@xpadev-net/niconicomments 0.2.61 → 0.2.62

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 +1236 -618
  2. package/dist/bundle.js +2096 -568
  3. package/package.json +17 -17
package/dist/bundle.d.ts CHANGED
@@ -1,45 +1,80 @@
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
+ drawVideo(enableLegacyPip: boolean): void;
45
+ getFont(): string;
46
+ getFillStyle(): string | CanvasGradient | CanvasPattern;
47
+ setScale(scale: number, arg1?: number): void;
48
+ fillRect(x: number, y: number, width: number, height: number): void;
49
+ strokeRect(x: number, y: number, width: number, height: number): void;
50
+ fillText(text: string, x: number, y: number): void;
51
+ strokeText(text: string, x: number, y: number): void;
52
+ quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void;
53
+ clearRect(x: number, y: number, width: number, height: number): void;
54
+ setFont(font: string): void;
55
+ setFillStyle(color: string): void;
56
+ setStrokeStyle(color: string): void;
57
+ setLineWidth(width: number): void;
58
+ setGlobalAlpha(alpha: number): void;
59
+ setSize(width: number, height: number): void;
60
+ getSize(): {
61
+ width: number;
62
+ height: number;
63
+ };
64
+ measureText(text: string): TextMetrics;
65
+ beginPath(): void;
66
+ closePath(): void;
67
+ moveTo(x: number, y: number): void;
68
+ lineTo(x: number, y: number): void;
69
+ stroke(): void;
70
+ save(): void;
71
+ restore(): void;
72
+ getCanvas(): IRenderer;
73
+ drawImage(image: IRenderer, x: number, y: number, width?: number, height?: number): void;
74
+ }
75
+
41
76
  declare class BaseComment implements IComment {
42
- protected readonly context: Context2D;
77
+ protected readonly renderer: IRenderer;
43
78
  protected cacheKey: string;
44
79
  comment: FormattedCommentWithSize;
45
80
  pos: {
@@ -48,11 +83,11 @@ declare class BaseComment implements IComment {
48
83
  };
49
84
  posY: number;
50
85
  readonly pluginName: string;
51
- image?: Canvas | null;
52
- buttonImage?: Canvas | null;
53
- constructor(comment: FormattedComment, context: Context2D);
86
+ image?: IRenderer | null;
87
+ buttonImage?: IRenderer | null;
88
+ constructor(comment: FormattedComment, renderer: IRenderer);
54
89
  get invisible(): boolean;
55
- get loc(): CommentLoc;
90
+ get loc(): "ue" | "naka" | "shita";
56
91
  get long(): number;
57
92
  get vpos(): number;
58
93
  get width(): number;
@@ -74,55 +109,72 @@ declare class BaseComment implements IComment {
74
109
  protected _drawBackgroundColor(posX: number, posY: number): void;
75
110
  protected _drawDebugInfo(posX: number, posY: number): void;
76
111
  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;
112
+ protected getTextImage(): IRenderer | null;
113
+ protected _generateTextImage(): IRenderer;
114
+ protected _cacheImage(image: IRenderer): void;
115
+ protected getButtonImage(posX: number, posY: number, cursor?: Position): IRenderer | undefined;
85
116
  isHovered(cursor?: Position, posX?: number, posY?: number): boolean;
117
+ protected getCacheKey(): string;
86
118
  }
87
119
 
88
120
  declare class FlashComment extends BaseComment {
89
121
  private _globalScale;
90
122
  readonly pluginName: string;
91
- buttonImage: Canvas;
92
- protected buttonContext: Context2D;
93
- constructor(comment: FormattedComment, context: Context2D);
123
+ buttonImage: IRenderer;
124
+ constructor(comment: FormattedComment, renderer: IRenderer);
94
125
  get content(): string;
95
126
  set content(input: string);
96
127
  convertComment(comment: FormattedComment): FormattedCommentWithSize;
97
128
  getCommentSize(parsedData: FormattedCommentWithFont): FormattedCommentWithSize;
98
129
  parseCommandAndNicoscript(comment: FormattedComment): FormattedCommentWithFont;
99
130
  parseContent(input: string, button?: ButtonParams): {
100
- content: CommentContentItem[];
131
+ content: ({
132
+ type: "spacer";
133
+ char: string;
134
+ charWidth: number;
135
+ count: number;
136
+ isButton?: boolean | undefined;
137
+ font?: "defont" | "gulim" | "simsun" | undefined;
138
+ } | {
139
+ type: "text";
140
+ content: string;
141
+ slicedContent: string[];
142
+ isButton?: boolean | undefined;
143
+ font?: "defont" | "gulim" | "simsun" | undefined;
144
+ width?: number[] | undefined;
145
+ })[];
101
146
  lineCount: number;
102
147
  lineOffset: number;
103
148
  };
104
149
  measureText(comment: MeasureTextInput): MeasureTextResult;
150
+ private _isDoubleResize;
105
151
  private _measureContent;
106
152
  _drawCollision(posX: number, posY: number, showCollision: boolean): void;
107
- _generateTextImage(): Canvas;
108
- getButtonImage(posX: number, posY: number, cursor?: Position): HTMLCanvasElement | undefined;
153
+ _generateTextImage(): IRenderer;
154
+ getButtonImage(posX: number, posY: number, cursor?: Position): IRenderer | undefined;
109
155
  isHovered(_cursor?: Position, _posX?: number, _posY?: number): boolean;
110
- protected _setupCanvas(image: Canvas, context: Context2D): {
111
- image: HTMLCanvasElement;
112
- context: CanvasRenderingContext2D;
156
+ protected _setupCanvas(renderer: IRenderer): {
157
+ renderer: IRenderer;
113
158
  };
114
159
  }
115
160
 
116
161
  declare class HTML5Comment extends BaseComment {
117
162
  readonly pluginName: string;
118
- constructor(comment: FormattedComment, context: Context2D);
163
+ constructor(comment: FormattedComment, context: IRenderer);
119
164
  get content(): string;
120
165
  set content(input: string);
121
166
  convertComment(comment: FormattedComment): FormattedCommentWithSize;
122
167
  getCommentSize(parsedData: FormattedCommentWithFont): FormattedCommentWithSize;
123
168
  parseCommandAndNicoscript(comment: FormattedComment): FormattedCommentWithFont;
124
- parseContent(input: string): {
125
- content: CommentContentItem[];
169
+ parseContent(input: string, font?: HTML5Fonts): {
170
+ content: {
171
+ type: "text";
172
+ content: string;
173
+ slicedContent: string[];
174
+ isButton?: boolean | undefined;
175
+ font?: "defont" | "gulim" | "simsun" | undefined;
176
+ width?: number[] | undefined;
177
+ }[];
126
178
  lineCount: number;
127
179
  lineOffset: number;
128
180
  };
@@ -130,598 +182,1065 @@ declare class HTML5Comment extends BaseComment {
130
182
  private _measureComment;
131
183
  private _processResizeX;
132
184
  _drawCollision(posX: number, posY: number, showCollision: boolean): void;
133
- _generateTextImage(): Canvas;
185
+ _generateTextImage(): IRenderer;
134
186
  getButtonImage(): undefined;
135
187
  isHovered(): boolean;
136
188
  }
137
189
 
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 };
190
+ type index_d$4_BaseComment = BaseComment;
191
+ declare const index_d$4_BaseComment: typeof BaseComment;
192
+ type index_d$4_FlashComment = FlashComment;
193
+ declare const index_d$4_FlashComment: typeof FlashComment;
194
+ type index_d$4_HTML5Comment = HTML5Comment;
195
+ declare const index_d$4_HTML5Comment: typeof HTML5Comment;
196
+ declare namespace index_d$4 {
197
+ export { index_d$4_BaseComment as BaseComment, index_d$4_FlashComment as FlashComment, index_d$4_HTML5Comment as HTML5Comment };
146
198
  }
147
199
 
148
200
  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
-
201
+ type MultiConfigItem<T> = {
202
+ html5: T;
203
+ flash: T;
204
+ };
205
+ type ConfigSizeItem<T> = {
206
+ big: T;
207
+ medium: T;
208
+ small: T;
209
+ };
210
+ type ConfigResizedItem<T> = {
211
+ default: T;
212
+ resized: T;
213
+ };
214
+ type ConfigFlashFontItem<T> = {
215
+ gulim: T;
216
+ simsun: T;
217
+ defont: T;
218
+ };
219
+ type ConfigHTML5FontItem<T> = {
220
+ gothic: T;
221
+ mincho: T;
222
+ defont: T;
223
+ };
153
224
  type CommentStageSize = {
154
- width: number;
155
- fullWidth: number;
156
- height: number;
225
+ width: number;
226
+ fullWidth: number;
227
+ height: number;
157
228
  };
158
-
159
229
  type FlashCharList = {
160
- [key in "simsunStrong" | "simsunWeak" | "gulim" | "gothic"]: string;
230
+ [key in "simsunStrong" | "simsunWeak" | "gulim" | "gothic"]: string;
161
231
  };
162
232
  type FlashMode = "xp" | "vista";
163
233
  type FlashScriptChar = {
164
- [key in "super" | "sub"]: string;
234
+ [key in "super" | "sub"]: string;
165
235
  };
166
236
  type FontList = {
167
- [key in "gulim" | "simsun"]: string;
237
+ [key in "gulim" | "simsun"]: string;
168
238
  };
169
239
  type LineCounts = {
170
- [key in "default" | "resized" | "doubleResized"]: ConfigSizeItem<number>;
240
+ [key in "default" | "resized" | "doubleResized"]: ConfigSizeItem<number>;
171
241
  };
172
- type TypeDoubleResizeMaxWidth = {
173
- [key in "full" | "normal"]: number;
174
- };
175
-
176
242
  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;
243
+ cacheAge: number;
244
+ canvasHeight: number;
245
+ canvasWidth: number;
246
+ collisionRange: {
247
+ [key in "left" | "right"]: number;
248
+ };
249
+ collisionPadding: number;
250
+ colors: {
251
+ [key: string]: string;
252
+ };
253
+ commentDrawPadding: number;
254
+ commentDrawRange: number;
255
+ commentScale: ConfigItem<number>;
256
+ commentStageSize: ConfigItem<CommentStageSize>;
257
+ flashCommentYOffset: ConfigSizeItem<ConfigResizedItem<number>>;
258
+ flashCommentYPaddingTop: ConfigResizedItem<number>;
259
+ contextFillLiveOpacity: number;
260
+ contextLineWidth: ConfigItem<number>;
261
+ contextStrokeColor: string;
262
+ contextStrokeInversionColor: string;
263
+ contextStrokeOpacity: number;
264
+ flashChar: FlashCharList;
265
+ flashMode: FlashMode;
266
+ flashScriptChar: FlashScriptChar;
267
+ flashThreshold: number;
268
+ fonts: {
269
+ flash: FontList;
270
+ html5: PlatformFont;
271
+ };
272
+ fontSize: ConfigItem<ConfigSizeItem<ConfigResizedItem<number>>>;
273
+ fpsInterval: number;
274
+ html5HiResCommentCorrection: number;
275
+ html5LineCounts: ConfigItem<LineCounts>;
276
+ lineHeight: ConfigItem<ConfigSizeItem<ConfigResizedItem<number>>>;
277
+ html5MinFontSize: number;
278
+ sameCAGap: number;
279
+ sameCAMinScore: number;
280
+ sameCARange: number;
281
+ sameCATimestampRange: number;
282
+ flashLetterSpacing: number;
283
+ flashScriptCharOffset: number;
284
+ plugins: IPluginConstructor[];
285
+ commentPlugins: {
286
+ class: typeof BaseComment;
287
+ condition: (comment: FormattedComment) => boolean;
288
+ }[];
289
+ commentLimit: number | undefined;
290
+ hideCommentOrder: "asc" | "desc";
291
+ lineBreakCount: {
292
+ [key in CommentSize]: number;
293
+ };
294
+ nakaCommentSpeedOffset: number;
295
+ atButtonPadding: number;
296
+ atButtonRadius: number;
297
+ flashDoubleResizeHeights: Partial<ConfigSizeItem<{
298
+ [key: number]: number;
299
+ }>>;
300
+ flashLineBreakScale: ConfigSizeItem<number>;
301
+ compatSpacer: {
302
+ flash: {
303
+ [key: string]: Partial<ConfigFlashFontItem<number>>;
304
+ };
305
+ html5: {
306
+ [key: string]: Partial<ConfigHTML5FontItem<number>>;
307
+ };
308
+ };
224
309
  };
225
-
226
310
  type Config = Partial<BaseConfig>;
227
311
 
228
312
  type Position = {
229
- x: number;
230
- y: number;
313
+ x: number;
314
+ y: number;
231
315
  };
232
316
 
233
317
  interface CommentEventBase {
234
- type: CommentEventName;
235
- timeStamp: number;
236
- vpos: number;
318
+ type: CommentEventName;
319
+ timeStamp: number;
320
+ vpos: number;
237
321
  }
238
-
239
322
  interface SeekDisableEvent extends CommentEventBase {
240
- type: "seekDisable";
323
+ type: "seekDisable";
241
324
  }
242
-
243
325
  type SeekDisableEventHandler = (event: SeekDisableEvent) => unknown;
244
-
245
326
  interface SeekEnableEvent extends CommentEventBase {
246
- type: "seekEnable";
327
+ type: "seekEnable";
247
328
  }
248
329
  type SeekEnableEventHandler = (event: SeekEnableEvent) => unknown;
249
-
250
330
  interface CommentDisableEvent extends CommentEventBase {
251
- type: "commentDisable";
331
+ type: "commentDisable";
252
332
  }
253
- type CommentDisableEventHandler = (
254
- event: CommentDisableEvent,
255
- ) => unknown;
256
-
333
+ type CommentDisableEventHandler = (event: CommentDisableEvent) => unknown;
257
334
  interface CommentEnableEvent extends CommentEventBase {
258
- type: "commentEnable";
335
+ type: "commentEnable";
259
336
  }
260
337
  type CommentEnableEventHandler = (event: CommentEnableEvent) => unknown;
261
-
262
338
  interface JumpEvent extends CommentEventBase {
263
- type: "jump";
264
- to: string;
265
- message?: string;
339
+ type: "jump";
340
+ to: string;
341
+ message?: string;
266
342
  }
267
343
  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;
344
+ type CommentEventName = "seekDisable" | "seekEnable" | "commentDisable" | "commentEnable" | "jump";
345
+ type CommentEventHandler = SeekDisableEventHandler | SeekEnableEventHandler | CommentDisableEventHandler | CommentEnableEventHandler | JumpEventHandler;
281
346
  interface CommentEventHandlerMap {
282
- seekDisable: SeekDisableEventHandler;
283
- seekEnable: SeekEnableEventHandler;
284
- commentDisable: CommentDisableEventHandler;
285
- commentEnable: CommentEnableEventHandler;
286
- jump: JumpEventHandler;
347
+ seekDisable: SeekDisableEventHandler;
348
+ seekEnable: SeekEnableEventHandler;
349
+ commentDisable: CommentDisableEventHandler;
350
+ commentEnable: CommentEnableEventHandler;
351
+ jump: JumpEventHandler;
287
352
  }
288
353
  interface CommentEventMap {
289
- seekDisable: SeekDisableEvent;
290
- seekEnable: SeekEnableEvent;
291
- commentDisable: CommentDisableEvent;
292
- commentEnable: CommentEnableEvent;
293
- jump: JumpEvent;
354
+ seekDisable: SeekDisableEvent;
355
+ seekEnable: SeekEnableEvent;
356
+ commentDisable: CommentDisableEvent;
357
+ commentEnable: CommentEnableEvent;
358
+ jump: JumpEvent;
294
359
  }
295
360
 
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";
361
+ type Platform = "win7" | "win8_1" | "win" | "mac10_9" | "mac10_11" | "mac" | "other";
362
+ declare const ZHTML5Fonts: valibot.UnionSchema<[valibot.LiteralSchema<"gothic", "gothic">, valibot.LiteralSchema<"mincho", "mincho">, valibot.LiteralSchema<"defont", "defont">], "defont" | "mincho" | "gothic">;
363
+ type HTML5Fonts = Output<typeof ZHTML5Fonts>;
305
364
  type FontItem = {
306
- font: string;
307
- offset: number;
308
- weight: number;
365
+ font: string;
366
+ offset: number;
367
+ weight: number;
309
368
  };
310
369
  type PlatformFont = {
311
- [key in HTML5Fonts]: FontItem;
370
+ [key in HTML5Fonts]: FontItem;
312
371
  };
313
372
 
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
- */
373
+ declare const ZFormattedComment: valibot.ObjectSchema<{
374
+ id: valibot.OptionalSchema<valibot.NumberSchema<number>, 0, number>;
375
+ vpos: valibot.OptionalSchema<valibot.NumberSchema<number>, 0, number>;
376
+ content: valibot.OptionalSchema<valibot.StringSchema<string>, "", string>;
377
+ date: valibot.OptionalSchema<valibot.NumberSchema<number>, 0, number>;
378
+ date_usec: valibot.OptionalSchema<valibot.NumberSchema<number>, 0, number>;
379
+ owner: valibot.OptionalSchema<valibot.BooleanSchema<boolean>, false, boolean>;
380
+ premium: valibot.OptionalSchema<valibot.BooleanSchema<boolean>, false, boolean>;
381
+ mail: valibot.OptionalSchema<valibot.ArraySchema<valibot.StringSchema<string>, string[]>, never[], string[]>;
382
+ user_id: valibot.OptionalSchema<valibot.NumberSchema<number>, 0, number>;
383
+ layer: valibot.OptionalSchema<valibot.NumberSchema<number>, -1, number>;
384
+ is_my_post: valibot.OptionalSchema<valibot.BooleanSchema<boolean>, false, boolean>;
385
+ }, undefined, {
386
+ owner: boolean;
387
+ content: string;
388
+ vpos: number;
389
+ date: number;
390
+ id: number;
391
+ date_usec: number;
392
+ premium: boolean;
393
+ mail: string[];
394
+ user_id: number;
395
+ layer: number;
396
+ is_my_post: boolean;
397
+ }>;
398
+ type FormattedComment = Output<typeof ZFormattedComment>;
399
+ declare const ZFormattedLegacyComment: valibot.ObjectSchema<Omit<{
400
+ id: valibot.OptionalSchema<valibot.NumberSchema<number>, 0, number>;
401
+ vpos: valibot.OptionalSchema<valibot.NumberSchema<number>, 0, number>;
402
+ content: valibot.OptionalSchema<valibot.StringSchema<string>, "", string>;
403
+ date: valibot.OptionalSchema<valibot.NumberSchema<number>, 0, number>;
404
+ date_usec: valibot.OptionalSchema<valibot.NumberSchema<number>, 0, number>;
405
+ owner: valibot.OptionalSchema<valibot.BooleanSchema<boolean>, false, boolean>;
406
+ premium: valibot.OptionalSchema<valibot.BooleanSchema<boolean>, false, boolean>;
407
+ mail: valibot.OptionalSchema<valibot.ArraySchema<valibot.StringSchema<string>, string[]>, never[], string[]>;
408
+ user_id: valibot.OptionalSchema<valibot.NumberSchema<number>, 0, number>;
409
+ layer: valibot.OptionalSchema<valibot.NumberSchema<number>, -1, number>;
410
+ is_my_post: valibot.OptionalSchema<valibot.BooleanSchema<boolean>, false, boolean>;
411
+ }, "user_id" | "layer" | "is_my_post">, undefined, {
412
+ owner: boolean;
413
+ content: string;
414
+ vpos: number;
415
+ date: number;
416
+ id: number;
417
+ date_usec: number;
418
+ premium: boolean;
419
+ mail: string[];
420
+ }>;
421
+ type FormattedLegacyComment = Output<typeof ZFormattedLegacyComment>;
341
422
  type formattedComment = FormattedComment;
342
- /**
343
- * @deprecated
344
- */
345
423
  type formattedLegacyComment = FormattedLegacyComment;
346
424
 
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
- */
425
+ declare const ZApiChat: valibot.ObjectSchema<{
426
+ thread: valibot.OptionalSchema<valibot.StringSchema<string>, "", string>;
427
+ no: valibot.OptionalSchema<valibot.NumberSchema<number>, 0, number>;
428
+ vpos: valibot.NumberSchema<number>;
429
+ date: valibot.OptionalSchema<valibot.NumberSchema<number>, 0, number>;
430
+ date_usec: valibot.OptionalSchema<valibot.NumberSchema<number>, 0, number>;
431
+ nicoru: valibot.OptionalSchema<valibot.NumberSchema<number>, 0, number>;
432
+ premium: valibot.OptionalSchema<valibot.NumberSchema<number>, 0, number>;
433
+ anonymity: valibot.OptionalSchema<valibot.NumberSchema<number>, 0, number>;
434
+ user_id: valibot.OptionalSchema<valibot.StringSchema<string>, "", string>;
435
+ mail: valibot.OptionalSchema<valibot.StringSchema<string>, "", string>;
436
+ content: valibot.StringSchema<string>;
437
+ deleted: valibot.OptionalSchema<valibot.NumberSchema<number>, 0, number>;
438
+ }, undefined, {
439
+ content: string;
440
+ vpos: number;
441
+ date: number;
442
+ date_usec: number;
443
+ premium: number;
444
+ mail: string;
445
+ user_id: string;
446
+ thread: string;
447
+ no: number;
448
+ nicoru: number;
449
+ anonymity: number;
450
+ deleted: number;
451
+ }>;
452
+ type ApiChat = Output<typeof ZApiChat>;
453
+ declare const ZRawApiResponse: valibot.UnionSchema<[valibot.ObjectSchema<{
454
+ chat: valibot.ObjectSchema<{
455
+ thread: valibot.OptionalSchema<valibot.StringSchema<string>, "", string>;
456
+ no: valibot.OptionalSchema<valibot.NumberSchema<number>, 0, number>;
457
+ vpos: valibot.NumberSchema<number>;
458
+ date: valibot.OptionalSchema<valibot.NumberSchema<number>, 0, number>;
459
+ date_usec: valibot.OptionalSchema<valibot.NumberSchema<number>, 0, number>;
460
+ nicoru: valibot.OptionalSchema<valibot.NumberSchema<number>, 0, number>;
461
+ premium: valibot.OptionalSchema<valibot.NumberSchema<number>, 0, number>;
462
+ anonymity: valibot.OptionalSchema<valibot.NumberSchema<number>, 0, number>;
463
+ user_id: valibot.OptionalSchema<valibot.StringSchema<string>, "", string>;
464
+ mail: valibot.OptionalSchema<valibot.StringSchema<string>, "", string>;
465
+ content: valibot.StringSchema<string>;
466
+ deleted: valibot.OptionalSchema<valibot.NumberSchema<number>, 0, number>;
467
+ }, undefined, {
468
+ content: string;
469
+ vpos: number;
470
+ date: number;
471
+ date_usec: number;
472
+ premium: number;
473
+ mail: string;
474
+ user_id: string;
475
+ thread: string;
476
+ no: number;
477
+ nicoru: number;
478
+ anonymity: number;
479
+ deleted: number;
480
+ }>;
481
+ }, undefined, {
482
+ chat: {
483
+ content: string;
484
+ vpos: number;
485
+ date: number;
486
+ date_usec: number;
487
+ premium: number;
488
+ mail: string;
489
+ user_id: string;
490
+ thread: string;
491
+ no: number;
492
+ nicoru: number;
493
+ anonymity: number;
494
+ deleted: number;
495
+ };
496
+ }>, valibot.RecordSchema<valibot.StringSchema<string>, valibot.UnknownSchema<unknown>, {
497
+ [x: string]: unknown;
498
+ }>], {
499
+ chat: {
500
+ content: string;
501
+ vpos: number;
502
+ date: number;
503
+ date_usec: number;
504
+ premium: number;
505
+ mail: string;
506
+ user_id: string;
507
+ thread: string;
508
+ no: number;
509
+ nicoru: number;
510
+ anonymity: number;
511
+ deleted: number;
512
+ };
513
+ } | {
514
+ [x: string]: unknown;
515
+ }>;
516
+ type RawApiResponse = Output<typeof ZRawApiResponse>;
517
+ declare const ZApiPing: valibot.ObjectSchema<{
518
+ content: valibot.StringSchema<string>;
519
+ }, undefined, {
520
+ content: string;
521
+ }>;
522
+ type ApiPing = Output<typeof ZApiPing>;
523
+ declare const ZApiThread: valibot.ObjectSchema<{
524
+ resultcode: valibot.NumberSchema<number>;
525
+ thread: valibot.StringSchema<string>;
526
+ server_time: valibot.NumberSchema<number>;
527
+ ticket: valibot.StringSchema<string>;
528
+ revision: valibot.NumberSchema<number>;
529
+ }, undefined, {
530
+ thread: string;
531
+ resultcode: number;
532
+ server_time: number;
533
+ ticket: string;
534
+ revision: number;
535
+ }>;
536
+ type ApiThread = Output<typeof ZApiThread>;
537
+ declare const ZApiLeaf: valibot.ObjectSchema<{
538
+ thread: valibot.StringSchema<string>;
539
+ count: valibot.NumberSchema<number>;
540
+ }, undefined, {
541
+ count: number;
542
+ thread: string;
543
+ }>;
544
+ type ApiLeaf = Output<typeof ZApiLeaf>;
545
+ declare const ZApiGlobalNumRes: valibot.ObjectSchema<{
546
+ thread: valibot.StringSchema<string>;
547
+ num_res: valibot.NumberSchema<number>;
548
+ }, undefined, {
549
+ thread: string;
550
+ num_res: number;
551
+ }>;
552
+ type ApiGlobalNumRes = Output<typeof ZApiGlobalNumRes>;
386
553
  type rawApiResponse = RawApiResponse;
387
554
 
388
- type OwnerComment = {
389
- time: string;
390
- command: string;
391
- comment: string;
392
- };
393
-
394
- /**
395
- * @deprecated
396
- */
555
+ declare const ZOwnerComment: valibot.ObjectSchema<{
556
+ time: valibot.StringSchema<string>;
557
+ command: valibot.StringSchema<string>;
558
+ comment: valibot.StringSchema<string>;
559
+ }, undefined, {
560
+ time: string;
561
+ command: string;
562
+ comment: string;
563
+ }>;
564
+ type OwnerComment = Output<typeof ZOwnerComment>;
397
565
  type ownerComment = OwnerComment;
398
566
 
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
- */
567
+ declare const ZV1Comment: valibot.ObjectSchema<{
568
+ id: valibot.StringSchema<string>;
569
+ no: valibot.NumberSchema<number>;
570
+ vposMs: valibot.NumberSchema<number>;
571
+ body: valibot.StringSchema<string>;
572
+ commands: valibot.ArraySchema<valibot.StringSchema<string>, string[]>;
573
+ userId: valibot.StringSchema<string>;
574
+ isPremium: valibot.BooleanSchema<boolean>;
575
+ score: valibot.NumberSchema<number>;
576
+ postedAt: valibot.StringSchema<string>;
577
+ nicoruCount: valibot.NumberSchema<number>;
578
+ nicoruId: valibot.NullableSchema<valibot.StringSchema<string>, undefined, string | null>;
579
+ source: valibot.StringSchema<string>;
580
+ isMyPost: valibot.BooleanSchema<boolean>;
581
+ }, undefined, {
582
+ id: string;
583
+ no: number;
584
+ vposMs: number;
585
+ body: string;
586
+ commands: string[];
587
+ userId: string;
588
+ isPremium: boolean;
589
+ score: number;
590
+ postedAt: string;
591
+ nicoruCount: number;
592
+ nicoruId: string | null;
593
+ source: string;
594
+ isMyPost: boolean;
595
+ }>;
596
+ type V1Comment = Output<typeof ZV1Comment>;
597
+ declare const ZV1Thread: valibot.ObjectSchema<{
598
+ id: valibot.UnknownSchema<unknown>;
599
+ fork: valibot.StringSchema<string>;
600
+ commentCount: valibot.OptionalSchema<valibot.NumberSchema<number>, 0, number>;
601
+ comments: valibot.ArraySchema<valibot.ObjectSchema<{
602
+ id: valibot.StringSchema<string>;
603
+ no: valibot.NumberSchema<number>;
604
+ vposMs: valibot.NumberSchema<number>;
605
+ body: valibot.StringSchema<string>;
606
+ commands: valibot.ArraySchema<valibot.StringSchema<string>, string[]>;
607
+ userId: valibot.StringSchema<string>;
608
+ isPremium: valibot.BooleanSchema<boolean>;
609
+ score: valibot.NumberSchema<number>;
610
+ postedAt: valibot.StringSchema<string>;
611
+ nicoruCount: valibot.NumberSchema<number>;
612
+ nicoruId: valibot.NullableSchema<valibot.StringSchema<string>, undefined, string | null>;
613
+ source: valibot.StringSchema<string>;
614
+ isMyPost: valibot.BooleanSchema<boolean>;
615
+ }, undefined, {
616
+ id: string;
617
+ no: number;
618
+ vposMs: number;
619
+ body: string;
620
+ commands: string[];
621
+ userId: string;
622
+ isPremium: boolean;
623
+ score: number;
624
+ postedAt: string;
625
+ nicoruCount: number;
626
+ nicoruId: string | null;
627
+ source: string;
628
+ isMyPost: boolean;
629
+ }>, {
630
+ id: string;
631
+ no: number;
632
+ vposMs: number;
633
+ body: string;
634
+ commands: string[];
635
+ userId: string;
636
+ isPremium: boolean;
637
+ score: number;
638
+ postedAt: string;
639
+ nicoruCount: number;
640
+ nicoruId: string | null;
641
+ source: string;
642
+ isMyPost: boolean;
643
+ }[]>;
644
+ }, undefined, {
645
+ fork: string;
646
+ commentCount: number;
647
+ comments: {
648
+ id: string;
649
+ no: number;
650
+ vposMs: number;
651
+ body: string;
652
+ commands: string[];
653
+ userId: string;
654
+ isPremium: boolean;
655
+ score: number;
656
+ postedAt: string;
657
+ nicoruCount: number;
658
+ nicoruId: string | null;
659
+ source: string;
660
+ isMyPost: boolean;
661
+ }[];
662
+ id?: unknown;
663
+ }>;
664
+ type V1Thread = Output<typeof ZV1Thread>;
424
665
  type v1Thread = V1Thread;
425
666
 
426
667
  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;
668
+ comment: FormattedCommentWithSize;
669
+ invisible: boolean;
670
+ loc: CommentLoc;
671
+ width: number;
672
+ long: number;
673
+ height: number;
674
+ vpos: number;
675
+ flash: boolean;
676
+ posY: number;
677
+ owner: boolean;
678
+ layer: number;
679
+ mail: string[];
680
+ content: string;
681
+ image?: IRenderer | null;
682
+ draw: (vpos: number, showCollision: boolean, cursor?: Position) => void;
683
+ isHovered: (cursor?: Position, posX?: number, posY?: number) => boolean;
443
684
  }
444
685
 
445
686
  interface IPluginConstructor {
446
- id: string;
447
- new (Canvas: Canvas, comments: IComment[]): IPlugin;
687
+ id: string;
688
+ new (Canvas: IRenderer, comments: IComment[]): IPlugin;
448
689
  }
449
-
450
690
  interface IPlugin {
451
- draw?: (vpos: number) => void;
452
- addComments?: (comments: IComment[]) => void;
453
- transformComments?: (comments: IComment[]) => IComment[];
691
+ draw?: (vpos: number) => void;
692
+ addComments?: (comments: IComment[]) => void;
693
+ transformComments?: (comments: IComment[]) => IComment[];
454
694
  }
455
-
456
695
  type IPluginList = {
457
- instance: IPlugin;
458
- canvas: HTMLCanvasElement;
696
+ instance: IPlugin;
697
+ canvas: IRenderer;
459
698
  }[];
460
699
 
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;
700
+ type InputFormatType = "XMLDocument" | "niconicome" | "formatted" | "legacy" | "legacyOwner" | "owner" | "v1" | "empty" | "default";
701
+ type InputFormat = XMLDocument | FormattedComment[] | FormattedLegacyComment[] | RawApiResponse[] | OwnerComment[] | V1Thread[] | string | undefined;
480
702
  type ModeType = "default" | "html5" | "flash";
481
703
  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;
704
+ config: Config;
705
+ debug: boolean;
706
+ enableLegacyPiP: boolean;
707
+ format: InputFormatType;
708
+ formatted: boolean;
709
+ keepCA: boolean;
710
+ mode: ModeType;
711
+ scale: number;
712
+ showCollision: boolean;
713
+ showCommentCount: boolean;
714
+ showFPS: boolean;
715
+ useLegacy: boolean;
716
+ video: HTMLVideoElement | undefined;
495
717
  };
496
718
  type Options = Partial<BaseOptions>;
497
-
498
- /**
499
- * @deprecated
500
- */
501
719
  type inputFormatType = InputFormatType;
502
- /**
503
- * @deprecated
504
- */
505
720
  type inputFormat = InputFormat;
506
721
 
507
722
  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;
723
+ id: number;
724
+ vpos: number;
725
+ date: number;
726
+ date_usec: number;
727
+ owner: boolean;
728
+ premium: boolean;
729
+ mail: string[];
730
+ user_id: number;
731
+ layer: number;
732
+ loc: CommentLoc;
733
+ size: CommentSize;
734
+ fontSize: number;
735
+ font: CommentFont;
736
+ color: string;
737
+ strokeColor?: string;
738
+ wakuColor?: string;
739
+ fillColor?: string;
740
+ full: boolean;
741
+ ender: boolean;
742
+ _live: boolean;
743
+ long: number;
744
+ invisible: boolean;
745
+ content: CommentContentItem[];
746
+ rawContent: string;
747
+ flash: boolean;
748
+ lineCount: number;
749
+ lineOffset: number;
750
+ is_my_post: boolean;
751
+ button?: ButtonParams;
537
752
  };
538
753
  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;
754
+ height: number;
755
+ width: number;
756
+ lineHeight: number;
757
+ resized: boolean;
758
+ resizedX: boolean;
759
+ resizedY: boolean;
760
+ content: CommentMeasuredContentItem[];
761
+ charSize: number;
762
+ scale: number;
763
+ scaleX: number;
764
+ buttonObjects?: ButtonList;
550
765
  };
551
766
  type ParseContentResult = {
552
- content: CommentContentItem[];
553
- lineCount: number;
554
- lineOffset: number;
767
+ content: CommentContentItem[];
768
+ lineCount: number;
769
+ lineOffset: number;
555
770
  };
556
771
  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;
772
+ flash: boolean;
773
+ loc: CommentLoc;
774
+ size: CommentSize;
775
+ fontSize: number;
776
+ color: string;
777
+ strokeColor?: string;
778
+ wakuColor?: string;
779
+ fillColor?: string;
780
+ font: CommentFont;
781
+ full: boolean;
782
+ ender: boolean;
783
+ _live: boolean;
784
+ invisible: boolean;
785
+ long: number;
786
+ button?: ButtonParams;
572
787
  };
573
- type CommentContentItem = {
574
- content: string;
575
- slicedContent: string[];
576
- isButton?: boolean;
577
- font?: CommentFlashFont;
578
- width?: number[];
788
+ 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">;
789
+ type CommentFont = Output<typeof ZCommentFont>;
790
+ declare const ZCommentHTML5Font: valibot.UnionSchema<[valibot.LiteralSchema<"defont", "defont">, valibot.LiteralSchema<"mincho", "mincho">, valibot.LiteralSchema<"gothic", "gothic">], "defont" | "mincho" | "gothic">;
791
+ type CommentHTML5Font = Output<typeof ZCommentHTML5Font>;
792
+ declare const ZCommentFlashFont: valibot.UnionSchema<[valibot.LiteralSchema<"defont", "defont">, valibot.LiteralSchema<"gulim", "gulim">, valibot.LiteralSchema<"simsun", "simsun">], "defont" | "gulim" | "simsun">;
793
+ type CommentFlashFont = Output<typeof ZCommentFlashFont>;
794
+ declare const ZCommentContentItemSpacer: valibot.ObjectSchema<{
795
+ type: valibot.LiteralSchema<"spacer", "spacer">;
796
+ char: valibot.StringSchema<string>;
797
+ charWidth: valibot.NumberSchema<number>;
798
+ isButton: valibot.OptionalSchema<valibot.BooleanSchema<boolean>, undefined, boolean | undefined>;
799
+ 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>;
800
+ count: valibot.NumberSchema<number>;
801
+ }, undefined, {
802
+ type: "spacer";
803
+ char: string;
804
+ charWidth: number;
805
+ count: number;
806
+ isButton?: boolean | undefined;
807
+ font?: "defont" | "gulim" | "simsun" | undefined;
808
+ }>;
809
+ declare const ZCommentContentItemText: valibot.ObjectSchema<{
810
+ type: valibot.LiteralSchema<"text", "text">;
811
+ content: valibot.StringSchema<string>;
812
+ slicedContent: valibot.ArraySchema<valibot.StringSchema<string>, string[]>;
813
+ isButton: valibot.OptionalSchema<valibot.BooleanSchema<boolean>, undefined, boolean | undefined>;
814
+ 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>;
815
+ width: valibot.OptionalSchema<valibot.ArraySchema<valibot.NumberSchema<number>, number[]>, undefined, number[] | undefined>;
816
+ }, undefined, {
817
+ type: "text";
818
+ content: string;
819
+ slicedContent: string[];
820
+ isButton?: boolean | undefined;
821
+ font?: "defont" | "gulim" | "simsun" | undefined;
822
+ width?: number[] | undefined;
823
+ }>;
824
+ type CommentContentItemText = Output<typeof ZCommentContentItemText>;
825
+ declare const ZCommentContentItem: valibot.UnionSchema<[valibot.ObjectSchema<{
826
+ type: valibot.LiteralSchema<"spacer", "spacer">;
827
+ char: valibot.StringSchema<string>;
828
+ charWidth: valibot.NumberSchema<number>;
829
+ isButton: valibot.OptionalSchema<valibot.BooleanSchema<boolean>, undefined, boolean | undefined>;
830
+ 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>;
831
+ count: valibot.NumberSchema<number>;
832
+ }, undefined, {
833
+ type: "spacer";
834
+ char: string;
835
+ charWidth: number;
836
+ count: number;
837
+ isButton?: boolean | undefined;
838
+ font?: "defont" | "gulim" | "simsun" | undefined;
839
+ }>, valibot.ObjectSchema<{
840
+ type: valibot.LiteralSchema<"text", "text">;
841
+ content: valibot.StringSchema<string>;
842
+ slicedContent: valibot.ArraySchema<valibot.StringSchema<string>, string[]>;
843
+ isButton: valibot.OptionalSchema<valibot.BooleanSchema<boolean>, undefined, boolean | undefined>;
844
+ 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>;
845
+ width: valibot.OptionalSchema<valibot.ArraySchema<valibot.NumberSchema<number>, number[]>, undefined, number[] | undefined>;
846
+ }, undefined, {
847
+ type: "text";
848
+ content: string;
849
+ slicedContent: string[];
850
+ isButton?: boolean | undefined;
851
+ font?: "defont" | "gulim" | "simsun" | undefined;
852
+ width?: number[] | undefined;
853
+ }>], {
854
+ type: "spacer";
855
+ char: string;
856
+ charWidth: number;
857
+ count: number;
858
+ isButton?: boolean | undefined;
859
+ font?: "defont" | "gulim" | "simsun" | undefined;
860
+ } | {
861
+ type: "text";
862
+ content: string;
863
+ slicedContent: string[];
864
+ isButton?: boolean | undefined;
865
+ font?: "defont" | "gulim" | "simsun" | undefined;
866
+ width?: number[] | undefined;
867
+ }>;
868
+ type CommentContentItem = Output<typeof ZCommentContentItem>;
869
+ declare const ZCommentMeasuredContentItemText: valibot.IntersectSchema<[valibot.UnionSchema<[valibot.ObjectSchema<{
870
+ type: valibot.LiteralSchema<"spacer", "spacer">;
871
+ char: valibot.StringSchema<string>;
872
+ charWidth: valibot.NumberSchema<number>;
873
+ isButton: valibot.OptionalSchema<valibot.BooleanSchema<boolean>, undefined, boolean | undefined>;
874
+ 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>;
875
+ count: valibot.NumberSchema<number>;
876
+ }, undefined, {
877
+ type: "spacer";
878
+ char: string;
879
+ charWidth: number;
880
+ count: number;
881
+ isButton?: boolean | undefined;
882
+ font?: "defont" | "gulim" | "simsun" | undefined;
883
+ }>, valibot.ObjectSchema<{
884
+ type: valibot.LiteralSchema<"text", "text">;
885
+ content: valibot.StringSchema<string>;
886
+ slicedContent: valibot.ArraySchema<valibot.StringSchema<string>, string[]>;
887
+ isButton: valibot.OptionalSchema<valibot.BooleanSchema<boolean>, undefined, boolean | undefined>;
888
+ 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>;
889
+ width: valibot.OptionalSchema<valibot.ArraySchema<valibot.NumberSchema<number>, number[]>, undefined, number[] | undefined>;
890
+ }, undefined, {
891
+ type: "text";
892
+ content: string;
893
+ slicedContent: string[];
894
+ isButton?: boolean | undefined;
895
+ font?: "defont" | "gulim" | "simsun" | undefined;
896
+ width?: number[] | undefined;
897
+ }>], {
898
+ type: "spacer";
899
+ char: string;
900
+ charWidth: number;
901
+ count: number;
902
+ isButton?: boolean | undefined;
903
+ font?: "defont" | "gulim" | "simsun" | undefined;
904
+ } | {
905
+ type: "text";
906
+ content: string;
907
+ slicedContent: string[];
908
+ isButton?: boolean | undefined;
909
+ font?: "defont" | "gulim" | "simsun" | undefined;
910
+ width?: number[] | undefined;
911
+ }>, valibot.ObjectSchema<{
912
+ width: valibot.ArraySchema<valibot.NumberSchema<number>, number[]>;
913
+ }, undefined, {
914
+ width: number[];
915
+ }>], ({
916
+ type: "spacer";
917
+ char: string;
918
+ charWidth: number;
919
+ count: number;
920
+ isButton?: boolean | undefined;
921
+ font?: "defont" | "gulim" | "simsun" | undefined;
922
+ } | {
923
+ type: "text";
924
+ content: string;
925
+ slicedContent: string[];
926
+ isButton?: boolean | undefined;
927
+ font?: "defont" | "gulim" | "simsun" | undefined;
928
+ width?: number[] | undefined;
929
+ }) & {
930
+ width: number[];
931
+ }>;
932
+ declare const ZCommentMeasuredContentItem: valibot.UnionSchema<[valibot.IntersectSchema<[valibot.UnionSchema<[valibot.ObjectSchema<{
933
+ type: valibot.LiteralSchema<"spacer", "spacer">;
934
+ char: valibot.StringSchema<string>;
935
+ charWidth: valibot.NumberSchema<number>;
936
+ isButton: valibot.OptionalSchema<valibot.BooleanSchema<boolean>, undefined, boolean | undefined>;
937
+ 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>;
938
+ count: valibot.NumberSchema<number>;
939
+ }, undefined, {
940
+ type: "spacer";
941
+ char: string;
942
+ charWidth: number;
943
+ count: number;
944
+ isButton?: boolean | undefined;
945
+ font?: "defont" | "gulim" | "simsun" | undefined;
946
+ }>, valibot.ObjectSchema<{
947
+ type: valibot.LiteralSchema<"text", "text">;
948
+ content: valibot.StringSchema<string>;
949
+ slicedContent: valibot.ArraySchema<valibot.StringSchema<string>, string[]>;
950
+ isButton: valibot.OptionalSchema<valibot.BooleanSchema<boolean>, undefined, boolean | undefined>;
951
+ 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>;
952
+ width: valibot.OptionalSchema<valibot.ArraySchema<valibot.NumberSchema<number>, number[]>, undefined, number[] | undefined>;
953
+ }, undefined, {
954
+ type: "text";
955
+ content: string;
956
+ slicedContent: string[];
957
+ isButton?: boolean | undefined;
958
+ font?: "defont" | "gulim" | "simsun" | undefined;
959
+ width?: number[] | undefined;
960
+ }>], {
961
+ type: "spacer";
962
+ char: string;
963
+ charWidth: number;
964
+ count: number;
965
+ isButton?: boolean | undefined;
966
+ font?: "defont" | "gulim" | "simsun" | undefined;
967
+ } | {
968
+ type: "text";
969
+ content: string;
970
+ slicedContent: string[];
971
+ isButton?: boolean | undefined;
972
+ font?: "defont" | "gulim" | "simsun" | undefined;
973
+ width?: number[] | undefined;
974
+ }>, valibot.ObjectSchema<{
975
+ width: valibot.ArraySchema<valibot.NumberSchema<number>, number[]>;
976
+ }, undefined, {
977
+ width: number[];
978
+ }>], ({
979
+ type: "spacer";
980
+ char: string;
981
+ charWidth: number;
982
+ count: number;
983
+ isButton?: boolean | undefined;
984
+ font?: "defont" | "gulim" | "simsun" | undefined;
985
+ } | {
986
+ type: "text";
987
+ content: string;
988
+ slicedContent: string[];
989
+ isButton?: boolean | undefined;
990
+ font?: "defont" | "gulim" | "simsun" | undefined;
991
+ width?: number[] | undefined;
992
+ }) & {
993
+ width: number[];
994
+ }>, valibot.ObjectSchema<{
995
+ type: valibot.LiteralSchema<"spacer", "spacer">;
996
+ char: valibot.StringSchema<string>;
997
+ charWidth: valibot.NumberSchema<number>;
998
+ isButton: valibot.OptionalSchema<valibot.BooleanSchema<boolean>, undefined, boolean | undefined>;
999
+ 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>;
1000
+ count: valibot.NumberSchema<number>;
1001
+ }, undefined, {
1002
+ type: "spacer";
1003
+ char: string;
1004
+ charWidth: number;
1005
+ count: number;
1006
+ isButton?: boolean | undefined;
1007
+ font?: "defont" | "gulim" | "simsun" | undefined;
1008
+ }>], {
1009
+ type: "spacer";
1010
+ char: string;
1011
+ charWidth: number;
1012
+ count: number;
1013
+ isButton?: boolean | undefined;
1014
+ font?: "defont" | "gulim" | "simsun" | undefined;
1015
+ } | (({
1016
+ type: "spacer";
1017
+ char: string;
1018
+ charWidth: number;
1019
+ count: number;
1020
+ isButton?: boolean | undefined;
1021
+ font?: "defont" | "gulim" | "simsun" | undefined;
1022
+ } | {
1023
+ type: "text";
1024
+ content: string;
1025
+ slicedContent: string[];
1026
+ isButton?: boolean | undefined;
1027
+ font?: "defont" | "gulim" | "simsun" | undefined;
1028
+ width?: number[] | undefined;
1029
+ }) & {
1030
+ width: number[];
1031
+ })>;
1032
+ type CommentMeasuredContentItem = Output<typeof ZCommentMeasuredContentItem>;
1033
+ type CommentFlashFontParsed = "gothic" | "gulim" | "simsunStrong" | "simsunWeak";
1034
+ type CommentContentIndex = {
1035
+ index: number;
1036
+ font: CommentFlashFontParsed;
579
1037
  };
580
- type CommentMeasuredContentItem = CommentContentItem & {
581
- width: number[];
1038
+ declare const ZCommentSize: valibot.UnionSchema<[valibot.LiteralSchema<"big", "big">, valibot.LiteralSchema<"medium", "medium">, valibot.LiteralSchema<"small", "small">], "big" | "medium" | "small">;
1039
+ type CommentSize = Output<typeof ZCommentSize>;
1040
+ declare const ZCommentLoc: valibot.UnionSchema<[valibot.LiteralSchema<"ue", "ue">, valibot.LiteralSchema<"naka", "naka">, valibot.LiteralSchema<"shita", "shita">], "ue" | "naka" | "shita">;
1041
+ type CommentLoc = Output<typeof ZCommentLoc>;
1042
+ type Collision = {
1043
+ [key in CollisionPos]: CollisionItem;
582
1044
  };
583
- type CommentFlashFontParsed =
584
- | "gothic"
585
- | "gulim"
586
- | "simsunStrong"
587
- | "simsunWeak";
588
- type CommentContentIndex = {
589
- index: number;
590
- font: CommentFlashFontParsed;
1045
+ type Timeline = {
1046
+ [key: number]: IComment[];
591
1047
  };
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
1048
  type CollisionPos = "ue" | "shita" | "right" | "left";
599
- type CollisionItem = { [p: number]: IComment[] };
1049
+ type CollisionItem = {
1050
+ [p: number]: IComment[];
1051
+ };
600
1052
  type NicoScript = {
601
- reverse: NicoScriptReverse[];
602
- ban: NicoScriptBan[];
603
- default: NicoScriptDefault[];
604
- replace: NicoScriptReplace[];
605
- seekDisable: NicoScriptSeekDisable[];
606
- jump: NicoScriptJump[];
1053
+ reverse: NicoScriptReverse[];
1054
+ ban: NicoScriptBan[];
1055
+ default: NicoScriptDefault[];
1056
+ replace: NicoScriptReplace[];
1057
+ seekDisable: NicoScriptSeekDisable[];
1058
+ jump: NicoScriptJump[];
607
1059
  };
608
1060
  type NicoScriptSeekDisable = {
609
- start: number;
610
- end: number;
1061
+ start: number;
1062
+ end: number;
611
1063
  };
612
1064
  type NicoScriptJump = {
613
- start: number;
614
- end?: number;
615
- to: string;
616
- message?: string;
1065
+ start: number;
1066
+ end?: number;
1067
+ to: string;
1068
+ message?: string;
617
1069
  };
618
1070
  type NicoScriptReverse = {
619
- target: NicoScriptReverseTarget;
620
- start: number;
621
- end: number;
1071
+ target: NicoScriptReverseTarget;
1072
+ start: number;
1073
+ end: number;
622
1074
  };
623
1075
  type NicoScriptReverseTarget = "コメ" | "投コメ" | "全";
624
1076
  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;
1077
+ start: number;
1078
+ long: number | undefined;
1079
+ keyword: string;
1080
+ replace: string;
1081
+ range: NicoScriptReplaceRange;
1082
+ target: NicoScriptReplaceTarget;
1083
+ condition: NicoScriptReplaceCondition;
1084
+ color: string | undefined;
1085
+ size: CommentSize | undefined;
1086
+ font: CommentFont | undefined;
1087
+ loc: CommentLoc | undefined;
1088
+ no: number;
637
1089
  };
638
1090
  type NicoScriptReplaceRange = "単" | "全";
639
- type NicoScriptReplaceTarget =
640
- | "コメ"
641
- | "投コメ"
642
- | "全"
643
- | "含まない"
644
- | "含む";
1091
+ type NicoScriptReplaceTarget = "コメ" | "投コメ" | "全" | "含まない" | "含む";
645
1092
  type NicoScriptReplaceCondition = "完全一致" | "部分一致";
646
1093
  type NicoScriptBan = {
647
- start: number;
648
- end: number;
1094
+ start: number;
1095
+ end: number;
649
1096
  };
650
1097
  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;
1098
+ start: number;
1099
+ long: number | undefined;
1100
+ color: string | undefined;
1101
+ size: CommentSize | undefined;
1102
+ font: CommentFont | undefined;
1103
+ loc: CommentLoc | undefined;
657
1104
  };
658
1105
  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;
1106
+ width: number;
1107
+ height: number;
1108
+ resized: boolean;
1109
+ resizedX: boolean;
1110
+ resizedY: boolean;
1111
+ fontSize: number;
1112
+ lineHeight: number;
1113
+ content: CommentMeasuredContentItem[];
1114
+ charSize: number;
1115
+ scaleX: number;
1116
+ scale: number;
670
1117
  };
671
-
672
1118
  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; //通常のコメントのように表示するか
1119
+ message: {
1120
+ before: string;
1121
+ body: string;
1122
+ after: string;
1123
+ };
1124
+ commentMessage: string;
1125
+ commentMail: string[];
1126
+ commentVisible: boolean;
1127
+ limit: number;
1128
+ local: boolean;
1129
+ hidden: boolean;
684
1130
  };
685
-
686
1131
  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;
1132
+ loc: CommentLoc | undefined;
1133
+ size: CommentSize | undefined;
1134
+ fontSize: number | undefined;
1135
+ color: string | undefined;
1136
+ strokeColor?: string;
1137
+ wakuColor?: string;
1138
+ fillColor?: string;
1139
+ font: CommentFont | undefined;
1140
+ full: boolean;
1141
+ ender: boolean;
1142
+ _live: boolean;
1143
+ invisible: boolean;
1144
+ long: number | undefined;
1145
+ button?: ButtonParams;
701
1146
  };
702
-
703
1147
  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;
1148
+ resized?: boolean;
1149
+ resizedY?: boolean;
1150
+ resizedX?: boolean;
1151
+ lineHeight?: number;
1152
+ charSize?: number;
1153
+ scale: number;
718
1154
  };
719
-
1155
+ declare const ZMeasureInput: valibot.ObjectSchema<{
1156
+ 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">;
1157
+ content: valibot.ArraySchema<valibot.UnionSchema<[valibot.ObjectSchema<{
1158
+ type: valibot.LiteralSchema<"spacer", "spacer">;
1159
+ char: valibot.StringSchema<string>;
1160
+ charWidth: valibot.NumberSchema<number>;
1161
+ isButton: valibot.OptionalSchema<valibot.BooleanSchema<boolean>, undefined, boolean | undefined>;
1162
+ 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>;
1163
+ count: valibot.NumberSchema<number>;
1164
+ }, undefined, {
1165
+ type: "spacer";
1166
+ char: string;
1167
+ charWidth: number;
1168
+ count: number;
1169
+ isButton?: boolean | undefined;
1170
+ font?: "defont" | "gulim" | "simsun" | undefined;
1171
+ }>, valibot.ObjectSchema<{
1172
+ type: valibot.LiteralSchema<"text", "text">;
1173
+ content: valibot.StringSchema<string>;
1174
+ slicedContent: valibot.ArraySchema<valibot.StringSchema<string>, string[]>;
1175
+ isButton: valibot.OptionalSchema<valibot.BooleanSchema<boolean>, undefined, boolean | undefined>;
1176
+ 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>;
1177
+ width: valibot.OptionalSchema<valibot.ArraySchema<valibot.NumberSchema<number>, number[]>, undefined, number[] | undefined>;
1178
+ }, undefined, {
1179
+ type: "text";
1180
+ content: string;
1181
+ slicedContent: string[];
1182
+ isButton?: boolean | undefined;
1183
+ font?: "defont" | "gulim" | "simsun" | undefined;
1184
+ width?: number[] | undefined;
1185
+ }>], {
1186
+ type: "spacer";
1187
+ char: string;
1188
+ charWidth: number;
1189
+ count: number;
1190
+ isButton?: boolean | undefined;
1191
+ font?: "defont" | "gulim" | "simsun" | undefined;
1192
+ } | {
1193
+ type: "text";
1194
+ content: string;
1195
+ slicedContent: string[];
1196
+ isButton?: boolean | undefined;
1197
+ font?: "defont" | "gulim" | "simsun" | undefined;
1198
+ width?: number[] | undefined;
1199
+ }>, ({
1200
+ type: "spacer";
1201
+ char: string;
1202
+ charWidth: number;
1203
+ count: number;
1204
+ isButton?: boolean | undefined;
1205
+ font?: "defont" | "gulim" | "simsun" | undefined;
1206
+ } | {
1207
+ type: "text";
1208
+ content: string;
1209
+ slicedContent: string[];
1210
+ isButton?: boolean | undefined;
1211
+ font?: "defont" | "gulim" | "simsun" | undefined;
1212
+ width?: number[] | undefined;
1213
+ })[]>;
1214
+ lineHeight: valibot.NumberSchema<number>;
1215
+ charSize: valibot.NumberSchema<number>;
1216
+ lineCount: valibot.NumberSchema<number>;
1217
+ }, undefined, {
1218
+ lineHeight: number;
1219
+ font: "defont" | "mincho" | "gothic" | "gulim" | "simsun";
1220
+ content: ({
1221
+ type: "spacer";
1222
+ char: string;
1223
+ charWidth: number;
1224
+ count: number;
1225
+ isButton?: boolean | undefined;
1226
+ font?: "defont" | "gulim" | "simsun" | undefined;
1227
+ } | {
1228
+ type: "text";
1229
+ content: string;
1230
+ slicedContent: string[];
1231
+ isButton?: boolean | undefined;
1232
+ font?: "defont" | "gulim" | "simsun" | undefined;
1233
+ width?: number[] | undefined;
1234
+ })[];
1235
+ charSize: number;
1236
+ lineCount: number;
1237
+ }>;
1238
+ type MeasureInput = Output<typeof ZMeasureInput>;
720
1239
  type ValueOf<T> = T[keyof T];
721
1240
 
722
1241
  declare let imageCache: {
723
1242
  [key: string]: {
724
- image: Canvas;
1243
+ image: IRenderer;
725
1244
  timeout: number | NodeJS.Timeout;
726
1245
  };
727
1246
  };
@@ -733,14 +1252,14 @@ declare const resetNicoScripts: () => void;
733
1252
  declare let plugins: IPluginList;
734
1253
  declare const setPlugins: (input: IPluginList) => void;
735
1254
 
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 };
1255
+ declare const index_d$3_imageCache: typeof imageCache;
1256
+ declare const index_d$3_nicoScripts: typeof nicoScripts;
1257
+ declare const index_d$3_plugins: typeof plugins;
1258
+ declare const index_d$3_resetImageCache: typeof resetImageCache;
1259
+ declare const index_d$3_resetNicoScripts: typeof resetNicoScripts;
1260
+ declare const index_d$3_setPlugins: typeof setPlugins;
1261
+ declare namespace index_d$3 {
1262
+ 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
1263
  }
745
1264
 
746
1265
  declare const colors: {
@@ -941,16 +1460,16 @@ declare class NotImplementedError extends Error {
941
1460
  });
942
1461
  }
943
1462
 
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 };
1463
+ type index_d$2_CanvasRenderingContext2DError = CanvasRenderingContext2DError;
1464
+ declare const index_d$2_CanvasRenderingContext2DError: typeof CanvasRenderingContext2DError;
1465
+ type index_d$2_InvalidFormatError = InvalidFormatError;
1466
+ declare const index_d$2_InvalidFormatError: typeof InvalidFormatError;
1467
+ type index_d$2_InvalidOptionError = InvalidOptionError;
1468
+ declare const index_d$2_InvalidOptionError: typeof InvalidOptionError;
1469
+ type index_d$2_NotImplementedError = NotImplementedError;
1470
+ declare const index_d$2_NotImplementedError: typeof NotImplementedError;
1471
+ declare namespace index_d$2 {
1472
+ 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
1473
  }
955
1474
 
956
1475
  declare const registerHandler: <K extends keyof CommentEventHandlerMap>(eventName: K, handler: CommentEventHandlerMap[K]) => void;
@@ -970,34 +1489,54 @@ declare namespace inputParser_d {
970
1489
  export { convert2formattedComment as default };
971
1490
  }
972
1491
 
973
- declare const typeGuard: {
974
- 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[];
979
- };
980
- 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;
1492
+ declare class CanvasRenderer implements IRenderer {
1493
+ readonly canvas: HTMLCanvasElement;
1494
+ readonly video?: HTMLVideoElement;
1495
+ private readonly context;
1496
+ constructor(canvas?: HTMLCanvasElement, video?: HTMLVideoElement);
1497
+ drawVideo(enableLegacyPip: boolean): void;
1498
+ getFont(): string;
1499
+ getFillStyle(): string | CanvasGradient | CanvasPattern;
1500
+ setScale(scale: number, arg1?: number): void;
1501
+ drawImage(image: IRenderer, x: number, y: number, width?: number, height?: number): void;
1502
+ fillRect(x: number, y: number, width: number, height: number): void;
1503
+ strokeRect(x: number, y: number, width: number, height: number): void;
1504
+ fillText(text: string, x: number, y: number): void;
1505
+ strokeText(text: string, x: number, y: number): void;
1506
+ quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void;
1507
+ clearRect(x: number, y: number, width: number, height: number): void;
1508
+ setFont(font: string): void;
1509
+ setFillStyle(color: string): void;
1510
+ setStrokeStyle(color: string): void;
1511
+ setLineWidth(width: number): void;
1512
+ setGlobalAlpha(alpha: number): void;
1513
+ setSize(width: number, height: number): void;
1514
+ getSize(): {
1515
+ width: number;
1516
+ height: number;
987
1517
  };
1518
+ measureText(text: string): TextMetrics;
1519
+ beginPath(): void;
1520
+ closePath(): void;
1521
+ moveTo(x: number, y: number): void;
1522
+ lineTo(x: number, y: number): void;
1523
+ stroke(): void;
1524
+ save(): void;
1525
+ restore(): void;
1526
+ getCanvas(): IRenderer;
1527
+ }
1528
+
1529
+ type index_d$1_CanvasRenderer = CanvasRenderer;
1530
+ declare const index_d$1_CanvasRenderer: typeof CanvasRenderer;
1531
+ declare namespace index_d$1 {
1532
+ export { index_d$1_CanvasRenderer as CanvasRenderer };
1533
+ }
1534
+
1535
+ declare const typeGuard: {
988
1536
  xmlDocument: (i: unknown) => i is XMLDocument;
989
1537
  legacyOwner: {
990
1538
  comments: (i: unknown) => i is string;
991
1539
  };
992
- owner: {
993
- comment: (i: unknown) => i is OwnerComment;
994
- comments: (i: unknown) => i is OwnerComment[];
995
- };
996
- v1: {
997
- comment: (i: unknown) => i is V1Comment;
998
- thread: (i: unknown) => i is V1Thread;
999
- threads: (i: unknown) => i is V1Thread[];
1000
- };
1001
1540
  nicoScript: {
1002
1541
  range: {
1003
1542
  target: (i: unknown) => i is NicoScriptReverseTarget;
@@ -1009,25 +1548,63 @@ declare const typeGuard: {
1009
1548
  };
1010
1549
  };
1011
1550
  comment: {
1012
- font: (i: unknown) => i is CommentFont;
1013
- loc: (i: unknown) => i is CommentLoc;
1014
- size: (i: unknown) => i is CommentSize;
1015
1551
  command: {
1016
1552
  key: (i: unknown) => i is "full" | "ender" | "_live" | "invisible";
1017
1553
  };
1018
1554
  color: (i: unknown) => i is "white" | "red" | "pink" | "orange" | "yellow" | "green" | "cyan" | "blue" | "purple" | "black" | "white2" | "niconicowhite" | "red2" | "truered" | "pink2" | "orange2" | "passionorange" | "yellow2" | "madyellow" | "green2" | "elementalgreen" | "cyan2" | "blue2" | "marinblue" | "purple2" | "nobleviolet" | "black2";
1019
- colorCode: (i: unknown) => i is string;
1020
1555
  colorCodeAllowAlpha: (i: unknown) => i is string;
1021
1556
  };
1022
1557
  config: {
1023
1558
  initOptions: (item: unknown) => item is Partial<BaseOptions>;
1024
1559
  };
1025
1560
  internal: {
1026
- CommentMeasuredContentItem: (i: unknown) => i is CommentMeasuredContentItem;
1027
- CommentMeasuredContentItemArray: (i: unknown) => i is CommentMeasuredContentItem[];
1561
+ CommentMeasuredContentItemArray: (i: unknown) => i is ({
1562
+ type: "spacer";
1563
+ char: string;
1564
+ charWidth: number;
1565
+ count: number;
1566
+ isButton?: boolean | undefined;
1567
+ font?: "defont" | "gulim" | "simsun" | undefined;
1568
+ } | (({
1569
+ type: "spacer";
1570
+ char: string;
1571
+ charWidth: number;
1572
+ count: number;
1573
+ isButton?: boolean | undefined;
1574
+ font?: "defont" | "gulim" | "simsun" | undefined;
1575
+ } | {
1576
+ type: "text";
1577
+ content: string;
1578
+ slicedContent: string[];
1579
+ isButton?: boolean | undefined;
1580
+ font?: "defont" | "gulim" | "simsun" | undefined;
1581
+ width?: number[] | undefined;
1582
+ }) & {
1583
+ width: number[];
1584
+ }))[];
1028
1585
  MultiConfigItem: <T>(i: unknown) => i is MultiConfigItem<T>;
1029
- HTML5Fonts: (i: unknown) => i is HTML5Fonts;
1030
- MeasureInput: (i: unknown) => i is MeasureInput;
1586
+ HTML5Fonts: (i: unknown) => i is "defont" | "mincho" | "gothic";
1587
+ MeasureInput: (i: unknown) => i is {
1588
+ lineHeight: number;
1589
+ font: "defont" | "mincho" | "gothic" | "gulim" | "simsun";
1590
+ content: ({
1591
+ type: "spacer";
1592
+ char: string;
1593
+ charWidth: number;
1594
+ count: number;
1595
+ isButton?: boolean | undefined;
1596
+ font?: "defont" | "gulim" | "simsun" | undefined;
1597
+ } | {
1598
+ type: "text";
1599
+ content: string;
1600
+ slicedContent: string[];
1601
+ isButton?: boolean | undefined;
1602
+ font?: "defont" | "gulim" | "simsun" | undefined;
1603
+ width?: number[] | undefined;
1604
+ })[];
1605
+ charSize: number;
1606
+ lineCount: number;
1607
+ };
1031
1608
  };
1032
1609
  };
1033
1610
 
@@ -1035,10 +1612,10 @@ declare namespace typeGuard_d {
1035
1612
  export { typeGuard as default };
1036
1613
  }
1037
1614
 
1038
- declare const ArrayPush: (array: {
1615
+ declare const arrayPush: (array: {
1039
1616
  [key: number]: IComment[];
1040
1617
  }, key: string | number, push: IComment) => void;
1041
- declare const ArrayEqual: (a: unknown[], b: unknown[]) => boolean;
1618
+ declare const arrayEqual: (a: unknown[], b: unknown[]) => boolean;
1042
1619
 
1043
1620
  declare const hex2rgb: (hex: string) => number[];
1044
1621
  declare const hex2rgba: (hex: string) => number[];
@@ -1052,7 +1629,7 @@ declare const isReverseActive: (vpos: number, isOwner: boolean) => boolean;
1052
1629
  declare const isBanActive: (vpos: number) => boolean;
1053
1630
  declare const processFixedComment: (comment: IComment, collision: CollisionItem, timeline: Timeline) => void;
1054
1631
  declare const processMovableComment: (comment: IComment, collision: Collision, timeline: Timeline) => void;
1055
- declare const getPosY: (currentPos: number, targetComment: IComment, collision: IComment[] | undefined) => {
1632
+ declare const getPosY: (currentPos: number, targetComment: IComment, collision: IComment[] | undefined, isChanged?: boolean) => {
1056
1633
  currentPos: number;
1057
1634
  isChanged: boolean;
1058
1635
  isBreak: boolean;
@@ -1066,18 +1643,33 @@ declare const getConfig: <T>(input: ConfigItem<T>, isFlash?: boolean) => T;
1066
1643
 
1067
1644
  declare const getFlashFontIndex: (part: string) => CommentContentIndex[];
1068
1645
  declare const getFlashFontName: (font: CommentFlashFontParsed) => CommentFlashFont;
1069
- declare const parseContent: (content: string) => CommentContentItem[];
1646
+ declare const parseContent: (content: string) => ({
1647
+ type: "spacer";
1648
+ char: string;
1649
+ charWidth: number;
1650
+ count: number;
1651
+ isButton?: boolean | undefined;
1652
+ font?: "defont" | "gulim" | "simsun" | undefined;
1653
+ } | {
1654
+ type: "text";
1655
+ content: string;
1656
+ slicedContent: string[];
1657
+ isButton?: boolean | undefined;
1658
+ font?: "defont" | "gulim" | "simsun" | undefined;
1659
+ width?: number[] | undefined;
1660
+ })[];
1070
1661
  declare const getButtonParts: (comment: FormattedCommentWithSize) => FormattedCommentWithSize;
1071
1662
  declare const buildAtButtonComment: (comment: FormattedCommentWithSize, vpos: number) => FormattedComment | undefined;
1072
1663
 
1073
1664
  declare const getLineHeight: (fontSize: CommentSize, isFlash: boolean, resized?: boolean) => number;
1074
1665
  declare const getCharSize: (fontSize: CommentSize, isFlash: boolean) => number;
1075
- declare const measure: (comment: MeasureInput, context: Context2D) => {
1666
+ declare const measure: (comment: MeasureInput, renderer: IRenderer) => {
1076
1667
  height: number;
1077
1668
  width: number;
1078
1669
  lineWidth: number[];
1079
1670
  itemWidth: number[][];
1080
1671
  };
1672
+ declare const addHTML5PartToResult: (lineContent: CommentContentItem[], part: string, font?: CommentHTML5Font) => void;
1081
1673
  declare const getFontSizeAndScale: (charSize: number) => {
1082
1674
  scale: number;
1083
1675
  fontSize: number;
@@ -1085,8 +1677,9 @@ declare const getFontSizeAndScale: (charSize: number) => {
1085
1677
 
1086
1678
  declare const nativeSort: <T>(getter: (input: T) => number) => (a: T, b: T) => 1 | 0 | -1;
1087
1679
 
1088
- declare const index_d_ArrayEqual: typeof ArrayEqual;
1089
- declare const index_d_ArrayPush: typeof ArrayPush;
1680
+ declare const index_d_addHTML5PartToResult: typeof addHTML5PartToResult;
1681
+ declare const index_d_arrayEqual: typeof arrayEqual;
1682
+ declare const index_d_arrayPush: typeof arrayPush;
1090
1683
  declare const index_d_buildAtButtonComment: typeof buildAtButtonComment;
1091
1684
  declare const index_d_changeCALayer: typeof changeCALayer;
1092
1685
  declare const index_d_getButtonParts: typeof getButtonParts;
@@ -1114,7 +1707,7 @@ declare const index_d_parseFont: typeof parseFont;
1114
1707
  declare const index_d_processFixedComment: typeof processFixedComment;
1115
1708
  declare const index_d_processMovableComment: typeof processMovableComment;
1116
1709
  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 };
1710
+ 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
1711
  }
1119
1712
 
1120
1713
  declare const definition: {
@@ -1126,7 +1719,7 @@ declare const definition: {
1126
1719
 
1127
1720
  declare const internal_definition: typeof definition;
1128
1721
  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 };
1722
+ 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
1723
  }
1131
1724
 
1132
1725
  declare class NiconiComments {
@@ -1134,40 +1727,15 @@ declare class NiconiComments {
1134
1727
  showCollision: boolean;
1135
1728
  showFPS: boolean;
1136
1729
  showCommentCount: boolean;
1137
- video: HTMLVideoElement | undefined;
1138
1730
  private lastVpos;
1139
- private readonly canvas;
1731
+ private readonly renderer;
1140
1732
  private readonly collision;
1141
- private readonly context;
1142
1733
  private readonly timeline;
1143
1734
  static typeGuard: {
1144
- 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[];
1149
- };
1150
- 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;
1157
- };
1158
1735
  xmlDocument: (i: unknown) => i is XMLDocument;
1159
1736
  legacyOwner: {
1160
1737
  comments: (i: unknown) => i is string;
1161
1738
  };
1162
- owner: {
1163
- comment: (i: unknown) => i is OwnerComment;
1164
- comments: (i: unknown) => i is OwnerComment[];
1165
- };
1166
- v1: {
1167
- comment: (i: unknown) => i is V1Comment;
1168
- thread: (i: unknown) => i is V1Thread;
1169
- threads: (i: unknown) => i is V1Thread[];
1170
- };
1171
1739
  nicoScript: {
1172
1740
  range: {
1173
1741
  target: (i: unknown) => i is NicoScriptReverseTarget;
@@ -1179,34 +1747,84 @@ declare class NiconiComments {
1179
1747
  };
1180
1748
  };
1181
1749
  comment: {
1182
- font: (i: unknown) => i is CommentFont;
1183
- loc: (i: unknown) => i is CommentLoc;
1184
- size: (i: unknown) => i is CommentSize;
1185
1750
  command: {
1186
1751
  key: (i: unknown) => i is "full" | "ender" | "_live" | "invisible";
1187
1752
  };
1188
1753
  color: (i: unknown) => i is "white" | "red" | "pink" | "orange" | "yellow" | "green" | "cyan" | "blue" | "purple" | "black" | "white2" | "niconicowhite" | "red2" | "truered" | "pink2" | "orange2" | "passionorange" | "yellow2" | "madyellow" | "green2" | "elementalgreen" | "cyan2" | "blue2" | "marinblue" | "purple2" | "nobleviolet" | "black2";
1189
- colorCode: (i: unknown) => i is string;
1190
1754
  colorCodeAllowAlpha: (i: unknown) => i is string;
1191
1755
  };
1192
1756
  config: {
1193
1757
  initOptions: (item: unknown) => item is Partial<BaseOptions>;
1194
1758
  };
1195
1759
  internal: {
1196
- CommentMeasuredContentItem: (i: unknown) => i is CommentMeasuredContentItem;
1197
- CommentMeasuredContentItemArray: (i: unknown) => i is CommentMeasuredContentItem[];
1760
+ CommentMeasuredContentItemArray: (i: unknown) => i is ({
1761
+ type: "spacer";
1762
+ char: string;
1763
+ charWidth: number;
1764
+ count: number;
1765
+ isButton?: boolean | undefined;
1766
+ font?: "defont" | "gulim" | "simsun" | undefined;
1767
+ } | (({
1768
+ type: "spacer";
1769
+ char: string;
1770
+ charWidth: number;
1771
+ count: number;
1772
+ isButton?: boolean | undefined;
1773
+ font?: "defont" | "gulim" | "simsun" | undefined;
1774
+ } | {
1775
+ type: "text";
1776
+ content: string;
1777
+ slicedContent: string[];
1778
+ isButton?: boolean | undefined;
1779
+ font?: "defont" | "gulim" | "simsun" | undefined;
1780
+ width?: number[] | undefined;
1781
+ }) & {
1782
+ width: number[];
1783
+ }))[];
1198
1784
  MultiConfigItem: <T>(i: unknown) => i is MultiConfigItem<T>;
1199
- HTML5Fonts: (i: unknown) => i is HTML5Fonts;
1200
- MeasureInput: (i: unknown) => i is MeasureInput;
1785
+ HTML5Fonts: (i: unknown) => i is "defont" | "mincho" | "gothic";
1786
+ MeasureInput: (i: unknown) => i is {
1787
+ lineHeight: number;
1788
+ font: "defont" | "mincho" | "gothic" | "gulim" | "simsun";
1789
+ content: ({
1790
+ type: "spacer";
1791
+ char: string;
1792
+ charWidth: number;
1793
+ count: number;
1794
+ isButton?: boolean | undefined;
1795
+ font?: "defont" | "gulim" | "simsun" | undefined;
1796
+ } | {
1797
+ type: "text";
1798
+ content: string;
1799
+ slicedContent: string[];
1800
+ isButton?: boolean | undefined;
1801
+ font?: "defont" | "gulim" | "simsun" | undefined;
1802
+ width?: number[] | undefined;
1803
+ })[];
1804
+ charSize: number;
1805
+ lineCount: number;
1806
+ };
1201
1807
  };
1202
1808
  };
1203
1809
  static default: typeof NiconiComments;
1204
1810
  static FlashComment: {
1205
- condition: (comment: FormattedComment) => boolean;
1811
+ condition: (comment: {
1812
+ owner: boolean;
1813
+ content: string;
1814
+ vpos: number;
1815
+ date: number;
1816
+ id: number;
1817
+ date_usec: number;
1818
+ premium: boolean;
1819
+ mail: string[];
1820
+ user_id: number;
1821
+ layer: number;
1822
+ is_my_post: boolean;
1823
+ }) => boolean;
1206
1824
  class: typeof FlashComment;
1207
1825
  };
1208
1826
  static internal: typeof internal;
1209
- constructor(canvas: Canvas, data: InputFormat, initOptions?: Options);
1827
+ constructor(renderer: IRenderer | HTMLCanvasElement, data: InputFormat, initOptions?: Options);
1210
1828
  private preRendering;
1211
1829
  private getCommentPos;
1212
1830
  private sortComment;
@@ -1223,4 +1841,4 @@ declare class NiconiComments {
1223
1841
  click(vpos: number, pos: Position): void;
1224
1842
  }
1225
1843
 
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 };
1844
+ 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 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 };