@courthive/scoring-visualizations 0.2.2
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/README.md +5 -0
- package/dist/engine/LiveEngine.d.ts +42 -0
- package/dist/engine/LiveEngine.d.ts.map +1 -0
- package/dist/engine/buildSetMap.d.ts +14 -0
- package/dist/engine/buildSetMap.d.ts.map +1 -0
- package/dist/engine/createPlaybackEngine.d.ts +23 -0
- package/dist/engine/createPlaybackEngine.d.ts.map +1 -0
- package/dist/engine/feedMatchUp.d.ts +82 -0
- package/dist/engine/feedMatchUp.d.ts.map +1 -0
- package/dist/episodes/buildEpisodes.d.ts +10 -0
- package/dist/episodes/buildEpisodes.d.ts.map +1 -0
- package/dist/episodes/types.d.ts +45 -0
- package/dist/episodes/types.d.ts.map +1 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/parsers/index.d.ts +10 -0
- package/dist/parsers/index.d.ts.map +1 -0
- package/dist/parsers/ionSportParser.d.ts +187 -0
- package/dist/parsers/ionSportParser.d.ts.map +1 -0
- package/dist/parsers/ionSportValidator.d.ts +33 -0
- package/dist/parsers/ionSportValidator.d.ts.map +1 -0
- package/dist/parsers/proTrackerParser.d.ts +115 -0
- package/dist/parsers/proTrackerParser.d.ts.map +1 -0
- package/dist/parsers/proTrackerValidator.d.ts +38 -0
- package/dist/parsers/proTrackerValidator.d.ts.map +1 -0
- package/dist/parsers/types.d.ts +49 -0
- package/dist/parsers/types.d.ts.map +1 -0
- package/dist/scoring-visualizations.es.js +4039 -0
- package/dist/scoring-visualizations.umd.js +7 -0
- package/dist/statistics/index.d.ts +3 -0
- package/dist/statistics/index.d.ts.map +1 -0
- package/dist/statistics/matchStatistics.d.ts +19 -0
- package/dist/statistics/matchStatistics.d.ts.map +1 -0
- package/dist/utils/supportsGameVisualizations.d.ts +14 -0
- package/dist/utils/supportsGameVisualizations.d.ts.map +1 -0
- package/dist/utils/supportsPointsToVisualization.d.ts +13 -0
- package/dist/utils/supportsPointsToVisualization.d.ts.map +1 -0
- package/dist/visualizations/coronaChart.d.ts +54 -0
- package/dist/visualizations/coronaChart.d.ts.map +1 -0
- package/dist/visualizations/data/sampleGame.d.ts +31 -0
- package/dist/visualizations/data/sampleGame.d.ts.map +1 -0
- package/dist/visualizations/donutChart.d.ts +31 -0
- package/dist/visualizations/donutChart.d.ts.map +1 -0
- package/dist/visualizations/gameFish.d.ts +16 -0
- package/dist/visualizations/gameFish.d.ts.map +1 -0
- package/dist/visualizations/gameTree.d.ts +17 -0
- package/dist/visualizations/gameTree.d.ts.map +1 -0
- package/dist/visualizations/groupGames.d.ts +6 -0
- package/dist/visualizations/groupGames.d.ts.map +1 -0
- package/dist/visualizations/helpers/FileDropzone.d.ts +13 -0
- package/dist/visualizations/helpers/FileDropzone.d.ts.map +1 -0
- package/dist/visualizations/helpers/JsonViewer.d.ts +27 -0
- package/dist/visualizations/helpers/JsonViewer.d.ts.map +1 -0
- package/dist/visualizations/helpers/PlaybackControls.d.ts +5 -0
- package/dist/visualizations/helpers/PlaybackControls.d.ts.map +1 -0
- package/dist/visualizations/horizonChart.d.ts +59 -0
- package/dist/visualizations/horizonChart.d.ts.map +1 -0
- package/dist/visualizations/index.d.ts +21 -0
- package/dist/visualizations/index.d.ts.map +1 -0
- package/dist/visualizations/legacyRally.d.ts +3 -0
- package/dist/visualizations/legacyRally.d.ts.map +1 -0
- package/dist/visualizations/matchUpDashboard.d.ts +30 -0
- package/dist/visualizations/matchUpDashboard.d.ts.map +1 -0
- package/dist/visualizations/momentumChart.d.ts +12 -0
- package/dist/visualizations/momentumChart.d.ts.map +1 -0
- package/dist/visualizations/ptsChart.d.ts +14 -0
- package/dist/visualizations/ptsChart.d.ts.map +1 -0
- package/dist/visualizations/ptsHorizon.d.ts +83 -0
- package/dist/visualizations/ptsHorizon.d.ts.map +1 -0
- package/dist/visualizations/rallyTree.d.ts +78 -0
- package/dist/visualizations/rallyTree.d.ts.map +1 -0
- package/dist/visualizations/simpleChart.d.ts +6 -0
- package/dist/visualizations/simpleChart.d.ts.map +1 -0
- package/dist/visualizations/statView.d.ts +44 -0
- package/dist/visualizations/statView.d.ts.map +1 -0
- package/dist/visualizations/typeOf.d.ts +6 -0
- package/dist/visualizations/typeOf.d.ts.map +1 -0
- package/dist/visualizations/types/events.d.ts +92 -0
- package/dist/visualizations/types/events.d.ts.map +1 -0
- package/dist/visualizations/types/index.d.ts +79 -0
- package/dist/visualizations/types/index.d.ts.map +1 -0
- package/dist/visualizations/utils/arrays.d.ts +18 -0
- package/dist/visualizations/utils/arrays.d.ts.map +1 -0
- package/dist/visualizations/utils/colorUtils.d.ts +36 -0
- package/dist/visualizations/utils/colorUtils.d.ts.map +1 -0
- package/dist/visualizations/utils/generateId.d.ts +2 -0
- package/dist/visualizations/utils/generateId.d.ts.map +1 -0
- package/dist/visualizations/utils/keyWalk.d.ts +2 -0
- package/dist/visualizations/utils/keyWalk.d.ts.map +1 -0
- package/dist/visualizations/utils/math.d.ts +10 -0
- package/dist/visualizations/utils/math.d.ts.map +1 -0
- package/dist/visualizations/utils/setDev.d.ts +29 -0
- package/dist/visualizations/utils/setDev.d.ts.map +1 -0
- package/package.json +75 -0
package/README.md
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LiveEngine — Reactive wrapper around ScoringEngine
|
|
3
|
+
*
|
|
4
|
+
* Adds pub/sub to the ScoringEngine so visualizations (and hive-eye-tracker)
|
|
5
|
+
* can subscribe to state changes. Every mutation auto-notifies subscribers
|
|
6
|
+
* with the fresh getState() MatchUp.
|
|
7
|
+
*
|
|
8
|
+
* Pattern:
|
|
9
|
+
* const live = new LiveEngine(engine);
|
|
10
|
+
* const unsub = live.subscribe(matchUp => chart.matchUp(matchUp));
|
|
11
|
+
* live.addPoint({ winner: 0 }); // subscriber fires
|
|
12
|
+
* unsub(); // stop listening
|
|
13
|
+
*/
|
|
14
|
+
type Listener = (matchUp: any) => void;
|
|
15
|
+
export declare class LiveEngine {
|
|
16
|
+
private engine;
|
|
17
|
+
private listeners;
|
|
18
|
+
constructor(engine?: any);
|
|
19
|
+
/** Subscribe to state changes. Returns an unsubscribe function. */
|
|
20
|
+
subscribe(cb: Listener): () => void;
|
|
21
|
+
private notify;
|
|
22
|
+
addPoint(opts: {
|
|
23
|
+
winner: 0 | 1;
|
|
24
|
+
server?: 0 | 1;
|
|
25
|
+
result?: string;
|
|
26
|
+
rallyLength?: number;
|
|
27
|
+
}): void;
|
|
28
|
+
undo(count?: number): boolean;
|
|
29
|
+
redo(count?: number): boolean;
|
|
30
|
+
editPoint(pointIndex: number, newData: Record<string, any>, options?: {
|
|
31
|
+
recalculate?: boolean;
|
|
32
|
+
}): void;
|
|
33
|
+
reset(): void;
|
|
34
|
+
getState(): any;
|
|
35
|
+
canUndo(): boolean;
|
|
36
|
+
canRedo(): boolean;
|
|
37
|
+
isComplete(): boolean;
|
|
38
|
+
getPointCount(): number;
|
|
39
|
+
getScoreboard(): string;
|
|
40
|
+
}
|
|
41
|
+
export {};
|
|
42
|
+
//# sourceMappingURL=LiveEngine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LiveEngine.d.ts","sourceRoot":"","sources":["../../src/engine/LiveEngine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAQH,KAAK,QAAQ,GAAG,CAAC,OAAO,EAAE,GAAG,KAAK,IAAI,CAAC;AAEvC,qBAAa,UAAU;IACrB,OAAO,CAAC,MAAM,CAAM;IACpB,OAAO,CAAC,SAAS,CAA4B;gBAEjC,MAAM,CAAC,EAAE,GAAG;IAIxB,mEAAmE;IACnE,SAAS,CAAC,EAAE,EAAE,QAAQ,GAAG,MAAM,IAAI;IAOnC,OAAO,CAAC,MAAM;IASd,QAAQ,CAAC,IAAI,EAAE;QAAE,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC;QAAC,MAAM,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;IAK9F,IAAI,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO;IAM7B,IAAI,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO;IAM7B,SAAS,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,OAAO,CAAC,EAAE;QAAE,WAAW,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI;IAKtG,KAAK,IAAI,IAAI;IAOb,QAAQ,IAAI,GAAG;IAIf,OAAO,IAAI,OAAO;IAIlB,OAAO,IAAI,OAAO;IAIlB,UAAU,IAAI,OAAO;IAIrB,aAAa,IAAI,MAAM;IAIvB,aAAa,IAAI,MAAM;CAGxB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Build a SetMap from ScoringEngine MatchUp state for coronaChart.
|
|
3
|
+
*
|
|
4
|
+
* For each set, computes cumulative point differential (p2sdiff)
|
|
5
|
+
* and extracts gamesScore and winnerIndex.
|
|
6
|
+
*/
|
|
7
|
+
export interface SetMap {
|
|
8
|
+
p2sdiff: number[];
|
|
9
|
+
gamesScore: [number, number];
|
|
10
|
+
players: [string, string];
|
|
11
|
+
winnerIndex: 0 | 1;
|
|
12
|
+
}
|
|
13
|
+
export declare function buildSetMap(matchUp: any, players?: [string, string]): SetMap[];
|
|
14
|
+
//# sourceMappingURL=buildSetMap.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buildSetMap.d.ts","sourceRoot":"","sources":["../../src/engine/buildSetMap.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,WAAW,MAAM;IACrB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1B,WAAW,EAAE,CAAC,GAAG,CAAC,CAAC;CACpB;AAED,wBAAgB,WAAW,CAAC,OAAO,EAAE,GAAG,EAAE,OAAO,GAAE,CAAC,MAAM,EAAE,MAAM,CAA4B,GAAG,MAAM,EAAE,CAuCxG"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { LiveEngine } from './LiveEngine';
|
|
2
|
+
import { getMcpFixture } from './feedMatchUp';
|
|
3
|
+
export interface PlaybackControls {
|
|
4
|
+
liveEngine: LiveEngine;
|
|
5
|
+
start(): void;
|
|
6
|
+
pause(): void;
|
|
7
|
+
stepForward(): void;
|
|
8
|
+
stepBack(): void;
|
|
9
|
+
reset(): void;
|
|
10
|
+
isPlaying(): boolean;
|
|
11
|
+
getProgress(): {
|
|
12
|
+
current: number;
|
|
13
|
+
total: number;
|
|
14
|
+
};
|
|
15
|
+
getFixture(): ReturnType<typeof getMcpFixture>;
|
|
16
|
+
destroy(): void;
|
|
17
|
+
}
|
|
18
|
+
export declare function createPlaybackEngine(options: {
|
|
19
|
+
matchIndex?: number;
|
|
20
|
+
delayMs?: number;
|
|
21
|
+
onComplete?: () => void;
|
|
22
|
+
}): PlaybackControls;
|
|
23
|
+
//# sourceMappingURL=createPlaybackEngine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createPlaybackEngine.d.ts","sourceRoot":"","sources":["../../src/engine/createPlaybackEngine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAc,MAAM,eAAe,CAAC;AAM1D,MAAM,WAAW,gBAAgB;IAC/B,UAAU,EAAE,UAAU,CAAC;IACvB,KAAK,IAAI,IAAI,CAAC;IACd,KAAK,IAAI,IAAI,CAAC;IACd,WAAW,IAAI,IAAI,CAAC;IACpB,QAAQ,IAAI,IAAI,CAAC;IACjB,KAAK,IAAI,IAAI,CAAC;IACd,SAAS,IAAI,OAAO,CAAC;IACrB,WAAW,IAAI;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAClD,UAAU,IAAI,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC;IAC/C,OAAO,IAAI,IAAI,CAAC;CACjB;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE;IAC5C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;CACzB,GAAG,gBAAgB,CAmFnB"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Feed MCP fixture data into the factory ScoringEngine
|
|
3
|
+
*
|
|
4
|
+
* Thin wrapper: iterates points, calls addPoint(), returns getState().
|
|
5
|
+
* No scoring logic lives here — the ScoringEngine is the single source of truth.
|
|
6
|
+
*/
|
|
7
|
+
interface McpPoint {
|
|
8
|
+
index: number;
|
|
9
|
+
set: number;
|
|
10
|
+
game: number;
|
|
11
|
+
score: string;
|
|
12
|
+
server: number;
|
|
13
|
+
winner: number;
|
|
14
|
+
result: string;
|
|
15
|
+
error: string | null;
|
|
16
|
+
serves: string[];
|
|
17
|
+
rally: string[];
|
|
18
|
+
rallyLength: number;
|
|
19
|
+
totalShots: number;
|
|
20
|
+
breakpoint: number | null;
|
|
21
|
+
gamepoint: number | null;
|
|
22
|
+
tiebreak: boolean;
|
|
23
|
+
code: string;
|
|
24
|
+
}
|
|
25
|
+
interface McpFixture {
|
|
26
|
+
matchId: number;
|
|
27
|
+
players: [string, string];
|
|
28
|
+
tournament: {
|
|
29
|
+
name: string;
|
|
30
|
+
division: string;
|
|
31
|
+
date: string | null;
|
|
32
|
+
tour: string;
|
|
33
|
+
};
|
|
34
|
+
score: {
|
|
35
|
+
sets?: Array<{
|
|
36
|
+
games: [number, number];
|
|
37
|
+
complete: boolean;
|
|
38
|
+
}>;
|
|
39
|
+
match_score?: string;
|
|
40
|
+
winner?: string;
|
|
41
|
+
loser?: string;
|
|
42
|
+
};
|
|
43
|
+
sets: Array<{
|
|
44
|
+
games: Array<{
|
|
45
|
+
range: [number, number];
|
|
46
|
+
winner: string;
|
|
47
|
+
score: [number, number];
|
|
48
|
+
tiebreak: boolean;
|
|
49
|
+
}>;
|
|
50
|
+
winner?: number;
|
|
51
|
+
}>;
|
|
52
|
+
points: McpPoint[];
|
|
53
|
+
totalPoints: number;
|
|
54
|
+
}
|
|
55
|
+
export declare const RESULT_MAP: Record<string, string>;
|
|
56
|
+
/**
|
|
57
|
+
* Feed a single MCP fixture match through the ScoringEngine.
|
|
58
|
+
*
|
|
59
|
+
* @param matchIndex - Index into mcpFixtures array (wraps around)
|
|
60
|
+
* @returns The ScoringEngine MatchUp state (with enriched history points)
|
|
61
|
+
*/
|
|
62
|
+
export declare function feedMatchUp(matchIndex?: number): any;
|
|
63
|
+
/**
|
|
64
|
+
* Feed all MCP fixtures through the ScoringEngine.
|
|
65
|
+
*/
|
|
66
|
+
export declare function feedAllMatchUps(): any[];
|
|
67
|
+
/**
|
|
68
|
+
* Get the raw MCP fixture data (for metadata like player names, tournament).
|
|
69
|
+
*/
|
|
70
|
+
export declare function getMcpFixture(matchIndex?: number): McpFixture;
|
|
71
|
+
/**
|
|
72
|
+
* Extract rally lengths from a ScoringEngine MatchUp, grouped by winner.
|
|
73
|
+
* Returns [player0Rallies, player1Rallies] for simpleChart.
|
|
74
|
+
*/
|
|
75
|
+
export declare function extractRallyLengths(matchUp: any): number[][];
|
|
76
|
+
/**
|
|
77
|
+
* Extract points for a single game from a ScoringEngine MatchUp.
|
|
78
|
+
* Used by gameFish stories. Returns legacy Point[] shape.
|
|
79
|
+
*/
|
|
80
|
+
export declare function extractGamePoints(matchUp: any, setIdx?: number, gameIdx?: number): any[];
|
|
81
|
+
export {};
|
|
82
|
+
//# sourceMappingURL=feedMatchUp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feedMatchUp.d.ts","sourceRoot":"","sources":["../../src/engine/feedMatchUp.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAOH,UAAU,QAAQ;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,QAAQ,EAAE,OAAO,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,UAAU,UAAU;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1B,UAAU,EAAE;QACV,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,MAAM,CAAC;QACjB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;QACpB,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IACF,KAAK,EAAE;QACL,IAAI,CAAC,EAAE,KAAK,CAAC;YAAE,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;YAAC,QAAQ,EAAE,OAAO,CAAA;SAAE,CAAC,CAAC;QAC7D,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,IAAI,EAAE,KAAK,CAAC;QACV,KAAK,EAAE,KAAK,CAAC;YACX,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;YACxB,MAAM,EAAE,MAAM,CAAC;YACf,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;YACxB,QAAQ,EAAE,OAAO,CAAC;SACnB,CAAC,CAAC;QACH,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,CAAC,CAAC;IACH,MAAM,EAAE,QAAQ,EAAE,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;CACrB;AAMD,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAU7C,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,UAAU,SAAI,GAAG,GAAG,CA4B/C;AAED;;GAEG;AACH,wBAAgB,eAAe,IAAI,GAAG,EAAE,CAEvC;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,UAAU,SAAI,GAAG,UAAU,CAExD;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,GAAG,GAAG,MAAM,EAAE,EAAE,CAW5D;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,GAAG,EAAE,MAAM,SAAI,EAAE,OAAO,SAAI,GAAG,GAAG,EAAE,CA4B9E"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Episode } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Transforms a ScoringEngine MatchUp into an Episode array
|
|
4
|
+
* suitable for visualization components (GameTree, Momentum, PTS, GameFish, Corona).
|
|
5
|
+
*
|
|
6
|
+
* @param matchUp - A MatchUp object from ScoringEngine.getState()
|
|
7
|
+
* @returns Episode[] - Array of episodes, one per point played
|
|
8
|
+
*/
|
|
9
|
+
export declare function buildEpisodes(matchUp: any): Episode[];
|
|
10
|
+
//# sourceMappingURL=buildEpisodes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buildEpisodes.d.ts","sourceRoot":"","sources":["../../src/episodes/buildEpisodes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEvC;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,GAAG,GAAG,OAAO,EAAE,CA4BrD"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export interface EpisodePoint {
|
|
2
|
+
winner: number;
|
|
3
|
+
server: number;
|
|
4
|
+
pointNumber: number;
|
|
5
|
+
index: number;
|
|
6
|
+
isBreakpoint: boolean;
|
|
7
|
+
score: string;
|
|
8
|
+
set: number;
|
|
9
|
+
game: number;
|
|
10
|
+
rallyLength?: number;
|
|
11
|
+
result?: string;
|
|
12
|
+
notation?: string;
|
|
13
|
+
tiebreak?: boolean;
|
|
14
|
+
serve?: 1 | 2;
|
|
15
|
+
points?: [number, number];
|
|
16
|
+
setCumulativePoints?: [number, number];
|
|
17
|
+
}
|
|
18
|
+
export interface EpisodeGame {
|
|
19
|
+
complete: boolean;
|
|
20
|
+
winner: number | undefined;
|
|
21
|
+
games: number[];
|
|
22
|
+
index: number;
|
|
23
|
+
}
|
|
24
|
+
export interface EpisodeSet {
|
|
25
|
+
complete: boolean;
|
|
26
|
+
winner: number | undefined;
|
|
27
|
+
sets: number[][];
|
|
28
|
+
index: number;
|
|
29
|
+
}
|
|
30
|
+
export interface EpisodeNeeded {
|
|
31
|
+
pointsToGame: number[];
|
|
32
|
+
pointsToSet: number[];
|
|
33
|
+
gamesToSet: number[];
|
|
34
|
+
}
|
|
35
|
+
export interface Episode {
|
|
36
|
+
action: 'addPoint';
|
|
37
|
+
point: EpisodePoint;
|
|
38
|
+
game: EpisodeGame;
|
|
39
|
+
set: EpisodeSet;
|
|
40
|
+
needed: EpisodeNeeded;
|
|
41
|
+
nextService: number;
|
|
42
|
+
result: boolean;
|
|
43
|
+
complete: boolean;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/episodes/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,OAAO,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IAEb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;IACd,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1B,mBAAmB,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACxC;AAED,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,IAAI,EAAE,MAAM,EAAE,EAAE,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,aAAa;IAC5B,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB;AAED,MAAM,WAAW,OAAO;IACtB,MAAM,EAAE,UAAU,CAAC;IACnB,KAAK,EAAE,YAAY,CAAC;IACpB,IAAI,EAAE,WAAW,CAAC;IAClB,GAAG,EAAE,UAAU,CAAC;IAChB,MAAM,EAAE,aAAa,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;CACnB"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export { buildEpisodes } from './episodes/buildEpisodes';
|
|
2
|
+
export type { Episode, EpisodePoint, EpisodeGame, EpisodeSet, EpisodeNeeded } from './episodes/types';
|
|
3
|
+
export { feedMatchUp, feedAllMatchUps, getMcpFixture, extractRallyLengths, extractGamePoints } from './engine/feedMatchUp';
|
|
4
|
+
export { LiveEngine } from './engine/LiveEngine';
|
|
5
|
+
export { createPlaybackEngine } from './engine/createPlaybackEngine';
|
|
6
|
+
export type { PlaybackControls } from './engine/createPlaybackEngine';
|
|
7
|
+
export { buildSetMap } from './engine/buildSetMap';
|
|
8
|
+
export type { SetMap } from './engine/buildSetMap';
|
|
9
|
+
export { coronaChart, coronaChartFromMatchUp } from './visualizations/coronaChart';
|
|
10
|
+
export { ptsHorizon, ptsHorizonFromMatchUp } from './visualizations/ptsHorizon';
|
|
11
|
+
export { horizonChart } from './visualizations/horizonChart';
|
|
12
|
+
export { gameTree } from './visualizations/gameTree';
|
|
13
|
+
export { rallyTree } from './visualizations/rallyTree';
|
|
14
|
+
export { momentumChart } from './visualizations/momentumChart';
|
|
15
|
+
export { ptsMatch } from './visualizations/ptsChart';
|
|
16
|
+
export { gameFish } from './visualizations/gameFish';
|
|
17
|
+
export { statView } from './visualizations/statView';
|
|
18
|
+
export { matchUpDashboard } from './visualizations/matchUpDashboard';
|
|
19
|
+
export { simpleChart } from './visualizations/simpleChart';
|
|
20
|
+
export { donutChart, donutChartFromMatchUps, aggregateMatchUps } from './visualizations/donutChart';
|
|
21
|
+
export type { DonutChartOptions, DonutDatum, CompetitivenessBucket } from './visualizations/donutChart';
|
|
22
|
+
export { computeMatchStats, computeMatchStatsFromMatchUp } from './statistics';
|
|
23
|
+
export type { StatObject } from './statistics';
|
|
24
|
+
export type { PtsChartEvents, GameFishEvents, GameTreeEvents, MomentumChartEvents } from './visualizations/types/events';
|
|
25
|
+
export { validateProTrackerMatch, validateProTrackerBuffer, parsePTFContent, parsePTFPoint, mapPTFFormat, classifyResult, mapServeLocation, decodeUTF16LE, splitPTFRows, validateIONSportMatch, parseIONSportMatch, parseIONSportPoint, mapIONSportFormat, isTimedFormat, extractPlayersFromSide, extractPlayers, buildSubstitutionEvents, } from './parsers';
|
|
26
|
+
export type { PointResult, StrokeType, ServeLocation, RallyShot, ProTrackerValidationResult, ProTrackerValidationOptions, IONSportValidationResult, IONSportValidationOptions, PTFMatch, ParsedPTFPoint, ParsedIONSportMatch, PlayerInfo, SubstitutionInfo, } from './parsers';
|
|
27
|
+
export { supportsGameVisualizations } from './utils/supportsGameVisualizations';
|
|
28
|
+
export { supportsPointsToVisualization } from './utils/supportsPointsToVisualization';
|
|
29
|
+
export { createFileDropzone } from './visualizations/helpers/FileDropzone';
|
|
30
|
+
export type { FileDropzoneOptions } from './visualizations/helpers/FileDropzone';
|
|
31
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,YAAY,EAAE,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGtG,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,aAAa,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAG3H,OAAO,EAA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ACvB,wBAAwB,EACxB,eAAe,EACf,aAAa,EACb,YAAY,EACZ,cAAc,EACd,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,qBAAqB,EACrB,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,aAAa,EACb,sBAAsB,EACtB,cAAc,EACd,uBAAuB,GACxB,MAAM,WAAW,CAAC;AACnB,YAAY,EACV,WAAW,EACX,UAAU,EACV,aAAa,EACb,SAAS,EACT,0BAA0B,EAC1B,2BAA2B,EAC3B,wBAAwB,EACxB,yBAAyB,EACzB,QAAQ,EACR,cAAc,EACd,mBAAmB,EACnB,UAAU,EACV,gBAAgB,GACjB,MAAM,WAAW,CAAC;AAGnB,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAChF,OAAO,EAAE,6BAA6B,EAAE,MAAM,uCAAuC,CAAC;AAGtF,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAC3E,YAAY,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type { PointResult, StrokeType, ServeLocation, RallyShot, AddPointOptions } from './types';
|
|
2
|
+
export { parsePTFContent, parsePTFPoint, mapPTFFormat, classifyResult, mapServeLocation, decodeUTF16LE, splitPTFRows, } from './proTrackerParser';
|
|
3
|
+
export type { PTFMatch, PTFFormat, PTFSet, PTFGame, PTFPoint, PTFShot, ParsedPTFPoint, } from './proTrackerParser';
|
|
4
|
+
export { parseIONSportMatch, parseIONSportPoint, mapIONSportFormat, isTimedFormat, extractPlayersFromSide, extractPlayers, buildSubstitutionEvents, } from './ionSportParser';
|
|
5
|
+
export type { IONSportMatchData, IONSportSide, IONSportPlayer, IONSportSet, IONSportGame, IONSportPoint, IONSportShot, CourtTimeEntry, ParsedIONSportPoint, PlayerInfo, ParsedIONSportMatch, ParsedIONSportSet, SubstitutionInfo, } from './ionSportParser';
|
|
6
|
+
export { validateProTrackerMatch, validateProTrackerBuffer } from './proTrackerValidator';
|
|
7
|
+
export type { ProTrackerValidationOptions, ProTrackerValidationResult } from './proTrackerValidator';
|
|
8
|
+
export { validateIONSportMatch } from './ionSportValidator';
|
|
9
|
+
export type { IONSportValidationOptions, IONSportValidationResult } from './ionSportValidator';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/parsers/index.ts"],"names":[],"mappings":"AACA,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,aAAa,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAGlG,OAAO,EACL,eAAe,EACf,aAAa,EACb,YAAY,EACZ,cAAc,EACd,gBAAgB,EAChB,aAAa,EACb,YAAY,GACb,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EACV,QAAQ,EACR,SAAS,EACT,MAAM,EACN,OAAO,EACP,QAAQ,EACR,OAAO,EACP,cAAc,GACf,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,aAAa,EACb,sBAAsB,EACtB,cAAc,EACd,uBAAuB,GACxB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EACV,iBAAiB,EACjB,YAAY,EACZ,cAAc,EACd,WAAW,EACX,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,cAAc,EACd,mBAAmB,EACnB,UAAU,EACV,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AAC1F,YAAY,EAAE,2BAA2B,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AAGrG,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,YAAY,EAAE,yBAAyB,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import { PointResult } from './types';
|
|
2
|
+
export interface IONSportMatchData {
|
|
3
|
+
matchId: string;
|
|
4
|
+
matchFormat: string;
|
|
5
|
+
matchType: 'S' | 'D';
|
|
6
|
+
matchStatus: string;
|
|
7
|
+
sides: IONSportSide[];
|
|
8
|
+
sets: IONSportSet[];
|
|
9
|
+
playerCourtTimeLog: {
|
|
10
|
+
side1: CourtTimeEntry[];
|
|
11
|
+
side2: CourtTimeEntry[];
|
|
12
|
+
};
|
|
13
|
+
substitutionPolicy?: {
|
|
14
|
+
perSet: number;
|
|
15
|
+
perMatch: number;
|
|
16
|
+
};
|
|
17
|
+
schedule?: any;
|
|
18
|
+
clocks?: any[];
|
|
19
|
+
matchWinningSide?: number;
|
|
20
|
+
}
|
|
21
|
+
export interface IONSportSide {
|
|
22
|
+
sideNumber: number;
|
|
23
|
+
players: IONSportPlayer[];
|
|
24
|
+
_id?: string;
|
|
25
|
+
}
|
|
26
|
+
export interface IONSportPlayer {
|
|
27
|
+
playerNumber: number;
|
|
28
|
+
participant: {
|
|
29
|
+
_id: string;
|
|
30
|
+
first_name: string;
|
|
31
|
+
last_name: string;
|
|
32
|
+
[key: string]: any;
|
|
33
|
+
};
|
|
34
|
+
_id?: string;
|
|
35
|
+
}
|
|
36
|
+
export interface IONSportSet {
|
|
37
|
+
games: IONSportGame[];
|
|
38
|
+
winningSide?: number;
|
|
39
|
+
side1Score: number;
|
|
40
|
+
side2Score: number;
|
|
41
|
+
}
|
|
42
|
+
export interface IONSportGame {
|
|
43
|
+
gameFormat: string;
|
|
44
|
+
gameNumber: number;
|
|
45
|
+
points: IONSportPoint[];
|
|
46
|
+
}
|
|
47
|
+
export interface IONSportPoint {
|
|
48
|
+
pointNumber: number;
|
|
49
|
+
winningSide?: number;
|
|
50
|
+
winReason: string;
|
|
51
|
+
server: {
|
|
52
|
+
sideNumber: number;
|
|
53
|
+
playerNumber: number;
|
|
54
|
+
player: string | null;
|
|
55
|
+
returningSide: 'DEUCE' | 'AD';
|
|
56
|
+
};
|
|
57
|
+
shots: IONSportShot[];
|
|
58
|
+
side1Score: number;
|
|
59
|
+
side2Score: number;
|
|
60
|
+
timestamp: string;
|
|
61
|
+
startPointTimeStamp?: string;
|
|
62
|
+
substitutions: any[];
|
|
63
|
+
onCourtPlayers: {
|
|
64
|
+
side1: any[];
|
|
65
|
+
side2: any[];
|
|
66
|
+
};
|
|
67
|
+
playerPositions?: any;
|
|
68
|
+
timeout?: any[];
|
|
69
|
+
extensions?: any[];
|
|
70
|
+
_id?: string;
|
|
71
|
+
}
|
|
72
|
+
export interface IONSportShot {
|
|
73
|
+
participant: string | null;
|
|
74
|
+
shotDetail: string | null;
|
|
75
|
+
shotMadeFrom: string;
|
|
76
|
+
shotNumber: number;
|
|
77
|
+
shotOutcome: string;
|
|
78
|
+
shotType: string;
|
|
79
|
+
side: number;
|
|
80
|
+
_id?: string;
|
|
81
|
+
}
|
|
82
|
+
export interface CourtTimeEntry {
|
|
83
|
+
player: {
|
|
84
|
+
_id: string;
|
|
85
|
+
first_name: string;
|
|
86
|
+
last_name: string;
|
|
87
|
+
};
|
|
88
|
+
playerNumber: number;
|
|
89
|
+
sideNumber?: number;
|
|
90
|
+
inTime: string;
|
|
91
|
+
outTime: string;
|
|
92
|
+
substitutedBy: string | null;
|
|
93
|
+
substitutedAt: string | null;
|
|
94
|
+
performedBy: string;
|
|
95
|
+
isReverted: boolean;
|
|
96
|
+
setNumber: number;
|
|
97
|
+
pointNumber?: number;
|
|
98
|
+
}
|
|
99
|
+
export interface ParsedIONSportPoint {
|
|
100
|
+
winningSide: 1 | 2;
|
|
101
|
+
serverSideNumber: 1 | 2;
|
|
102
|
+
serverParticipantId?: string;
|
|
103
|
+
result?: PointResult;
|
|
104
|
+
timestamp?: string;
|
|
105
|
+
startPointTimeStamp?: string;
|
|
106
|
+
serveSide?: 'DEUCE' | 'AD';
|
|
107
|
+
scoreValue?: number;
|
|
108
|
+
}
|
|
109
|
+
export interface PlayerInfo {
|
|
110
|
+
participantId: string;
|
|
111
|
+
firstName: string;
|
|
112
|
+
lastName: string;
|
|
113
|
+
playerNumber: number;
|
|
114
|
+
}
|
|
115
|
+
export interface ParsedIONSportMatch {
|
|
116
|
+
matchId: string;
|
|
117
|
+
matchFormat: string;
|
|
118
|
+
factoryFormat: string;
|
|
119
|
+
matchType: 'S' | 'D';
|
|
120
|
+
isDoubles: boolean;
|
|
121
|
+
isTimed: boolean;
|
|
122
|
+
side1Players: PlayerInfo[];
|
|
123
|
+
side2Players: PlayerInfo[];
|
|
124
|
+
sets: ParsedIONSportSet[];
|
|
125
|
+
courtTimeLog: {
|
|
126
|
+
side1: CourtTimeEntry[];
|
|
127
|
+
side2: CourtTimeEntry[];
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
export interface ParsedIONSportSet {
|
|
131
|
+
setNumber: number;
|
|
132
|
+
winningSide?: number;
|
|
133
|
+
side1Score: number;
|
|
134
|
+
side2Score: number;
|
|
135
|
+
points: ParsedIONSportPoint[];
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Parse raw IONSport JSON data into structured match
|
|
139
|
+
*/
|
|
140
|
+
export declare function parseIONSportMatch(jsonData: any): ParsedIONSportMatch;
|
|
141
|
+
/**
|
|
142
|
+
* Parse a single IONSport point into engine-compatible format
|
|
143
|
+
*/
|
|
144
|
+
export declare function parseIONSportPoint(point: IONSportPoint): ParsedIONSportPoint;
|
|
145
|
+
/**
|
|
146
|
+
* Map IONSport format code to factory matchUpFormatCode
|
|
147
|
+
*
|
|
148
|
+
* IONSport uses "SET3-S:10P" for timed 10-minute point-based sets.
|
|
149
|
+
* Factory uses "SET3-S:T10P" (with T prefix for timed).
|
|
150
|
+
*
|
|
151
|
+
* Detection: if format contains `P` suffix without `T` prefix before the number, add `T`.
|
|
152
|
+
*/
|
|
153
|
+
export declare function mapIONSportFormat(ionFormat: string): string;
|
|
154
|
+
/**
|
|
155
|
+
* Detect if format is timed (requires endSegment)
|
|
156
|
+
*/
|
|
157
|
+
export declare function isTimedFormat(matchFormat: string): boolean;
|
|
158
|
+
/**
|
|
159
|
+
* Extract player info from an IONSport side
|
|
160
|
+
*/
|
|
161
|
+
export declare function extractPlayersFromSide(side: IONSportSide | undefined): PlayerInfo[];
|
|
162
|
+
/**
|
|
163
|
+
* Extract all players from match data
|
|
164
|
+
*/
|
|
165
|
+
export declare function extractPlayers(matchData: any): {
|
|
166
|
+
side1: PlayerInfo[];
|
|
167
|
+
side2: PlayerInfo[];
|
|
168
|
+
};
|
|
169
|
+
/**
|
|
170
|
+
* Build substitution events from playerCourtTimeLog
|
|
171
|
+
*
|
|
172
|
+
* Returns substitution events sorted by (setNumber, pointNumber).
|
|
173
|
+
* Each event represents a player leaving and being replaced.
|
|
174
|
+
*/
|
|
175
|
+
export declare function buildSubstitutionEvents(courtTimeLog: {
|
|
176
|
+
side1: CourtTimeEntry[];
|
|
177
|
+
side2: CourtTimeEntry[];
|
|
178
|
+
}): SubstitutionInfo[];
|
|
179
|
+
export interface SubstitutionInfo {
|
|
180
|
+
sideNumber: 1 | 2;
|
|
181
|
+
outParticipantId: string;
|
|
182
|
+
inParticipantId: string;
|
|
183
|
+
setNumber: number;
|
|
184
|
+
pointNumber?: number;
|
|
185
|
+
timestamp: string;
|
|
186
|
+
}
|
|
187
|
+
//# sourceMappingURL=ionSportParser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ionSportParser.d.ts","sourceRoot":"","sources":["../../src/parsers/ionSportParser.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAM3C,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,GAAG,GAAG,GAAG,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB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IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,mBAAmB,EAAE,CAAC;CAC/B;AAMD;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,GAAG,GAAG,mBAAmB,CA2DrE;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,aAAa,GAAG,mBAAmB,CA2B5E;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAQ3D;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAG1D;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,YAAY,GAAG,SAAS,GAAG,UAAU,EAAE,CASnF;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,GAAG,GAAG;IAAE,KAAK,EAAE,UAAU,EAAE,CAAC;IAAC,KAAK,EAAE,UAAU,EAAE,CAAA;CAAE,CAM3F;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,YAAY,EAAE;IAAE,KAAK,EAAE,cAAc,EAAE,CAAC;IAAC,KAAK,EAAE,cAAc,EAAE,CAAA;CAAE,GACjE,gBAAgB,EAAE,CA0BpB;AAED,MAAM,WAAW,gBAAgB;IAC/B,UAAU,EAAE,CAAC,GAAG,CAAC,CAAC;IAClB,gBAAgB,EAAE,MAAM,CAAC;IACzB,eAAe,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;CACnB"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { ParsedIONSportMatch } from './ionSportParser';
|
|
2
|
+
export interface IONSportValidationOptions {
|
|
3
|
+
/** Raw IONSport JSON data */
|
|
4
|
+
jsonData: any;
|
|
5
|
+
/** Debug mode — show detailed steps */
|
|
6
|
+
debug?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface IONSportValidationResult {
|
|
9
|
+
valid: boolean;
|
|
10
|
+
errors: string[];
|
|
11
|
+
warnings: string[];
|
|
12
|
+
matchUp: any;
|
|
13
|
+
pointsProcessed: number;
|
|
14
|
+
setsProcessed: number;
|
|
15
|
+
/** Parsed match metadata */
|
|
16
|
+
parsedMatch: ParsedIONSportMatch;
|
|
17
|
+
/** Score string */
|
|
18
|
+
actualScore: string;
|
|
19
|
+
/** Per-set scores from validation */
|
|
20
|
+
setScores: Array<{
|
|
21
|
+
side1: number;
|
|
22
|
+
side2: number;
|
|
23
|
+
}>;
|
|
24
|
+
/** Stats */
|
|
25
|
+
doubleFaults: number;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Validate IONSport match data
|
|
29
|
+
*
|
|
30
|
+
* Main entry point for IONSport validation.
|
|
31
|
+
*/
|
|
32
|
+
export declare function validateIONSportMatch(options: IONSportValidationOptions): IONSportValidationResult;
|
|
33
|
+
//# sourceMappingURL=ionSportValidator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ionSportValidator.d.ts","sourceRoot":"","sources":["../../src/parsers/ionSportValidator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAGL,KAAK,mBAAmB,EAGzB,MAAM,kBAAkB,CAAC;AAQ1B,MAAM,WAAW,yBAAyB;IACxC,6BAA6B;IAC7B,QAAQ,EAAE,GAAG,CAAC;IACd,uCAAuC;IACvC,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,wBAAwB;IACvC,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,EAAE,MAAM,EAAE,CAAC;IAEnB,OAAO,EAAE,GAAG,CAAC;IACb,eAAe,EAAE,MAAM,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC;IAEtB,4BAA4B;IAC5B,WAAW,EAAE,mBAAmB,CAAC;IAEjC,mBAAmB;IACnB,WAAW,EAAE,MAAM,CAAC;IAEpB,qCAAqC;IACrC,SAAS,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAEnD,YAAY;IACZ,YAAY,EAAE,MAAM,CAAC;CACtB;AAMD;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,yBAAyB,GAAG,wBAAwB,CAqFlG"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { PointResult, StrokeType, ServeLocation, RallyShot } from './types';
|
|
2
|
+
export interface PTFMatch {
|
|
3
|
+
players: [string, string];
|
|
4
|
+
format: PTFFormat;
|
|
5
|
+
sets: PTFSet[];
|
|
6
|
+
statistician?: string;
|
|
7
|
+
tournament?: string;
|
|
8
|
+
surface?: string;
|
|
9
|
+
date?: Date;
|
|
10
|
+
round?: string;
|
|
11
|
+
inOut?: string;
|
|
12
|
+
winner?: string;
|
|
13
|
+
startTime?: string;
|
|
14
|
+
finishTime?: string;
|
|
15
|
+
firstServer?: number;
|
|
16
|
+
}
|
|
17
|
+
export interface PTFFormat {
|
|
18
|
+
numberOfSets: number;
|
|
19
|
+
gamesForSet: number;
|
|
20
|
+
setFormat: string;
|
|
21
|
+
finalSetFormat: string;
|
|
22
|
+
advantages: boolean;
|
|
23
|
+
lets: boolean;
|
|
24
|
+
}
|
|
25
|
+
export interface PTFSet {
|
|
26
|
+
setNumber: number;
|
|
27
|
+
winner: string;
|
|
28
|
+
score: Record<string, string>;
|
|
29
|
+
games: PTFGame[];
|
|
30
|
+
finishTime?: string;
|
|
31
|
+
}
|
|
32
|
+
export interface PTFGame {
|
|
33
|
+
gameNumber: number;
|
|
34
|
+
server: string;
|
|
35
|
+
receiver: string;
|
|
36
|
+
winner: string;
|
|
37
|
+
score: Record<string, string>;
|
|
38
|
+
points: PTFPoint[];
|
|
39
|
+
finishTime?: string;
|
|
40
|
+
}
|
|
41
|
+
export interface PTFPoint {
|
|
42
|
+
pointNumber: number;
|
|
43
|
+
winner: string;
|
|
44
|
+
server: string;
|
|
45
|
+
receiver: string;
|
|
46
|
+
score: Record<string, string>;
|
|
47
|
+
shots: PTFShot[];
|
|
48
|
+
rallyLength: number;
|
|
49
|
+
finishTime?: string;
|
|
50
|
+
breakpoint: boolean;
|
|
51
|
+
}
|
|
52
|
+
export interface PTFShot {
|
|
53
|
+
player: string;
|
|
54
|
+
stroke: string;
|
|
55
|
+
strokeType: string;
|
|
56
|
+
result: string;
|
|
57
|
+
x1: number;
|
|
58
|
+
y1: number;
|
|
59
|
+
x2: number;
|
|
60
|
+
y2: number;
|
|
61
|
+
time?: string;
|
|
62
|
+
receiver?: string;
|
|
63
|
+
isKeyShot?: boolean;
|
|
64
|
+
}
|
|
65
|
+
export interface ParsedPTFPoint {
|
|
66
|
+
winningSide: 1 | 2;
|
|
67
|
+
serverSideNumber: 1 | 2;
|
|
68
|
+
result?: PointResult;
|
|
69
|
+
stroke?: StrokeType;
|
|
70
|
+
hand?: 'Forehand' | 'Backhand';
|
|
71
|
+
serveLocation?: ServeLocation;
|
|
72
|
+
rally?: RallyShot[];
|
|
73
|
+
rallyLength?: number;
|
|
74
|
+
timestamp?: string;
|
|
75
|
+
metadata?: {
|
|
76
|
+
coordinates?: Array<{
|
|
77
|
+
x1: number;
|
|
78
|
+
y1: number;
|
|
79
|
+
x2: number;
|
|
80
|
+
y2: number;
|
|
81
|
+
}>;
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Parse PTF CSV rows into structured match data
|
|
86
|
+
*
|
|
87
|
+
* @param csvRows - Array of string arrays (split CSV rows)
|
|
88
|
+
* @returns Structured PTF match
|
|
89
|
+
*/
|
|
90
|
+
export declare function parsePTFContent(csvRows: string[][]): PTFMatch;
|
|
91
|
+
/**
|
|
92
|
+
* Parse a PTF point into engine-compatible format
|
|
93
|
+
*/
|
|
94
|
+
export declare function parsePTFPoint(point: PTFPoint, players: [string, string]): ParsedPTFPoint;
|
|
95
|
+
/**
|
|
96
|
+
* Map PTF format to factory matchUpFormatCode
|
|
97
|
+
*/
|
|
98
|
+
export declare function mapPTFFormat(format: PTFFormat): string;
|
|
99
|
+
/**
|
|
100
|
+
* Classify point result from shot data
|
|
101
|
+
*/
|
|
102
|
+
export declare function classifyResult(shots: PTFShot[]): PointResult;
|
|
103
|
+
/**
|
|
104
|
+
* Map serve location from shot coordinates using angle calculations
|
|
105
|
+
*/
|
|
106
|
+
export declare function mapServeLocation(shot: PTFShot): ServeLocation | undefined;
|
|
107
|
+
/**
|
|
108
|
+
* Decode a UTF-16 LE ArrayBuffer to string (browser-compatible)
|
|
109
|
+
*/
|
|
110
|
+
export declare function decodeUTF16LE(buffer: ArrayBuffer): string;
|
|
111
|
+
/**
|
|
112
|
+
* Split decoded PTF content into CSV rows
|
|
113
|
+
*/
|
|
114
|
+
export declare function splitPTFRows(content: string): string[][];
|
|
115
|
+
//# sourceMappingURL=proTrackerParser.d.ts.map
|