@allyhub/sdk 0.12.0 → 0.14.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 (154) hide show
  1. package/CHANGELOG.md +13 -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/files.d.ts +9 -2
  26. package/dist/node_modules/@allyhub/formats/dist/files.js +1 -1
  27. package/dist/node_modules/@allyhub/formats/dist/note-shape.d.ts +9 -0
  28. package/dist/node_modules/@allyhub/formats/dist/note-shape.js +1 -1
  29. package/dist/node_modules/@allyhub/formats/dist/schemas.d.ts +931 -87
  30. package/dist/node_modules/@allyhub/formats/dist/schemas.js +1 -1
  31. package/dist/node_modules/@allyhub/formats/package.json +1 -1
  32. package/dist/node_modules/@allyhub/image-draw/package.json +1 -1
  33. package/dist/node_modules/@allyhub/image-measure/package.json +1 -1
  34. package/dist/node_modules/@allyhub/image-sdk/package.json +1 -1
  35. package/dist/node_modules/@allyhub/measure/package.json +1 -1
  36. package/dist/node_modules/@allyhub/ooxml/dist/color.d.ts +11 -0
  37. package/dist/node_modules/@allyhub/ooxml/dist/color.js +1 -1
  38. package/dist/node_modules/@allyhub/ooxml/dist/ext.d.ts +43 -0
  39. package/dist/node_modules/@allyhub/ooxml/dist/ext.js +1 -1
  40. package/dist/node_modules/@allyhub/ooxml/dist/index.d.ts +2 -1
  41. package/dist/node_modules/@allyhub/ooxml/dist/index.js +1 -1
  42. package/dist/node_modules/@allyhub/ooxml/dist/transform.d.ts +13 -0
  43. package/dist/node_modules/@allyhub/ooxml/dist/transform.js +2 -0
  44. package/dist/node_modules/@allyhub/ooxml/package.json +5 -1
  45. package/dist/node_modules/@allyhub/piece/dist/gen.d.ts +4 -4
  46. package/dist/node_modules/@allyhub/piece/dist/media.d.ts +2 -2
  47. package/dist/node_modules/@allyhub/piece/package.json +1 -1
  48. package/dist/node_modules/@allyhub/protocol/dist/account.d.ts +35 -0
  49. package/dist/node_modules/@allyhub/protocol/dist/account.js +1 -1
  50. package/dist/node_modules/@allyhub/protocol/dist/cloud.d.ts +19 -0
  51. package/dist/node_modules/@allyhub/protocol/dist/cloud.js +1 -1
  52. package/dist/node_modules/@allyhub/protocol/dist/editor.d.ts +35 -20
  53. package/dist/node_modules/@allyhub/protocol/dist/editor.js +1 -1
  54. package/dist/node_modules/@allyhub/protocol/dist/events.d.ts +3 -3
  55. package/dist/node_modules/@allyhub/protocol/dist/frame.d.ts +28 -2
  56. package/dist/node_modules/@allyhub/protocol/dist/frame.js +1 -1
  57. package/dist/node_modules/@allyhub/protocol/dist/jobs.d.ts +6 -6
  58. package/dist/node_modules/@allyhub/protocol/dist/snapshots.d.ts +73 -10
  59. package/dist/node_modules/@allyhub/protocol/dist/snapshots.js +1 -1
  60. package/dist/node_modules/@allyhub/protocol/dist/tools.d.ts +45 -9
  61. package/dist/node_modules/@allyhub/protocol/dist/tools.js +1 -1
  62. package/dist/node_modules/@allyhub/protocol/package.json +1 -1
  63. package/dist/node_modules/@allyhub/runtimes/package.json +1 -1
  64. package/dist/node_modules/@allyhub/scenery/package.json +1 -1
  65. package/dist/node_modules/@allyhub/sheet/dist/annotations.d.ts +14 -0
  66. package/dist/node_modules/@allyhub/sheet/dist/annotations.js +2 -0
  67. package/dist/node_modules/@allyhub/sheet/dist/api/capabilities.js +1 -1
  68. package/dist/node_modules/@allyhub/sheet/dist/api/index.d.ts +1 -1
  69. package/dist/node_modules/@allyhub/sheet/dist/api/index.js +1 -1
  70. package/dist/node_modules/@allyhub/sheet/dist/api/rules.d.ts +24 -0
  71. package/dist/node_modules/@allyhub/sheet/dist/api/rules.js +1 -1
  72. package/dist/node_modules/@allyhub/sheet/dist/api/styles.d.ts +12 -0
  73. package/dist/node_modules/@allyhub/sheet/dist/api/styles.js +1 -1
  74. package/dist/node_modules/@allyhub/sheet/dist/api/workbook.d.ts +3 -1
  75. package/dist/node_modules/@allyhub/sheet/dist/api/workbook.js +1 -1
  76. package/dist/node_modules/@allyhub/sheet/dist/arrange.d.ts +28 -1
  77. package/dist/node_modules/@allyhub/sheet/dist/arrange.js +1 -1
  78. package/dist/node_modules/@allyhub/sheet/dist/data-tools.d.ts +42 -0
  79. package/dist/node_modules/@allyhub/sheet/dist/data-tools.js +2 -0
  80. package/dist/node_modules/@allyhub/sheet/dist/edit.d.ts +43 -2
  81. package/dist/node_modules/@allyhub/sheet/dist/edit.js +1 -1
  82. package/dist/node_modules/@allyhub/sheet/dist/fill.d.ts +10 -0
  83. package/dist/node_modules/@allyhub/sheet/dist/fill.js +1 -1
  84. package/dist/node_modules/@allyhub/sheet/dist/filter.js +1 -1
  85. package/dist/node_modules/@allyhub/sheet/dist/formula/rewrite.d.ts +14 -0
  86. package/dist/node_modules/@allyhub/sheet/dist/formula/rewrite.js +1 -1
  87. package/dist/node_modules/@allyhub/sheet/dist/html.js +10 -10
  88. package/dist/node_modules/@allyhub/sheet/dist/index.d.ts +6 -1
  89. package/dist/node_modules/@allyhub/sheet/dist/index.js +1 -1
  90. package/dist/node_modules/@allyhub/sheet/dist/outline.d.ts +30 -0
  91. package/dist/node_modules/@allyhub/sheet/dist/outline.js +2 -0
  92. package/dist/node_modules/@allyhub/sheet/dist/rich.d.ts +29 -0
  93. package/dist/node_modules/@allyhub/sheet/dist/rich.js +2 -0
  94. package/dist/node_modules/@allyhub/sheet/dist/rules.js +1 -1
  95. package/dist/node_modules/@allyhub/sheet/dist/table-style.d.ts +6 -0
  96. package/dist/node_modules/@allyhub/sheet/dist/table-style.js +1 -1
  97. package/dist/node_modules/@allyhub/sheet/dist/table-styles.js +1 -1
  98. package/dist/node_modules/@allyhub/sheet/dist/workbook.d.ts +5 -1
  99. package/dist/node_modules/@allyhub/sheet/dist/workbook.js +1 -1
  100. package/dist/node_modules/@allyhub/sheet/dist/xlsx/charts.js +1 -1
  101. package/dist/node_modules/@allyhub/sheet/dist/xlsx/import.js +1 -1
  102. package/dist/node_modules/@allyhub/sheet/dist/xlsx/read.d.ts +17 -1
  103. package/dist/node_modules/@allyhub/sheet/dist/xlsx/read.js +2 -2
  104. package/dist/node_modules/@allyhub/sheet/dist/xlsx/runs.d.ts +56 -0
  105. package/dist/node_modules/@allyhub/sheet/dist/xlsx/runs.js +2 -0
  106. package/dist/node_modules/@allyhub/sheet/dist/xlsx/styles.d.ts +6 -0
  107. package/dist/node_modules/@allyhub/sheet/dist/xlsx/styles.js +1 -1
  108. package/dist/node_modules/@allyhub/sheet/dist/xlsx/write.js +1 -1
  109. package/dist/node_modules/@allyhub/sheet/package.json +1 -1
  110. package/dist/node_modules/@allyhub/slides-core/dist/animation.d.ts +117 -21
  111. package/dist/node_modules/@allyhub/slides-core/dist/animation.js +1 -1
  112. package/dist/node_modules/@allyhub/slides-core/dist/api.d.ts +181 -30
  113. package/dist/node_modules/@allyhub/slides-core/dist/api.js +3 -3
  114. package/dist/node_modules/@allyhub/slides-core/dist/capabilities.js +1 -1
  115. package/dist/node_modules/@allyhub/slides-core/dist/chart-api.d.ts +28 -2
  116. package/dist/node_modules/@allyhub/slides-core/dist/chart-api.js +1 -1
  117. package/dist/node_modules/@allyhub/slides-core/dist/check.js +1 -1
  118. package/dist/node_modules/@allyhub/slides-core/dist/enums.d.ts +222 -4
  119. package/dist/node_modules/@allyhub/slides-core/dist/enums.js +1 -1
  120. package/dist/node_modules/@allyhub/slides-core/dist/file.d.ts +6 -0
  121. package/dist/node_modules/@allyhub/slides-core/dist/file.js +3 -3
  122. package/dist/node_modules/@allyhub/slides-core/dist/generated/table-styles.d.ts +3 -0
  123. package/dist/node_modules/@allyhub/slides-core/dist/generated/table-styles.js +2 -0
  124. package/dist/node_modules/@allyhub/slides-core/dist/index.d.ts +3 -0
  125. package/dist/node_modules/@allyhub/slides-core/dist/index.js +1 -1
  126. package/dist/node_modules/@allyhub/slides-core/dist/merge.js +1 -1
  127. package/dist/node_modules/@allyhub/slides-core/dist/model.d.ts +98 -10
  128. package/dist/node_modules/@allyhub/slides-core/dist/numbering.d.ts +6 -0
  129. package/dist/node_modules/@allyhub/slides-core/dist/numbering.js +2 -0
  130. package/dist/node_modules/@allyhub/slides-core/dist/office.d.ts +53 -0
  131. package/dist/node_modules/@allyhub/slides-core/dist/office.js +1 -1
  132. package/dist/node_modules/@allyhub/slides-core/dist/patterns.d.ts +8 -0
  133. package/dist/node_modules/@allyhub/slides-core/dist/patterns.js +2 -0
  134. package/dist/node_modules/@allyhub/slides-core/dist/resolve.d.ts +36 -6
  135. package/dist/node_modules/@allyhub/slides-core/dist/resolve.js +1 -1
  136. package/dist/node_modules/@allyhub/slides-core/dist/script.d.ts +11 -0
  137. package/dist/node_modules/@allyhub/slides-core/dist/script.js +2 -2
  138. package/dist/node_modules/@allyhub/slides-core/dist/sdk.d.ts +1 -1
  139. package/dist/node_modules/@allyhub/slides-core/dist/sdk.js +1 -1
  140. package/dist/node_modules/@allyhub/slides-core/dist/table-style.d.ts +48 -0
  141. package/dist/node_modules/@allyhub/slides-core/dist/table-style.js +2 -0
  142. package/dist/node_modules/@allyhub/slides-core/package.json +1 -1
  143. package/dist/node_modules/@allyhub/video-core/dist/mix-plan.js +1 -1
  144. package/dist/node_modules/@allyhub/video-core/dist/timeline.d.ts +4 -0
  145. package/dist/node_modules/@allyhub/video-core/package.json +1 -1
  146. package/dist/node_modules/@allyhub/video-sdk/package.json +1 -1
  147. package/docs/defaults.md +78 -4
  148. package/docs/image.md +1 -1
  149. package/docs/pictures.md +1 -1
  150. package/docs/project.md +1 -1
  151. package/docs/sheets.md +19 -9
  152. package/docs/slides.md +30 -16
  153. package/docs/speech.md +1 -1
  154. package/package.json +1 -1
@@ -1,8 +1,8 @@
1
- import { type ShapeFile, type SlidesFile, type Numbering, type TextAlign } from "@allyhub/formats";
2
- import { type ChartDef } from "@allyhub/chart";
1
+ import { type TextOrientation, type ShapeFile, type SlidesFile, type Numbering, type TextAlign } from "@allyhub/formats";
2
+ import { type ChartDef, type ColorMapDef } from "@allyhub/chart";
3
3
  import type { DeckCode } from "./code.js";
4
4
  import type { Anchor, AutoSize, PlaceholderType } from "./enums.js";
5
- import type { Color, FontDef, Frame, LevelsDef, LineSpacing, MasterDef, ParagraphDef, GradientDef, ShadowDef, ShapeDef, Glue, ShapeKind, TableCellDef, TableDef, TextFrameDef } from "./model.js";
5
+ import type { PlaybackDef, Color, FontDef, Frame, LevelsDef, LineSpacing, MasterDef, ParagraphDef, ParagraphFormatDef, ParagraphSpace, GradientDef, PatternDef, PictureFillDef, GlowDef, ReflectionDef, ShadowDef, ShapeDef, Glue, ShapeKind, TableCellDef, TableDef, TextFrameDef } from "./model.js";
6
6
  import { type ResolvedAnimation, type ResolvedTransition } from "./animation.js";
7
7
  import { type Theme } from "./theme.js";
8
8
  import { type Length } from "./units.js";
@@ -17,20 +17,28 @@ export interface LevelStyle {
17
17
  font: Required<Pick<FontDef, "name" | "size">> & Omit<FontDef, "name" | "size">;
18
18
  alignment: TextAlign;
19
19
  line_spacing: LineSpacing;
20
- space_before: Length;
21
- space_after: Length;
20
+ space_before: ParagraphSpace;
21
+ space_after: ParagraphSpace;
22
22
  bullet?: {
23
23
  char: string;
24
24
  font?: string;
25
25
  };
26
26
  /** Counted in place of a bullet. */
27
27
  numbered?: Numbering;
28
+ /** The number a list starts at. */
29
+ start_at?: number;
30
+ /** Its bullet's or number's colour; its text's where unsaid. */
31
+ bullet_color?: Color;
32
+ /** Its bullet's or number's size, a share of its text's; its text's where unsaid. */
33
+ bullet_size?: number;
28
34
  margin_left: Length;
29
35
  indent: Length;
30
36
  }
31
37
  /** A text frame's style, every value inherited and resolved. */
32
38
  export interface TextStyle {
33
39
  vertical_anchor: Anchor;
40
+ /** Which way its text runs; across where nothing says. */
41
+ orientation: TextOrientation;
34
42
  auto_size: AutoSize;
35
43
  word_wrap: boolean;
36
44
  margins: {
@@ -73,15 +81,26 @@ export interface ResolvedShape {
73
81
  placeholder?: {
74
82
  type: PlaceholderType;
75
83
  idx: number;
84
+ orient?: "vert";
76
85
  };
77
86
  text?: ResolvedText;
78
87
  fill?: Color | null;
79
88
  fill_transparency?: number;
80
89
  gradient?: GradientDef;
90
+ pattern?: PatternDef;
91
+ /** A picture filling it: its project path, tiled or stretched. */
92
+ picture_fill?: Omit<PictureFillDef, "base">;
81
93
  shadow?: ShadowDef | null;
94
+ inner_shadow?: ShadowDef;
95
+ glow?: GlowDef;
96
+ soft_edges?: Length;
97
+ reflection?: ReflectionDef;
82
98
  line?: Color | null;
83
99
  line_width?: Length;
84
100
  line_dash?: NonNullable<ShapeDef["line_dash"]>;
101
+ line_cap?: NonNullable<ShapeDef["line_cap"]>;
102
+ line_join?: NonNullable<ShapeDef["line_join"]>;
103
+ line_compound?: NonNullable<ShapeDef["line_compound"]>;
85
104
  line_begin?: NonNullable<ShapeDef["line_begin"]>;
86
105
  line_end?: NonNullable<ShapeDef["line_end"]>;
87
106
  line_begin_size?: NonNullable<ShapeDef["line_begin_size"]>;
@@ -89,15 +108,18 @@ export interface ResolvedShape {
89
108
  path?: NonNullable<ShapeDef["path"]>;
90
109
  table?: ResolvedTable;
91
110
  chart?: ChartDef;
111
+ /** Where a click on it goes in a show: an address, `#<slide id>`, or a show jump. */
112
+ link?: string;
92
113
  group?: string;
93
114
  /** PowerPoint's Lock: not moved, sized or turned by hand. */
94
115
  locked?: boolean;
95
116
  geometry?: ShapeDef["geometry"];
96
117
  adjustments?: number[];
97
- /** A picture or a movie: its project path, its poster, its crop. */
118
+ /** A picture or a movie: its project path, its poster, its crop, how it plays. */
98
119
  media?: {
99
120
  path: string;
100
121
  poster?: number;
122
+ playback?: PlaybackDef;
101
123
  crop?: {
102
124
  left: number;
103
125
  top: number;
@@ -130,6 +152,8 @@ export interface ResolvedSlide {
130
152
  hidden: boolean;
131
153
  /** Its background's colour: its own, or its layout's or master's. */
132
154
  background: Color;
155
+ /** The colour map its colours are drawn through: its layout's over its master's, where they have one (Office's where not). */
156
+ color_map?: ColorMapDef;
133
157
  /** Its own background, a gradient or a picture (a project path), over the colour. */
134
158
  background_gradient?: GradientDef;
135
159
  background_picture?: string;
@@ -141,6 +165,8 @@ export interface ResolvedSlide {
141
165
  transition?: ResolvedTransition;
142
166
  /** Seconds after it comes on that a show goes on by itself (`advance_after`). */
143
167
  advance?: number;
168
+ /** The section that starts at it, by its name (`p14:section`). */
169
+ section?: string;
144
170
  notes?: string;
145
171
  /** Its place in the slides file's `slides`, and its block's generator for a generated slide. */
146
172
  file: {
@@ -197,8 +223,12 @@ export interface ResolveInput {
197
223
  export declare function joinPath(base: string, rel: string): string;
198
224
  /** Levels with list styles over them, the last one's values winning. */
199
225
  export declare function levelsOver(base: readonly LevelStyle[], ...over: (LevelsDef | undefined)[]): LevelStyle[];
226
+ /** A bullet's colour and size and a list's start over a level's: null takes the level's own away (its text's). */
227
+ export declare function bulletLookOver<L extends Pick<LevelStyle, "bullet_color" | "bullet_size" | "start_at">>(l: L, v: Pick<ParagraphFormatDef, "bullet_color" | "bullet_size" | "start_at">): L;
200
228
  /** What the text of a shape that is not a placeholder starts from under a master: PowerPoint's own, then the master's other style. */
201
229
  export declare const plainLevels: (master: MasterDef) => LevelStyle[];
230
+ /** Space before or after a paragraph as the slides file says it: points, or a number of lines. */
231
+ export declare const spaceOfFile: (s: NonNullable<NonNullable<ShapeFile["text"]>["space_before"]>) => ParagraphSpace;
202
232
  /** A colour the slides file names (its format has checked it): the theme's, lighter or darker, or `#RRGGBB`. */
203
233
  export declare const colorOfFile: (c: string) => Color;
204
234
  /** Paragraphs from the script's words: a line each; a list's items each a paragraph, a nested list a level deeper; `**bold**`, `*italic*`, `` `code` `` (in the font `code` names) and spans (WORDS_SPAN) as runs. */
@@ -1,2 +1,2 @@
1
1
  /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{colorOfFile as ee}from"@allyhub/formats";import{readMarks as _e,markRuns as be}from"@allyhub/piece";import{chartOfFile as ye}from"@allyhub/chart";import{AUTOSHAPE_STYLE as C,SHADOW_DEFAULTS as H,CONNECTOR_STYLE as ne,DRAWN_TEXTBOX_FRAME as te,TEXT_FALLBACK as ie,TEXT_INSETS as W,isConnectorGeometry as $e,placeholderFrame as xe,styleKindOf as we}from"./office.js";import{resolveAnimation as ke,resolveTransition as oe}from"./animation.js";import{glued as ve}from"./connect.js";import{pathSteps as Se}from"./path.js";import{masterPlaceholder as Ae}from"./placeholders.js";import{DECK_FONTS as Oe,OFFICE_THEME as ze,themeOver as Te}from"./theme.js";import{Pt as O}from"./units.js";export function joinPath(i,t){if(t.startsWith("/"))return t.slice(1);const u=[];for(const r of[...i.split("/"),...t.split("/")])r===""||r==="."||(r===".."?u.pop():u.push(r));return u.join("/")}const re={left:0,top:0,width:0,height:0},U=()=>Array.from({length:9},()=>({...ie,font:{...ie.font},margin_left:0}));export function levelsOver(i,...t){return i.map((u,r)=>{let o={...u,font:{...u.font}};for(const $ of t){const l=$?.[r];l&&(o={...o,...l.alignment===void 0?{}:{alignment:l.alignment},...l.line_spacing===void 0?{}:{line_spacing:l.line_spacing},...l.space_before===void 0?{}:{space_before:l.space_before},...l.space_after===void 0?{}:{space_after:l.space_after},...l.margin_left===void 0?{}:{margin_left:l.margin_left},...l.indent===void 0?{}:{indent:l.indent},font:{...o.font,...l.font}},l.numbered!==void 0&&(o.numbered=l.numbered,delete o.bullet),l.bullet===null?(delete o.bullet,delete o.numbered):l.bullet!==void 0?(delete o.numbered,o.bullet={char:l.bullet,...l.bullet_font===void 0?{}:{font:l.bullet_font}}):l.bullet_font!==void 0&&o.bullet&&(o.bullet={...o.bullet,font:l.bullet_font}))}return o})}function I(i,...t){const u=t.filter(o=>o!==void 0),r=o=>{for(let $=u.length-1;$>=0;$--){const l=u[$]?.[o];if(l!==void 0)return l}};return{vertical_anchor:r("vertical_anchor")??i.vertical_anchor,auto_size:r("auto_size")??i.auto_size,word_wrap:r("word_wrap")??i.word_wrap,margins:{left:r("margin_left")??W.left,top:r("margin_top")??W.top,right:r("margin_right")??W.right,bottom:r("margin_bottom")??W.bottom}}}const ae={vertical_anchor:"t",auto_size:"none",word_wrap:!0};export const plainLevels=i=>levelsOver(U(),i.text_styles.other);function V(i,t){return{...I(ae,t),levels:levelsOver(U(),i.text_styles.other,t.levels)}}function je(i,t,...u){return{...I(xe(t),...u),levels:levelsOver(U(),i.text_styles[we(t)],...u.map(r=>r?.levels))}}const Ee=Array.from({length:9},()=>({font:{color:C.font_color}})),de={vertical_anchor:C.vertical_anchor};function le(i,t){return{...I(ae,t),levels:levelsOver(U(),i.text_styles.other,Ee,t.levels)}}const X=i=>{const t={...i};return delete t.paragraphs,t},G=i=>({paragraphs:[],levels:[],...i}),N=i=>i==="none"?null:colorOfFile(i),Fe=/<span((?:\s+(?:color|font|size|bold|italic|underline|link|highlight|baseline|strike)="[^"\n]*")+)\s*>(.*?)<\/span>/gu,Ne=/(color|font|size|bold|italic|underline|link|highlight|baseline|strike)="([^"\n]*)"/gu,K=57344,Me=256,se="",Ce=/[\ue000-\ue100]|[^\ue000-\ue100]+/gu;export const colorOfFile=i=>ee(i)??"dk1";function Z(i){const{shadow:t,gradient:u}=i;return{...i.fill_transparency===void 0?{}:{fill_transparency:i.fill_transparency},...u?{gradient:{angle:u.angle??0,stops:u.stops.map(r=>({at:r.at,color:colorOfFile(r.color),...r.transparency===void 0?{}:{transparency:r.transparency}}))}}:{},...t?{shadow:{color:t.color===void 0?H.color:colorOfFile(t.color),blur:t.blur===void 0?H.blur:O(t.blur),distance:t.distance===void 0?H.distance:O(t.distance),angle:t.angle??H.angle,transparency:t.transparency??H.transparency}}:{}}}function fe(i,t,u=[]){return{...i,rows:i.rows.map((r,o)=>({height:r.height,cells:r.cells.map($=>{const l=u[o];return{...$,text:{paragraphs:$.text.paragraphs,style:B({...V(t,$.text),auto_size:"shape"},l),own:X($.text),empty:!1},...l?{fileText:l}:{}}})}))}}function B(i,t){return t?{...i,...t.anchor===void 0?{}:{vertical_anchor:t.anchor},levels:i.levels.map(u=>{const r={...u.font,...t.size===void 0?{}:{size:O(t.size)},...t.bold===void 0?{}:{bold:t.bold},...t.italic===void 0?{}:{italic:t.italic},...t.underline===void 0?{}:{underline:t.underline},...t.strike===void 0?{}:{strike:t.strike},...t.font===void 0?{}:{name:t.font}};t.color!==void 0&&(r.color=colorOfFile(t.color));const o={...u,font:r,...t.align===void 0?{}:{alignment:t.align},...t.line_spacing===void 0?{}:{line_spacing:{lines:t.line_spacing}},...t.space_before===void 0?{}:{space_before:O(t.space_before)},...t.space_after===void 0?{}:{space_after:O(t.space_after)}};return t.numbered!==void 0?(o.numbered=t.numbered,delete o.bullet):t.bullet===!1?(delete o.bullet,delete o.numbered):t.bullet!==void 0&&(o.bullet={char:t.bullet},delete o.numbered),(t.numbered!==void 0||t.bullet!==void 0&&t.bullet!==!1)&&u.margin_left===0?{...o,margin_left:ue,indent:-ue}:o})}:i}function Pe(i,t){if(!t)return[...i];const u=t.numbered!==void 0||t.bullet!==void 0;return i.map(r=>{const o={...r};return t.align!==void 0&&delete o.alignment,t.line_spacing!==void 0&&delete o.line_spacing,t.space_before!==void 0&&delete o.space_before,t.space_after!==void 0&&delete o.space_after,u&&(delete o.bullet,delete o.bullet_font,delete o.numbered),o})}function Le(i){const t={};for(const[,u,r=""]of i.matchAll(Ne))if(u==="font")t.name=r.trim();else if(u==="link")t.link=r.trim();else if(u==="highlight")t.highlight=r.trim().toUpperCase();else if(u==="bold")t.bold=r.trim()!=="false";else if(u==="italic")t.italic=r.trim()!=="false";else if(u==="strike")t.strike=r.trim()!=="false";else if(u==="underline")t.underline=r.trim()!=="false";else if(u==="size"){const o=Number(r);Number.isFinite(o)&&o>0&&(t.size=O(o))}else if(u==="baseline"){const o=Number(r);Number.isFinite(o)&&(t.baseline=o)}else{const o=ee(r.trim());o!==void 0&&(t.color=o)}return t}const ue=342900;export function paragraphsOfWords(i,t=0,u=Oe.code){return i===void 0?[]:typeof i=="string"?i.split(/\r?\n/u).map(r=>{const o=[],$=r.replace(Fe,(j,F,P)=>(o.push(Le(F)),`${String.fromCharCode(K+o.length-1)}${P}${se}`)),l=_e($);let E;const M=be(l.text,l.marks).flatMap(j=>{const F=j.kinds.includes("code"),P={...j.kinds.includes("strong")?{bold:!0}:{},...j.kinds.includes("em")?{italic:!0}:{},...F?{name:u}:{}};return[...j.text.matchAll(Ce)].flatMap(Y=>{const L=Y[0],R=L.charCodeAt(0);if(L===se)return E=void 0,[];if(R>=K&&R<K+Me)return E=o[R-K],[];const D={...E,...P};return[{text:L,...Object.keys(D).length>0?{font:D}:{},...F?{code:!0}:{}}]})});return{runs:M.length>0?M:[{text:""}],level:t}}):i.flatMap(r=>paragraphsOfWords(r,Array.isArray(r)?Math.min(t+1,8):t,u))}const ce=i=>({left:O(i.x),top:O(i.y),width:O(i.w),height:O(i.h)}),Re=new Set(["dt","ftr","sldNum"]),pe=i=>({...i.locked?{locked:!0}:{},...i.rotation===void 0||i.rotation===0?{}:{rotation:i.rotation},...i.flip_h||i.flip_v?{flip:{...i.flip_h?{h:!0}:{},...i.flip_v?{v:!0}:{}}}:{}});function he(i,t,u){if(!t)return;t.fill!==void 0&&(i.background=colorOfFile(t.fill));const r=t.gradient&&Z({gradient:t.gradient}).gradient;r&&(i.background_gradient=r),t.picture!==void 0&&(i.background_picture=joinPath(u,t.picture))}const me=i=>i===void 0?void 0:{left:i.left??0,top:i.top??0,right:i.right??0,bottom:i.bottom??0};export function resolveDeck(i){const{code:t,file:u,words:r,prefix:o,base:$}=i,l=[],E=Te(i.theme??ze,t.theme),M=new Map;for(const e of t.masters)for(const n of e.layouts)M.set(n.name,{layout:n,master:e});const j=[],F=(e,n,a)=>({name:e.name,kind:e.kind,frame:{...e.frame??re},...e.flip?{flip:{...e.flip}}:{},...e.connect?{connect:{...e.connect.begin?{begin:{...e.connect.begin}}:{},...e.connect.end?{end:{...e.connect.end}}:{}}}:{},...e.rotation===void 0?{}:{rotation:e.rotation},level:n,...e.text?{text:{paragraphs:e.text.paragraphs,style:e.kind==="autoshape"?le(a,e.text):V(a,e.text),own:X(e.text),empty:!1}}:{},...e.fill===void 0?{}:{fill:e.fill},...e.fill_transparency===void 0?{}:{fill_transparency:e.fill_transparency},...e.gradient?{gradient:e.gradient}:{},...e.shadow===void 0?{}:{shadow:e.shadow},...e.line===void 0?{}:{line:e.line},...e.line_width===void 0?{}:{line_width:e.line_width},...e.line_dash===void 0?{}:{line_dash:e.line_dash},...e.line_begin===void 0?{}:{line_begin:e.line_begin},...e.line_end===void 0?{}:{line_end:e.line_end},...e.line_begin_size===void 0?{}:{line_begin_size:e.line_begin_size},...e.line_end_size===void 0?{}:{line_end_size:e.line_end_size},...e.path?{path:e.path}:{},...e.table?{table:fe(e.table,a)}:{},...e.chart?{chart:e.chart}:{},...e.group===void 0?{}:{group:e.group},...e.geometry?{geometry:e.geometry}:{},...e.adjustments?{adjustments:[...e.adjustments]}:{},...e.media?{media:{path:joinPath(e.media.base,e.media.path),...e.media.poster===void 0?{}:{poster:e.media.poster}}}:{},...e.component?{component:{...e.component}}:{},sources:{frame:{from:n}}}),P=(e,n)=>{const a=e.placeholder?.type??"body",m=Ae(n,a),_=e.frame??m?.frame??re;return{name:e.name,kind:"placeholder",frame:{..._},level:"slide",...e.placeholder?{placeholder:{...e.placeholder}}:{},text:{paragraphs:[],style:je(n,a,m?.text,e.text),empty:!0},...e.fill===void 0?{}:{fill:e.fill},...e.line===void 0?{}:{line:e.line},sources:{frame:{from:e.frame||!m?"layout":"master"},text:{from:"layout"}}}},Y=(e,n,a,m)=>{const _=t.components[e];if(!_){l.push({...a,message:/\.[cm]?[jt]sx?(?:#|$)/u.test(e)?`${e} names no component: its module has no such export, or the export is not made with defineComponent.`:`There is no component ${e} in the deck's module (it has ${Object.keys(t.components).join(", ")||"none"}).`});return}for(const b of Object.keys(n??{}))Object.hasOwn(_.props,b)||l.push({...a,message:`Component ${e} has no prop ${b} a person sets (it has ${Object.keys(_.props).join(", ")||"none"}).`});return{name:e,props:{...n??{}},...m===void 0?{}:{dur:m}}},L=(e,n,a,m,_)=>{const b={slide:m,shape:e,path:a};if(!n.frame){l.push({...b,message:`Shape ${e} is the slide's own: it needs a frame { x, y, w, h } in points.`});return}const w=ce(n.frame),s={frame:{from:"slide",path:`${a}.frame`}},y={name:e,frame:w,level:"slide",...n.fill===void 0?{}:{fill:N(n.fill)},...Z(n),...n.line===void 0?{}:{line:N(n.line)},...n.line_dash===void 0?{}:{line_dash:n.line_dash},...n.line_begin===void 0?{}:{line_begin:n.line_begin},...n.line_end===void 0?{}:{line_end:n.line_end},...n.line_begin_size===void 0?{}:{line_begin_size:n.line_begin_size},...n.line_end_size===void 0?{}:{line_end_size:n.line_end_size},...n.group===void 0?{}:{group:n.group},...pe(n)};if(n.textbox)return{...y,kind:"textbox",text:{paragraphs:paragraphsOfWords(r(`${o}.${m}.${e}`),0,E.fonts.code),style:B(V(_,G(te)),n.text),own:X(G(te)),empty:!1},...n.text?{fileText:{...n.text}}:{},sources:{...s,text:{from:"slide",path:`${a}.text`}}};if(n.picture!==void 0){const f=me(n.crop);return{...y,kind:"picture",media:{path:joinPath($,n.picture),...f?{crop:f}:{}},sources:{...s,media:{from:"slide",path:`${a}.picture`}}}}if(n.movie!==void 0)return{...y,kind:"movie",media:{path:joinPath($,n.movie),...n.poster===void 0?{}:{poster:n.poster}},sources:{...s,media:{from:"slide",path:`${a}.movie`}}};if(n.chart){const f=r(`${o}.${m}.${e}`),S=ye(n.chart,{title:typeof f=="string"?f:void 0,base:$,rows:g=>i.data?.(g),problem:g=>{l.push({...b,message:`Chart ${e}: ${g}`})}});return S?{...y,kind:"chart",chart:S,sources:s}:void 0}if(n.table){const f=n.table,S=w.width/f.columns.reduce((d,c)=>d+c,0),g=w.height/f.rows.reduce((d,c)=>d+c.height,0),v=r(`${o}.${m}.${e}`),z=Array.isArray(v)?v:[];return z.length>f.rows.length&&l.push({...b,message:`Table ${e} has ${String(f.rows.length)} rows and its words ${String(z.length)}.`}),{...y,kind:"table",table:fe({columns:f.columns.map(d=>Math.round(d*S)),rows:f.rows.map((d,c)=>{const p=z[c],x=Array.isArray(p)?p:p===void 0?[]:[p];return{height:Math.round(d.height*g),cells:f.columns.map((k,A)=>({text:{levels:[],paragraphs:paragraphsOfWords(x[A],0,E.fonts.code)},...d.fill===void 0?{}:{fill:colorOfFile(d.fill)},...d.line===void 0?{}:{borders:{bottom:{color:colorOfFile(d.line),width:O(1)}}}}))}})},_,f.rows.map(d=>d.text)),sources:s}}const h=n.path&&Se(n.path.d);if(n.path&&!h){l.push({...b,message:`Shape ${e}'s path starts with M and says only M, L, C and Z, absolute.`});return}if(n.geometry!==void 0||n.path&&h){const f=!n.path&&$e(n.geometry);return{...y,kind:"autoshape",...n.path&&h?{path:{w:n.path.w,h:n.path.h,steps:h}}:n.geometry===void 0?{}:{geometry:n.geometry,...n.adjustments?{adjustments:[...n.adjustments]}:{}},...f?{line:n.line===void 0?ne.line:N(n.line),line_width:n.line_width===void 0?ne.line_width:O(n.line_width)}:{fill:n.fill===void 0?C.fill:N(n.fill),line:n.line===void 0?C.line:N(n.line),line_width:n.line_width===void 0?C.line_width:O(n.line_width)},...n.text&&!f?{fileText:{...n.text}}:{},...f?{}:{text:{paragraphs:paragraphsOfWords(r(`${o}.${m}.${e}`)).map(S=>n.text?.align===void 0?{alignment:C.alignment,...S}:S),style:B(le(_,G(de)),n.text),own:X(G(de)),empty:!1}},sources:{...s,fill:{from:"slide",path:`${a}.fill`}}}}if(n.component!==void 0){const f=Y(n.component,n.props,b,n.dur);return f?{...y,kind:"component",component:f,sources:s}:void 0}},R=(e,n,a)=>{if(n.frame&&(e.frame=ce(n.frame),e.sources.frame={from:"slide",path:`${a}.frame`}),Object.assign(e,pe(n)),n.dur!==void 0&&e.component&&(e.component={...e.component,dur:n.dur}),n.text&&e.text&&(e.text.style=B(e.text.style,n.text),e.text.paragraphs=Pe(e.text.paragraphs,n.text),e.fileText={...n.text},e.sources.text={from:"slide",path:`${a}.text`}),n.line!==void 0&&(e.line=N(n.line),e.sources.line={from:"slide",path:`${a}.line`}),n.line_width!==void 0&&(e.line_width=O(n.line_width)),n.line_dash!==void 0&&(e.line_dash=n.line_dash),n.line_begin!==void 0&&(e.line_begin=n.line_begin),n.line_end!==void 0&&(e.line_end=n.line_end),n.line_begin_size!==void 0&&(e.line_begin_size=n.line_begin_size),n.line_end_size!==void 0&&(e.line_end_size=n.line_end_size),n.fill!==void 0&&(e.fill=N(n.fill),e.sources.fill={from:"slide",path:`${a}.fill`}),Object.assign(e,Z(n)),(n.picture!==void 0||n.movie!==void 0)&&(e.placeholder?.type==="pic"||e.placeholder?.type==="media"||e.placeholder?.type==="obj")){const m=me(n.crop);e.kind=n.picture!==void 0?"picture":"movie",e.media={path:joinPath($,n.picture??n.movie??""),...m?{crop:m}:{},...n.poster===void 0?{}:{poster:n.poster}},e.sources.media={from:"slide",path:`${a}.${n.picture!==void 0?"picture":"movie"}`},delete e.text}},D=(e,n,a,m,_)=>{const b=M.get(n);if(!b){l.push({slide:e,path:`slides.${String(a)}.layout`,message:`Slide ${e} is on the layout "${n}", which the deck's module does not have (it has ${[...M.keys()].join(", ")||"none"}).`});return}const{layout:w,master:s}=b,y=[...(w.display_master_shapes===!1?[]:s.shapes).filter(f=>f.kind!=="placeholder").map(f=>F(f,"master",s)),...w.shapes.filter(f=>f.kind!=="placeholder").map(f=>F(f,"layout",s))],h=w.shapes.filter(f=>f.kind==="placeholder").map((f,S)=>({shape:P(f,s),order:S}));return{slide:{id:e,layout:w.name,master:s.name,hidden:m,background:w.background??s.background,shapes:y,animations:[],file:{index:a,..._===void 0?{}:{generate:_}}},placed:h,master:s}},q=(e,n,a)=>{if(!n)return;const m=w=>{const s=n[w];if(s===void 0)return e.connect?.[w];const y=s==="none"?void 0:a(s.shape);return s==="none"||y===void 0?void 0:{shape:y,site:s.site}},_=m("begin"),b=m("end");_||b?e.connect={..._?{begin:_}:{},...b?{end:b}:{}}:delete e.connect},J=(e,n,a,m,_,b,w,s,y,h=()=>{})=>{const f=new Set(a.map(d=>d.shape.name));let S=a.length;for(const[d,c]of Object.entries(m??{})){const p=b(d);if(p===void 0)continue;const x=`${_}.shapes.${d}`,k=c.textbox!==void 0||c.geometry!==void 0||c.path!==void 0||c.table!==void 0||c.chart!==void 0||c.component!==void 0||(c.picture!==void 0||c.movie!==void 0)&&!f.has(p),A=a.find(ge=>ge.shape.name===p);if(A&&!k){R(A.shape,c,x),q(A.shape,c.connect,b),A.shown=!0,c.z!==void 0&&(A.z=c.z);continue}if(A){l.push({slide:e.id,shape:p,path:x,message:`Slide ${e.id} has a ${A.shape.kind} ${p} already: a shape of its own needs another name.`});continue}if(!k){l.push({slide:e.id,shape:p,path:x,message:`Slide ${e.id} has no shape ${p} to change (its layout's placeholders and its own shapes are ${[...f].join(", ")||"none"}).`});continue}const T=L(p,c,x,e.id,n);T&&q(T,c.connect,b),T&&(a.push({shape:T,order:S++,...c.z===void 0?{}:{z:c.z}}),f.add(p))}const g=a.filter(d=>d.shown===!0||!Re.has(d.shape.placeholder?.type??"")||w(d.shape)!==void 0);a.splice(0,a.length,...g),a.sort((d,c)=>(d.z??0)-(c.z??0)||d.order-c.order);const v=new Map(a.flatMap((d,c)=>d.shape.group===void 0?[]:[[d.shape.group,c]])),z=a.flatMap((d,c)=>{const p=d.shape.group;return p===void 0?[d]:v.get(p)===c?a.filter(x=>x.shape.group===p):[]});a.splice(0,a.length,...z);for(const d of a){const c=h(d.shape);c!==void 0&&(d.shape.alt=c);const p=d.shape.text;if(d.shape.kind==="placeholder"&&p){const x=w(d.shape);p.paragraphs=paragraphsOfWords(x,0,E.fonts.code),p.empty=p.paragraphs.length===0||p.paragraphs.every(k=>k.runs.every(A=>A.text===""))}}e.shapes.push(...a.map(d=>d.shape));for(const d of e.shapes){const c=d.connect;if(!c)continue;const p=ve(d,x=>e.shapes.find(k=>k.name===x&&k.level===d.level&&k!==d));d.frame=p.frame,p.flip?d.flip=p.flip:delete d.flip;for(const x of p.lost){const k=c[x];k&&d.level==="slide"&&l.push({slide:e.id,shape:d.name,message:`Connector ${d.name}'s ${x} is glued to site ${String(k.site)} of ${k.shape}, which slide ${e.id} has not: it stays where it is.`})}}s!==void 0&&s.trim()!==""&&(e.notes=s);for(const[d,c]of(y??[]).entries()){const p=b(c.shape);if(p===void 0)continue;const x={slide:e.id,shape:p,path:`${_}.animations.${String(d)}`},k=e.shapes.find(T=>T.name===p&&T.level==="slide");if(!k){l.push({...x,message:`Slide ${e.id} has no shape ${p} to animate (it has ${e.shapes.filter(T=>T.level==="slide").map(T=>T.name).join(", ")}).`});continue}if(c.paragraph!==void 0&&c.paragraph>=(k.text?.paragraphs.length??0)){l.push({...x,message:`Shape ${p} has no paragraph ${String(c.paragraph)} to animate (it has ${String(k.text?.paragraphs.length??0)}).`});continue}const A=ke({...c,shape:p});A?e.animations.push(A):l.push({...x,message:`The animation of ${p} needs a path that starts with M and says only M, L and C, absolute.`})}},Q=new Set;return u.slides.forEach((e,n)=>{const a=`slides.${String(n)}`;if(e.layout!==void 0){const s=D(e.id,e.layout,n,e.hidden===!0);if(!s)return;const y=r(`${o}.${e.id}.notes`);e.transition&&(s.slide.transition=oe(e.transition)),e.advance_after!==void 0&&(s.slide.advance=e.advance_after),he(s.slide,e.background,$),J(s.slide,s.master,s.placed,e.shapes,a,h=>h,h=>r(`${o}.${e.id}.${h.name}`),typeof y=="string"?y:void 0,e.animations,h=>{const f=r(`${o}.${e.id}.alt.${h.name}`);return typeof f=="string"?f:void 0}),j.push(s.slide),Q.add(e.id);return}const m=e.generate??"",_=t.generators[m];if(_===void 0){l.push({slide:e.id,path:`${a}.generate`,message:`There is no generator ${m} in the deck's module (it has ${Object.keys(t.generators).join(", ")||"none"}).`});return}if(!Array.isArray(_)){l.push({slide:e.id,path:`${a}.generate`,message:`Generator ${m} threw: ${_.error}`,..._.stack===void 0?{}:{stack:_.stack}});return}const b=_,w=new Set(Array.isArray(e.hidden)?e.hidden:[]);for(const s of b){const y=`${e.id}/${s.id}`,h=D(y,s.layout,n,w.has(s.id),m);if(!h)continue;for(const g of s.shapes){const v=g.placeholder?h.placed.find(z=>z.shape.placeholder?.idx===g.placeholder?.idx):void 0;if(v)g.frame&&(v.shape.frame={...g.frame}),v.shape.sources.frame={from:"code"},v.shown=!0;else{const z=F(g,"layout",h.master);h.placed.push({shape:{...z,level:"slide",sources:{frame:{from:"code"}}},order:h.placed.length})}}const f=`${s.id}/`,S=s.transition??(s===b[0]?e.transition:void 0);he(h.slide,e.background,$),S&&(h.slide.transition=oe(S)),J(h.slide,h.master,h.placed,e.shapes,a,g=>g.startsWith(f)?g.slice(f.length):void 0,g=>{const v=g.placeholder===void 0?void 0:s.text[g.placeholder.idx];return v===void 0?void 0:v.map(z=>z.runs.map(d=>d.text).join(""))},s.notes,[...(s.animations??[]).map(g=>({...g,shape:`${f}${g.shape}`})),...e.animations??[]]);for(const g of h.slide.shapes){const v=g.placeholder===void 0?void 0:s.text[g.placeholder.idx];v&&g.text&&(g.text.paragraphs=v,g.text.empty=!1)}j.push(h.slide),Q.add(y)}for(const s of Object.keys(e.shapes??{})){const[y]=s.split("/");y!==void 0&&!b.some(h=>h.id===y)&&l.push({slide:e.id,path:`${a}.shapes.${s}`,message:`Generator ${m} makes no slide ${y}: ${s} changes nothing.`})}}),j.forEach((e,n)=>{for(const a of e.shapes)a.placeholder?.type==="sldNum"&&a.text&&(a.text.paragraphs=[{level:0,runs:[{text:String(n+1),field:"slidenum"}]}],a.text.empty=!1)}),{deck:{width:t.slide_width,height:t.slide_height,theme:E,slides:j},problems:l}}
2
+ import{CAPS as ze,colorOfFile as de,groupLevels as Ae,SHOW_JUMPS as Te,showJumpOf as je,slideLinkOf as Ee,UNDERLINES as Fe}from"@allyhub/formats";import{readMarks as Ne,markRuns as Le}from"@allyhub/piece";import{chartOfFile as Me}from"@allyhub/chart";import{AUTOSHAPE_STYLE as R,SHADOW_DEFAULTS as I,PATTERN_DEFAULTS as se,TILE_DEFAULTS as W,INNER_SHADOW_DEFAULTS as H,GLOW_DEFAULTS as q,REFLECTION_DEFAULTS as X,CONNECTOR_STYLE as fe,DRAWN_TEXTBOX_FRAME as ce,TEXT_FALLBACK as ue,TEXT_INSETS as B,isConnectorGeometry as Ce,placeholderFrame as Pe,styleKindOf as Re}from"./office.js";import{resolveAnimation as De,resolveTransition as Ue,unitsAcross as Ie,EFFECT_OPTIONS as We,TRANSITION_OPTIONS as He}from"./animation.js";import{glued as Ge}from"./connect.js";import{pathSteps as Xe}from"./path.js";import{CHART_AXIS_WORDS as Be}from"./script.js";import{cellLook as Ke,tableStyleOf as Q}from"./table-style.js";import{masterPlaceholder as Je}from"./placeholders.js";import{DECK_FONTS as Ye,OFFICE_THEME as Ve,themeOver as Ze}from"./theme.js";import{Pt as S}from"./units.js";export function joinPath(i,t){if(t.startsWith("/"))return t.slice(1);const l=[];for(const r of[...i.split("/"),...t.split("/")])r===""||r==="."||(r===".."?l.pop():l.push(r));return l.join("/")}const pe={left:0,top:0,width:0,height:0};function qe(i,t){const l={...i.color_map,...t.color_map};return Object.keys(l).length>0?{color_map:l}:{}}const K=()=>Array.from({length:9},()=>({...ue,font:{...ue.font},margin_left:0}));export function levelsOver(i,...t){return i.map((l,r)=>{let o={...l,font:{...l.font}};for(const y of t){const a=y?.[r];a&&(o={...o,...a.alignment===void 0?{}:{alignment:a.alignment},...a.line_spacing===void 0?{}:{line_spacing:a.line_spacing},...a.space_before===void 0?{}:{space_before:a.space_before},...a.space_after===void 0?{}:{space_after:a.space_after},...a.margin_left===void 0?{}:{margin_left:a.margin_left},...a.indent===void 0?{}:{indent:a.indent},font:{...o.font,...a.font}},a.numbered!==void 0&&(o.numbered=a.numbered,delete o.bullet),a.bullet===null?(delete o.bullet,delete o.numbered):a.bullet!==void 0?(delete o.numbered,o.bullet={char:a.bullet,...a.bullet_font===void 0?{}:{font:a.bullet_font}}):a.bullet_font!==void 0&&o.bullet&&(o.bullet={...o.bullet,font:a.bullet_font}),o=bulletLookOver(o,a))}return o})}export function bulletLookOver(i,t){const l={...i};return t.bullet_color===null?delete l.bullet_color:t.bullet_color!==void 0&&(l.bullet_color=t.bullet_color),t.bullet_size===null?delete l.bullet_size:t.bullet_size!==void 0&&(l.bullet_size=t.bullet_size),t.start_at!==void 0&&(l.start_at=t.start_at),l}function ee(i,...t){const l=t.filter(o=>o!==void 0),r=o=>{for(let y=l.length-1;y>=0;y--){const a=l[y]?.[o];if(a!==void 0)return a}};return{vertical_anchor:r("vertical_anchor")??i.vertical_anchor,orientation:r("orientation")??"horz",auto_size:r("auto_size")??i.auto_size,word_wrap:r("word_wrap")??i.word_wrap,margins:{left:r("margin_left")??B.left,top:r("margin_top")??B.top,right:r("margin_right")??B.right,bottom:r("margin_bottom")??B.bottom}}}const he={vertical_anchor:"t",auto_size:"none",word_wrap:!0};export const plainLevels=i=>levelsOver(K(),i.text_styles.other);function ne(i,t){return{...ee(he,t),levels:levelsOver(K(),i.text_styles.other,t.levels)}}function Qe(i,t,...l){return{...ee(Pe(t),...l),levels:levelsOver(K(),i.text_styles[Re(t)],...l.map(r=>r?.levels))}}const en=Array.from({length:9},()=>({font:{color:R.font_color}})),me={vertical_anchor:R.vertical_anchor};function _e(i,t){return{...ee(he,t),levels:levelsOver(K(),i.text_styles.other,en,t.levels)}}const J=i=>{const t={...i};return delete t.paragraphs,t},Y=i=>({paragraphs:[],levels:[],...i}),C=i=>i==="none"?null:colorOfFile(i),nn=/<span((?:\s+(?:color|font|size|bold|italic|underline|link|highlight|baseline|strike|spacing|caps)="[^"\n]*")+)\s*>(.*?)<\/span>/gu,tn=/(color|font|size|bold|italic|underline|link|highlight|baseline|strike|spacing|caps)="([^"\n]*)"/gu,V=57344,on=256,ge="",rn=/[\ue000-\ue100]|[^\ue000-\ue100]+/gu;export const spaceOfFile=i=>typeof i=="number"?S(i):{lines:i.lines},colorOfFile=i=>de(i)??"dk1";function te(i){const{shadow:t,gradient:l,inner_shadow:r,glow:o,reflection:y}=i;return{...r?{inner_shadow:{color:r.color===void 0?H.color:colorOfFile(r.color),blur:r.blur===void 0?H.blur:S(r.blur),distance:r.distance===void 0?H.distance:S(r.distance),angle:r.angle??H.angle,transparency:r.transparency??H.transparency}}:{},...o?{glow:{color:o.color===void 0?q.color:colorOfFile(o.color),size:o.size===void 0?q.size:S(o.size),transparency:o.transparency??q.transparency}}:{},...i.soft_edges===void 0?{}:{soft_edges:S(i.soft_edges)},...y?{reflection:{transparency:y.transparency??X.transparency,size:y.size??X.size,distance:y.distance===void 0?X.distance:S(y.distance),blur:y.blur===void 0?X.blur:S(y.blur)}}:{},...i.fill_transparency===void 0?{}:{fill_transparency:i.fill_transparency},...l?{gradient:{angle:l.angle??0,...l.path===void 0?{}:{path:l.path},...l.focus===void 0?{}:{focus:{left:l.focus.left??.5,top:l.focus.top??.5,right:l.focus.right??.5,bottom:l.focus.bottom??.5}},stops:l.stops.map(a=>({at:a.at,color:colorOfFile(a.color),...a.transparency===void 0?{}:{transparency:a.transparency}}))}}:{},...t?{shadow:{color:t.color===void 0?I.color:colorOfFile(t.color),blur:t.blur===void 0?I.blur:S(t.blur),distance:t.distance===void 0?I.distance:S(t.distance),angle:t.angle??I.angle,transparency:t.transparency??I.transparency}}:{}}}const an=i=>({...i.tile?{tile:{...i.tile}}:{},...i.transparency===void 0?{}:{transparency:i.transparency}});function be(i,t){const{pattern:l,picture_fill:r}=i;return{...l?{pattern:{preset:l.preset,fg:colorOfFile(l.fg??se.fg),bg:colorOfFile(l.bg??se.bg)}}:{},...r?{picture_fill:{path:joinPath(t,r.path),...r.tile?{tile:{scale_x:r.tile.scale_x??W.scale_x,scale_y:r.tile.scale_y??W.scale_y,offset_x:r.tile.x===void 0?W.offset_x:S(r.tile.x),offset_y:r.tile.y===void 0?W.offset_y:S(r.tile.y),align:r.tile.align??W.align}}:{},...r.transparency===void 0?{}:{transparency:r.transparency}}}:{}}}function ye(i,t,l=[]){const r=Q(i.style);return{...i,rows:i.rows.map((o,y)=>({height:o.height,cells:o.cells.map((a,E)=>{const N=l[y],v=r?Ke(r,i,y,E,i.rows.length,i.columns.length,y+(a.span_height??1)-1,E+(a.span_width??1)-1):void 0,F=ne(t,a.text),L=v&&(v.bold!==void 0||v.text!==void 0)?{...F,levels:F.levels.map(P=>({...P,font:{...P.font,...v.bold===void 0?{}:{bold:v.bold},...v.text===void 0?{}:{color:v.text}}}))}:F;return{...a,text:{paragraphs:a.text.paragraphs,style:Z({...L,auto_size:"shape"},N),own:J(a.text),empty:!1},...N?{fileText:N}:{}}})}))}}function Z(i,t){return t?{...i,...t.anchor===void 0?{}:{vertical_anchor:t.anchor},...t.orientation===void 0?{}:{orientation:t.orientation},levels:i.levels.map(l=>{const r={...l.font,...t.size===void 0?{}:{size:S(t.size)},...t.bold===void 0?{}:{bold:t.bold},...t.italic===void 0?{}:{italic:t.italic},...t.underline===void 0?{}:{underline:t.underline},...t.strike===void 0?{}:{strike:t.strike},...t.caps===void 0?{}:{caps:t.caps},...t.font===void 0?{}:{name:t.font}};t.color!==void 0&&(r.color=colorOfFile(t.color));const o={...l,font:r,...t.align===void 0?{}:{alignment:t.align},...t.line_spacing===void 0?{}:{line_spacing:{lines:t.line_spacing}},...t.space_before===void 0?{}:{space_before:spaceOfFile(t.space_before)},...t.space_after===void 0?{}:{space_after:spaceOfFile(t.space_after)}};return t.bullet_color!==void 0&&(o.bullet_color=colorOfFile(t.bullet_color)),t.bullet_size!==void 0&&(o.bullet_size=t.bullet_size),t.start_at!==void 0&&(o.start_at=t.start_at),t.numbered!==void 0?(o.numbered=t.numbered,delete o.bullet):t.bullet===!1?(delete o.bullet,delete o.numbered):t.bullet!==void 0&&(o.bullet={char:t.bullet},delete o.numbered),(t.numbered!==void 0||t.bullet!==void 0&&t.bullet!==!1)&&l.margin_left===0?{...o,margin_left:$e,indent:-$e}:o})}:i}function ln(i,t){if(!t)return[...i];const l=t.numbered!==void 0||t.bullet!==void 0;return i.map(r=>{const o={...r};return t.align!==void 0&&delete o.alignment,t.line_spacing!==void 0&&delete o.line_spacing,t.space_before!==void 0&&delete o.space_before,t.space_after!==void 0&&delete o.space_after,t.bullet_color!==void 0&&delete o.bullet_color,t.bullet_size!==void 0&&delete o.bullet_size,t.start_at!==void 0&&delete o.start_at,l&&(delete o.bullet,delete o.bullet_font,delete o.numbered),o})}const dn=i=>Fe.includes(i),sn=i=>ze.includes(i);function fn(i){const t={};for(const[,l,r=""]of i.matchAll(tn))if(l==="font")t.name=r.trim();else if(l==="link")t.link=r.trim();else if(l==="highlight")t.highlight=r.trim().toUpperCase();else if(l==="bold")t.bold=r.trim()!=="false";else if(l==="italic")t.italic=r.trim()!=="false";else if(l==="strike"){const o=r.trim();t.strike=o==="dblStrike"?o:o!=="false"}else if(l==="underline"){const o=r.trim();t.underline=dn(o)&&o!=="sng"?o:o!=="false"}else if(l==="caps"){const o=r.trim();sn(o)&&(t.caps=o)}else if(l==="size"){const o=Number(r);Number.isFinite(o)&&o>0&&(t.size=S(o))}else if(l==="baseline"){const o=Number(r);Number.isFinite(o)&&(t.baseline=o)}else if(l==="spacing"){const o=Number(r);Number.isFinite(o)&&(t.spacing=S(o))}else{const o=de(r.trim());o!==void 0&&(t.color=o)}return t}const $e=342900;export function paragraphsOfWords(i,t=0,l=Ye.code){return i===void 0?[]:typeof i=="string"?i.split(/\r?\n/u).map(r=>{const o=[],y=r.replace(nn,(v,F,L)=>(o.push(fn(F)),`${String.fromCharCode(V+o.length-1)}${L}${ge}`)),a=Ne(y);let E;const N=Le(a.text,a.marks).flatMap(v=>{const F=v.kinds.includes("code"),L={...v.kinds.includes("strong")?{bold:!0}:{},...v.kinds.includes("em")?{italic:!0}:{},...F?{name:l}:{}};return[...v.text.matchAll(rn)].flatMap(P=>{const D=P[0],U=D.charCodeAt(0);if(D===ge)return E=void 0,[];if(U>=V&&U<V+on)return E=o[U-V],[];const G={...E,...L};return[{text:D,...Object.keys(G).length>0?{font:G}:{},...F?{code:!0}:{}}]})});return{runs:N.length>0?N:[{text:""}],level:t}}):i.flatMap(r=>paragraphsOfWords(r,Array.isArray(r)?Math.min(t+1,8):t,l))}const ke=i=>({left:S(i.x),top:S(i.y),width:S(i.w),height:S(i.h)}),cn=new Set(["dt","ftr","sldNum"]),we=i=>({...i.locked?{locked:!0}:{},...i.link===void 0?{}:{link:i.link},...i.rotation===void 0||i.rotation===0?{}:{rotation:i.rotation},...i.flip_h||i.flip_v?{flip:{...i.flip_h?{h:!0}:{},...i.flip_v?{v:!0}:{}}}:{}});function xe(i,t,l){if(!t)return;t.fill!==void 0&&(i.background=colorOfFile(t.fill));const r=t.gradient&&te({gradient:t.gradient}).gradient;r&&(i.background_gradient=r),t.picture!==void 0&&(i.background_picture=joinPath(l,t.picture))}const un=i=>{const t=Q(i.style);return{...t?{style:t.id}:{},...i.first_row===void 0?{}:{first_row:i.first_row},...i.last_row===void 0?{}:{last_row:i.last_row},...i.first_col===void 0?{}:{first_col:i.first_col},...i.last_col===void 0?{}:{last_col:i.last_col},...i.horz_banding===void 0?{}:{horz_banding:i.horz_banding},...i.vert_banding===void 0?{}:{vert_banding:i.vert_banding}}},Se=i=>i===void 0?void 0:{left:i.left??0,top:i.top??0,right:i.right??0,bottom:i.bottom??0};export function resolveDeck(i){const{code:t,file:l,words:r,prefix:o,base:y}=i,a=[],E=Ze(i.theme??Ve,t.theme),N=new Map;for(const e of t.masters)for(const n of e.layouts)N.set(n.name,{layout:n,master:e});const v=[],F=(e,n,s)=>{const h=He[n.type];return n.direction!==void 0&&!h.directions.includes(n.direction)&&a.push({slide:e,path:`${s}.transition.direction`,message:h.directions.length===0?`A ${n.type} transition has no direction (${n.direction}).`:`A ${n.type} transition goes ${h.directions.join(", ")}, not ${n.direction}.`}),n.through_black===!0&&!h.throughBlack&&a.push({slide:e,path:`${s}.transition.through_black`,message:`A ${n.type} transition does not go through black: only a fade, a cut and a reveal do.`}),Ue(n)},L=(e,n,s)=>({name:e.name,kind:e.kind,frame:{...e.frame??pe},...e.flip?{flip:{...e.flip}}:{},...e.connect?{connect:{...e.connect.begin?{begin:{...e.connect.begin}}:{},...e.connect.end?{end:{...e.connect.end}}:{}}}:{},...e.rotation===void 0?{}:{rotation:e.rotation},level:n,...e.text?{text:{paragraphs:e.text.paragraphs,style:e.kind==="autoshape"?_e(s,e.text):ne(s,e.text),own:J(e.text),empty:!1}}:{},...e.fill===void 0?{}:{fill:e.fill},...e.fill_transparency===void 0?{}:{fill_transparency:e.fill_transparency},...e.gradient?{gradient:e.gradient}:{},...e.pattern?{pattern:e.pattern}:{},...e.picture_fill?{picture_fill:{...an(e.picture_fill),path:joinPath(e.picture_fill.base,e.picture_fill.path)}}:{},...e.shadow===void 0?{}:{shadow:e.shadow},...e.inner_shadow?{inner_shadow:e.inner_shadow}:{},...e.glow?{glow:e.glow}:{},...e.soft_edges===void 0?{}:{soft_edges:e.soft_edges},...e.reflection?{reflection:e.reflection}:{},...e.line===void 0?{}:{line:e.line},...e.line_width===void 0?{}:{line_width:e.line_width},...e.line_dash===void 0?{}:{line_dash:e.line_dash},...e.line_cap===void 0?{}:{line_cap:e.line_cap},...e.line_join===void 0?{}:{line_join:e.line_join},...e.line_compound===void 0?{}:{line_compound:e.line_compound},...e.line_begin===void 0?{}:{line_begin:e.line_begin},...e.line_end===void 0?{}:{line_end:e.line_end},...e.line_begin_size===void 0?{}:{line_begin_size:e.line_begin_size},...e.line_end_size===void 0?{}:{line_end_size:e.line_end_size},...e.path?{path:e.path}:{},...e.table?{table:ye(e.table,s)}:{},...e.chart?{chart:e.chart}:{},...e.link===void 0?{}:{link:e.link},...e.group===void 0?{}:{group:e.group},...e.geometry?{geometry:e.geometry}:{},...e.adjustments?{adjustments:[...e.adjustments]}:{},...e.media?{media:{path:joinPath(e.media.base,e.media.path),...e.media.poster===void 0?{}:{poster:e.media.poster},...e.media.playback?{playback:e.media.playback}:{}}}:{},...e.component?{component:{...e.component}}:{},sources:{frame:{from:n}}}),P=(e,n)=>{const s=e.placeholder?.type??"body",h=Je(n,s),g=e.frame??h?.frame??pe;return{name:e.name,kind:"placeholder",frame:{...g},level:"slide",...e.placeholder?{placeholder:{...e.placeholder}}:{},text:{paragraphs:[],style:Qe(n,s,h?.text,e.text),empty:!0},...e.fill===void 0?{}:{fill:e.fill},...e.line===void 0?{}:{line:e.line},sources:{frame:{from:e.frame||!h?"layout":"master"},text:{from:"layout"}}}},D=(e,n,s,h)=>{const g=t.components[e];if(!g){a.push({...s,message:/\.[cm]?[jt]sx?(?:#|$)/u.test(e)?`${e} names no component: its module has no such export, or the export is not made with defineComponent.`:`There is no component ${e} in the deck's module (it has ${Object.keys(t.components).join(", ")||"none"}).`});return}for(const $ of Object.keys(n??{}))Object.hasOwn(g.props,$)||a.push({...s,message:`Component ${e} has no prop ${$} a person sets (it has ${Object.keys(g.props).join(", ")||"none"}).`});return{name:e,props:{...n??{}},...h===void 0?{}:{dur:h}}},U=(e,n,s,h,g)=>{const $={slide:h,shape:e,path:s};if(!n.frame){a.push({...$,message:`Shape ${e} is the slide's own: it needs a frame { x, y, w, h } in points.`});return}const T=ke(n.frame),u={frame:{from:"slide",path:`${s}.frame`}},x={name:e,frame:T,level:"slide",...n.fill===void 0?{}:{fill:C(n.fill)},...te(n),...be(n,y),...n.line===void 0?{}:{line:C(n.line)},...n.line_dash===void 0?{}:{line_dash:n.line_dash},...n.line_cap===void 0?{}:{line_cap:n.line_cap},...n.line_join===void 0?{}:{line_join:n.line_join},...n.line_compound===void 0?{}:{line_compound:n.line_compound},...n.line_begin===void 0?{}:{line_begin:n.line_begin},...n.line_end===void 0?{}:{line_end:n.line_end},...n.line_begin_size===void 0?{}:{line_begin_size:n.line_begin_size},...n.line_end_size===void 0?{}:{line_end_size:n.line_end_size},...n.group===void 0?{}:{group:n.group},...we(n)};if(n.textbox)return{...x,kind:"textbox",text:{paragraphs:paragraphsOfWords(r(`${o}.${h}.${e}`),0,E.fonts.code),style:Z(ne(g,Y(ce)),n.text),own:J(Y(ce)),empty:!1},...n.text?{fileText:{...n.text}}:{},sources:{...u,text:{from:"slide",path:`${s}.text`}}};if(n.picture!==void 0){const p=Se(n.crop);return{...x,kind:"picture",media:{path:joinPath(y,n.picture),...p?{crop:p}:{}},sources:{...u,media:{from:"slide",path:`${s}.picture`}}}}if(n.movie!==void 0)return{...x,kind:"movie",media:{path:joinPath(y,n.movie),...n.poster===void 0?{}:{poster:n.poster},...n.playback?{playback:n.playback}:{}},sources:{...u,media:{from:"slide",path:`${s}.movie`}}};if(n.audio!==void 0)return{...x,kind:"audio",media:{path:joinPath(y,n.audio),...n.playback?{playback:n.playback}:{}},sources:{...u,media:{from:"slide",path:`${s}.audio`}}};if(n.chart){const p=`${o}.${h}.${e}`,j=c=>typeof c=="string"?c:void 0,w=Object.fromEntries(Be.flatMap(c=>{const d=j(r(`${p}.${c}`));return d===void 0?[]:[[c,d]]})),O=Me(n.chart,{title:j(r(p))??j(r(`${p}.title`)),axisTitles:w,base:y,rows:c=>i.data?.(c),problem:c=>{a.push({...$,message:`Chart ${e}: ${c}`})}});return O?{...x,kind:"chart",chart:O,sources:u}:void 0}if(n.table){const p=n.table;p.style!==void 0&&!Q(p.style)&&a.push({...$,message:`Table ${e}'s style ${p.style} is none of PowerPoint's built-in table styles: name one as its gallery does (Medium Style 2 - Accent 1, Light Style 1, No Style, Table Grid) or by its id.`});const j=T.width/p.columns.reduce((f,m)=>f+m,0),w=T.height/p.rows.reduce((f,m)=>f+m.height,0),O=r(`${o}.${h}.${e}`),c=Array.isArray(O)?O:[],d=new Map;for(const f of p.merged??[]){const m=f.rows??1,_=f.columns??1;for(let k=f.row;k<f.row+m;k++)for(let z=f.column;z<f.column+_;z++)d.set(`${String(k)},${String(z)}`,"under");d.set(`${String(f.row)},${String(f.column)}`,{w:_,h:m})}return c.length>p.rows.length&&a.push({...$,message:`Table ${e} has ${String(p.rows.length)} rows and its words ${String(c.length)}.`}),{...x,kind:"table",table:ye({...un(p),columns:p.columns.map(f=>Math.round(f*j)),rows:p.rows.map((f,m)=>{const _=c[m],k=Array.isArray(_)?_:_===void 0?[]:[_];return{height:Math.round(f.height*w),cells:p.columns.map((z,M)=>{const A=d.get(`${String(m)},${String(M)}`);return{text:{levels:[],paragraphs:A==="under"?[]:paragraphsOfWords(k[M],0,E.fonts.code)},...A==="under"?{spanned:!0}:{},...A!==void 0&&A!=="under"&&A.w>1?{span_width:A.w}:{},...A!==void 0&&A!=="under"&&A.h>1?{span_height:A.h}:{},...f.fill===void 0?{}:{fill:colorOfFile(f.fill)},...f.line===void 0?{}:{borders:{bottom:{color:colorOfFile(f.line),width:S(1)}}}}})}})},g,p.rows.map(f=>f.text)),sources:u}}const b=n.path&&Xe(n.path.d);if(n.path&&!b){a.push({...$,message:`Shape ${e}'s path starts with M and says only M, L, C and Z, absolute.`});return}if(n.geometry!==void 0||n.path&&b){const p=!n.path&&Ce(n.geometry);return{...x,kind:"autoshape",...n.path&&b?{path:{w:n.path.w,h:n.path.h,steps:b}}:n.geometry===void 0?{}:{geometry:n.geometry,...n.adjustments?{adjustments:[...n.adjustments]}:{}},...p?{line:n.line===void 0?fe.line:C(n.line),line_width:n.line_width===void 0?fe.line_width:S(n.line_width)}:{fill:n.fill===void 0?R.fill:C(n.fill),line:n.line===void 0?R.line:C(n.line),line_width:n.line_width===void 0?R.line_width:S(n.line_width)},...n.text&&!p?{fileText:{...n.text}}:{},...p?{}:{text:{paragraphs:paragraphsOfWords(r(`${o}.${h}.${e}`)).map(j=>n.text?.align===void 0?{alignment:R.alignment,...j}:j),style:Z(_e(g,Y(me)),n.text),own:J(Y(me)),empty:!1}},sources:{...u,fill:{from:"slide",path:`${s}.fill`}}}}if(n.component!==void 0){const p=D(n.component,n.props,$,n.dur);return p?{...x,kind:"component",component:p,sources:u}:void 0}},G=(e,n,s)=>{if(n.frame&&(e.frame=ke(n.frame),e.sources.frame={from:"slide",path:`${s}.frame`}),Object.assign(e,we(n)),n.dur!==void 0&&e.component&&(e.component={...e.component,dur:n.dur}),n.text&&e.text&&(e.text.style=Z(e.text.style,n.text),e.text.paragraphs=ln(e.text.paragraphs,n.text),e.fileText={...n.text},e.sources.text={from:"slide",path:`${s}.text`}),n.line!==void 0&&(e.line=C(n.line),e.sources.line={from:"slide",path:`${s}.line`}),n.line_width!==void 0&&(e.line_width=S(n.line_width)),n.line_dash!==void 0&&(e.line_dash=n.line_dash),n.line_cap!==void 0&&(e.line_cap=n.line_cap),n.line_join!==void 0&&(e.line_join=n.line_join),n.line_compound!==void 0&&(e.line_compound=n.line_compound),n.line_begin!==void 0&&(e.line_begin=n.line_begin),n.line_end!==void 0&&(e.line_end=n.line_end),n.line_begin_size!==void 0&&(e.line_begin_size=n.line_begin_size),n.line_end_size!==void 0&&(e.line_end_size=n.line_end_size),(n.fill!==void 0||n.gradient!==void 0||n.pattern!==void 0||n.picture_fill!==void 0)&&(delete e.gradient,delete e.pattern,delete e.picture_fill),n.fill!==void 0&&(e.fill=C(n.fill),e.sources.fill={from:"slide",path:`${s}.fill`}),Object.assign(e,te(n),be(n,y)),(n.picture!==void 0||n.movie!==void 0)&&(e.placeholder?.type==="pic"||e.placeholder?.type==="media"||e.placeholder?.type==="obj")){const h=Se(n.crop);e.kind=n.picture!==void 0?"picture":"movie",e.media={path:joinPath(y,n.picture??n.movie??""),...h?{crop:h}:{},...n.poster===void 0?{}:{poster:n.poster},...n.playback&&n.movie!==void 0?{playback:n.playback}:{}},e.sources.media={from:"slide",path:`${s}.${n.picture!==void 0?"picture":"movie"}`},delete e.text}else n.playback&&e.media&&(e.kind==="movie"||e.kind==="audio")&&(e.media={...e.media,playback:{...e.media.playback,...n.playback}})},ie=(e,n,s,h,g)=>{const $=N.get(n);if(!$){a.push({slide:e,path:`slides.${String(s)}.layout`,message:`Slide ${e} is on the layout "${n}", which the deck's module does not have (it has ${[...N.keys()].join(", ")||"none"}).`});return}const{layout:T,master:u}=$,x=[...(T.display_master_shapes===!1?[]:u.shapes).filter(p=>p.kind!=="placeholder").map(p=>L(p,"master",u)),...T.shapes.filter(p=>p.kind!=="placeholder").map(p=>L(p,"layout",u))],b=T.shapes.filter(p=>p.kind==="placeholder").map((p,j)=>({shape:P(p,u),order:j}));return{slide:{id:e,layout:T.name,master:u.name,hidden:h,background:T.background??u.background,...qe(u,T),shapes:x,animations:[],file:{index:s,...g===void 0?{}:{generate:g}}},placed:b,master:u}},oe=(e,n,s)=>{if(!n)return;const h=T=>{const u=n[T];if(u===void 0)return e.connect?.[T];const x=u==="none"?void 0:s(u.shape);return u==="none"||x===void 0?void 0:{shape:x,site:u.site}},g=h("begin"),$=h("end");g||$?e.connect={...g?{begin:g}:{},...$?{end:$}:{}}:delete e.connect},re=(e,n,s,h,g,$,T,u,x,b=()=>{})=>{const p=new Set(s.map(c=>c.shape.name));let j=s.length;for(const[c,d]of Object.entries(h??{})){const f=$(c);if(f===void 0)continue;const m=`${g}.shapes.${c}`,_=d.textbox!==void 0||d.geometry!==void 0||d.path!==void 0||d.table!==void 0||d.chart!==void 0||d.component!==void 0||d.audio!==void 0||(d.picture!==void 0||d.movie!==void 0)&&!p.has(f),k=s.find(M=>M.shape.name===f);if(k&&!_){G(k.shape,d,m),oe(k.shape,d.connect,$),k.shown=!0,d.z!==void 0&&(k.z=d.z);continue}if(k){a.push({slide:e.id,shape:f,path:m,message:`Slide ${e.id} has a ${k.shape.kind} ${f} already: a shape of its own needs another name.`});continue}if(!_){a.push({slide:e.id,shape:f,path:m,message:`Slide ${e.id} has no shape ${f} to change (its layout's placeholders and its own shapes are ${[...p].join(", ")||"none"}).`});continue}const z=U(f,d,m,e.id,n);z&&oe(z,d.connect,$),z&&(s.push({shape:z,order:j++,...d.z===void 0?{}:{z:d.z}}),p.add(f))}const w=s.filter(c=>c.shown===!0||!cn.has(c.shape.placeholder?.type??"")||T(c.shape)!==void 0);s.splice(0,s.length,...w),s.sort((c,d)=>(c.z??0)-(d.z??0)||c.order-d.order);const O=(c,d)=>{const f=_=>{const k=_.shape.group;return k===void 0?void 0:Ae(k)[d]},m=new Map(c.flatMap((_,k)=>{const z=f(_);return z===void 0?[]:[[z,k]]}));return c.flatMap((_,k)=>{const z=f(_);return z===void 0?[_]:m.get(z)===k?O(c.filter(M=>f(M)===z),d+1):[]})};s.splice(0,s.length,...O(s,0));for(const c of s){const d=b(c.shape);d!==void 0&&(c.shape.alt=d);const f=c.shape.text;if(c.shape.kind==="placeholder"&&f){const m=T(c.shape);f.paragraphs=paragraphsOfWords(m,0,E.fonts.code),f.empty=f.paragraphs.length===0||f.paragraphs.every(_=>_.runs.every(k=>k.text===""))}}e.shapes.push(...s.map(c=>c.shape));for(const c of e.shapes){const d=c.connect;if(!d)continue;const f=Ge(c,m=>e.shapes.find(_=>_.name===m&&_.level===c.level&&_!==c));c.frame=f.frame,f.flip?c.flip=f.flip:delete c.flip;for(const m of f.lost){const _=d[m];_&&c.level==="slide"&&a.push({slide:e.id,shape:c.name,message:`Connector ${c.name}'s ${m} is glued to site ${String(_.site)} of ${_.shape}, which slide ${e.id} has not: it stays where it is.`})}}u!==void 0&&u.trim()!==""&&(e.notes=u);for(const[c,d]of(x??[]).entries()){const f=$(d.shape);if(f===void 0)continue;const m={slide:e.id,shape:f,path:`${g}.animations.${String(c)}`},_=e.shapes.find(A=>A.name===f&&A.level==="slide");if(!_){a.push({...m,message:`Slide ${e.id} has no shape ${f} to animate (it has ${e.shapes.filter(A=>A.level==="slide").map(A=>A.name).join(", ")}).`});continue}if(d.paragraph!==void 0&&d.paragraph>=(_.text?.paragraphs.length??0)){a.push({...m,message:`Shape ${f} has no paragraph ${String(d.paragraph)} to animate (it has ${String(_.text?.paragraphs.length??0)}).`});continue}const k=We[d.effect];d.direction!==void 0&&!k.directions.includes(d.direction)&&a.push({...m,path:`${m.path}.direction`,message:k.directions.length===0?`${f}'s ${d.effect} has no direction (${d.direction}).`:`${f}'s ${d.effect} goes ${k.directions.join(", ")}, not ${d.direction}.`}),d.amount!==void 0&&k.amount===void 0?a.push({...m,path:`${m.path}.amount`,message:`${f}'s ${d.effect} has no amount: only a Grow/Shrink, a spin and a Transparency do.`}):d.effect==="transparency"&&(d.amount??0)>1&&a.push({...m,path:`${m.path}.amount`,message:`${f}'s transparency is a share, at most 1 (it is ${String(d.amount)}).`}),d.animate_text!==void 0&&!_.text&&a.push({...m,path:`${m.path}.animate_text`,message:`${f} has no text to animate by ${d.animate_text}: it plays as one.`});const z=d.animate_text,M=De({...d,shape:f,..._.text?{}:{animate_text:void 0}},z===void 0?1:(d.paragraph===void 0?_.text?.paragraphs??[]:[_.text?.paragraphs[d.paragraph]]).reduce((A,ve)=>A+Ie(ve?.runs.map(Oe=>Oe.text)??[],z).length,0));M?e.animations.push(M):a.push({...m,message:`The animation of ${f} needs a path that starts with M and says only M, L and C, absolute.`})}},ae=new Set;l.slides.forEach((e,n)=>{const s=`slides.${String(n)}`;if(e.layout!==void 0){const u=ie(e.id,e.layout,n,e.hidden===!0);if(!u)return;const x=r(`${o}.${e.id}.notes`);e.transition&&(u.slide.transition=F(e.id,e.transition,s)),e.advance_after!==void 0&&(u.slide.advance=e.advance_after),e.section!==void 0&&(u.slide.section=e.section),xe(u.slide,e.background,y),re(u.slide,u.master,u.placed,e.shapes,s,b=>b,b=>r(`${o}.${e.id}.${b.name}`),typeof x=="string"?x:void 0,e.animations,b=>{const p=r(`${o}.${e.id}.alt.${b.name}`);return typeof p=="string"?p:void 0}),v.push(u.slide),ae.add(e.id);return}const h=e.generate??"",g=t.generators[h];if(g===void 0){a.push({slide:e.id,path:`${s}.generate`,message:`There is no generator ${h} in the deck's module (it has ${Object.keys(t.generators).join(", ")||"none"}).`});return}if(!Array.isArray(g)){a.push({slide:e.id,path:`${s}.generate`,message:`Generator ${h} threw: ${g.error}`,...g.stack===void 0?{}:{stack:g.stack}});return}const $=g,T=new Set(Array.isArray(e.hidden)?e.hidden:[]);for(const u of $){const x=`${e.id}/${u.id}`,b=ie(x,u.layout,n,T.has(u.id),h);if(!b)continue;for(const w of u.shapes){const O=w.placeholder?b.placed.find(c=>c.shape.placeholder?.idx===w.placeholder?.idx):void 0;if(O)w.frame&&(O.shape.frame={...w.frame}),O.shape.sources.frame={from:"code"},O.shown=!0;else{const c=L(w,"layout",b.master);b.placed.push({shape:{...c,level:"slide",sources:{frame:{from:"code"}}},order:b.placed.length})}}const p=`${u.id}/`,j=u.transition??(u===$[0]?e.transition:void 0);xe(b.slide,e.background,y),j&&(b.slide.transition=F(b.slide.id,j,s)),u===$[0]&&e.section!==void 0&&(b.slide.section=e.section),re(b.slide,b.master,b.placed,e.shapes,s,w=>w.startsWith(p)?w.slice(p.length):void 0,w=>{const O=w.placeholder===void 0?void 0:u.text[w.placeholder.idx];return O===void 0?void 0:O.map(c=>c.runs.map(d=>d.text).join(""))},u.notes,[...(u.animations??[]).map(w=>({...w,shape:`${p}${w.shape}`})),...e.animations??[]]);for(const w of b.slide.shapes){const O=w.placeholder===void 0?void 0:u.text[w.placeholder.idx];O&&w.text&&(w.text.paragraphs=O,w.text.empty=!1)}v.push(b.slide),ae.add(x)}for(const u of Object.keys(e.shapes??{})){const[x]=u.split("/");x!==void 0&&!$.some(b=>b.id===x)&&a.push({slide:e.id,path:`${s}.shapes.${u}`,message:`Generator ${h} makes no slide ${x}: ${u} changes nothing.`})}});const le=new Set(v.map(e=>e.id));for(const e of v)for(const n of e.shapes){if(n.level!=="slide")continue;const s=[...n.link===void 0?[]:[n.link],...(n.text?.paragraphs??[]).flatMap(h=>h.runs.flatMap(g=>g.font?.link===void 0?[]:[g.font.link]))];for(const h of new Set(s)){const g=Ee(h);(g!==void 0?!le.has(g):h.startsWith("ppaction://")&&je(h)===void 0)&&a.push({slide:e.id,shape:n.name,message:g!==void 0?`Shape ${n.name} links to slide ${g}, which the deck has not (it has ${[...le].join(", ")}).`:`Shape ${n.name} links to ${h}: a show jump is ppaction://hlinkshowjump?jump= and ${Te.join(", ")}.`})}}return v.forEach((e,n)=>{for(const s of e.shapes)s.placeholder?.type==="sldNum"&&s.text&&(s.text.paragraphs=[{level:0,runs:[{text:String(n+1),field:"slidenum"}]}],s.text.empty=!1)}),{deck:{width:t.slide_width,height:t.slide_height,theme:E,slides:v},problems:a}}
@@ -33,6 +33,17 @@ export type DeckScriptEdit =
33
33
  * snapshot's recorder resolve a deck's slides with.
34
34
  */
35
35
  export declare function scriptWords(script: ScriptFile, prefix: string): (key: string) => Words;
36
+ /** A chart's axes that have a title: its words name them. */
37
+ export declare const CHART_AXIS_WORDS: readonly ["category_axis", "value_axis", "secondary_axis"];
38
+ export type ChartAxisWords = (typeof CHART_AXIS_WORDS)[number];
39
+ /** A chart's words: its title and its axes' titles (undefined or empty: none). */
40
+ export type ChartWords = {
41
+ title?: string | undefined;
42
+ } & Partial<Record<ChartAxisWords, string | undefined>>;
43
+ /** A chart's words in the script: its title, or `{ title, category_axis, value_axis, secondary_axis }`. */
44
+ export declare function chartWordsOf(words: ScriptText | undefined): ChartWords;
45
+ /** A chart's words as the script writes them: its title alone as a line, else by name; none undefined. */
46
+ export declare function chartScriptText(w: ChartWords): ScriptText | undefined;
36
47
  /** A script's text read; undefined when it is not a script. */
37
48
  export declare function readScript(text: string): ScriptFile | undefined;
38
49
  /** The script's text after an edit. */
@@ -1,3 +1,3 @@
1
1
  /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{readDataFile as S}from"@allyhub/formats";import{isCollection as m,isMap as c,isSeq as w,parseDocument as g}from"yaml";export function scriptWords(s,e){const n=new Map(s.slides.map(r=>[r.id,r]));return r=>{if(!r.startsWith(`${e}.`))return;const f=r.slice(e.length+1),t=f.lastIndexOf(".");if(t<0)return;const o=n.get(f.slice(0,t)),l=f.slice(t+1);return l==="notes"?typeof o?.notes=="string"?o.notes:void 0:o?.text?.[l]}}export function readScript(s){const e=g(s);if(e.errors.length>0)return;const n=S("script",e.toJS()??{});return n.ok?n.value:void 0}function k(s){let e=s.get("slides",!0);if(w(e)||(c(s.contents)?s.set("slides",s.createNode([])):s.contents=s.createNode({slides:[]}),e=s.get("slides",!0)),!w(e))throw new Error("The script has no slides list.");return e.flow===!0&&(e.flow=!1),e}function x(s,e){!m(s)||!m(e)||(e.flow===!0&&(s.flow=!0),s.items.forEach((n,r)=>{x(n,e.items[r])}))}export function editDeckScript(s,e){const n=g(s===void 0||s.trim()===""?`slides: []
3
- `:s);if(n.errors.length>0)throw new Error("The script is not YAML: it is mended by hand first.");return editDeckScriptDocument(n,e),n.toString()}export function editDeckScriptDocument(s,e){const n=k(s),r=n.items.findIndex(o=>c(o)&&o.get("id")===e.slide);if(e.op==="remove"){r>=0&&n.items.splice(r,1);return}const f=e.op==="text"?e.words===void 0:e.op==="alt"?e.alt===void 0:e.notes===void 0;if(r<0&&f)return;let t=n.items[r];if(c(t)||(n.items.push(s.createNode({id:e.slide})),t=n.items.at(-1)),!!c(t)){if(e.op==="notes")e.notes===void 0?t.delete("notes"):t.set("notes",s.createNode(e.notes));else if(e.op==="alt")if(e.alt===void 0){t.deleteIn(["alt",e.shape]);const o=t.get("alt",!0);c(o)&&o.items.length===0&&t.delete("alt")}else t.setIn(["alt",e.shape],e.alt);else if(e.words===void 0){t.deleteIn(["text",e.shape]);const o=t.get("text",!0);c(o)&&o.items.length===0&&t.delete("text")}else{const o=s.createNode(e.words);x(o,t.getIn(["text",e.shape],!0)),t.setIn(["text",e.shape],o)}t.items.length===1&&n.items.splice(n.items.indexOf(t),1)}}const a=s=>JSON.stringify(s);export function deckScriptEdits(s,e){const n=[],r=new Map(s.slides.map(t=>[t.id,t])),f=new Map(e.slides.map(t=>[t.id,t]));for(const t of r.keys())f.has(t)||n.push({op:"remove",slide:t});for(const[t,o]of f){const l=r.get(t),p=l?.text??{},u=o.text??{};for(const i of new Set([...Object.keys(p),...Object.keys(u)]))a(p[i])!==a(u[i])&&n.push({op:"text",slide:t,shape:i,words:u[i]});const h=l?.alt??{},d=o.alt??{};for(const i of new Set([...Object.keys(h),...Object.keys(d)]))h[i]!==d[i]&&n.push({op:"alt",slide:t,shape:i,alt:d[i]});a(l?.notes)!==a(o.notes)&&n.push({op:"notes",slide:t,notes:o.notes})}return n}
2
+ import{readDataFile as w}from"@allyhub/formats";import{isCollection as m,isMap as a,isSeq as g,parseDocument as y}from"yaml";export function scriptWords(t,e){const s=new Map(t.slides.map(i=>[i.id,i])),o=i=>typeof i=="string"?i:Array.isArray(i)?i.map(o).filter(n=>n!==void 0):void 0;return i=>{if(!i.startsWith(`${e}.`))return;const[n="",...r]=i.slice(e.length+1).split("."),c=s.get(n);if(r.length===1&&r[0]==="notes")return typeof c?.notes=="string"?c.notes:void 0;if(r.length===2&&r[0]==="alt")return c?.alt?.[r[1]??""];let f=c?.text;for(const u of r)f=typeof f=="object"&&f!==null&&!Array.isArray(f)?f[u]:void 0;return o(f)}}export const CHART_AXIS_WORDS=["category_axis","value_axis","secondary_axis"];export function chartWordsOf(t){if(typeof t=="string")return{title:t};if(typeof t!="object"||Array.isArray(t))return{};const e={};for(const s of["title",...CHART_AXIS_WORDS]){const o=t[s];typeof o=="string"&&(e[s]=o)}return e}export function chartScriptText(t){const e=Object.fromEntries(Object.entries(t).filter(([,o])=>o!==void 0&&o!=="")),s=Object.keys(e);if(s.length!==0)return s.length===1&&e.title!==void 0?e.title:e}export function readScript(t){const e=y(t);if(e.errors.length>0)return;const s=w("script",e.toJS()??{});return s.ok?s.value:void 0}function S(t){let e=t.get("slides",!0);if(g(e)||(a(t.contents)?t.set("slides",t.createNode([])):t.contents=t.createNode({slides:[]}),e=t.get("slides",!0)),!g(e))throw new Error("The script has no slides list.");return e.flow===!0&&(e.flow=!1),e}function x(t,e){!m(t)||!m(e)||(e.flow===!0&&(t.flow=!0),t.items.forEach((s,o)=>{x(s,e.items[o])}))}export function editDeckScript(t,e){const s=y(t===void 0||t.trim()===""?`slides: []
3
+ `:t);if(s.errors.length>0)throw new Error("The script is not YAML: it is mended by hand first.");return editDeckScriptDocument(s,e),s.toString()}export function editDeckScriptDocument(t,e){const s=S(t),o=s.items.findIndex(r=>a(r)&&r.get("id")===e.slide);if(e.op==="remove"){o>=0&&s.items.splice(o,1);return}const i=e.op==="text"?e.words===void 0:e.op==="alt"?e.alt===void 0:e.notes===void 0;if(o<0&&i)return;let n=s.items[o];if(a(n)||(s.items.push(t.createNode({id:e.slide})),n=s.items.at(-1)),!!a(n)){if(e.op==="notes")e.notes===void 0?n.delete("notes"):n.set("notes",t.createNode(e.notes));else if(e.op==="alt")if(e.alt===void 0){n.deleteIn(["alt",e.shape]);const r=n.get("alt",!0);a(r)&&r.items.length===0&&n.delete("alt")}else n.setIn(["alt",e.shape],e.alt);else if(e.words===void 0){n.deleteIn(["text",e.shape]);const r=n.get("text",!0);a(r)&&r.items.length===0&&n.delete("text")}else{const r=t.createNode(e.words);x(r,n.getIn(["text",e.shape],!0)),n.setIn(["text",e.shape],r)}n.items.length===1&&s.items.splice(s.items.indexOf(n),1)}}const p=t=>JSON.stringify(t);export function deckScriptEdits(t,e){const s=[],o=new Map(t.slides.map(n=>[n.id,n])),i=new Map(e.slides.map(n=>[n.id,n]));for(const n of o.keys())i.has(n)||s.push({op:"remove",slide:n});for(const[n,r]of i){const c=o.get(n),f=c?.text??{},u=r.text??{};for(const l of new Set([...Object.keys(f),...Object.keys(u)]))p(f[l])!==p(u[l])&&s.push({op:"text",slide:n,shape:l,words:u[l]});const h=c?.alt??{},d=r.alt??{};for(const l of new Set([...Object.keys(h),...Object.keys(d)]))h[l]!==d[l]&&s.push({op:"alt",slide:n,shape:l,alt:d[l]});p(c?.notes)!==p(r.notes)&&s.push({op:"notes",slide:n,notes:r.notes})}return s}
@@ -1,7 +1,7 @@
1
1
  import { presentationFor } from "./index.js";
2
2
  /** python-pptx's length functions: each gives a Length, a number of EMU that says itself in other units (`Pt(12).pt`, `.inches`, `.cm`, `.mm`, `.emu`). */
3
3
  export declare const Emu: (n: number) => import("./units.js").LengthValue, Inches: (n: number) => import("./units.js").LengthValue, Pt: (n: number) => import("./units.js").LengthValue, Cm: (n: number) => import("./units.js").LengthValue, Mm: (n: number) => import("./units.js").LengthValue, Centipoints: (n: number) => import("./units.js").LengthValue;
4
- export { RGBColor, MSO_ANCHOR, CategoryChartData, MSO_ARROWHEAD, MSO_ARROWHEAD_SIZE, XL_CHART_TYPE, XL_LABEL_POSITION, XL_LEGEND_POSITION, MSO_AUTO_SIZE, MSO_CONNECTOR, MSO_FILL, MSO_LINE, MSO_LINE_DASH_STYLE, MSO_SHAPE, MSO_SHAPE_TYPE, MSO_THEME_COLOR, PP_ALIGN, PP_PARAGRAPH_ALIGNMENT, PP_PLACEHOLDER, THEME_FONT, SLIDE_SIZES, presentationFor, isDeck, type Anchor, type AutoSize, type Background, type Cell, type ColorFormat, type ComponentContext, type ComponentInput, type Deck, type FillFormat, type FreeformBuilder, type GradientStop, type GroupShape, type Font, type GeneratedSlide, type Generator, type Length, type LengthValue, type LineFormat, type ListLevel, type ListStyle, type Paragraph, type Placeholders, type PlaceholderType, type Presentation, type PresentationOptions, type PropSpec, type Run, type Shape, type ShapeCollection, type ShapeType, type SlideLayout, type SlideLayouts, type SlideMaster, type SlideMasters, type SlideSizeName, type Table, type TextFrame, type TextStyles, type ThemeInput, } from "./index.js";
4
+ export { RGBColor, MSO_ANCHOR, CategoryChartData, MSO_ARROWHEAD, MSO_ARROWHEAD_SIZE, XL_CHART_TYPE, XL_LABEL_POSITION, XL_LEGEND_POSITION, MSO_AUTO_SIZE, MSO_CONNECTOR, MSO_FILL, MSO_LINE, MSO_LINE_DASH_STYLE, MSO_LINE_CAP, MSO_LINE_COMPOUND, MSO_LINE_JOIN, MSO_PATTERN, MSO_PATTERN_TYPE, TILE_ALIGNMENT, MSO_SHAPE, MSO_SHAPE_TYPE, MSO_TEXT_CAPS, MSO_TEXT_ORIENTATION, MSO_TEXT_STRIKE, MSO_TEXT_UNDERLINE_TYPE, MSO_THEME_COLOR, MSO_UNDERLINE, PP_ALIGN, PP_PARAGRAPH_ALIGNMENT, PP_PLACEHOLDER, THEME_FONT, SLIDE_SIZES, presentationFor, isDeck, type Anchor, type AutoSize, type Background, type Cell, type ColorFormat, type ComponentContext, type ComponentInput, type Deck, type FillFormat, type FreeformBuilder, type GradientStop, type GroupShape, type Font, type GeneratedSlide, type Generator, type Length, type LengthValue, type LineFormat, type ListLevel, type ListStyle, type Paragraph, type Placeholders, type PlaceholderOptions, type PlaceholderType, type Presentation, type PresentationOptions, type PropSpec, type Run, type Shape, type ShapeCollection, type ShapeType, type SlideLayout, type SlideLayouts, type SlideMaster, type SlideMasters, type SlideSizeName, type Table, type TextFrame, type TextStyles, type ThemeInput, } from "./index.js";
5
5
  /**
6
6
  * A deck: the default export of a deck's module. Its function makes
7
7
  * the presentation's slide masters, layouts, components and generators;
@@ -1,2 +1,2 @@
1
1
  /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{LENGTH_UNITS as O,presentationFor as _}from"./index.js";export const{Emu,Inches,Pt,Cm,Mm,Centipoints}=O;export{RGBColor,MSO_ANCHOR,CategoryChartData,MSO_ARROWHEAD,MSO_ARROWHEAD_SIZE,XL_CHART_TYPE,XL_LABEL_POSITION,XL_LEGEND_POSITION,MSO_AUTO_SIZE,MSO_CONNECTOR,MSO_FILL,MSO_LINE,MSO_LINE_DASH_STYLE,MSO_SHAPE,MSO_SHAPE_TYPE,MSO_THEME_COLOR,PP_ALIGN,PP_PARAGRAPH_ALIGNMENT,PP_PLACEHOLDER,THEME_FONT,SLIDE_SIZES,presentationFor,isDeck}from"./index.js";export const presentation=_(""),slidesFor=E=>({presentation:_(E.file)});
2
+ import{LENGTH_UNITS as O,presentationFor as _}from"./index.js";export const{Emu,Inches,Pt,Cm,Mm,Centipoints}=O;export{RGBColor,MSO_ANCHOR,CategoryChartData,MSO_ARROWHEAD,MSO_ARROWHEAD_SIZE,XL_CHART_TYPE,XL_LABEL_POSITION,XL_LEGEND_POSITION,MSO_AUTO_SIZE,MSO_CONNECTOR,MSO_FILL,MSO_LINE,MSO_LINE_DASH_STYLE,MSO_LINE_CAP,MSO_LINE_COMPOUND,MSO_LINE_JOIN,MSO_PATTERN,MSO_PATTERN_TYPE,TILE_ALIGNMENT,MSO_SHAPE,MSO_SHAPE_TYPE,MSO_TEXT_CAPS,MSO_TEXT_ORIENTATION,MSO_TEXT_STRIKE,MSO_TEXT_UNDERLINE_TYPE,MSO_THEME_COLOR,MSO_UNDERLINE,PP_ALIGN,PP_PARAGRAPH_ALIGNMENT,PP_PLACEHOLDER,THEME_FONT,SLIDE_SIZES,presentationFor,isDeck}from"./index.js";export const presentation=_(""),slidesFor=E=>({presentation:_(E.file)});
@@ -0,0 +1,48 @@
1
+ import type { Color } from "@allyhub/chart";
2
+ import { TABLE_STYLES } from "./generated/table-styles.js";
3
+ import type { CellBorder, TableDef } from "./model.js";
4
+ /** A part of a table a style paints. */
5
+ export type TableStylePart = "wholeTbl" | "band1H" | "band2H" | "band1V" | "band2V" | "lastCol" | "firstCol" | "lastRow" | "firstRow";
6
+ /** An edge a style part rules: its outer sides, and between its cells. */
7
+ export type TableStyleEdge = "left" | "right" | "top" | "bottom" | "insideH" | "insideV";
8
+ /** What a style part paints: its text's weight and colour, its fill (null: none), its edges (null: none). */
9
+ export interface TableStylePartDef {
10
+ bold?: boolean;
11
+ text?: Color;
12
+ fill?: Color | null;
13
+ borders?: Partial<Record<TableStyleEdge, CellBorder | null>>;
14
+ }
15
+ /** A built-in table style: its id (`{5C22544A-…}`), its English name as PowerPoint's gallery shows it, its family and accent, its parts. */
16
+ export interface TableStyleDef {
17
+ id: string;
18
+ name: string;
19
+ family: string;
20
+ accent?: number;
21
+ /** What is behind its cells (`a:tblBg`), which a fill that lets some through shows. */
22
+ background?: Color;
23
+ parts: Partial<Record<TableStylePart, TableStylePartDef>>;
24
+ }
25
+ /** PowerPoint's 74 built-in table styles, in its gallery's order. */
26
+ export { TABLE_STYLES };
27
+ /** The style PowerPoint and python-pptx give a new table: Medium Style 2 – Accent 1. */
28
+ export declare const DEFAULT_TABLE_STYLE = "{5C22544A-7EE6-4342-B048-85BDC9FD1C3A}";
29
+ /** A built-in style by its id or its English name ("Medium Style 2 - Accent 1"); undefined for any other. */
30
+ export declare function tableStyleOf(idOrName: string | undefined): TableStyleDef | undefined;
31
+ /** Table Design's options as a table holds them (`a:tblPr`'s flags). */
32
+ export type TableFlags = Pick<TableDef, "first_row" | "last_row" | "first_col" | "last_col" | "horz_banding" | "vert_banding">;
33
+ /** The look a style gives a cell: its fill, each edge, its text's weight and colour (absent: the style says nothing). */
34
+ export interface CellLook {
35
+ fill?: Color | null;
36
+ borders: Partial<Record<"left" | "right" | "top" | "bottom", CellBorder | null>>;
37
+ bold?: boolean;
38
+ text?: Color;
39
+ }
40
+ /**
41
+ * The look a style gives the cell at row `r`, column `c` of a table of
42
+ * `rows` × `cols` (a merged cell's last row and column `r2`, `c2`): the
43
+ * whole table's, then a band's, then the last and first column's and the
44
+ * last and first row's where those options are on, each over the one
45
+ * before; an edge between two cells is the part's inside rule.
46
+ */
47
+ export declare function cellLook(style: TableStyleDef, flags: TableFlags, r: number, c: number, rows: number, cols: number, r2?: number, c2?: number): CellLook;
48
+ //# sourceMappingURL=table-style.d.ts.map
@@ -0,0 +1,2 @@
1
+ /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
+ import{TABLE_STYLES as b}from"./generated/table-styles.js";export{b as TABLE_STYLES};export const DEFAULT_TABLE_STYLE="{5C22544A-7EE6-4342-B048-85BDC9FD1C3A}";const V=new Map(b.map(t=>[t.id.toUpperCase(),t])),R=new Map(b.map(t=>[B(t.name),t]));function B(t){return t.toLowerCase().replace(/[–—]/gu,"-").replace(/\s+/gu," ").trim()}export function tableStyleOf(t){if(t!==void 0)return V.get(t.trim().toUpperCase())??R.get(B(t))}export function cellLook(t,e,r,s,a,c,l=r,p=s){const f={borders:{}},_=e.first_row===!0?1:0,w=e.first_col===!0?1:0,C=e.last_row===!0&&l===a-1,h=e.last_col===!0&&p===c-1,i=["wholeTbl"];e.horz_banding===!0&&r>=_&&!C&&i.push((r-_)%2===0?"band1H":"band2H"),e.vert_banding===!0&&s>=w&&!h&&i.push((s-w)%2===0?"band1V":"band2V"),h&&i.push("lastCol"),e.first_col===!0&&s===0&&i.push("firstCol"),C&&i.push("lastRow"),e.first_row===!0&&r===0&&i.push("firstRow");for(const o of i){const n=t.parts[o];if(!n)continue;n.fill!==void 0&&(f.fill=n.fill),n.bold!==void 0&&(f.bold=n.bold),n.text!==void 0&&(f.text=n.text);const m=n.borders??{},x=o==="firstRow"||o==="lastRow"||o==="band1H"||o==="band2H",E=o==="firstCol"||o==="lastCol"||o==="band1V"||o==="band2V",d={top:x?r:0,bottom:x?l:a-1,left:E?s:0,right:E?p:c-1},u=(L,H,T)=>{const A=H?m[L]:m[T];A!==void 0&&(f.borders[L]=A)};u("left",s===d.left,"insideV"),u("right",p===d.right,"insideV"),u("top",r===d.top,"insideH"),u("bottom",l===d.bottom,"insideH")}return f}
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allyhub/slides-core",
3
- "version": "0.12.0",
3
+ "version": "0.14.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -1,2 +1,2 @@
1
1
  /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{addEnvelopes as v,duckEnvelope as I,hashSeed as w,MIX_DEFAULTS as D,resolveVoice as E,SFX_HIT as F,speechEnvelope as S,speechSpans as O}from"@allyhub/audio";import{MUSIC_DEFAULTS as M,musicSegments as k,placeStretches as A,wholeLoop as G}from"./music.js";import{wordsIn as U}from"./speech.js";export function voicePlan(t,s){const a=o=>E(o),c=s.filter(o=>o.mic!==void 0);return{mic:{video:a(t),...c.length>0?{parts:Object.fromEntries(c.map(o=>[o.key,a(o.mic)]))}:{}}}}export function wordsOnFilm(t,s){return t.flatMap(a=>U(s(a.file)??[],a.from,a.dur,a.at,a.speed??1)).map(a=>({start:a.start,end:a.end})).sort((a,c)=>a.start-c.start)}const g=(t,s)=>s===void 0||!Number.isFinite(s)?0:t-s,L=t=>[...t].sort((s,a)=>s.t-a.t);export function musicPlayed(t,s,a){return t.play?k(t.play,t.seam??M.seam,s,"before",!t.loop):t.loop?k(G(t.from,s,a,t.seam),s>1?t.seam??M.loopSeam:0,s,"after",!1):k(A([{from:t.from,to:s}],void 0,s,a),0,s)}export function mixPlan(t,s,a){const c=t.duration,o=t.audio.mix??D,i={duration:c,speech:[],footage:[],sfx:[]};for(const e of[...t.audio.speech??[],...t.audio.room??[]]){const f=s[e.file];!f||e.dur<=0||i.speech.push({file:e.file,...e.part===void 0?{}:{part:e.part},at:e.at,from:e.from,dur:e.dur,gainDb:g(o.speech,f.loudness)+(e.gainDb??0),...e.speed!==void 0&&e.speed!==1?{speed:e.speed}:{},...e.denoise?{denoise:e.denoise}:{},...e.fadeIn?{fadeIn:e.fadeIn}:{},...e.fadeOut?{fadeOut:e.fadeOut}:{}})}const m=O(i.speech,o.duck),h=S(m,o.footageUnderSpeech-o.footage,o.duck);for(const e of t.footage??[]){const f=s[e.file];if(!e.audio||e.take===!0||!f)continue;const d=e.speed>0?e.speed:1,u=Math.max(0,e.from),b=e.start+(u-e.from)/d,y=f.duration===void 0?1/0:f.duration-u,x=Math.min(e.end-b,y/d);x<=0||i.footage.push({file:e.file,at:b,from:u,dur:x,...d===1?{}:{speed:d},gainDb:g(o.footage,f.loudness)+e.gainDb,...h.length>0?{envelope:h}:{}})}const n=t.audio.music,r=n?.file===void 0?void 0:s[n.file];if(n?.file!==void 0&&r){const e=(n.gain??[]).map(u=>({t:u.t,db:u.db})),f=r.duration??n.from+c,d={file:n.file,segments:musicPlayed(n,f,c),gainDb:g(o.musicAlone,r.loudness),alone:o.musicAlone,fadeIn:o.musicFade.in,fadeOut:Math.min(o.musicFade.out,c/4),...n.until===void 0?{}:{until:n.until},duck:v(v(S(m,o.music-o.musicAlone,o.duck),I(wordsOnFilm(i.speech,u=>s[u]?.words),o.duck)),L(e)),...n.shape?{shape:n.shape}:{}};i.music=d}const l=speechGains(t);l.length>0&&(i.speechGain=l);const p=t.audio.mic;return p&&(i.voice={video:p.video,...p.parts?{parts:p.parts}:{},spans:t.parts.map(e=>({part:e.key,start:e.start,end:e.end})),seed:a.seed}),t.cues.forEach((e,f)=>{const d=e.gainDb??0;if(e.file!==void 0){const b=s[e.file];if(!b)return;i.sfx.push({sound:e.sound,file:e.file,at:e.t,gainDb:g(o.sfx,b.loudness)+d,seed:0,...e.shape?{shape:e.shape,level:{target:o.sfx,gainDb:d}}:{}});return}const u=F[e.sound];u!==void 0&&i.sfx.push({sound:e.sound,at:Math.max(0,e.t-u),gainDb:o.sfx-D.sfx+d,seed:w(`${a.seed}:${e.sound}:${String(f)}`),...e.shape?{shape:e.shape}:{}})}),i}export function speechGains(t){const s=new Map;for(const n of t.parts)n.speechGainDb!==void 0&&n.speechGainDb!==0&&s.set(n.key,n.speechGainDb);if(s.size===0)return[];const a=[];for(const n of t.parts)a.push({start:n.start,end:n.end,db:s.get(n.key)??0,rank:0});const c=[...(t.audio.speech??[]).map(n=>({c:n,rank:2})),...(t.audio.room??[]).map(n=>({c:n,rank:1}))];for(const{c:n,rank:r}of c)n.part===void 0||n.dur<=0||a.push({start:n.at,end:n.at+n.dur,db:s.get(n.part)??0,rank:r});const o=[...new Set(a.flatMap(n=>[n.start,n.end]))].sort((n,r)=>n-r),i=[];for(let n=0;n+1<o.length;n++){const r=o[n]??0,l=o[n+1]??r,p=(r+l)/2;let e;for(const d of a)p<d.start||p>=d.end||(!e||d.rank>e.rank||d.rank===e.rank&&d.start>=e.start)&&(e=d);const f=e?.db??0;i.at(-1)?.db!==f&&i.push({t:r,db:f})}if(i.every(n=>n.db===0))return[];const m=.005,h=[];for(const[n,r]of i.entries()){if(n===0){h.push({t:r.t,db:r.db});continue}const l=i[n-1]?.db??0;h.push({t:Math.max(0,r.t-m),db:l},{t:r.t+m,db:r.db})}return h}
2
+ import{addEnvelopes as v,duckEnvelope as I,hashSeed as w,MIX_DEFAULTS as D,resolveVoice as E,SFX_HIT as F,speechEnvelope as S,speechSpans as O}from"@allyhub/audio";import{MUSIC_DEFAULTS as M,musicSegments as k,placeStretches as A,wholeLoop as G}from"./music.js";import{wordsIn as U}from"./speech.js";export function voicePlan(t,o){const a=s=>E(s),p=o.filter(s=>s.mic!==void 0);return{mic:{video:a(t),...p.length>0?{parts:Object.fromEntries(p.map(s=>[s.key,a(s.mic)]))}:{}}}}export function wordsOnFilm(t,o){return t.flatMap(a=>U(o(a.file)??[],a.from,a.dur,a.at,a.speed??1)).map(a=>({start:a.start,end:a.end})).sort((a,p)=>a.start-p.start)}const g=(t,o)=>o===void 0||!Number.isFinite(o)?0:t-o,L=t=>[...t].sort((o,a)=>o.t-a.t);export function musicPlayed(t,o,a){return t.play?k(t.play,t.seam??M.seam,o,"before",!t.loop):t.loop?k(G(t.from,o,a,t.seam),o>1?t.seam??M.loopSeam:0,o,"after",!1):k(A([{from:t.from,to:o}],void 0,o,a),0,o)}export function mixPlan(t,o,a){const p=t.duration,s=t.audio.mix??D,f={duration:p,speech:[],footage:[],sfx:[]};for(const e of[...t.audio.speech??[],...t.audio.room??[]]){const i=o[e.file];!i||e.dur<=0||f.speech.push({file:e.file,...e.part===void 0?{}:{part:e.part},at:e.at,from:e.from,dur:e.dur,gainDb:g(s.speech,i.loudness)+(e.gainDb??0),...e.speed!==void 0&&e.speed!==1?{speed:e.speed}:{},...e.denoise?{denoise:e.denoise}:{},...e.fadeIn?{fadeIn:e.fadeIn}:{},...e.fadeOut?{fadeOut:e.fadeOut}:{}})}const m=O(f.speech,s.duck),h=S(m,s.footageUnderSpeech-s.footage,s.duck);for(const e of t.footage??[]){const i=o[e.file];if(!e.audio||e.take===!0||!i)continue;const d=e.speed>0?e.speed:1,u=Math.max(0,e.from),b=e.start+(u-e.from)/d,y=i.duration===void 0?1/0:i.duration-u,x=Math.min(e.end-b,y/d);x<=0||f.footage.push({file:e.file,at:b,from:u,dur:x,...d===1?{}:{speed:d},gainDb:g(s.footage,i.loudness)+e.gainDb,...h.length>0?{envelope:h}:{}})}const n=t.audio.music,r=n?.file===void 0?void 0:o[n.file];if(n?.file!==void 0&&r){const e=(n.gain??[]).map(u=>({t:u.t,db:u.db})),i=r.duration??n.from+p,d={file:n.file,segments:musicPlayed(n,i,p),gainDb:g(s.musicAlone,r.loudness),alone:s.musicAlone,fadeIn:s.musicFade.in,fadeOut:Math.min(s.musicFade.out,p/4),...n.until===void 0?{}:{until:n.until},duck:v(v(S(m,s.music-s.musicAlone,s.duck),I(wordsOnFilm(f.speech,u=>o[u]?.words),s.duck)),L(e)),...n.shape?{shape:n.shape}:{}};f.music=d}const l=speechGains(t);l.length>0&&(f.speechGain=l);const c=t.audio.mic;return c&&(f.voice={video:c.video,...c.parts?{parts:c.parts}:{},spans:t.parts.map(e=>({part:e.key,start:e.start,end:e.end})),seed:a.seed}),t.cues.forEach((e,i)=>{const d=e.gainDb??0;if(e.file!==void 0){const b=o[e.file];if(!b)return;f.sfx.push({sound:e.sound,file:e.file,at:e.t,gainDb:g(s.sfx,b.loudness)+d,seed:0,...e.from===void 0?{}:{from:e.from},...e.length===void 0?{}:{length:e.length},...e.shape?{shape:e.shape,level:{target:s.sfx,gainDb:d}}:{}});return}const u=F[e.sound];u!==void 0&&f.sfx.push({sound:e.sound,at:Math.max(0,e.t-u),gainDb:s.sfx-D.sfx+d,seed:w(`${a.seed}:${e.sound}:${String(i)}`),...e.shape?{shape:e.shape}:{}})}),f}export function speechGains(t){const o=new Map;for(const n of t.parts)n.speechGainDb!==void 0&&n.speechGainDb!==0&&o.set(n.key,n.speechGainDb);if(o.size===0)return[];const a=[];for(const n of t.parts)a.push({start:n.start,end:n.end,db:o.get(n.key)??0,rank:0});const p=[...(t.audio.speech??[]).map(n=>({c:n,rank:2})),...(t.audio.room??[]).map(n=>({c:n,rank:1}))];for(const{c:n,rank:r}of p)n.part===void 0||n.dur<=0||a.push({start:n.at,end:n.at+n.dur,db:o.get(n.part)??0,rank:r});const s=[...new Set(a.flatMap(n=>[n.start,n.end]))].sort((n,r)=>n-r),f=[];for(let n=0;n+1<s.length;n++){const r=s[n]??0,l=s[n+1]??r,c=(r+l)/2;let e;for(const d of a)c<d.start||c>=d.end||(!e||d.rank>e.rank||d.rank===e.rank&&d.start>=e.start)&&(e=d);const i=e?.db??0;f.at(-1)?.db!==i&&f.push({t:r,db:i})}if(f.every(n=>n.db===0))return[];const m=.005,h=[];for(const[n,r]of f.entries()){if(n===0){h.push({t:r.t,db:r.db});continue}const l=f[n-1]?.db??0;h.push({t:Math.max(0,r.t-m),db:l},{t:r.t+m,db:r.db})}return h}
@@ -169,6 +169,10 @@ export interface Cue {
169
169
  gainDb?: number;
170
170
  /** How it is shaped before it is levelled (its sound's `shape`). */
171
171
  shape?: FixedShape;
172
+ /** Seconds into its file it plays from (a trim's start); its file's start unless said. */
173
+ from?: number;
174
+ /** Seconds of it that play from there; to its file's end unless said. */
175
+ length?: number;
172
176
  }
173
177
  /**
174
178
  * A footage layer's background as its `background` option resolved: what
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allyhub/video-core",
3
- "version": "0.12.0",
3
+ "version": "0.14.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allyhub/video-sdk",
3
- "version": "0.12.0",
3
+ "version": "0.14.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
package/docs/defaults.md CHANGED
@@ -96,9 +96,9 @@ A new master's text styles (`master.text_styles`: `title_style`, `body_style`, `
96
96
 
97
97
  | Key | Value |
98
98
  | --- | --- |
99
- | `title` | `[{"alignment":"l","line_spacing":{"lines":0.9},"space_before":0,"bullet":null,"font":{"name":"+mj-lt","size":558800,"color":"dk1"}},{"alignment":"l","line_spacing":{"lines":0.9},"space_before":0,"bullet":null,"font":{"name":"+mj-lt","size":558800,"color":"dk1"}},{"alignment":"l","line_spacing":{"lines":0.9},"space_before":0,"bullet":null,"font":{"name":"+mj-lt","size":558800,"color":"dk1"}},{"alignment":"l","line_spacing":{"lines":0.9},"space_before":0,"bullet":null,"font":{"name":"+mj-lt","size":558800,"color":"dk1"}},{"alignment":"l","line_spacing":{"lines":0.9},"space_before":0,"bullet":null,"font":{"name":"+mj-lt","size":558800,"color":"dk1"}},{"alignment":"l","line_spacing":{"lines":0.9},"space_before":0,"bullet":null,"font":{"name":"+mj-lt","size":558800,"color":"dk1"}},{"alignment":"l","line_spacing":{"lines":0.9},"space_before":0,"bullet":null,"font":{"name":"+mj-lt","size":558800,"color":"dk1"}},{"alignment":"l","line_spacing":{"lines":0.9},"space_before":0,"bullet":null,"font":{"name":"+mj-lt","size":558800,"color":"dk1"}},{"alignment":"l","line_spacing":{"lines":0.9},"space_before":0,"bullet":null,"font":{"name":"+mj-lt","size":558800,"color":"dk1"}}]` |
100
- | `body` | `[{"alignment":"l","line_spacing":{"lines":0.9},"space_before":127000,"bullet":"•","bullet_font":"Arial","margin_left":228600,"indent":-228600,"font":{"name":"+mn-lt","size":355600,"color":"dk1"}},{"alignment":"l","line_spacing":{"lines":0.9},"space_before":63500,"bullet":"•","bullet_font":"Arial","margin_left":685800,"indent":-228600,"font":{"name":"+mn-lt","size":304800,"color":"dk1"}},{"alignment":"l","line_spacing":{"lines":0.9},"space_before":63500,"bullet":"•","bullet_font":"Arial","margin_left":1143000,"indent":-228600,"font":{"name":"+mn-lt","size":254000,"color":"dk1"}},{"alignment":"l","line_spacing":{"lines":0.9},"space_before":63500,"bullet":"•","bullet_font":"Arial","margin_left":1600200,"indent":-228600,"font":{"name":"+mn-lt","size":228600,"color":"dk1"}},{"alignment":"l","line_spacing":{"lines":0.9},"space_before":63500,"bullet":"•","bullet_font":"Arial","margin_left":2057400,"indent":-228600,"font":{"name":"+mn-lt","size":228600,"color":"dk1"}},{"alignment":"l","line_spacing":{"lines":0.9},"space_before":63500,"bullet":"•","bullet_font":"Arial","margin_left":2514600,"indent":-228600,"font":{"name":"+mn-lt","size":228600,"color":"dk1"}},{"alignment":"l","line_spacing":{"lines":0.9},"space_before":63500,"bullet":"•","bullet_font":"Arial","margin_left":2971800,"indent":-228600,"font":{"name":"+mn-lt","size":228600,"color":"dk1"}},{"alignment":"l","line_spacing":{"lines":0.9},"space_before":63500,"bullet":"•","bullet_font":"Arial","margin_left":3429000,"indent":-228600,"font":{"name":"+mn-lt","size":228600,"color":"dk1"}},{"alignment":"l","line_spacing":{"lines":0.9},"space_before":63500,"bullet":"•","bullet_font":"Arial","margin_left":3886200,"indent":-228600,"font":{"name":"+mn-lt","size":228600,"color":"dk1"}}]` |
101
- | `other` | `[{"alignment":"l","margin_left":0,"font":{"name":"+mn-lt","size":228600,"color":"dk1"}},{"alignment":"l","margin_left":457200,"font":{"name":"+mn-lt","size":228600,"color":"dk1"}},{"alignment":"l","margin_left":914400,"font":{"name":"+mn-lt","size":228600,"color":"dk1"}},{"alignment":"l","margin_left":1371600,"font":{"name":"+mn-lt","size":228600,"color":"dk1"}},{"alignment":"l","margin_left":1828800,"font":{"name":"+mn-lt","size":228600,"color":"dk1"}},{"alignment":"l","margin_left":2286000,"font":{"name":"+mn-lt","size":228600,"color":"dk1"}},{"alignment":"l","margin_left":2743200,"font":{"name":"+mn-lt","size":228600,"color":"dk1"}},{"alignment":"l","margin_left":3200400,"font":{"name":"+mn-lt","size":228600,"color":"dk1"}},{"alignment":"l","margin_left":3657600,"font":{"name":"+mn-lt","size":228600,"color":"dk1"}}]` |
99
+ | `title` | `[{"alignment":"l","line_spacing":{"lines":0.9},"space_before":0,"bullet":null,"font":{"name":"+mj-lt","size":558800,"color":"tx1"}},{"alignment":"l","line_spacing":{"lines":0.9},"space_before":0,"bullet":null,"font":{"name":"+mj-lt","size":558800,"color":"tx1"}},{"alignment":"l","line_spacing":{"lines":0.9},"space_before":0,"bullet":null,"font":{"name":"+mj-lt","size":558800,"color":"tx1"}},{"alignment":"l","line_spacing":{"lines":0.9},"space_before":0,"bullet":null,"font":{"name":"+mj-lt","size":558800,"color":"tx1"}},{"alignment":"l","line_spacing":{"lines":0.9},"space_before":0,"bullet":null,"font":{"name":"+mj-lt","size":558800,"color":"tx1"}},{"alignment":"l","line_spacing":{"lines":0.9},"space_before":0,"bullet":null,"font":{"name":"+mj-lt","size":558800,"color":"tx1"}},{"alignment":"l","line_spacing":{"lines":0.9},"space_before":0,"bullet":null,"font":{"name":"+mj-lt","size":558800,"color":"tx1"}},{"alignment":"l","line_spacing":{"lines":0.9},"space_before":0,"bullet":null,"font":{"name":"+mj-lt","size":558800,"color":"tx1"}},{"alignment":"l","line_spacing":{"lines":0.9},"space_before":0,"bullet":null,"font":{"name":"+mj-lt","size":558800,"color":"tx1"}}]` |
100
+ | `body` | `[{"alignment":"l","line_spacing":{"lines":0.9},"space_before":127000,"bullet":"•","bullet_font":"Arial","margin_left":228600,"indent":-228600,"font":{"name":"+mn-lt","size":355600,"color":"tx1"}},{"alignment":"l","line_spacing":{"lines":0.9},"space_before":63500,"bullet":"•","bullet_font":"Arial","margin_left":685800,"indent":-228600,"font":{"name":"+mn-lt","size":304800,"color":"tx1"}},{"alignment":"l","line_spacing":{"lines":0.9},"space_before":63500,"bullet":"•","bullet_font":"Arial","margin_left":1143000,"indent":-228600,"font":{"name":"+mn-lt","size":254000,"color":"tx1"}},{"alignment":"l","line_spacing":{"lines":0.9},"space_before":63500,"bullet":"•","bullet_font":"Arial","margin_left":1600200,"indent":-228600,"font":{"name":"+mn-lt","size":228600,"color":"tx1"}},{"alignment":"l","line_spacing":{"lines":0.9},"space_before":63500,"bullet":"•","bullet_font":"Arial","margin_left":2057400,"indent":-228600,"font":{"name":"+mn-lt","size":228600,"color":"tx1"}},{"alignment":"l","line_spacing":{"lines":0.9},"space_before":63500,"bullet":"•","bullet_font":"Arial","margin_left":2514600,"indent":-228600,"font":{"name":"+mn-lt","size":228600,"color":"tx1"}},{"alignment":"l","line_spacing":{"lines":0.9},"space_before":63500,"bullet":"•","bullet_font":"Arial","margin_left":2971800,"indent":-228600,"font":{"name":"+mn-lt","size":228600,"color":"tx1"}},{"alignment":"l","line_spacing":{"lines":0.9},"space_before":63500,"bullet":"•","bullet_font":"Arial","margin_left":3429000,"indent":-228600,"font":{"name":"+mn-lt","size":228600,"color":"tx1"}},{"alignment":"l","line_spacing":{"lines":0.9},"space_before":63500,"bullet":"•","bullet_font":"Arial","margin_left":3886200,"indent":-228600,"font":{"name":"+mn-lt","size":228600,"color":"tx1"}}]` |
101
+ | `other` | `[{"alignment":"l","margin_left":0,"font":{"name":"+mn-lt","size":228600,"color":"tx1"}},{"alignment":"l","margin_left":457200,"font":{"name":"+mn-lt","size":228600,"color":"tx1"}},{"alignment":"l","margin_left":914400,"font":{"name":"+mn-lt","size":228600,"color":"tx1"}},{"alignment":"l","margin_left":1371600,"font":{"name":"+mn-lt","size":228600,"color":"tx1"}},{"alignment":"l","margin_left":1828800,"font":{"name":"+mn-lt","size":228600,"color":"tx1"}},{"alignment":"l","margin_left":2286000,"font":{"name":"+mn-lt","size":228600,"color":"tx1"}},{"alignment":"l","margin_left":2743200,"font":{"name":"+mn-lt","size":228600,"color":"tx1"}},{"alignment":"l","margin_left":3200400,"font":{"name":"+mn-lt","size":228600,"color":"tx1"}},{"alignment":"l","margin_left":3657600,"font":{"name":"+mn-lt","size":228600,"color":"tx1"}}]` |
102
102
 
103
103
  ### `TEXT_FALLBACK`
104
104
 
@@ -113,7 +113,7 @@ What text has where not even a master's text styles say: 18 pt in the theme's mi
113
113
  | `indent` | `0` |
114
114
  | `font.name` | `"+mn-lt"` |
115
115
  | `font.size` | `228600` |
116
- | `font.color` | `"dk1"` |
116
+ | `font.color` | `"tx1"` |
117
117
 
118
118
  ### `TEXT_INSETS`
119
119
 
@@ -169,6 +169,80 @@ A shape's shadow where a `shadow` in a deck's slides file or `shape.shadow` says
169
169
  | `angle` | `45` |
170
170
  | `transparency` | `0.6` |
171
171
 
172
+ ### `PLAYBACK_DEFAULTS`
173
+
174
+ How a movie or a sound plays where its `playback` in a deck's slides file (or `add_movie`'s and `add_audio`'s) says nothing: it starts as it comes on, at PowerPoint's 80 % of its sound in a PowerPoint file (presenting and a render play it at its own level), and a sound's icon (`icon`, EMU) is half an inch square.
175
+
176
+ | Key | Value |
177
+ | --- | --- |
178
+ | `start` | `"auto"` |
179
+ | `volume` | `0.8` |
180
+ | `icon` | `457200` |
181
+
182
+ ### `LINE_DEFAULTS`
183
+
184
+ A line where a deck's slides file (`line_cap`, `line_join`, `line_compound`) or `shape.line` (`cap_type`, `join_type`, `compound_type`) says nothing: flat ends, mitred corners (the Office theme's lines', limited to 8 widths), one line.
185
+
186
+ | Key | Value |
187
+ | --- | --- |
188
+ | `cap` | `"flat"` |
189
+ | `join` | `"miter"` |
190
+ | `compound` | `"sng"` |
191
+
192
+ ### `PATTERN_DEFAULTS`
193
+
194
+ A pattern fill's colours where a deck's slides file (`pattern: { preset }`) or `fill.patterned()` says none: its foreground, `fg`, and its background, `bg`.
195
+
196
+ | Key | Value |
197
+ | --- | --- |
198
+ | `fg` | `"accent1"` |
199
+ | `bg` | `"bg1"` |
200
+
201
+ ### `TILE_DEFAULTS`
202
+
203
+ A tiled picture fill where `picture_fill.tile` (or `fill.picture`'s `tile`) says nothing: its own size each way, its first tile at the top left, not moved (`offset_x`, `offset_y` in EMU; the slides file's `x` and `y` are points).
204
+
205
+ | Key | Value |
206
+ | --- | --- |
207
+ | `scale_x` | `1` |
208
+ | `scale_y` | `1` |
209
+ | `offset_x` | `0` |
210
+ | `offset_y` | `0` |
211
+ | `align` | `"tl"` |
212
+
213
+ ### `INNER_SHADOW_DEFAULTS`
214
+
215
+ A shadow inside a shape where `inner_shadow` in a deck's slides file or `shape.inner_shadow` says nothing, as PowerPoint's Inside: Top Left: `color`, `blur` and `distance` (EMU), `angle` (degrees clockwise from the right), `transparency` (a share).
216
+
217
+ | Key | Value |
218
+ | --- | --- |
219
+ | `color.rgb` | `"#000000"` |
220
+ | `blur` | `63500` |
221
+ | `distance` | `50800` |
222
+ | `angle` | `45` |
223
+ | `transparency` | `0.5` |
224
+
225
+ ### `GLOW_DEFAULTS`
226
+
227
+ A glow where `glow` in a deck's slides file or `shape.glow` says nothing, as PowerPoint's 5 pt glow in Accent 1: `color`, `size` (EMU), `transparency` (a share).
228
+
229
+ | Key | Value |
230
+ | --- | --- |
231
+ | `color` | `"accent1"` |
232
+ | `size` | `63500` |
233
+ | `transparency` | `0.6` |
234
+
235
+ ### `REFLECTION_DEFAULTS`
236
+
237
+ A reflection where `reflection` in a deck's slides file or `shape.reflection` says nothing, as PowerPoint's Tight Reflection: Touching: `transparency` where it starts and `size` (shares), `distance` and `blur` (EMU).
238
+
239
+ | Key | Value |
240
+ | --- | --- |
241
+ | `transparency` | `0.5` |
242
+ | `size` | `0.35` |
243
+ | `distance` | `0` |
244
+ | `blur` | `6350` |
245
+
172
246
  ### `SLIDE_SECONDS`
173
247
 
174
248
  A slide's window on the stage's clock, seconds: a still of it is drawn at its end, when what moves in its components has settled. It is also how long a component moves, which its `dur` changes (in the slides file, or `add_component`'s `{ dur }`): its slide rests no sooner, and a PowerPoint file's video of it is that long.
package/docs/image.md CHANGED
@@ -49,7 +49,7 @@ export default image({
49
49
  });
50
50
  ```
51
51
 
52
- A picture a board starts from is never changed: a pixel edit (a matte, a part removed, the picture expanded) is a new file beside it, recorded in its `.gen.json`, which a layer then shows.
52
+ A picture a board starts from is never changed: a pixel edit (a matte, a part removed, the picture expanded) is a new file beside it, recorded in its `.provenance`, which a layer then shows.
53
53
 
54
54
  ## `image()`
55
55
 
package/docs/pictures.md CHANGED
@@ -52,7 +52,7 @@ Besides these, the layer options of any graphic layer: `at`, `until`, `dur`, `z`
52
52
  A picture's pixels are changed by AllyHub's cloud tools, each its own command (`allyhub ai-media <tool>`; `allyhub help ai-media <tool>` gives its input, its limits and its price): `generate-image`, `edit-image` (where a `mask` or a `markup` says, when given), `extend-image` and `cut-out-image` (the cut-out and its matte). A picture's parts as layers are the agent's to make: a part cut out (`cut-out-image`) and the picture without it (`edit-image` with a mask). No tool takes a model: what serves each is the cloud's to choose.
53
53
 
54
54
  - **A picture on this computer** goes in by the address `allyhub upload` gives it.
55
- - **What a call makes** is a new file, never the picture given changed, with its record beside it (`<file>.gen.json`: the tool, the whole input, what it returned, the credits). The same call to the same `--file` finds that file and calls nothing. Files the output names deeper (a matte, the layers) are downloaded beside it, each listed in the result.
55
+ - **What a call makes** is a new file, never the picture given changed, with its record beside it (`<file>.provenance`: the tool, the whole input, what it returned, the credits). The same call to the same `--file` finds that file and calls nothing. Files the output names deeper (a matte, the layers) are downloaded beside it, each listed in the result.
56
56
  - **Outside a mask** the model may redraw a little: what is kept exactly, and how, is the code's.
57
57
  - **A Mark up note's region** is SVG path data in the pixels of the picture whose file it names.
58
58
 
package/docs/project.md CHANGED
@@ -245,7 +245,7 @@ export default video({
245
245
  ```
246
246
 
247
247
  - **Media** (pictures `png jpg jpeg webp gif svg avif`; sound `mp3 wav m4a ogg aac flac`; video `mp4 webm mov m4v qt`; fonts `woff2 woff ttf otf`; 3D `glb gltf bin ktx2`, environments `hdr exr`) imports as a `MediaInfo`: `path` from the project's root, `sha256`, `kind`, `width` and `height`, `duration`, `audio`, and what the build measured (`words`, `loudness`, `tempo`, `faces`, `matte`…). `url` is where the stage loads it, valid only at run time; a media value turned into a string is its `url` (`img.src = logo`).
248
- - **Beside a media file**, files of the same name add to it: `<name>.words.json` (its word times: the file is a take, [speech.md](speech.md)), `<name>.elements.json` (a screenshot's named element boxes, `elements`), `<file>.gen.json` (how the file was made: `gen`; move it with its file).
248
+ - **Beside a media file**, files of the same name add to it: `<name>.words.json` (its word times: the file is a take, [speech.md](speech.md)), `<name>.elements.json` (a screenshot's named element boxes, `elements`), `<file>.provenance` (how the file was made: `gen`; move it with its file).
249
249
  - **Data**: CSV imports as an array of objects keyed by the header row, a column whose every value is a number as numbers; YAML as its value; JSON as usual.
250
250
  - A file that is not there is AK-A001; one of the wrong kind AK-A003; a picture on the stage that does not load AK-A005.
251
251