@bendyline/squisq 2.13.8 → 2.13.10
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.
- package/dist/{Doc-BCrrYAuK.d.ts → Doc-DqYt_b2b.d.ts} +14 -1
- package/dist/{ImageEditDoc-CSuevovH.d.ts → ImageEditDoc-CXXiXVJ-.d.ts} +1 -1
- package/dist/{chunk-HGXZMB7K.js → chunk-DIY3NBIS.js} +88 -28
- package/dist/{chunk-NROIOJKY.js → chunk-FXQ7C2FF.js} +17 -1
- package/dist/{chunk-FTN6SGW5.js → chunk-HKHOFTGM.js} +10 -0
- package/dist/{chunk-CS3MAZZX.js → chunk-KRMAEYNM.js} +232 -59
- package/dist/{chunk-5C6ZO5FV.js → chunk-LWNT6M4N.js} +19 -14
- package/dist/{chunk-PJHMZ26J.js → chunk-WK6LEZ3U.js} +204 -25
- package/dist/doc/index.d.ts +14 -15
- package/dist/doc/index.js +7 -5
- package/dist/fence/index.d.ts +1 -1
- package/dist/generate/index.d.ts +1 -1
- package/dist/imageEdit/index.d.ts +3 -3
- package/dist/index.d.ts +7 -7
- package/dist/index.js +20 -6
- package/dist/jsonForm/index.d.ts +1 -1
- package/dist/{materializePageSection-FT1B5NOo.d.ts → materializePageSection-S2hxZ_lO.d.ts} +1 -1
- package/dist/mediaEdit/index.d.ts +2 -2
- package/dist/narration/index.d.ts +28 -2
- package/dist/narration/index.js +8 -4
- package/dist/recommend/index.js +1 -1
- package/dist/schemas/index.d.ts +4 -4
- package/dist/{themeLibrary-BWvtBQ42.d.ts → themeLibrary-CFJbeItn.d.ts} +1 -1
- package/dist/timing/index.d.ts +1 -1
- package/dist/transform/index.d.ts +43 -7
- package/dist/transform/index.js +11 -3
- package/package.json +1 -1
|
@@ -2396,6 +2396,8 @@ interface Doc {
|
|
|
2396
2396
|
duration: number;
|
|
2397
2397
|
bookmarks: AudioBookmark[];
|
|
2398
2398
|
builds?: BuildAdvance[];
|
|
2399
|
+
/** When the presenter first showed each presentation slide during the take. */
|
|
2400
|
+
slides?: PresentationSlideMark[];
|
|
2399
2401
|
};
|
|
2400
2402
|
/** Projection-only guard: never compile an accepted plan twice. */
|
|
2401
2403
|
presentationApplied?: boolean;
|
|
@@ -3443,6 +3445,17 @@ interface AudioBookmark {
|
|
|
3443
3445
|
/** The word text at this position */
|
|
3444
3446
|
textFragment?: string;
|
|
3445
3447
|
}
|
|
3448
|
+
/**
|
|
3449
|
+
* A presentation slide the presenter put on screen while recording, keyed by
|
|
3450
|
+
* where its passage begins in the narration script. Unlike a bookmark it marks
|
|
3451
|
+
* a click, not a spoken word.
|
|
3452
|
+
*/
|
|
3453
|
+
interface PresentationSlideMark {
|
|
3454
|
+
/** Character offset in the narration script where the slide's passage begins. */
|
|
3455
|
+
charOffset: number;
|
|
3456
|
+
/** Seconds: take-relative in a timing sidecar, document time once applied. */
|
|
3457
|
+
time: number;
|
|
3458
|
+
}
|
|
3446
3459
|
/**
|
|
3447
3460
|
* Timing data for an audio segment, typically from a `.timing.json` file
|
|
3448
3461
|
* generated alongside TTS audio. Contains the source text and per-word
|
|
@@ -3473,4 +3486,4 @@ declare function getBlockAtTime(blocks: Block[], time: number): Block | null;
|
|
|
3473
3486
|
*/
|
|
3474
3487
|
declare function getCaptionAtTime(captions: CaptionTrack | undefined, time: number): CaptionPhrase | null;
|
|
3475
3488
|
|
|
3476
|
-
export { type FontFamilyKind as $, type AccentImage as A, type BarChartInput as B, type CaptionPhrase as C, type CustomTemplateLayer as D, type CustomTemplateValidationError as E, type CustomTemplateValidationResult as F, DARK_SURFACE as G, DEFAULT_DOC_FONT as H, DEFAULT_TITLE_FONT as I, type DataTableInput as J, type DateEventInput as K, type DeepPartial as L, type DefinitionCardInput as M, type DiagramBlockInput as N, type DiagramEdgeAnchor as O, type DiagramTemplateEdge as P, type DiagramTemplateNode as Q, type Doc as R, type DocBlock as S, type DocDiagnostic as T, type DonutChartInput as U, type DrawingBlockInput as V, FRONTMATTER_CUSTOM_TEMPLATES_KEY as W, FRONTMATTER_CUSTOM_THEMES_KEY as X, FRONTMATTER_MOTION_KEY as Y, type FactCardInput as Z, type FontFamily as _, type AccentPosition as a, type PersistentLayer as a$, type FullBleedQuoteInput as a0, type GradientBackgroundConfig as a1, type ImageBackgroundConfig as a2, type ImageLayer as a3, type ImageTreatment as a4, type ImageWithCaptionInput as a5, LIGHT_SURFACE as a6, type Layer as a7, type LayerRepeat as a8, type LayoutHints as a9, PAGE_DESIGN_FAMILIES as aA, PAGE_DIVIDERS as aB, PAGE_EMPHASES as aC, PAGE_EYEBROWS as aD, PAGE_HEADING_CASES as aE, PAGE_HEADING_SCALES as aF, PAGE_HEADING_UNDERLINES as aG, PAGE_HERO_STYLES as aH, PAGE_IMAGE_FRAMINGS as aI, PAGE_NUMERAL_STYLES as aJ, PAGE_PATTERNS as aK, PAGE_QUOTE_MARKS as aL, PAGE_SECTION_KINDS as aM, PAGE_SECTION_SPACINGS as aN, PAGE_SHADOWS as aO, PAGE_VARIANTS as aP, type PageAccentRotation as aQ, type PageBackground as aR, type PageDesignFamily as aS, type PageEmphasis as aT, type PageHeadingTreatment as aU, type PageSectionKind as aV, type PageSectionOverride as aW, type PageTokens as aX, type PageVariant as aY, type PathLayer as aZ, type PatternBackgroundConfig as a_, type LeftFeatureInput as aa, type LineChartInput as ab, type LinearGradient as ac, type ListBlockInput as ad, MOTION_PROFILES as ae, type MapBlockInput as af, type MapLayer as ag, type MapMarker as ah, type MapTileStyle as ai, type MarkerStyle as aj, type MediaClip as ak, type MediaCrop as al, type MediaCut as am, type MediaEdits as an, type MediaOnlyInput as ao, type MediaScheduleOptions as ap, type MermaidLayer as aq, type MotionEntrance as ar, type MotionOrigin as as, type MotionProfile as at, type MotionProfileName as au, type MotionSpec as av, type MotionState as aw, PAGE_ACCENT_STRATEGIES as ax, PAGE_BACKGROUNDS as ay, PAGE_BACKGROUND_RHYTHMS as az, type AmbientGradientConfig as b, type
|
|
3489
|
+
export { type FontFamilyKind as $, type AccentImage as A, type BarChartInput as B, type CaptionPhrase as C, type CustomTemplateLayer as D, type CustomTemplateValidationError as E, type CustomTemplateValidationResult as F, DARK_SURFACE as G, DEFAULT_DOC_FONT as H, DEFAULT_TITLE_FONT as I, type DataTableInput as J, type DateEventInput as K, type DeepPartial as L, type DefinitionCardInput as M, type DiagramBlockInput as N, type DiagramEdgeAnchor as O, type DiagramTemplateEdge as P, type DiagramTemplateNode as Q, type Doc as R, type DocBlock as S, type DocDiagnostic as T, type DonutChartInput as U, type DrawingBlockInput as V, FRONTMATTER_CUSTOM_TEMPLATES_KEY as W, FRONTMATTER_CUSTOM_THEMES_KEY as X, FRONTMATTER_MOTION_KEY as Y, type FactCardInput as Z, type FontFamily as _, type AccentPosition as a, type PersistentLayer as a$, type FullBleedQuoteInput as a0, type GradientBackgroundConfig as a1, type ImageBackgroundConfig as a2, type ImageLayer as a3, type ImageTreatment as a4, type ImageWithCaptionInput as a5, LIGHT_SURFACE as a6, type Layer as a7, type LayerRepeat as a8, type LayoutHints as a9, PAGE_DESIGN_FAMILIES as aA, PAGE_DIVIDERS as aB, PAGE_EMPHASES as aC, PAGE_EYEBROWS as aD, PAGE_HEADING_CASES as aE, PAGE_HEADING_SCALES as aF, PAGE_HEADING_UNDERLINES as aG, PAGE_HERO_STYLES as aH, PAGE_IMAGE_FRAMINGS as aI, PAGE_NUMERAL_STYLES as aJ, PAGE_PATTERNS as aK, PAGE_QUOTE_MARKS as aL, PAGE_SECTION_KINDS as aM, PAGE_SECTION_SPACINGS as aN, PAGE_SHADOWS as aO, PAGE_VARIANTS as aP, type PageAccentRotation as aQ, type PageBackground as aR, type PageDesignFamily as aS, type PageEmphasis as aT, type PageHeadingTreatment as aU, type PageSectionKind as aV, type PageSectionOverride as aW, type PageTokens as aX, type PageVariant as aY, type PathLayer as aZ, type PatternBackgroundConfig as a_, type LeftFeatureInput as aa, type LineChartInput as ab, type LinearGradient as ac, type ListBlockInput as ad, MOTION_PROFILES as ae, type MapBlockInput as af, type MapLayer as ag, type MapMarker as ah, type MapTileStyle as ai, type MarkerStyle as aj, type MediaClip as ak, type MediaCrop as al, type MediaCut as am, type MediaEdits as an, type MediaOnlyInput as ao, type MediaScheduleOptions as ap, type MermaidLayer as aq, type MotionEntrance as ar, type MotionOrigin as as, type MotionProfile as at, type MotionProfileName as au, type MotionSpec as av, type MotionState as aw, PAGE_ACCENT_STRATEGIES as ax, PAGE_BACKGROUNDS as ay, PAGE_BACKGROUND_RHYTHMS as az, type AmbientGradientConfig as b, type VideoEmbedLayer as b$, type PersistentLayerConfig as b0, type PersistentLayerTemplate as b1, type PersistentLayerTemplateConfig as b2, type PersistentLayerTemplateType as b3, type PhotoGridInput as b4, type PieChartInput as b5, type PipStyle as b6, type Position as b7, type PresentationSlideMark as b8, type ProgressIndicatorConfig as b9, type TextParagraph as bA, type TextParagraphList as bB, type TextStyle as bC, type Theme as bD, type ThemeColorPalette as bE, type ThemeColorScheme as bF, type ThemePageStyle as bG, type ThemeRegistry as bH, type ThemeSchemaVersion as bI, type ThemeSeedColors as bJ, type ThemeStyle as bK, type ThemeTypography as bL, type TimelineBlockInput as bM, type TimelineTemplateEvent as bN, type TimelineTemplateLink as bO, type TimelineTemplateTrack as bP, type TitleBlockInput as bQ, type TitleCaptionConfig as bR, type TopFeatureInput as bS, type TranscriptBlockInput as bT, type TreeBlockInput as bU, type TreeLayer as bV, type TreeLayerItem as bW, type TreeLayerStyle as bX, type TreeTemplateItem as bY, type TwoColumnInput as bZ, VIEWPORT_PRESETS as b_, type PromotedBodyAnnotation as ba, type PullQuoteInput as bb, type QuoteBlockInput as bc, type RawLayersInput as bd, type RenderStyle as be, type RightFeatureInput as bf, type ScatterChartInput as bg, type ScheduledClip as bh, type SectionHeaderInput as bi, type ShapeFilter as bj, type ShapeLayer as bk, type ShapePattern as bl, type SolidBackgroundConfig as bm, type StartBlockConfig as bn, type StatHighlightInput as bo, type SurfaceScheme as bp, type SvgLayer as bq, THEME_SCHEMA_VERSION as br, type TableLayer as bs, type TableLayerStyle as bt, type TemplateBlock as bu, type TemplateContext as bv, type TemplateFunction as bw, type TemplateRegistry as bx, type TextFlow as by, type TextLayer as bz, type Animation as c, serializeMediaFx as c$, type VideoLayer as c0, type VideoPipPosition as c1, type VideoPipShape as c2, type VideoPipSize as c3, type VideoPlacement as c4, type VideoPresentation as c5, type VideoPullQuoteInput as c6, type VideoWithCaptionInput as c7, type ViewportConfig as c8, type ViewportOrientation as c9, resolveMotionProfile as cA, scaledFontSize as cB, scheduleMediaClip as cC, validateCustomTemplateDefinition as cD, type MediaFxOpId as cE, type MediaFxChain as cF, MEDIA_EDIT_PARAMS as cG, MEDIA_FX_ORDER as cH, MEDIA_FX_SPECS as cI, type MediaEditParamKey as cJ, type MediaEditParamValues as cK, type MediaFxOp as cL, formatMediaNumber as cM, hasRenderableFx as cN, mediaEditHtmlAttribute as cO, mediaEditValuesFromAttributes as cP, mediaEditValuesFromParams as cQ, mediaRenderKey as cR, normalizeMediaCrop as cS, normalizeMediaCuts as cT, parseMediaCrop as cU, parseMediaCuts as cV, parseMediaEdits as cW, parseMediaFx as cX, serializeMediaCrop as cY, serializeMediaCuts as cZ, serializeMediaEdits as c_, type ViewportPreset as ca, type VignetteConfig as cb, applySurface as cc, calculateDuration as cd, calculateFontScale as ce, createTemplateContext as cf, createTheme as cg, createThemeRegistry as ch, getAspectRatioString as ci, getBlockAtTime as cj, getCaptionAtTime as ck, getDocPlaybackDuration as cl, getLayoutHints as cm, getSafeTextBounds as cn, getSegmentAtTime as co, getTwoColumnPositions as cp, getViewport as cq, getViewportOrientation as cr, isCustomTemplateDefinition as cs, isMotionProfileName as ct, isPersistentLayerTemplate as cu, isTemplateBlock as cv, scaledFontSize$1 as cw, readFrontmatterMotion as cx, resolveMediaSchedule as cy, resolveMotionForDoc as cz, type AnimationType as d, type AreaChartInput as e, type AudioBookmark as f, type AudioSegment as g, type AudioTimingData as h, type AudioTrack as i, type BigTextInput as j, type Block as k, type BlockConnection as l, type BorderStyle as m, type BottomFeatureInput as n, type CaptionTrack as o, type CaptionWord as p, type ChartBaseFields as q, type ChartTemplateInput as r, type ColorScheme as s, type ColumnChartInput as t, type ComparisonBarInput as u, type ContentBlockInput as v, type CornerBrandingConfig as w, type CountUpSpec as x, type CreateTemplateContextOptions as y, type CustomTemplateDefinition as z };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a3 as ImageLayer,
|
|
1
|
+
import { a3 as ImageLayer, bz as TextLayer, bk as ShapeLayer, aZ as PathLayer } from './Doc-DqYt_b2b.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* ImageEditDoc — JSON document describing a layered, editable image.
|
|
@@ -744,6 +744,7 @@ function findRailLabels(grid, boxes) {
|
|
|
744
744
|
for (let c = Math.max(0, box.c0); c <= Math.min(W - 1, box.c1); c++) inBox[r * W + c] = 1;
|
|
745
745
|
}
|
|
746
746
|
}
|
|
747
|
+
const boxCell = maskedCell(inBox, W, H);
|
|
747
748
|
const at = (r, c) => r >= 0 && r < H && c >= 0 && c < W ? grid[r][c] : " ";
|
|
748
749
|
const joins = (ch) => isLineChar(ch) || isJunction(ch) || isPlus(ch) || isAnyCorner(ch);
|
|
749
750
|
const vertJoins = (ch) => {
|
|
@@ -771,7 +772,7 @@ function findRailLabels(grid, boxes) {
|
|
|
771
772
|
if (ch === " ") return false;
|
|
772
773
|
if (arrowDirection(ch) !== null) return true;
|
|
773
774
|
const ascii = asciiArrowDirection(ch);
|
|
774
|
-
if (ascii !== null && asciiArrowGate(grid, r, c, ascii)) return true;
|
|
775
|
+
if (ascii !== null && asciiArrowGate(grid, r, c, ascii, boxCell)) return true;
|
|
775
776
|
if (!isLineChar(ch)) return false;
|
|
776
777
|
if (routingRow[r]) return true;
|
|
777
778
|
const vert = vertJoins(at(r - 1, c)) || vertJoins(at(r + 1, c));
|
|
@@ -880,8 +881,10 @@ function findRailLabels(grid, boxes) {
|
|
|
880
881
|
return out;
|
|
881
882
|
}
|
|
882
883
|
function extractEdges(grid, mask, perimeterOwners, boxes, warnings) {
|
|
884
|
+
var _a;
|
|
883
885
|
const H = grid.length;
|
|
884
886
|
const W = H > 0 ? grid[0].length : 0;
|
|
887
|
+
const boxCell = maskedCell(mask, W, H);
|
|
885
888
|
const cells = /* @__PURE__ */ new Map();
|
|
886
889
|
for (let r = 0; r < H; r++) {
|
|
887
890
|
for (let c = 0; c < W; c++) {
|
|
@@ -894,7 +897,7 @@ function extractEdges(grid, mask, perimeterOwners, boxes, warnings) {
|
|
|
894
897
|
continue;
|
|
895
898
|
}
|
|
896
899
|
const asc = asciiArrowDirection(ch);
|
|
897
|
-
if (asc && asciiArrowGate(grid, r, c, asc)) {
|
|
900
|
+
if (asc && asciiArrowGate(grid, r, c, asc, boxCell)) {
|
|
898
901
|
cells.set(idx, { arrow: asc });
|
|
899
902
|
continue;
|
|
900
903
|
}
|
|
@@ -924,12 +927,12 @@ function extractEdges(grid, mask, perimeterOwners, boxes, warnings) {
|
|
|
924
927
|
break;
|
|
925
928
|
}
|
|
926
929
|
if (isHoriz(gch)) {
|
|
927
|
-
if (horizRunReachesStructure(grid, mask, r, g, W)) break;
|
|
930
|
+
if (horizRunReachesStructure(grid, mask, r, g, W, boxCell)) break;
|
|
928
931
|
while (g < W && isHoriz(grid[r][g])) g++;
|
|
929
932
|
sawText = true;
|
|
930
933
|
continue;
|
|
931
934
|
}
|
|
932
|
-
if (isStructuralInGap(grid, r, g)) {
|
|
935
|
+
if (isStructuralInGap(grid, r, g, boxCell)) {
|
|
933
936
|
failed = true;
|
|
934
937
|
break;
|
|
935
938
|
}
|
|
@@ -950,7 +953,7 @@ function extractEdges(grid, mask, perimeterOwners, boxes, warnings) {
|
|
|
950
953
|
const isCrossCell = (idx) => CROSS_CHARS.has(grid[Math.floor(idx / W)][idx % W]);
|
|
951
954
|
const stateKey = (idx, channel) => idx * 2 + channel;
|
|
952
955
|
const visited = /* @__PURE__ */ new Set();
|
|
953
|
-
const
|
|
956
|
+
const found = [];
|
|
954
957
|
const seeds = [];
|
|
955
958
|
for (const idx of cells.keys()) {
|
|
956
959
|
seeds.push([idx, 0]);
|
|
@@ -959,11 +962,13 @@ function extractEdges(grid, mask, perimeterOwners, boxes, warnings) {
|
|
|
959
962
|
for (const [seedIdx, seedChannel] of seeds) {
|
|
960
963
|
if (visited.has(stateKey(seedIdx, seedChannel))) continue;
|
|
961
964
|
const componentCells = /* @__PURE__ */ new Set();
|
|
965
|
+
const states = [];
|
|
962
966
|
const queue = [[seedIdx, seedChannel]];
|
|
963
967
|
visited.add(stateKey(seedIdx, seedChannel));
|
|
964
968
|
while (queue.length > 0) {
|
|
965
969
|
const [idx, channel] = queue.pop();
|
|
966
970
|
componentCells.add(idx);
|
|
971
|
+
states.push(stateKey(idx, channel));
|
|
967
972
|
const r = Math.floor(idx / W);
|
|
968
973
|
const c = idx % W;
|
|
969
974
|
const neighbors = isCrossCell(idx) && channel === 1 ? [
|
|
@@ -990,15 +995,19 @@ function extractEdges(grid, mask, perimeterOwners, boxes, warnings) {
|
|
|
990
995
|
}
|
|
991
996
|
}
|
|
992
997
|
}
|
|
993
|
-
|
|
994
|
-
}
|
|
995
|
-
|
|
996
|
-
const
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
998
|
+
found.push({ cells: [...componentCells].sort((a, b) => a - b), states });
|
|
999
|
+
}
|
|
1000
|
+
found.sort((a, b) => a.cells[0] - b.cells[0]);
|
|
1001
|
+
const componentOfState = /* @__PURE__ */ new Map();
|
|
1002
|
+
found.forEach(({ states }, i) => states.forEach((key) => componentOfState.set(key, i)));
|
|
1003
|
+
const nearestOwner = (r, c) => {
|
|
1004
|
+
const owners = perimeterOwners.get(r * W + c) ?? [];
|
|
1005
|
+
if (owners.length === 0) return null;
|
|
1006
|
+
return [...owners].sort(
|
|
1007
|
+
(a, b) => boxes[a].r0 - boxes[b].r0 || boxes[a].c0 - boxes[b].c0 || a - b
|
|
1008
|
+
)[0];
|
|
1009
|
+
};
|
|
1010
|
+
const attachmentsOf = (component) => {
|
|
1002
1011
|
const inComponent = new Set(component);
|
|
1003
1012
|
const endpoints = [];
|
|
1004
1013
|
for (const idx of component) {
|
|
@@ -1034,13 +1043,6 @@ function extractEdges(grid, mask, perimeterOwners, boxes, warnings) {
|
|
|
1034
1043
|
attachmentsByBox.set(boxIdx, { boxIdx, isArrowEnd: info.arrow !== null });
|
|
1035
1044
|
}
|
|
1036
1045
|
}
|
|
1037
|
-
const nearestOwner = (r, c) => {
|
|
1038
|
-
const owners = perimeterOwners.get(r * W + c) ?? [];
|
|
1039
|
-
if (owners.length === 0) return null;
|
|
1040
|
-
return [...owners].sort(
|
|
1041
|
-
(a, b) => boxes[a].r0 - boxes[b].r0 || boxes[a].c0 - boxes[b].c0 || a - b
|
|
1042
|
-
)[0];
|
|
1043
|
-
};
|
|
1044
1046
|
for (const idx of component) {
|
|
1045
1047
|
const r = Math.floor(idx / W);
|
|
1046
1048
|
const c = idx % W;
|
|
@@ -1089,6 +1091,53 @@ function extractEdges(grid, mask, perimeterOwners, boxes, warnings) {
|
|
|
1089
1091
|
}
|
|
1090
1092
|
}
|
|
1091
1093
|
}
|
|
1094
|
+
return { byBox: attachmentsByBox, dangling };
|
|
1095
|
+
};
|
|
1096
|
+
const components = found.map(({ cells: componentCells }) => componentCells);
|
|
1097
|
+
const infos = components.map(attachmentsOf);
|
|
1098
|
+
const mergedInto = components.map((_, i) => i);
|
|
1099
|
+
for (const idx of cells.keys()) {
|
|
1100
|
+
if (!isCrossCell(idx)) continue;
|
|
1101
|
+
const across = componentOfState.get(stateKey(idx, 0));
|
|
1102
|
+
const along = componentOfState.get(stateKey(idx, 1));
|
|
1103
|
+
if (across === void 0 || along === void 0 || across === along) continue;
|
|
1104
|
+
const r = Math.floor(idx / W);
|
|
1105
|
+
const c = idx % W;
|
|
1106
|
+
for (const [trunk, bar, vertical] of [
|
|
1107
|
+
[along, across, true],
|
|
1108
|
+
[across, along, false]
|
|
1109
|
+
]) {
|
|
1110
|
+
if (mergedInto[trunk] !== trunk || mergedInto[bar] !== bar) continue;
|
|
1111
|
+
const trunkEnds = [...infos[trunk].byBox.values()];
|
|
1112
|
+
const barEnds = [...infos[bar].byBox.values()];
|
|
1113
|
+
const source = trunkEnds.find((a) => !a.isArrowEnd);
|
|
1114
|
+
const target = trunkEnds.find((a) => a.isArrowEnd);
|
|
1115
|
+
if (trunkEnds.length !== 2 || !source || !target || barEnds.length === 0) continue;
|
|
1116
|
+
const sideOf = (boxIdx) => {
|
|
1117
|
+
const b = boxes[boxIdx];
|
|
1118
|
+
const [lo, hi, at] = vertical ? [b.r0, b.r1, r] : [b.c0, b.c1, c];
|
|
1119
|
+
return hi < at ? -1 : lo > at ? 1 : 0;
|
|
1120
|
+
};
|
|
1121
|
+
const sourceSide = sideOf(source.boxIdx);
|
|
1122
|
+
if (sourceSide === 0 || sideOf(target.boxIdx) !== -sourceSide) continue;
|
|
1123
|
+
const fanOut = barEnds.every((a) => a.isArrowEnd && sideOf(a.boxIdx) === -sourceSide);
|
|
1124
|
+
const fanIn = barEnds.every((a) => !a.isArrowEnd && sideOf(a.boxIdx) === sourceSide);
|
|
1125
|
+
if (!fanOut && !fanIn) continue;
|
|
1126
|
+
for (const a of barEnds) infos[trunk].byBox.set(a.boxIdx, a);
|
|
1127
|
+
(_a = infos[trunk]).dangling || (_a.dangling = infos[bar].dangling);
|
|
1128
|
+
components[trunk] = [...components[trunk], ...components[bar]].sort((x, y) => x - y);
|
|
1129
|
+
mergedInto[bar] = trunk;
|
|
1130
|
+
break;
|
|
1131
|
+
}
|
|
1132
|
+
}
|
|
1133
|
+
const edges = [];
|
|
1134
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1135
|
+
let mergedParallel = false;
|
|
1136
|
+
const looseComponents = /* @__PURE__ */ new Set();
|
|
1137
|
+
const sideLabelCells = /* @__PURE__ */ new Set();
|
|
1138
|
+
for (const [componentIdx, component] of components.entries()) {
|
|
1139
|
+
if (mergedInto[componentIdx] !== componentIdx) continue;
|
|
1140
|
+
const { byBox: attachmentsByBox, dangling } = infos[componentIdx];
|
|
1092
1141
|
const attachments = [...attachmentsByBox.values()].sort(
|
|
1093
1142
|
(a, b) => boxes[a.boxIdx].r0 - boxes[b.boxIdx].r0 || boxes[a.boxIdx].c0 - boxes[b.boxIdx].c0
|
|
1094
1143
|
);
|
|
@@ -1212,28 +1261,38 @@ function extractEdges(grid, mask, perimeterOwners, boxes, warnings) {
|
|
|
1212
1261
|
for (const idx of sideLabelCells) edgeCells.add(idx);
|
|
1213
1262
|
return { edges, edgeCells };
|
|
1214
1263
|
}
|
|
1215
|
-
function horizRunReachesStructure(grid, mask, r, c, W) {
|
|
1264
|
+
function horizRunReachesStructure(grid, mask, r, c, W, isBoxCell) {
|
|
1216
1265
|
let end = c;
|
|
1217
1266
|
while (end < W && isHoriz(grid[r][end]) && !mask[r * W + end]) end++;
|
|
1218
1267
|
if (end >= W || mask[r * W + end]) return true;
|
|
1219
1268
|
const ch = grid[r][end];
|
|
1220
1269
|
if (isLineChar(ch) || arrowDirection(ch) !== null) return true;
|
|
1221
1270
|
const asc = asciiArrowDirection(ch);
|
|
1222
|
-
return asc !== null && asciiArrowGate(grid, r, end, asc);
|
|
1271
|
+
return asc !== null && asciiArrowGate(grid, r, end, asc, isBoxCell);
|
|
1223
1272
|
}
|
|
1224
|
-
function isStructuralInGap(grid, r, c) {
|
|
1273
|
+
function isStructuralInGap(grid, r, c, isBoxCell) {
|
|
1225
1274
|
const ch = grid[r][c];
|
|
1226
1275
|
if (arrowDirection(ch) !== null) return true;
|
|
1227
1276
|
const asc = asciiArrowDirection(ch);
|
|
1228
|
-
if (asc !== null && asciiArrowGate(grid, r, c, asc)) return true;
|
|
1277
|
+
if (asc !== null && asciiArrowGate(grid, r, c, asc, isBoxCell)) return true;
|
|
1229
1278
|
if (!isLineChar(ch)) return false;
|
|
1230
1279
|
const isDrawing = (x) => x !== void 0 && (isLineChar(x) || arrowDirection(x) !== null);
|
|
1231
1280
|
return isDrawing(grid[r - 1]?.[c]) || isDrawing(grid[r + 1]?.[c]);
|
|
1232
1281
|
}
|
|
1233
|
-
function asciiArrowGate(grid, r, c, dir) {
|
|
1234
|
-
const
|
|
1282
|
+
function asciiArrowGate(grid, r, c, dir, isBoxCell) {
|
|
1283
|
+
const [br, bc] = dir === "down" ? [r - 1, c] : dir === "up" ? [r + 1, c] : dir === "right" ? [r, c - 1] : [r, c + 1];
|
|
1284
|
+
const behind = grid[br]?.[bc];
|
|
1235
1285
|
if (behind === void 0) return false;
|
|
1236
|
-
|
|
1286
|
+
if (dir === "down" || dir === "up" ? isVert(behind) : isHoriz(behind)) return true;
|
|
1287
|
+
if (!isBoxCell || !isPlus(behind) || isBoxCell(br, bc)) return false;
|
|
1288
|
+
const line = (lr, lc, test) => {
|
|
1289
|
+
const ch = grid[lr]?.[lc];
|
|
1290
|
+
return ch !== void 0 && test(ch) && !isBoxCell(lr, lc);
|
|
1291
|
+
};
|
|
1292
|
+
return line(br, bc - 1, isHoriz) || line(br, bc + 1, isHoriz) || line(br - 1, bc, isVert) || line(br + 1, bc, isVert);
|
|
1293
|
+
}
|
|
1294
|
+
function maskedCell(mask, W, H) {
|
|
1295
|
+
return (r, c) => r >= 0 && r < H && c >= 0 && c < W && mask[r * W + c] === 1;
|
|
1237
1296
|
}
|
|
1238
1297
|
function snapEndpoint(r, c, arrow, perimeterOwners, boxes, W, H) {
|
|
1239
1298
|
const ownersAt = (rr, cc) => {
|
|
@@ -3974,6 +4033,7 @@ function recommendTemplatesForBlock(profile, allNames) {
|
|
|
3974
4033
|
}
|
|
3975
4034
|
|
|
3976
4035
|
export {
|
|
4036
|
+
matchNumberHighlight,
|
|
3977
4037
|
parseAnnotationInner,
|
|
3978
4038
|
parseStandaloneAnnotation,
|
|
3979
4039
|
isMediaAnnotationName,
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
expectedSyllablesAt,
|
|
10
10
|
flattenRenderableBlocks,
|
|
11
11
|
wordPosAtExpectedSyllables
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-LWNT6M4N.js";
|
|
13
13
|
|
|
14
14
|
// src/narration/types.ts
|
|
15
15
|
var DEFAULT_FEATURE_CONFIG = Object.freeze({
|
|
@@ -1177,6 +1177,13 @@ function recordSlideShown(log, blockId, atMs) {
|
|
|
1177
1177
|
const floor = log.length > 0 ? log[log.length - 1].atMs : 0;
|
|
1178
1178
|
return [...log, { blockId, atMs: Math.max(atMs, floor, 0) }];
|
|
1179
1179
|
}
|
|
1180
|
+
var EMPTY_SLIDE_MARK_LOG = Object.freeze([]);
|
|
1181
|
+
function recordSlideMark(log, charOffset, atMs) {
|
|
1182
|
+
if (!Number.isInteger(charOffset) || charOffset < 0 || !Number.isFinite(atMs)) return log;
|
|
1183
|
+
if (log.some((entry) => entry.charOffset === charOffset)) return log;
|
|
1184
|
+
const floor = log.length > 0 ? log[log.length - 1].atMs : 0;
|
|
1185
|
+
return [...log, { charOffset, atMs: Math.max(atMs, floor, 0) }];
|
|
1186
|
+
}
|
|
1180
1187
|
function clampDuration(durationSec) {
|
|
1181
1188
|
return Number.isFinite(durationSec) && durationSec >= 0 ? durationSec : 0;
|
|
1182
1189
|
}
|
|
@@ -1231,6 +1238,12 @@ function buildAdvanceTimingJson(doc, advances, durationSec, options) {
|
|
|
1231
1238
|
endSec: Math.max(startSec, Math.min(rawEnd, duration))
|
|
1232
1239
|
});
|
|
1233
1240
|
}
|
|
1241
|
+
let slideCursor = 0;
|
|
1242
|
+
const slides = (options?.slides ?? []).filter((mark) => mark.charOffset < script.sourceText.length).map((mark, index) => {
|
|
1243
|
+
const time = index === 0 ? 0 : Math.min(duration, Math.max(slideCursor, mark.atMs / 1e3));
|
|
1244
|
+
slideCursor = time;
|
|
1245
|
+
return { charOffset: mark.charOffset, time };
|
|
1246
|
+
});
|
|
1234
1247
|
return {
|
|
1235
1248
|
version: 3,
|
|
1236
1249
|
sourceText: script.sourceText,
|
|
@@ -1240,6 +1253,7 @@ function buildAdvanceTimingJson(doc, advances, durationSec, options) {
|
|
|
1240
1253
|
// them with block starts would misreport what was measured.
|
|
1241
1254
|
bookmarks: [],
|
|
1242
1255
|
blocks,
|
|
1256
|
+
...slides.length ? { slides } : {},
|
|
1243
1257
|
// `cameraOffsetSec` is deliberately omitted: a dual take already encodes
|
|
1244
1258
|
// its skew in the camera clip's `startAt`/`clipStart` attributes, and a
|
|
1245
1259
|
// second copy here invites a double correction.
|
|
@@ -1295,6 +1309,8 @@ export {
|
|
|
1295
1309
|
alignTranscript,
|
|
1296
1310
|
EMPTY_ADVANCE_LOG,
|
|
1297
1311
|
recordSlideShown,
|
|
1312
|
+
EMPTY_SLIDE_MARK_LOG,
|
|
1313
|
+
recordSlideMark,
|
|
1298
1314
|
buildAdvanceTimingJson,
|
|
1299
1315
|
advanceCoverage
|
|
1300
1316
|
};
|
|
@@ -111,8 +111,18 @@ function parseNarrationTimingJson(data) {
|
|
|
111
111
|
});
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
|
+
const slides = [];
|
|
115
|
+
if (Array.isArray(raw.slides))
|
|
116
|
+
for (const item of raw.slides) {
|
|
117
|
+
if (!item || typeof item !== "object") continue;
|
|
118
|
+
const mark = item;
|
|
119
|
+
if (Number.isInteger(mark.charOffset) && finiteNonNegative(mark.charOffset) && mark.charOffset < raw.sourceText.length && finiteNonNegative(mark.time) && mark.time <= raw.duration && !slides.some((slide) => slide.charOffset === mark.charOffset))
|
|
120
|
+
slides.push({ charOffset: mark.charOffset, time: mark.time });
|
|
121
|
+
}
|
|
122
|
+
slides.sort((a, b) => a.time - b.time);
|
|
114
123
|
return {
|
|
115
124
|
...builds.length ? { builds } : {},
|
|
125
|
+
...slides.length ? { slides } : {},
|
|
116
126
|
version: 3,
|
|
117
127
|
sourceText: raw.sourceText,
|
|
118
128
|
duration: raw.duration,
|