pptx-ts 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +319 -0
  3. package/dist/autopage-DkjYZUFD.js +423 -0
  4. package/dist/autopage-DkjYZUFD.js.map +1 -0
  5. package/dist/browser.d.ts +31 -0
  6. package/dist/browser.d.ts.map +1 -0
  7. package/dist/browser.js +110 -0
  8. package/dist/browser.js.map +1 -0
  9. package/dist/diagnostics-Du_s75MT.d.ts +829 -0
  10. package/dist/diagnostics-Du_s75MT.d.ts.map +1 -0
  11. package/dist/enums-CvRYniUA.d.ts +463 -0
  12. package/dist/enums-CvRYniUA.d.ts.map +1 -0
  13. package/dist/errors-Bvln0H-7.js +112 -0
  14. package/dist/errors-Bvln0H-7.js.map +1 -0
  15. package/dist/errors-PflMPWBn.d.ts +182 -0
  16. package/dist/errors-PflMPWBn.d.ts.map +1 -0
  17. package/dist/fit-BKs0zxMI.js +1356 -0
  18. package/dist/fit-BKs0zxMI.js.map +1 -0
  19. package/dist/html-dom-B0I0QSbU.js +679 -0
  20. package/dist/html-dom-B0I0QSbU.js.map +1 -0
  21. package/dist/html.d.ts +26 -0
  22. package/dist/html.d.ts.map +1 -0
  23. package/dist/html.js +63 -0
  24. package/dist/html.js.map +1 -0
  25. package/dist/index.d.ts +24 -0
  26. package/dist/index.d.ts.map +1 -0
  27. package/dist/index.js +57 -0
  28. package/dist/index.js.map +1 -0
  29. package/dist/inspect.d.ts +197 -0
  30. package/dist/inspect.d.ts.map +1 -0
  31. package/dist/inspect.js +317 -0
  32. package/dist/inspect.js.map +1 -0
  33. package/dist/math.d.ts +37 -0
  34. package/dist/math.d.ts.map +1 -0
  35. package/dist/math.js +203 -0
  36. package/dist/math.js.map +1 -0
  37. package/dist/measure.d.ts +313 -0
  38. package/dist/measure.d.ts.map +1 -0
  39. package/dist/measure.js +3 -0
  40. package/dist/namespaces-BVnNu7sg.js +666 -0
  41. package/dist/namespaces-BVnNu7sg.js.map +1 -0
  42. package/dist/node.d.ts +20 -0
  43. package/dist/node.d.ts.map +1 -0
  44. package/dist/node.js +55 -0
  45. package/dist/node.js.map +1 -0
  46. package/dist/notes-RLCwdlTE.js +1703 -0
  47. package/dist/notes-RLCwdlTE.js.map +1 -0
  48. package/dist/package-CaOLXSNi.d.ts +193 -0
  49. package/dist/package-CaOLXSNi.d.ts.map +1 -0
  50. package/dist/pres-C5__xkDh.d.ts +202 -0
  51. package/dist/pres-C5__xkDh.d.ts.map +1 -0
  52. package/dist/presentation-Cp7vzlAw.js +5427 -0
  53. package/dist/presentation-Cp7vzlAw.js.map +1 -0
  54. package/dist/presentation-types-DP_8jog7.d.ts +4872 -0
  55. package/dist/presentation-types-DP_8jog7.d.ts.map +1 -0
  56. package/dist/read.d.ts +55 -0
  57. package/dist/read.d.ts.map +1 -0
  58. package/dist/read.js +4 -0
  59. package/dist/script.d.ts +581 -0
  60. package/dist/script.d.ts.map +1 -0
  61. package/dist/script.js +3741 -0
  62. package/dist/script.js.map +1 -0
  63. package/dist/shapes-BemroU-z.js +6951 -0
  64. package/dist/shapes-BemroU-z.js.map +1 -0
  65. package/dist/slide-js0QpRV-.d.ts +3873 -0
  66. package/dist/slide-js0QpRV-.d.ts.map +1 -0
  67. package/dist/text-CyetbF6p.js +11278 -0
  68. package/dist/text-CyetbF6p.js.map +1 -0
  69. package/dist/units-1kRzYShk.js +231 -0
  70. package/dist/units-1kRzYShk.js.map +1 -0
  71. package/dist/units-internal-Dg95w_YD.js +753 -0
  72. package/dist/units-internal-Dg95w_YD.js.map +1 -0
  73. package/dist/zip.d.ts +68 -0
  74. package/dist/zip.d.ts.map +1 -0
  75. package/dist/zip.js +163 -0
  76. package/dist/zip.js.map +1 -0
  77. package/package.json +152 -0
  78. package/skills/ts-pptx-upstream/SKILL.md +340 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"units-internal-Dg95w_YD.js","names":[],"sources":["../src/enums.ts","../src/constants-internal.ts","../src/units-internal.ts"],"sourcesContent":["/**\n * ts-pptx Enums\n * NOTE: `enum` wont work for objects, so use `Object.freeze`\n */\n\n/**\n * Output-type name accepted by the zip/write layer. Derived from the `OutputType`\n * enum (see below) so the two never drift: adding a member to the enum extends this\n * union automatically.\n */\nexport type ZIP_OUTPUT_TYPE = `${OutputType}`\nexport type WRITE_OUTPUT_TYPE = ZIP_OUTPUT_TYPE\n/**\n * Public chart-type name accepted by `addChart()`. Derived from the internal\n * `ChartType` enum (see below) so the two never drift: adding a member to the\n * enum extends this union automatically.\n */\nexport type CHART_NAME = `${ChartType}`\n/**\n * Public scheme-color name. Derived from the `SchemeColor` enum (see below) so the\n * two never drift.\n */\nexport type SCHEME_COLORS = `${SchemeColor}`\n\nexport enum TextAnchor {\n\tb = 'b',\n\tctr = 'ctr',\n\tt = 't',\n}\n\n// ENUM\nexport enum OutputType {\n\tarraybuffer = 'arraybuffer',\n\tbase64 = 'base64',\n\tbinarystring = 'binarystring',\n\tblob = 'blob',\n\tnodebuffer = 'nodebuffer',\n\tuint8array = 'uint8array',\n}\nexport enum ChartType {\n\tarea = 'area',\n\tbar = 'bar',\n\tbar3d = 'bar3D',\n\tbubble = 'bubble',\n\tbubble3d = 'bubble3D',\n\tdoughnut = 'doughnut',\n\tline = 'line',\n\tpie = 'pie',\n\tradar = 'radar',\n\tscatter = 'scatter',\n\tstock = 'stock',\n\tsurface = 'surface',\n\twaterfall = 'waterfall',\n\tfunnel = 'funnel',\n\ttreemap = 'treemap',\n\tsunburst = 'sunburst',\n\thistogram = 'histogram',\n\tpareto = 'pareto',\n\tboxWhisker = 'boxWhisker',\n\tregionMap = 'regionMap',\n}\nexport enum ShapeType {\n\taccentBorderCallout1 = 'accentBorderCallout1',\n\taccentBorderCallout2 = 'accentBorderCallout2',\n\taccentBorderCallout3 = 'accentBorderCallout3',\n\taccentCallout1 = 'accentCallout1',\n\taccentCallout2 = 'accentCallout2',\n\taccentCallout3 = 'accentCallout3',\n\tactionButtonBackPrevious = 'actionButtonBackPrevious',\n\tactionButtonBeginning = 'actionButtonBeginning',\n\tactionButtonBlank = 'actionButtonBlank',\n\tactionButtonDocument = 'actionButtonDocument',\n\tactionButtonEnd = 'actionButtonEnd',\n\tactionButtonForwardNext = 'actionButtonForwardNext',\n\tactionButtonHelp = 'actionButtonHelp',\n\tactionButtonHome = 'actionButtonHome',\n\tactionButtonInformation = 'actionButtonInformation',\n\tactionButtonMovie = 'actionButtonMovie',\n\tactionButtonReturn = 'actionButtonReturn',\n\tactionButtonSound = 'actionButtonSound',\n\tarc = 'arc',\n\tbentArrow = 'bentArrow',\n\tbentUpArrow = 'bentUpArrow',\n\tbevel = 'bevel',\n\tblockArc = 'blockArc',\n\tborderCallout1 = 'borderCallout1',\n\tborderCallout2 = 'borderCallout2',\n\tborderCallout3 = 'borderCallout3',\n\tbracePair = 'bracePair',\n\tbracketPair = 'bracketPair',\n\tcallout1 = 'callout1',\n\tcallout2 = 'callout2',\n\tcallout3 = 'callout3',\n\tcan = 'can',\n\tchartPlus = 'chartPlus',\n\tchartStar = 'chartStar',\n\tchartX = 'chartX',\n\tchevron = 'chevron',\n\tchord = 'chord',\n\tcircularArrow = 'circularArrow',\n\tcloud = 'cloud',\n\tcloudCallout = 'cloudCallout',\n\tcorner = 'corner',\n\tcornerTabs = 'cornerTabs',\n\tcube = 'cube',\n\tcurvedDownArrow = 'curvedDownArrow',\n\tcurvedLeftArrow = 'curvedLeftArrow',\n\tcurvedRightArrow = 'curvedRightArrow',\n\tcurvedUpArrow = 'curvedUpArrow',\n\tcustGeom = 'custGeom',\n\tdecagon = 'decagon',\n\tdiagStripe = 'diagStripe',\n\tdiamond = 'diamond',\n\tdodecagon = 'dodecagon',\n\tdonut = 'donut',\n\tdoubleWave = 'doubleWave',\n\tdownArrow = 'downArrow',\n\tdownArrowCallout = 'downArrowCallout',\n\tellipse = 'ellipse',\n\tellipseRibbon = 'ellipseRibbon',\n\tellipseRibbon2 = 'ellipseRibbon2',\n\tflowChartAlternateProcess = 'flowChartAlternateProcess',\n\tflowChartCollate = 'flowChartCollate',\n\tflowChartConnector = 'flowChartConnector',\n\tflowChartDecision = 'flowChartDecision',\n\tflowChartDelay = 'flowChartDelay',\n\tflowChartDisplay = 'flowChartDisplay',\n\tflowChartDocument = 'flowChartDocument',\n\tflowChartExtract = 'flowChartExtract',\n\tflowChartInputOutput = 'flowChartInputOutput',\n\tflowChartInternalStorage = 'flowChartInternalStorage',\n\tflowChartMagneticDisk = 'flowChartMagneticDisk',\n\tflowChartMagneticDrum = 'flowChartMagneticDrum',\n\tflowChartMagneticTape = 'flowChartMagneticTape',\n\tflowChartManualInput = 'flowChartManualInput',\n\tflowChartManualOperation = 'flowChartManualOperation',\n\tflowChartMerge = 'flowChartMerge',\n\tflowChartMultidocument = 'flowChartMultidocument',\n\tflowChartOfflineStorage = 'flowChartOfflineStorage',\n\tflowChartOffpageConnector = 'flowChartOffpageConnector',\n\tflowChartOnlineStorage = 'flowChartOnlineStorage',\n\tflowChartOr = 'flowChartOr',\n\tflowChartPredefinedProcess = 'flowChartPredefinedProcess',\n\tflowChartPreparation = 'flowChartPreparation',\n\tflowChartProcess = 'flowChartProcess',\n\tflowChartPunchedCard = 'flowChartPunchedCard',\n\tflowChartPunchedTape = 'flowChartPunchedTape',\n\tflowChartSort = 'flowChartSort',\n\tflowChartSummingJunction = 'flowChartSummingJunction',\n\tflowChartTerminator = 'flowChartTerminator',\n\tfoldedCorner = 'foldedCorner',\n\tframe = 'frame',\n\tfunnel = 'funnel',\n\tgear6 = 'gear6',\n\tgear9 = 'gear9',\n\thalfFrame = 'halfFrame',\n\theart = 'heart',\n\theptagon = 'heptagon',\n\thexagon = 'hexagon',\n\thomePlate = 'homePlate',\n\thorizontalScroll = 'horizontalScroll',\n\tirregularSeal1 = 'irregularSeal1',\n\tirregularSeal2 = 'irregularSeal2',\n\tleftArrow = 'leftArrow',\n\tleftArrowCallout = 'leftArrowCallout',\n\tleftBrace = 'leftBrace',\n\tleftBracket = 'leftBracket',\n\tleftCircularArrow = 'leftCircularArrow',\n\tleftRightArrow = 'leftRightArrow',\n\tleftRightArrowCallout = 'leftRightArrowCallout',\n\tleftRightCircularArrow = 'leftRightCircularArrow',\n\tleftRightRibbon = 'leftRightRibbon',\n\tleftRightUpArrow = 'leftRightUpArrow',\n\tleftUpArrow = 'leftUpArrow',\n\tlightningBolt = 'lightningBolt',\n\tline = 'line',\n\tlineInv = 'lineInv',\n\tmathDivide = 'mathDivide',\n\tmathEqual = 'mathEqual',\n\tmathMinus = 'mathMinus',\n\tmathMultiply = 'mathMultiply',\n\tmathNotEqual = 'mathNotEqual',\n\tmathPlus = 'mathPlus',\n\tmoon = 'moon',\n\tnoSmoking = 'noSmoking',\n\tnonIsoscelesTrapezoid = 'nonIsoscelesTrapezoid',\n\tnotchedRightArrow = 'notchedRightArrow',\n\toctagon = 'octagon',\n\tparallelogram = 'parallelogram',\n\tpentagon = 'pentagon',\n\tpie = 'pie',\n\tpieWedge = 'pieWedge',\n\tplaque = 'plaque',\n\tplaqueTabs = 'plaqueTabs',\n\tplus = 'plus',\n\tquadArrow = 'quadArrow',\n\tquadArrowCallout = 'quadArrowCallout',\n\trect = 'rect',\n\tribbon = 'ribbon',\n\tribbon2 = 'ribbon2',\n\trightArrow = 'rightArrow',\n\trightArrowCallout = 'rightArrowCallout',\n\trightBrace = 'rightBrace',\n\trightBracket = 'rightBracket',\n\tround1Rect = 'round1Rect',\n\tround2DiagRect = 'round2DiagRect',\n\tround2SameRect = 'round2SameRect',\n\troundRect = 'roundRect',\n\trtTriangle = 'rtTriangle',\n\tsmileyFace = 'smileyFace',\n\tsnip1Rect = 'snip1Rect',\n\tsnip2DiagRect = 'snip2DiagRect',\n\tsnip2SameRect = 'snip2SameRect',\n\tsnipRoundRect = 'snipRoundRect',\n\tsquareTabs = 'squareTabs',\n\tstar10 = 'star10',\n\tstar12 = 'star12',\n\tstar16 = 'star16',\n\tstar24 = 'star24',\n\tstar32 = 'star32',\n\tstar4 = 'star4',\n\tstar5 = 'star5',\n\tstar6 = 'star6',\n\tstar7 = 'star7',\n\tstar8 = 'star8',\n\tstripedRightArrow = 'stripedRightArrow',\n\tsun = 'sun',\n\tswooshArrow = 'swooshArrow',\n\tteardrop = 'teardrop',\n\ttrapezoid = 'trapezoid',\n\ttriangle = 'triangle',\n\tupArrow = 'upArrow',\n\tupArrowCallout = 'upArrowCallout',\n\tupDownArrow = 'upDownArrow',\n\tupDownArrowCallout = 'upDownArrowCallout',\n\tuturnArrow = 'uturnArrow',\n\tverticalScroll = 'verticalScroll',\n\twave = 'wave',\n\twedgeEllipseCallout = 'wedgeEllipseCallout',\n\twedgeRectCallout = 'wedgeRectCallout',\n\twedgeRoundRectCallout = 'wedgeRoundRectCallout',\n}\nexport enum SchemeColor {\n\ttext1 = 'tx1',\n\ttext2 = 'tx2',\n\tbackground1 = 'bg1',\n\tbackground2 = 'bg2',\n\taccent1 = 'accent1',\n\taccent2 = 'accent2',\n\taccent3 = 'accent3',\n\taccent4 = 'accent4',\n\taccent5 = 'accent5',\n\taccent6 = 'accent6',\n}\nexport enum AlignH {\n\tleft = 'left',\n\tcenter = 'center',\n\tright = 'right',\n\tjustify = 'justify',\n}\nexport enum AlignV {\n\ttop = 'top',\n\tmiddle = 'middle',\n\tbottom = 'bottom',\n}\n\nexport type SHAPE_NAME =\n\t| 'accentBorderCallout1'\n\t| 'accentBorderCallout2'\n\t| 'accentBorderCallout3'\n\t| 'accentCallout1'\n\t| 'accentCallout2'\n\t| 'accentCallout3'\n\t| 'actionButtonBackPrevious'\n\t| 'actionButtonBeginning'\n\t| 'actionButtonBlank'\n\t| 'actionButtonDocument'\n\t| 'actionButtonEnd'\n\t| 'actionButtonForwardNext'\n\t| 'actionButtonHelp'\n\t| 'actionButtonHome'\n\t| 'actionButtonInformation'\n\t| 'actionButtonMovie'\n\t| 'actionButtonReturn'\n\t| 'actionButtonSound'\n\t| 'arc'\n\t| 'bentArrow'\n\t| 'bentUpArrow'\n\t| 'bevel'\n\t| 'blockArc'\n\t| 'borderCallout1'\n\t| 'borderCallout2'\n\t| 'borderCallout3'\n\t| 'bracePair'\n\t| 'bracketPair'\n\t| 'callout1'\n\t| 'callout2'\n\t| 'callout3'\n\t| 'can'\n\t| 'chartPlus'\n\t| 'chartStar'\n\t| 'chartX'\n\t| 'chevron'\n\t| 'chord'\n\t| 'circularArrow'\n\t| 'cloud'\n\t| 'cloudCallout'\n\t| 'corner'\n\t| 'cornerTabs'\n\t| 'cube'\n\t| 'curvedDownArrow'\n\t| 'curvedLeftArrow'\n\t| 'curvedRightArrow'\n\t| 'curvedUpArrow'\n\t| 'custGeom'\n\t| 'decagon'\n\t| 'diagStripe'\n\t| 'diamond'\n\t| 'dodecagon'\n\t| 'donut'\n\t| 'doubleWave'\n\t| 'downArrow'\n\t| 'downArrowCallout'\n\t| 'ellipse'\n\t| 'ellipseRibbon'\n\t| 'ellipseRibbon2'\n\t| 'flowChartAlternateProcess'\n\t| 'flowChartCollate'\n\t| 'flowChartConnector'\n\t| 'flowChartDecision'\n\t| 'flowChartDelay'\n\t| 'flowChartDisplay'\n\t| 'flowChartDocument'\n\t| 'flowChartExtract'\n\t| 'flowChartInputOutput'\n\t| 'flowChartInternalStorage'\n\t| 'flowChartMagneticDisk'\n\t| 'flowChartMagneticDrum'\n\t| 'flowChartMagneticTape'\n\t| 'flowChartManualInput'\n\t| 'flowChartManualOperation'\n\t| 'flowChartMerge'\n\t| 'flowChartMultidocument'\n\t| 'flowChartOfflineStorage'\n\t| 'flowChartOffpageConnector'\n\t| 'flowChartOnlineStorage'\n\t| 'flowChartOr'\n\t| 'flowChartPredefinedProcess'\n\t| 'flowChartPreparation'\n\t| 'flowChartProcess'\n\t| 'flowChartPunchedCard'\n\t| 'flowChartPunchedTape'\n\t| 'flowChartSort'\n\t| 'flowChartSummingJunction'\n\t| 'flowChartTerminator'\n\t| 'foldedCorner'\n\t| 'frame'\n\t| 'funnel'\n\t| 'gear6'\n\t| 'gear9'\n\t| 'halfFrame'\n\t| 'heart'\n\t| 'heptagon'\n\t| 'hexagon'\n\t| 'homePlate'\n\t| 'horizontalScroll'\n\t| 'irregularSeal1'\n\t| 'irregularSeal2'\n\t| 'leftArrow'\n\t| 'leftArrowCallout'\n\t| 'leftBrace'\n\t| 'leftBracket'\n\t| 'leftCircularArrow'\n\t| 'leftRightArrow'\n\t| 'leftRightArrowCallout'\n\t| 'leftRightCircularArrow'\n\t| 'leftRightRibbon'\n\t| 'leftRightUpArrow'\n\t| 'leftUpArrow'\n\t| 'lightningBolt'\n\t| 'line'\n\t| 'lineInv'\n\t| 'mathDivide'\n\t| 'mathEqual'\n\t| 'mathMinus'\n\t| 'mathMultiply'\n\t| 'mathNotEqual'\n\t| 'mathPlus'\n\t| 'moon'\n\t| 'noSmoking'\n\t| 'nonIsoscelesTrapezoid'\n\t| 'notchedRightArrow'\n\t| 'octagon'\n\t| 'parallelogram'\n\t| 'pentagon'\n\t| 'pie'\n\t| 'pieWedge'\n\t| 'plaque'\n\t| 'plaqueTabs'\n\t| 'plus'\n\t| 'quadArrow'\n\t| 'quadArrowCallout'\n\t| 'rect'\n\t| 'ribbon'\n\t| 'ribbon2'\n\t| 'rightArrow'\n\t| 'rightArrowCallout'\n\t| 'rightBrace'\n\t| 'rightBracket'\n\t| 'round1Rect'\n\t| 'round2DiagRect'\n\t| 'round2SameRect'\n\t| 'roundRect'\n\t| 'rtTriangle'\n\t| 'smileyFace'\n\t| 'snip1Rect'\n\t| 'snip2DiagRect'\n\t| 'snip2SameRect'\n\t| 'snipRoundRect'\n\t| 'squareTabs'\n\t| 'star10'\n\t| 'star12'\n\t| 'star16'\n\t| 'star24'\n\t| 'star32'\n\t| 'star4'\n\t| 'star5'\n\t| 'star6'\n\t| 'star7'\n\t| 'star8'\n\t| 'stripedRightArrow'\n\t| 'sun'\n\t| 'swooshArrow'\n\t| 'teardrop'\n\t| 'trapezoid'\n\t| 'triangle'\n\t| 'upArrow'\n\t| 'upArrowCallout'\n\t| 'upDownArrow'\n\t| 'upDownArrowCallout'\n\t| 'uturnArrow'\n\t| 'verticalScroll'\n\t| 'wave'\n\t| 'wedgeEllipseCallout'\n\t| 'wedgeRectCallout'\n\t| 'wedgeRoundRectCallout'\n\t| CONNECTOR_PRESET_NAME\n\n/**\n * Valid ECMA-376 `ST_ShapeType` presets that are not surfaced with a friendly\n * `ShapeType` name. They are still legal geometries PowerPoint renders, so the\n * preset-validation set must accept them.\n */\nconst EXTRA_SHAPE_PRESETS = [\n\t'straightConnector1',\n\t'bentConnector2',\n\t'bentConnector3',\n\t'bentConnector4',\n\t'bentConnector5',\n\t'curvedConnector2',\n\t'curvedConnector3',\n\t'curvedConnector4',\n\t'curvedConnector5',\n] as const\n\n/**\n * Connector preset geometries (`straightConnector1` / `bentConnector{2-5}` /\n * `curvedConnector{2-5}`) that `addShape` can serialize but that are not surfaced\n * as friendly `ShapeType` names. Derived from `EXTRA_SHAPE_PRESETS` so the public\n * `SHAPE_NAME` union and the runtime `VALID_SHAPE_PRESETS` set share one source of\n * truth and cannot drift. Use `addConnector` for live, endpoint-bound connectors;\n * pass these to `addShape` for a static box-positioned connector geometry.\n */\nexport type CONNECTOR_PRESET_NAME = (typeof EXTRA_SHAPE_PRESETS)[number]\n\n/**\n * Every shape geometry name ts-pptx can serialize without corrupting the\n * package: the OOXML preset geometries (`ST_ShapeType` — `ShapeType` values\n * plus the unexposed connectors above) and `custGeom` (freeform paths, emitted\n * as `<a:custGeom>` rather than `<a:prstGeom>`). Used to reject bogus presets\n * before they become an invalid `<a:prstGeom prst=\"...\">` that triggers\n * PowerPoint's \"needs repair\" dialog and drops the shape.\n */\nexport const VALID_SHAPE_PRESETS: ReadonlySet<string> = new Set<string>([\n\t...Object.values(ShapeType),\n\t...EXTRA_SHAPE_PRESETS,\n])\n\n/**\n * Narrow a public `CHART_NAME` to the internal `ChartType` enum. Because\n * `CHART_NAME` is derived from `ChartType`, every `CHART_NAME` value is by\n * construction a valid enum value, so this conversion is total and safe — it is\n * the single boundary cast that lets internal code compare against the enum\n * (enum-to-enum) instead of enum-to-string.\n */\nexport function asChartType(name: CHART_NAME): ChartType {\n\treturn name as ChartType\n}\n\n/** Every {@link ChartType} value, for validating a caller-supplied `type` at the API boundary. */\nconst CHART_TYPES: ReadonlySet<string> = new Set<string>(Object.values(ChartType))\n\n/**\n * Is `name` a chart type this library emits?\n *\n * `CHART_NAME` constrains TypeScript callers, but `addChart` is reachable from plain JavaScript\n * where nothing enforces the union — and the two emitters partition the catalog between them by\n * `switch`, so an off-catalog string has no arm in either and cannot produce a plot. Checked once\n * at define time (`gen/define/chart.ts`) so the caller hears about it at the call that was wrong,\n * rather than getting a chart-shaped hole in the deck.\n */\nexport function isChartType(name: unknown): name is CHART_NAME {\n\treturn typeof name === 'string' && CHART_TYPES.has(name)\n}\n\n/**\n * The chartEx (`cx:` / Office 2016 chart-extension) chart types. Unlike the classic 2007 catalog\n * these do NOT emit a `<c:chartSpace>` chart part: they emit a separate `chartEx{N}.xml` part in\n * the `http://schemas.microsoft.com/office/drawing/2014/chartex` namespace, are referenced from\n * the slide through `<mc:AlternateContent>`, and render only in PowerPoint 2016+/Microsoft 365\n * (older Office, Google Slides, Keynote and LibreOffice show the `<mc:Fallback>` shape instead).\n * See `gen/chart/chartex-xml.ts`.\n */\nconst CHARTEX_TYPES: ReadonlySet<string> = new Set<string>([\n\tChartType.waterfall,\n\tChartType.funnel,\n\tChartType.treemap,\n\tChartType.sunburst,\n\tChartType.histogram,\n\tChartType.pareto,\n\tChartType.boxWhisker,\n\tChartType.regionMap,\n])\n\n/**\n * Is `type` a chartEx (cx:) chart? Accepts a `ChartType`/`CHART_NAME` string; anything else —\n * including a combo-chart `ChartMulti[]` array or `undefined` — is not a chartEx type (combos are\n * classic-only), so those return `false`.\n */\nexport function isChartExType(type: unknown): boolean {\n\treturn typeof type === 'string' && CHARTEX_TYPES.has(type)\n}\n\nexport enum SlideObjectType {\n\tchart = 'chart',\n\tconnector = 'connector',\n\tgroup = 'group',\n\thyperlink = 'hyperlink',\n\timage = 'image',\n\tmedia = 'media',\n\tmodel3d = 'model3d',\n\toleObject = 'oleObject',\n\tonline = 'online',\n\tplaceholder = 'placeholder',\n\ttable = 'table',\n\ttablecell = 'tablecell',\n\ttext = 'text',\n\tnotes = 'notes',\n\tzoom = 'zoom',\n}\n\n/**\n * Maps a friendly `ConnectorType` to its OOXML connector preset *family*. `straight`\n * has a single fixed preset; `elbow` and `curved` select a member by bend count\n * (`bentConnector{3,4,5}` / `curvedConnector{3,4,5}`) — see `connectorPresetFor`.\n */\nexport const CONNECTOR_PRESETS = {\n\tstraight: 'straightConnector1',\n\telbow: 'bentConnector',\n\tcurved: 'curvedConnector',\n} as const satisfies Record<'straight' | 'elbow' | 'curved', string>\n\n/**\n * Resolve the concrete connector preset geometry name for a `type` + bend count.\n * `straight` ignores `bends` (it has no adjustable jog). For `elbow` / `curved`, the\n * preset suffix is `bends + 2`, so `bends` of 1/2/3 maps to `…Connector3/4/5`, each\n * of which exposes exactly `bends` adjustable guides (`adj1…adjN`).\n * @param {'straight' | 'elbow' | 'curved'} type - friendly connector routing style\n * @param {number} bends - number of adjustable bends (1–3); ignored for `straight`\n * @return {CONNECTOR_PRESET_NAME} OOXML preset geometry name (e.g. `bentConnector4`)\n */\nexport function connectorPresetFor(type: 'straight' | 'elbow' | 'curved', bends: number): CONNECTOR_PRESET_NAME {\n\tif (type === 'straight') return CONNECTOR_PRESETS.straight\n\treturn `${CONNECTOR_PRESETS[type]}${bends + 2}` as CONNECTOR_PRESET_NAME\n}\nexport enum PlaceholderType {\n\ttitle = 'title',\n\tbody = 'body',\n\timage = 'pic',\n\tchart = 'chart',\n\ttable = 'tbl',\n\tmedia = 'media',\n}\n/**\n * Placeholder-type name. Derived from the `PlaceholderType` enum (above) so the two\n * never drift.\n */\nexport type PLACEHOLDER_TYPE = `${PlaceholderType}`\n\n/**\n * Bullet glyph presets. Only `DEFAULT` is currently wired through to output; the remaining entries are\n * reserved and not yet selectable via options.\n */\nexport enum BulletType {\n\tDEFAULT = '&#x2022;',\n\tCHECK = '&#x2713;',\n\tSTAR = '&#x2605;',\n\tTRIANGLE = '&#x25B6;',\n}\n\n/**\n * Built-in PowerPoint table style IDs.\n *\n * Each value is the GUID that goes into `<a:tableStyleId>` inside `<a:tblPr>`.\n * These 74 GUIDs are the complete set defined in [MS-OE376] §5.1.6.10 and are\n * resolved by PowerPoint without embedding any style definition in the file.\n *\n * Only these enum members are supported. Raw GUID strings are not accepted;\n * use `TableStyle` members exclusively.\n */\nexport enum TableStyle {\n\t// ── No style ────────────────────────────────────────────────────────────\n\tNO_STYLE_NO_GRID = '{2D5ABB26-0587-4C30-8999-92F81FD0307C}',\n\tNO_STYLE_TABLE_GRID = '{5940675A-B579-460E-94D1-54222C63F5DA}',\n\n\t// ── Themed Style 1 ──────────────────────────────────────────────────────\n\tTHEMED_STYLE_1_ACCENT_1 = '{3C2FFA5D-87B4-456A-9821-1D502468CF0F}',\n\tTHEMED_STYLE_1_ACCENT_2 = '{284E427A-3D55-4303-BF80-6455036E1DE7}',\n\tTHEMED_STYLE_1_ACCENT_3 = '{69C7853C-536D-4A76-A0AE-DD22124D55A5}',\n\tTHEMED_STYLE_1_ACCENT_4 = '{775DCB02-9BB8-47FD-8907-85C794F793BA}',\n\tTHEMED_STYLE_1_ACCENT_5 = '{35758FB7-9AC5-4552-8A53-C91805E547FA}',\n\tTHEMED_STYLE_1_ACCENT_6 = '{08FB837D-C827-4EFA-A057-4D05807E0F7C}',\n\n\t// ── Themed Style 2 ──────────────────────────────────────────────────────\n\tTHEMED_STYLE_2_ACCENT_1 = '{D113A9D2-9D6B-4929-AA2D-F23B5EE8CBE7}',\n\tTHEMED_STYLE_2_ACCENT_2 = '{18603FDC-E32A-4AB5-989C-0864C3EAD2B8}',\n\tTHEMED_STYLE_2_ACCENT_3 = '{306799F8-075E-4A3A-A7F6-7FBC6576F1A4}',\n\tTHEMED_STYLE_2_ACCENT_4 = '{E269D01E-BC32-4049-B463-5C60D7B0CCD2}',\n\tTHEMED_STYLE_2_ACCENT_5 = '{327F97BB-C833-4FB7-BDE5-3F7075034690}',\n\tTHEMED_STYLE_2_ACCENT_6 = '{638B1855-1B75-4FBE-930C-398BA8C253C6}',\n\n\t// ── Light Style 1 ───────────────────────────────────────────────────────\n\tLIGHT_STYLE_1 = '{9D7B26C5-4107-4FEC-AEDC-1716B250A1EF}',\n\tLIGHT_STYLE_1_ACCENT_1 = '{3B4B98B0-60AC-42C2-AFA5-B58CD77FA1E5}',\n\tLIGHT_STYLE_1_ACCENT_2 = '{0E3FDE45-AF77-4B5C-9715-49D594BDF05E}',\n\tLIGHT_STYLE_1_ACCENT_3 = '{C083E6E3-FA7D-4D7B-A595-EF9225AFEA82}',\n\tLIGHT_STYLE_1_ACCENT_4 = '{D27102A9-8310-4765-A935-A1911B00CA55}',\n\tLIGHT_STYLE_1_ACCENT_5 = '{5FD0F851-EC5A-4D38-B0AD-8093EC10F338}',\n\tLIGHT_STYLE_1_ACCENT_6 = '{68D230F3-CF80-4859-8CE7-A43EE81993B5}',\n\n\t// ── Light Style 2 ───────────────────────────────────────────────────────\n\tLIGHT_STYLE_2 = '{7E9639D4-E3E2-4D34-9284-5A2195B3D0D7}',\n\tLIGHT_STYLE_2_ACCENT_1 = '{69012ECD-51FC-41F1-AA8D-1B2483CD663E}',\n\tLIGHT_STYLE_2_ACCENT_2 = '{72833802-FEF1-4C79-8D5D-14CF1EAF98D9}',\n\tLIGHT_STYLE_2_ACCENT_3 = '{F2DE63D5-997A-4646-A377-4702673A728D}',\n\tLIGHT_STYLE_2_ACCENT_4 = '{17292A2E-F333-43FB-9621-5CBBE7FDCDCB}',\n\tLIGHT_STYLE_2_ACCENT_5 = '{5A111915-BE36-4E01-A7E5-04B1672EAD32}',\n\tLIGHT_STYLE_2_ACCENT_6 = '{912C8C85-51F0-491E-9774-3900AFEF0FD7}',\n\n\t// ── Light Style 3 ───────────────────────────────────────────────────────\n\tLIGHT_STYLE_3 = '{616DA210-FB5B-4158-B5E0-FEB733F419BA}',\n\tLIGHT_STYLE_3_ACCENT_1 = '{BC89EF96-8CEA-46FF-86C4-4CE0E7609802}',\n\tLIGHT_STYLE_3_ACCENT_2 = '{5DA37D80-6434-44D0-A028-1B22A696006F}',\n\tLIGHT_STYLE_3_ACCENT_3 = '{8799B23B-EC83-4686-B30A-512413B5E67A}',\n\tLIGHT_STYLE_3_ACCENT_4 = '{ED083AE6-46FA-4A59-8FB0-9F97EB10719F}',\n\tLIGHT_STYLE_3_ACCENT_5 = '{BDBED569-4797-4DF1-A0F4-6AAB3CD982D8}',\n\tLIGHT_STYLE_3_ACCENT_6 = '{E8B1032C-EA38-4F05-BA0D-38AFFFC7BED3}',\n\n\t// ── Medium Style 1 ──────────────────────────────────────────────────────\n\tMEDIUM_STYLE_1 = '{793D81CF-94F2-401A-BA57-92F5A7B2D0C5}',\n\tMEDIUM_STYLE_1_ACCENT_1 = '{B301B821-A1FF-4177-AEE7-76D212191A09}',\n\tMEDIUM_STYLE_1_ACCENT_2 = '{9DCAF9ED-07DC-4A11-8D7F-57B35C25682E}',\n\tMEDIUM_STYLE_1_ACCENT_3 = '{1FECB4D8-DB02-4DC6-A0A2-4F2EBAE1DC90}',\n\tMEDIUM_STYLE_1_ACCENT_4 = '{1E171933-4619-4E11-9A3F-F7608DF75F80}',\n\tMEDIUM_STYLE_1_ACCENT_5 = '{FABFCF23-3B69-468F-B69F-88F6DE6A72F2}',\n\tMEDIUM_STYLE_1_ACCENT_6 = '{10A1B5D5-9B99-4C35-A422-299274C87663}',\n\n\t// ── Medium Style 2 ──────────────────────────────────────────────────────\n\tMEDIUM_STYLE_2 = '{073A0DAA-6AF3-43AB-8588-CEC1D06C72B9}',\n\tMEDIUM_STYLE_2_ACCENT_1 = '{5C22544A-7EE6-4342-B048-85BDC9FD1C3A}',\n\tMEDIUM_STYLE_2_ACCENT_2 = '{21E4AEA4-8DFA-4A89-87EB-49C32662AFE0}',\n\tMEDIUM_STYLE_2_ACCENT_3 = '{F5AB1C69-6EDB-4FF4-983F-18BD219EF322}',\n\tMEDIUM_STYLE_2_ACCENT_4 = '{00A15C55-8517-42AA-B614-E9B94910E393}',\n\tMEDIUM_STYLE_2_ACCENT_5 = '{7DF18680-E054-41AD-8BC1-D1AEF772440D}',\n\tMEDIUM_STYLE_2_ACCENT_6 = '{93296810-A885-4BE3-A3E7-6D5BEEA58F35}',\n\n\t// ── Medium Style 3 ──────────────────────────────────────────────────────\n\tMEDIUM_STYLE_3 = '{8EC20E35-A176-4012-BC5E-935CFFF8708E}',\n\tMEDIUM_STYLE_3_ACCENT_1 = '{6E25E649-3F16-4E02-A733-19D2CDBF48F0}',\n\tMEDIUM_STYLE_3_ACCENT_2 = '{85BE263C-DBD7-4A20-BB59-AAB30ACAA65A}',\n\tMEDIUM_STYLE_3_ACCENT_3 = '{EB344D84-9AFB-497E-A393-DC336BA19D2E}',\n\tMEDIUM_STYLE_3_ACCENT_4 = '{EB9631B5-78F2-41C9-869B-9F39066F8104}',\n\tMEDIUM_STYLE_3_ACCENT_5 = '{74C1A8A3-306A-4EB7-A6B1-4F7E0EB9C5D6}',\n\tMEDIUM_STYLE_3_ACCENT_6 = '{2A488322-F2BA-4B5B-9748-0D474271808F}',\n\n\t// ── Medium Style 4 ──────────────────────────────────────────────────────\n\tMEDIUM_STYLE_4 = '{D7AC3CCA-C797-4891-BE02-D94E43425B78}',\n\tMEDIUM_STYLE_4_ACCENT_1 = '{69CF1AB2-1976-4502-BF36-3FF5EA218861}',\n\tMEDIUM_STYLE_4_ACCENT_2 = '{8A107856-5554-42FB-B03E-39F5DBC370BA}',\n\tMEDIUM_STYLE_4_ACCENT_3 = '{0505E3EF-67EA-436B-97B2-0124C06EBD24}',\n\tMEDIUM_STYLE_4_ACCENT_4 = '{C4B1156A-380E-4F78-BDF5-A606A8083BF9}',\n\tMEDIUM_STYLE_4_ACCENT_5 = '{22838BEF-8BB2-4498-84A7-C5851F593DF1}',\n\tMEDIUM_STYLE_4_ACCENT_6 = '{16D9F66E-5EB9-4882-86FB-DCBF35E3C3E4}',\n\n\t// ── Dark Style 1 ────────────────────────────────────────────────────────\n\tDARK_STYLE_1 = '{E8034E78-7F5D-4C2E-B375-FC64B27BC917}',\n\tDARK_STYLE_1_ACCENT_1 = '{125E5076-3810-47DD-B79F-674D7AD40C01}',\n\tDARK_STYLE_1_ACCENT_2 = '{37CE84F3-28C3-443E-9E96-99CF82512B78}',\n\tDARK_STYLE_1_ACCENT_3 = '{D03447BB-5D67-496B-8E87-E561075AD55C}',\n\tDARK_STYLE_1_ACCENT_4 = '{E929F9F4-4A8F-4326-A1B4-22849713DDAB}',\n\tDARK_STYLE_1_ACCENT_5 = '{8FD4443E-F989-4FC4-A0C8-D5A2AF1F390B}',\n\tDARK_STYLE_1_ACCENT_6 = '{AF606853-7671-496A-8E4F-DF71F8EC918B}',\n\n\t// ── Dark Style 2 ────────────────────────────────────────────────────────\n\tDARK_STYLE_2 = '{5202B0CA-FC54-4496-8BCA-5EF66A818D29}',\n\t/** Header uses Accent 2, body rows use Accent 1 */\n\tDARK_STYLE_2_ACCENT_1_ACCENT_2 = '{0660B408-B3CF-4A94-85FC-2B1E0A45F4A2}',\n\t/** Header uses Accent 4, body rows use Accent 3 */\n\tDARK_STYLE_2_ACCENT_3_ACCENT_4 = '{91EBBBCC-DAD2-459C-BE2E-F6DE35CF9A28}',\n\t/** Header uses Accent 6, body rows use Accent 5 */\n\tDARK_STYLE_2_ACCENT_5_ACCENT_6 = '{46F890A9-2807-4EBB-B81D-B2AA78EC7F39}',\n}\n","/**\n * Generator-internal constants — the non-published half of the enums module.\n *\n * `enums.ts` holds the genuinely public surface (the `ChartType`/`ShapeType`/\n * `SchemeColor`/`AlignH`… enums, the shape-preset sets, and the `*_NAME` unions) and is\n * `export *`-ed by every entrypoint. This module holds the constants only the generators\n * need — default styling, fixed axis/field ids, colour palettes, layout bases, and the\n * base64 placeholder images — none of which are part of the public API. Splitting them out\n * keeps `export *` from leaking them onto the package surface, mirroring the\n * `units-internal.ts` / `types/internal.ts` split. Nothing here is exported from an entrypoint.\n */\n\nimport type { BorderProps, OptsChartGridLine } from './types/index.js'\nimport type { ShadowPropsInternal } from './types/internal.js'\n\n// CONST\nexport const CRLF = '\\r\\n' // AKA: Chr(13) & Chr(10)\n// Base for `<p:sldLayoutId id>` (layout N gets BASE + N). 2147483649 = 0x80000001:\n// ECMA-376 ST_SlideLayoutId requires id >= 0x80000000, and PowerPoint conventionally\n// starts layout IDs one past that. See `makeXmlMaster` in `gen/slide/master.ts`.\nexport const LAYOUT_IDX_SERIES_BASE = 2147483649\nexport const REGEX_HEX_COLOR = /^[0-9a-fA-F]{6}$/\nexport const LINEH_MODIFIER = 1.67 // AKA: Golden Ratio Typography\n\nexport const DEF_BULLET_MARGIN = 27\nexport const DEF_CELL_BORDER: BorderProps = { type: 'solid', color: '666666', width: 1 }\nexport const DEF_CELL_MARGIN_IN: [number, number, number, number] = [0.05, 0.1, 0.05, 0.1] // \"Normal\" margins in PPT-2021 (\"Narrow\" is `0.05` for all 4)\nexport const DEF_CHART_BORDER: BorderProps = { type: 'solid', color: '363636', width: 1 }\nexport const DEF_CHART_GRIDLINE: OptsChartGridLine = { color: '888888', style: 'solid', size: 1, cap: 'flat' }\nexport const DEF_FONT_COLOR = '000000'\nexport const DEF_FONT_SIZE = 12\nexport const DEF_FONT_TITLE_SIZE = 18\nexport const DEF_PRES_LAYOUT = 'LAYOUT_16x9'\nexport const DEF_PRES_LAYOUT_NAME = 'DEFAULT'\nexport const DEF_SHAPE_LINE_COLOR = '333333'\nexport const DEF_SHAPE_SHADOW: ShadowPropsInternal = {\n\ttype: 'outer',\n\tblur: 3,\n\toffset: 23000 / 12700,\n\tangle: 90,\n\tcolor: '000000',\n\t_alpha: 0.35,\n\trotateWithShape: true,\n}\nexport const DEF_SLIDE_MARGIN_IN: [number, number, number, number] = [0.5, 0.5, 0.5, 0.5] // TRBL-style\nexport const DEF_TEXT_SHADOW: ShadowPropsInternal = {\n\ttype: 'outer',\n\tblur: 8,\n\toffset: 4,\n\tangle: 270,\n\tcolor: '000000',\n\t_alpha: 0.75,\n}\nexport const DEF_TEXT_GLOW = { size: 8, color: 'FFFFFF', opacity: 0.75 }\n\n// Fixed `<c:axId val>` identifiers that wire each chart's axes together (e.g. a value\n// axis's `<c:crossAx>` points at its category axis by id). ECMA-376 only requires the id\n// be a unique unsigned int within the chart; these stable constants keep the emitted\n// cross-references deterministic across decks. Consumed throughout `gen/chart/`.\nexport const AXIS_ID_VALUE_PRIMARY = '2094734552'\nexport const AXIS_ID_VALUE_SECONDARY = '2094734553'\nexport const AXIS_ID_CATEGORY_PRIMARY = '2094734554'\nexport const AXIS_ID_CATEGORY_SECONDARY = '2094734555'\nexport const AXIS_ID_SERIES_PRIMARY = '2094734556'\n\nexport const LETTERS: string[] = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.split('')\n// The default series palettes hold their distinct entries once. Every consumer reaches them\n// through `paletteColor()` (`gen/chart/chart-parts.ts`), which wraps back to the start, so a\n// chart with more series or points than the palette has entries repeats it rather than\n// running off the end.\nexport const BARCHART_COLORS: string[] = [\n\t'C0504D',\n\t'4F81BD',\n\t'9BBB59',\n\t'8064A2',\n\t'4BACC6',\n\t'F79646',\n\t'628FC6',\n\t'C86360',\n]\nexport const PIECHART_COLORS: string[] = [\n\t'5DA5DA',\n\t'FAA43A',\n\t'60BD68',\n\t'F17CB0',\n\t'B2912F',\n\t'B276B2',\n\t'DECF3F',\n\t'F15854',\n\t'A7A7A7',\n]\n\n// Fixed GUID PowerPoint stamps on a slide-number field: `<a:fld id=\"{...}\" type=\"slidenum\">`.\n// Microsoft-specific (not defined by ECMA-376); reused verbatim so PowerPoint recognizes the\n// field and auto-updates the page number. Consumed in `gen/slide/object.ts` (`slideObjectToXml`).\nexport const SLDNUMFLDID = '{F7021451-1387-4CA6-816F-3879F97B5CBC}'\n\n// Cached text of a slide-number field on a part that has no slide number of its own — a master\n// or a layout. Guillemets around a hash, which is verbatim what PowerPoint caches there: every\n// en-US master and layout in `test/read/fixtures/` writes `<a:t>‹#›</a:t>`. (A German-locale\n// deck writes `‹Nr.›`; the cache is recomputed on open, so the en-US spelling is the one to\n// emit rather than a per-locale table.) Consumed in `gen/slide/object.ts`.\nexport const SLDNUM_PLACEHOLDER_TEXT = '‹#›'\n\n// The XML prolog every emitted OOXML part begins with. Kept as one constant so a\n// stray edit can't desync one part's declaration from the rest.\nexport const XML_DECL = '<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>'\n","/**\n * Generator-side unit conversion — the lenient layer over `units.ts`.\n *\n * `units.ts` holds the strict, public primitives: one branded `Emu` type and converters that\n * take a number and throw on anything they cannot represent. This module holds what the\n * generators actually need on top of that: converters that accept the loose shapes the\n * authoring API has always accepted (numeric strings, `\"5in\"`, `null`), that clamp to the\n * ranges PowerPoint will load without offering to repair the file, and that warn about legacy\n * inputs instead of failing.\n *\n * The split is deliberate: the leniency and the back-compat warnings are policy, not\n * arithmetic, and policy should not be part of the published API. Nothing here is exported\n * from an entrypoint.\n */\n\nimport { warn, warnOnce } from './diagnostics.js'\nimport { InvalidOptionError } from './errors.js'\nimport {\n\tEMU_PER_INCH,\n\tEMU_PER_POINT,\n\tANGLE_UNITS_PER_DEGREE,\n\tcoordToEmu,\n\tFIXED_PCT_PER_PERCENT,\n\tinchesToEmu,\n\tPERCENT_SCALE,\n\ttype Emu,\n} from './units.js'\nimport type { Coord, PresLayout } from './types/index.js'\n\n/**\n * Resolve a user `Coord` (x/y/w/h) to EMU — the single user-coordinate → EMU boundary.\n * - bare `number` → **inches** (no magnitude guessing); `\"<n>%\"` → percent of the slide axis;\n * `\"<n>in\"`/`\"<n>pt\"`/`\"<n>emu\"` → explicit units (see {@link Coord} / {@link coordToEmu})\n * - `null`/`undefined` → 0 (callers may omit a coordinate)\n * - throws on a non-finite number rather than silently collapsing the object to zero size\n * @param {Coord|null|undefined} size - user coordinate\n * @param {'X' | 'Y'} xyDir - axis (selects slide width vs height for percentages)\n * @param {PresLayout} layout - presentation layout (EMU dimensions)\n * @returns {Emu} resolved EMU value\n */\nexport function getSmartParseNumber(size: Coord | null | undefined, xyDir: 'X' | 'Y', layout: PresLayout): Emu {\n\tif (size === null || size === undefined) return 0 as Emu\n\n\t// GUARD: A NaN/Infinity coordinate is always a mistake (commonly arithmetic on an\n\t// `undefined` layout dimension). Fail loud with a targeted hint instead of the generic\n\t// converter message, since this is the most common way a deck collapses to zero-size.\n\tif (typeof size === 'number' && !isFinite(size)) {\n\t\tthrow new InvalidOptionError(\n\t\t\t'coord/non-finite',\n\t\t\t`Invalid ${xyDir || 'coordinate'} value: expected a finite number but received ${String(size)}. ` +\n\t\t\t\t'This usually means a layout dimension was read from a missing property (e.g. `layout.width` returning `undefined`). ' +\n\t\t\t\t'Use `slide.width`/`slide.height` or `STANDARD_LAYOUTS.<NAME>.width`/`.height` (inches).'\n\t\t)\n\t}\n\n\treturn coordToEmu(size, xyDir === 'Y' ? layout.height : layout.width)\n}\n\n/**\n * Convert inches into EMU.\n * - accepts a number (inches) or a numeric/`\"<n>in\"` string\n * - no magnitude guessing: values are always treated as inches (use {@link coordToEmu} for\n * user coordinates that may carry other units)\n * @param {number|string} inches - inches as number or string\n * @returns {Emu} EMU value\n */\nexport function inch2Emu(inches: number | string): Emu {\n\tif (typeof inches === 'string') inches = Number(inches.replace(/in*/gi, ''))\n\treturn inchesToEmu(inches)\n}\n\n/**\n * Convert a single `margin` component (table cell/table margin, or text-box/placeholder body\n * inset) to EMU.\n *\n * Margins are INCHES, consistent with the positional API (`x`/`y`/`w`/`h`) and the value\n * PowerPoint's own dialog shows (both the table cell-margin and the text-box internal-margin\n * fields are inches). Historically the library read these as POINTS (table cells used a magnitude\n * heuristic — `>= 1` points, `< 1` inches; text-box margins were straight points), so a legitimate\n * fraction-of-an-inch value entered from the PowerPoint dialog became a tiny points value. Every\n * value is now inches. A `>= 1` value is honored as inches but warns once, because it is almost\n * certainly a legacy points value that should be divided by 72 (e.g. `10` points → `0.139` inches).\n *\n * Shared by every margin site so they stay in lockstep: the cell XML emitter and text-box/slide-\n * number insets (`gen/slide/object.ts`), the autoPage row-height pass (`gen/table/autopage.ts`), and the measured-fit pass\n * (`measure-fit`).\n * @param {number} inches - margin component in inches\n * @returns {Emu} EMU value\n */\nexport function marginToEmu(inches: number): Emu {\n\tif (inches >= 1)\n\t\twarnOnce(\n\t\t\t'margin/legacy-points',\n\t\t\t'margins (table cell and text-box) are interpreted as inches (matching the rest of the API and the ' +\n\t\t\t\t'PowerPoint dialog); a value >= 1 is likely a legacy points value — divide by 72 to convert (e.g. 10pt => 0.139in).'\n\t\t)\n\treturn inch2Emu(inches)\n}\n\n/**\n * Resolve a table's column widths to EMU, the single source of truth shared by the\n * table XML emitter and the measured-fit pass (so a fitted cell sees the same grid\n * the renderer draws).\n * - an explicit `colW` **array** is per-column inches (`inch2Emu`); a non-finite slot\n * falls back to the even-distribution width\n * - otherwise the table's already-resolved width (`totalWidthEmu`, EMU) is split evenly\n * across `colCount` columns. (A scalar `colW` never reaches here — `addTableDefinition`\n * converts it to `w` and clears `colW`.)\n *\n * IMPORTANT: the even path divides an **EMU** width. Passing the raw inches `options.w`\n * instead (the historical bug) produced ~0-EMU columns (e.g. `w=9` → `gridCol w=\"3\"`),\n * collapsing auto-width tables to a sliver in PowerPoint/LibreOffice.\n * @param {Coord[]|Coord|undefined} colW - explicit per-column inches, or scalar/undefined\n * @param {number} totalWidthEmu - the table's resolved width in EMU\n * @param {number} colCount - number of grid columns (counting colspans)\n * @returns {number[]} per-column widths in EMU (length `colCount`)\n */\nexport function resolveTableColWidthsEmu(\n\tcolW: Coord[] | Coord | undefined,\n\ttotalWidthEmu: number,\n\tcolCount: number\n): number[] {\n\tif (!(colCount > 0)) return []\n\tconst even = totalWidthEmu > 0 ? Math.round(totalWidthEmu / colCount) : EMU_PER_INCH\n\tif (Array.isArray(colW)) {\n\t\treturn Array.from({ length: colCount }, (_, i) => {\n\t\t\t// Guard before inch2Emu: it throws on non-finite input. A missing/NaN slot\n\t\t\t// falls back to the even-distribution width.\n\t\t\tconst n = colW[i]\n\t\t\treturn typeof n === 'number' && Number.isFinite(n) ? Math.round(inch2Emu(n)) : even\n\t\t})\n\t}\n\treturn new Array<number>(colCount).fill(even)\n}\n\n/**\n * Convert points to EMU, leniently: anything that does not read as a finite number — a `NaN`,\n * an `Infinity`, a non-numeric string, `null` — becomes `0` rather than throwing.\n *\n * That is the whole difference from {@link pointsToEmu} in `units.ts`, which throws on the same\n * input. Emitters use this one for the many optional size/width/offset options where a missing\n * or malformed value should collapse the feature (a zero-width line, no shadow offset) rather\n * than take the whole deck down.\n *\n * @param pt - points, as a number or a numeric string\n * @returns the value in EMU, or `0` if it does not read as a finite number\n */\nexport function ptsToEmuLenient(pt: number | string): number {\n\tconst points = Number(pt)\n\treturn Number.isFinite(points) ? Math.round(points * EMU_PER_POINT) : 0\n}\n\n/**\n * Convert a transparency percentage (0-100) into a schema-valid `<a:alpha>` value\n * (ST_PositiveFixedPercentage, 0-100000). Out-of-range transparency yields an\n * alpha that PowerPoint rejects as needing repair, so clamp into range and warn.\n */\nexport function transparencyToAlpha(transparency: number): number {\n\tconst pct = Math.min(100, Math.max(0, transparency))\n\tif (pct !== transparency)\n\t\twarn('transparency/out-of-range', `transparency ${transparency} is outside the valid range 0-100; using ${pct}.`)\n\treturn Math.round((100 - pct) * FIXED_PCT_PER_PERCENT)\n}\n\n/** Convert an opacity (0-1) into a schema-valid `<a:alpha>` value (0-100000); clamps + warns on out-of-range input. */\nexport function opacityToAlpha(opacity: number): number {\n\tconst o = Math.min(1, Math.max(0, opacity))\n\tif (o !== opacity) warn('opacity/out-of-range', `opacity ${opacity} is outside the valid range 0-1; using ${o}.`)\n\treturn Math.round(o * PERCENT_SCALE)\n}\n\n/**\n * Convert a line width (points) to EMU clamped into ST_LineWidth (0..20116800 EMU,\n * i.e. 0-1584pt). Out-of-range widths make PowerPoint report the package as needing\n * repair, so clamp into range and warn.\n */\nexport function lineWidthToEmu(widthPts: number | string): number {\n\tconst raw = ptsToEmuLenient(widthPts)\n\tconst clamped = Math.min(20116800, Math.max(0, raw))\n\tif (clamped !== raw)\n\t\twarn(\n\t\t\t'line/width-out-of-range',\n\t\t\t`line width ${widthPts} is outside the valid range 0-1584pt; using ${clamped / EMU_PER_POINT}.`\n\t\t)\n\treturn clamped\n}\n\n/**\n * Convert degrees to a DrawingML angle (60000ths of a degree), **without** wrapping.\n *\n * Most angles in the format are not modular: a connection site at 400 degrees, a polar adjust\n * handle whose range runs to 540, an arc that sweeps 400 degrees — each means something a\n * reduction into 0..360 would destroy. Use this for those, and {@link convertRotationDegrees}\n * for the ones that genuinely are a rotation.\n *\n * Non-finite input throws rather than reaching the attribute: `Math.round(Infinity * 60000)` is\n * `Infinity`, which serializes as `ang=\"Infinity\"` and makes PowerPoint offer to repair the file.\n *\n * @param d - degrees\n * @param what - what is being converted, for the error message\n * @param code - diagnostic code to throw under, where a caller has a more specific one\n */\nexport function convertAngleUnits(d: number, what: string, code: AngleErrorCode = 'coord/non-finite'): number {\n\tassertFiniteDegrees(d, what, code)\n\treturn Math.round(d * ANGLE_UNITS_PER_DEGREE)\n}\n\n/** The codes {@link convertAngleUnits} may throw under, each declared in `codes.ts`. */\ntype AngleErrorCode = 'coord/non-finite' | 'geometry/arc-angle-non-finite'\n\nfunction assertFiniteDegrees(d: number, what: string, code: AngleErrorCode): void {\n\tif (typeof d !== 'number' || !Number.isFinite(d))\n\t\tthrow new InvalidOptionError(code, `${what} must be a finite number of degrees; received ${String(d)}.`)\n}\n\n/**\n * Convert a shape or gradient rotation (degrees) to a DrawingML angle (60000ths of a degree).\n *\n * A rotation *is* modular — 800 degrees and 80 degrees point the same way — so the value is\n * reduced with `% 360`. The reduction keeps the sign: `-45` stays `-45` rather than becoming\n * `315`, because both are valid `ST_Angle`, PowerPoint writes negative rotations itself, and\n * the read side reports back what was authored. Only an input outside -360..360 moves.\n *\n * @param d - degrees\n * @returns the `rot` value in 60000ths of a degree\n */\nexport function convertRotationDegrees(d: number): number {\n\tconst degrees = d || 0\n\t// Guard before reducing, so `Infinity` is reported as itself rather than as the `NaN` that\n\t// `Infinity % 360` would hand on.\n\tassertFiniteDegrees(degrees, 'rotation', 'coord/non-finite')\n\treturn Math.round((degrees % 360) * ANGLE_UNITS_PER_DEGREE)\n}\n\n/**\n * Convert a freeform arc angle (degrees) to an `<a:arcTo>` ST_AdjAngle value (60000ths).\n * Unlike a shape rotation, a sweep is not modular: a 400 degree swAng draws a different\n * arc than a 40 degree one, so the value is never wrapped into 0..360.\n * @param {number} d degrees\n * @param {'stAng' | 'swAng'} attr - attribute being emitted, for the error message\n * @returns {number} ST_AdjAngle value (60000ths of a degree)\n */\nexport function convertArcAngle(d: number, attr: 'stAng' | 'swAng'): number {\n\treturn convertAngleUnits(d, `Arc ${attr}`, 'geometry/arc-angle-non-finite')\n}\n"],"mappings":";;;AAwBA,IAAY,aAAL,yBAAA,YAAA;CACN,WAAA,OAAA;CACA,WAAA,SAAA;CACA,WAAA,OAAA;;AACD,EAAA,CAAA,CAAA;AAGA,IAAY,aAAL,yBAAA,YAAA;CACN,WAAA,iBAAA;CACA,WAAA,YAAA;CACA,WAAA,kBAAA;CACA,WAAA,UAAA;CACA,WAAA,gBAAA;CACA,WAAA,gBAAA;;AACD,EAAA,CAAA,CAAA;AACA,IAAY,YAAL,yBAAA,WAAA;CACN,UAAA,UAAA;CACA,UAAA,SAAA;CACA,UAAA,WAAA;CACA,UAAA,YAAA;CACA,UAAA,cAAA;CACA,UAAA,cAAA;CACA,UAAA,UAAA;CACA,UAAA,SAAA;CACA,UAAA,WAAA;CACA,UAAA,aAAA;CACA,UAAA,WAAA;CACA,UAAA,aAAA;CACA,UAAA,eAAA;CACA,UAAA,YAAA;CACA,UAAA,aAAA;CACA,UAAA,cAAA;CACA,UAAA,eAAA;CACA,UAAA,YAAA;CACA,UAAA,gBAAA;CACA,UAAA,eAAA;;AACD,EAAA,CA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W,MAAiC;CAC3E,OAAO,kBAAkB,GAAG,OAAO,QAAQ,+BAA+B;AAC3E"}
package/dist/zip.d.ts ADDED
@@ -0,0 +1,68 @@
1
+ import { b as ZIP_OUTPUT_TYPE } from "./enums-CvRYniUA.js";
2
+ import { a as TsPptxError, d as InvalidOptionErrorCode, f as MediaErrorCode, h as UnsupportedFeatureErrorCode, i as PackageReadError, l as ErrorCode, m as TsPptxCode, n as InvalidOptionError, o as TsPptxErrorOptions, p as PackageReadErrorCode, r as MediaError, s as UnsupportedFeatureError, t as InternalError, u as InternalErrorCode } from "./errors-PflMPWBn.js";
3
+ //#region src/zip.d.ts
4
+ declare class ZipWriter {
5
+ #private;
6
+ /**
7
+ * Add a package part.
8
+ * @param path - full zip path, e.g. `ppt/slides/slide1.xml`
9
+ * @param data - XML string (UTF-8 encoded) or already-decoded bytes (media)
10
+ * @param opts.store - skip DEFLATE for this entry (already-compressed media)
11
+ */
12
+ add(path: string, data: string | Uint8Array, opts?: {
13
+ store?: boolean;
14
+ }): void;
15
+ /**
16
+ * Snapshot the accumulated entries in insertion order, before zipping. Each
17
+ * entry carries its already-encoded bytes and whether it was added with
18
+ * `store` (recovered from the per-entry level). This is the seam the
19
+ * package-parts path reads: the same accumulator {@link generate} would zip,
20
+ * exposed without running DEFLATE. Every value in `#entries` is the
21
+ * `[bytes, opts]` tuple {@link add} writes, so the cast is total.
22
+ */
23
+ entries(): Array<{
24
+ path: string;
25
+ data: Uint8Array;
26
+ store: boolean;
27
+ }>;
28
+ /**
29
+ * Compress all accumulated entries to raw zip bytes.
30
+ * @param compression - false stores every entry uncompressed (level 0)
31
+ */
32
+ toBytes(compression?: boolean): Uint8Array;
33
+ /**
34
+ * Finalize the archive in the requested output shape.
35
+ * @param type - one of the supported {@link ZIP_OUTPUT_TYPE} output shapes
36
+ * @param opts.compression - false stores every entry uncompressed
37
+ */
38
+ generate(type: ZIP_OUTPUT_TYPE, opts: {
39
+ compression: boolean;
40
+ }): Promise<string | ArrayBuffer | Blob | Uint8Array>;
41
+ }
42
+ /**
43
+ * Inputs the read path accepts. A `string` is a **filesystem path** (Node) read
44
+ * from disk; in-memory archives are passed as `Uint8Array`/`ArrayBuffer`/`Blob`/
45
+ * `number[]`. A `Promise` wrapper is allowed so callers can forward an unawaited
46
+ * byte source.
47
+ *
48
+ * Note: unlike JSZip's `loadAsync`, a string is NOT a latin1 binary-content
49
+ * string. That JSZip-compat interpretation was a footgun — every real consumer
50
+ * passes a path, and a path silently became garbage bytes → "Not a valid ZIP
51
+ * archive". To read a `binarystring`/`base64` write-path output back in, convert
52
+ * it to bytes first (e.g. `Uint8Array.from(atob(b64), c => c.charCodeAt(0))`).
53
+ */
54
+ type ZipInputValue = string | number[] | Uint8Array | ArrayBuffer | Blob;
55
+ type ZipInput = ZipInputValue | Promise<ZipInputValue>;
56
+ /**
57
+ * Decompress a zip archive to a `path → bytes` map in central-directory order.
58
+ *
59
+ * Read-path counterpart to {@link ZipWriter}: fflate's `unzipSync` needs a
60
+ * `Uint8Array`, so the JSZip-style input auto-detection that `loadAsync` did is
61
+ * reproduced by {@link toUint8Array} first. Directory markers (keys ending in
62
+ * `/`) are dropped — fflate surfaces them but no consumer wants empty-dir
63
+ * entries, and the write path emits none.
64
+ */
65
+ declare function readZip(input: ZipInput): Promise<Map<string, Uint8Array>>;
66
+ //#endregion
67
+ export { type ErrorCode, InternalError, type InternalErrorCode, InvalidOptionError, type InvalidOptionErrorCode, MediaError, type MediaErrorCode, PackageReadError, type PackageReadErrorCode, type TsPptxCode, TsPptxError, type TsPptxErrorOptions, UnsupportedFeatureError, type UnsupportedFeatureErrorCode, ZipInput, ZipWriter, readZip };
68
+ //# sourceMappingURL=zip.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zip.d.ts","names":[],"sources":["../src/zip.ts"],"mappings":";;;cAwBa;;;;;;;;EASZ,IAAI,cAAc,eAAe,YAAY;IAAS;;;;;;;;;;EAgBtD,WAAW;IAAQ;IAAc,MAAM;IAAY;;;;;;EAWnD,QAAQ,wBAAqB;;;;;;EAUvB,SACL,MAAM,iBACN;IAAQ;MACN,iBAAiB,cAAc,OAAO;;;;;;;;;;;;;;KAkBrC,oCAAoC,aAAa,cAAc;KACxD,WAAW,gBAAgB,QAAQ;;;;;;;;;;iBAWzB,QAAQ,OAAO,WAAW,QAAQ,YAAY"}
package/dist/zip.js ADDED
@@ -0,0 +1,163 @@
1
+ import { a as TsPptxError, i as PackageReadError, n as InvalidOptionError, o as UnsupportedFeatureError, r as MediaError, t as InternalError } from "./errors-Bvln0H-7.js";
2
+ import { strToU8, unzipSync, zipSync } from "fflate";
3
+ //#region src/zip.ts
4
+ /**
5
+ * ZIP backend seam for the write path.
6
+ *
7
+ * fflate is functional — one `{path: bytes}` map in, one `Uint8Array` out — so
8
+ * every contact with the backend is isolated here rather than spread across the
9
+ * incremental builder calls the JSZip API encouraged. Callers accumulate entries
10
+ * with {@link ZipWriter.add} (strings are UTF-8 encoded; already-decoded media
11
+ * passes bytes directly) and finalize with {@link ZipWriter.generate}, which maps
12
+ * fflate's single `Uint8Array` to the requested output shape.
13
+ *
14
+ * Unlike JSZip there is no folder/directory concept: keys are full slash-paths and
15
+ * fflate emits no directory entries, so the package carries only real parts.
16
+ */
17
+ /**
18
+ * Fixed modification time (2001-01-01 UTC) stamped on every entry so archive
19
+ * bytes are reproducible across runs. fflate encodes DOS dates, which are bounded
20
+ * to 1980-2099, so 0/epoch is not usable here.
21
+ */
22
+ const FIXED_MTIME = Date.UTC(2001, 0, 1);
23
+ var ZipWriter = class {
24
+ #entries = {};
25
+ /**
26
+ * Add a package part.
27
+ * @param path - full zip path, e.g. `ppt/slides/slide1.xml`
28
+ * @param data - XML string (UTF-8 encoded) or already-decoded bytes (media)
29
+ * @param opts.store - skip DEFLATE for this entry (already-compressed media)
30
+ */
31
+ add(path, data, opts) {
32
+ const bytes = typeof data === "string" ? strToU8(data) : data;
33
+ const fileOpts = { mtime: FIXED_MTIME };
34
+ if (opts?.store) fileOpts.level = 0;
35
+ this.#entries[path] = [bytes, fileOpts];
36
+ }
37
+ /**
38
+ * Snapshot the accumulated entries in insertion order, before zipping. Each
39
+ * entry carries its already-encoded bytes and whether it was added with
40
+ * `store` (recovered from the per-entry level). This is the seam the
41
+ * package-parts path reads: the same accumulator {@link generate} would zip,
42
+ * exposed without running DEFLATE. Every value in `#entries` is the
43
+ * `[bytes, opts]` tuple {@link add} writes, so the cast is total.
44
+ */
45
+ entries() {
46
+ return Object.entries(this.#entries).map(([path, value]) => {
47
+ const [bytes, fileOpts] = value;
48
+ return {
49
+ path,
50
+ data: bytes,
51
+ store: fileOpts.level === 0
52
+ };
53
+ });
54
+ }
55
+ /**
56
+ * Compress all accumulated entries to raw zip bytes.
57
+ * @param compression - false stores every entry uncompressed (level 0)
58
+ */
59
+ toBytes(compression = true) {
60
+ return zipSync(this.#entries, {
61
+ level: compression ? 6 : 0,
62
+ mtime: FIXED_MTIME
63
+ });
64
+ }
65
+ /**
66
+ * Finalize the archive in the requested output shape.
67
+ * @param type - one of the supported {@link ZIP_OUTPUT_TYPE} output shapes
68
+ * @param opts.compression - false stores every entry uncompressed
69
+ */
70
+ async generate(type, opts) {
71
+ return convertZipOutput(this.toBytes(opts.compression), type);
72
+ }
73
+ };
74
+ /**
75
+ * Decompress a zip archive to a `path → bytes` map in central-directory order.
76
+ *
77
+ * Read-path counterpart to {@link ZipWriter}: fflate's `unzipSync` needs a
78
+ * `Uint8Array`, so the JSZip-style input auto-detection that `loadAsync` did is
79
+ * reproduced by {@link toUint8Array} first. Directory markers (keys ending in
80
+ * `/`) are dropped — fflate surfaces them but no consumer wants empty-dir
81
+ * entries, and the write path emits none.
82
+ */
83
+ async function readZip(input) {
84
+ const bytes = await toUint8Array(input);
85
+ let entries;
86
+ try {
87
+ entries = unzipSync(bytes);
88
+ } catch (cause) {
89
+ throw new PackageReadError("zip/not-a-zip-archive", "Not a valid ZIP archive", { cause });
90
+ }
91
+ const out = /* @__PURE__ */ new Map();
92
+ for (const [path, body] of Object.entries(entries)) {
93
+ if (path.endsWith("/")) continue;
94
+ out.set(path, body);
95
+ }
96
+ return out;
97
+ }
98
+ /**
99
+ * Normalize a read-path input to `Uint8Array`: a `Buffer`/`Uint8Array` passes
100
+ * through, `ArrayBuffer`/`Blob`/`number[]` are copied/wrapped, and a `string` is
101
+ * a **filesystem path** read from disk (Node). See {@link ZipInput} for why a
102
+ * string is a path rather than JSZip's latin1 binary-content string.
103
+ */
104
+ async function toUint8Array(input) {
105
+ const data = await input;
106
+ if (data instanceof Uint8Array) return data;
107
+ if (data instanceof ArrayBuffer) return new Uint8Array(data);
108
+ if (typeof data === "string") return readFileAsBytes(data);
109
+ if (Array.isArray(data)) return Uint8Array.from(data);
110
+ if (typeof Blob !== "undefined" && data instanceof Blob) return new Uint8Array(await data.arrayBuffer());
111
+ throw new InvalidOptionError("zip/unsupported-input", "Unsupported zip input type; expected a filesystem path (string), number[], Uint8Array, ArrayBuffer, or Blob");
112
+ }
113
+ /**
114
+ * Read a `.pptx` (or any zip) from a filesystem path into bytes. Node-only:
115
+ * `node:fs` is imported lazily so the browser build stays free of a Node
116
+ * dependency, and a missing filesystem (browser) or missing file both throw a
117
+ * clear error naming the path — never the opaque "Not a valid ZIP archive".
118
+ */
119
+ async function readFileAsBytes(filePath) {
120
+ let readFile;
121
+ try {
122
+ ({readFile} = await import("node:fs/promises"));
123
+ } catch {
124
+ throw new UnsupportedFeatureError("zip/filesystem-unavailable", `Cannot read zip from path "${filePath}": filesystem access requires Node. Pass a Uint8Array/ArrayBuffer/Blob for an in-memory archive.`);
125
+ }
126
+ try {
127
+ return new Uint8Array(await readFile(filePath));
128
+ } catch (cause) {
129
+ throw new PackageReadError("zip/file-read-failed", `Cannot read .pptx at "${filePath}": ${cause.message}`, { cause });
130
+ }
131
+ }
132
+ const PPTX_MIME = "application/vnd.openxmlformats-officedocument.presentationml.presentation";
133
+ /** Map fflate's `Uint8Array` to the requested {@link ZIP_OUTPUT_TYPE} output shape. */
134
+ function convertZipOutput(bytes, type) {
135
+ switch (type) {
136
+ case "uint8array": return bytes;
137
+ case "arraybuffer": {
138
+ const out = new ArrayBuffer(bytes.byteLength);
139
+ new Uint8Array(out).set(bytes);
140
+ return out;
141
+ }
142
+ case "nodebuffer": return Buffer.from(bytes);
143
+ case "blob": return new Blob([new Uint8Array(bytes)], { type: PPTX_MIME });
144
+ case "base64": return bytesToBinaryString(bytes, true);
145
+ case "binarystring": return bytesToBinaryString(bytes, false);
146
+ default: throw new InvalidOptionError("zip/unsupported-output", `Unsupported zip output type: ${String(type)}`);
147
+ }
148
+ }
149
+ /**
150
+ * Build a latin1 binary string from bytes (chunked to dodge the argument-count
151
+ * limit of `String.fromCharCode(...spread)` on large archives), optionally
152
+ * base64-encoding it. `btoa` is isomorphic (Node and browsers).
153
+ */
154
+ function bytesToBinaryString(bytes, base64) {
155
+ let binary = "";
156
+ const CHUNK = 32768;
157
+ for (let i = 0; i < bytes.length; i += CHUNK) binary += String.fromCharCode(...bytes.subarray(i, i + CHUNK));
158
+ return base64 ? btoa(binary) : binary;
159
+ }
160
+ //#endregion
161
+ export { InternalError, InvalidOptionError, MediaError, PackageReadError, TsPptxError, UnsupportedFeatureError, ZipWriter, readZip };
162
+
163
+ //# sourceMappingURL=zip.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zip.js","names":["#entries","exhaustive"],"sources":["../src/zip.ts"],"sourcesContent":["import { strToU8, unzipSync, zipSync, type Unzipped, type Zippable, type ZipOptions } from 'fflate'\nimport type { ZIP_OUTPUT_TYPE } from './enums.js'\nimport { InvalidOptionError, PackageReadError, UnsupportedFeatureError } from './errors.js'\n\n/**\n * ZIP backend seam for the write path.\n *\n * fflate is functional — one `{path: bytes}` map in, one `Uint8Array` out — so\n * every contact with the backend is isolated here rather than spread across the\n * incremental builder calls the JSZip API encouraged. Callers accumulate entries\n * with {@link ZipWriter.add} (strings are UTF-8 encoded; already-decoded media\n * passes bytes directly) and finalize with {@link ZipWriter.generate}, which maps\n * fflate's single `Uint8Array` to the requested output shape.\n *\n * Unlike JSZip there is no folder/directory concept: keys are full slash-paths and\n * fflate emits no directory entries, so the package carries only real parts.\n */\n/**\n * Fixed modification time (2001-01-01 UTC) stamped on every entry so archive\n * bytes are reproducible across runs. fflate encodes DOS dates, which are bounded\n * to 1980-2099, so 0/epoch is not usable here.\n */\nconst FIXED_MTIME = Date.UTC(2001, 0, 1)\n\nexport class ZipWriter {\n\treadonly #entries: Zippable = {}\n\n\t/**\n\t * Add a package part.\n\t * @param path - full zip path, e.g. `ppt/slides/slide1.xml`\n\t * @param data - XML string (UTF-8 encoded) or already-decoded bytes (media)\n\t * @param opts.store - skip DEFLATE for this entry (already-compressed media)\n\t */\n\tadd(path: string, data: string | Uint8Array, opts?: { store?: boolean }): void {\n\t\tconst bytes = typeof data === 'string' ? strToU8(data) : data\n\t\t// Pin mtime so archive bytes are reproducible across runs (stable fixtures).\n\t\tconst fileOpts: ZipOptions = { mtime: FIXED_MTIME }\n\t\tif (opts?.store) fileOpts.level = 0\n\t\tthis.#entries[path] = [bytes, fileOpts]\n\t}\n\n\t/**\n\t * Snapshot the accumulated entries in insertion order, before zipping. Each\n\t * entry carries its already-encoded bytes and whether it was added with\n\t * `store` (recovered from the per-entry level). This is the seam the\n\t * package-parts path reads: the same accumulator {@link generate} would zip,\n\t * exposed without running DEFLATE. Every value in `#entries` is the\n\t * `[bytes, opts]` tuple {@link add} writes, so the cast is total.\n\t */\n\tentries(): Array<{ path: string; data: Uint8Array; store: boolean }> {\n\t\treturn Object.entries(this.#entries).map(([path, value]) => {\n\t\t\tconst [bytes, fileOpts] = value as [Uint8Array, ZipOptions]\n\t\t\treturn { path, data: bytes, store: fileOpts.level === 0 }\n\t\t})\n\t}\n\n\t/**\n\t * Compress all accumulated entries to raw zip bytes.\n\t * @param compression - false stores every entry uncompressed (level 0)\n\t */\n\ttoBytes(compression = true): Uint8Array {\n\t\t// Global level is the per-entry default; entries added with `store` keep their level 0.\n\t\treturn zipSync(this.#entries, { level: compression ? 6 : 0, mtime: FIXED_MTIME })\n\t}\n\n\t/**\n\t * Finalize the archive in the requested output shape.\n\t * @param type - one of the supported {@link ZIP_OUTPUT_TYPE} output shapes\n\t * @param opts.compression - false stores every entry uncompressed\n\t */\n\tasync generate(\n\t\ttype: ZIP_OUTPUT_TYPE,\n\t\topts: { compression: boolean }\n\t): Promise<string | ArrayBuffer | Blob | Uint8Array> {\n\t\tconst bytes = this.toBytes(opts.compression)\n\t\treturn convertZipOutput(bytes, type)\n\t}\n}\n\n/**\n * Inputs the read path accepts. A `string` is a **filesystem path** (Node) read\n * from disk; in-memory archives are passed as `Uint8Array`/`ArrayBuffer`/`Blob`/\n * `number[]`. A `Promise` wrapper is allowed so callers can forward an unawaited\n * byte source.\n *\n * Note: unlike JSZip's `loadAsync`, a string is NOT a latin1 binary-content\n * string. That JSZip-compat interpretation was a footgun — every real consumer\n * passes a path, and a path silently became garbage bytes → \"Not a valid ZIP\n * archive\". To read a `binarystring`/`base64` write-path output back in, convert\n * it to bytes first (e.g. `Uint8Array.from(atob(b64), c => c.charCodeAt(0))`).\n */\ntype ZipInputValue = string | number[] | Uint8Array | ArrayBuffer | Blob\nexport type ZipInput = ZipInputValue | Promise<ZipInputValue>\n\n/**\n * Decompress a zip archive to a `path → bytes` map in central-directory order.\n *\n * Read-path counterpart to {@link ZipWriter}: fflate's `unzipSync` needs a\n * `Uint8Array`, so the JSZip-style input auto-detection that `loadAsync` did is\n * reproduced by {@link toUint8Array} first. Directory markers (keys ending in\n * `/`) are dropped — fflate surfaces them but no consumer wants empty-dir\n * entries, and the write path emits none.\n */\nexport async function readZip(input: ZipInput): Promise<Map<string, Uint8Array>> {\n\tconst bytes = await toUint8Array(input)\n\tlet entries: Unzipped\n\ttry {\n\t\tentries = unzipSync(bytes)\n\t} catch (cause) {\n\t\tthrow new PackageReadError('zip/not-a-zip-archive', 'Not a valid ZIP archive', { cause })\n\t}\n\tconst out = new Map<string, Uint8Array>()\n\tfor (const [path, body] of Object.entries(entries)) {\n\t\tif (path.endsWith('/')) continue\n\t\tout.set(path, body)\n\t}\n\treturn out\n}\n\n/**\n * Normalize a read-path input to `Uint8Array`: a `Buffer`/`Uint8Array` passes\n * through, `ArrayBuffer`/`Blob`/`number[]` are copied/wrapped, and a `string` is\n * a **filesystem path** read from disk (Node). See {@link ZipInput} for why a\n * string is a path rather than JSZip's latin1 binary-content string.\n */\nasync function toUint8Array(input: ZipInput): Promise<Uint8Array> {\n\tconst data = await input\n\tif (data instanceof Uint8Array) return data\n\tif (data instanceof ArrayBuffer) return new Uint8Array(data)\n\tif (typeof data === 'string') return readFileAsBytes(data)\n\tif (Array.isArray(data)) return Uint8Array.from(data)\n\tif (typeof Blob !== 'undefined' && data instanceof Blob) return new Uint8Array(await data.arrayBuffer())\n\tthrow new InvalidOptionError(\n\t\t'zip/unsupported-input',\n\t\t'Unsupported zip input type; expected a filesystem path (string), number[], Uint8Array, ArrayBuffer, or Blob'\n\t)\n}\n\n/**\n * Read a `.pptx` (or any zip) from a filesystem path into bytes. Node-only:\n * `node:fs` is imported lazily so the browser build stays free of a Node\n * dependency, and a missing filesystem (browser) or missing file both throw a\n * clear error naming the path — never the opaque \"Not a valid ZIP archive\".\n */\nasync function readFileAsBytes(filePath: string): Promise<Uint8Array> {\n\tlet readFile: (typeof import('node:fs/promises'))['readFile']\n\ttry {\n\t\t;({ readFile } = await import('node:fs/promises'))\n\t} catch {\n\t\tthrow new UnsupportedFeatureError(\n\t\t\t'zip/filesystem-unavailable',\n\t\t\t`Cannot read zip from path \"${filePath}\": filesystem access requires Node. ` +\n\t\t\t\t'Pass a Uint8Array/ArrayBuffer/Blob for an in-memory archive.'\n\t\t)\n\t}\n\ttry {\n\t\treturn new Uint8Array(await readFile(filePath))\n\t} catch (cause) {\n\t\tthrow new PackageReadError(\n\t\t\t'zip/file-read-failed',\n\t\t\t`Cannot read .pptx at \"${filePath}\": ${(cause as Error).message}`,\n\t\t\t{\n\t\t\t\tcause,\n\t\t\t}\n\t\t)\n\t}\n}\n\nconst PPTX_MIME = 'application/vnd.openxmlformats-officedocument.presentationml.presentation'\n\n/** Map fflate's `Uint8Array` to the requested {@link ZIP_OUTPUT_TYPE} output shape. */\nfunction convertZipOutput(bytes: Uint8Array, type: ZIP_OUTPUT_TYPE): string | ArrayBuffer | Blob | Uint8Array {\n\tswitch (type) {\n\t\tcase 'uint8array':\n\t\t\treturn bytes\n\t\tcase 'arraybuffer': {\n\t\t\t// Copy into a fresh (non-shared) ArrayBuffer; fflate's output buffer is\n\t\t\t// typed ArrayBufferLike, which may be a SharedArrayBuffer.\n\t\t\tconst out = new ArrayBuffer(bytes.byteLength)\n\t\t\tnew Uint8Array(out).set(bytes)\n\t\t\treturn out\n\t\t}\n\t\tcase 'nodebuffer':\n\t\t\t// Buffer.from(Uint8Array) copies, so the result owns its memory.\n\t\t\treturn Buffer.from(bytes)\n\t\tcase 'blob':\n\t\t\t// Copy into an ArrayBuffer-backed view so it is a valid BlobPart.\n\t\t\treturn new Blob([new Uint8Array(bytes)], { type: PPTX_MIME })\n\t\tcase 'base64':\n\t\t\treturn bytesToBinaryString(bytes, true)\n\t\tcase 'binarystring':\n\t\t\treturn bytesToBinaryString(bytes, false)\n\t\tdefault: {\n\t\t\tconst exhaustive: never = type\n\t\t\tthrow new InvalidOptionError('zip/unsupported-output', `Unsupported zip output type: ${String(exhaustive)}`)\n\t\t}\n\t}\n}\n\n/**\n * Build a latin1 binary string from bytes (chunked to dodge the argument-count\n * limit of `String.fromCharCode(...spread)` on large archives), optionally\n * base64-encoding it. `btoa` is isomorphic (Node and browsers).\n */\nfunction bytesToBinaryString(bytes: Uint8Array, base64: boolean): string {\n\tlet binary = ''\n\tconst CHUNK = 0x8000\n\tfor (let i = 0; i < bytes.length; i += CHUNK) {\n\t\tbinary += String.fromCharCode(...bytes.subarray(i, i + CHUNK))\n\t}\n\treturn base64 ? btoa(binary) : binary\n}\n\n// Error taxonomy — see `entry-errors.ts`. Re-exported from every entry so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AACD;;;;;;AAOA,SAAS,oBAAoB,OAAmB,QAAyB;CACxE,IAAI,SAAS;CACb,MAAM,QAAQ;CACd,KAAK,IAAI,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK,OACtC,UAAU,OAAO,aAAa,GAAG,MAAM,SAAS,GAAG,IAAI,KAAK,CAAC;CAE9D,OAAO,SAAS,KAAK,MAAM,IAAI;AAChC"}
package/package.json ADDED
@@ -0,0 +1,152 @@
1
+ {
2
+ "name": "pptx-ts",
3
+ "version": "0.0.1",
4
+ "author": {
5
+ "name": "shbernal",
6
+ "url": "https://github.com/shbernal/"
7
+ },
8
+ "description": "Create PowerPoint presentations (.pptx) from TypeScript and modern JavaScript",
9
+ "homepage": "https://github.com/shbernal/ts-pptx#readme",
10
+ "license": "MIT",
11
+ "packageManager": "pnpm@11.3.0",
12
+ "type": "module",
13
+ "engines": {
14
+ "node": ">=24"
15
+ },
16
+ "sideEffects": false,
17
+ "exports": {
18
+ ".": {
19
+ "browser": {
20
+ "types": "./dist/browser.d.ts",
21
+ "default": "./dist/browser.js"
22
+ },
23
+ "node": {
24
+ "types": "./dist/node.d.ts",
25
+ "default": "./dist/node.js"
26
+ },
27
+ "default": {
28
+ "types": "./dist/index.d.ts",
29
+ "default": "./dist/index.js"
30
+ }
31
+ },
32
+ "./inspect": {
33
+ "types": "./dist/inspect.d.ts",
34
+ "default": "./dist/inspect.js"
35
+ },
36
+ "./measure": {
37
+ "types": "./dist/measure.d.ts",
38
+ "default": "./dist/measure.js"
39
+ },
40
+ "./read": {
41
+ "types": "./dist/read.d.ts",
42
+ "default": "./dist/read.js"
43
+ },
44
+ "./script": {
45
+ "types": "./dist/script.d.ts",
46
+ "default": "./dist/script.js"
47
+ },
48
+ "./math": {
49
+ "types": "./dist/math.d.ts",
50
+ "default": "./dist/math.js"
51
+ },
52
+ "./zip": {
53
+ "types": "./dist/zip.d.ts",
54
+ "default": "./dist/zip.js"
55
+ },
56
+ "./html": {
57
+ "types": "./dist/html.d.ts",
58
+ "default": "./dist/html.js"
59
+ },
60
+ "./node": {
61
+ "types": "./dist/node.d.ts",
62
+ "node": "./dist/node.js",
63
+ "default": "./dist/node.js"
64
+ },
65
+ "./browser": {
66
+ "types": "./dist/browser.d.ts",
67
+ "browser": "./dist/browser.js",
68
+ "default": "./dist/browser.js"
69
+ },
70
+ "./package.json": {
71
+ "default": "./package.json"
72
+ }
73
+ },
74
+ "files": [
75
+ "dist",
76
+ "skills"
77
+ ],
78
+ "types": "./dist/index.d.ts",
79
+ "dependencies": {
80
+ "@xmldom/xmldom": "^0.9.12",
81
+ "fflate": "^0.8.3",
82
+ "opentype.js": "^2.0.0"
83
+ },
84
+ "peerDependencies": {
85
+ "mathml2omml": "^0.5.0",
86
+ "temml": "^0.13.3"
87
+ },
88
+ "peerDependenciesMeta": {
89
+ "mathml2omml": {
90
+ "optional": true
91
+ },
92
+ "temml": {
93
+ "optional": true
94
+ }
95
+ },
96
+ "publishConfig": {
97
+ "access": "public"
98
+ },
99
+ "devDependencies": {
100
+ "@arethetypeswrong/cli": "^0.18.5",
101
+ "@playwright/test": "^1.62.1",
102
+ "@types/istanbul-lib-coverage": "^2.0.6",
103
+ "@types/istanbul-lib-report": "^3.0.3",
104
+ "@types/istanbul-reports": "^3.0.4",
105
+ "@types/node": "^26.3.0",
106
+ "@types/opentype.js": "^1.3.10",
107
+ "@vitest/coverage-v8": "^4.1.11",
108
+ "@vue/compiler-sfc": "^3.5.41",
109
+ "ast-v8-to-istanbul": "^1.0.5",
110
+ "charcheck": "0.2.5",
111
+ "esbuild": "^0.28.2",
112
+ "happy-dom": "^20.11.6",
113
+ "istanbul-lib-coverage": "^3.2.2",
114
+ "istanbul-lib-report": "^3.0.1",
115
+ "istanbul-reports": "^3.2.0",
116
+ "jszip": "^3.10.1",
117
+ "lefthook": "^2.1.10",
118
+ "mathml2omml": "^0.5.0",
119
+ "micromark": "^4.0.2",
120
+ "ooxml-validate": "^0.0.3",
121
+ "oxfmt": "^0.65.0",
122
+ "oxlint": "^1.80.0",
123
+ "oxlint-tsgolint": "7.0.2001",
124
+ "pptx-html": "^0.1.2",
125
+ "publint": "^0.3.24",
126
+ "temml": "^0.13.4",
127
+ "ts-pptx-demos-showcases": "workspace:*",
128
+ "tsdown": "^0.22.14",
129
+ "typescript": "^7.0.2",
130
+ "typescript-6": "npm:typescript@6.0.3",
131
+ "vitepress": "^1.6.4",
132
+ "vitest": "^4.1.11",
133
+ "vue": "^3.5.41"
134
+ },
135
+ "repository": {
136
+ "type": "git",
137
+ "url": "git+https://github.com/shbernal/ts-pptx.git"
138
+ },
139
+ "keywords": [
140
+ "pptx",
141
+ "ooxml",
142
+ "powerpoint",
143
+ "presentation",
144
+ "slides",
145
+ "typescript",
146
+ "charts",
147
+ "html"
148
+ ],
149
+ "bugs": {
150
+ "url": "https://github.com/shbernal/ts-pptx/issues"
151
+ }
152
+ }