@xpadev-net/niconicomments 0.2.61 → 0.2.63

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 (3) hide show
  1. package/dist/bundle.d.ts +1644 -600
  2. package/dist/bundle.js +2120 -560
  3. package/package.json +17 -17
package/dist/bundle.d.ts CHANGED
@@ -1,45 +1,81 @@
1
1
  /// <reference types="node" />
2
+ import * as valibot from 'valibot';
3
+ import { Output } from 'valibot';
4
+
2
5
  type ButtonList = {
3
- left: ButtonPartLeft;
4
- middle: ButtonPartMiddle[];
5
- right: ButtonPartRight;
6
+ left: ButtonPartLeft;
7
+ middle: ButtonPartMiddle[];
8
+ right: ButtonPartRight;
6
9
  };
7
-
8
10
  type ButtonPartLeft = {
9
- type: "left";
10
- left: number;
11
- top: number;
12
- width: number;
13
- height: number;
11
+ type: "left";
12
+ left: number;
13
+ top: number;
14
+ width: number;
15
+ height: number;
14
16
  };
15
-
16
17
  type ButtonPartMiddle = {
17
- type: "middle";
18
- left: number;
19
- top: number;
20
- width: number;
21
- height: number;
18
+ type: "middle";
19
+ left: number;
20
+ top: number;
21
+ width: number;
22
+ height: number;
22
23
  };
23
-
24
24
  type ButtonPartRight = {
25
- type: "right";
26
- right: number;
27
- top: number;
28
- height: number;
25
+ type: "right";
26
+ right: number;
27
+ top: number;
28
+ height: number;
29
29
  };
30
30
 
31
31
  type Canvas = HTMLCanvasElement;
32
32
  type Context2D = CanvasRenderingContext2D;
33
33
 
34
34
  type DefaultCommand = {
35
- color?: string;
36
- size?: CommentSize;
37
- font?: CommentFont;
38
- loc?: CommentLoc;
35
+ color?: string;
36
+ size?: CommentSize;
37
+ font?: CommentFont;
38
+ loc?: CommentLoc;
39
39
  };
40
40
 
41
+ interface IRenderer {
42
+ readonly canvas: HTMLCanvasElement;
43
+ readonly video?: HTMLVideoElement;
44
+ destroy(): void;
45
+ drawVideo(enableLegacyPip: boolean): void;
46
+ getFont(): string;
47
+ getFillStyle(): string | CanvasGradient | CanvasPattern;
48
+ setScale(scale: number, arg1?: number): void;
49
+ fillRect(x: number, y: number, width: number, height: number): void;
50
+ strokeRect(x: number, y: number, width: number, height: number): void;
51
+ fillText(text: string, x: number, y: number): void;
52
+ strokeText(text: string, x: number, y: number): void;
53
+ quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void;
54
+ clearRect(x: number, y: number, width: number, height: number): void;
55
+ setFont(font: string): void;
56
+ setFillStyle(color: string): void;
57
+ setStrokeStyle(color: string): void;
58
+ setLineWidth(width: number): void;
59
+ setGlobalAlpha(alpha: number): void;
60
+ setSize(width: number, height: number): void;
61
+ getSize(): {
62
+ width: number;
63
+ height: number;
64
+ };
65
+ measureText(text: string): TextMetrics;
66
+ beginPath(): void;
67
+ closePath(): void;
68
+ moveTo(x: number, y: number): void;
69
+ lineTo(x: number, y: number): void;
70
+ stroke(): void;
71
+ save(): void;
72
+ restore(): void;
73
+ getCanvas(): IRenderer;
74
+ drawImage(image: IRenderer, x: number, y: number, width?: number, height?: number): void;
75
+ }
76
+
41
77
  declare class BaseComment implements IComment {
42
- protected readonly context: Context2D;
78
+ protected readonly renderer: IRenderer;
43
79
  protected cacheKey: string;
44
80
  comment: FormattedCommentWithSize;
45
81
  pos: {
@@ -48,11 +84,11 @@ declare class BaseComment implements IComment {
48
84
  };
49
85
  posY: number;
50
86
  readonly pluginName: string;
51
- image?: Canvas | null;
52
- buttonImage?: Canvas | null;
53
- constructor(comment: FormattedComment, context: Context2D);
87
+ image?: IRenderer | null;
88
+ buttonImage?: IRenderer | null;
89
+ constructor(comment: FormattedComment, renderer: IRenderer);
54
90
  get invisible(): boolean;
55
- get loc(): CommentLoc;
91
+ get loc(): "ue" | "naka" | "shita";
56
92
  get long(): number;
57
93
  get vpos(): number;
58
94
  get width(): number;
@@ -74,55 +110,72 @@ declare class BaseComment implements IComment {
74
110
  protected _drawBackgroundColor(posX: number, posY: number): void;
75
111
  protected _drawDebugInfo(posX: number, posY: number): void;
76
112
  protected _drawCollision(posX: number, posY: number, showCollision: boolean): void;
77
- protected getTextImage(): Canvas | null;
78
- protected _generateTextImage(): Canvas;
79
- protected _cacheImage(image: Canvas): void;
80
- protected createCanvas(): {
81
- image: Canvas;
82
- context: Context2D;
83
- };
84
- protected getButtonImage(posX: number, posY: number, cursor?: Position): Canvas | undefined;
113
+ protected getTextImage(): IRenderer | null;
114
+ protected _generateTextImage(): IRenderer;
115
+ protected _cacheImage(image: IRenderer): void;
116
+ protected getButtonImage(posX: number, posY: number, cursor?: Position): IRenderer | undefined;
85
117
  isHovered(cursor?: Position, posX?: number, posY?: number): boolean;
118
+ protected getCacheKey(): string;
86
119
  }
87
120
 
88
121
  declare class FlashComment extends BaseComment {
89
122
  private _globalScale;
90
123
  readonly pluginName: string;
91
- buttonImage: Canvas;
92
- protected buttonContext: Context2D;
93
- constructor(comment: FormattedComment, context: Context2D);
124
+ buttonImage: IRenderer;
125
+ constructor(comment: FormattedComment, renderer: IRenderer);
94
126
  get content(): string;
95
127
  set content(input: string);
96
128
  convertComment(comment: FormattedComment): FormattedCommentWithSize;
97
129
  getCommentSize(parsedData: FormattedCommentWithFont): FormattedCommentWithSize;
98
130
  parseCommandAndNicoscript(comment: FormattedComment): FormattedCommentWithFont;
99
131
  parseContent(input: string, button?: ButtonParams): {
100
- content: CommentContentItem[];
132
+ content: ({
133
+ type: "spacer";
134
+ char: string;
135
+ charWidth: number;
136
+ count: number;
137
+ isButton?: boolean | undefined;
138
+ font?: "defont" | "gulim" | "simsun" | undefined;
139
+ } | {
140
+ type: "text";
141
+ content: string;
142
+ slicedContent: string[];
143
+ isButton?: boolean | undefined;
144
+ font?: "defont" | "gulim" | "simsun" | undefined;
145
+ width?: number[] | undefined;
146
+ })[];
101
147
  lineCount: number;
102
148
  lineOffset: number;
103
149
  };
104
150
  measureText(comment: MeasureTextInput): MeasureTextResult;
151
+ private _isDoubleResize;
105
152
  private _measureContent;
106
153
  _drawCollision(posX: number, posY: number, showCollision: boolean): void;
107
- _generateTextImage(): Canvas;
108
- getButtonImage(posX: number, posY: number, cursor?: Position): HTMLCanvasElement | undefined;
154
+ _generateTextImage(): IRenderer;
155
+ getButtonImage(posX: number, posY: number, cursor?: Position): IRenderer | undefined;
109
156
  isHovered(_cursor?: Position, _posX?: number, _posY?: number): boolean;
110
- protected _setupCanvas(image: Canvas, context: Context2D): {
111
- image: HTMLCanvasElement;
112
- context: CanvasRenderingContext2D;
157
+ protected _setupCanvas(renderer: IRenderer): {
158
+ renderer: IRenderer;
113
159
  };
114
160
  }
115
161
 
116
162
  declare class HTML5Comment extends BaseComment {
117
163
  readonly pluginName: string;
118
- constructor(comment: FormattedComment, context: Context2D);
164
+ constructor(comment: FormattedComment, context: IRenderer);
119
165
  get content(): string;
120
166
  set content(input: string);
121
167
  convertComment(comment: FormattedComment): FormattedCommentWithSize;
122
168
  getCommentSize(parsedData: FormattedCommentWithFont): FormattedCommentWithSize;
123
169
  parseCommandAndNicoscript(comment: FormattedComment): FormattedCommentWithFont;
124
- parseContent(input: string): {
125
- content: CommentContentItem[];
170
+ parseContent(input: string, font?: HTML5Fonts): {
171
+ content: {
172
+ type: "text";
173
+ content: string;
174
+ slicedContent: string[];
175
+ isButton?: boolean | undefined;
176
+ font?: "defont" | "gulim" | "simsun" | undefined;
177
+ width?: number[] | undefined;
178
+ }[];
126
179
  lineCount: number;
127
180
  lineOffset: number;
128
181
  };
@@ -130,598 +183,1065 @@ declare class HTML5Comment extends BaseComment {
130
183
  private _measureComment;
131
184
  private _processResizeX;
132
185
  _drawCollision(posX: number, posY: number, showCollision: boolean): void;
133
- _generateTextImage(): Canvas;
186
+ _generateTextImage(): IRenderer;
134
187
  getButtonImage(): undefined;
135
188
  isHovered(): boolean;
136
189
  }
137
190
 
138
- type index_d$3_BaseComment = BaseComment;
139
- declare const index_d$3_BaseComment: typeof BaseComment;
140
- type index_d$3_FlashComment = FlashComment;
141
- declare const index_d$3_FlashComment: typeof FlashComment;
142
- type index_d$3_HTML5Comment = HTML5Comment;
143
- declare const index_d$3_HTML5Comment: typeof HTML5Comment;
144
- declare namespace index_d$3 {
145
- export { index_d$3_BaseComment as BaseComment, index_d$3_FlashComment as FlashComment, index_d$3_HTML5Comment as HTML5Comment };
191
+ type index_d$4_BaseComment = BaseComment;
192
+ declare const index_d$4_BaseComment: typeof BaseComment;
193
+ type index_d$4_FlashComment = FlashComment;
194
+ declare const index_d$4_FlashComment: typeof FlashComment;
195
+ type index_d$4_HTML5Comment = HTML5Comment;
196
+ declare const index_d$4_HTML5Comment: typeof HTML5Comment;
197
+ declare namespace index_d$4 {
198
+ export { index_d$4_BaseComment as BaseComment, index_d$4_FlashComment as FlashComment, index_d$4_HTML5Comment as HTML5Comment };
146
199
  }
147
200
 
148
201
  type ConfigItem<T> = T | MultiConfigItem<T>;
149
- type MultiConfigItem<T> = { html5: T; flash: T };
150
- type ConfigSizeItem<T> = { big: T; medium: T; small: T };
151
- type ConfigResizedItem<T> = { default: T; resized: T };
152
-
202
+ type MultiConfigItem<T> = {
203
+ html5: T;
204
+ flash: T;
205
+ };
206
+ type ConfigSizeItem<T> = {
207
+ big: T;
208
+ medium: T;
209
+ small: T;
210
+ };
211
+ type ConfigResizedItem<T> = {
212
+ default: T;
213
+ resized: T;
214
+ };
215
+ type ConfigFlashFontItem<T> = {
216
+ gulim: T;
217
+ simsun: T;
218
+ defont: T;
219
+ };
220
+ type ConfigHTML5FontItem<T> = {
221
+ gothic: T;
222
+ mincho: T;
223
+ defont: T;
224
+ };
153
225
  type CommentStageSize = {
154
- width: number;
155
- fullWidth: number;
156
- height: number;
226
+ width: number;
227
+ fullWidth: number;
228
+ height: number;
157
229
  };
158
-
159
230
  type FlashCharList = {
160
- [key in "simsunStrong" | "simsunWeak" | "gulim" | "gothic"]: string;
231
+ [key in "simsunStrong" | "simsunWeak" | "gulim" | "gothic"]: string;
161
232
  };
162
233
  type FlashMode = "xp" | "vista";
163
234
  type FlashScriptChar = {
164
- [key in "super" | "sub"]: string;
235
+ [key in "super" | "sub"]: string;
165
236
  };
166
237
  type FontList = {
167
- [key in "gulim" | "simsun"]: string;
238
+ [key in "gulim" | "simsun"]: string;
168
239
  };
169
240
  type LineCounts = {
170
- [key in "default" | "resized" | "doubleResized"]: ConfigSizeItem<number>;
241
+ [key in "default" | "resized" | "doubleResized"]: ConfigSizeItem<number>;
171
242
  };
172
- type TypeDoubleResizeMaxWidth = {
173
- [key in "full" | "normal"]: number;
174
- };
175
-
176
243
  type BaseConfig = {
177
- cacheAge: number;
178
- canvasHeight: number;
179
- canvasWidth: number;
180
- collisionRange: { [key in "left" | "right"]: number };
181
- colors: { [key: string]: string };
182
- commentDrawPadding: number;
183
- commentDrawRange: number;
184
- commentScale: ConfigItem<number>;
185
- CommentStageSize: ConfigItem<CommentStageSize>;
186
- commentYMarginBottom: ConfigSizeItem<number>;
187
- commentYOffset: ConfigSizeItem<ConfigResizedItem<number>>;
188
- commentYPaddingTop: ConfigResizedItem<number>;
189
- contextFillLiveOpacity: number;
190
- contextLineWidth: ConfigItem<number>;
191
- contextStrokeColor: string;
192
- contextStrokeInversionColor: string;
193
- contextStrokeOpacity: number;
194
- doubleResizeMaxWidth: ConfigItem<TypeDoubleResizeMaxWidth>;
195
- flashChar: FlashCharList;
196
- FlashMode: FlashMode;
197
- FlashScriptChar: FlashScriptChar;
198
- flashThreshold: number;
199
- font: FontList;
200
- fonts: PlatformFont;
201
- fontSize: ConfigItem<ConfigSizeItem<ConfigResizedItem<number>>>;
202
- fpsInterval: number;
203
- hiResCommentCorrection: number;
204
- lineCounts: ConfigItem<LineCounts>;
205
- lineHeight: ConfigItem<ConfigSizeItem<ConfigResizedItem<number>>>;
206
- minFontSize: number;
207
- sameCAGap: number;
208
- sameCAMinScore: number;
209
- sameCARange: number;
210
- sameCATimestampRange: number;
211
- letterSpacing: number;
212
- scriptCharOffset: number;
213
- plugins: IPluginConstructor[];
214
- commentPlugins: {
215
- class: typeof BaseComment;
216
- condition: (comment: FormattedComment) => boolean;
217
- }[];
218
- commentLimit: number | undefined;
219
- hideCommentOrder: "asc" | "desc";
220
- lineBreakCount: { [key in CommentSize]: number };
221
- nakaCommentSpeedOffset: number;
222
- atButtonPadding: number;
223
- atButtonRadius: number;
244
+ cacheAge: number;
245
+ canvasHeight: number;
246
+ canvasWidth: number;
247
+ collisionRange: {
248
+ [key in "left" | "right"]: number;
249
+ };
250
+ collisionPadding: number;
251
+ colors: {
252
+ [key: string]: string;
253
+ };
254
+ commentDrawPadding: number;
255
+ commentDrawRange: number;
256
+ commentScale: ConfigItem<number>;
257
+ commentStageSize: ConfigItem<CommentStageSize>;
258
+ flashCommentYOffset: ConfigSizeItem<ConfigResizedItem<number>>;
259
+ flashCommentYPaddingTop: ConfigResizedItem<number>;
260
+ contextFillLiveOpacity: number;
261
+ contextLineWidth: ConfigItem<number>;
262
+ contextStrokeColor: string;
263
+ contextStrokeInversionColor: string;
264
+ contextStrokeOpacity: number;
265
+ flashChar: FlashCharList;
266
+ flashMode: FlashMode;
267
+ flashScriptChar: FlashScriptChar;
268
+ flashThreshold: number;
269
+ fonts: {
270
+ flash: FontList;
271
+ html5: PlatformFont;
272
+ };
273
+ fontSize: ConfigItem<ConfigSizeItem<ConfigResizedItem<number>>>;
274
+ fpsInterval: number;
275
+ html5HiResCommentCorrection: number;
276
+ html5LineCounts: ConfigItem<LineCounts>;
277
+ lineHeight: ConfigItem<ConfigSizeItem<ConfigResizedItem<number>>>;
278
+ html5MinFontSize: number;
279
+ sameCAGap: number;
280
+ sameCAMinScore: number;
281
+ sameCARange: number;
282
+ sameCATimestampRange: number;
283
+ flashLetterSpacing: number;
284
+ flashScriptCharOffset: number;
285
+ plugins: IPluginConstructor[];
286
+ commentPlugins: {
287
+ class: typeof BaseComment;
288
+ condition: (comment: FormattedComment) => boolean;
289
+ }[];
290
+ commentLimit: number | undefined;
291
+ hideCommentOrder: "asc" | "desc";
292
+ lineBreakCount: {
293
+ [key in CommentSize]: number;
294
+ };
295
+ nakaCommentSpeedOffset: number;
296
+ atButtonPadding: number;
297
+ atButtonRadius: number;
298
+ flashDoubleResizeHeights: Partial<ConfigSizeItem<{
299
+ [key: number]: number;
300
+ }>>;
301
+ flashLineBreakScale: ConfigSizeItem<number>;
302
+ compatSpacer: {
303
+ flash: {
304
+ [key: string]: Partial<ConfigFlashFontItem<number>>;
305
+ };
306
+ html5: {
307
+ [key: string]: Partial<ConfigHTML5FontItem<number>>;
308
+ };
309
+ };
224
310
  };
225
-
226
311
  type Config = Partial<BaseConfig>;
227
312
 
228
313
  type Position = {
229
- x: number;
230
- y: number;
314
+ x: number;
315
+ y: number;
231
316
  };
232
317
 
233
318
  interface CommentEventBase {
234
- type: CommentEventName;
235
- timeStamp: number;
236
- vpos: number;
319
+ type: CommentEventName;
320
+ timeStamp: number;
321
+ vpos: number;
237
322
  }
238
-
239
323
  interface SeekDisableEvent extends CommentEventBase {
240
- type: "seekDisable";
324
+ type: "seekDisable";
241
325
  }
242
-
243
326
  type SeekDisableEventHandler = (event: SeekDisableEvent) => unknown;
244
-
245
327
  interface SeekEnableEvent extends CommentEventBase {
246
- type: "seekEnable";
328
+ type: "seekEnable";
247
329
  }
248
330
  type SeekEnableEventHandler = (event: SeekEnableEvent) => unknown;
249
-
250
331
  interface CommentDisableEvent extends CommentEventBase {
251
- type: "commentDisable";
332
+ type: "commentDisable";
252
333
  }
253
- type CommentDisableEventHandler = (
254
- event: CommentDisableEvent,
255
- ) => unknown;
256
-
334
+ type CommentDisableEventHandler = (event: CommentDisableEvent) => unknown;
257
335
  interface CommentEnableEvent extends CommentEventBase {
258
- type: "commentEnable";
336
+ type: "commentEnable";
259
337
  }
260
338
  type CommentEnableEventHandler = (event: CommentEnableEvent) => unknown;
261
-
262
339
  interface JumpEvent extends CommentEventBase {
263
- type: "jump";
264
- to: string;
265
- message?: string;
340
+ type: "jump";
341
+ to: string;
342
+ message?: string;
266
343
  }
267
344
  type JumpEventHandler = (event: JumpEvent) => unknown;
268
-
269
- type CommentEventName =
270
- | "seekDisable"
271
- | "seekEnable"
272
- | "commentDisable"
273
- | "commentEnable"
274
- | "jump";
275
- type CommentEventHandler =
276
- | SeekDisableEventHandler
277
- | SeekEnableEventHandler
278
- | CommentDisableEventHandler
279
- | CommentEnableEventHandler
280
- | JumpEventHandler;
345
+ type CommentEventName = "seekDisable" | "seekEnable" | "commentDisable" | "commentEnable" | "jump";
346
+ type CommentEventHandler = SeekDisableEventHandler | SeekEnableEventHandler | CommentDisableEventHandler | CommentEnableEventHandler | JumpEventHandler;
281
347
  interface CommentEventHandlerMap {
282
- seekDisable: SeekDisableEventHandler;
283
- seekEnable: SeekEnableEventHandler;
284
- commentDisable: CommentDisableEventHandler;
285
- commentEnable: CommentEnableEventHandler;
286
- jump: JumpEventHandler;
348
+ seekDisable: SeekDisableEventHandler;
349
+ seekEnable: SeekEnableEventHandler;
350
+ commentDisable: CommentDisableEventHandler;
351
+ commentEnable: CommentEnableEventHandler;
352
+ jump: JumpEventHandler;
287
353
  }
288
354
  interface CommentEventMap {
289
- seekDisable: SeekDisableEvent;
290
- seekEnable: SeekEnableEvent;
291
- commentDisable: CommentDisableEvent;
292
- commentEnable: CommentEnableEvent;
293
- jump: JumpEvent;
355
+ seekDisable: SeekDisableEvent;
356
+ seekEnable: SeekEnableEvent;
357
+ commentDisable: CommentDisableEvent;
358
+ commentEnable: CommentEnableEvent;
359
+ jump: JumpEvent;
294
360
  }
295
361
 
296
- type Platform =
297
- | "win7"
298
- | "win8_1"
299
- | "win"
300
- | "mac10_9"
301
- | "mac10_11"
302
- | "mac"
303
- | "other";
304
- type HTML5Fonts = "gothic" | "mincho" | "defont";
362
+ type Platform = "win7" | "win8_1" | "win" | "mac10_9" | "mac10_11" | "mac" | "other";
363
+ declare const ZHTML5Fonts: valibot.UnionSchema<[valibot.LiteralSchema<"gothic", "gothic">, valibot.LiteralSchema<"mincho", "mincho">, valibot.LiteralSchema<"defont", "defont">], "defont" | "mincho" | "gothic">;
364
+ type HTML5Fonts = Output<typeof ZHTML5Fonts>;
305
365
  type FontItem = {
306
- font: string;
307
- offset: number;
308
- weight: number;
366
+ font: string;
367
+ offset: number;
368
+ weight: number;
309
369
  };
310
370
  type PlatformFont = {
311
- [key in HTML5Fonts]: FontItem;
371
+ [key in HTML5Fonts]: FontItem;
312
372
  };
313
373
 
314
- type FormattedComment = {
315
- id: number;
316
- vpos: number;
317
- content: string;
318
- date: number;
319
- date_usec: number;
320
- owner: boolean;
321
- premium: boolean;
322
- mail: string[];
323
- user_id: number;
324
- layer: number;
325
- is_my_post: boolean;
326
- };
327
- type FormattedLegacyComment = {
328
- id: number;
329
- vpos: number;
330
- content: string;
331
- date: number;
332
- date_usec: number;
333
- owner: boolean;
334
- premium: boolean;
335
- mail: string[];
336
- };
337
-
338
- /**
339
- * @deprecated
340
- */
374
+ declare const ZFormattedComment: valibot.ObjectSchema<{
375
+ id: valibot.OptionalSchema<valibot.NumberSchema<number>, 0, number>;
376
+ vpos: valibot.OptionalSchema<valibot.NumberSchema<number>, 0, number>;
377
+ content: valibot.OptionalSchema<valibot.StringSchema<string>, "", string>;
378
+ date: valibot.OptionalSchema<valibot.NumberSchema<number>, 0, number>;
379
+ date_usec: valibot.OptionalSchema<valibot.NumberSchema<number>, 0, number>;
380
+ owner: valibot.OptionalSchema<valibot.BooleanSchema<boolean>, false, boolean>;
381
+ premium: valibot.OptionalSchema<valibot.BooleanSchema<boolean>, false, boolean>;
382
+ mail: valibot.OptionalSchema<valibot.ArraySchema<valibot.StringSchema<string>, string[]>, never[], string[]>;
383
+ user_id: valibot.OptionalSchema<valibot.NumberSchema<number>, 0, number>;
384
+ layer: valibot.OptionalSchema<valibot.NumberSchema<number>, -1, number>;
385
+ is_my_post: valibot.OptionalSchema<valibot.BooleanSchema<boolean>, false, boolean>;
386
+ }, undefined, {
387
+ owner: boolean;
388
+ content: string;
389
+ id: number;
390
+ vpos: number;
391
+ date: number;
392
+ date_usec: number;
393
+ premium: boolean;
394
+ mail: string[];
395
+ user_id: number;
396
+ layer: number;
397
+ is_my_post: boolean;
398
+ }>;
399
+ type FormattedComment = Output<typeof ZFormattedComment>;
400
+ declare const ZFormattedLegacyComment: valibot.ObjectSchema<Omit<{
401
+ id: valibot.OptionalSchema<valibot.NumberSchema<number>, 0, number>;
402
+ vpos: valibot.OptionalSchema<valibot.NumberSchema<number>, 0, number>;
403
+ content: valibot.OptionalSchema<valibot.StringSchema<string>, "", string>;
404
+ date: valibot.OptionalSchema<valibot.NumberSchema<number>, 0, number>;
405
+ date_usec: valibot.OptionalSchema<valibot.NumberSchema<number>, 0, number>;
406
+ owner: valibot.OptionalSchema<valibot.BooleanSchema<boolean>, false, boolean>;
407
+ premium: valibot.OptionalSchema<valibot.BooleanSchema<boolean>, false, boolean>;
408
+ mail: valibot.OptionalSchema<valibot.ArraySchema<valibot.StringSchema<string>, string[]>, never[], string[]>;
409
+ user_id: valibot.OptionalSchema<valibot.NumberSchema<number>, 0, number>;
410
+ layer: valibot.OptionalSchema<valibot.NumberSchema<number>, -1, number>;
411
+ is_my_post: valibot.OptionalSchema<valibot.BooleanSchema<boolean>, false, boolean>;
412
+ }, "user_id" | "layer" | "is_my_post">, undefined, {
413
+ owner: boolean;
414
+ content: string;
415
+ id: number;
416
+ vpos: number;
417
+ date: number;
418
+ date_usec: number;
419
+ premium: boolean;
420
+ mail: string[];
421
+ }>;
422
+ type FormattedLegacyComment = Output<typeof ZFormattedLegacyComment>;
341
423
  type formattedComment = FormattedComment;
342
- /**
343
- * @deprecated
344
- */
345
424
  type formattedLegacyComment = FormattedLegacyComment;
346
425
 
347
- type RawApiResponse = {
348
- [key: string]: ApiPing | ApiThread | ApiLeaf | ApiGlobalNumRes | ApiChat;
349
- };
350
- type ApiPing = {
351
- content: string;
352
- };
353
- type ApiThread = {
354
- resultcode: number;
355
- thread: string;
356
- server_time: number;
357
- ticket: string;
358
- revision: number;
359
- };
360
- type ApiLeaf = {
361
- thread: string;
362
- count: number;
363
- };
364
- type ApiGlobalNumRes = {
365
- thread: string;
366
- num_res: number;
367
- };
368
- type ApiChat = {
369
- thread: string;
370
- no: number;
371
- vpos: number;
372
- date: number;
373
- date_usec: number;
374
- nicoru: number;
375
- premium: number;
376
- anonymity: number;
377
- user_id: string;
378
- mail: string;
379
- content: string;
380
- deleted: number;
381
- };
382
-
383
- /**
384
- * @deprecated
385
- */
426
+ declare const ZApiChat: valibot.ObjectSchema<{
427
+ thread: valibot.OptionalSchema<valibot.StringSchema<string>, "", string>;
428
+ no: valibot.OptionalSchema<valibot.NumberSchema<number>, 0, number>;
429
+ vpos: valibot.NumberSchema<number>;
430
+ date: valibot.OptionalSchema<valibot.NumberSchema<number>, 0, number>;
431
+ date_usec: valibot.OptionalSchema<valibot.NumberSchema<number>, 0, number>;
432
+ nicoru: valibot.OptionalSchema<valibot.NumberSchema<number>, 0, number>;
433
+ premium: valibot.OptionalSchema<valibot.NumberSchema<number>, 0, number>;
434
+ anonymity: valibot.OptionalSchema<valibot.NumberSchema<number>, 0, number>;
435
+ user_id: valibot.OptionalSchema<valibot.StringSchema<string>, "", string>;
436
+ mail: valibot.OptionalSchema<valibot.StringSchema<string>, "", string>;
437
+ content: valibot.StringSchema<string>;
438
+ deleted: valibot.OptionalSchema<valibot.NumberSchema<number>, 0, number>;
439
+ }, undefined, {
440
+ content: string;
441
+ vpos: number;
442
+ date: number;
443
+ date_usec: number;
444
+ premium: number;
445
+ mail: string;
446
+ user_id: string;
447
+ thread: string;
448
+ no: number;
449
+ nicoru: number;
450
+ anonymity: number;
451
+ deleted: number;
452
+ }>;
453
+ type ApiChat = Output<typeof ZApiChat>;
454
+ declare const ZRawApiResponse: valibot.UnionSchema<[valibot.ObjectSchema<{
455
+ chat: valibot.ObjectSchema<{
456
+ thread: valibot.OptionalSchema<valibot.StringSchema<string>, "", string>;
457
+ no: valibot.OptionalSchema<valibot.NumberSchema<number>, 0, number>;
458
+ vpos: valibot.NumberSchema<number>;
459
+ date: valibot.OptionalSchema<valibot.NumberSchema<number>, 0, number>;
460
+ date_usec: valibot.OptionalSchema<valibot.NumberSchema<number>, 0, number>;
461
+ nicoru: valibot.OptionalSchema<valibot.NumberSchema<number>, 0, number>;
462
+ premium: valibot.OptionalSchema<valibot.NumberSchema<number>, 0, number>;
463
+ anonymity: valibot.OptionalSchema<valibot.NumberSchema<number>, 0, number>;
464
+ user_id: valibot.OptionalSchema<valibot.StringSchema<string>, "", string>;
465
+ mail: valibot.OptionalSchema<valibot.StringSchema<string>, "", string>;
466
+ content: valibot.StringSchema<string>;
467
+ deleted: valibot.OptionalSchema<valibot.NumberSchema<number>, 0, number>;
468
+ }, undefined, {
469
+ content: string;
470
+ vpos: number;
471
+ date: number;
472
+ date_usec: number;
473
+ premium: number;
474
+ mail: string;
475
+ user_id: string;
476
+ thread: string;
477
+ no: number;
478
+ nicoru: number;
479
+ anonymity: number;
480
+ deleted: number;
481
+ }>;
482
+ }, undefined, {
483
+ chat: {
484
+ content: string;
485
+ vpos: number;
486
+ date: number;
487
+ date_usec: number;
488
+ premium: number;
489
+ mail: string;
490
+ user_id: string;
491
+ thread: string;
492
+ no: number;
493
+ nicoru: number;
494
+ anonymity: number;
495
+ deleted: number;
496
+ };
497
+ }>, valibot.RecordSchema<valibot.StringSchema<string>, valibot.UnknownSchema<unknown>, {
498
+ [x: string]: unknown;
499
+ }>], {
500
+ chat: {
501
+ content: string;
502
+ vpos: number;
503
+ date: number;
504
+ date_usec: number;
505
+ premium: number;
506
+ mail: string;
507
+ user_id: string;
508
+ thread: string;
509
+ no: number;
510
+ nicoru: number;
511
+ anonymity: number;
512
+ deleted: number;
513
+ };
514
+ } | {
515
+ [x: string]: unknown;
516
+ }>;
517
+ type RawApiResponse = Output<typeof ZRawApiResponse>;
518
+ declare const ZApiPing: valibot.ObjectSchema<{
519
+ content: valibot.StringSchema<string>;
520
+ }, undefined, {
521
+ content: string;
522
+ }>;
523
+ type ApiPing = Output<typeof ZApiPing>;
524
+ declare const ZApiThread: valibot.ObjectSchema<{
525
+ resultcode: valibot.NumberSchema<number>;
526
+ thread: valibot.StringSchema<string>;
527
+ server_time: valibot.NumberSchema<number>;
528
+ ticket: valibot.StringSchema<string>;
529
+ revision: valibot.NumberSchema<number>;
530
+ }, undefined, {
531
+ thread: string;
532
+ resultcode: number;
533
+ server_time: number;
534
+ ticket: string;
535
+ revision: number;
536
+ }>;
537
+ type ApiThread = Output<typeof ZApiThread>;
538
+ declare const ZApiLeaf: valibot.ObjectSchema<{
539
+ thread: valibot.StringSchema<string>;
540
+ count: valibot.NumberSchema<number>;
541
+ }, undefined, {
542
+ count: number;
543
+ thread: string;
544
+ }>;
545
+ type ApiLeaf = Output<typeof ZApiLeaf>;
546
+ declare const ZApiGlobalNumRes: valibot.ObjectSchema<{
547
+ thread: valibot.StringSchema<string>;
548
+ num_res: valibot.NumberSchema<number>;
549
+ }, undefined, {
550
+ thread: string;
551
+ num_res: number;
552
+ }>;
553
+ type ApiGlobalNumRes = Output<typeof ZApiGlobalNumRes>;
386
554
  type rawApiResponse = RawApiResponse;
387
555
 
388
- type OwnerComment = {
389
- time: string;
390
- command: string;
391
- comment: string;
392
- };
393
-
394
- /**
395
- * @deprecated
396
- */
556
+ declare const ZOwnerComment: valibot.ObjectSchema<{
557
+ time: valibot.StringSchema<string>;
558
+ command: valibot.StringSchema<string>;
559
+ comment: valibot.StringSchema<string>;
560
+ }, undefined, {
561
+ time: string;
562
+ command: string;
563
+ comment: string;
564
+ }>;
565
+ type OwnerComment = Output<typeof ZOwnerComment>;
397
566
  type ownerComment = OwnerComment;
398
567
 
399
- type V1Thread = {
400
- id: string;
401
- fork: string;
402
- commentCount: number;
403
- comments: V1Comment[];
404
- };
405
- type V1Comment = {
406
- id: string;
407
- no: number;
408
- vposMs: number;
409
- body: string;
410
- commands: string[];
411
- userId: string;
412
- isPremium: boolean;
413
- score: number;
414
- postedAt: string;
415
- nicoruCount: number;
416
- nicoruId: undefined;
417
- source: string;
418
- isMyPost: boolean;
419
- };
420
-
421
- /**
422
- * @deprecated
423
- */
568
+ declare const ZV1Comment: valibot.ObjectSchema<{
569
+ id: valibot.StringSchema<string>;
570
+ no: valibot.NumberSchema<number>;
571
+ vposMs: valibot.NumberSchema<number>;
572
+ body: valibot.StringSchema<string>;
573
+ commands: valibot.ArraySchema<valibot.StringSchema<string>, string[]>;
574
+ userId: valibot.StringSchema<string>;
575
+ isPremium: valibot.BooleanSchema<boolean>;
576
+ score: valibot.NumberSchema<number>;
577
+ postedAt: valibot.StringSchema<string>;
578
+ nicoruCount: valibot.NumberSchema<number>;
579
+ nicoruId: valibot.NullableSchema<valibot.StringSchema<string>, undefined, string | null>;
580
+ source: valibot.StringSchema<string>;
581
+ isMyPost: valibot.BooleanSchema<boolean>;
582
+ }, undefined, {
583
+ id: string;
584
+ no: number;
585
+ vposMs: number;
586
+ body: string;
587
+ commands: string[];
588
+ userId: string;
589
+ isPremium: boolean;
590
+ score: number;
591
+ postedAt: string;
592
+ nicoruCount: number;
593
+ nicoruId: string | null;
594
+ source: string;
595
+ isMyPost: boolean;
596
+ }>;
597
+ type V1Comment = Output<typeof ZV1Comment>;
598
+ declare const ZV1Thread: valibot.ObjectSchema<{
599
+ id: valibot.UnknownSchema<unknown>;
600
+ fork: valibot.StringSchema<string>;
601
+ commentCount: valibot.OptionalSchema<valibot.NumberSchema<number>, 0, number>;
602
+ comments: valibot.ArraySchema<valibot.ObjectSchema<{
603
+ id: valibot.StringSchema<string>;
604
+ no: valibot.NumberSchema<number>;
605
+ vposMs: valibot.NumberSchema<number>;
606
+ body: valibot.StringSchema<string>;
607
+ commands: valibot.ArraySchema<valibot.StringSchema<string>, string[]>;
608
+ userId: valibot.StringSchema<string>;
609
+ isPremium: valibot.BooleanSchema<boolean>;
610
+ score: valibot.NumberSchema<number>;
611
+ postedAt: valibot.StringSchema<string>;
612
+ nicoruCount: valibot.NumberSchema<number>;
613
+ nicoruId: valibot.NullableSchema<valibot.StringSchema<string>, undefined, string | null>;
614
+ source: valibot.StringSchema<string>;
615
+ isMyPost: valibot.BooleanSchema<boolean>;
616
+ }, undefined, {
617
+ id: string;
618
+ no: number;
619
+ vposMs: number;
620
+ body: string;
621
+ commands: string[];
622
+ userId: string;
623
+ isPremium: boolean;
624
+ score: number;
625
+ postedAt: string;
626
+ nicoruCount: number;
627
+ nicoruId: string | null;
628
+ source: string;
629
+ isMyPost: boolean;
630
+ }>, {
631
+ id: string;
632
+ no: number;
633
+ vposMs: number;
634
+ body: string;
635
+ commands: string[];
636
+ userId: string;
637
+ isPremium: boolean;
638
+ score: number;
639
+ postedAt: string;
640
+ nicoruCount: number;
641
+ nicoruId: string | null;
642
+ source: string;
643
+ isMyPost: boolean;
644
+ }[]>;
645
+ }, undefined, {
646
+ fork: string;
647
+ commentCount: number;
648
+ comments: {
649
+ id: string;
650
+ no: number;
651
+ vposMs: number;
652
+ body: string;
653
+ commands: string[];
654
+ userId: string;
655
+ isPremium: boolean;
656
+ score: number;
657
+ postedAt: string;
658
+ nicoruCount: number;
659
+ nicoruId: string | null;
660
+ source: string;
661
+ isMyPost: boolean;
662
+ }[];
663
+ id?: unknown;
664
+ }>;
665
+ type V1Thread = Output<typeof ZV1Thread>;
424
666
  type v1Thread = V1Thread;
425
667
 
426
668
  interface IComment {
427
- comment: FormattedCommentWithSize;
428
- invisible: boolean;
429
- loc: CommentLoc;
430
- width: number;
431
- long: number;
432
- height: number;
433
- vpos: number;
434
- flash: boolean;
435
- posY: number;
436
- owner: boolean;
437
- layer: number;
438
- mail: string[];
439
- content: string;
440
- image?: Canvas | null;
441
- draw: (vpos: number, showCollision: boolean, cursor?: Position) => void;
442
- isHovered: (cursor?: Position, posX?: number, posY?: number) => boolean;
669
+ comment: FormattedCommentWithSize;
670
+ invisible: boolean;
671
+ loc: CommentLoc;
672
+ width: number;
673
+ long: number;
674
+ height: number;
675
+ vpos: number;
676
+ flash: boolean;
677
+ posY: number;
678
+ owner: boolean;
679
+ layer: number;
680
+ mail: string[];
681
+ content: string;
682
+ image?: IRenderer | null;
683
+ draw: (vpos: number, showCollision: boolean, cursor?: Position) => void;
684
+ isHovered: (cursor?: Position, posX?: number, posY?: number) => boolean;
443
685
  }
444
686
 
445
687
  interface IPluginConstructor {
446
- id: string;
447
- new (Canvas: Canvas, comments: IComment[]): IPlugin;
688
+ id: string;
689
+ new (Canvas: IRenderer, comments: IComment[]): IPlugin;
448
690
  }
449
-
450
691
  interface IPlugin {
451
- draw?: (vpos: number) => void;
452
- addComments?: (comments: IComment[]) => void;
453
- transformComments?: (comments: IComment[]) => IComment[];
692
+ draw?: (vpos: number) => void;
693
+ addComments?: (comments: IComment[]) => void;
694
+ transformComments?: (comments: IComment[]) => IComment[];
454
695
  }
455
-
456
696
  type IPluginList = {
457
- instance: IPlugin;
458
- canvas: HTMLCanvasElement;
697
+ instance: IPlugin;
698
+ canvas: IRenderer;
459
699
  }[];
460
700
 
461
- type InputFormatType =
462
- | "XMLDocument"
463
- | "niconicome"
464
- | "formatted"
465
- | "legacy"
466
- | "legacyOwner"
467
- | "owner"
468
- | "v1"
469
- | "empty"
470
- | "default";
471
- type InputFormat =
472
- | XMLDocument
473
- | FormattedComment[]
474
- | FormattedLegacyComment[]
475
- | RawApiResponse[]
476
- | OwnerComment[]
477
- | V1Thread[]
478
- | string
479
- | undefined;
701
+ type InputFormatType = "XMLDocument" | "niconicome" | "formatted" | "legacy" | "legacyOwner" | "owner" | "v1" | "empty" | "default";
702
+ type InputFormat = XMLDocument | FormattedComment[] | FormattedLegacyComment[] | RawApiResponse[] | OwnerComment[] | V1Thread[] | string | undefined;
480
703
  type ModeType = "default" | "html5" | "flash";
481
704
  type BaseOptions = {
482
- config: Config;
483
- debug: boolean;
484
- enableLegacyPiP: boolean;
485
- format: InputFormatType;
486
- formatted: boolean;
487
- keepCA: boolean;
488
- mode: ModeType;
489
- scale: number;
490
- showCollision: boolean;
491
- showCommentCount: boolean;
492
- showFPS: boolean;
493
- useLegacy: boolean;
494
- video: HTMLVideoElement | undefined;
705
+ config: Config;
706
+ debug: boolean;
707
+ enableLegacyPiP: boolean;
708
+ format: InputFormatType;
709
+ formatted: boolean;
710
+ keepCA: boolean;
711
+ mode: ModeType;
712
+ scale: number;
713
+ showCollision: boolean;
714
+ showCommentCount: boolean;
715
+ showFPS: boolean;
716
+ useLegacy: boolean;
717
+ video: HTMLVideoElement | undefined;
495
718
  };
496
719
  type Options = Partial<BaseOptions>;
497
-
498
- /**
499
- * @deprecated
500
- */
501
720
  type inputFormatType = InputFormatType;
502
- /**
503
- * @deprecated
504
- */
505
721
  type inputFormat = InputFormat;
506
722
 
507
723
  type FormattedCommentWithFont = {
508
- id: number;
509
- vpos: number;
510
- date: number;
511
- date_usec: number;
512
- owner: boolean;
513
- premium: boolean;
514
- mail: string[];
515
- user_id: number;
516
- layer: number;
517
- loc: CommentLoc;
518
- size: CommentSize;
519
- fontSize: number;
520
- font: CommentFont;
521
- color: string;
522
- strokeColor?: string;
523
- wakuColor?: string;
524
- fillColor?: string;
525
- full: boolean;
526
- ender: boolean;
527
- _live: boolean;
528
- long: number;
529
- invisible: boolean;
530
- content: CommentContentItem[];
531
- rawContent: string;
532
- flash: boolean;
533
- lineCount: number;
534
- lineOffset: number;
535
- is_my_post: boolean;
536
- button?: ButtonParams;
724
+ id: number;
725
+ vpos: number;
726
+ date: number;
727
+ date_usec: number;
728
+ owner: boolean;
729
+ premium: boolean;
730
+ mail: string[];
731
+ user_id: number;
732
+ layer: number;
733
+ loc: CommentLoc;
734
+ size: CommentSize;
735
+ fontSize: number;
736
+ font: CommentFont;
737
+ color: string;
738
+ strokeColor?: string;
739
+ wakuColor?: string;
740
+ fillColor?: string;
741
+ full: boolean;
742
+ ender: boolean;
743
+ _live: boolean;
744
+ long: number;
745
+ invisible: boolean;
746
+ content: CommentContentItem[];
747
+ rawContent: string;
748
+ flash: boolean;
749
+ lineCount: number;
750
+ lineOffset: number;
751
+ is_my_post: boolean;
752
+ button?: ButtonParams;
537
753
  };
538
754
  type FormattedCommentWithSize = FormattedCommentWithFont & {
539
- height: number;
540
- width: number;
541
- lineHeight: number;
542
- resized: boolean;
543
- resizedX: boolean;
544
- resizedY: boolean;
545
- content: CommentMeasuredContentItem[];
546
- charSize: number;
547
- scale: number;
548
- scaleX: number;
549
- buttonObjects?: ButtonList;
755
+ height: number;
756
+ width: number;
757
+ lineHeight: number;
758
+ resized: boolean;
759
+ resizedX: boolean;
760
+ resizedY: boolean;
761
+ content: CommentMeasuredContentItem[];
762
+ charSize: number;
763
+ scale: number;
764
+ scaleX: number;
765
+ buttonObjects?: ButtonList;
550
766
  };
551
767
  type ParseContentResult = {
552
- content: CommentContentItem[];
553
- lineCount: number;
554
- lineOffset: number;
768
+ content: CommentContentItem[];
769
+ lineCount: number;
770
+ lineOffset: number;
555
771
  };
556
772
  type ParseCommandAndNicoScriptResult = {
557
- flash: boolean;
558
- loc: CommentLoc;
559
- size: CommentSize;
560
- fontSize: number;
561
- color: string;
562
- strokeColor?: string;
563
- wakuColor?: string;
564
- fillColor?: string;
565
- font: CommentFont;
566
- full: boolean;
567
- ender: boolean;
568
- _live: boolean;
569
- invisible: boolean;
570
- long: number;
571
- button?: ButtonParams;
773
+ flash: boolean;
774
+ loc: CommentLoc;
775
+ size: CommentSize;
776
+ fontSize: number;
777
+ color: string;
778
+ strokeColor?: string;
779
+ wakuColor?: string;
780
+ fillColor?: string;
781
+ font: CommentFont;
782
+ full: boolean;
783
+ ender: boolean;
784
+ _live: boolean;
785
+ invisible: boolean;
786
+ long: number;
787
+ button?: ButtonParams;
572
788
  };
573
- type CommentContentItem = {
574
- content: string;
575
- slicedContent: string[];
576
- isButton?: boolean;
577
- font?: CommentFlashFont;
578
- width?: number[];
789
+ declare const ZCommentFont: valibot.UnionSchema<[valibot.LiteralSchema<"defont", "defont">, valibot.LiteralSchema<"mincho", "mincho">, valibot.LiteralSchema<"gothic", "gothic">, valibot.LiteralSchema<"gulim", "gulim">, valibot.LiteralSchema<"simsun", "simsun">], "defont" | "mincho" | "gothic" | "gulim" | "simsun">;
790
+ type CommentFont = Output<typeof ZCommentFont>;
791
+ declare const ZCommentHTML5Font: valibot.UnionSchema<[valibot.LiteralSchema<"defont", "defont">, valibot.LiteralSchema<"mincho", "mincho">, valibot.LiteralSchema<"gothic", "gothic">], "defont" | "mincho" | "gothic">;
792
+ type CommentHTML5Font = Output<typeof ZCommentHTML5Font>;
793
+ declare const ZCommentFlashFont: valibot.UnionSchema<[valibot.LiteralSchema<"defont", "defont">, valibot.LiteralSchema<"gulim", "gulim">, valibot.LiteralSchema<"simsun", "simsun">], "defont" | "gulim" | "simsun">;
794
+ type CommentFlashFont = Output<typeof ZCommentFlashFont>;
795
+ declare const ZCommentContentItemSpacer: valibot.ObjectSchema<{
796
+ type: valibot.LiteralSchema<"spacer", "spacer">;
797
+ char: valibot.StringSchema<string>;
798
+ charWidth: valibot.NumberSchema<number>;
799
+ isButton: valibot.OptionalSchema<valibot.BooleanSchema<boolean>, undefined, boolean | undefined>;
800
+ font: valibot.OptionalSchema<valibot.UnionSchema<[valibot.LiteralSchema<"defont", "defont">, valibot.LiteralSchema<"gulim", "gulim">, valibot.LiteralSchema<"simsun", "simsun">], "defont" | "gulim" | "simsun">, undefined, "defont" | "gulim" | "simsun" | undefined>;
801
+ count: valibot.NumberSchema<number>;
802
+ }, undefined, {
803
+ type: "spacer";
804
+ char: string;
805
+ charWidth: number;
806
+ count: number;
807
+ isButton?: boolean | undefined;
808
+ font?: "defont" | "gulim" | "simsun" | undefined;
809
+ }>;
810
+ declare const ZCommentContentItemText: valibot.ObjectSchema<{
811
+ type: valibot.LiteralSchema<"text", "text">;
812
+ content: valibot.StringSchema<string>;
813
+ slicedContent: valibot.ArraySchema<valibot.StringSchema<string>, string[]>;
814
+ isButton: valibot.OptionalSchema<valibot.BooleanSchema<boolean>, undefined, boolean | undefined>;
815
+ font: valibot.OptionalSchema<valibot.UnionSchema<[valibot.LiteralSchema<"defont", "defont">, valibot.LiteralSchema<"gulim", "gulim">, valibot.LiteralSchema<"simsun", "simsun">], "defont" | "gulim" | "simsun">, undefined, "defont" | "gulim" | "simsun" | undefined>;
816
+ width: valibot.OptionalSchema<valibot.ArraySchema<valibot.NumberSchema<number>, number[]>, undefined, number[] | undefined>;
817
+ }, undefined, {
818
+ type: "text";
819
+ content: string;
820
+ slicedContent: string[];
821
+ isButton?: boolean | undefined;
822
+ font?: "defont" | "gulim" | "simsun" | undefined;
823
+ width?: number[] | undefined;
824
+ }>;
825
+ type CommentContentItemText = Output<typeof ZCommentContentItemText>;
826
+ declare const ZCommentContentItem: valibot.UnionSchema<[valibot.ObjectSchema<{
827
+ type: valibot.LiteralSchema<"spacer", "spacer">;
828
+ char: valibot.StringSchema<string>;
829
+ charWidth: valibot.NumberSchema<number>;
830
+ isButton: valibot.OptionalSchema<valibot.BooleanSchema<boolean>, undefined, boolean | undefined>;
831
+ font: valibot.OptionalSchema<valibot.UnionSchema<[valibot.LiteralSchema<"defont", "defont">, valibot.LiteralSchema<"gulim", "gulim">, valibot.LiteralSchema<"simsun", "simsun">], "defont" | "gulim" | "simsun">, undefined, "defont" | "gulim" | "simsun" | undefined>;
832
+ count: valibot.NumberSchema<number>;
833
+ }, undefined, {
834
+ type: "spacer";
835
+ char: string;
836
+ charWidth: number;
837
+ count: number;
838
+ isButton?: boolean | undefined;
839
+ font?: "defont" | "gulim" | "simsun" | undefined;
840
+ }>, valibot.ObjectSchema<{
841
+ type: valibot.LiteralSchema<"text", "text">;
842
+ content: valibot.StringSchema<string>;
843
+ slicedContent: valibot.ArraySchema<valibot.StringSchema<string>, string[]>;
844
+ isButton: valibot.OptionalSchema<valibot.BooleanSchema<boolean>, undefined, boolean | undefined>;
845
+ font: valibot.OptionalSchema<valibot.UnionSchema<[valibot.LiteralSchema<"defont", "defont">, valibot.LiteralSchema<"gulim", "gulim">, valibot.LiteralSchema<"simsun", "simsun">], "defont" | "gulim" | "simsun">, undefined, "defont" | "gulim" | "simsun" | undefined>;
846
+ width: valibot.OptionalSchema<valibot.ArraySchema<valibot.NumberSchema<number>, number[]>, undefined, number[] | undefined>;
847
+ }, undefined, {
848
+ type: "text";
849
+ content: string;
850
+ slicedContent: string[];
851
+ isButton?: boolean | undefined;
852
+ font?: "defont" | "gulim" | "simsun" | undefined;
853
+ width?: number[] | undefined;
854
+ }>], {
855
+ type: "spacer";
856
+ char: string;
857
+ charWidth: number;
858
+ count: number;
859
+ isButton?: boolean | undefined;
860
+ font?: "defont" | "gulim" | "simsun" | undefined;
861
+ } | {
862
+ type: "text";
863
+ content: string;
864
+ slicedContent: string[];
865
+ isButton?: boolean | undefined;
866
+ font?: "defont" | "gulim" | "simsun" | undefined;
867
+ width?: number[] | undefined;
868
+ }>;
869
+ type CommentContentItem = Output<typeof ZCommentContentItem>;
870
+ declare const ZCommentMeasuredContentItemText: valibot.IntersectSchema<[valibot.UnionSchema<[valibot.ObjectSchema<{
871
+ type: valibot.LiteralSchema<"spacer", "spacer">;
872
+ char: valibot.StringSchema<string>;
873
+ charWidth: valibot.NumberSchema<number>;
874
+ isButton: valibot.OptionalSchema<valibot.BooleanSchema<boolean>, undefined, boolean | undefined>;
875
+ font: valibot.OptionalSchema<valibot.UnionSchema<[valibot.LiteralSchema<"defont", "defont">, valibot.LiteralSchema<"gulim", "gulim">, valibot.LiteralSchema<"simsun", "simsun">], "defont" | "gulim" | "simsun">, undefined, "defont" | "gulim" | "simsun" | undefined>;
876
+ count: valibot.NumberSchema<number>;
877
+ }, undefined, {
878
+ type: "spacer";
879
+ char: string;
880
+ charWidth: number;
881
+ count: number;
882
+ isButton?: boolean | undefined;
883
+ font?: "defont" | "gulim" | "simsun" | undefined;
884
+ }>, valibot.ObjectSchema<{
885
+ type: valibot.LiteralSchema<"text", "text">;
886
+ content: valibot.StringSchema<string>;
887
+ slicedContent: valibot.ArraySchema<valibot.StringSchema<string>, string[]>;
888
+ isButton: valibot.OptionalSchema<valibot.BooleanSchema<boolean>, undefined, boolean | undefined>;
889
+ font: valibot.OptionalSchema<valibot.UnionSchema<[valibot.LiteralSchema<"defont", "defont">, valibot.LiteralSchema<"gulim", "gulim">, valibot.LiteralSchema<"simsun", "simsun">], "defont" | "gulim" | "simsun">, undefined, "defont" | "gulim" | "simsun" | undefined>;
890
+ width: valibot.OptionalSchema<valibot.ArraySchema<valibot.NumberSchema<number>, number[]>, undefined, number[] | undefined>;
891
+ }, undefined, {
892
+ type: "text";
893
+ content: string;
894
+ slicedContent: string[];
895
+ isButton?: boolean | undefined;
896
+ font?: "defont" | "gulim" | "simsun" | undefined;
897
+ width?: number[] | undefined;
898
+ }>], {
899
+ type: "spacer";
900
+ char: string;
901
+ charWidth: number;
902
+ count: number;
903
+ isButton?: boolean | undefined;
904
+ font?: "defont" | "gulim" | "simsun" | undefined;
905
+ } | {
906
+ type: "text";
907
+ content: string;
908
+ slicedContent: string[];
909
+ isButton?: boolean | undefined;
910
+ font?: "defont" | "gulim" | "simsun" | undefined;
911
+ width?: number[] | undefined;
912
+ }>, valibot.ObjectSchema<{
913
+ width: valibot.ArraySchema<valibot.NumberSchema<number>, number[]>;
914
+ }, undefined, {
915
+ width: number[];
916
+ }>], ({
917
+ type: "spacer";
918
+ char: string;
919
+ charWidth: number;
920
+ count: number;
921
+ isButton?: boolean | undefined;
922
+ font?: "defont" | "gulim" | "simsun" | undefined;
923
+ } | {
924
+ type: "text";
925
+ content: string;
926
+ slicedContent: string[];
927
+ isButton?: boolean | undefined;
928
+ font?: "defont" | "gulim" | "simsun" | undefined;
929
+ width?: number[] | undefined;
930
+ }) & {
931
+ width: number[];
932
+ }>;
933
+ declare const ZCommentMeasuredContentItem: valibot.UnionSchema<[valibot.IntersectSchema<[valibot.UnionSchema<[valibot.ObjectSchema<{
934
+ type: valibot.LiteralSchema<"spacer", "spacer">;
935
+ char: valibot.StringSchema<string>;
936
+ charWidth: valibot.NumberSchema<number>;
937
+ isButton: valibot.OptionalSchema<valibot.BooleanSchema<boolean>, undefined, boolean | undefined>;
938
+ font: valibot.OptionalSchema<valibot.UnionSchema<[valibot.LiteralSchema<"defont", "defont">, valibot.LiteralSchema<"gulim", "gulim">, valibot.LiteralSchema<"simsun", "simsun">], "defont" | "gulim" | "simsun">, undefined, "defont" | "gulim" | "simsun" | undefined>;
939
+ count: valibot.NumberSchema<number>;
940
+ }, undefined, {
941
+ type: "spacer";
942
+ char: string;
943
+ charWidth: number;
944
+ count: number;
945
+ isButton?: boolean | undefined;
946
+ font?: "defont" | "gulim" | "simsun" | undefined;
947
+ }>, valibot.ObjectSchema<{
948
+ type: valibot.LiteralSchema<"text", "text">;
949
+ content: valibot.StringSchema<string>;
950
+ slicedContent: valibot.ArraySchema<valibot.StringSchema<string>, string[]>;
951
+ isButton: valibot.OptionalSchema<valibot.BooleanSchema<boolean>, undefined, boolean | undefined>;
952
+ font: valibot.OptionalSchema<valibot.UnionSchema<[valibot.LiteralSchema<"defont", "defont">, valibot.LiteralSchema<"gulim", "gulim">, valibot.LiteralSchema<"simsun", "simsun">], "defont" | "gulim" | "simsun">, undefined, "defont" | "gulim" | "simsun" | undefined>;
953
+ width: valibot.OptionalSchema<valibot.ArraySchema<valibot.NumberSchema<number>, number[]>, undefined, number[] | undefined>;
954
+ }, undefined, {
955
+ type: "text";
956
+ content: string;
957
+ slicedContent: string[];
958
+ isButton?: boolean | undefined;
959
+ font?: "defont" | "gulim" | "simsun" | undefined;
960
+ width?: number[] | undefined;
961
+ }>], {
962
+ type: "spacer";
963
+ char: string;
964
+ charWidth: number;
965
+ count: number;
966
+ isButton?: boolean | undefined;
967
+ font?: "defont" | "gulim" | "simsun" | undefined;
968
+ } | {
969
+ type: "text";
970
+ content: string;
971
+ slicedContent: string[];
972
+ isButton?: boolean | undefined;
973
+ font?: "defont" | "gulim" | "simsun" | undefined;
974
+ width?: number[] | undefined;
975
+ }>, valibot.ObjectSchema<{
976
+ width: valibot.ArraySchema<valibot.NumberSchema<number>, number[]>;
977
+ }, undefined, {
978
+ width: number[];
979
+ }>], ({
980
+ type: "spacer";
981
+ char: string;
982
+ charWidth: number;
983
+ count: number;
984
+ isButton?: boolean | undefined;
985
+ font?: "defont" | "gulim" | "simsun" | undefined;
986
+ } | {
987
+ type: "text";
988
+ content: string;
989
+ slicedContent: string[];
990
+ isButton?: boolean | undefined;
991
+ font?: "defont" | "gulim" | "simsun" | undefined;
992
+ width?: number[] | undefined;
993
+ }) & {
994
+ width: number[];
995
+ }>, valibot.ObjectSchema<{
996
+ type: valibot.LiteralSchema<"spacer", "spacer">;
997
+ char: valibot.StringSchema<string>;
998
+ charWidth: valibot.NumberSchema<number>;
999
+ isButton: valibot.OptionalSchema<valibot.BooleanSchema<boolean>, undefined, boolean | undefined>;
1000
+ font: valibot.OptionalSchema<valibot.UnionSchema<[valibot.LiteralSchema<"defont", "defont">, valibot.LiteralSchema<"gulim", "gulim">, valibot.LiteralSchema<"simsun", "simsun">], "defont" | "gulim" | "simsun">, undefined, "defont" | "gulim" | "simsun" | undefined>;
1001
+ count: valibot.NumberSchema<number>;
1002
+ }, undefined, {
1003
+ type: "spacer";
1004
+ char: string;
1005
+ charWidth: number;
1006
+ count: number;
1007
+ isButton?: boolean | undefined;
1008
+ font?: "defont" | "gulim" | "simsun" | undefined;
1009
+ }>], {
1010
+ type: "spacer";
1011
+ char: string;
1012
+ charWidth: number;
1013
+ count: number;
1014
+ isButton?: boolean | undefined;
1015
+ font?: "defont" | "gulim" | "simsun" | undefined;
1016
+ } | (({
1017
+ type: "spacer";
1018
+ char: string;
1019
+ charWidth: number;
1020
+ count: number;
1021
+ isButton?: boolean | undefined;
1022
+ font?: "defont" | "gulim" | "simsun" | undefined;
1023
+ } | {
1024
+ type: "text";
1025
+ content: string;
1026
+ slicedContent: string[];
1027
+ isButton?: boolean | undefined;
1028
+ font?: "defont" | "gulim" | "simsun" | undefined;
1029
+ width?: number[] | undefined;
1030
+ }) & {
1031
+ width: number[];
1032
+ })>;
1033
+ type CommentMeasuredContentItem = Output<typeof ZCommentMeasuredContentItem>;
1034
+ type CommentFlashFontParsed = "gothic" | "gulim" | "simsunStrong" | "simsunWeak";
1035
+ type CommentContentIndex = {
1036
+ index: number;
1037
+ font: CommentFlashFontParsed;
579
1038
  };
580
- type CommentMeasuredContentItem = CommentContentItem & {
581
- width: number[];
1039
+ declare const ZCommentSize: valibot.UnionSchema<[valibot.LiteralSchema<"big", "big">, valibot.LiteralSchema<"medium", "medium">, valibot.LiteralSchema<"small", "small">], "big" | "medium" | "small">;
1040
+ type CommentSize = Output<typeof ZCommentSize>;
1041
+ declare const ZCommentLoc: valibot.UnionSchema<[valibot.LiteralSchema<"ue", "ue">, valibot.LiteralSchema<"naka", "naka">, valibot.LiteralSchema<"shita", "shita">], "ue" | "naka" | "shita">;
1042
+ type CommentLoc = Output<typeof ZCommentLoc>;
1043
+ type Collision = {
1044
+ [key in CollisionPos]: CollisionItem;
582
1045
  };
583
- type CommentFlashFontParsed =
584
- | "gothic"
585
- | "gulim"
586
- | "simsunStrong"
587
- | "simsunWeak";
588
- type CommentContentIndex = {
589
- index: number;
590
- font: CommentFlashFontParsed;
1046
+ type Timeline = {
1047
+ [key: number]: IComment[];
591
1048
  };
592
- type CommentFont = "defont" | "mincho" | "gothic" | "gulim" | "simsun";
593
- type CommentFlashFont = "defont" | "gulim" | "simsun";
594
- type CommentSize = "big" | "medium" | "small";
595
- type CommentLoc = "ue" | "naka" | "shita";
596
- type Collision = { [key in CollisionPos]: CollisionItem };
597
- type Timeline = { [key: number]: IComment[] };
598
1049
  type CollisionPos = "ue" | "shita" | "right" | "left";
599
- type CollisionItem = { [p: number]: IComment[] };
1050
+ type CollisionItem = {
1051
+ [p: number]: IComment[];
1052
+ };
600
1053
  type NicoScript = {
601
- reverse: NicoScriptReverse[];
602
- ban: NicoScriptBan[];
603
- default: NicoScriptDefault[];
604
- replace: NicoScriptReplace[];
605
- seekDisable: NicoScriptSeekDisable[];
606
- jump: NicoScriptJump[];
1054
+ reverse: NicoScriptReverse[];
1055
+ ban: NicoScriptBan[];
1056
+ default: NicoScriptDefault[];
1057
+ replace: NicoScriptReplace[];
1058
+ seekDisable: NicoScriptSeekDisable[];
1059
+ jump: NicoScriptJump[];
607
1060
  };
608
1061
  type NicoScriptSeekDisable = {
609
- start: number;
610
- end: number;
1062
+ start: number;
1063
+ end: number;
611
1064
  };
612
1065
  type NicoScriptJump = {
613
- start: number;
614
- end?: number;
615
- to: string;
616
- message?: string;
1066
+ start: number;
1067
+ end?: number;
1068
+ to: string;
1069
+ message?: string;
617
1070
  };
618
1071
  type NicoScriptReverse = {
619
- target: NicoScriptReverseTarget;
620
- start: number;
621
- end: number;
1072
+ target: NicoScriptReverseTarget;
1073
+ start: number;
1074
+ end: number;
622
1075
  };
623
1076
  type NicoScriptReverseTarget = "コメ" | "投コメ" | "全";
624
1077
  type NicoScriptReplace = {
625
- start: number;
626
- long: number | undefined;
627
- keyword: string;
628
- replace: string;
629
- range: NicoScriptReplaceRange;
630
- target: NicoScriptReplaceTarget;
631
- condition: NicoScriptReplaceCondition;
632
- color: string | undefined;
633
- size: CommentSize | undefined;
634
- font: CommentFont | undefined;
635
- loc: CommentLoc | undefined;
636
- no: number;
1078
+ start: number;
1079
+ long: number | undefined;
1080
+ keyword: string;
1081
+ replace: string;
1082
+ range: NicoScriptReplaceRange;
1083
+ target: NicoScriptReplaceTarget;
1084
+ condition: NicoScriptReplaceCondition;
1085
+ color: string | undefined;
1086
+ size: CommentSize | undefined;
1087
+ font: CommentFont | undefined;
1088
+ loc: CommentLoc | undefined;
1089
+ no: number;
637
1090
  };
638
1091
  type NicoScriptReplaceRange = "単" | "全";
639
- type NicoScriptReplaceTarget =
640
- | "コメ"
641
- | "投コメ"
642
- | "全"
643
- | "含まない"
644
- | "含む";
1092
+ type NicoScriptReplaceTarget = "コメ" | "投コメ" | "全" | "含まない" | "含む";
645
1093
  type NicoScriptReplaceCondition = "完全一致" | "部分一致";
646
1094
  type NicoScriptBan = {
647
- start: number;
648
- end: number;
1095
+ start: number;
1096
+ end: number;
649
1097
  };
650
1098
  type NicoScriptDefault = {
651
- start: number;
652
- long: number | undefined;
653
- color: string | undefined;
654
- size: CommentSize | undefined;
655
- font: CommentFont | undefined;
656
- loc: CommentLoc | undefined;
1099
+ start: number;
1100
+ long: number | undefined;
1101
+ color: string | undefined;
1102
+ size: CommentSize | undefined;
1103
+ font: CommentFont | undefined;
1104
+ loc: CommentLoc | undefined;
657
1105
  };
658
1106
  type MeasureTextResult = {
659
- width: number;
660
- height: number;
661
- resized: boolean;
662
- resizedX: boolean;
663
- resizedY: boolean;
664
- fontSize: number;
665
- lineHeight: number;
666
- content: CommentMeasuredContentItem[];
667
- charSize: number;
668
- scaleX: number;
669
- scale: number;
1107
+ width: number;
1108
+ height: number;
1109
+ resized: boolean;
1110
+ resizedX: boolean;
1111
+ resizedY: boolean;
1112
+ fontSize: number;
1113
+ lineHeight: number;
1114
+ content: CommentMeasuredContentItem[];
1115
+ charSize: number;
1116
+ scaleX: number;
1117
+ scale: number;
670
1118
  };
671
-
672
1119
  type ButtonParams = {
673
- message: {
674
- before: string;
675
- body: string;
676
- after: string;
677
- }; //表示するボタンの内容
678
- commentMessage: string; //コメントの内容
679
- commentMail: string[]; //コメントのコマンド → 未指定時は色のみ継承
680
- commentVisible: boolean; //コメントを投稿するか
681
- limit: number; //ボタンの使用上限
682
- local: boolean; //ローカルコメントか
683
- hidden: boolean; //通常のコメントのように表示するか
1120
+ message: {
1121
+ before: string;
1122
+ body: string;
1123
+ after: string;
1124
+ };
1125
+ commentMessage: string;
1126
+ commentMail: string[];
1127
+ commentVisible: boolean;
1128
+ limit: number;
1129
+ local: boolean;
1130
+ hidden: boolean;
684
1131
  };
685
-
686
1132
  type ParsedCommand = {
687
- loc: CommentLoc | undefined;
688
- size: CommentSize | undefined;
689
- fontSize: number | undefined;
690
- color: string | undefined;
691
- strokeColor?: string;
692
- wakuColor?: string;
693
- fillColor?: string;
694
- font: CommentFont | undefined;
695
- full: boolean;
696
- ender: boolean;
697
- _live: boolean;
698
- invisible: boolean;
699
- long: number | undefined;
700
- button?: ButtonParams;
1133
+ loc: CommentLoc | undefined;
1134
+ size: CommentSize | undefined;
1135
+ fontSize: number | undefined;
1136
+ color: string | undefined;
1137
+ strokeColor?: string;
1138
+ wakuColor?: string;
1139
+ fillColor?: string;
1140
+ font: CommentFont | undefined;
1141
+ full: boolean;
1142
+ ender: boolean;
1143
+ _live: boolean;
1144
+ invisible: boolean;
1145
+ long: number | undefined;
1146
+ button?: ButtonParams;
701
1147
  };
702
-
703
1148
  type MeasureTextInput = FormattedCommentWithFont & {
704
- resized?: boolean;
705
- resizedY?: boolean;
706
- resizedX?: boolean;
707
- lineHeight?: number;
708
- charSize?: number;
709
- scale: number;
710
- };
711
-
712
- type MeasureInput = {
713
- font: CommentFont;
714
- content: CommentContentItem[];
715
- lineHeight: number;
716
- charSize: number;
717
- lineCount: number;
1149
+ resized?: boolean;
1150
+ resizedY?: boolean;
1151
+ resizedX?: boolean;
1152
+ lineHeight?: number;
1153
+ charSize?: number;
1154
+ scale: number;
718
1155
  };
719
-
1156
+ declare const ZMeasureInput: valibot.ObjectSchema<{
1157
+ font: valibot.UnionSchema<[valibot.LiteralSchema<"defont", "defont">, valibot.LiteralSchema<"mincho", "mincho">, valibot.LiteralSchema<"gothic", "gothic">, valibot.LiteralSchema<"gulim", "gulim">, valibot.LiteralSchema<"simsun", "simsun">], "defont" | "mincho" | "gothic" | "gulim" | "simsun">;
1158
+ content: valibot.ArraySchema<valibot.UnionSchema<[valibot.ObjectSchema<{
1159
+ type: valibot.LiteralSchema<"spacer", "spacer">;
1160
+ char: valibot.StringSchema<string>;
1161
+ charWidth: valibot.NumberSchema<number>;
1162
+ isButton: valibot.OptionalSchema<valibot.BooleanSchema<boolean>, undefined, boolean | undefined>;
1163
+ font: valibot.OptionalSchema<valibot.UnionSchema<[valibot.LiteralSchema<"defont", "defont">, valibot.LiteralSchema<"gulim", "gulim">, valibot.LiteralSchema<"simsun", "simsun">], "defont" | "gulim" | "simsun">, undefined, "defont" | "gulim" | "simsun" | undefined>;
1164
+ count: valibot.NumberSchema<number>;
1165
+ }, undefined, {
1166
+ type: "spacer";
1167
+ char: string;
1168
+ charWidth: number;
1169
+ count: number;
1170
+ isButton?: boolean | undefined;
1171
+ font?: "defont" | "gulim" | "simsun" | undefined;
1172
+ }>, valibot.ObjectSchema<{
1173
+ type: valibot.LiteralSchema<"text", "text">;
1174
+ content: valibot.StringSchema<string>;
1175
+ slicedContent: valibot.ArraySchema<valibot.StringSchema<string>, string[]>;
1176
+ isButton: valibot.OptionalSchema<valibot.BooleanSchema<boolean>, undefined, boolean | undefined>;
1177
+ font: valibot.OptionalSchema<valibot.UnionSchema<[valibot.LiteralSchema<"defont", "defont">, valibot.LiteralSchema<"gulim", "gulim">, valibot.LiteralSchema<"simsun", "simsun">], "defont" | "gulim" | "simsun">, undefined, "defont" | "gulim" | "simsun" | undefined>;
1178
+ width: valibot.OptionalSchema<valibot.ArraySchema<valibot.NumberSchema<number>, number[]>, undefined, number[] | undefined>;
1179
+ }, undefined, {
1180
+ type: "text";
1181
+ content: string;
1182
+ slicedContent: string[];
1183
+ isButton?: boolean | undefined;
1184
+ font?: "defont" | "gulim" | "simsun" | undefined;
1185
+ width?: number[] | undefined;
1186
+ }>], {
1187
+ type: "spacer";
1188
+ char: string;
1189
+ charWidth: number;
1190
+ count: number;
1191
+ isButton?: boolean | undefined;
1192
+ font?: "defont" | "gulim" | "simsun" | undefined;
1193
+ } | {
1194
+ type: "text";
1195
+ content: string;
1196
+ slicedContent: string[];
1197
+ isButton?: boolean | undefined;
1198
+ font?: "defont" | "gulim" | "simsun" | undefined;
1199
+ width?: number[] | undefined;
1200
+ }>, ({
1201
+ type: "spacer";
1202
+ char: string;
1203
+ charWidth: number;
1204
+ count: number;
1205
+ isButton?: boolean | undefined;
1206
+ font?: "defont" | "gulim" | "simsun" | undefined;
1207
+ } | {
1208
+ type: "text";
1209
+ content: string;
1210
+ slicedContent: string[];
1211
+ isButton?: boolean | undefined;
1212
+ font?: "defont" | "gulim" | "simsun" | undefined;
1213
+ width?: number[] | undefined;
1214
+ })[]>;
1215
+ lineHeight: valibot.NumberSchema<number>;
1216
+ charSize: valibot.NumberSchema<number>;
1217
+ lineCount: valibot.NumberSchema<number>;
1218
+ }, undefined, {
1219
+ lineHeight: number;
1220
+ font: "defont" | "mincho" | "gothic" | "gulim" | "simsun";
1221
+ content: ({
1222
+ type: "spacer";
1223
+ char: string;
1224
+ charWidth: number;
1225
+ count: number;
1226
+ isButton?: boolean | undefined;
1227
+ font?: "defont" | "gulim" | "simsun" | undefined;
1228
+ } | {
1229
+ type: "text";
1230
+ content: string;
1231
+ slicedContent: string[];
1232
+ isButton?: boolean | undefined;
1233
+ font?: "defont" | "gulim" | "simsun" | undefined;
1234
+ width?: number[] | undefined;
1235
+ })[];
1236
+ charSize: number;
1237
+ lineCount: number;
1238
+ }>;
1239
+ type MeasureInput = Output<typeof ZMeasureInput>;
720
1240
  type ValueOf<T> = T[keyof T];
721
1241
 
722
1242
  declare let imageCache: {
723
1243
  [key: string]: {
724
- image: Canvas;
1244
+ image: IRenderer;
725
1245
  timeout: number | NodeJS.Timeout;
726
1246
  };
727
1247
  };
@@ -733,14 +1253,14 @@ declare const resetNicoScripts: () => void;
733
1253
  declare let plugins: IPluginList;
734
1254
  declare const setPlugins: (input: IPluginList) => void;
735
1255
 
736
- declare const index_d$2_imageCache: typeof imageCache;
737
- declare const index_d$2_nicoScripts: typeof nicoScripts;
738
- declare const index_d$2_plugins: typeof plugins;
739
- declare const index_d$2_resetImageCache: typeof resetImageCache;
740
- declare const index_d$2_resetNicoScripts: typeof resetNicoScripts;
741
- declare const index_d$2_setPlugins: typeof setPlugins;
742
- declare namespace index_d$2 {
743
- export { index_d$2_imageCache as imageCache, index_d$2_nicoScripts as nicoScripts, index_d$2_plugins as plugins, index_d$2_resetImageCache as resetImageCache, index_d$2_resetNicoScripts as resetNicoScripts, index_d$2_setPlugins as setPlugins };
1256
+ declare const index_d$3_imageCache: typeof imageCache;
1257
+ declare const index_d$3_nicoScripts: typeof nicoScripts;
1258
+ declare const index_d$3_plugins: typeof plugins;
1259
+ declare const index_d$3_resetImageCache: typeof resetImageCache;
1260
+ declare const index_d$3_resetNicoScripts: typeof resetNicoScripts;
1261
+ declare const index_d$3_setPlugins: typeof setPlugins;
1262
+ declare namespace index_d$3 {
1263
+ export { index_d$3_imageCache as imageCache, index_d$3_nicoScripts as nicoScripts, index_d$3_plugins as plugins, index_d$3_resetImageCache as resetImageCache, index_d$3_resetNicoScripts as resetNicoScripts, index_d$3_setPlugins as setPlugins };
744
1264
  }
745
1265
 
746
1266
  declare const colors: {
@@ -941,16 +1461,16 @@ declare class NotImplementedError extends Error {
941
1461
  });
942
1462
  }
943
1463
 
944
- type index_d$1_CanvasRenderingContext2DError = CanvasRenderingContext2DError;
945
- declare const index_d$1_CanvasRenderingContext2DError: typeof CanvasRenderingContext2DError;
946
- type index_d$1_InvalidFormatError = InvalidFormatError;
947
- declare const index_d$1_InvalidFormatError: typeof InvalidFormatError;
948
- type index_d$1_InvalidOptionError = InvalidOptionError;
949
- declare const index_d$1_InvalidOptionError: typeof InvalidOptionError;
950
- type index_d$1_NotImplementedError = NotImplementedError;
951
- declare const index_d$1_NotImplementedError: typeof NotImplementedError;
952
- declare namespace index_d$1 {
953
- export { index_d$1_CanvasRenderingContext2DError as CanvasRenderingContext2DError, index_d$1_InvalidFormatError as InvalidFormatError, index_d$1_InvalidOptionError as InvalidOptionError, index_d$1_NotImplementedError as NotImplementedError };
1464
+ type index_d$2_CanvasRenderingContext2DError = CanvasRenderingContext2DError;
1465
+ declare const index_d$2_CanvasRenderingContext2DError: typeof CanvasRenderingContext2DError;
1466
+ type index_d$2_InvalidFormatError = InvalidFormatError;
1467
+ declare const index_d$2_InvalidFormatError: typeof InvalidFormatError;
1468
+ type index_d$2_InvalidOptionError = InvalidOptionError;
1469
+ declare const index_d$2_InvalidOptionError: typeof InvalidOptionError;
1470
+ type index_d$2_NotImplementedError = NotImplementedError;
1471
+ declare const index_d$2_NotImplementedError: typeof NotImplementedError;
1472
+ declare namespace index_d$2 {
1473
+ export { index_d$2_CanvasRenderingContext2DError as CanvasRenderingContext2DError, index_d$2_InvalidFormatError as InvalidFormatError, index_d$2_InvalidOptionError as InvalidOptionError, index_d$2_NotImplementedError as NotImplementedError };
954
1474
  }
955
1475
 
956
1476
  declare const registerHandler: <K extends keyof CommentEventHandlerMap>(eventName: K, handler: CommentEventHandlerMap[K]) => void;
@@ -970,33 +1490,238 @@ declare namespace inputParser_d {
970
1490
  export { convert2formattedComment as default };
971
1491
  }
972
1492
 
1493
+ declare class CanvasRenderer implements IRenderer {
1494
+ readonly canvas: HTMLCanvasElement;
1495
+ readonly video?: HTMLVideoElement;
1496
+ private readonly context;
1497
+ constructor(canvas?: HTMLCanvasElement, video?: HTMLVideoElement);
1498
+ drawVideo(enableLegacyPip: boolean): void;
1499
+ getFont(): string;
1500
+ getFillStyle(): string | CanvasGradient | CanvasPattern;
1501
+ setScale(scale: number, arg1?: number): void;
1502
+ drawImage(image: IRenderer, x: number, y: number, width?: number, height?: number): void;
1503
+ fillRect(x: number, y: number, width: number, height: number): void;
1504
+ strokeRect(x: number, y: number, width: number, height: number): void;
1505
+ fillText(text: string, x: number, y: number): void;
1506
+ strokeText(text: string, x: number, y: number): void;
1507
+ quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void;
1508
+ clearRect(x: number, y: number, width: number, height: number): void;
1509
+ setFont(font: string): void;
1510
+ setFillStyle(color: string): void;
1511
+ setStrokeStyle(color: string): void;
1512
+ setLineWidth(width: number): void;
1513
+ setGlobalAlpha(alpha: number): void;
1514
+ setSize(width: number, height: number): void;
1515
+ getSize(): {
1516
+ width: number;
1517
+ height: number;
1518
+ };
1519
+ measureText(text: string): TextMetrics;
1520
+ beginPath(): void;
1521
+ closePath(): void;
1522
+ moveTo(x: number, y: number): void;
1523
+ lineTo(x: number, y: number): void;
1524
+ stroke(): void;
1525
+ save(): void;
1526
+ restore(): void;
1527
+ getCanvas(): IRenderer;
1528
+ destroy(): void;
1529
+ }
1530
+
1531
+ type index_d$1_CanvasRenderer = CanvasRenderer;
1532
+ declare const index_d$1_CanvasRenderer: typeof CanvasRenderer;
1533
+ declare namespace index_d$1 {
1534
+ export { index_d$1_CanvasRenderer as CanvasRenderer };
1535
+ }
1536
+
973
1537
  declare const typeGuard: {
974
1538
  formatted: {
975
- comment: (i: unknown) => i is FormattedComment;
976
- comments: (i: unknown) => i is FormattedComment[];
977
- legacyComment: (i: unknown) => i is FormattedLegacyComment;
978
- legacyComments: (i: unknown) => i is FormattedLegacyComment[];
1539
+ comment: (i: unknown) => i is {
1540
+ owner: boolean;
1541
+ content: string;
1542
+ id: number;
1543
+ vpos: number;
1544
+ date: number;
1545
+ date_usec: number;
1546
+ premium: boolean;
1547
+ mail: string[];
1548
+ user_id: number;
1549
+ layer: number;
1550
+ is_my_post: boolean;
1551
+ };
1552
+ comments: (i: unknown) => i is {
1553
+ owner: boolean;
1554
+ content: string;
1555
+ id: number;
1556
+ vpos: number;
1557
+ date: number;
1558
+ date_usec: number;
1559
+ premium: boolean;
1560
+ mail: string[];
1561
+ user_id: number;
1562
+ layer: number;
1563
+ is_my_post: boolean;
1564
+ }[];
1565
+ legacyComment: (i: unknown) => i is {
1566
+ owner: boolean;
1567
+ content: string;
1568
+ id: number;
1569
+ vpos: number;
1570
+ date: number;
1571
+ date_usec: number;
1572
+ premium: boolean;
1573
+ mail: string[];
1574
+ };
1575
+ legacyComments: (i: unknown) => i is {
1576
+ owner: boolean;
1577
+ content: string;
1578
+ id: number;
1579
+ vpos: number;
1580
+ date: number;
1581
+ date_usec: number;
1582
+ premium: boolean;
1583
+ mail: string[];
1584
+ }[];
979
1585
  };
980
1586
  legacy: {
981
- rawApiResponses: (i: unknown) => i is RawApiResponse[];
982
- apiChat: (i: unknown) => i is ApiChat;
983
- apiGlobalNumRes: (i: unknown) => i is ApiGlobalNumRes;
984
- apiLeaf: (i: unknown) => i is ApiLeaf;
985
- apiPing: (i: unknown) => i is ApiPing;
986
- apiThread: (i: unknown) => i is ApiThread;
1587
+ rawApiResponses: (i: unknown) => i is ({
1588
+ chat: {
1589
+ content: string;
1590
+ vpos: number;
1591
+ date: number;
1592
+ date_usec: number;
1593
+ premium: number;
1594
+ mail: string;
1595
+ user_id: string;
1596
+ thread: string;
1597
+ no: number;
1598
+ nicoru: number;
1599
+ anonymity: number;
1600
+ deleted: number;
1601
+ };
1602
+ } | {
1603
+ [x: string]: unknown;
1604
+ })[];
1605
+ apiChat: (i: unknown) => i is {
1606
+ content: string;
1607
+ vpos: number;
1608
+ date: number;
1609
+ date_usec: number;
1610
+ premium: number;
1611
+ mail: string;
1612
+ user_id: string;
1613
+ thread: string;
1614
+ no: number;
1615
+ nicoru: number;
1616
+ anonymity: number;
1617
+ deleted: number;
1618
+ };
1619
+ apiGlobalNumRes: (i: unknown) => i is {
1620
+ thread: string;
1621
+ num_res: number;
1622
+ };
1623
+ apiLeaf: (i: unknown) => i is {
1624
+ count: number;
1625
+ thread: string;
1626
+ };
1627
+ apiPing: (i: unknown) => i is {
1628
+ content: string;
1629
+ };
1630
+ apiThread: (i: unknown) => i is {
1631
+ thread: string;
1632
+ resultcode: number;
1633
+ server_time: number;
1634
+ ticket: string;
1635
+ revision: number;
1636
+ };
987
1637
  };
988
1638
  xmlDocument: (i: unknown) => i is XMLDocument;
989
1639
  legacyOwner: {
990
1640
  comments: (i: unknown) => i is string;
991
1641
  };
992
1642
  owner: {
993
- comment: (i: unknown) => i is OwnerComment;
994
- comments: (i: unknown) => i is OwnerComment[];
1643
+ comment: (i: unknown) => i is {
1644
+ time: string;
1645
+ command: string;
1646
+ comment: string;
1647
+ };
1648
+ comments: (i: unknown) => i is {
1649
+ time: string;
1650
+ command: string;
1651
+ comment: string;
1652
+ }[];
995
1653
  };
996
1654
  v1: {
997
- comment: (i: unknown) => i is V1Comment;
998
- thread: (i: unknown) => i is V1Thread;
999
- threads: (i: unknown) => i is V1Thread[];
1655
+ comment: (i: unknown) => i is {
1656
+ id: string;
1657
+ no: number;
1658
+ vposMs: number;
1659
+ body: string;
1660
+ commands: string[];
1661
+ userId: string;
1662
+ isPremium: boolean;
1663
+ score: number;
1664
+ postedAt: string;
1665
+ nicoruCount: number;
1666
+ nicoruId: string | null;
1667
+ source: string;
1668
+ isMyPost: boolean;
1669
+ };
1670
+ comments: (i: unknown) => i is {
1671
+ id: string;
1672
+ no: number;
1673
+ vposMs: number;
1674
+ body: string;
1675
+ commands: string[];
1676
+ userId: string;
1677
+ isPremium: boolean;
1678
+ score: number;
1679
+ postedAt: string;
1680
+ nicoruCount: number;
1681
+ nicoruId: string | null;
1682
+ source: string;
1683
+ isMyPost: boolean;
1684
+ }[];
1685
+ thread: (i: unknown) => i is {
1686
+ fork: string;
1687
+ commentCount: number;
1688
+ comments: {
1689
+ id: string;
1690
+ no: number;
1691
+ vposMs: number;
1692
+ body: string;
1693
+ commands: string[];
1694
+ userId: string;
1695
+ isPremium: boolean;
1696
+ score: number;
1697
+ postedAt: string;
1698
+ nicoruCount: number;
1699
+ nicoruId: string | null;
1700
+ source: string;
1701
+ isMyPost: boolean;
1702
+ }[];
1703
+ id?: unknown;
1704
+ };
1705
+ threads: (i: unknown) => i is {
1706
+ fork: string;
1707
+ commentCount: number;
1708
+ comments: {
1709
+ id: string;
1710
+ no: number;
1711
+ vposMs: number;
1712
+ body: string;
1713
+ commands: string[];
1714
+ userId: string;
1715
+ isPremium: boolean;
1716
+ score: number;
1717
+ postedAt: string;
1718
+ nicoruCount: number;
1719
+ nicoruId: string | null;
1720
+ source: string;
1721
+ isMyPost: boolean;
1722
+ }[];
1723
+ id?: unknown;
1724
+ }[];
1000
1725
  };
1001
1726
  nicoScript: {
1002
1727
  range: {
@@ -1009,9 +1734,9 @@ declare const typeGuard: {
1009
1734
  };
1010
1735
  };
1011
1736
  comment: {
1012
- font: (i: unknown) => i is CommentFont;
1013
- loc: (i: unknown) => i is CommentLoc;
1014
- size: (i: unknown) => i is CommentSize;
1737
+ font: (i: unknown) => i is "defont" | "mincho" | "gothic" | "gulim" | "simsun";
1738
+ loc: (i: unknown) => i is "ue" | "naka" | "shita";
1739
+ size: (i: unknown) => i is "big" | "medium" | "small";
1015
1740
  command: {
1016
1741
  key: (i: unknown) => i is "full" | "ender" | "_live" | "invisible";
1017
1742
  };
@@ -1023,11 +1748,77 @@ declare const typeGuard: {
1023
1748
  initOptions: (item: unknown) => item is Partial<BaseOptions>;
1024
1749
  };
1025
1750
  internal: {
1026
- CommentMeasuredContentItem: (i: unknown) => i is CommentMeasuredContentItem;
1027
- CommentMeasuredContentItemArray: (i: unknown) => i is CommentMeasuredContentItem[];
1751
+ CommentMeasuredContentItem: (i: unknown) => i is {
1752
+ type: "spacer";
1753
+ char: string;
1754
+ charWidth: number;
1755
+ count: number;
1756
+ isButton?: boolean | undefined;
1757
+ font?: "defont" | "gulim" | "simsun" | undefined;
1758
+ } | (({
1759
+ type: "spacer";
1760
+ char: string;
1761
+ charWidth: number;
1762
+ count: number;
1763
+ isButton?: boolean | undefined;
1764
+ font?: "defont" | "gulim" | "simsun" | undefined;
1765
+ } | {
1766
+ type: "text";
1767
+ content: string;
1768
+ slicedContent: string[];
1769
+ isButton?: boolean | undefined;
1770
+ font?: "defont" | "gulim" | "simsun" | undefined;
1771
+ width?: number[] | undefined;
1772
+ }) & {
1773
+ width: number[];
1774
+ });
1775
+ CommentMeasuredContentItemArray: (i: unknown) => i is ({
1776
+ type: "spacer";
1777
+ char: string;
1778
+ charWidth: number;
1779
+ count: number;
1780
+ isButton?: boolean | undefined;
1781
+ font?: "defont" | "gulim" | "simsun" | undefined;
1782
+ } | (({
1783
+ type: "spacer";
1784
+ char: string;
1785
+ charWidth: number;
1786
+ count: number;
1787
+ isButton?: boolean | undefined;
1788
+ font?: "defont" | "gulim" | "simsun" | undefined;
1789
+ } | {
1790
+ type: "text";
1791
+ content: string;
1792
+ slicedContent: string[];
1793
+ isButton?: boolean | undefined;
1794
+ font?: "defont" | "gulim" | "simsun" | undefined;
1795
+ width?: number[] | undefined;
1796
+ }) & {
1797
+ width: number[];
1798
+ }))[];
1028
1799
  MultiConfigItem: <T>(i: unknown) => i is MultiConfigItem<T>;
1029
- HTML5Fonts: (i: unknown) => i is HTML5Fonts;
1030
- MeasureInput: (i: unknown) => i is MeasureInput;
1800
+ HTML5Fonts: (i: unknown) => i is "defont" | "mincho" | "gothic";
1801
+ MeasureInput: (i: unknown) => i is {
1802
+ lineHeight: number;
1803
+ font: "defont" | "mincho" | "gothic" | "gulim" | "simsun";
1804
+ content: ({
1805
+ type: "spacer";
1806
+ char: string;
1807
+ charWidth: number;
1808
+ count: number;
1809
+ isButton?: boolean | undefined;
1810
+ font?: "defont" | "gulim" | "simsun" | undefined;
1811
+ } | {
1812
+ type: "text";
1813
+ content: string;
1814
+ slicedContent: string[];
1815
+ isButton?: boolean | undefined;
1816
+ font?: "defont" | "gulim" | "simsun" | undefined;
1817
+ width?: number[] | undefined;
1818
+ })[];
1819
+ charSize: number;
1820
+ lineCount: number;
1821
+ };
1031
1822
  };
1032
1823
  };
1033
1824
 
@@ -1035,10 +1826,10 @@ declare namespace typeGuard_d {
1035
1826
  export { typeGuard as default };
1036
1827
  }
1037
1828
 
1038
- declare const ArrayPush: (array: {
1829
+ declare const arrayPush: (array: {
1039
1830
  [key: number]: IComment[];
1040
1831
  }, key: string | number, push: IComment) => void;
1041
- declare const ArrayEqual: (a: unknown[], b: unknown[]) => boolean;
1832
+ declare const arrayEqual: (a: unknown[], b: unknown[]) => boolean;
1042
1833
 
1043
1834
  declare const hex2rgb: (hex: string) => number[];
1044
1835
  declare const hex2rgba: (hex: string) => number[];
@@ -1052,7 +1843,7 @@ declare const isReverseActive: (vpos: number, isOwner: boolean) => boolean;
1052
1843
  declare const isBanActive: (vpos: number) => boolean;
1053
1844
  declare const processFixedComment: (comment: IComment, collision: CollisionItem, timeline: Timeline) => void;
1054
1845
  declare const processMovableComment: (comment: IComment, collision: Collision, timeline: Timeline) => void;
1055
- declare const getPosY: (currentPos: number, targetComment: IComment, collision: IComment[] | undefined) => {
1846
+ declare const getPosY: (currentPos: number, targetComment: IComment, collision: IComment[] | undefined, isChanged?: boolean) => {
1056
1847
  currentPos: number;
1057
1848
  isChanged: boolean;
1058
1849
  isBreak: boolean;
@@ -1066,18 +1857,33 @@ declare const getConfig: <T>(input: ConfigItem<T>, isFlash?: boolean) => T;
1066
1857
 
1067
1858
  declare const getFlashFontIndex: (part: string) => CommentContentIndex[];
1068
1859
  declare const getFlashFontName: (font: CommentFlashFontParsed) => CommentFlashFont;
1069
- declare const parseContent: (content: string) => CommentContentItem[];
1860
+ declare const parseContent: (content: string) => ({
1861
+ type: "spacer";
1862
+ char: string;
1863
+ charWidth: number;
1864
+ count: number;
1865
+ isButton?: boolean | undefined;
1866
+ font?: "defont" | "gulim" | "simsun" | undefined;
1867
+ } | {
1868
+ type: "text";
1869
+ content: string;
1870
+ slicedContent: string[];
1871
+ isButton?: boolean | undefined;
1872
+ font?: "defont" | "gulim" | "simsun" | undefined;
1873
+ width?: number[] | undefined;
1874
+ })[];
1070
1875
  declare const getButtonParts: (comment: FormattedCommentWithSize) => FormattedCommentWithSize;
1071
1876
  declare const buildAtButtonComment: (comment: FormattedCommentWithSize, vpos: number) => FormattedComment | undefined;
1072
1877
 
1073
1878
  declare const getLineHeight: (fontSize: CommentSize, isFlash: boolean, resized?: boolean) => number;
1074
1879
  declare const getCharSize: (fontSize: CommentSize, isFlash: boolean) => number;
1075
- declare const measure: (comment: MeasureInput, context: Context2D) => {
1880
+ declare const measure: (comment: MeasureInput, renderer: IRenderer) => {
1076
1881
  height: number;
1077
1882
  width: number;
1078
1883
  lineWidth: number[];
1079
1884
  itemWidth: number[][];
1080
1885
  };
1886
+ declare const addHTML5PartToResult: (lineContent: CommentContentItem[], part: string, font?: CommentHTML5Font) => void;
1081
1887
  declare const getFontSizeAndScale: (charSize: number) => {
1082
1888
  scale: number;
1083
1889
  fontSize: number;
@@ -1085,8 +1891,9 @@ declare const getFontSizeAndScale: (charSize: number) => {
1085
1891
 
1086
1892
  declare const nativeSort: <T>(getter: (input: T) => number) => (a: T, b: T) => 1 | 0 | -1;
1087
1893
 
1088
- declare const index_d_ArrayEqual: typeof ArrayEqual;
1089
- declare const index_d_ArrayPush: typeof ArrayPush;
1894
+ declare const index_d_addHTML5PartToResult: typeof addHTML5PartToResult;
1895
+ declare const index_d_arrayEqual: typeof arrayEqual;
1896
+ declare const index_d_arrayPush: typeof arrayPush;
1090
1897
  declare const index_d_buildAtButtonComment: typeof buildAtButtonComment;
1091
1898
  declare const index_d_changeCALayer: typeof changeCALayer;
1092
1899
  declare const index_d_getButtonParts: typeof getButtonParts;
@@ -1114,7 +1921,7 @@ declare const index_d_parseFont: typeof parseFont;
1114
1921
  declare const index_d_processFixedComment: typeof processFixedComment;
1115
1922
  declare const index_d_processMovableComment: typeof processMovableComment;
1116
1923
  declare namespace index_d {
1117
- export { index_d_ArrayEqual as ArrayEqual, index_d_ArrayPush as ArrayPush, index_d_buildAtButtonComment as buildAtButtonComment, index_d_changeCALayer as changeCALayer, index_d_getButtonParts as getButtonParts, index_d_getCharSize as getCharSize, index_d_getConfig as getConfig, index_d_getDefaultCommand as getDefaultCommand, index_d_getFlashFontIndex as getFlashFontIndex, index_d_getFlashFontName as getFlashFontName, index_d_getFontSizeAndScale as getFontSizeAndScale, index_d_getLineHeight as getLineHeight, index_d_getPosX as getPosX, index_d_getPosY as getPosY, index_d_getStrokeColor as getStrokeColor, index_d_hex2rgb as hex2rgb, index_d_hex2rgba as hex2rgba, index_d_isBanActive as isBanActive, index_d_isFlashComment as isFlashComment, index_d_isLineBreakResize as isLineBreakResize, index_d_isReverseActive as isReverseActive, index_d_measure as measure, index_d_nativeSort as nativeSort, index_d_parseCommandAndNicoScript as parseCommandAndNicoScript, index_d_parseContent as parseContent, index_d_parseFont as parseFont, index_d_processFixedComment as processFixedComment, index_d_processMovableComment as processMovableComment };
1924
+ export { index_d_addHTML5PartToResult as addHTML5PartToResult, index_d_arrayEqual as arrayEqual, index_d_arrayPush as arrayPush, index_d_buildAtButtonComment as buildAtButtonComment, index_d_changeCALayer as changeCALayer, index_d_getButtonParts as getButtonParts, index_d_getCharSize as getCharSize, index_d_getConfig as getConfig, index_d_getDefaultCommand as getDefaultCommand, index_d_getFlashFontIndex as getFlashFontIndex, index_d_getFlashFontName as getFlashFontName, index_d_getFontSizeAndScale as getFontSizeAndScale, index_d_getLineHeight as getLineHeight, index_d_getPosX as getPosX, index_d_getPosY as getPosY, index_d_getStrokeColor as getStrokeColor, index_d_hex2rgb as hex2rgb, index_d_hex2rgba as hex2rgba, index_d_isBanActive as isBanActive, index_d_isFlashComment as isFlashComment, index_d_isLineBreakResize as isLineBreakResize, index_d_isReverseActive as isReverseActive, index_d_measure as measure, index_d_nativeSort as nativeSort, index_d_parseCommandAndNicoScript as parseCommandAndNicoScript, index_d_parseContent as parseContent, index_d_parseFont as parseFont, index_d_processFixedComment as processFixedComment, index_d_processMovableComment as processMovableComment };
1118
1925
  }
1119
1926
 
1120
1927
  declare const definition: {
@@ -1126,7 +1933,7 @@ declare const definition: {
1126
1933
 
1127
1934
  declare const internal_definition: typeof definition;
1128
1935
  declare namespace internal {
1129
- export { index_d$3 as comments, index_d$2 as contexts, internal_definition as definition, index_d$1 as errors, eventHandler_d as eventHandler, inputParser_d as inputParser, typeGuard_d as typeGuard, index_d as utils };
1936
+ export { index_d$4 as comments, index_d$3 as contexts, internal_definition as definition, index_d$2 as errors, eventHandler_d as eventHandler, inputParser_d as inputParser, index_d$1 as renderer, typeGuard_d as typeGuard, index_d as utils };
1130
1937
  }
1131
1938
 
1132
1939
  declare class NiconiComments {
@@ -1134,39 +1941,198 @@ declare class NiconiComments {
1134
1941
  showCollision: boolean;
1135
1942
  showFPS: boolean;
1136
1943
  showCommentCount: boolean;
1137
- video: HTMLVideoElement | undefined;
1138
1944
  private lastVpos;
1139
- private readonly canvas;
1945
+ private readonly renderer;
1140
1946
  private readonly collision;
1141
- private readonly context;
1142
1947
  private readonly timeline;
1143
1948
  static typeGuard: {
1144
1949
  formatted: {
1145
- comment: (i: unknown) => i is FormattedComment;
1146
- comments: (i: unknown) => i is FormattedComment[];
1147
- legacyComment: (i: unknown) => i is FormattedLegacyComment;
1148
- legacyComments: (i: unknown) => i is FormattedLegacyComment[];
1950
+ comment: (i: unknown) => i is {
1951
+ owner: boolean;
1952
+ content: string;
1953
+ id: number;
1954
+ vpos: number;
1955
+ date: number;
1956
+ date_usec: number;
1957
+ premium: boolean;
1958
+ mail: string[];
1959
+ user_id: number;
1960
+ layer: number;
1961
+ is_my_post: boolean;
1962
+ };
1963
+ comments: (i: unknown) => i is {
1964
+ owner: boolean;
1965
+ content: string;
1966
+ id: number;
1967
+ vpos: number;
1968
+ date: number;
1969
+ date_usec: number;
1970
+ premium: boolean;
1971
+ mail: string[];
1972
+ user_id: number;
1973
+ layer: number;
1974
+ is_my_post: boolean;
1975
+ }[];
1976
+ legacyComment: (i: unknown) => i is {
1977
+ owner: boolean;
1978
+ content: string;
1979
+ id: number;
1980
+ vpos: number;
1981
+ date: number;
1982
+ date_usec: number;
1983
+ premium: boolean;
1984
+ mail: string[];
1985
+ };
1986
+ legacyComments: (i: unknown) => i is {
1987
+ owner: boolean;
1988
+ content: string;
1989
+ id: number;
1990
+ vpos: number;
1991
+ date: number;
1992
+ date_usec: number;
1993
+ premium: boolean;
1994
+ mail: string[];
1995
+ }[];
1149
1996
  };
1150
1997
  legacy: {
1151
- rawApiResponses: (i: unknown) => i is RawApiResponse[];
1152
- apiChat: (i: unknown) => i is ApiChat;
1153
- apiGlobalNumRes: (i: unknown) => i is ApiGlobalNumRes;
1154
- apiLeaf: (i: unknown) => i is ApiLeaf;
1155
- apiPing: (i: unknown) => i is ApiPing;
1156
- apiThread: (i: unknown) => i is ApiThread;
1998
+ rawApiResponses: (i: unknown) => i is ({
1999
+ chat: {
2000
+ content: string;
2001
+ vpos: number;
2002
+ date: number;
2003
+ date_usec: number;
2004
+ premium: number;
2005
+ mail: string;
2006
+ user_id: string;
2007
+ thread: string;
2008
+ no: number;
2009
+ nicoru: number;
2010
+ anonymity: number;
2011
+ deleted: number;
2012
+ };
2013
+ } | {
2014
+ [x: string]: unknown;
2015
+ })[];
2016
+ apiChat: (i: unknown) => i is {
2017
+ content: string;
2018
+ vpos: number;
2019
+ date: number;
2020
+ date_usec: number;
2021
+ premium: number;
2022
+ mail: string;
2023
+ user_id: string;
2024
+ thread: string;
2025
+ no: number;
2026
+ nicoru: number;
2027
+ anonymity: number;
2028
+ deleted: number;
2029
+ };
2030
+ apiGlobalNumRes: (i: unknown) => i is {
2031
+ thread: string;
2032
+ num_res: number;
2033
+ };
2034
+ apiLeaf: (i: unknown) => i is {
2035
+ count: number;
2036
+ thread: string;
2037
+ };
2038
+ apiPing: (i: unknown) => i is {
2039
+ content: string;
2040
+ };
2041
+ apiThread: (i: unknown) => i is {
2042
+ thread: string;
2043
+ resultcode: number;
2044
+ server_time: number;
2045
+ ticket: string;
2046
+ revision: number;
2047
+ };
1157
2048
  };
1158
2049
  xmlDocument: (i: unknown) => i is XMLDocument;
1159
2050
  legacyOwner: {
1160
2051
  comments: (i: unknown) => i is string;
1161
2052
  };
1162
2053
  owner: {
1163
- comment: (i: unknown) => i is OwnerComment;
1164
- comments: (i: unknown) => i is OwnerComment[];
2054
+ comment: (i: unknown) => i is {
2055
+ time: string;
2056
+ command: string;
2057
+ comment: string;
2058
+ };
2059
+ comments: (i: unknown) => i is {
2060
+ time: string;
2061
+ command: string;
2062
+ comment: string;
2063
+ }[];
1165
2064
  };
1166
2065
  v1: {
1167
- comment: (i: unknown) => i is V1Comment;
1168
- thread: (i: unknown) => i is V1Thread;
1169
- threads: (i: unknown) => i is V1Thread[];
2066
+ comment: (i: unknown) => i is {
2067
+ id: string;
2068
+ no: number;
2069
+ vposMs: number;
2070
+ body: string;
2071
+ commands: string[];
2072
+ userId: string;
2073
+ isPremium: boolean;
2074
+ score: number;
2075
+ postedAt: string;
2076
+ nicoruCount: number;
2077
+ nicoruId: string | null;
2078
+ source: string;
2079
+ isMyPost: boolean;
2080
+ };
2081
+ comments: (i: unknown) => i is {
2082
+ id: string;
2083
+ no: number;
2084
+ vposMs: number;
2085
+ body: string;
2086
+ commands: string[];
2087
+ userId: string;
2088
+ isPremium: boolean;
2089
+ score: number;
2090
+ postedAt: string;
2091
+ nicoruCount: number;
2092
+ nicoruId: string | null;
2093
+ source: string;
2094
+ isMyPost: boolean;
2095
+ }[];
2096
+ thread: (i: unknown) => i is {
2097
+ fork: string;
2098
+ commentCount: number;
2099
+ comments: {
2100
+ id: string;
2101
+ no: number;
2102
+ vposMs: number;
2103
+ body: string;
2104
+ commands: string[];
2105
+ userId: string;
2106
+ isPremium: boolean;
2107
+ score: number;
2108
+ postedAt: string;
2109
+ nicoruCount: number;
2110
+ nicoruId: string | null;
2111
+ source: string;
2112
+ isMyPost: boolean;
2113
+ }[];
2114
+ id?: unknown;
2115
+ };
2116
+ threads: (i: unknown) => i is {
2117
+ fork: string;
2118
+ commentCount: number;
2119
+ comments: {
2120
+ id: string;
2121
+ no: number;
2122
+ vposMs: number;
2123
+ body: string;
2124
+ commands: string[];
2125
+ userId: string;
2126
+ isPremium: boolean;
2127
+ score: number;
2128
+ postedAt: string;
2129
+ nicoruCount: number;
2130
+ nicoruId: string | null;
2131
+ source: string;
2132
+ isMyPost: boolean;
2133
+ }[];
2134
+ id?: unknown;
2135
+ }[];
1170
2136
  };
1171
2137
  nicoScript: {
1172
2138
  range: {
@@ -1179,9 +2145,9 @@ declare class NiconiComments {
1179
2145
  };
1180
2146
  };
1181
2147
  comment: {
1182
- font: (i: unknown) => i is CommentFont;
1183
- loc: (i: unknown) => i is CommentLoc;
1184
- size: (i: unknown) => i is CommentSize;
2148
+ font: (i: unknown) => i is "defont" | "mincho" | "gothic" | "gulim" | "simsun";
2149
+ loc: (i: unknown) => i is "ue" | "naka" | "shita";
2150
+ size: (i: unknown) => i is "big" | "medium" | "small";
1185
2151
  command: {
1186
2152
  key: (i: unknown) => i is "full" | "ender" | "_live" | "invisible";
1187
2153
  };
@@ -1193,20 +2159,98 @@ declare class NiconiComments {
1193
2159
  initOptions: (item: unknown) => item is Partial<BaseOptions>;
1194
2160
  };
1195
2161
  internal: {
1196
- CommentMeasuredContentItem: (i: unknown) => i is CommentMeasuredContentItem;
1197
- CommentMeasuredContentItemArray: (i: unknown) => i is CommentMeasuredContentItem[];
2162
+ CommentMeasuredContentItem: (i: unknown) => i is {
2163
+ type: "spacer";
2164
+ char: string;
2165
+ charWidth: number;
2166
+ count: number;
2167
+ isButton?: boolean | undefined;
2168
+ font?: "defont" | "gulim" | "simsun" | undefined;
2169
+ } | (({
2170
+ type: "spacer";
2171
+ char: string;
2172
+ charWidth: number;
2173
+ count: number;
2174
+ isButton?: boolean | undefined;
2175
+ font?: "defont" | "gulim" | "simsun" | undefined;
2176
+ } | {
2177
+ type: "text";
2178
+ content: string;
2179
+ slicedContent: string[];
2180
+ isButton?: boolean | undefined;
2181
+ font?: "defont" | "gulim" | "simsun" | undefined;
2182
+ width?: number[] | undefined;
2183
+ }) & {
2184
+ width: number[];
2185
+ });
2186
+ CommentMeasuredContentItemArray: (i: unknown) => i is ({
2187
+ type: "spacer";
2188
+ char: string;
2189
+ charWidth: number;
2190
+ count: number;
2191
+ isButton?: boolean | undefined;
2192
+ font?: "defont" | "gulim" | "simsun" | undefined;
2193
+ } | (({
2194
+ type: "spacer";
2195
+ char: string;
2196
+ charWidth: number;
2197
+ count: number;
2198
+ isButton?: boolean | undefined;
2199
+ font?: "defont" | "gulim" | "simsun" | undefined;
2200
+ } | {
2201
+ type: "text";
2202
+ content: string;
2203
+ slicedContent: string[];
2204
+ isButton?: boolean | undefined;
2205
+ font?: "defont" | "gulim" | "simsun" | undefined;
2206
+ width?: number[] | undefined;
2207
+ }) & {
2208
+ width: number[];
2209
+ }))[];
1198
2210
  MultiConfigItem: <T>(i: unknown) => i is MultiConfigItem<T>;
1199
- HTML5Fonts: (i: unknown) => i is HTML5Fonts;
1200
- MeasureInput: (i: unknown) => i is MeasureInput;
2211
+ HTML5Fonts: (i: unknown) => i is "defont" | "mincho" | "gothic";
2212
+ MeasureInput: (i: unknown) => i is {
2213
+ lineHeight: number;
2214
+ font: "defont" | "mincho" | "gothic" | "gulim" | "simsun";
2215
+ content: ({
2216
+ type: "spacer";
2217
+ char: string;
2218
+ charWidth: number;
2219
+ count: number;
2220
+ isButton?: boolean | undefined;
2221
+ font?: "defont" | "gulim" | "simsun" | undefined;
2222
+ } | {
2223
+ type: "text";
2224
+ content: string;
2225
+ slicedContent: string[];
2226
+ isButton?: boolean | undefined;
2227
+ font?: "defont" | "gulim" | "simsun" | undefined;
2228
+ width?: number[] | undefined;
2229
+ })[];
2230
+ charSize: number;
2231
+ lineCount: number;
2232
+ };
1201
2233
  };
1202
2234
  };
1203
2235
  static default: typeof NiconiComments;
1204
2236
  static FlashComment: {
1205
- condition: (comment: FormattedComment) => boolean;
2237
+ condition: (comment: {
2238
+ owner: boolean;
2239
+ content: string;
2240
+ id: number;
2241
+ vpos: number;
2242
+ date: number;
2243
+ date_usec: number;
2244
+ premium: boolean;
2245
+ mail: string[];
2246
+ user_id: number;
2247
+ layer: number;
2248
+ is_my_post: boolean;
2249
+ }) => boolean;
1206
2250
  class: typeof FlashComment;
1207
2251
  };
1208
2252
  static internal: typeof internal;
1209
- constructor(canvas: Canvas, data: InputFormat, initOptions?: Options);
2253
+ constructor(renderer: IRenderer | HTMLCanvasElement, data: InputFormat, initOptions?: Options);
1210
2254
  private preRendering;
1211
2255
  private getCommentPos;
1212
2256
  private sortComment;
@@ -1223,4 +2267,4 @@ declare class NiconiComments {
1223
2267
  click(vpos: number, pos: Position): void;
1224
2268
  }
1225
2269
 
1226
- export { type ApiChat, type ApiGlobalNumRes, type ApiLeaf, type ApiPing, type ApiThread, type BaseConfig, type BaseOptions, type ButtonList, type ButtonParams, type ButtonPartLeft, type ButtonPartMiddle, type ButtonPartRight, type Canvas, type Collision, type CollisionItem, type CollisionPos, type CommentContentIndex, type CommentContentItem, type CommentDisableEvent, type CommentDisableEventHandler, type CommentEnableEvent, type CommentEnableEventHandler, type CommentEventBase, type CommentEventHandler, type CommentEventHandlerMap, type CommentEventMap, type CommentEventName, type CommentFlashFont, type CommentFlashFontParsed, type CommentFont, type CommentLoc, type CommentMeasuredContentItem, type CommentSize, type CommentStageSize, type Config, type ConfigItem, type Context2D, type DefaultCommand, type FlashMode, type FlashScriptChar, type FontItem, type FormattedComment, type FormattedCommentWithFont, type FormattedCommentWithSize, type FormattedLegacyComment, type HTML5Fonts, type IComment, type IPlugin, type IPluginConstructor, type IPluginList, type InputFormat, type InputFormatType, type JumpEvent, type JumpEventHandler, type MeasureInput, type MeasureTextInput, type MeasureTextResult, type MultiConfigItem, type NicoScript, type NicoScriptReplace, type NicoScriptReplaceCondition, type NicoScriptReplaceRange, type NicoScriptReplaceTarget, type NicoScriptReverseTarget, type Options, type OwnerComment, type ParseCommandAndNicoScriptResult, type ParseContentResult, type ParsedCommand, type Platform, type PlatformFont, type Position, type RawApiResponse, type SeekDisableEvent, type SeekDisableEventHandler, type SeekEnableEvent, type SeekEnableEventHandler, type Timeline, type V1Comment, type V1Thread, type ValueOf, NiconiComments as default, type formattedComment, type formattedLegacyComment, type inputFormat, type inputFormatType, type ownerComment, type rawApiResponse, type v1Thread };
2270
+ export { type ApiChat, type ApiGlobalNumRes, type ApiLeaf, type ApiPing, type ApiThread, type BaseConfig, type BaseOptions, type ButtonList, type ButtonParams, type ButtonPartLeft, type ButtonPartMiddle, type ButtonPartRight, type Canvas, type Collision, type CollisionItem, type CollisionPos, type CommentContentIndex, type CommentContentItem, type CommentContentItemText, type CommentDisableEvent, type CommentDisableEventHandler, type CommentEnableEvent, type CommentEnableEventHandler, type CommentEventBase, type CommentEventHandler, type CommentEventHandlerMap, type CommentEventMap, type CommentEventName, type CommentFlashFont, type CommentFlashFontParsed, type CommentFont, type CommentHTML5Font, type CommentLoc, type CommentMeasuredContentItem, type CommentSize, type CommentStageSize, type Config, type ConfigItem, type Context2D, type DefaultCommand, type FlashMode, type FlashScriptChar, type FontItem, type FormattedComment, type FormattedCommentWithFont, type FormattedCommentWithSize, type FormattedLegacyComment, type HTML5Fonts, type IComment, type IPlugin, type IPluginConstructor, type IPluginList, type IRenderer, type InputFormat, type InputFormatType, type JumpEvent, type JumpEventHandler, type MeasureInput, type MeasureTextInput, type MeasureTextResult, type MultiConfigItem, type NicoScript, type NicoScriptReplace, type NicoScriptReplaceCondition, type NicoScriptReplaceRange, type NicoScriptReplaceTarget, type NicoScriptReverseTarget, type Options, type OwnerComment, type ParseCommandAndNicoScriptResult, type ParseContentResult, type ParsedCommand, type Platform, type PlatformFont, type Position, type RawApiResponse, type SeekDisableEvent, type SeekDisableEventHandler, type SeekEnableEvent, type SeekEnableEventHandler, type Timeline, type V1Comment, type V1Thread, type ValueOf, ZApiChat, ZApiGlobalNumRes, ZApiLeaf, ZApiPing, ZApiThread, ZCommentContentItem, ZCommentContentItemSpacer, ZCommentContentItemText, ZCommentFlashFont, ZCommentFont, ZCommentHTML5Font, ZCommentLoc, ZCommentMeasuredContentItem, ZCommentMeasuredContentItemText, ZCommentSize, ZFormattedComment, ZFormattedLegacyComment, ZHTML5Fonts, ZMeasureInput, ZOwnerComment, ZRawApiResponse, ZV1Comment, ZV1Thread, NiconiComments as default, type formattedComment, type formattedLegacyComment, type inputFormat, type inputFormatType, type ownerComment, type rawApiResponse, type v1Thread };