@allyhub/sdk 0.12.0 → 0.13.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 (149) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/node_modules/@allyhub/audio/dist/plan.d.ts +3 -0
  3. package/dist/node_modules/@allyhub/audio/dist/render.js +1 -1
  4. package/dist/node_modules/@allyhub/audio/package.json +1 -1
  5. package/dist/node_modules/@allyhub/chart/dist/chart-file.d.ts +2 -0
  6. package/dist/node_modules/@allyhub/chart/dist/chart-file.js +1 -1
  7. package/dist/node_modules/@allyhub/chart/dist/chart-xml.js +3 -2
  8. package/dist/node_modules/@allyhub/chart/dist/chart.d.ts +5 -12
  9. package/dist/node_modules/@allyhub/chart/dist/chart.js +2 -1
  10. package/dist/node_modules/@allyhub/chart/dist/color.d.ts +37 -0
  11. package/dist/node_modules/@allyhub/chart/dist/color.js +2 -0
  12. package/dist/node_modules/@allyhub/chart/dist/index.d.ts +1 -0
  13. package/dist/node_modules/@allyhub/chart/dist/index.js +1 -1
  14. package/dist/node_modules/@allyhub/chart/dist/svg.js +1 -1
  15. package/dist/node_modules/@allyhub/chart/package.json +1 -1
  16. package/dist/node_modules/@allyhub/diagnostics/package.json +1 -1
  17. package/dist/node_modules/@allyhub/formats/dist/data/deck-code.d.ts +130 -0
  18. package/dist/node_modules/@allyhub/formats/dist/data/deck-code.js +1 -1
  19. package/dist/node_modules/@allyhub/formats/dist/data/gen.d.ts +3 -1
  20. package/dist/node_modules/@allyhub/formats/dist/data/gen.js +1 -1
  21. package/dist/node_modules/@allyhub/formats/dist/data/sheet.d.ts +512 -166
  22. package/dist/node_modules/@allyhub/formats/dist/data/sheet.js +1 -1
  23. package/dist/node_modules/@allyhub/formats/dist/data/slides.d.ts +2523 -136
  24. package/dist/node_modules/@allyhub/formats/dist/data/slides.js +1 -1
  25. package/dist/node_modules/@allyhub/formats/dist/schemas.d.ts +931 -87
  26. package/dist/node_modules/@allyhub/formats/dist/schemas.js +1 -1
  27. package/dist/node_modules/@allyhub/formats/package.json +1 -1
  28. package/dist/node_modules/@allyhub/image-draw/package.json +1 -1
  29. package/dist/node_modules/@allyhub/image-measure/package.json +1 -1
  30. package/dist/node_modules/@allyhub/image-sdk/package.json +1 -1
  31. package/dist/node_modules/@allyhub/measure/package.json +1 -1
  32. package/dist/node_modules/@allyhub/ooxml/dist/color.d.ts +11 -0
  33. package/dist/node_modules/@allyhub/ooxml/dist/color.js +1 -1
  34. package/dist/node_modules/@allyhub/ooxml/dist/ext.d.ts +43 -0
  35. package/dist/node_modules/@allyhub/ooxml/dist/ext.js +1 -1
  36. package/dist/node_modules/@allyhub/ooxml/dist/index.d.ts +2 -1
  37. package/dist/node_modules/@allyhub/ooxml/dist/index.js +1 -1
  38. package/dist/node_modules/@allyhub/ooxml/dist/transform.d.ts +13 -0
  39. package/dist/node_modules/@allyhub/ooxml/dist/transform.js +2 -0
  40. package/dist/node_modules/@allyhub/ooxml/package.json +5 -1
  41. package/dist/node_modules/@allyhub/piece/dist/gen.d.ts +4 -4
  42. package/dist/node_modules/@allyhub/piece/dist/media.d.ts +2 -2
  43. package/dist/node_modules/@allyhub/piece/package.json +1 -1
  44. package/dist/node_modules/@allyhub/protocol/dist/account.d.ts +35 -0
  45. package/dist/node_modules/@allyhub/protocol/dist/account.js +1 -1
  46. package/dist/node_modules/@allyhub/protocol/dist/cloud.d.ts +19 -0
  47. package/dist/node_modules/@allyhub/protocol/dist/cloud.js +1 -1
  48. package/dist/node_modules/@allyhub/protocol/dist/editor.d.ts +35 -20
  49. package/dist/node_modules/@allyhub/protocol/dist/editor.js +1 -1
  50. package/dist/node_modules/@allyhub/protocol/dist/events.d.ts +3 -3
  51. package/dist/node_modules/@allyhub/protocol/dist/frame.d.ts +28 -2
  52. package/dist/node_modules/@allyhub/protocol/dist/frame.js +1 -1
  53. package/dist/node_modules/@allyhub/protocol/dist/jobs.d.ts +6 -6
  54. package/dist/node_modules/@allyhub/protocol/dist/snapshots.d.ts +73 -10
  55. package/dist/node_modules/@allyhub/protocol/dist/snapshots.js +1 -1
  56. package/dist/node_modules/@allyhub/protocol/dist/tools.d.ts +9 -9
  57. package/dist/node_modules/@allyhub/protocol/package.json +1 -1
  58. package/dist/node_modules/@allyhub/runtimes/package.json +1 -1
  59. package/dist/node_modules/@allyhub/scenery/package.json +1 -1
  60. package/dist/node_modules/@allyhub/sheet/dist/annotations.d.ts +14 -0
  61. package/dist/node_modules/@allyhub/sheet/dist/annotations.js +2 -0
  62. package/dist/node_modules/@allyhub/sheet/dist/api/capabilities.js +1 -1
  63. package/dist/node_modules/@allyhub/sheet/dist/api/index.d.ts +1 -1
  64. package/dist/node_modules/@allyhub/sheet/dist/api/index.js +1 -1
  65. package/dist/node_modules/@allyhub/sheet/dist/api/rules.d.ts +24 -0
  66. package/dist/node_modules/@allyhub/sheet/dist/api/rules.js +1 -1
  67. package/dist/node_modules/@allyhub/sheet/dist/api/styles.d.ts +12 -0
  68. package/dist/node_modules/@allyhub/sheet/dist/api/styles.js +1 -1
  69. package/dist/node_modules/@allyhub/sheet/dist/api/workbook.d.ts +3 -1
  70. package/dist/node_modules/@allyhub/sheet/dist/api/workbook.js +1 -1
  71. package/dist/node_modules/@allyhub/sheet/dist/arrange.d.ts +28 -1
  72. package/dist/node_modules/@allyhub/sheet/dist/arrange.js +1 -1
  73. package/dist/node_modules/@allyhub/sheet/dist/data-tools.d.ts +42 -0
  74. package/dist/node_modules/@allyhub/sheet/dist/data-tools.js +2 -0
  75. package/dist/node_modules/@allyhub/sheet/dist/edit.d.ts +43 -2
  76. package/dist/node_modules/@allyhub/sheet/dist/edit.js +1 -1
  77. package/dist/node_modules/@allyhub/sheet/dist/fill.d.ts +10 -0
  78. package/dist/node_modules/@allyhub/sheet/dist/fill.js +1 -1
  79. package/dist/node_modules/@allyhub/sheet/dist/filter.js +1 -1
  80. package/dist/node_modules/@allyhub/sheet/dist/formula/rewrite.d.ts +14 -0
  81. package/dist/node_modules/@allyhub/sheet/dist/formula/rewrite.js +1 -1
  82. package/dist/node_modules/@allyhub/sheet/dist/html.js +10 -10
  83. package/dist/node_modules/@allyhub/sheet/dist/index.d.ts +6 -1
  84. package/dist/node_modules/@allyhub/sheet/dist/index.js +1 -1
  85. package/dist/node_modules/@allyhub/sheet/dist/outline.d.ts +30 -0
  86. package/dist/node_modules/@allyhub/sheet/dist/outline.js +2 -0
  87. package/dist/node_modules/@allyhub/sheet/dist/rich.d.ts +29 -0
  88. package/dist/node_modules/@allyhub/sheet/dist/rich.js +2 -0
  89. package/dist/node_modules/@allyhub/sheet/dist/rules.js +1 -1
  90. package/dist/node_modules/@allyhub/sheet/dist/table-style.d.ts +6 -0
  91. package/dist/node_modules/@allyhub/sheet/dist/table-style.js +1 -1
  92. package/dist/node_modules/@allyhub/sheet/dist/table-styles.js +1 -1
  93. package/dist/node_modules/@allyhub/sheet/dist/workbook.d.ts +5 -1
  94. package/dist/node_modules/@allyhub/sheet/dist/workbook.js +1 -1
  95. package/dist/node_modules/@allyhub/sheet/dist/xlsx/charts.js +1 -1
  96. package/dist/node_modules/@allyhub/sheet/dist/xlsx/import.js +1 -1
  97. package/dist/node_modules/@allyhub/sheet/dist/xlsx/read.d.ts +17 -1
  98. package/dist/node_modules/@allyhub/sheet/dist/xlsx/read.js +2 -2
  99. package/dist/node_modules/@allyhub/sheet/dist/xlsx/runs.d.ts +56 -0
  100. package/dist/node_modules/@allyhub/sheet/dist/xlsx/runs.js +2 -0
  101. package/dist/node_modules/@allyhub/sheet/dist/xlsx/styles.d.ts +6 -0
  102. package/dist/node_modules/@allyhub/sheet/dist/xlsx/styles.js +1 -1
  103. package/dist/node_modules/@allyhub/sheet/dist/xlsx/write.js +1 -1
  104. package/dist/node_modules/@allyhub/sheet/package.json +1 -1
  105. package/dist/node_modules/@allyhub/slides-core/dist/animation.d.ts +117 -21
  106. package/dist/node_modules/@allyhub/slides-core/dist/animation.js +1 -1
  107. package/dist/node_modules/@allyhub/slides-core/dist/api.d.ts +181 -30
  108. package/dist/node_modules/@allyhub/slides-core/dist/api.js +3 -3
  109. package/dist/node_modules/@allyhub/slides-core/dist/capabilities.js +1 -1
  110. package/dist/node_modules/@allyhub/slides-core/dist/chart-api.d.ts +28 -2
  111. package/dist/node_modules/@allyhub/slides-core/dist/chart-api.js +1 -1
  112. package/dist/node_modules/@allyhub/slides-core/dist/check.js +1 -1
  113. package/dist/node_modules/@allyhub/slides-core/dist/enums.d.ts +222 -4
  114. package/dist/node_modules/@allyhub/slides-core/dist/enums.js +1 -1
  115. package/dist/node_modules/@allyhub/slides-core/dist/file.d.ts +6 -0
  116. package/dist/node_modules/@allyhub/slides-core/dist/file.js +3 -3
  117. package/dist/node_modules/@allyhub/slides-core/dist/generated/table-styles.d.ts +3 -0
  118. package/dist/node_modules/@allyhub/slides-core/dist/generated/table-styles.js +2 -0
  119. package/dist/node_modules/@allyhub/slides-core/dist/index.d.ts +3 -0
  120. package/dist/node_modules/@allyhub/slides-core/dist/index.js +1 -1
  121. package/dist/node_modules/@allyhub/slides-core/dist/merge.js +1 -1
  122. package/dist/node_modules/@allyhub/slides-core/dist/model.d.ts +98 -10
  123. package/dist/node_modules/@allyhub/slides-core/dist/numbering.d.ts +6 -0
  124. package/dist/node_modules/@allyhub/slides-core/dist/numbering.js +2 -0
  125. package/dist/node_modules/@allyhub/slides-core/dist/office.d.ts +53 -0
  126. package/dist/node_modules/@allyhub/slides-core/dist/office.js +1 -1
  127. package/dist/node_modules/@allyhub/slides-core/dist/patterns.d.ts +8 -0
  128. package/dist/node_modules/@allyhub/slides-core/dist/patterns.js +2 -0
  129. package/dist/node_modules/@allyhub/slides-core/dist/resolve.d.ts +36 -6
  130. package/dist/node_modules/@allyhub/slides-core/dist/resolve.js +1 -1
  131. package/dist/node_modules/@allyhub/slides-core/dist/script.d.ts +11 -0
  132. package/dist/node_modules/@allyhub/slides-core/dist/script.js +2 -2
  133. package/dist/node_modules/@allyhub/slides-core/dist/sdk.d.ts +1 -1
  134. package/dist/node_modules/@allyhub/slides-core/dist/sdk.js +1 -1
  135. package/dist/node_modules/@allyhub/slides-core/dist/table-style.d.ts +48 -0
  136. package/dist/node_modules/@allyhub/slides-core/dist/table-style.js +2 -0
  137. package/dist/node_modules/@allyhub/slides-core/package.json +1 -1
  138. package/dist/node_modules/@allyhub/video-core/dist/mix-plan.js +1 -1
  139. package/dist/node_modules/@allyhub/video-core/dist/timeline.d.ts +4 -0
  140. package/dist/node_modules/@allyhub/video-core/package.json +1 -1
  141. package/dist/node_modules/@allyhub/video-sdk/package.json +1 -1
  142. package/docs/defaults.md +78 -4
  143. package/docs/image.md +1 -1
  144. package/docs/pictures.md +1 -1
  145. package/docs/project.md +1 -1
  146. package/docs/sheets.md +19 -9
  147. package/docs/slides.md +30 -16
  148. package/docs/speech.md +1 -1
  149. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
1
  /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{themeColor as A,themeColorOf as T}from"@allyhub/chart";import{presetAdjustments as H}from"@allyhub/ooxml/geometry";import{connectorBetween as B,connectorEnds as U,siteOn as W,sitesOf as Z}from"./connect.js";import{framedComponent as X}from"@allyhub/piece";import{colorOfFile as Y}from"@allyhub/formats";import{MSO_ARROWHEAD as j,MSO_ARROWHEAD_SIZE as $,MSO_CONNECTOR as J,MSO_LINE as q,MSO_SHAPE as P,MSO_SHAPE_TYPE as K,PP_PLACEHOLDER as v}from"./enums.js";import{Chart as Q}from"./chart-api.js";import{AUTOSHAPE_STYLE as p,SHADOW_DEFAULTS as z,CONNECTOR_GEOMETRIES as V,CONNECTOR_STYLE as F,FOOTER_IDX as tt,isConnectorGeometry as k,OFFICE_TEXT_STYLES as et,placeholderLevels as st,TEXT_INSETS as w,TEXTBOX_FRAME as rt}from"./office.js";import{masterPlaceholder as C}from"./placeholders.js";import{strict as a}from"./strict.js";import{EMU_PER_PT as N,SLIDE_SIZES as M,length as l,lengthOr as E}from"./units.js";class it extends Error{constructor(t){super(`${t} (allyhub slides capabilities lists what the API holds).`),this.name="Unsupported"}}const g=i=>{throw new it(i)},nt=/^#?[0-9a-f]{6}$/iu,L=i=>{if(!nt.test(i))throw new Error(`rgb ${i} is not RRGGBB.`);return`#${i.replace("#","").toUpperCase()}`};function I(i,t){if(typeof i!="string")return i;const e=Y(i);if(e===void 0)throw new Error(`${t} is a theme colour (accent1), one lighter or darker (accent1 lighter 40%) or #RRGGBB, not ${i}.`);return e}export const RGBColor=Object.assign(function(t,e,s){for(const o of[t,e,s])if(!Number.isInteger(o)||o<0||o>255)throw new Error(`RGBColor(${String(t)}, ${String(e)}, ${String(s)}): each is 0 to 255.`);const r=`#${[t,e,s].map(o=>o.toString(16).padStart(2,"0")).join("").toUpperCase()}`;return new.target===void 0?r:new String(r)},{from_string:i=>L(i)});export class ColorFormat{read;write;constructor(t,e){return this.read=t,this.write=e,a(this,"ColorFormat")}get theme_color(){const t=this.read();return t===void 0?void 0:T(t)}set theme_color(t){this.write(t===void 0?void 0:A(t,this.brightness))}get brightness(){const t=this.read();return typeof t=="object"&&"brightness"in t?t.brightness:0}set brightness(t){if(!(t>=-1&&t<=1))throw new RangeError(`brightness ${String(t)} is not a number from -1.0 to 1.0.`);const e=this.read();if(e===void 0)throw new TypeError("There is no colour to set the brightness of: set theme_color first.");const s=T(e);if(s!==void 0)this.write(A(s,t));else if(t!==0)throw new TypeError("Only a theme colour has a brightness here, so an RGB colour does not: set theme_color first, or rgb to the colour it makes.")}get rgb(){const t=this.read();return typeof t=="object"&&"rgb"in t?t.rgb:void 0}set rgb(t){this.write(t===void 0?void 0:{rgb:L(t)})}}export class Font{def;constructor(t){return this.def=t,a(this,"Font")}_set(t,e){e===void 0?Reflect.deleteProperty(this.def,t):this.def[t]=e}get strike(){return this.def.strike}set strike(t){this._set("strike",t)}get baseline(){return this.def.baseline}set baseline(t){this._set("baseline",t)}get highlight(){return this.def.highlight}set highlight(t){this._set("highlight",t)}get name(){return this.def.name}set name(t){this._set("name",t)}get size(){return E(this.def.size)}set size(t){if(t!==void 0&&t<12700)throw new Error(`A font size is a Length of Pt(1) and over: Pt(${String(t)}) for ${String(t)} points; ${String(t)} alone is ${String(t)} EMU.`);this._set("size",t)}get bold(){return this.def.bold}set bold(t){this._set("bold",t)}get italic(){return this.def.italic}set italic(t){this._set("italic",t)}get underline(){return this.def.underline}set underline(t){this._set("underline",t)}get spacing(){return E(this.def.spacing)}set spacing(t){this._set("spacing",t)}get color(){return new ColorFormat(()=>this.def.color,t=>{this._set("color",t)})}}export class Hyperlink{def;constructor(t){return this.def=t,a(this,"_Hyperlink")}get address(){return this.def.font?.link}set address(t){this.def.font??={},t===void 0?Reflect.deleteProperty(this.def.font,"link"):this.def.font.link=t}}export class Run{def;constructor(t){return this.def=t,a(this,"_Run")}get text(){return this.def.text}set text(t){this.def.text=t}get font(){return this.def.font??={},new Font(this.def.font)}get hyperlink(){return new Hyperlink(this.def)}}const ot=i=>{if(!Number.isFinite(i)||i<=0)throw new Error(`line_spacing ${String(i)} is not over 0.`);return Number.isInteger(i)&&i>=N?{fixed:i}:{lines:i}},ht=i=>i===void 0?void 0:"lines"in i?i.lines:l(i.fixed),D=i=>i.split(/\n|\v/u).flatMap((t,e)=>[...e>0?[{text:"\v"}]:[],...t===""?[]:[{text:t}]]);class G{_set(t,e){e===void 0?Reflect.deleteProperty(this.fmt,t):this.fmt[t]=e}get alignment(){return this.fmt.alignment}set alignment(t){this._set("alignment",t)}get line_spacing(){return ht(this.fmt.line_spacing)}set line_spacing(t){this._set("line_spacing",t===void 0?void 0:ot(t))}get space_before(){return E(this.fmt.space_before)}set space_before(t){this._set("space_before",t)}get space_after(){return E(this.fmt.space_after)}set space_after(t){this._set("space_after",t)}get font(){return this.fmt.font??={},new Font(this.fmt.font)}}export class Paragraph extends G{fmt;constructor(t){return super(),this.fmt=t,a(this,"_Paragraph")}get text(){return this.fmt.runs.map(t=>t.text).join("")}set text(t){this.fmt.runs=D(t)}get runs(){return this.fmt.runs.filter(t=>t.text!=="\v").map(t=>new Run(t))}add_run(){const t={text:""};return this.fmt.runs.push(t),new Run(t)}add_line_break(){this.fmt.runs.push({text:"\v"})}clear(){return this.fmt.runs=[],this}get level(){return this.fmt.level}set level(t){if(!Number.isInteger(t)||t<0||t>8)throw new Error(`level ${String(t)} is not 0 to 8.`);this.fmt.level=t}}export class ListLevel extends G{fmt;constructor(t){return super(),this.fmt=t,a(this,"ListLevel")}get numbered(){return this.fmt.numbered}set numbered(t){this._set("numbered",t)}get bullet(){return this.fmt.bullet}set bullet(t){this._set("bullet",t)}get bullet_font(){return this.fmt.bullet_font}set bullet_font(t){this._set("bullet_font",t)}get margin_left(){return E(this.fmt.margin_left)}set margin_left(t){this._set("margin_left",t)}get indent(){return E(this.fmt.indent)}set indent(t){this._set("indent",t)}}const O=i=>Object.freeze(i.map(t=>new ListLevel(t))),at=()=>Array.from({length:9},()=>({})),S=()=>({paragraphs:[],levels:at()});export class TextFrame{def;constructor(t){return this.def=t,a(this,"TextFrame")}_set(t,e){e===void 0?Reflect.deleteProperty(this.def,t):this.def[t]=e}get text(){return this.def.paragraphs.map(t=>t.runs.map(e=>e.text).join("")).join(`
3
- `)}set text(t){this.def.paragraphs=t.split(`
4
- `).map(e=>({runs:D(e),level:0}))}get paragraphs(){return this.def.paragraphs.length===0&&this.def.paragraphs.push({runs:[],level:0}),this.def.paragraphs.map(t=>new Paragraph(t))}add_paragraph(){this.def.paragraphs.length===0&&this.def.paragraphs.push({runs:[],level:0});const t={runs:[],level:0};return this.def.paragraphs.push(t),new Paragraph(t)}clear(){const t=this.def.paragraphs[0];this.def.paragraphs=t?[{...t,runs:[]}]:[]}fit_text(t,e=18,s,r){this.def.auto_size="text",this.def.word_wrap=!0;for(const n of this.def.paragraphs)for(const o of n.runs)o.font={...o.font,size:Math.trunc(e*N),...t===void 0?{}:{name:t},...s===void 0?{}:{bold:s},...r===void 0?{}:{italic:r}}}get list_style(){return O(this.def.levels)}get vertical_anchor(){return this.def.vertical_anchor}set vertical_anchor(t){this._set("vertical_anchor",t)}get auto_size(){return this.def.auto_size}set auto_size(t){this._set("auto_size",t)}get word_wrap(){return this.def.word_wrap}set word_wrap(t){this._set("word_wrap",t)}get margin_left(){return l(this.def.margin_left??w.left)}set margin_left(t){this.def.margin_left=t}get margin_top(){return l(this.def.margin_top??w.top)}set margin_top(t){this.def.margin_top=t}get margin_right(){return l(this.def.margin_right??w.right)}set margin_right(t){this.def.margin_right=t}get margin_bottom(){return l(this.def.margin_bottom??w.bottom)}set margin_bottom(t){this.def.margin_bottom=t}}export class FillFormat{read;write;start;shape;constructor(t,e,s="lt1",r){return this.read=t,this.write=e,this.start=s,this.shape=r,a(this,"FillFormat")}solid(){const t=this.read();this.shape&&Reflect.deleteProperty(this.shape,"gradient"),t==null&&this.write(this.start)}background(){this.shape&&Reflect.deleteProperty(this.shape,"gradient"),this.write(null)}_shape(t){if(!this.shape)throw new TypeError(`Only a shape's fill has ${t}.`);return this.shape}gradient(){this._shape("a gradient").gradient??={angle:90,stops:[{at:0,color:"accent1"},{at:1,color:"accent2"}]}}get gradient_angle(){return this._gradient().angle}set gradient_angle(t){this._gradient().angle=t}get gradient_stops(){return this._gradient().stops.map(t=>new GradientStop(t))}set gradient_stops(t){if(t.length<2)throw new Error("A gradient has two stops at least.");this._gradient().stops=t.map(e=>e instanceof GradientStop?GradientStop.defOf(e):{...e,color:I(e.color,"A gradient stop's colour")})}_gradient(){const{gradient:t}=this._shape("a gradient");if(!t)throw new TypeError("This fill is no gradient: call fill.gradient() first.");return t}get transparency(){return this._shape("a transparency").fill_transparency??0}set transparency(t){if(!(t>=0&&t<=1))throw new Error(`A transparency is a share, 0 to 1, not ${String(t)}.`);this._shape("a transparency").fill_transparency=t}get type(){if(this.shape?.gradient)return"gradient";const t=this.read();return t===void 0?void 0:t===null?"background":"solid"}get fore_color(){const t=this.read();if(t==null)throw new TypeError("This fill is not solid, so it has no fore_color: call fill.solid() first.");return new ColorFormat(()=>this.read()??void 0,e=>{this.write(e??this.start)})}}export class GradientStop{stop;constructor(t){return this.stop=t,a(this,"GradientStop")}static defOf(t){return{...t.stop}}get color(){return new ColorFormat(()=>this.stop.color,t=>{t!==void 0&&(this.stop.color=t)})}get position(){return this.stop.at}set position(t){if(!(t>=0&&t<=1))throw new Error(`A stop's position is a share, 0 to 1, not ${String(t)}.`);this.stop.at=t}get transparency(){return this.stop.transparency??0}set transparency(t){if(!(t>=0&&t<=1))throw new Error(`A transparency is a share, 0 to 1, not ${String(t)}.`);t===0?Reflect.deleteProperty(this.stop,"transparency"):this.stop.transparency=t}}export class ShadowFormat{def;constructor(t){return this.def=t,a(this,"ShadowFormat")}_shadow(){return this.def.shadow??={...z},this.def.shadow}get inherit(){return this.def.shadow===void 0}set inherit(t){t?Reflect.deleteProperty(this.def,"shadow"):this.def.shadow??=null}get blur_radius(){return l(this._shadow().blur)}set blur_radius(t){this._shadow().blur=t}get distance(){return l(this._shadow().distance)}set distance(t){this._shadow().distance=t}get angle(){return this._shadow().angle}set angle(t){this._shadow().angle=t}get transparency(){return this._shadow().transparency}set transparency(t){this._shadow().transparency=t}get color(){const t=this._shadow();return new ColorFormat(()=>t.color,e=>{t.color=e??z.color})}}export class LineFormat{def;constructor(t){return this.def=t,a(this,"LineFormat")}get color(){return new ColorFormat(()=>this.def.line??void 0,t=>{this.def.line=t??null})}get fill(){return new FillFormat(()=>this.def.line,t=>{this.def.line=t},"dk1")}get width(){return l(this.def.line_width??0)}set width(t){this.def.line_width=t}get dash_style(){return this.def.line_dash??null}set dash_style(t){t===null?delete this.def.line_dash:this.def.line_dash=x(q,"MSO_LINE","dash_style",t)}get begin_arrow(){return this.def.line_begin??"none"}set begin_arrow(t){this.def.line_begin=x(j,"MSO_ARROWHEAD","begin_arrow",t)}get end_arrow(){return this.def.line_end??"none"}set end_arrow(t){this.def.line_end=x(j,"MSO_ARROWHEAD","end_arrow",t)}get begin_arrow_width(){return this.def.line_begin_size?.w??"med"}set begin_arrow_width(t){this.def.line_begin_size={...this.def.line_begin_size,w:x($,"MSO_ARROWHEAD_SIZE","begin_arrow_width",t)}}get begin_arrow_length(){return this.def.line_begin_size?.len??"med"}set begin_arrow_length(t){this.def.line_begin_size={...this.def.line_begin_size,len:x($,"MSO_ARROWHEAD_SIZE","begin_arrow_length",t)}}get end_arrow_width(){return this.def.line_end_size?.w??"med"}set end_arrow_width(t){this.def.line_end_size={...this.def.line_end_size,w:x($,"MSO_ARROWHEAD_SIZE","end_arrow_width",t)}}get end_arrow_length(){return this.def.line_end_size?.len??"med"}set end_arrow_length(t){this.def.line_end_size={...this.def.line_end_size,len:x($,"MSO_ARROWHEAD_SIZE","end_arrow_length",t)}}}function x(i,t,e,s){if(Object.values(i).includes(s))return s;throw new Error(`${e}: ${String(s)} is not one of ${t}'s ${Object.keys(i).join(", ")}.`)}export class Background{holder;constructor(t){return this.holder=t,a(this,"_Background")}get fill(){return new FillFormat(()=>this.holder.background,t=>{this.holder.background=t??"lt1"})}}export const adjustmentDefaults=i=>H(i).map(t=>t.value/1e5);export class Adjustments{def;constructor(t){return this.def=t,a(this,"Adjustments",{index:e=>this._values()[e],setIndex:(e,s)=>{this._set(e,Number(s))}})}_values(){return this.def.adjustments??adjustmentDefaults(this.def.geometry??"rect")}get length(){return this._values().length}_set(t,e){const s=this._values();if(t<0||t>=s.length)throw new RangeError(`adjustments[${String(t)}]: ${this.def.geometry??"this shape"} has ${String(s.length)}.`);if(!Number.isFinite(e))throw new Error(`adjustments[${String(t)}] = ${String(e)} is not a number.`);s[t]=e,this.def.adjustments=s}}const dt={left:0,top:0,width:0,height:0};export class Shape{def;inherit;constructor(t,e=()=>{}){return this.def=t,this.inherit=e,a(this,"Shape")}get _def(){return this.def}_frame(){return this.def.frame??this.inherit()??dt}_own(){return this.def.frame??={...this._frame()},this.def.frame}get name(){return this.def.name}set name(t){this.def.name=t}get shape_type(){return this.def.path?"freeform":k(this.def.geometry)?"line":this.def.kind}get is_placeholder(){return this.def.kind==="placeholder"}get has_table(){return this.def.table!==void 0}get has_chart(){return this.def.chart!==void 0}get chart(){if(!this.def.chart)throw new Error(`${this.def.name} is not a chart.`);return new Q(this.def.chart)}get table(){if(!this.def.table)throw new Error(`${this.def.name} is not a table.`);return new Table(this.def.table)}get placeholder_format(){if(!this.def.placeholder)throw new Error(`${this.def.name} is not a placeholder.`);return a({...this.def.placeholder},"_PlaceholderFormat")}get left(){return l(this._frame().left)}set left(t){this._own().left=t}get top(){return l(this._frame().top)}set top(t){this._own().top=t}get width(){return l(this._frame().width)}set width(t){this._own().width=t}get height(){return l(this._frame().height)}set height(t){this._own().height=t}get rotation(){return this.def.rotation??0}set rotation(t){if(!Number.isFinite(t))throw new Error(`${this.def.name}: rotation is a number of degrees.`);const e=(Math.trunc(t*6e4)%216e5+216e5)%216e5/6e4;e===0?Reflect.deleteProperty(this.def,"rotation"):this.def.rotation=e}get flip_h(){return this.def.flip?.h===!0}set flip_h(t){this._flip("h",t)}get flip_v(){return this.def.flip?.v===!0}set flip_v(t){this._flip("v",t)}_flip(t,e){const s={...this.def.flip};e?s[t]=!0:Reflect.deleteProperty(s,t),Object.keys(s).length===0?Reflect.deleteProperty(this.def,"flip"):this.def.flip=s}get has_text_frame(){return this.def.text!==void 0}get text_frame(){if(!this.def.text)throw new Error(`${this.def.name} (a ${this.shape_type}) has no text frame: has_text_frame is false.`);return new TextFrame(this.def.text)}get text(){return this.text_frame.text}set text(t){this.text_frame.text=t}get fill(){return new FillFormat(()=>this.def.fill,t=>{this.def.fill=t},"lt1",this.def)}get line(){return new LineFormat(this.def)}get shadow(){return new ShadowFormat(this.def)}get adjustments(){return new Adjustments(this.def)}_ends(t){if(this.def.path||!k(this.def.geometry))throw new Error(`${this.def.name}.${t}: it is not a connector (add_connector makes one).`);return U(this._frame(),this.def.flip,this.def.rotation)}_move(t,e){const s=B(t,e,this.def.rotation);this.def.frame=s.frame,s.flip?this.def.flip=s.flip:Reflect.deleteProperty(this.def,"flip")}get begin_x(){return l(Math.round(this._ends("begin_x")[0][0]))}set begin_x(t){const[e,s]=this._ends("begin_x");this._move([t,e[1]],s)}get begin_y(){return l(Math.round(this._ends("begin_y")[0][1]))}set begin_y(t){const[e,s]=this._ends("begin_y");this._move([e[0],t],s)}get end_x(){return l(Math.round(this._ends("end_x")[1][0]))}set end_x(t){const[e,s]=this._ends("end_x");this._move(e,[t,s[1]])}get end_y(){return l(Math.round(this._ends("end_y")[1][1]))}set end_y(t){const[e,s]=this._ends("end_y");this._move(e,[s[0],t])}begin_connect(t,e){this._connect("begin",t,e)}end_connect(t,e){this._connect("end",t,e)}_connect(t,e,s){const r=`${t}_connect`,[n,o]=this._ends(r);if(!(e instanceof Shape))throw new Error(`${this.def.name}.${r}(): its shape is a Shape.`);const h=e._def,f={frame:e._frame(),geometry:h.geometry,adjustments:h.adjustments,flip:h.flip,rotation:h.rotation,path:h.path},u=Z(f).length;if(!Number.isInteger(s)||s<0||s>=u)throw new Error(`${this.def.name}.${r}(): ${h.name} has connection sites 0 to ${String(u-1)}; ${String(s)} is not one.`);const c=W(f,s)??(t==="begin"?n:o);this.def.connect={...this.def.connect,[t]:{shape:h.name,site:s}},this._move(t==="begin"?c:n,t==="begin"?o:c)}}const lt=i=>typeof i=="number"&&Number.isFinite(i),_=(i,t,e,s)=>{for(const[r,n]of Object.entries({left:i,top:t,width:e,height:s}))if(!lt(n))throw new Error(`${r} ${String(n)} is not a length (Emu, Inches, Pt, Cm, Mm).`);if(e<0||s<0)throw new Error("A shape's width and height are 0 or more.");return{left:Math.trunc(i),top:Math.trunc(t),width:Math.trunc(e),height:Math.trunc(s)}},ft=new Set(Object.values(P));export class FreeformBuilder{steps;sx;sy;make;constructor(t,e,s){return this.steps=[{op:"move",x:t[0],y:t[1]}],[this.sx,this.sy]=typeof e=="number"?[e,e]:e,this.make=s,a(this,"FreeformBuilder")}add_line_segments(t,e=!0){for(const[s,r]of t)this.steps.push({op:"line",x:s,y:r});return e&&this.steps.push({op:"close"}),this}add_curve_segment(t,e,s,r,n,o){if(![t,e,s,r,n,o].every(h=>Number.isFinite(h)))throw new Error("add_curve_segment(x1, y1, x2, y2, x, y) takes six numbers in local units: its two control points and the point it ends at.");return this.steps.push({op:"curve",x1:t,y1:e,x2:s,y2:r,x:n,y:o}),this}move_to(t,e){return this.steps.push({op:"move",x:t,y:e}),this}convert_to_shape(t=0,e=0){this.steps.length<2&&g("convert_to_shape(): a freeform needs a segment.");const s=this.steps.flatMap(d=>d.op==="close"?[]:d.op==="curve"?[[d.x1,d.y1],[d.x2,d.y2],[d.x,d.y]]:[[d.x,d.y]]),r=s.map(d=>d[0]),n=s.map(d=>d[1]),o=Math.min(...r),h=Math.min(...n),f=Math.max(...r)-o,u=Math.max(...n)-h;f===0&&u===0&&g("convert_to_shape(): a freeform's points are all one point.");const c=(d,m)=>({x:d-o,y:m-h});return this.make({w:f,h:u,steps:this.steps.map(d=>{if(d.op==="close")return d;if(d.op!=="curve")return{op:d.op,...c(d.x,d.y)};const m=c(d.x1,d.y1),y=c(d.x2,d.y2);return{op:"curve",x1:m.x,y1:m.y,x2:y.x,y2:y.y,...c(d.x,d.y)}})},_(Math.round(o*this.sx)+t,Math.round(h*this.sy)+e,Math.round(f*this.sx),Math.round(u*this.sy)))}}export class GroupShape{list;_name;make;constructor(t,e,s){return this.list=t,this._name=e,this.make=s,a(this,"GroupShape")}members(){return this.list.filter(t=>t.group===this._name)}box(){const t=this.members().flatMap(r=>r.frame?[r.frame]:[]),e=Math.min(...t.map(r=>r.left)),s=Math.min(...t.map(r=>r.top));return{left:t.length>0?e:0,top:t.length>0?s:0,right:Math.max(0,...t.map(r=>r.left+r.width)),bottom:Math.max(0,...t.map(r=>r.top+r.height))}}get shapes(){return this.make(this._name)}get shape_type(){return K.GROUP}get name(){return this._name}set name(t){for(const e of this.members())e.group=t;this._name=t}get left(){return l(this.box().left)}set left(t){const e=t-this.box().left;for(const s of this.members())s.frame&&(s.frame.left+=e)}get top(){return l(this.box().top)}set top(t){const e=t-this.box().top;for(const s of this.members())s.frame&&(s.frame.top+=e)}get width(){const t=this.box();return l(t.right-t.left)}get height(){const t=this.box();return l(t.bottom-t.top)}}export class Cell{def;table;row;col;constructor(t,e,s,r){return this.def=t,this.table=e,this.row=s,this.col=r,a(this,"_Cell")}get text_frame(){return new TextFrame(this.def.text)}get text(){return this.text_frame.text}set text(t){this.text_frame.text=t}get fill(){return new FillFormat(()=>this.def.fill,t=>{this.def.fill=t})}get borders(){return this.def.borders??{}}set borders(t){this.def.borders=Object.fromEntries(Object.entries(t).map(([e,s])=>[e,{...s,color:I(s.color,`A cell's ${e} border`)}]))}get margin_left(){return l(this.def.text.margin_left??w.left)}set margin_left(t){this.def.text.margin_left=t}get margin_right(){return l(this.def.text.margin_right??w.right)}set margin_right(t){this.def.text.margin_right=t}get margin_top(){return l(this.def.text.margin_top??w.top)}set margin_top(t){this.def.text.margin_top=t}get margin_bottom(){return l(this.def.text.margin_bottom??w.bottom)}set margin_bottom(t){this.def.text.margin_bottom=t}get vertical_anchor(){return this.def.text.vertical_anchor}set vertical_anchor(t){t===void 0?delete this.def.text.vertical_anchor:this.def.text.vertical_anchor=t}get is_merge_origin(){return(this.def.span_width??1)>1||(this.def.span_height??1)>1}get is_spanned(){return this.def.spanned===!0}get span_width(){return this.def.span_width??1}get span_height(){return this.def.span_height??1}merge(t){const e=[this.row,t.row].sort((f,u)=>f-u),s=[this.col,t.col].sort((f,u)=>f-u),[r=0,n=0]=e,[o=0,h=0]=s;for(let f=r;f<=n;f++)for(let u=o;u<=h;u++){const c=this.table.rows[f]?.cells[u];c&&(f===r&&u===o?(h>o&&(c.span_width=h-o+1),n>r&&(c.span_height=n-r+1)):c.spanned=!0)}}split(){const t=this.span_width,e=this.span_height;delete this.def.span_width,delete this.def.span_height;for(let s=this.row;s<this.row+e;s++)for(let r=this.col;r<this.col+t;r++){const n=this.table.rows[s]?.cells[r];n&&delete n.spanned}}}export class Column{def;at;constructor(t,e){return this.def=t,this.at=e,a(this,"_Column")}get width(){return l(this.def.columns[this.at]??0)}set width(t){this.def.columns[this.at]=t}}export class Row{def;at;constructor(t,e){return this.def=t,this.at=e,a(this,"_Row")}get row(){const t=this.def.rows[this.at];if(!t)throw new Error(`The table has no row ${String(this.at)}.`);return t}get height(){return l(this.row.height)}set height(t){this.row.height=t}}export class Table{def;constructor(t){return this.def=t,a(this,"Table")}cell(t,e){const s=this.def.rows[t]?.cells[e];if(!s)throw new Error(`cell(): the table has ${String(this.def.rows.length)} rows and ${String(this.def.columns.length)} columns.`);return new Cell(s,this.def,t,e)}*iter_cells(){for(let t=0;t<this.def.rows.length;t++)for(let e=0;e<this.def.columns.length;e++)yield this.cell(t,e)}get columns(){return this.def.columns.map((t,e)=>new Column(this.def,e))}get rows(){return this.def.rows.map((t,e)=>new Row(this.def,e))}flag(t){return this.def[t]===!0}get first_row(){return this.flag("first_row")}set first_row(t){this.def.first_row=t}get first_col(){return this.flag("first_col")}set first_col(t){this.def.first_col=t}get last_row(){return this.flag("last_row")}set last_row(t){this.def.last_row=t}get last_col(){return this.flag("last_col")}set last_col(t){this.def.last_col=t}get horz_banding(){return this.flag("horz_banding")}set horz_banding(t){this.def.horz_banding=t}get vert_banding(){return this.flag("vert_banding")}set vert_banding(t){this.def.vert_banding=t}}function ut(i,t,e=[]){const s=new Set([...i,...e].map(n=>n.name));let r=1;for(;s.has(`${t}-${String(r)}`);)r++;return`${t}-${String(r)}`}export class ShapeCollection{list;base;components;inherit;group;under;constructor(t,e,s,r=()=>{},n=()=>[],o){return this.list=t,this.base=e,this.components=s,this.inherit=r,this.under=n,this.group=o,a(this,"SlideShapes",{index:h=>this._at(h)})}_wrap(t){return new Shape(t,()=>this.inherit(t))}_at(t){const e=this.list[t];return e?this._wrap(e):void 0}*[Symbol.iterator](){for(const t of this.list)yield this._wrap(t)}get length(){return this.list.length}get(t){const e=this.list.find(s=>s.name===t);return e?this._wrap(e):void 0}get title(){const t=this.list.find(e=>e.placeholder?.type==="title"||e.placeholder?.type==="ctrTitle");return t?this._wrap(t):void 0}get placeholders(){return new Placeholders(this.list,this.inherit)}_add(t,e){const s={name:ut(this.list,t,this.under()),...e,...this.group===void 0?{}:{group:this.group}};return this.list.push(s),this._wrap(s)}add_textbox(t,e,s,r){return this._add("textbox",{kind:"textbox",frame:_(t,e,s,r),text:{...S(),...rt}})}add_picture(t,e,s,r,n){return(r===void 0||n===void 0)&&g("add_picture() takes a width and a height here: a picture's own size is not read while a deck's code runs"),this._add("picture",{kind:"picture",frame:_(e,s,r??0,n??0),media:{path:t,base:this.base}})}add_movie(t,e,s,r,n,o={}){return this._add("movie",{kind:"movie",frame:_(e,s,r,n),media:{path:t,base:this.base,...o.poster_frame_time===void 0?{}:{poster:o.poster_frame_time}}})}add_shape(t,e,s,r,n){ft.has(t)||g(`add_shape(): ${t} is not one of MSO_SHAPE's ${Object.keys(P).join(", ")}`);const o=S();return o.vertical_anchor=p.vertical_anchor,o.paragraphs=[{runs:[],level:0,alignment:p.alignment}],this._add("shape",{kind:"autoshape",frame:_(e,s,r,n),geometry:t,fill:p.fill,line:p.line,line_width:p.line_width,text:o})}add_table(t,e,s,r,n,o){(t<1||e<1)&&g("add_table(): a table has at least a row and a column.");const h=Math.floor(n/e),f=Math.floor(o/t);return this._add("table",{kind:"table",frame:_(s,r,n,o),table:{columns:Array.from({length:e},()=>h),rows:Array.from({length:t},()=>({height:f,cells:Array.from({length:e},()=>({text:S()}))}))}})}add_chart(t,e,s,r,n,o){return this._add("chart",{kind:"chart",frame:_(e,s,r,n),chart:{type:t,categories:[...o.categories],series:o._series()}})}add_group_shape(){this.group!==void 0&&g("add_group_shape(): a group here holds shapes, not another group.");let t=1;for(;this.list.some(e=>e.group===`group-${String(t)}`);)t++;return new GroupShape(this.list,`group-${String(t)}`,e=>new ShapeCollection(this.list,this.base,this.components,this.inherit,this.under,e))}build_freeform(t=0,e=0,s=1){return new FreeformBuilder([t,e],s,(r,n)=>{const o=S();return o.vertical_anchor=p.vertical_anchor,o.paragraphs=[{runs:[],level:0,alignment:p.alignment}],this._add("freeform",{kind:"autoshape",frame:n,path:r,fill:p.fill,line:p.line,line_width:p.line_width,text:o})})}add_connector(t,e,s,r,n){k(t)||g(`add_connector(): ${t} is not one of MSO_CONNECTOR's ${Object.keys(J).join(", ")}, nor a connector's preset (${V.join(", ")})`);const o=_(Math.min(e,r),Math.min(s,n),Math.abs(r-e),Math.abs(n-s)),h=r<e,f=n<s;return this._add("connector",{kind:"autoshape",frame:o,geometry:t,...h||f?{flip:{...h?{h}:{},...f?{v:f}:{}}}:{},line:F.line,line_width:F.line_width})}add_component(t,e,s,r,n,o={},h={}){if(!Object.hasOwn(this.components(),t))throw new Error(`add_component(): the presentation has no component ${t}; add it with prs.components.add("${t}", { … }) first.`);if(h.dur!==void 0&&!(Number.isFinite(h.dur)&&h.dur>0))throw new Error(`add_component(): dur is how long ${t} moves, seconds over 0; it was ${String(h.dur)}.`);return this._add(t,{kind:"component",frame:_(e,s,r,n),component:{name:t,props:o,...h.dur===void 0?{}:{dur:h.dur}}})}}export const NAME_OF_TYPE={title:"title",ctrTitle:"title",subTitle:"subtitle",body:"body",pic:"picture",media:"media",obj:"content",dt:"date",ftr:"footer",sldNum:"slide-number"};export class Placeholders{list;inherit;constructor(t,e=()=>{}){return this.list=t,this.inherit=e,a(this,"placeholders",{index:s=>this.get(s)})}_wrap(t){return new Shape(t,()=>this.inherit(t))}*[Symbol.iterator](){for(const t of this.list)t.kind==="placeholder"&&(yield this._wrap(t))}get length(){return this.list.filter(t=>t.kind==="placeholder").length}get(t){const e=this.list.find(s=>s.kind==="placeholder"&&(typeof t=="number"?s.placeholder?.idx===t:s.name===t||s.placeholder?.type===t));return e?this._wrap(e):void 0}add(t,e,s,r,n,o={}){const h=typeof e=="object"?e:o,f=typeof e=="object"?void 0:e;Object.values(v).includes(t)||g(`placeholders.add(): ${t} is not one of PP_PLACEHOLDER's ${Object.keys(v).join(", ")}`);const u=this.list.filter(b=>b.kind==="placeholder"),c=new Set(u.map(b=>b.placeholder?.idx));let d=t==="title"||t==="ctrTitle"?0:tt[t]??1;for(c.has(d)&&d===0&&(d=1);c.has(d);)d++;const m=h.name??NAME_OF_TYPE[t];if(this.list.some(b=>b.name===m))throw new Error(`Two shapes are ${m}: give the placeholder a name ({ name }).`);const y=[f,s,r,n].filter(b=>b!==void 0);if(y.length!==0&&y.length!==4)throw new Error("placeholders.add(type, left, top, width, height): give all four, or none to take the master's frame.");const R={name:m,kind:"placeholder",placeholder:{type:t,idx:d},...y.length===4?{frame:_(f??0,s??0,r??0,n??0)}:{},text:{paragraphs:[],levels:st(t)}};return this.list.push(R),this._wrap(R)}}export class SlideLayout{def;master;ctx;constructor(t,e,s){return this.def=t,this.master=e,this.ctx=s,a(this,"SlideLayout")}get _def(){return this.def}inherit=t=>t.placeholder?C(this.master._def,t.placeholder.type)?.frame:void 0;get name(){return this.def.name}get slide_master(){return this.master}get display_master_shapes(){return this.def.display_master_shapes??!0}set display_master_shapes(t){t?delete this.def.display_master_shapes:this.def.display_master_shapes=!1}get background(){return new Background(this.def)}get placeholders(){return new Placeholders(this.def.shapes,this.inherit)}get shapes(){return new ShapeCollection(this.def.shapes,this.ctx.base,this.ctx.components,this.inherit,()=>this.master._def.shapes)}}export class SlideLayouts{list;make;constructor(t,e){return this.list=t,this.make=e,a(this,"SlideLayouts",{index:s=>this.list[s]})}*[Symbol.iterator](){yield*this.list}get length(){return this.list.length}get_by_name(t,e){return this.list.find(s=>s.name===t)??e}index(t){const e=this.list.indexOf(t);if(e<0)throw new Error(`${t.name} is not among these layouts.`);return e}add(t,e){if(!this.make)throw new Error("A layout is added to a master: master.slide_layouts.add(name).");const s=this.make(t);return e?.(s),s}}export class TextStyles{def;constructor(t){return this.def=t,a(this,"text_styles")}get title_style(){return O(this.def.title)}get body_style(){return O(this.def.body)}get other_style(){return O(this.def.other)}}export class SlideMaster{def;layouts=[];ctx;allLayouts;constructor(t,e,s){return this.def=t,this.ctx=e,this.allLayouts=s,a(this,"SlideMaster")}get _def(){return this.def}get name(){return this.def.name}get background(){return new Background(this.def)}get placeholders(){return new Placeholders(this.def.shapes)}get shapes(){return new ShapeCollection(this.def.shapes,this.ctx.base,this.ctx.components)}get text_styles(){return new TextStyles(this.def.text_styles)}get slide_layouts(){return new SlideLayouts(this.layouts,t=>{if(this.allLayouts.some(r=>r.name===t))throw new Error(`Two layouts are "${t}": a layout's name is unique in the deck, as its slides file names it.`);const e={name:t,master:this.def.name,shapes:[]};this.def.layouts.push(e);const s=new SlideLayout(e,this,this.ctx);return this.layouts.push(s),this.allLayouts.push(s),s})}}export class SlideMasters{list;make;constructor(t,e){return this.list=t,this.make=e,a(this,"SlideMasters",{index:s=>this.list[s]})}*[Symbol.iterator](){yield*this.list}get length(){return this.list.length}index(t){return this.list.indexOf(t)}add(t,e){const s=this.make(t);return e?.(s),s}}export class GeneratedSlide{own;def;layout;constructor(t,e,s){this.def=t,this.layout=e,this.own=e._def.shapes.filter(n=>n.kind==="placeholder").map(n=>({name:n.name,kind:"placeholder",...n.placeholder?{placeholder:{...n.placeholder}}:{},text:S()}));const r=n=>{const o=e._def.shapes.find(h=>h.kind==="placeholder"&&h.placeholder?.idx===n.placeholder?.idx);return o?o.frame??(o.placeholder?C(e.slide_master._def,o.placeholder.type)?.frame:void 0):void 0};return this._shapes=new ShapeCollection(this.own,s.base,s.components,r,()=>[...e.slide_master._def.shapes,...e._def.shapes]),this._placeholders=new Placeholders(this.own,r),a(this,"Slide")}_shapes;_placeholders;get shapes(){return this._shapes}get placeholders(){return this._placeholders}get slide_id(){return this.def.id}get slide_layout(){return this.layout}get has_notes_slide(){return this.def.notes!==void 0}get notes_slide(){const t=this.def;return a({notes_text_frame:a({get text(){return t.notes??""},set text(e){t.notes=e}},"TextFrame")},"NotesSlide")}get transition(){return this.def.transition}set transition(t){t===void 0?delete this.def.transition:this.def.transition=t}get animations(){return new Animations(this.def.animations??=[])}_done(){const t={},e=[];for(const s of this.own)s.kind==="placeholder"&&s.placeholder?(s.text?.paragraphs.some(r=>r.runs.length>0)&&(t[s.placeholder.idx]=s.text.paragraphs),s.frame&&e.push({...s,text:S()})):e.push(s);return{...this.def,shapes:e,text:t}}}export class Animations{list;constructor(t){return this.list=t,a(this,"Animations")}add(t,e,s={}){this.list.push({shape:typeof t=="string"?t:t.name,effect:e,...s})}get length(){return this.list.length}}class ct{gen;constructor(t){return this.gen=t,a(this,"slides")}add_slide(t,e){return this.gen._add(t,e)}}export class Generator{list=[];prs;ctx;constructor(t,e){return this.prs=t,this.ctx=e,a(this,"Generator")}data(t){return this.ctx.data(t)}get slides(){return new ct(this)}_add(t,e){const s=typeof t=="string"?this.prs._layout(t):t;if(!s)throw new Error(`add_slide(): the presentation has no layout ${typeof t=="string"?t:t.name}.`);if(!/^[A-Za-z0-9_-]+$/u.test(e))throw new Error(`add_slide(): ${e} is not an id of letters, digits, _ and -.`);if(this.list.some(n=>n.slide_id===e))throw new Error(`add_slide(): two slides are ${e}.`);const r=new GeneratedSlide({id:e,layout:s.name,shapes:[],text:{}},s,this.prs._ctx);return this.list.push(r),r}_made(){return this.list.map(t=>t._done())}}const pt=()=>JSON.parse(JSON.stringify(et));export class Presentation{masters=[];layouts=[];def;_ctx;constructor(t,e){return this.def={slide_width:t[0],slide_height:t[1],masters:[],components:{},generators:{}},this._ctx={base:e,components:()=>this.def.components},a(this,"Presentation")}get _def(){return this.def}get slide_width(){return l(this.def.slide_width)}set slide_width(t){this.def.slide_width=t}get slide_height(){return l(this.def.slide_height)}set slide_height(t){this.def.slide_height=t}get slide_masters(){return new SlideMasters(this.masters,t=>{if(this.masters.some(r=>r.name===t))throw new Error(`Two masters are "${t}".`);const e={name:t,background:"lt1",text_styles:pt(),shapes:[],layouts:[]};this.def.masters.push(e);const s=new SlideMaster(e,this._ctx,this.layouts);return this.masters.push(s),s})}get slide_master(){const t=this.masters[0];if(!t)throw new Error("The presentation has no master yet: prs.slide_masters.add(name) makes one.");return t}get slide_layouts(){const t=this.masters[0];return t?t.slide_layouts:new SlideLayouts([])}get slides(){return g("A deck's slides are in the slides file presentation({ slides }) names, in order, each on a layout, and their words in its script; slides made from data are a generator's (prs.generators.add)")}save(){return g("A deck is not saved by its code: allyhub render writes its PDF, pictures and PPTX")}get theme(){return this.def.theme??={},this.def.theme}set theme(t){this.def.theme=t}get components(){return a({add:(t,e)=>{if(Object.hasOwn(this.def.components,t))throw new Error(`Two components are "${t}".`);const s=X(t,e);if(!s)throw new Error(`Component ${t} is not a component: give what defineComponent makes, or { props, layers }.`);this.def.components[t]=s}},"components")}get generators(){return a({add:(t,e)=>{if(Object.hasOwn(this.def.generators,t))throw new Error(`Two generators are "${t}".`);this.def.generators[t]={name:t,make:s=>{const r=new Generator(this,s);return e(r),r._made()}}}},"generators")}_layout(t){return this.layouts.find(e=>e.name===t)}}export const DECK_BRAND="__allyhubDeck";export function isDeck(i){return typeof i=="object"&&i!==null&&DECK_BRAND in i}export const presentationFor=i=>(t,e)=>{const[s,r]=typeof t=="function"?[{},t]:[t,e];if(typeof r!="function")throw new Error(`A deck's module exports one deck: export default presentation({ slides: "./deck.yaml", script: "./deck.{locale}.yaml", size }, (prs) => { … masters, layouts, components … }), its slides and its script named from its folder.`);if(s.script!==void 0&&!s.script.includes("{locale}"))throw new Error(`presentation(): script ${s.script} names one file: write {locale} in its name for each language (./deck.{locale}.yaml).`);if(typeof s.size=="string"&&!Object.hasOwn(M,s.size))throw new Error(`presentation(): size ${s.size} is not one of ${Object.keys(M).join(", ")}, or { width, height } in EMU.`);return{[DECK_BRAND]:!0,kind:"slides",options:s,build:r,written:{file:i}}};export function evaluateDeck(i){const t=i.options.size??"16:9",e=typeof t=="string"?M[t]:[t.width,t.height],s=i.written.file.split("/").slice(0,-1).join("/"),r=new Presentation(e,s);return i.options.theme&&(r.theme=JSON.parse(JSON.stringify(i.options.theme))),i.build(r),r._def}
2
+ import{themeColor as P,themeColorOf as T}from"@allyhub/chart";import{presetAdjustments as te}from"@allyhub/ooxml/geometry";import{connectorBetween as re,connectorEnds as se,siteOn as ie,sitesOf as ne}from"./connect.js";import{framedComponent as oe}from"@allyhub/piece";import{COLOR_TRANSFORMS as F,colorOfFile as ae,GRADIENT_PATHS as z,inGroup as I,THEME_COLORS as A}from"@allyhub/formats";import{MSO_ARROWHEAD as C,MSO_ARROWHEAD_SIZE as S,MSO_CONNECTOR as he,MSO_LINE as de,MSO_LINE_CAP as le,MSO_LINE_COMPOUND as fe,MSO_LINE_JOIN as ce,MSO_PATTERN_TYPE as ue,TILE_ALIGNMENT as pe,MSO_SHAPE as D,MSO_SHAPE_TYPE as _e,MSO_TEXT_ORIENTATION as G,PP_PLACEHOLDER as H}from"./enums.js";import{Chart as ge}from"./chart-api.js";import{AUTOSHAPE_STYLE as g,SHADOW_DEFAULTS as U,LINE_DEFAULTS as x,PATTERN_DEFAULTS as O,TILE_DEFAULTS as B,INNER_SHADOW_DEFAULTS as me,GLOW_DEFAULTS as v,REFLECTION_DEFAULTS as we,PLAYBACK_DEFAULTS as W,CONNECTOR_GEOMETRIES as be,CONNECTOR_STYLE as Y,FOOTER_IDX as ye,isConnectorGeometry as M,OFFICE_TEXT_STYLES as xe,placeholderLevels as Ee,TEXT_INSETS as w,TEXTBOX_FRAME as Se}from"./office.js";import{masterPlaceholder as X}from"./placeholders.js";import{strict as a}from"./strict.js";import{DEFAULT_TABLE_STYLE as Oe,TABLE_STYLES as $e,tableStyleOf as Z}from"./table-style.js";import{EMU_PER_PT as R,SLIDE_SIZES as j,length as l,lengthOr as $}from"./units.js";class ke extends Error{constructor(e){super(`${e} (allyhub slides capabilities lists what the API holds).`),this.name="Unsupported"}}export const refuse=i=>{throw new ke(i)};const Te=/^#?[0-9a-f]{6}$/iu,J=i=>{if(!Te.test(i))throw new Error(`rgb ${i} is not RRGGBB.`);return`#${i.replace("#","").toUpperCase()}`};function N(i,e){if(typeof i!="string")return i;const t=ae(i);if(t===void 0)throw new Error(`${e} is a theme colour (accent1), one lighter or darker (accent1 lighter 40%) or #RRGGBB, not ${i}.`);return t}export const OFFICE_COLOR_MAP={...Object.fromEntries(A.map(i=>[i,i])),tx1:"dk1",bg1:"lt1",tx2:"dk2",bg2:"lt2"};const Ae=["bg1","tx1","bg2","tx2","accent1","accent2","accent3","accent4","accent5","accent6","hlink","folHlink"];function K(i){const e={};for(const[t,r]of Object.entries(i))if(r!==void 0){if(!Ae.includes(t))throw new Error(`A colour map maps bg1, tx1, bg2, tx2, accent1 to accent6, hlink and folHlink, not ${t}.`);if(!A.includes(r))throw new Error(`A colour map's ${t} is one of the theme's colours (${A.join(", ")}), not ${r}.`);e[t]=r}return e}export const RGBColor=Object.assign(function(e,t,r){for(const o of[e,t,r])if(!Number.isInteger(o)||o<0||o>255)throw new Error(`RGBColor(${String(e)}, ${String(t)}, ${String(r)}): each is 0 to 255.`);const s=`#${[e,t,r].map(o=>o.toString(16).padStart(2,"0")).join("").toUpperCase()}`;return new.target===void 0?s:new String(s)},{from_string:i=>J(i)});export class ColorFormat{read;write;constructor(e,t){return this.read=e,this.write=t,a(this,"ColorFormat")}get theme_color(){const e=this.read();return e===void 0?void 0:T(e)}set theme_color(e){const t=this.read();e!==void 0&&typeof t=="object"&&"transforms"in t?this.write(t.transforms.length>0?{theme_color:e,transforms:t.transforms}:e):this.write(e===void 0?void 0:P(e,this.brightness))}get transforms(){const e=this.read();return typeof e=="object"&&"transforms"in e?[...e.transforms??[]]:[]}set transforms(e){const t=this.read();if(t===void 0)throw new TypeError("There is no colour to transform: set theme_color or rgb first.");for(const s of e)if(!F.includes(s.name))throw new Error(`A colour's transform is one of ${F.join(", ")}, not ${s.name}.`);const r=e.map(s=>({name:s.name,value:s.value}));if(typeof t=="object"&&"rgb"in t)this.write(r.length>0?{rgb:t.rgb,transforms:r}:{rgb:t.rgb});else{const s=T(t)??"dk1";this.write(r.length>0?{theme_color:s,transforms:r}:s)}}get brightness(){const e=this.read();return typeof e=="object"&&"brightness"in e?e.brightness:0}set brightness(e){if(!(e>=-1&&e<=1))throw new RangeError(`brightness ${String(e)} is not a number from -1.0 to 1.0.`);const t=this.read();if(t===void 0)throw new TypeError("There is no colour to set the brightness of: set theme_color first.");const r=T(t);if(r!==void 0)this.write(P(r,e));else if(e!==0)throw new TypeError("Only a theme colour has a brightness here, so an RGB colour does not: set theme_color first, or rgb to the colour it makes.")}get rgb(){const e=this.read();return typeof e=="object"&&"rgb"in e?e.rgb:void 0}set rgb(e){this.write(e===void 0?void 0:{rgb:J(e)})}}export class Font{def;constructor(e){return this.def=e,a(this,"Font")}_set(e,t){t===void 0?Reflect.deleteProperty(this.def,e):this.def[e]=t}get strike(){const e=this.def.strike;return e==="sngStrike"?!0:e}set strike(e){this._set("strike",e==="noStrike"?!1:e==="sngStrike"?!0:e)}get caps(){return this.def.caps}set caps(e){this._set("caps",e)}get baseline(){return this.def.baseline}set baseline(e){this._set("baseline",e)}get highlight(){return this.def.highlight}set highlight(e){this._set("highlight",e)}get name(){return this.def.name}set name(e){this._set("name",e)}get size(){return $(this.def.size)}set size(e){if(e!==void 0&&e<12700)throw new Error(`A font size is a Length of Pt(1) and over: Pt(${String(e)}) for ${String(e)} points; ${String(e)} alone is ${String(e)} EMU.`);this._set("size",e)}get bold(){return this.def.bold}set bold(e){this._set("bold",e)}get italic(){return this.def.italic}set italic(e){this._set("italic",e)}get underline(){const e=this.def.underline;return e==="sng"?!0:e}set underline(e){this._set("underline",e==="none"?!1:e==="sng"?!0:e)}get spacing(){return $(this.def.spacing)}set spacing(e){this._set("spacing",e)}get color(){return new ColorFormat(()=>this.def.color,e=>{this._set("color",e)})}}export class Hyperlink{def;constructor(e){return this.def=e,a(this,"_Hyperlink")}get address(){return this.def.font?.link}set address(e){this.def.font??={},e===void 0?Reflect.deleteProperty(this.def.font,"link"):this.def.font.link=e}}export class Run{def;constructor(e){return this.def=e,a(this,"_Run")}get text(){return this.def.text}set text(e){this.def.text=e}get font(){return this.def.font??={},new Font(this.def.font)}get hyperlink(){return new Hyperlink(this.def)}}const Me=i=>{if(!Number.isFinite(i)||i<=0)throw new Error(`line_spacing ${String(i)} is not over 0.`);return Number.isInteger(i)&&i>=R?{fixed:i}:{lines:i}},Re=i=>i===void 0?void 0:"lines"in i?i.lines:l(i.fixed),q=i=>{if(!Number.isFinite(i)||i<0)throw new Error(`A paragraph's space ${String(i)} is under 0.`);return i===0||Number.isInteger(i)&&i>=R?i:{lines:i}},Q=i=>i===void 0?void 0:typeof i=="number"?l(i):i.lines,V=i=>i.split(/\n|\v/u).flatMap((e,t)=>[...t>0?[{text:"\v"}]:[],...e===""?[]:[{text:e}]]);class ee{_set(e,t){t===void 0?Reflect.deleteProperty(this.fmt,e):this.fmt[e]=t}get alignment(){return this.fmt.alignment}set alignment(e){this._set("alignment",e)}get line_spacing(){return Re(this.fmt.line_spacing)}set line_spacing(e){this._set("line_spacing",e===void 0?void 0:Me(e))}get space_before(){return Q(this.fmt.space_before)}set space_before(e){this._set("space_before",e===void 0?void 0:q(e))}get space_after(){return Q(this.fmt.space_after)}set space_after(e){this._set("space_after",e===void 0?void 0:q(e))}get font(){return this.fmt.font??={},new Font(this.fmt.font)}}export class Paragraph extends ee{fmt;constructor(e){return super(),this.fmt=e,a(this,"_Paragraph")}get text(){return this.fmt.runs.map(e=>e.text).join("")}set text(e){this.fmt.runs=V(e)}get runs(){return this.fmt.runs.filter(e=>e.text!=="\v").map(e=>new Run(e))}add_run(){const e={text:""};return this.fmt.runs.push(e),new Run(e)}add_line_break(){this.fmt.runs.push({text:"\v"})}clear(){return this.fmt.runs=[],this}get level(){return this.fmt.level}set level(e){if(!Number.isInteger(e)||e<0||e>8)throw new Error(`level ${String(e)} is not 0 to 8.`);this.fmt.level=e}}export class ListLevel extends ee{fmt;constructor(e){return super(),this.fmt=e,a(this,"ListLevel")}get numbered(){return this.fmt.numbered}set numbered(e){this._set("numbered",e)}get bullet(){return this.fmt.bullet}set bullet(e){this._set("bullet",e)}get bullet_font(){return this.fmt.bullet_font}set bullet_font(e){this._set("bullet_font",e)}get bullet_color(){return this.fmt.bullet_color}set bullet_color(e){this._set("bullet_color",e==null?e:N(e,"bullet_color"))}get bullet_size(){return this.fmt.bullet_size}set bullet_size(e){if(typeof e=="number"&&!(e>=.25&&e<=4))throw new Error(`bullet_size is a share of the text's size, 0.25 to 4, not ${String(e)}.`);this._set("bullet_size",e)}get start_at(){return this.fmt.start_at}set start_at(e){if(e!==void 0&&!(Number.isInteger(e)&&e>=1&&e<=32767))throw new Error(`start_at is a whole number from 1 to 32767, not ${String(e)}.`);this._set("start_at",e)}get margin_left(){return $(this.fmt.margin_left)}set margin_left(e){this._set("margin_left",e)}get indent(){return $(this.fmt.indent)}set indent(e){this._set("indent",e)}}const k=i=>Object.freeze(i.map(e=>new ListLevel(e))),je=()=>Array.from({length:9},()=>({})),E=()=>({paragraphs:[],levels:je()});export class TextFrame{def;constructor(e){return this.def=e,a(this,"TextFrame")}_set(e,t){t===void 0?Reflect.deleteProperty(this.def,e):this.def[e]=t}get text(){return this.def.paragraphs.map(e=>e.runs.map(t=>t.text).join("")).join(`
3
+ `)}set text(e){this.def.paragraphs=e.split(`
4
+ `).map(t=>({runs:V(t),level:0}))}get paragraphs(){return this.def.paragraphs.length===0&&this.def.paragraphs.push({runs:[],level:0}),this.def.paragraphs.map(e=>new Paragraph(e))}add_paragraph(){this.def.paragraphs.length===0&&this.def.paragraphs.push({runs:[],level:0});const e={runs:[],level:0};return this.def.paragraphs.push(e),new Paragraph(e)}clear(){const e=this.def.paragraphs[0];this.def.paragraphs=e?[{...e,runs:[]}]:[]}fit_text(e,t=18,r,s){this.def.auto_size="text",this.def.word_wrap=!0;for(const n of this.def.paragraphs)for(const o of n.runs)o.font={...o.font,size:Math.trunc(t*R),...e===void 0?{}:{name:e},...r===void 0?{}:{bold:r},...s===void 0?{}:{italic:s}}}get list_style(){return k(this.def.levels)}get vertical_anchor(){return this.def.vertical_anchor}set vertical_anchor(e){this._set("vertical_anchor",e)}get orientation(){return this.def.orientation}set orientation(e){if(e!==void 0&&!Object.values(G).includes(e))throw new Error(`orientation is one of MSO_TEXT_ORIENTATION's ${Object.values(G).join(", ")}, not ${e}.`);this._set("orientation",e)}get auto_size(){return this.def.auto_size}set auto_size(e){this._set("auto_size",e)}get word_wrap(){return this.def.word_wrap}set word_wrap(e){this._set("word_wrap",e)}get margin_left(){return l(this.def.margin_left??w.left)}set margin_left(e){this.def.margin_left=e}get margin_top(){return l(this.def.margin_top??w.top)}set margin_top(e){this.def.margin_top=e}get margin_right(){return l(this.def.margin_right??w.right)}set margin_right(e){this.def.margin_right=e}get margin_bottom(){return l(this.def.margin_bottom??w.bottom)}set margin_bottom(e){this.def.margin_bottom=e}}export class FillFormat{read;write;start;shape;base;constructor(e,t,r="lt1",s,n=""){return this.read=e,this.write=t,this.start=r,this.shape=s,this.base=n,a(this,"FillFormat")}_only(e){if(this.shape)for(const t of["gradient","pattern","picture_fill"])t!==e&&Reflect.deleteProperty(this.shape,t)}solid(){const e=this.read();this._only("solid"),e==null&&this.write(this.start)}background(){this._only("solid"),this.write(null)}patterned(){const e=this._shape("a pattern");this._only("pattern"),e.pattern??={preset:"pct5",fg:O.fg,bg:O.bg}}get pattern(){return this._pattern().preset}set pattern(e){this._pattern().preset=p(ue,"MSO_PATTERN_TYPE","pattern",e)}_pattern(){const{pattern:e}=this._shape("a pattern");if(!e)throw new TypeError("This fill is no pattern: call fill.patterned() first.");return e}get back_color(){const e=this._pattern();return new ColorFormat(()=>e.bg,t=>{e.bg=t??O.bg})}picture(e,t={}){const r=this._shape("a picture");this._only("picture_fill"),r.picture_fill={path:e,base:this.base,...t.tile?{tile:{...B,...t.tile,align:p(pe,"TILE_ALIGNMENT","tile.align",t.tile.align??B.align)}}:{},...t.transparency===void 0?{}:{transparency:t.transparency}}}_shape(e){if(!this.shape)throw new TypeError(`Only a shape's fill has ${e}.`);return this.shape}gradient(){this._only("gradient"),this._shape("a gradient").gradient??={angle:90,stops:[{at:0,color:"accent1"},{at:1,color:"accent2"}]}}get gradient_path(){return this._gradient().path??"linear"}set gradient_path(e){const t=this._gradient();e==="linear"?delete t.path:z.includes(e)?t.path=e:refuse(`gradient_path is "linear", ${z.map(r=>`"${r}"`).join(", ")}, not ${e}.`)}get gradient_focus(){return{...this._gradient().focus??{left:.5,top:.5,right:.5,bottom:.5}}}set gradient_focus(e){this._gradient().focus={...e}}get gradient_angle(){return this._gradient().angle}set gradient_angle(e){this._gradient().angle=e}get gradient_stops(){return this._gradient().stops.map(e=>new GradientStop(e))}set gradient_stops(e){if(e.length<2)throw new Error("A gradient has two stops at least.");this._gradient().stops=e.map(t=>t instanceof GradientStop?GradientStop.defOf(t):{...t,color:N(t.color,"A gradient stop's colour")})}_gradient(){const{gradient:e}=this._shape("a gradient");if(!e)throw new TypeError("This fill is no gradient: call fill.gradient() first.");return e}get transparency(){return this._shape("a transparency").fill_transparency??0}set transparency(e){if(!(e>=0&&e<=1))throw new Error(`A transparency is a share, 0 to 1, not ${String(e)}.`);this._shape("a transparency").fill_transparency=e}get type(){if(this.shape?.picture_fill)return"picture";if(this.shape?.pattern)return"patterned";if(this.shape?.gradient)return"gradient";const e=this.read();return e===void 0?void 0:e===null?"background":"solid"}get fore_color(){const e=this.shape?.pattern;if(e)return new ColorFormat(()=>e.fg,r=>{e.fg=r??O.fg});const t=this.read();if(t==null)throw new TypeError("This fill is not solid, so it has no fore_color: call fill.solid() first.");return new ColorFormat(()=>this.read()??void 0,r=>{this.write(r??this.start)})}}export class GradientStop{stop;constructor(e){return this.stop=e,a(this,"GradientStop")}static defOf(e){return{...e.stop}}get color(){return new ColorFormat(()=>this.stop.color,e=>{e!==void 0&&(this.stop.color=e)})}get position(){return this.stop.at}set position(e){if(!(e>=0&&e<=1))throw new Error(`A stop's position is a share, 0 to 1, not ${String(e)}.`);this.stop.at=e}get transparency(){return this.stop.transparency??0}set transparency(e){if(!(e>=0&&e<=1))throw new Error(`A transparency is a share, 0 to 1, not ${String(e)}.`);e===0?Reflect.deleteProperty(this.stop,"transparency"):this.stop.transparency=e}}export class ShadowFormat{def;inner;constructor(e,t=!1){return this.def=e,this.inner=t,a(this,"ShadowFormat")}_shadow(){return this.inner?(this.def.inner_shadow??={...me},this.def.inner_shadow):(this.def.shadow??={...U},this.def.shadow)}get visible(){return this.inner?this.def.inner_shadow!==void 0:this.def.shadow!==void 0&&this.def.shadow!==null}set visible(e){e?this._shadow():this.inner?Reflect.deleteProperty(this.def,"inner_shadow"):this.def.shadow=null}get inherit(){return this.def.shadow===void 0}set inherit(e){e?Reflect.deleteProperty(this.def,"shadow"):this.def.shadow??=null}get blur_radius(){return l(this._shadow().blur)}set blur_radius(e){this._shadow().blur=e}get distance(){return l(this._shadow().distance)}set distance(e){this._shadow().distance=e}get angle(){return this._shadow().angle}set angle(e){this._shadow().angle=e}get transparency(){return this._shadow().transparency}set transparency(e){this._shadow().transparency=e}get color(){const e=this._shadow();return new ColorFormat(()=>e.color,t=>{e.color=t??U.color})}}export class GlowFormat{def;constructor(e){return this.def=e,a(this,"GlowFormat")}_glow(){return this.def.glow??={...v},this.def.glow}get visible(){return this.def.glow!==void 0}set visible(e){e?this._glow():Reflect.deleteProperty(this.def,"glow")}get radius(){return l(this.def.glow?.size??0)}set radius(e){e<=0?Reflect.deleteProperty(this.def,"glow"):this._glow().size=e}get transparency(){return this._glow().transparency}set transparency(e){this._glow().transparency=e}get color(){const e=this._glow();return new ColorFormat(()=>e.color,t=>{e.color=t??v.color})}}export class SoftEdgeFormat{def;constructor(e){return this.def=e,a(this,"SoftEdgeFormat")}get radius(){return l(this.def.soft_edges??0)}set radius(e){e<=0?Reflect.deleteProperty(this.def,"soft_edges"):this.def.soft_edges=e}}export class ReflectionFormat{def;constructor(e){return this.def=e,a(this,"ReflectionFormat")}_reflection(){return this.def.reflection??={...we},this.def.reflection}get visible(){return this.def.reflection!==void 0}set visible(e){e?this._reflection():Reflect.deleteProperty(this.def,"reflection")}get transparency(){return this._reflection().transparency}set transparency(e){this._reflection().transparency=e}get size(){return this._reflection().size}set size(e){this._reflection().size=e}get offset(){return l(this._reflection().distance)}set offset(e){this._reflection().distance=e}get blur(){return l(this._reflection().blur)}set blur(e){this._reflection().blur=e}}export class LineFormat{def;constructor(e){return this.def=e,a(this,"LineFormat")}get color(){return new ColorFormat(()=>this.def.line??void 0,e=>{this.def.line=e??null})}get fill(){return new FillFormat(()=>this.def.line,e=>{this.def.line=e},"dk1")}get width(){return l(this.def.line_width??0)}set width(e){this.def.line_width=e}get dash_style(){return this.def.line_dash??null}set dash_style(e){e===null?delete this.def.line_dash:this.def.line_dash=p(de,"MSO_LINE","dash_style",e)}get cap_type(){return this.def.line_cap??x.cap}set cap_type(e){const t=p(le,"MSO_LINE_CAP","cap_type",e);t===x.cap?delete this.def.line_cap:this.def.line_cap=t}get join_type(){return this.def.line_join??x.join}set join_type(e){const t=p(ce,"MSO_LINE_JOIN","join_type",e);t===x.join?delete this.def.line_join:this.def.line_join=t}get compound_type(){return this.def.line_compound??x.compound}set compound_type(e){const t=p(fe,"MSO_LINE_COMPOUND","compound_type",e);t===x.compound?delete this.def.line_compound:this.def.line_compound=t}get begin_arrow(){return this.def.line_begin??"none"}set begin_arrow(e){this.def.line_begin=p(C,"MSO_ARROWHEAD","begin_arrow",e)}get end_arrow(){return this.def.line_end??"none"}set end_arrow(e){this.def.line_end=p(C,"MSO_ARROWHEAD","end_arrow",e)}get begin_arrow_width(){return this.def.line_begin_size?.w??"med"}set begin_arrow_width(e){this.def.line_begin_size={...this.def.line_begin_size,w:p(S,"MSO_ARROWHEAD_SIZE","begin_arrow_width",e)}}get begin_arrow_length(){return this.def.line_begin_size?.len??"med"}set begin_arrow_length(e){this.def.line_begin_size={...this.def.line_begin_size,len:p(S,"MSO_ARROWHEAD_SIZE","begin_arrow_length",e)}}get end_arrow_width(){return this.def.line_end_size?.w??"med"}set end_arrow_width(e){this.def.line_end_size={...this.def.line_end_size,w:p(S,"MSO_ARROWHEAD_SIZE","end_arrow_width",e)}}get end_arrow_length(){return this.def.line_end_size?.len??"med"}set end_arrow_length(e){this.def.line_end_size={...this.def.line_end_size,len:p(S,"MSO_ARROWHEAD_SIZE","end_arrow_length",e)}}}function p(i,e,t,r){if(Object.values(i).includes(r))return r;throw new Error(`${t}: ${String(r)} is not one of ${e}'s ${Object.keys(i).join(", ")}.`)}export class Background{holder;constructor(e){return this.holder=e,a(this,"_Background")}get fill(){return new FillFormat(()=>this.holder.background,e=>{this.holder.background=e??"bg1"})}}export const adjustmentDefaults=i=>te(i).map(e=>e.value/1e5);export class Adjustments{def;constructor(e){return this.def=e,a(this,"Adjustments",{index:t=>this._values()[t],setIndex:(t,r)=>{this._set(t,Number(r))}})}_values(){return this.def.adjustments??adjustmentDefaults(this.def.geometry??"rect")}get length(){return this._values().length}_set(e,t){const r=this._values();if(e<0||e>=r.length)throw new RangeError(`adjustments[${String(e)}]: ${this.def.geometry??"this shape"} has ${String(r.length)}.`);if(!Number.isFinite(t))throw new Error(`adjustments[${String(e)}] = ${String(t)} is not a number.`);r[e]=t,this.def.adjustments=r}}const Ne={left:0,top:0,width:0,height:0};export class Shape{def;inherit;base;constructor(e,t=()=>{},r=""){return this.def=e,this.inherit=t,this.base=r,a(this,"Shape")}get _def(){return this.def}_frame(){return this.def.frame??this.inherit()??Ne}_own(){return this.def.frame??={...this._frame()},this.def.frame}get name(){return this.def.name}set name(e){this.def.name=e}get shape_type(){return this.def.path?"freeform":this.def.kind==="audio"?"movie":M(this.def.geometry)?"line":this.def.kind}get is_placeholder(){return this.def.kind==="placeholder"}get has_table(){return this.def.table!==void 0}get has_chart(){return this.def.chart!==void 0}get chart(){if(!this.def.chart)throw new Error(`${this.def.name} is not a chart.`);return new ge(this.def.chart)}get table(){if(!this.def.table)throw new Error(`${this.def.name} is not a table.`);return new Table(this.def.table)}get placeholder_format(){if(!this.def.placeholder)throw new Error(`${this.def.name} is not a placeholder.`);return a({...this.def.placeholder},"_PlaceholderFormat")}get left(){return l(this._frame().left)}set left(e){this._own().left=e}get top(){return l(this._frame().top)}set top(e){this._own().top=e}get width(){return l(this._frame().width)}set width(e){this._own().width=e}get height(){return l(this._frame().height)}set height(e){this._own().height=e}get rotation(){return this.def.rotation??0}set rotation(e){if(!Number.isFinite(e))throw new Error(`${this.def.name}: rotation is a number of degrees.`);const t=(Math.trunc(e*6e4)%216e5+216e5)%216e5/6e4;t===0?Reflect.deleteProperty(this.def,"rotation"):this.def.rotation=t}get flip_h(){return this.def.flip?.h===!0}set flip_h(e){this._flip("h",e)}get flip_v(){return this.def.flip?.v===!0}set flip_v(e){this._flip("v",e)}_flip(e,t){const r={...this.def.flip};t?r[e]=!0:Reflect.deleteProperty(r,e),Object.keys(r).length===0?Reflect.deleteProperty(this.def,"flip"):this.def.flip=r}get has_text_frame(){return this.def.text!==void 0}get text_frame(){if(!this.def.text)throw new Error(`${this.def.name} (a ${this.shape_type}) has no text frame: has_text_frame is false.`);return new TextFrame(this.def.text)}get text(){return this.text_frame.text}set text(e){this.text_frame.text=e}get fill(){return new FillFormat(()=>this.def.fill,e=>{this.def.fill=e},"lt1",this.def,this.base)}get line(){return new LineFormat(this.def)}get shadow(){return new ShadowFormat(this.def)}get inner_shadow(){return new ShadowFormat(this.def,!0)}get glow(){return new GlowFormat(this.def)}get soft_edge(){return new SoftEdgeFormat(this.def)}get reflection(){return new ReflectionFormat(this.def)}get adjustments(){return new Adjustments(this.def)}_ends(e){if(this.def.path||!M(this.def.geometry))throw new Error(`${this.def.name}.${e}: it is not a connector (add_connector makes one).`);return se(this._frame(),this.def.flip,this.def.rotation)}_move(e,t){const r=re(e,t,this.def.rotation);this.def.frame=r.frame,r.flip?this.def.flip=r.flip:Reflect.deleteProperty(this.def,"flip")}get begin_x(){return l(Math.round(this._ends("begin_x")[0][0]))}set begin_x(e){const[t,r]=this._ends("begin_x");this._move([e,t[1]],r)}get begin_y(){return l(Math.round(this._ends("begin_y")[0][1]))}set begin_y(e){const[t,r]=this._ends("begin_y");this._move([t[0],e],r)}get end_x(){return l(Math.round(this._ends("end_x")[1][0]))}set end_x(e){const[t,r]=this._ends("end_x");this._move(t,[e,r[1]])}get end_y(){return l(Math.round(this._ends("end_y")[1][1]))}set end_y(e){const[t,r]=this._ends("end_y");this._move(t,[r[0],e])}begin_connect(e,t){this._connect("begin",e,t)}end_connect(e,t){this._connect("end",e,t)}_connect(e,t,r){const s=`${e}_connect`,[n,o]=this._ends(s);if(!(t instanceof Shape))throw new Error(`${this.def.name}.${s}(): its shape is a Shape.`);const h=t._def,f={frame:t._frame(),geometry:h.geometry,adjustments:h.adjustments,flip:h.flip,rotation:h.rotation,path:h.path},c=ne(f).length;if(!Number.isInteger(r)||r<0||r>=c)throw new Error(`${this.def.name}.${s}(): ${h.name} has connection sites 0 to ${String(c-1)}; ${String(r)} is not one.`);const u=ie(f,r)??(e==="begin"?n:o);this.def.connect={...this.def.connect,[e]:{shape:h.name,site:r}},this._move(e==="begin"?u:n,e==="begin"?o:u)}}const Le=i=>typeof i=="number"&&Number.isFinite(i),_=(i,e,t,r)=>{for(const[s,n]of Object.entries({left:i,top:e,width:t,height:r}))if(!Le(n))throw new Error(`${s} ${String(n)} is not a length (Emu, Inches, Pt, Cm, Mm).`);if(t<0||r<0)throw new Error("A shape's width and height are 0 or more.");return{left:Math.trunc(i),top:Math.trunc(e),width:Math.trunc(t),height:Math.trunc(r)}},Pe=new Set(Object.values(D));export class FreeformBuilder{steps;sx;sy;make;constructor(e,t,r){return this.steps=[{op:"move",x:e[0],y:e[1]}],[this.sx,this.sy]=typeof t=="number"?[t,t]:t,this.make=r,a(this,"FreeformBuilder")}add_line_segments(e,t=!0){for(const[r,s]of e)this.steps.push({op:"line",x:r,y:s});return t&&this.steps.push({op:"close"}),this}add_curve_segment(e,t,r,s,n,o){if(![e,t,r,s,n,o].every(h=>Number.isFinite(h)))throw new Error("add_curve_segment(x1, y1, x2, y2, x, y) takes six numbers in local units: its two control points and the point it ends at.");return this.steps.push({op:"curve",x1:e,y1:t,x2:r,y2:s,x:n,y:o}),this}move_to(e,t){return this.steps.push({op:"move",x:e,y:t}),this}convert_to_shape(e=0,t=0){this.steps.length<2&&refuse("convert_to_shape(): a freeform needs a segment.");const r=this.steps.flatMap(d=>d.op==="close"?[]:d.op==="curve"?[[d.x1,d.y1],[d.x2,d.y2],[d.x,d.y]]:[[d.x,d.y]]),s=r.map(d=>d[0]),n=r.map(d=>d[1]),o=Math.min(...s),h=Math.min(...n),f=Math.max(...s)-o,c=Math.max(...n)-h;f===0&&c===0&&refuse("convert_to_shape(): a freeform's points are all one point.");const u=(d,m)=>({x:d-o,y:m-h});return this.make({w:f,h:c,steps:this.steps.map(d=>{if(d.op==="close")return d;if(d.op!=="curve")return{op:d.op,...u(d.x,d.y)};const m=u(d.x1,d.y1),y=u(d.x2,d.y2);return{op:"curve",x1:m.x,y1:m.y,x2:y.x,y2:y.y,...u(d.x,d.y)}})},_(Math.round(o*this.sx)+e,Math.round(h*this.sy)+t,Math.round(f*this.sx),Math.round(c*this.sy)))}}export class GroupShape{list;_name;make;constructor(e,t,r){return this.list=e,this._name=t,this.make=r,a(this,"GroupShape")}members(){return this.list.filter(e=>I(e.group,this._name))}box(){const e=this.members().flatMap(s=>s.frame?[s.frame]:[]),t=Math.min(...e.map(s=>s.left)),r=Math.min(...e.map(s=>s.top));return{left:e.length>0?t:0,top:e.length>0?r:0,right:Math.max(0,...e.map(s=>s.left+s.width)),bottom:Math.max(0,...e.map(s=>s.top+s.height))}}get shapes(){return this.make(this._name)}get shape_type(){return _e.GROUP}get name(){return this._name.split("/").pop()??this._name}set name(e){const t=this._name.lastIndexOf("/"),r=t<0?e:`${this._name.slice(0,t)}/${e}`;for(const s of this.members())s.group=`${r}${(s.group??"").slice(this._name.length)}`;this._name=r}get left(){return l(this.box().left)}set left(e){const t=e-this.box().left;for(const r of this.members())r.frame&&(r.frame.left+=t)}get top(){return l(this.box().top)}set top(e){const t=e-this.box().top;for(const r of this.members())r.frame&&(r.frame.top+=t)}get width(){const e=this.box();return l(e.right-e.left)}get height(){const e=this.box();return l(e.bottom-e.top)}}export class Cell{def;table;row;col;constructor(e,t,r,s){return this.def=e,this.table=t,this.row=r,this.col=s,a(this,"_Cell")}get text_frame(){return new TextFrame(this.def.text)}get text(){return this.text_frame.text}set text(e){this.text_frame.text=e}get fill(){return new FillFormat(()=>this.def.fill,e=>{this.def.fill=e})}get borders(){return this.def.borders??{}}set borders(e){this.def.borders=Object.fromEntries(Object.entries(e).map(([t,r])=>[t,{...r,color:N(r.color,`A cell's ${t} border`)}]))}get margin_left(){return l(this.def.text.margin_left??w.left)}set margin_left(e){this.def.text.margin_left=e}get margin_right(){return l(this.def.text.margin_right??w.right)}set margin_right(e){this.def.text.margin_right=e}get margin_top(){return l(this.def.text.margin_top??w.top)}set margin_top(e){this.def.text.margin_top=e}get margin_bottom(){return l(this.def.text.margin_bottom??w.bottom)}set margin_bottom(e){this.def.text.margin_bottom=e}get vertical_anchor(){return this.def.text.vertical_anchor}set vertical_anchor(e){e===void 0?delete this.def.text.vertical_anchor:this.def.text.vertical_anchor=e}get is_merge_origin(){return(this.def.span_width??1)>1||(this.def.span_height??1)>1}get is_spanned(){return this.def.spanned===!0}get span_width(){return this.def.span_width??1}get span_height(){return this.def.span_height??1}merge(e){const t=[this.row,e.row].sort((f,c)=>f-c),r=[this.col,e.col].sort((f,c)=>f-c),[s=0,n=0]=t,[o=0,h=0]=r;for(let f=s;f<=n;f++)for(let c=o;c<=h;c++){const u=this.table.rows[f]?.cells[c];u&&(f===s&&c===o?(h>o&&(u.span_width=h-o+1),n>s&&(u.span_height=n-s+1)):u.spanned=!0)}}split(){const e=this.span_width,t=this.span_height;delete this.def.span_width,delete this.def.span_height;for(let r=this.row;r<this.row+t;r++)for(let s=this.col;s<this.col+e;s++){const n=this.table.rows[r]?.cells[s];n&&delete n.spanned}}}export class Column{def;at;constructor(e,t){return this.def=e,this.at=t,a(this,"_Column")}get width(){return l(this.def.columns[this.at]??0)}set width(e){this.def.columns[this.at]=e}}export class Row{def;at;constructor(e,t){return this.def=e,this.at=t,a(this,"_Row")}get row(){const e=this.def.rows[this.at];if(!e)throw new Error(`The table has no row ${String(this.at)}.`);return e}get height(){return l(this.row.height)}set height(e){this.row.height=e}}export class Table{def;constructor(e){return this.def=e,a(this,"Table")}cell(e,t){const r=this.def.rows[e]?.cells[t];if(!r)throw new Error(`cell(): the table has ${String(this.def.rows.length)} rows and ${String(this.def.columns.length)} columns.`);return new Cell(r,this.def,e,t)}*iter_cells(){for(let e=0;e<this.def.rows.length;e++)for(let t=0;t<this.def.columns.length;t++)yield this.cell(e,t)}get columns(){return this.def.columns.map((e,t)=>new Column(this.def,t))}get rows(){return this.def.rows.map((e,t)=>new Row(this.def,t))}get style(){return Z(this.def.style)?.name??null}set style(e){if(e===null){delete this.def.style;return}const t=Z(e)??refuse(`Table.style: ${e} is none of PowerPoint's built-in table styles (${$e.slice(0,3).map(r=>r.name).join(", ")}…).`);this.def.style=t.id}flag(e){return this.def[e]===!0}get first_row(){return this.flag("first_row")}set first_row(e){this.def.first_row=e}get first_col(){return this.flag("first_col")}set first_col(e){this.def.first_col=e}get last_row(){return this.flag("last_row")}set last_row(e){this.def.last_row=e}get last_col(){return this.flag("last_col")}set last_col(e){this.def.last_col=e}get horz_banding(){return this.flag("horz_banding")}set horz_banding(e){this.def.horz_banding=e}get vert_banding(){return this.flag("vert_banding")}set vert_banding(e){this.def.vert_banding=e}}function Fe(i,e,t=[]){const r=new Set([...i,...t].map(n=>n.name));let s=1;for(;r.has(`${e}-${String(s)}`);)s++;return`${e}-${String(s)}`}export class ShapeCollection{list;base;components;inherit;group;under;constructor(e,t,r,s=()=>{},n=()=>[],o){return this.list=e,this.base=t,this.components=r,this.inherit=s,this.under=n,this.group=o,a(this,"SlideShapes",{index:h=>this._at(h)})}_wrap(e){return new Shape(e,()=>this.inherit(e))}_at(e){const t=this.list[e];return t?this._wrap(t):void 0}*[Symbol.iterator](){for(const e of this.list)yield this._wrap(e)}get length(){return this.list.length}get(e){const t=this.list.find(r=>r.name===e);return t?this._wrap(t):void 0}get title(){const e=this.list.find(t=>t.placeholder?.type==="title"||t.placeholder?.type==="ctrTitle");return e?this._wrap(e):void 0}get placeholders(){return new Placeholders(this.list,this.inherit)}_add(e,t){const r={name:Fe(this.list,e,this.under()),...t,...this.group===void 0?{}:{group:this.group}};return this.list.push(r),this._wrap(r)}add_textbox(e,t,r,s){return this._add("textbox",{kind:"textbox",frame:_(e,t,r,s),text:{...E(),...Se}})}add_picture(e,t,r,s,n){return(s===void 0||n===void 0)&&refuse("add_picture() takes a width and a height here: a picture's own size is not read while a deck's code runs"),this._add("picture",{kind:"picture",frame:_(t,r,s??0,n??0),media:{path:e,base:this.base}})}add_movie(e,t,r,s,n,o={}){return this._add("movie",{kind:"movie",frame:_(t,r,s,n),media:{path:e,base:this.base,...o.poster_frame_time===void 0?{}:{poster:o.poster_frame_time},...o.playback?{playback:{...o.playback}}:{}}})}add_audio(e,t,r,s=W.icon,n=W.icon,o={}){return this._add("audio",{kind:"audio",frame:_(t,r,s,n),media:{path:e,base:this.base,...o.playback?{playback:{...o.playback}}:{}}})}add_shape(e,t,r,s,n){Pe.has(e)||refuse(`add_shape(): ${e} is not one of MSO_SHAPE's ${Object.keys(D).join(", ")}`);const o=E();return o.vertical_anchor=g.vertical_anchor,o.paragraphs=[{runs:[],level:0,alignment:g.alignment}],this._add("shape",{kind:"autoshape",frame:_(t,r,s,n),geometry:e,fill:g.fill,line:g.line,line_width:g.line_width,text:o})}add_table(e,t,r,s,n,o){(e<1||t<1)&&refuse("add_table(): a table has at least a row and a column.");const h=Math.floor(n/t),f=Math.floor(o/e);return this._add("table",{kind:"table",frame:_(r,s,n,o),table:{style:Oe,first_row:!0,horz_banding:!0,columns:Array.from({length:t},()=>h),rows:Array.from({length:e},()=>({height:f,cells:Array.from({length:t},()=>({text:E()}))}))}})}add_chart(e,t,r,s,n,o){return this._add("chart",{kind:"chart",frame:_(t,r,s,n),chart:{type:e,categories:[...o.categories],series:o._series()}})}add_group_shape(){const e=this.group===void 0?"":`${this.group}/`;let t=1;for(;this.list.some(r=>I(r.group,`${e}group-${String(t)}`));)t++;return new GroupShape(this.list,`${e}group-${String(t)}`,r=>new ShapeCollection(this.list,this.base,this.components,this.inherit,this.under,r))}build_freeform(e=0,t=0,r=1){return new FreeformBuilder([e,t],r,(s,n)=>{const o=E();return o.vertical_anchor=g.vertical_anchor,o.paragraphs=[{runs:[],level:0,alignment:g.alignment}],this._add("freeform",{kind:"autoshape",frame:n,path:s,fill:g.fill,line:g.line,line_width:g.line_width,text:o})})}add_connector(e,t,r,s,n){M(e)||refuse(`add_connector(): ${e} is not one of MSO_CONNECTOR's ${Object.keys(he).join(", ")}, nor a connector's preset (${be.join(", ")})`);const o=_(Math.min(t,s),Math.min(r,n),Math.abs(s-t),Math.abs(n-r)),h=s<t,f=n<r;return this._add("connector",{kind:"autoshape",frame:o,geometry:e,...h||f?{flip:{...h?{h}:{},...f?{v:f}:{}}}:{},line:Y.line,line_width:Y.line_width})}add_component(e,t,r,s,n,o={},h={}){if(!Object.hasOwn(this.components(),e))throw new Error(`add_component(): the presentation has no component ${e}; add it with prs.components.add("${e}", { … }) first.`);if(h.dur!==void 0&&!(Number.isFinite(h.dur)&&h.dur>0))throw new Error(`add_component(): dur is how long ${e} moves, seconds over 0; it was ${String(h.dur)}.`);return this._add(e,{kind:"component",frame:_(t,r,s,n),component:{name:e,props:o,...h.dur===void 0?{}:{dur:h.dur}}})}}export const NAME_OF_TYPE={title:"title",ctrTitle:"title",subTitle:"subtitle",body:"body",pic:"picture",media:"media",obj:"content",dt:"date",ftr:"footer",sldNum:"slide-number"};export class Placeholders{list;inherit;constructor(e,t=()=>{}){return this.list=e,this.inherit=t,a(this,"placeholders",{index:r=>this.get(r)})}_wrap(e){return new Shape(e,()=>this.inherit(e))}*[Symbol.iterator](){for(const e of this.list)e.kind==="placeholder"&&(yield this._wrap(e))}get length(){return this.list.filter(e=>e.kind==="placeholder").length}get(e){const t=this.list.find(r=>r.kind==="placeholder"&&(typeof e=="number"?r.placeholder?.idx===e:r.name===e||r.placeholder?.type===e));return t?this._wrap(t):void 0}add(e,t,r,s,n,o={}){const h=typeof t=="object"?t:o,f=typeof t=="object"?void 0:t;Object.values(H).includes(e)||refuse(`placeholders.add(): ${e} is not one of PP_PLACEHOLDER's ${Object.keys(H).join(", ")}`);const c=this.list.filter(b=>b.kind==="placeholder"),u=new Set(c.map(b=>b.placeholder?.idx));let d=e==="title"||e==="ctrTitle"?0:ye[e]??1;for(u.has(d)&&d===0&&(d=1);u.has(d);)d++;const m=h.name??NAME_OF_TYPE[e];if(this.list.some(b=>b.name===m))throw new Error(`Two shapes are ${m}: give the placeholder a name ({ name }).`);const y=[f,r,s,n].filter(b=>b!==void 0);if(y.length!==0&&y.length!==4)throw new Error("placeholders.add(type, left, top, width, height): give all four, or none to take the master's frame.");const L={name:m,kind:"placeholder",placeholder:{type:e,idx:d,...h.orient==="vert"?{orient:"vert"}:{}},...y.length===4?{frame:_(f??0,r??0,s??0,n??0)}:{},text:{paragraphs:[],levels:Ee(e)}};return this.list.push(L),this._wrap(L)}}export class SlideLayout{def;master;ctx;constructor(e,t,r){return this.def=e,this.master=t,this.ctx=r,a(this,"SlideLayout")}get _def(){return this.def}inherit=e=>e.placeholder?X(this.master._def,e.placeholder.type)?.frame:void 0;get name(){return this.def.name}get slide_master(){return this.master}get display_master_shapes(){return this.def.display_master_shapes??!0}set display_master_shapes(e){e?delete this.def.display_master_shapes:this.def.display_master_shapes=!1}get color_map(){return this.def.color_map&&{...this.def.color_map}}set color_map(e){e===void 0?delete this.def.color_map:this.def.color_map=K(e)}get background(){return new Background(this.def)}get placeholders(){return new Placeholders(this.def.shapes,this.inherit)}get shapes(){return new ShapeCollection(this.def.shapes,this.ctx.base,this.ctx.components,this.inherit,()=>this.master._def.shapes)}}export class SlideLayouts{list;make;constructor(e,t){return this.list=e,this.make=t,a(this,"SlideLayouts",{index:r=>this.list[r]})}*[Symbol.iterator](){yield*this.list}get length(){return this.list.length}get_by_name(e,t){return this.list.find(r=>r.name===e)??t}index(e){const t=this.list.indexOf(e);if(t<0)throw new Error(`${e.name} is not among these layouts.`);return t}add(e,t){if(!this.make)throw new Error("A layout is added to a master: master.slide_layouts.add(name).");const r=this.make(e);return t?.(r),r}}export class TextStyles{def;constructor(e){return this.def=e,a(this,"text_styles")}get title_style(){return k(this.def.title)}get body_style(){return k(this.def.body)}get other_style(){return k(this.def.other)}}export class SlideMaster{def;layouts=[];ctx;allLayouts;constructor(e,t,r){return this.def=e,this.ctx=t,this.allLayouts=r,a(this,"SlideMaster")}get _def(){return this.def}get name(){return this.def.name}get color_map(){return{...OFFICE_COLOR_MAP,...this.def.color_map}}set color_map(e){const t=K(e),r=Object.fromEntries(Object.entries(t).filter(([s,n])=>OFFICE_COLOR_MAP[s]!==n));Object.keys(r).length===0?delete this.def.color_map:this.def.color_map=r}get background(){return new Background(this.def)}get placeholders(){return new Placeholders(this.def.shapes)}get shapes(){return new ShapeCollection(this.def.shapes,this.ctx.base,this.ctx.components)}get text_styles(){return new TextStyles(this.def.text_styles)}get slide_layouts(){return new SlideLayouts(this.layouts,e=>{if(this.allLayouts.some(s=>s.name===e))throw new Error(`Two layouts are "${e}": a layout's name is unique in the deck, as its slides file names it.`);const t={name:e,master:this.def.name,shapes:[]};this.def.layouts.push(t);const r=new SlideLayout(t,this,this.ctx);return this.layouts.push(r),this.allLayouts.push(r),r})}}export class SlideMasters{list;make;constructor(e,t){return this.list=e,this.make=t,a(this,"SlideMasters",{index:r=>this.list[r]})}*[Symbol.iterator](){yield*this.list}get length(){return this.list.length}index(e){return this.list.indexOf(e)}add(e,t){const r=this.make(e);return t?.(r),r}}export class GeneratedSlide{own;def;layout;constructor(e,t,r){this.def=e,this.layout=t,this.own=t._def.shapes.filter(n=>n.kind==="placeholder").map(n=>({name:n.name,kind:"placeholder",...n.placeholder?{placeholder:{...n.placeholder}}:{},text:E()}));const s=n=>{const o=t._def.shapes.find(h=>h.kind==="placeholder"&&h.placeholder?.idx===n.placeholder?.idx);return o?o.frame??(o.placeholder?X(t.slide_master._def,o.placeholder.type)?.frame:void 0):void 0};return this._shapes=new ShapeCollection(this.own,r.base,r.components,s,()=>[...t.slide_master._def.shapes,...t._def.shapes]),this._placeholders=new Placeholders(this.own,s),a(this,"Slide")}_shapes;_placeholders;get shapes(){return this._shapes}get placeholders(){return this._placeholders}get slide_id(){return this.def.id}get slide_layout(){return this.layout}get has_notes_slide(){return this.def.notes!==void 0}get notes_slide(){const e=this.def;return a({notes_text_frame:a({get text(){return e.notes??""},set text(t){e.notes=t}},"TextFrame")},"NotesSlide")}get transition(){return this.def.transition}set transition(e){e===void 0?delete this.def.transition:this.def.transition=e}get animations(){return new Animations(this.def.animations??=[])}_done(){const e={},t=[];for(const r of this.own)r.kind==="placeholder"&&r.placeholder?(r.text?.paragraphs.some(s=>s.runs.length>0)&&(e[r.placeholder.idx]=r.text.paragraphs),r.frame&&t.push({...r,text:E()})):t.push(r);return{...this.def,shapes:t,text:e}}}export class Animations{list;constructor(e){return this.list=e,a(this,"Animations")}add(e,t,r={}){this.list.push({shape:typeof e=="string"?e:e.name,effect:t,...r})}get length(){return this.list.length}}class ze{gen;constructor(e){return this.gen=e,a(this,"slides")}add_slide(e,t){return this.gen._add(e,t)}}export class Generator{list=[];prs;ctx;constructor(e,t){return this.prs=e,this.ctx=t,a(this,"Generator")}data(e){return this.ctx.data(e)}get slides(){return new ze(this)}_add(e,t){const r=typeof e=="string"?this.prs._layout(e):e;if(!r)throw new Error(`add_slide(): the presentation has no layout ${typeof e=="string"?e:e.name}.`);if(!/^[A-Za-z0-9_-]+$/u.test(t))throw new Error(`add_slide(): ${t} is not an id of letters, digits, _ and -.`);if(this.list.some(n=>n.slide_id===t))throw new Error(`add_slide(): two slides are ${t}.`);const s=new GeneratedSlide({id:t,layout:r.name,shapes:[],text:{}},r,this.prs._ctx);return this.list.push(s),s}_made(){return this.list.map(e=>e._done())}}const Ie=()=>JSON.parse(JSON.stringify(xe));export class Presentation{masters=[];layouts=[];def;_ctx;constructor(e,t){return this.def={slide_width:e[0],slide_height:e[1],masters:[],components:{},generators:{}},this._ctx={base:t,components:()=>this.def.components},a(this,"Presentation")}get _def(){return this.def}get slide_width(){return l(this.def.slide_width)}set slide_width(e){this.def.slide_width=e}get slide_height(){return l(this.def.slide_height)}set slide_height(e){this.def.slide_height=e}get slide_masters(){return new SlideMasters(this.masters,e=>{if(this.masters.some(s=>s.name===e))throw new Error(`Two masters are "${e}".`);const t={name:e,background:"bg1",text_styles:Ie(),shapes:[],layouts:[]};this.def.masters.push(t);const r=new SlideMaster(t,this._ctx,this.layouts);return this.masters.push(r),r})}get slide_master(){const e=this.masters[0];if(!e)throw new Error("The presentation has no master yet: prs.slide_masters.add(name) makes one.");return e}get slide_layouts(){const e=this.masters[0];return e?e.slide_layouts:new SlideLayouts([])}get slides(){return refuse("A deck's slides are in the slides file presentation({ slides }) names, in order, each on a layout, and their words in its script; slides made from data are a generator's (prs.generators.add)")}save(){return refuse("A deck is not saved by its code: allyhub render writes its PDF, pictures and PPTX")}get theme(){return this.def.theme??={},this.def.theme}set theme(e){this.def.theme=e}get components(){return a({add:(e,t)=>{if(Object.hasOwn(this.def.components,e))throw new Error(`Two components are "${e}".`);const r=oe(e,t);if(!r)throw new Error(`Component ${e} is not a component: give what defineComponent makes, or { props, layers }.`);this.def.components[e]=r}},"components")}get generators(){return a({add:(e,t)=>{if(Object.hasOwn(this.def.generators,e))throw new Error(`Two generators are "${e}".`);this.def.generators[e]={name:e,make:r=>{const s=new Generator(this,r);return t(s),s._made()}}}},"generators")}_layout(e){return this.layouts.find(t=>t.name===e)}}export const DECK_BRAND="__allyhubDeck";export function isDeck(i){return typeof i=="object"&&i!==null&&DECK_BRAND in i}export const presentationFor=i=>(e,t)=>{const[r,s]=typeof e=="function"?[{},e]:[e,t];if(typeof s!="function")throw new Error(`A deck's module exports one deck: export default presentation({ slides: "./deck.yaml", script: "./deck.{locale}.yaml", size }, (prs) => { … masters, layouts, components … }), its slides and its script named from its folder.`);if(r.script!==void 0&&!r.script.includes("{locale}"))throw new Error(`presentation(): script ${r.script} names one file: write {locale} in its name for each language (./deck.{locale}.yaml).`);if(typeof r.size=="string"&&!Object.hasOwn(j,r.size))throw new Error(`presentation(): size ${r.size} is not one of ${Object.keys(j).join(", ")}, or { width, height } in EMU.`);return{[DECK_BRAND]:!0,kind:"slides",options:r,build:s,written:{file:i}}};export function evaluateDeck(i){const e=i.options.size??"16:9",t=typeof e=="string"?j[e]:[e.width,e.height],r=i.written.file.split("/").slice(0,-1).join("/"),s=new Presentation(t,r);return i.options.theme&&(s.theme=JSON.parse(JSON.stringify(i.options.theme))),i.build(s),s._def}
@@ -1,2 +1,2 @@
1
1
  /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{Animations as l,Background as h,Cell as d,ColorFormat as p,Column as c,FillFormat as m,Font as y,FreeformBuilder as _,GeneratedSlide as w,Generator as f,GroupShape as u,Hyperlink as g,LineFormat as b,ListLevel as S,ShadowFormat as A,GradientStop as P,Paragraph as E,Placeholders as O,Presentation as L,Row as C,Run as x,Shape as R,ShapeCollection as M,SlideLayout as T,SlideLayouts as k,SlideMaster as H,SlideMasters as v,Table as I,TextFrame as G,TextStyles as F}from"./api.js";import{CategoryChartData as B,Chart as D,XyChartData as N,XySeriesData as j,ChartAxis as W,ChartFormat as z,ChartLegend as X,MajorGridlines as Z,TickLabels as U,ChartPlot as Y,ChartPoint as V,ChartSeries as K,DataLabels as q}from"./chart-api.js";import{MSO_ANCHOR as J,MSO_ARROWHEAD as Q,MSO_ARROWHEAD_SIZE as $,MSO_AUTO_SIZE as ee,MSO_CONNECTOR as te,MSO_FILL as ae,MSO_LINE as oe,MSO_SHAPE as se,MSO_SHAPE_TYPE as re,MSO_THEME_COLOR as ie,PP_ALIGN as ne,PP_PLACEHOLDER as le,THEME_FONT as he,XL_CHART_TYPE as de,XL_LABEL_POSITION as pe,XL_LEGEND_POSITION as ce}from"./enums.js";import{publicNames as s}from"./strict.js";const a={Presentation:{theme:"The theme's colours (dk1…folHlink) and fonts (major, minor), over the project's look.",components:"components.add(name, { props, layers }): a shape drawn by code, by the layer contract.",generators:"generators.add(name, (g) => { g.data(path); g.slides.add_slide(layout, id) … }): slides made from data, placed in the slides file as one block."},SlideMasters:{add:"add(name): a master, with Office's text styles and no placeholders yet."},_Cell:{borders:"Its edges: { left, right, top, bottom }, each { color, width } (a:lnL…)."},LineFormat:{begin_arrow:"What the end of the line where it starts has (MSO_ARROWHEAD): PowerPoint's Begin Arrow type (a:headEnd).",end_arrow:"What the end of the line where it ends has (MSO_ARROWHEAD): PowerPoint's End Arrow type (a:tailEnd).",begin_arrow_width:"How wide the arrowhead where the line starts is (MSO_ARROWHEAD_SIZE): PowerPoint's Begin Arrow size (a:headEnd@w).",begin_arrow_length:"How long the arrowhead where the line starts is (MSO_ARROWHEAD_SIZE): PowerPoint's Begin Arrow size (a:headEnd@len).",end_arrow_width:"How wide the arrowhead where the line ends is (MSO_ARROWHEAD_SIZE): PowerPoint's End Arrow size (a:tailEnd@w).",end_arrow_length:"How long the arrowhead where the line ends is (MSO_ARROWHEAD_SIZE): PowerPoint's End Arrow size (a:tailEnd@len)."},FillFormat:{transparency:"How much of the fill shows through, a share: PowerPoint's Transparency (a:alpha).",gradient_stops:"Its stops: each read as python-pptx's (color, position), and set whole as [{ at, color, transparency }], `at` and `transparency` shares, a colour as the slides file writes one (accent1, accent1 lighter 40%, #RRGGBB) or a Color; python-pptx's stops can only be read and changed in place."},_GradientStop:{transparency:"How much of its colour shows through, a share (a:alpha)."},ShadowFormat:{blur_radius:"How far the shadow blurs, a Length (a:outerShdw blurRad).",distance:"How far it falls from the shape, a Length (dist).",angle:"The way it falls, degrees clockwise from the right (dir).",transparency:"How much shows through it, a share (a:alpha).",color:"Its colour, a ColorFormat."},Shape:{flip_h:"Mirrored left to right (a:xfrm flipH), as the slides file's flip_h; its text reads as it is.",flip_v:"Mirrored top to bottom (a:xfrm flipV), as the slides file's flip_v."},FreeformBuilder:{add_curve_segment:"add_curve_segment(x1, y1, x2, y2, x, y): a cubic Bézier segment by its two control points (a:cubicBezTo)."},Font:{strike:"A line through it (@strike).",baseline:"Raised or lowered, a share of its size: superscript 0.3, subscript -0.25 (@baseline).",highlight:"The colour behind it, #RRGGBB as RGBColor gives one (a:highlight).",spacing:"Space added between letters, a Length, negative to tighten (PowerPoint's Character Spacing, a:rPr spc)."},SlideMaster:{text_styles:"Its text styles (p:txStyles): title_style, body_style, other_style, nine ListLevels each, Office's to start with."},SlideLayouts:{add:"add(name): a layout on this master."},SlideLayout:{display_master_shapes:"Whether its master's shapes are drawn on its slides, true unless set: PowerPoint's Hide Background Graphics (@showMasterSp)."},placeholders:{add:"add(PP_PLACEHOLDER.X, left?, top?, width?, height?, { name }): a placeholder on a master or a layout; a layout's without a frame takes its master's of its base type."},SlideShapes:{add_component:"add_component(name, left, top, width, height, props): a component of the presentation in a frame.",get:"get(name): a shape by its name."},TextFrame:{list_style:"Its list style (a:lstStyle): nine ListLevels, level 0 first, what its paragraphs take where they set nothing."},ListLevel:{"*":"A level of a list style: alignment, line_spacing, space_before, space_after, font, bullet (a character, or null for none), bullet_font, numbered (a:buAutoNum: arabicPeriod, alphaLcPeriod…), margin_left, indent."},text_styles:{"*":"title_style, body_style, other_style: a master's text styles, nine ListLevels each."},Animations:{"*":"A generated slide's Animation Pane: add(shape, effect, { start, direction, duration, delay, paragraph, path }), in order."},Slide:{animations:"Its Animation Pane, which python-pptx has no API for.",transition:"How it comes on from the slide before: { type, direction, duration }, which python-pptx has no API for."},Generator:{"*":"What a generator's function is given: data(path), and slides.add_slide(layout, id)."}},me={Presentation:{slides:"A deck's slides are in the slides file it names, their words in its script; slides from data are a generator's.",save:"A deck is not saved by its code: allyhub render writes its files."}},ye={Presentation:L.prototype,SlideMasters:v.prototype,SlideMaster:H.prototype,SlideLayouts:k.prototype,SlideLayout:T.prototype,Slide:w.prototype,placeholders:O.prototype,SlideShapes:M.prototype,Shape:R.prototype,TextFrame:G.prototype,_Paragraph:E.prototype,_Run:x.prototype,_Hyperlink:g.prototype,Font:y.prototype,ColorFormat:p.prototype,FillFormat:m.prototype,LineFormat:b.prototype,ShadowFormat:A.prototype,_GradientStop:P.prototype,FreeformBuilder:_.prototype,GroupShape:u.prototype,Table:I.prototype,CategoryChartData:B.prototype,XyChartData:N.prototype,XySeriesData:j.prototype,Chart:D.prototype,Plot:Y.prototype,Series:K.prototype,Point:V.prototype,DataLabels:q.prototype,Legend:X.prototype,Axis:W.prototype,TickLabels:U.prototype,MajorGridlines:Z.prototype,ChartFormat:z.prototype,_Cell:d.prototype,_Column:c.prototype,_Row:C.prototype,_Background:h.prototype},_e={Animations:l.prototype,ListLevel:S.prototype,text_styles:F.prototype,Generator:f.prototype},we=()=>{const e={};for(const[t,r]of Object.entries(ye)){const i=a[t]??{},n=me[t]??{};e[t]=s(r).filter(o=>!Object.hasOwn(i,o)&&!Object.hasOwn(n,o))}return e};export const CAPABILITIES={reference:{library:"python-pptx",version:"1.0.2",docs:"https://python-pptx.readthedocs.io/"},holds:we(),enums:Object.fromEntries(Object.entries({MSO_THEME_COLOR:ie,PP_ALIGN:ne,MSO_ANCHOR:J,MSO_AUTO_SIZE:ee,PP_PLACEHOLDER:le,MSO_SHAPE:se,MSO_CONNECTOR:te,MSO_SHAPE_TYPE:re,MSO_FILL:ae,MSO_LINE:oe,XL_CHART_TYPE:de,XL_LABEL_POSITION:pe,XL_LEGEND_POSITION:ce,MSO_ARROWHEAD:Q,MSO_ARROWHEAD_SIZE:$,THEME_FONT:he}).map(([e,t])=>[e,Object.keys(t)])),units:["Emu","Inches","Pt","Cm","Mm","Centipoints","RGBColor"],differs:["The entry is export default presentation({ slides: ./deck.yaml, script: ./deck.{locale}.yaml, size, theme }, (prs) => { … }), not Presentation(path): a deck is made by its code, never opened from a template. Its masters and layouts are made with the additions below; its slides are in the slides file it names.","A name python-pptx has that is not held throws where it is used, naming what the class holds; python-pptx's x[i] is held where it indexes (slide_masters[0], slide_layouts[0], placeholders[idx], shapes[0]), and len(x) is x.length.","A Length (what Inches(1) and Pt(12) give, and what a length reads, shape.width) is a Number of EMU with python-pptx's emu, inches, cm, mm, pt, centipoints and twips. Arithmetic on Lengths gives a plain number, as python's int does; two Lengths of one value are ===, and one is compared with a plain number by its .emu.",`An enumeration's members are PresentationML's values (MSO_THEME_COLOR.ACCENT_1 is "accent1", PP_ALIGN.CENTER "ctr"), not integers; TEXT_1 and BACKGROUND_1 are dk1 and lt1, a master's standard colour map. MSO_SHAPE_TYPE.COMPONENT is a component's. PP_PARAGRAPH_ALIGNMENT and MSO_LINE_DASH_STYLE are PP_ALIGN and MSO_LINE by python-pptx's other names.`,`A colour's rgb is "#RRGGBB": RGBColor(r, g, b), new RGBColor(r, g, b) and RGBColor.from_string("RRGGBB") make one.`,"A colour's brightness is a theme colour's: python-pptx also gives an RGB colour one, which is refused here (set rgb to the colour it makes).","line_spacing is a number of lines, or a Length of Pt(1) and over for a fixed height (python-pptx tells them apart by type).","add_picture() takes both width and height: a picture's own size is not read while a deck's code runs.","add_connector() takes MSO_CONNECTOR's STRAIGHT, ELBOW and CURVE, and also a connector's preset by name where python-pptx has none (straightConnector1, bentConnector2 to 5, curvedConnector2 to 5); a connector's adjustments (an elbow's middle) are its shape.adjustments.","begin_connect() and end_connect() take a site of the shape's own geometry, as PowerPoint numbers them (a rectangle's 0 top, 1 left, 2 bottom, 3 right; an ellipse has 8), where python-pptx places an end on those four of its box whatever its shape; a site the shape has not throws. A glued end follows its shape where the slides file or a person moves it, as PowerPoint's does.","add_movie(movie_file, left, top, width, height, { poster_frame_time }) takes a video file, its poster a moment of it in seconds, not poster_frame_image.","A shape's name is its kind and a number (textbox-1, shape-2), and a placeholder's its type's (title, body, subtitle): the slides file and the script name shapes by name.","fit_text() sets the frame to shrink its text when it is drawn (MSO_AUTO_SIZE.TEXT_TO_FIT_SHAPE) from max_size: it reads no font file.","Font.underline is a single underline or none.","Font.size refuses a size under Pt(1): a bare number is EMU, so size = 12 (python-pptx takes it) draws nothing.","A chart holds column, bar, line, area, pie, doughnut and XY scatter types; it has no 3D, no bubble, no radar and no second axis. A chart in the slides file can read its numbers from a project file: data, categories and series name it and its columns.","A Point holds format.fill alone, and its fill is its category's colour, one for every series of the chart (the slides file's category_colors), shown where the chart varies by categories; python-pptx's point is its own series'.","A table has no style, where python-pptx's starts with Medium Style 2: its look is its cells' (fill, borders, text), and first_row and the like say what its rows are and paint nothing. add_table returns its shape, whose .table is the table.","A group is its shapes: they are listed with the shapes the group is among, drawn as they are, and a group holds no group; its box is theirs, so left and top move them and width and height only read.","A presentation is 16:9 (12192000 × 6858000) and its theme Office 2013–2022's over the project's look; python-pptx's template is 4:3 with Office 2007's.","prs.slide_layouts and prs.slide_master are the first master's, as python-pptx's; a generator's add_slide also takes a layout of any master by name."],adds:{...a,...Object.fromEntries(Object.entries(_e).map(([e,t])=>[e,{...a[e]??{},names:s(t).join(", ")}]))}};
2
+ import{Animations as l,GlowFormat as h,ReflectionFormat as d,SoftEdgeFormat as p,Background as c,Cell as m,ColorFormat as _,Column as y,FillFormat as f,Font as u,FreeformBuilder as w,GeneratedSlide as g,Generator as S,GroupShape as b,Hyperlink as P,LineFormat as A,ListLevel as O,ShadowFormat as E,GradientStop as L,Paragraph as T,Placeholders as x,Presentation as C,Row as M,Run as R,Shape as I,ShapeCollection as v,SlideLayout as k,SlideLayouts as N,SlideMaster as F,SlideMasters as D,Table as H,TextFrame as G,TextStyles as B}from"./api.js";import{CategoryChartData as W,Chart as z,XyChartData as j,XySeriesData as X,AxisTitle as U,ChartAxis as Y,ChartFormat as Z,ChartLegend as V,MajorGridlines as J,TickLabels as K,ChartPlot as q,ChartPoint as Q,ChartSeries as $,DataLabels as ee}from"./chart-api.js";import{MSO_ANCHOR as te,MSO_ARROWHEAD as ae,MSO_ARROWHEAD_SIZE as se,MSO_AUTO_SIZE as oe,MSO_CONNECTOR as re,MSO_FILL as ie,MSO_LINE as ne,MSO_LINE_CAP as le,MSO_LINE_COMPOUND as he,MSO_LINE_JOIN as de,MSO_PATTERN_TYPE as pe,MSO_SHAPE as ce,MSO_SHAPE_TYPE as me,MSO_TEXT_CAPS as _e,MSO_TEXT_ORIENTATION as ye,MSO_TEXT_STRIKE as fe,MSO_THEME_COLOR as ue,MSO_UNDERLINE as we,PP_ALIGN as ge,PP_PLACEHOLDER as Se,THEME_FONT as be,XL_CHART_TYPE as Pe,XL_LABEL_POSITION as Ae,XL_LEGEND_POSITION as Oe}from"./enums.js";import{publicNames as o}from"./strict.js";const a={Presentation:{theme:"The theme's colours (dk1…folHlink) and fonts (major, minor), over the project's look.",components:"components.add(name, { props, layers }): a shape drawn by code, by the layer contract.",generators:"generators.add(name, (g) => { g.data(path); g.slides.add_slide(layout, id) … }): slides made from data, placed in the slides file as one block."},SlideMasters:{add:"add(name): a master, with Office's text styles and no placeholders yet."},Table:{style:"Its style, one of PowerPoint's 74 built-in table styles, by its English name as the gallery shows it (Medium Style 2 - Accent 1, Light Style 1, No Style, Table Grid); set by name or id ({5C22544A-…}), null for none (a:tableStyleId)."},_Cell:{borders:"Its edges: { left, right, top, bottom }, each { color, width } (a:lnL…)."},LineFormat:{cap_type:"How its ends and dashes end (MSO_LINE_CAP): PowerPoint's Cap type (a:ln@cap), flat unless set.",join_type:"How its corners meet (MSO_LINE_JOIN): PowerPoint's Join type (a:round, a:bevel, a:miter), a miter unless set.",compound_type:"One line, two or three (MSO_LINE_COMPOUND): PowerPoint's Compound type (a:ln@cmpd), single unless set.",begin_arrow:"What the end of the line where it starts has (MSO_ARROWHEAD): PowerPoint's Begin Arrow type (a:headEnd).",end_arrow:"What the end of the line where it ends has (MSO_ARROWHEAD): PowerPoint's End Arrow type (a:tailEnd).",begin_arrow_width:"How wide the arrowhead where the line starts is (MSO_ARROWHEAD_SIZE): PowerPoint's Begin Arrow size (a:headEnd@w).",begin_arrow_length:"How long the arrowhead where the line starts is (MSO_ARROWHEAD_SIZE): PowerPoint's Begin Arrow size (a:headEnd@len).",end_arrow_width:"How wide the arrowhead where the line ends is (MSO_ARROWHEAD_SIZE): PowerPoint's End Arrow size (a:tailEnd@w).",end_arrow_length:"How long the arrowhead where the line ends is (MSO_ARROWHEAD_SIZE): PowerPoint's End Arrow size (a:tailEnd@len)."},ColorFormat:{transforms:"DrawingML's transforms of the colour in order, [{ name, value }]: tint, shade, lumMod, lumOff, lum, satMod, satOff, sat, hueMod, hueOff, hue, alpha, alphaMod, alphaOff, each value a share (0.75 is 75%), degrees for hue and hueOff; set, they take a brightness's place."},FillFormat:{gradient_path:`A gradient's kind: "linear" along gradient_angle, or out from its focus, "circle", "rect" or "shape" (a:path), PowerPoint's Radial, Rectangular and Path; its first stop is at the focus.`,gradient_focus:"A path gradient's focus (a:fillToRect): { left, top, right, bottom }, the share in from each side, the middle unless set; PowerPoint's Direction (From Center is 0.5 each, From Top Left Corner { left: 0, top: 0, right: 1, bottom: 1 }).",picture:"picture(image_file, { tile, transparency }): a picture filling the shape, PowerPoint's Picture or Texture Fill (a:blipFill), a path from the deck's module's folder, stretched over the shape, or tiled: { scale_x, scale_y } shares of its own size, { offset_x, offset_y } Lengths from where align (TILE_ALIGNMENT, top left unless set) puts its first tile.",transparency:"How much of the fill shows through, a share: PowerPoint's Transparency (a:alpha).",gradient_stops:"Its stops: each read as python-pptx's (color, position), and set whole as [{ at, color, transparency }], `at` and `transparency` shares, a colour as the slides file writes one (accent1, accent1 lighter 40%, #RRGGBB) or a Color; python-pptx's stops can only be read and changed in place."},_GradientStop:{transparency:"How much of its colour shows through, a share (a:alpha)."},ShadowFormat:{blur_radius:"How far the shadow blurs, a Length (a:outerShdw blurRad).",distance:"How far it falls from the shape, a Length (dist).",angle:"The way it falls, degrees clockwise from the right (dir).",transparency:"How much shows through it, a share (a:alpha).",color:"Its colour, a ColorFormat.",visible:"Whether it is drawn, Office's ShadowFormat.Visible: true gives it the defaults' shadow until changed, false none."},Shape:{inner_shadow:"A shadow inside it (a:innerShdw), PowerPoint's Inner shadows: a ShadowFormat with visible, blur_radius, distance, angle, transparency and color; INNER_SHADOW_DEFAULTS until changed.",glow:"Its glow (a:glow), Office's GlowFormat: visible, radius (a Length; 0 takes it away), transparency, color; GLOW_DEFAULTS until changed.",soft_edge:"Its soft edges (a:softEdge), Office's SoftEdgeFormat: radius, how far in its edges fade (0 takes them away).",reflection:"Its reflection (a:reflection), Office's ReflectionFormat: visible, transparency where it starts, size (the share of the shape it shows), offset (how far below, a Length), blur; REFLECTION_DEFAULTS until changed.",flip_h:"Mirrored left to right (a:xfrm flipH), as the slides file's flip_h; its text reads as it is.",flip_v:"Mirrored top to bottom (a:xfrm flipV), as the slides file's flip_v."},FreeformBuilder:{add_curve_segment:"add_curve_segment(x1, y1, x2, y2, x, y): a cubic Bézier segment by its two control points (a:cubicBezTo)."},Font:{strike:"A line through it (@strike): true, or MSO_TEXT_STRIKE.DOUBLE (dblStrike), PowerPoint's Double Strikethrough.",caps:"Its letters as capitals (@cap, MSO_TEXT_CAPS): ALL, SMALL, or NONE over a level that has them; PowerPoint's All Caps and Small Caps.",baseline:"Raised or lowered, a share of its size: superscript 0.3, subscript -0.25 (@baseline).",highlight:"The colour behind it, #RRGGBB as RGBColor gives one (a:highlight).",spacing:"Space added between letters, a Length, negative to tighten (PowerPoint's Character Spacing, a:rPr spc)."},SlideMaster:{color_map:"Its colour map (p:clrMap): what tx1, bg1, tx2, bg2, the accents and the links are of the theme's twelve colours; Office's is { bg1: lt1, tx1: dk1, bg2: lt2, tx2: dk2 }, a dark master's the other way round.",text_styles:"Its text styles (p:txStyles): title_style, body_style, other_style, nine ListLevels each, Office's to start with."},SlideLayouts:{add:"add(name): a layout on this master."},SlideLayout:{color_map:"Its own colour map over its master's (p:clrMapOvr), or undefined for its master's.",display_master_shapes:"Whether its master's shapes are drawn on its slides, true unless set: PowerPoint's Hide Background Graphics (@showMasterSp)."},placeholders:{add:`add(PP_PLACEHOLDER.X, left?, top?, width?, height?, { name, orient }): a placeholder on a master or a layout; a layout's without a frame takes its master's of its base type; orient: "vert" makes it a vertical placeholder (p:ph@orient), its text turned by text_frame.orientation.`},SlideShapes:{add_audio:"add_audio(audio_file, left, top, width?, height?, { playback }): a sound, PowerPoint's Insert Audio, drawn as its icon (half an inch unless given); its shape_type is MSO_SHAPE_TYPE.MEDIA, as python-pptx reads one.",add_component:"add_component(name, left, top, width, height, props): a component of the presentation in a frame.",get:"get(name): a shape by its name."},TextFrame:{orientation:"Which way its text runs (a:bodyPr@vert, MSO_TEXT_ORIENTATION): HORIZONTAL, DOWNWARD (turned 90°), UPWARD (270°), VERTICAL_FAR_EAST (CJK upright, other letters turned), VERTICAL (stacked), VERTICAL_RIGHT_TO_LEFT, MONGOLIAN; PowerPoint's Text Direction.",list_style:"Its list style (a:lstStyle): nine ListLevels, level 0 first, what its paragraphs take where they set nothing."},ListLevel:{"*":"A level of a list style: alignment, line_spacing, space_before, space_after, font, bullet (a character, or null for none), bullet_font, bullet_color (a:buClr: a colour, or null for its text's), bullet_size (a:buSzPct: a share of its text's size), numbered (a:buAutoNum: any of ECMA-376's 41 schemes, arabicPeriod, alphaLcParenR, circleNumDbPlain, ea1ChsPeriod…), start_at (the number it starts at), margin_left, indent."},text_styles:{"*":"title_style, body_style, other_style: a master's text styles, nine ListLevels each."},Animations:{"*":"A generated slide's Animation Pane: add(shape, effect, { start, direction, amount, duration, delay, paragraph, path, animate_text, text_delay, repeat, rewind }), in order."},Slide:{animations:"Its Animation Pane, which python-pptx has no API for.",transition:"How it comes on from the slide before: { type, direction, through_black, duration }, PowerPoint's fade, push, wipe, split, reveal, cut, cover, uncover, zoom and morph, which python-pptx has no API for."},Series:{chart_type:"What the series is drawn as (XL_CHART_TYPE): a combination chart's column, line or area type other than the chart's, as Excel's Series.ChartType and PowerPoint's Change Chart Type ▸ Combo; the chart's own unless set.",on_secondary_axis:"On the chart's second value axis, at the right (Excel's Series.AxisGroup xlSecondary, Combo's Secondary Axis): columns, lines and areas only."},Chart:{secondary_value_axis:"Its second value axis, at the right (a c:valAx at axPos r), for its series on_secondary_axis: an Axis, its scale, gridlines, format and title its own."},Generator:{"*":"What a generator's function is given: data(path), and slides.add_slide(layout, id)."}},Ee={Presentation:{slides:"A deck's slides are in the slides file it names, their words in its script; slides from data are a generator's.",save:"A deck is not saved by its code: allyhub render writes its files."}},Le={Presentation:C.prototype,SlideMasters:D.prototype,SlideMaster:F.prototype,SlideLayouts:N.prototype,SlideLayout:k.prototype,Slide:g.prototype,placeholders:x.prototype,SlideShapes:v.prototype,Shape:I.prototype,TextFrame:G.prototype,_Paragraph:T.prototype,_Run:R.prototype,_Hyperlink:P.prototype,Font:u.prototype,ColorFormat:_.prototype,FillFormat:f.prototype,LineFormat:A.prototype,ShadowFormat:E.prototype,_GradientStop:L.prototype,FreeformBuilder:w.prototype,GroupShape:b.prototype,Table:H.prototype,CategoryChartData:W.prototype,XyChartData:j.prototype,XySeriesData:X.prototype,Chart:z.prototype,Plot:q.prototype,Series:$.prototype,Point:Q.prototype,DataLabels:ee.prototype,Legend:V.prototype,Axis:Y.prototype,AxisTitle:U.prototype,TickLabels:K.prototype,MajorGridlines:J.prototype,ChartFormat:Z.prototype,_Cell:m.prototype,_Column:y.prototype,_Row:M.prototype,_Background:c.prototype},Te={Animations:l.prototype,GlowFormat:h.prototype,SoftEdgeFormat:p.prototype,ReflectionFormat:d.prototype,ListLevel:O.prototype,text_styles:B.prototype,Generator:S.prototype},xe=()=>{const e={};for(const[t,r]of Object.entries(Le)){const i=a[t]??{},n=Ee[t]??{};e[t]=o(r).filter(s=>!Object.hasOwn(i,s)&&!Object.hasOwn(n,s))}return e};export const CAPABILITIES={reference:{library:"python-pptx",version:"1.0.2",docs:"https://python-pptx.readthedocs.io/"},holds:xe(),enums:Object.fromEntries(Object.entries({MSO_THEME_COLOR:ue,PP_ALIGN:ge,MSO_ANCHOR:te,MSO_AUTO_SIZE:oe,PP_PLACEHOLDER:Se,MSO_SHAPE:ce,MSO_CONNECTOR:re,MSO_SHAPE_TYPE:me,MSO_FILL:ie,MSO_LINE:ne,MSO_LINE_CAP:le,MSO_LINE_JOIN:de,MSO_LINE_COMPOUND:he,MSO_PATTERN_TYPE:pe,XL_CHART_TYPE:Pe,XL_LABEL_POSITION:Ae,XL_LEGEND_POSITION:Oe,MSO_ARROWHEAD:ae,MSO_ARROWHEAD_SIZE:se,MSO_UNDERLINE:we,MSO_TEXT_STRIKE:fe,MSO_TEXT_CAPS:_e,MSO_TEXT_ORIENTATION:ye,THEME_FONT:be}).map(([e,t])=>[e,Object.keys(t)])),units:["Emu","Inches","Pt","Cm","Mm","Centipoints","RGBColor"],differs:["The entry is export default presentation({ slides: ./deck.yaml, script: ./deck.{locale}.yaml, size, theme }, (prs) => { … }), not Presentation(path): a deck is made by its code, never opened from a template. Its masters and layouts are made with the additions below; its slides are in the slides file it names.","A name python-pptx has that is not held throws where it is used, naming what the class holds; python-pptx's x[i] is held where it indexes (slide_masters[0], slide_layouts[0], placeholders[idx], shapes[0]), and len(x) is x.length.","A Length (what Inches(1) and Pt(12) give, and what a length reads, shape.width) is a Number of EMU with python-pptx's emu, inches, cm, mm, pt, centipoints and twips. Arithmetic on Lengths gives a plain number, as python's int does; two Lengths of one value are ===, and one is compared with a plain number by its .emu.",`An enumeration's members are PresentationML's values (MSO_THEME_COLOR.ACCENT_1 is "accent1", PP_ALIGN.CENTER "ctr"), not integers; TEXT_1 and BACKGROUND_1 are tx1 and bg1, which the master's colour map (SlideMaster.color_map) makes dk1 and lt1 (Office's) or, on a dark master, lt1 and dk1. MSO_SHAPE_TYPE.COMPONENT is a component's. PP_PARAGRAPH_ALIGNMENT and MSO_LINE_DASH_STYLE are PP_ALIGN and MSO_LINE by python-pptx's other names; MSO_LINE also holds DrawingML's DOT, SYSTEM_DASH_DOT and SYSTEM_DASH_DOT_DOT, which python-pptx has no name for. A line's transparency is its colour's alpha (line.color.transforms).`,`A colour's rgb is "#RRGGBB": RGBColor(r, g, b), new RGBColor(r, g, b) and RGBColor.from_string("RRGGBB") make one.`,"A colour's brightness is a theme colour's: python-pptx also gives an RGB colour one, which is refused here (set rgb to the colour it makes).","line_spacing is a number of lines, or a Length of Pt(1) and over for a fixed height (python-pptx tells them apart by type). space_before and space_after are a Length too, or a number of lines at the paragraph's size (a:spcPct, PowerPoint's Before and After in lines), which python-pptx does not read.","add_picture() takes both width and height: a picture's own size is not read while a deck's code runs.","add_connector() takes MSO_CONNECTOR's STRAIGHT, ELBOW and CURVE, and also a connector's preset by name where python-pptx has none (straightConnector1, bentConnector2 to 5, curvedConnector2 to 5); a connector's adjustments (an elbow's middle) are its shape.adjustments.","begin_connect() and end_connect() take a site of the shape's own geometry, as PowerPoint numbers them (a rectangle's 0 top, 1 left, 2 bottom, 3 right; an ellipse has 8), where python-pptx places an end on those four of its box whatever its shape; a site the shape has not throws. A glued end follows its shape where the slides file or a person moves it, as PowerPoint's does.",`add_movie(movie_file, left, top, width, height, { poster_frame_time, playback }) takes a video file, its poster a moment of it in seconds, not poster_frame_image, and how it plays, PowerPoint's Playback, which python-pptx has no API for: { start: "auto" | "on-click", trim: { start, end } in seconds, loop, volume (a share, 0 mutes), fullscreen, hide }.`,"A shape's name is its kind and a number (textbox-1, shape-2), and a placeholder's its type's (title, body, subtitle): the slides file and the script name shapes by name.","fit_text() sets the frame to shrink its text when it is drawn (MSO_AUTO_SIZE.TEXT_TO_FIT_SHAPE) from max_size: it reads no font file.","Font.size refuses a size under Pt(1): a bare number is EMU, so size = 12 (python-pptx takes it) draws nothing.","A chart holds column, bar, line, area, pie, doughnut and XY scatter types, and combinations of columns, lines and areas, some on a second value axis (Series.chart_type, on_secondary_axis), which python-pptx reads as several plots and cannot make; it has no 3D, no bubble and no radar. A combination chart's plots share its gap width, overlap and data labels. Setting an axis's has_title gives it the words Axis Title, PowerPoint's new title's. A chart in the slides file can read its numbers from a project file: data, categories and series name it and its columns.","A Point holds format.fill alone, and its fill is its category's colour, one for every series of the chart (the slides file's category_colors), shown where the chart varies by categories; python-pptx's point is its own series'.","A table starts with python-pptx's Medium Style 2 - Accent 1, first_row and horz_banding on; its style is drawn under its cells' own fill, borders and text, as PowerPoint draws one. add_table returns its shape, whose .table is the table.","A group is its shapes: they are listed with the shapes the group is among, drawn as they are; a group's shapes.add_group_shape() makes a group in it (its shapes' group outer/inner in the slides file); its box is theirs, so left and top move them and width and height only read.","A presentation is 16:9 (12192000 × 6858000) and its theme Office 2013–2022's over the project's look; python-pptx's template is 4:3 with Office 2007's.","prs.slide_layouts and prs.slide_master are the first master's, as python-pptx's; a generator's add_slide also takes a layout of any master by name."],adds:{...a,...Object.fromEntries(Object.entries(Te).map(([e,t])=>[e,{...a[e]??{},names:o(t).join(", ")}]))}};
@@ -1,4 +1,4 @@
1
- import type { ChartLegendPosition, ChartType } from "@allyhub/formats";
1
+ import { type ChartLegendPosition, type ChartType } from "@allyhub/formats";
2
2
  import { ColorFormat, FillFormat } from "./api.js";
3
3
  import type { ChartAxisDef, ChartDef, ChartLabelPosition, ChartLabelsDef, ChartSeriesDef } from "@allyhub/chart";
4
4
  import type { Color } from "./model.js";
@@ -93,6 +93,12 @@ export declare class ChartSeries {
93
93
  };
94
94
  get smooth(): boolean;
95
95
  set smooth(v: boolean);
96
+ /** What it is drawn as: the chart's type, or a combination chart's column, line or area of its own. */
97
+ get chart_type(): ChartType;
98
+ set chart_type(v: ChartType);
99
+ /** On the chart's second value axis, at the right. */
100
+ get on_secondary_axis(): boolean;
101
+ set on_secondary_axis(v: boolean);
96
102
  /** Its fill (`format.fill`), and its line's width (`format.line.width`); a line's or an area's colour is the fill's. */
97
103
  get format(): {
98
104
  fill: FillFormat;
@@ -122,8 +128,10 @@ export declare class DataLabels {
122
128
  /** A chart's plot (python-pptx's `BarPlot`, `LinePlot`…). */
123
129
  export declare class ChartPlot {
124
130
  private readonly def;
125
- constructor(def: ChartDef);
131
+ private readonly members;
132
+ constructor(def: ChartDef, members: readonly number[]);
126
133
  get categories(): readonly string[];
134
+ /** Its series: a combination chart's plot holds those drawn as one kind on one axis. */
127
135
  get series(): ChartSeries[];
128
136
  get has_data_labels(): boolean;
129
137
  set has_data_labels(v: boolean);
@@ -165,6 +173,16 @@ export declare class ChartFormat {
165
173
  constructor(line: ChartLine);
166
174
  get line(): ChartLine;
167
175
  }
176
+ /** An axis's title (python-pptx's `AxisTitle`): its words, which it gets once asked for. */
177
+ export declare class AxisTitle {
178
+ private readonly def;
179
+ constructor(def: ChartAxisDef);
180
+ get has_text_frame(): boolean;
181
+ set has_text_frame(v: boolean);
182
+ get text_frame(): {
183
+ text: string;
184
+ };
185
+ }
168
186
  /** A chart's axis (python-pptx's `ValueAxis`, `CategoryAxis`). */
169
187
  export declare class ChartAxis {
170
188
  private readonly def;
@@ -181,6 +199,11 @@ export declare class ChartAxis {
181
199
  set visible(v: boolean);
182
200
  get reverse_order(): boolean;
183
201
  set reverse_order(v: boolean);
202
+ /** Whether it has a title; set true, it reads "Axis Title" until its words are set, as PowerPoint's new one. */
203
+ get has_title(): boolean;
204
+ set has_title(v: boolean);
205
+ /** Its title (python-pptx's `AxisTitle`): `axis_title.text_frame.text`. */
206
+ get axis_title(): AxisTitle;
184
207
  /** Its tick labels' format (`tick_labels.number_format`). */
185
208
  get tick_labels(): TickLabels;
186
209
  /** Its gridlines' colour (`major_gridlines.format.line.color`). */
@@ -209,10 +232,13 @@ export declare class Chart {
209
232
  };
210
233
  /** Its text's size and colour. */
211
234
  get font(): ChartFont;
235
+ /** Its plots: one, or a combination chart's, one per kind and axis (areas, then columns, then lines, the second axis's after). */
212
236
  get plots(): ChartPlot[];
213
237
  get series(): ChartSeries[];
214
238
  get value_axis(): ChartAxis;
215
239
  get category_axis(): ChartAxis;
240
+ /** Its second value axis, at the right: a combination chart's, for its series on_secondary_axis. */
241
+ get secondary_value_axis(): ChartAxis;
216
242
  /** Other numbers, in its look. */
217
243
  replace_data(chart_data: CategoryChartData): void;
218
244
  }
@@ -1,2 +1,2 @@
1
1
  /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{ColorFormat as l,FillFormat as f}from"./api.js";import{accentOf as d,isRound as u}from"@allyhub/chart";import{strict as r}from"./strict.js";import{Pt as o,length as h}from"./units.js";export class CategoryChartData{number_format;names=[];list=[];constructor(e={}){return this.number_format=e.number_format??"General",r(this,"CategoryChartData")}get categories(){return this.names}set categories(e){this.names=e.map(String)}add_category(e){this.names.push(String(e))}add_series(e,t=[],i){this.list.push({name:e,values:t.map(n=>n??null),...i===void 0?{}:{number_format:i}})}_series(){return this.list.map(e=>({...e,values:[...e.values],number_format:e.number_format??this.number_format}))}}export class XySeriesData{points=[];name;constructor(e){return this.name=e,r(this,"XySeriesData")}add_data_point(e,t){this.points.push({x:e,y:t})}}export class XyChartData{number_format;list=[];constructor(e={}){return this.number_format=e.number_format??"General",r(this,"XyChartData")}add_series(e){const t=new XySeriesData(e);return this.list.push(t),t}get categories(){return[]}_series(){return this.list.map(e=>({name:e.name,values:e.points.map(t=>t.y),x:e.points.map(t=>t.x),number_format:this.number_format}))}}const _=s=>s===void 0?void 0:s/o(1);export class ChartFont{read;write;constructor(e,t){return this.read=e,this.write=t,r(this,"ChartFont")}get size(){const e=this.read().size;return e===void 0?void 0:h(o(e))}set size(e){const t=this.read(),i=_(e);this.write({...t.color===void 0?{}:{color:t.color},...i===void 0?{}:{size:i}})}get color(){return new l(()=>this.read().color,e=>{const{size:t}=this.read();this.write({...t===void 0?{}:{size:t},...e===void 0?{}:{color:e}})})}}export class ChartLine{read;write;constructor(e,t){return this.read=e,this.write=t,r(this,"ChartLine")}get color(){return new l(this.read,this.write)}}export class ChartPoint{chart;at;constructor(e,t){return this.chart=e,this.at=t,r(this,"Point")}get format(){const{chart:e,at:t}=this;return r({fill:new f(()=>e.category_colors?.[t]??d(t),i=>{if(i===null)return;const n=[...e.category_colors??[]];for(let a=n.length;a<t;a++)n[a]=d(a);n[t]=i,e.category_colors=n},d(t))},"ChartFormat")}}export class ChartSeries{def;at;chart;constructor(e,t,i){return this.def=e,this.at=t,this.chart=i,r(this,"ChartSeries")}get points(){return this.chart.categories.map((e,t)=>new ChartPoint(this.chart,t))}get name(){return this.def.name}get values(){return this.def.values}get marker(){const e=this.def;return r({get size(){return e.marker_size},set size(t){t===void 0?delete e.marker_size:e.marker_size=t}},"Marker")}get smooth(){return this.def.smooth===!0}set smooth(e){this.def.smooth=e}get format(){const e=this.def;return r({line:r({get width(){return e.line_width===void 0?void 0:h(o(e.line_width))},set width(t){t===void 0?delete e.line_width:e.line_width=t/o(1)}},"LineFormat"),fill:new f(()=>this.def.color??d(this.at),t=>{t!==null&&(this.def.color=t)})},"ChartFormat")}}export class DataLabels{def;constructor(e){return this.def=e,r(this,"DataLabels")}get show_value(){return this.def.show_value??!1}set show_value(e){this.def.show_value=e}get show_percentage(){return this.def.show_percentage??!1}set show_percentage(e){this.def.show_percentage=e}get show_category_name(){return this.def.show_category_name??!1}set show_category_name(e){this.def.show_category_name=e}get show_series_name(){return this.def.show_series_name??!1}set show_series_name(e){this.def.show_series_name=e}get number_format(){return this.def.number_format??"General"}set number_format(e){this.def.number_format=e}get position(){return this.def.position}set position(e){e===void 0?delete this.def.position:this.def.position=e}get font(){return new ChartFont(()=>({...this.def.size===void 0?{}:{size:this.def.size},...this.def.color===void 0?{}:{color:this.def.color}}),e=>{delete this.def.size,delete this.def.color,Object.assign(this.def,e)})}}export class ChartPlot{def;constructor(e){return this.def=e,r(this,"ChartPlot")}get categories(){return this.def.categories}get series(){return this.def.series.map((e,t)=>new ChartSeries(e,t,this.def))}get has_data_labels(){return this.def.labels!==void 0}set has_data_labels(e){e?this.def.labels??={show_value:!0}:delete this.def.labels}get data_labels(){return this.def.labels??={show_value:!0},new DataLabels(this.def.labels)}get gap_width(){return this.def.gap_width??150}set gap_width(e){this.def.gap_width=e}get overlap(){return this.def.overlap??0}set overlap(e){this.def.overlap=e}get vary_by_categories(){return this.def.vary_by_categories??u(this.def.type)}set vary_by_categories(e){this.def.vary_by_categories=e}}export class ChartLegend{def;constructor(e){return this.def=e,r(this,"ChartLegend")}get position(){return this.def.legend??"right"}set position(e){this.def.legend=e}get include_in_layout(){return this.def.legend_overlay!==!0}set include_in_layout(e){e?delete this.def.legend_overlay:this.def.legend_overlay=!0}}export class TickLabels{def;constructor(e){return this.def=e,r(this,"TickLabels")}get number_format(){return this.def.number_format??"General"}set number_format(e){this.def.number_format=e}}export class MajorGridlines{line;constructor(e){return this.line=e,r(this,"MajorGridlines")}get format(){return new ChartFormat(this.line)}}export class ChartFormat{held;constructor(e){return this.held=e,r(this,"ChartFormat")}get line(){return this.held}}export class ChartAxis{def;constructor(e){return this.def=e,r(this,"ChartAxis")}get minimum_scale(){return this.def.minimum_scale}set minimum_scale(e){e===void 0?delete this.def.minimum_scale:this.def.minimum_scale=e}get maximum_scale(){return this.def.maximum_scale}set maximum_scale(e){e===void 0?delete this.def.maximum_scale:this.def.maximum_scale=e}get major_unit(){return this.def.major_unit}set major_unit(e){e===void 0?delete this.def.major_unit:this.def.major_unit=e}get has_major_gridlines(){return this.def.has_major_gridlines??!0}set has_major_gridlines(e){this.def.has_major_gridlines=e}get visible(){return this.def.visible??!0}set visible(e){this.def.visible=e}get reverse_order(){return this.def.reverse_order??!1}set reverse_order(e){this.def.reverse_order=e}get tick_labels(){return new TickLabels(this.def)}get major_gridlines(){return new MajorGridlines(new ChartLine(()=>this.def.gridline_color,e=>{e===void 0?delete this.def.gridline_color:this.def.gridline_color=e}))}get format(){return new ChartFormat(new ChartLine(()=>this.def.line_color,e=>{e===void 0?delete this.def.line_color:this.def.line_color=e}))}}export class Chart{def;constructor(e){return this.def=e,r(this,"Chart")}get chart_type(){return this.def.type}get has_legend(){return this.def.legend!==void 0}set has_legend(e){e?this.def.legend??="right":delete this.def.legend}get legend(){return new ChartLegend(this.def)}get has_title(){return this.def.title!==void 0}set has_title(e){e?this.def.title??="":delete this.def.title}get chart_title(){const e=this.def;return r({font:r({get size(){return e.title_size===void 0?void 0:h(o(e.title_size))},set size(t){t===void 0?delete e.title_size:e.title_size=t/o(1)}},"Font"),text_frame:r({get text(){return e.title??""},set text(t){e.title=t}},"TextFrame")},"ChartTitle")}get font(){return new ChartFont(()=>({...this.def.font_size===void 0?{}:{size:this.def.font_size},...this.def.font_color===void 0?{}:{color:this.def.font_color}}),e=>{delete this.def.font_size,delete this.def.font_color,e.size!==void 0&&(this.def.font_size=e.size),e.color!==void 0&&(this.def.font_color=e.color)})}get plots(){return[new ChartPlot(this.def)]}get series(){return this.def.series.map((e,t)=>new ChartSeries(e,t,this.def))}get value_axis(){return this.def.value_axis??={},new ChartAxis(this.def.value_axis)}get category_axis(){return this.def.category_axis??={},new ChartAxis(this.def.category_axis)}replace_data(e){const t=this.def.series;this.def.categories=[...e.categories],this.def.series=e._series().map((i,n)=>{const a=t[n]?.color;return a===void 0?i:{...i,color:a}})}}
2
+ import{CHART_COMBINED_TYPES as _}from"@allyhub/formats";import{ColorFormat as u,FillFormat as c,refuse as h}from"./api.js";import{accentOf as d,groupsOf as m,isCombinable as l,isRound as g}from"@allyhub/chart";import{strict as s}from"./strict.js";import{Pt as o,length as f}from"./units.js";export class CategoryChartData{number_format;names=[];list=[];constructor(e={}){return this.number_format=e.number_format??"General",s(this,"CategoryChartData")}get categories(){return this.names}set categories(e){this.names=e.map(String)}add_category(e){this.names.push(String(e))}add_series(e,t=[],i){this.list.push({name:e,values:t.map(n=>n??null),...i===void 0?{}:{number_format:i}})}_series(){return this.list.map(e=>({...e,values:[...e.values],number_format:e.number_format??this.number_format}))}}export class XySeriesData{points=[];name;constructor(e){return this.name=e,s(this,"XySeriesData")}add_data_point(e,t){this.points.push({x:e,y:t})}}export class XyChartData{number_format;list=[];constructor(e={}){return this.number_format=e.number_format??"General",s(this,"XyChartData")}add_series(e){const t=new XySeriesData(e);return this.list.push(t),t}get categories(){return[]}_series(){return this.list.map(e=>({name:e.name,values:e.points.map(t=>t.y),x:e.points.map(t=>t.x),number_format:this.number_format}))}}const p=r=>r===void 0?void 0:r/o(1);export class ChartFont{read;write;constructor(e,t){return this.read=e,this.write=t,s(this,"ChartFont")}get size(){const e=this.read().size;return e===void 0?void 0:f(o(e))}set size(e){const t=this.read(),i=p(e);this.write({...t.color===void 0?{}:{color:t.color},...i===void 0?{}:{size:i}})}get color(){return new u(()=>this.read().color,e=>{const{size:t}=this.read();this.write({...t===void 0?{}:{size:t},...e===void 0?{}:{color:e}})})}}export class ChartLine{read;write;constructor(e,t){return this.read=e,this.write=t,s(this,"ChartLine")}get color(){return new u(this.read,this.write)}}export class ChartPoint{chart;at;constructor(e,t){return this.chart=e,this.at=t,s(this,"Point")}get format(){const{chart:e,at:t}=this;return s({fill:new c(()=>e.category_colors?.[t]??d(t),i=>{if(i===null)return;const n=[...e.category_colors??[]];for(let a=n.length;a<t;a++)n[a]=d(a);n[t]=i,e.category_colors=n},d(t))},"ChartFormat")}}export class ChartSeries{def;at;chart;constructor(e,t,i){return this.def=e,this.at=t,this.chart=i,s(this,"ChartSeries")}get points(){return this.chart.categories.map((e,t)=>new ChartPoint(this.chart,t))}get name(){return this.def.name}get values(){return this.def.values}get marker(){const e=this.def;return s({get size(){return e.marker_size},set size(t){t===void 0?delete e.marker_size:e.marker_size=t}},"Marker")}get smooth(){return this.def.smooth===!0}set smooth(e){this.def.smooth=e}get chart_type(){const e=this.def.type;return e!==void 0&&l(this.chart.type)?e:this.chart.type}set chart_type(e){_.includes(e)||h(`chart_type: a series is drawn as a column, a line or an area of its own, not ${e}.`),l(this.chart.type)||h(`chart_type: a ${this.chart.type} chart combines with no other kind; only columns, lines and areas do.`),e===this.chart.type?delete this.def.type:this.def.type=e}get on_secondary_axis(){return this.def.secondary===!0}set on_secondary_axis(e){e&&!l(this.chart.type)&&h(`on_secondary_axis: a ${this.chart.type} chart has no second axis; only columns, lines and areas do.`),e?this.def.secondary=!0:delete this.def.secondary}get format(){const e=this.def;return s({line:s({get width(){return e.line_width===void 0?void 0:f(o(e.line_width))},set width(t){t===void 0?delete e.line_width:e.line_width=t/o(1)}},"LineFormat"),fill:new c(()=>this.def.color??d(this.at),t=>{t!==null&&(this.def.color=t)})},"ChartFormat")}}export class DataLabels{def;constructor(e){return this.def=e,s(this,"DataLabels")}get show_value(){return this.def.show_value??!1}set show_value(e){this.def.show_value=e}get show_percentage(){return this.def.show_percentage??!1}set show_percentage(e){this.def.show_percentage=e}get show_category_name(){return this.def.show_category_name??!1}set show_category_name(e){this.def.show_category_name=e}get show_series_name(){return this.def.show_series_name??!1}set show_series_name(e){this.def.show_series_name=e}get number_format(){return this.def.number_format??"General"}set number_format(e){this.def.number_format=e}get position(){return this.def.position}set position(e){e===void 0?delete this.def.position:this.def.position=e}get font(){return new ChartFont(()=>({...this.def.size===void 0?{}:{size:this.def.size},...this.def.color===void 0?{}:{color:this.def.color}}),e=>{delete this.def.size,delete this.def.color,Object.assign(this.def,e)})}}export class ChartPlot{def;members;constructor(e,t){return this.def=e,this.members=t,s(this,"ChartPlot")}get categories(){return this.def.categories}get series(){return this.members.flatMap(e=>{const t=this.def.series[e];return t?[new ChartSeries(t,e,this.def)]:[]})}get has_data_labels(){return this.def.labels!==void 0}set has_data_labels(e){e?this.def.labels??={show_value:!0}:delete this.def.labels}get data_labels(){return this.def.labels??={show_value:!0},new DataLabels(this.def.labels)}get gap_width(){return this.def.gap_width??150}set gap_width(e){this.def.gap_width=e}get overlap(){return this.def.overlap??0}set overlap(e){this.def.overlap=e}get vary_by_categories(){return this.def.vary_by_categories??g(this.def.type)}set vary_by_categories(e){this.def.vary_by_categories=e}}export class ChartLegend{def;constructor(e){return this.def=e,s(this,"ChartLegend")}get position(){return this.def.legend??"right"}set position(e){this.def.legend=e}get include_in_layout(){return this.def.legend_overlay!==!0}set include_in_layout(e){e?delete this.def.legend_overlay:this.def.legend_overlay=!0}}export class TickLabels{def;constructor(e){return this.def=e,s(this,"TickLabels")}get number_format(){return this.def.number_format??"General"}set number_format(e){this.def.number_format=e}}export class MajorGridlines{line;constructor(e){return this.line=e,s(this,"MajorGridlines")}get format(){return new ChartFormat(this.line)}}export class ChartFormat{held;constructor(e){return this.held=e,s(this,"ChartFormat")}get line(){return this.held}}export class AxisTitle{def;constructor(e){return this.def=e,s(this,"AxisTitle")}get has_text_frame(){return this.def.title!==void 0}set has_text_frame(e){e?this.def.title??="":delete this.def.title}get text_frame(){const e=this.def;return e.title??="",s({get text(){return e.title??""},set text(t){e.title=t}},"TextFrame")}}export class ChartAxis{def;constructor(e){return this.def=e,s(this,"ChartAxis")}get minimum_scale(){return this.def.minimum_scale}set minimum_scale(e){e===void 0?delete this.def.minimum_scale:this.def.minimum_scale=e}get maximum_scale(){return this.def.maximum_scale}set maximum_scale(e){e===void 0?delete this.def.maximum_scale:this.def.maximum_scale=e}get major_unit(){return this.def.major_unit}set major_unit(e){e===void 0?delete this.def.major_unit:this.def.major_unit=e}get has_major_gridlines(){return this.def.has_major_gridlines??!0}set has_major_gridlines(e){this.def.has_major_gridlines=e}get visible(){return this.def.visible??!0}set visible(e){this.def.visible=e}get reverse_order(){return this.def.reverse_order??!1}set reverse_order(e){this.def.reverse_order=e}get has_title(){return this.def.title!==void 0}set has_title(e){e?this.def.title??="Axis Title":delete this.def.title}get axis_title(){return new AxisTitle(this.def)}get tick_labels(){return new TickLabels(this.def)}get major_gridlines(){return new MajorGridlines(new ChartLine(()=>this.def.gridline_color,e=>{e===void 0?delete this.def.gridline_color:this.def.gridline_color=e}))}get format(){return new ChartFormat(new ChartLine(()=>this.def.line_color,e=>{e===void 0?delete this.def.line_color:this.def.line_color=e}))}}export class Chart{def;constructor(e){return this.def=e,s(this,"Chart")}get chart_type(){return this.def.type}get has_legend(){return this.def.legend!==void 0}set has_legend(e){e?this.def.legend??="right":delete this.def.legend}get legend(){return new ChartLegend(this.def)}get has_title(){return this.def.title!==void 0}set has_title(e){e?this.def.title??="":delete this.def.title}get chart_title(){const e=this.def;return s({font:s({get size(){return e.title_size===void 0?void 0:f(o(e.title_size))},set size(t){t===void 0?delete e.title_size:e.title_size=t/o(1)}},"Font"),text_frame:s({get text(){return e.title??""},set text(t){e.title=t}},"TextFrame")},"ChartTitle")}get font(){return new ChartFont(()=>({...this.def.font_size===void 0?{}:{size:this.def.font_size},...this.def.font_color===void 0?{}:{color:this.def.font_color}}),e=>{delete this.def.font_size,delete this.def.font_color,e.size!==void 0&&(this.def.font_size=e.size),e.color!==void 0&&(this.def.font_color=e.color)})}get plots(){return m(this.def).map(e=>new ChartPlot(this.def,e.series))}get series(){return this.def.series.map((e,t)=>new ChartSeries(e,t,this.def))}get value_axis(){return this.def.value_axis??={},new ChartAxis(this.def.value_axis)}get category_axis(){return this.def.category_axis??={},new ChartAxis(this.def.category_axis)}get secondary_value_axis(){return this.def.secondary_axis??={},new ChartAxis(this.def.secondary_axis)}replace_data(e){const t=this.def.series;this.def.categories=[...e.categories],this.def.series=e._series().map((i,n)=>{const a=t[n]?.color;return a===void 0?i:{...i,color:a}})}}
@@ -1,2 +1,2 @@
1
1
  /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- export function checkDeck(h,c){const s=[];for(const a of h.slides){const d=new Set;for(const e of a.shapes){if(e.level==="slide"){if(d.has(e.name)){const m=e.sources.frame.path?.replace(/\.frame$/u,"");s.push({slide:a.id,shape:e.name,...m===void 0?{}:{path:m},message:`Slide ${a.id} has two shapes named ${e.name}${e.sources.frame.from==="code"?` (its generator ${a.file.generate??""} makes them)`:""}.`})}d.add(e.name)}const i=e.media;if(!i)continue;const o=e.kind==="movie"?"video":"image",n=c.mediaKind(i.path),t={slide:a.id,shape:e.name,...e.sources.media?.path===void 0?{}:{path:e.sources.media.path}};n===void 0?s.push({...t,message:`${i.path} (shape ${e.name} of slide ${a.id}) is not in the project.`}):n!==o&&s.push({...t,message:`${i.path} (shape ${e.name} of slide ${a.id}) is ${n==="image"?"an image":`a ${n}`}, not ${o==="image"?"an image":"a video"}.`})}}return s}
2
+ export function checkDeck(f,o){const s=[];for(const i of f.slides){const m=new Set;for(const e of i.shapes){if(e.level==="slide"){if(m.has(e.name)){const a=e.sources.frame.path?.replace(/\.frame$/u,"");s.push({slide:i.id,shape:e.name,...a===void 0?{}:{path:a},message:`Slide ${i.id} has two shapes named ${e.name}${e.sources.frame.from==="code"?` (its generator ${i.file.generate??""} makes them)`:""}.`})}m.add(e.name)}const n=e.picture_fill;if(n){const a=o.mediaKind(n.path);a!=="image"&&s.push({slide:i.id,shape:e.name,message:a===void 0?`${n.path} (the picture filling shape ${e.name} of slide ${i.id}) is not in the project.`:`${n.path} (the picture filling shape ${e.name} of slide ${i.id}) is a ${a}, not an image.`})}const d=e.media;if(!d)continue;const h=e.kind==="movie"?"video":e.kind==="audio"?"audio":"image",t=o.mediaKind(d.path),p={slide:i.id,shape:e.name,...e.sources.media?.path===void 0?{}:{path:e.sources.media.path}};t===void 0?s.push({...p,message:`${d.path} (shape ${e.name} of slide ${i.id}) is not in the project.`}):t!==h&&s.push({...p,message:`${d.path} (shape ${e.name} of slide ${i.id}) is ${t==="image"?"an image":`a ${t}`}, not ${h==="image"?"an image":"a video"}.`})}}return s}