@xpadev-net/niconicomments 0.2.78 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. package/README.md +45 -7
  2. package/dist/bundle.d.ts +438 -306
  3. package/dist/bundle.js +2918 -1150
  4. package/package.json +20 -23
package/dist/bundle.d.ts CHANGED
@@ -38,9 +38,50 @@ type DefaultCommand = {
38
38
  loc?: CommentLoc;
39
39
  };
40
40
  //#endregion
41
+ //#region src/contexts/cache.d.ts
42
+ declare class ImageCacheContext {
43
+ private _cache;
44
+ get(key: string): {
45
+ image: IRenderer;
46
+ timeout: number;
47
+ } | undefined;
48
+ set(key: string, value: {
49
+ image: IRenderer;
50
+ timeout: number;
51
+ }): void;
52
+ delete(key: string): void;
53
+ reset(): void;
54
+ }
55
+ //#endregion
56
+ //#region src/utils/rangeCache.d.ts
57
+ declare class RangeCacheContext {
58
+ readonly reverseActiveOwner: Map<number, boolean>;
59
+ readonly reverseActiveViewer: Map<number, boolean>;
60
+ readonly banActive: Map<number, boolean>;
61
+ reset(): void;
62
+ setCachedActiveState(cache: Map<number, boolean>, vpos: number, result: boolean): void;
63
+ }
64
+ //#endregion
65
+ //#region src/contexts/instanceContext.d.ts
66
+ type CommentInstanceContext = {
67
+ config: BaseConfig;
68
+ options: BaseOptions;
69
+ nicoScripts: NicoScript;
70
+ imageCache: ImageCacheContext;
71
+ rangeCache: RangeCacheContext;
72
+ };
73
+ //#endregion
74
+ //#region src/contexts/nicoscript.d.ts
75
+ declare const createNicoScripts: () => NicoScript;
76
+ declare namespace index_d_exports$4 {
77
+ export { CommentInstanceContext, ImageCacheContext, createNicoScripts };
78
+ }
79
+ //#endregion
41
80
  //#region src/comments/BaseComment.d.ts
42
81
  declare class BaseComment implements IComment {
43
82
  protected readonly renderer: IRenderer;
83
+ protected readonly config: BaseConfig;
84
+ protected readonly ctx: CommentInstanceContext;
44
85
  protected cacheKey: string;
45
86
  comment: FormattedCommentWithSize;
46
87
  pos: {
@@ -52,7 +93,7 @@ declare class BaseComment implements IComment {
52
93
  image?: IRenderer | null;
53
94
  buttonImage?: IRenderer | null;
54
95
  index: number;
55
- constructor(comment: FormattedComment, renderer: IRenderer, index: number);
96
+ constructor(comment: FormattedComment, renderer: IRenderer, index: number, ctx: CommentInstanceContext);
56
97
  get invisible(): boolean;
57
98
  get loc(): "ue" | "naka" | "shita";
58
99
  get long(): number;
@@ -79,18 +120,21 @@ declare class BaseComment implements IComment {
79
120
  protected getTextImage(): IRenderer | null;
80
121
  protected _generateTextImage(): IRenderer;
81
122
  protected _cacheImage(image: IRenderer): void;
82
- protected getButtonImage(posX: number, posY: number, cursor?: Position): IRenderer | undefined;
83
- isHovered(cursor?: Position, posX?: number, posY?: number): boolean;
123
+ protected canGenerateTextImage(): boolean;
124
+ protected getButtonImage(_posX: number, _posY: number, _cursor?: Position): IRenderer | undefined;
125
+ isHovered(_cursor?: Position, _posX?: number, _posY?: number): boolean;
84
126
  protected getCacheKey(): string;
85
127
  }
86
128
  //#endregion
87
129
  //#region src/comments/FlashComment.d.ts
88
130
  declare class FlashComment extends BaseComment {
89
131
  private _globalScale;
132
+ private _buttonImageState?;
90
133
  readonly pluginName: string;
91
- buttonImage: IRenderer;
92
- constructor(comment: FormattedComment, renderer: IRenderer, index: number);
134
+ constructor(comment: FormattedComment, renderer: IRenderer, index: number, ctx: CommentInstanceContext);
135
+ private get _flashScriptCharRegex();
93
136
  get content(): string;
137
+ get flash(): boolean;
94
138
  set content(input: string);
95
139
  convertComment(comment: FormattedComment): FormattedCommentWithSize;
96
140
  getCommentSize(parsedData: FormattedCommentWithFont): FormattedCommentWithSize;
@@ -119,6 +163,7 @@ declare class FlashComment extends BaseComment {
119
163
  private _measureContent;
120
164
  _drawCollision(posX: number, posY: number, showCollision: boolean): void;
121
165
  _generateTextImage(): IRenderer;
166
+ protected canGenerateTextImage(): boolean;
122
167
  getButtonImage(posX: number, posY: number, cursor?: Position): IRenderer | undefined;
123
168
  isHovered(_cursor?: Position, _posX?: number, _posY?: number): boolean;
124
169
  protected _setupCanvas(renderer: IRenderer): {
@@ -129,7 +174,7 @@ declare class FlashComment extends BaseComment {
129
174
  //#region src/comments/HTML5Comment.d.ts
130
175
  declare class HTML5Comment extends BaseComment {
131
176
  readonly pluginName: string;
132
- constructor(comment: FormattedComment, context: IRenderer, index: number);
177
+ constructor(comment: FormattedComment, context: IRenderer, index: number, ctx: CommentInstanceContext);
133
178
  get content(): string;
134
179
  set content(input: string);
135
180
  convertComment(comment: FormattedComment): FormattedCommentWithSize;
@@ -151,167 +196,16 @@ declare class HTML5Comment extends BaseComment {
151
196
  private _measureComment;
152
197
  private _processResizeX;
153
198
  _drawCollision(posX: number, posY: number, showCollision: boolean): void;
199
+ protected canGenerateTextImage(): boolean;
154
200
  _generateTextImage(): IRenderer;
155
201
  getButtonImage(): undefined;
156
202
  isHovered(): boolean;
157
203
  }
158
- declare namespace index_d_exports$4 {
204
+ declare namespace index_d_exports$3 {
159
205
  export { BaseComment, FlashComment, HTML5Comment };
160
206
  }
161
207
  //#endregion
162
- //#region src/@types/config.d.ts
163
- type ConfigItem<T> = T | MultiConfigItem<T>;
164
- type MultiConfigItem<T> = {
165
- html5: T;
166
- flash: T;
167
- };
168
- type ConfigSizeItem<T> = {
169
- big: T;
170
- medium: T;
171
- small: T;
172
- };
173
- type ConfigResizedItem<T> = {
174
- default: T;
175
- resized: T;
176
- };
177
- type ConfigFlashFontItem<T> = {
178
- gulim: T;
179
- simsun: T;
180
- defont: T;
181
- };
182
- type ConfigHTML5FontItem<T> = {
183
- gothic: T;
184
- mincho: T;
185
- defont: T;
186
- };
187
- type CommentStageSize = {
188
- width: number;
189
- fullWidth: number;
190
- height: number;
191
- };
192
- type FlashCharList = { [key in "simsunStrong" | "simsunWeak" | "gulim" | "gothic"]: string };
193
- type FlashMode = "xp" | "vista";
194
- type FlashScriptChar = { [key in "super" | "sub"]: string };
195
- type FontList = { [key in "gulim" | "simsun"]: string };
196
- type LineCounts = { [key in "default" | "resized" | "doubleResized"]: ConfigSizeItem<number> };
197
- type BaseConfig = {
198
- cacheAge: number;
199
- canvasHeight: number;
200
- canvasWidth: number;
201
- collisionRange: { [key in "left" | "right"]: number };
202
- collisionPadding: number;
203
- colors: {
204
- [key: string]: string;
205
- };
206
- commentDrawPadding: number;
207
- commentDrawRange: number;
208
- commentScale: ConfigItem<number>;
209
- commentStageSize: ConfigItem<CommentStageSize>;
210
- flashCommentYOffset: ConfigSizeItem<ConfigResizedItem<number>>;
211
- flashCommentYPaddingTop: ConfigResizedItem<number>;
212
- contextFillLiveOpacity: number;
213
- contextLineWidth: ConfigItem<number>;
214
- contextStrokeColor: string;
215
- contextStrokeInversionColor: string;
216
- contextStrokeOpacity: number;
217
- flashChar: FlashCharList;
218
- flashMode: FlashMode;
219
- flashScriptChar: FlashScriptChar;
220
- flashThreshold: number;
221
- fonts: {
222
- flash: FontList;
223
- html5: PlatformFont;
224
- };
225
- fontSize: ConfigItem<ConfigSizeItem<ConfigResizedItem<number>>>;
226
- fpsInterval: number;
227
- html5HiResCommentCorrection: number;
228
- html5LineCounts: ConfigItem<LineCounts>;
229
- lineHeight: ConfigItem<ConfigSizeItem<ConfigResizedItem<number>>>;
230
- html5MinFontSize: number;
231
- sameCAGap: number;
232
- sameCAMinScore: number;
233
- sameCARange: number;
234
- sameCATimestampRange: number;
235
- flashLetterSpacing: number;
236
- flashScriptCharOffset: number;
237
- plugins: IPluginConstructor[];
238
- commentPlugins: {
239
- class: typeof BaseComment;
240
- condition: (comment: FormattedComment) => boolean;
241
- }[];
242
- commentLimit: number | undefined;
243
- hideCommentOrder: "asc" | "desc";
244
- lineBreakCount: { [key in CommentSize]: number };
245
- nakaCommentSpeedOffset: number;
246
- atButtonPadding: number;
247
- atButtonRadius: number;
248
- flashDoubleResizeHeights: Partial<ConfigSizeItem<{
249
- [key: number]: number;
250
- }>>;
251
- flashLineBreakScale: ConfigSizeItem<number>;
252
- compatSpacer: {
253
- flash: {
254
- [key: string]: Partial<ConfigFlashFontItem<number>>;
255
- };
256
- html5: {
257
- [key: string]: Partial<ConfigHTML5FontItem<number>>;
258
- };
259
- };
260
- };
261
- type Config = Partial<BaseConfig>;
262
- //#endregion
263
- //#region src/@types/cursor.d.ts
264
- type Position = {
265
- x: number;
266
- y: number;
267
- };
268
- //#endregion
269
- //#region src/@types/event.d.ts
270
- interface CommentEventBase {
271
- type: CommentEventName;
272
- timeStamp: number;
273
- vpos: number;
274
- }
275
- interface SeekDisableEvent extends CommentEventBase {
276
- type: "seekDisable";
277
- }
278
- type SeekDisableEventHandler = (event: SeekDisableEvent) => unknown;
279
- interface SeekEnableEvent extends CommentEventBase {
280
- type: "seekEnable";
281
- }
282
- type SeekEnableEventHandler = (event: SeekEnableEvent) => unknown;
283
- interface CommentDisableEvent extends CommentEventBase {
284
- type: "commentDisable";
285
- }
286
- type CommentDisableEventHandler = (event: CommentDisableEvent) => unknown;
287
- interface CommentEnableEvent extends CommentEventBase {
288
- type: "commentEnable";
289
- }
290
- type CommentEnableEventHandler = (event: CommentEnableEvent) => unknown;
291
- interface JumpEvent extends CommentEventBase {
292
- type: "jump";
293
- to: string;
294
- message?: string;
295
- }
296
- type JumpEventHandler = (event: JumpEvent) => unknown;
297
- type CommentEventName = "seekDisable" | "seekEnable" | "commentDisable" | "commentEnable" | "jump";
298
- type CommentEventHandler = SeekDisableEventHandler | SeekEnableEventHandler | CommentDisableEventHandler | CommentEnableEventHandler | JumpEventHandler;
299
- interface CommentEventHandlerMap {
300
- seekDisable: SeekDisableEventHandler;
301
- seekEnable: SeekEnableEventHandler;
302
- commentDisable: CommentDisableEventHandler;
303
- commentEnable: CommentEnableEventHandler;
304
- jump: JumpEventHandler;
305
- }
306
- interface CommentEventMap {
307
- seekDisable: SeekDisableEvent;
308
- seekEnable: SeekEnableEvent;
309
- commentDisable: CommentDisableEvent;
310
- commentEnable: CommentEnableEvent;
311
- jump: JumpEvent;
312
- }
313
- //#endregion
314
- //#region node_modules/.pnpm/valibot@1.3.1_typescript@6.0.2/node_modules/valibot/dist/index.d.mts
208
+ //#region node_modules/.pnpm/valibot@1.4.1_typescript@6.0.3/node_modules/valibot/dist/index.d.mts
315
209
  //#endregion
316
210
  //#region src/methods/fallback/fallback.d.ts
317
211
  /**
@@ -426,56 +320,6 @@ type SchemaWithPipe<TPipe$1 extends readonly [BaseSchema<unknown, unknown, BaseI
426
320
  * @returns A schema with a pipeline.
427
321
  */
428
322
  //#endregion
429
- //#region src/methods/pipe/pipeAsync.d.ts
430
- /**
431
- * Schema with pipe async type.
432
- */
433
- type SchemaWithPipeAsync<TPipe$1 extends readonly [(BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>), ...(PipeItem<any, unknown, BaseIssue<unknown>> | PipeItemAsync<any, unknown, BaseIssue<unknown>>)[]]> = Omit<FirstTupleItem<TPipe$1>, "async" | "pipe" | "~standard" | "~run" | "~types"> & {
434
- /**
435
- * The pipe items.
436
- */
437
- readonly pipe: TPipe$1;
438
- /**
439
- * Whether it's async.
440
- */
441
- readonly async: true;
442
- /**
443
- * The Standard Schema properties.
444
- *
445
- * @internal
446
- */
447
- readonly "~standard": StandardProps<InferInput<FirstTupleItem<TPipe$1>>, InferOutput<LastTupleItem<TPipe$1>>>;
448
- /**
449
- * Parses unknown input values.
450
- *
451
- * @param dataset The input dataset.
452
- * @param config The configuration.
453
- *
454
- * @returns The output dataset.
455
- *
456
- * @internal
457
- */
458
- readonly "~run": (dataset: UnknownDataset, config: Config$1<BaseIssue<unknown>>) => Promise<OutputDataset<InferOutput<LastTupleItem<TPipe$1>>, InferIssue<TPipe$1[number]>>>;
459
- /**
460
- * The input, output and issue type.
461
- *
462
- * @internal
463
- */
464
- readonly "~types"?: {
465
- readonly input: InferInput<FirstTupleItem<TPipe$1>>;
466
- readonly output: InferOutput<LastTupleItem<TPipe$1>>;
467
- readonly issue: InferIssue<TPipe$1[number]>;
468
- } | undefined;
469
- };
470
- /**
471
- * Adds a pipeline to a schema, that can validate and transform its input.
472
- *
473
- * @param schema The root schema.
474
- * @param item1 The first pipe item.
475
- *
476
- * @returns A schema with a pipeline.
477
- */
478
- //#endregion
479
323
  //#region src/types/metadata.d.ts
480
324
  /**
481
325
  * Base metadata interface.
@@ -909,6 +753,13 @@ type InferIssue<TItem$1 extends BaseSchema<unknown, unknown, BaseIssue<unknown>>
909
753
  * Checks if a type is `any`.
910
754
  */
911
755
  /**
756
+ * Checks if a type is `never`.
757
+ */
758
+ type IsNever<Type> = [Type] extends [never] ? true : false;
759
+ /**
760
+ * Extracts `null` from a type.
761
+ */
762
+ /**
912
763
  * Constructs a type that is maybe readonly.
913
764
  */
914
765
  type MaybeReadonly<TValue$1> = TValue$1 | Readonly<TValue$1>;
@@ -950,6 +801,12 @@ type LastTupleItem<TTuple extends readonly [unknown, ...unknown[]]> = TTuple[TTu
950
801
  /**
951
802
  * Converts union to intersection type.
952
803
  */
804
+ type UnionToIntersect<TUnion> = (TUnion extends any ? (arg: TUnion) => void : never) extends ((arg: infer Intersect) => void) ? Intersect : never;
805
+ /**
806
+ * Converts union to tuple type using an accumulator.
807
+ *
808
+ * For more information: {@link https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-5.html#tail-recursion-elimination-on-conditional-types}
809
+ */
953
810
  //#endregion
954
811
  //#region src/types/other.d.ts
955
812
  /**
@@ -1019,11 +876,13 @@ type OutputWithQuestionMarks<TEntries$1 extends ObjectEntries | ObjectEntriesAsy
1019
876
  /**
1020
877
  * Readonly output keys type.
1021
878
  */
1022
- type ReadonlyOutputKeys<TEntries$1 extends ObjectEntries | ObjectEntriesAsync> = { [TKey in keyof TEntries$1]: TEntries$1[TKey] extends SchemaWithPipe<infer TPipe> | SchemaWithPipeAsync<infer TPipe> ? ReadonlyAction<any> extends TPipe[number] ? TKey : never : never }[keyof TEntries$1];
879
+ type ReadonlyOutputKeys<TEntries$1 extends ObjectEntries | ObjectEntriesAsync> = { [TKey in keyof TEntries$1]: TEntries$1[TKey] extends {
880
+ readonly pipe: readonly unknown[];
881
+ } ? ReadonlyAction<any> extends TEntries$1[TKey]["pipe"][number] ? TKey : never : never }[keyof TEntries$1];
1023
882
  /**
1024
883
  * Output with readonly type.
1025
884
  */
1026
- type OutputWithReadonly<TEntries$1 extends ObjectEntries | ObjectEntriesAsync, TObject extends OutputWithQuestionMarks<TEntries$1, InferEntriesOutput<TEntries$1>>> = Readonly<TObject> & Pick<TObject, Exclude<keyof TObject, ReadonlyOutputKeys<TEntries$1>>>;
885
+ type OutputWithReadonly<TEntries$1 extends ObjectEntries | ObjectEntriesAsync, TObject extends OutputWithQuestionMarks<TEntries$1, InferEntriesOutput<TEntries$1>>> = ReadonlyOutputKeys<TEntries$1> extends never ? TObject : Readonly<TObject> & Pick<TObject, Exclude<keyof TObject, ReadonlyOutputKeys<TEntries$1>>>;
1027
886
  /**
1028
887
  * Infer object input type.
1029
888
  */
@@ -1246,7 +1105,6 @@ type PipeAction<TInput$1, TOutput$1, TIssue extends BaseIssue<unknown>> = BaseVa
1246
1105
  /**
1247
1106
  * Pipe action async type.
1248
1107
  */
1249
- type PipeActionAsync<TInput$1, TOutput$1, TIssue extends BaseIssue<unknown>> = BaseValidationAsync<TInput$1, TOutput$1, TIssue> | BaseTransformationAsync<TInput$1, TOutput$1, TIssue>;
1250
1108
  /**
1251
1109
  * Pipe item type.
1252
1110
  */
@@ -1254,10 +1112,6 @@ type PipeItem<TInput$1, TOutput$1, TIssue extends BaseIssue<unknown>> = BaseSche
1254
1112
  /**
1255
1113
  * Pipe item async type.
1256
1114
  */
1257
- type PipeItemAsync<TInput$1, TOutput$1, TIssue extends BaseIssue<unknown>> = BaseSchemaAsync<TInput$1, TOutput$1, TIssue> | PipeActionAsync<TInput$1, TOutput$1, TIssue>;
1258
- /**
1259
- * Schema without pipe type.
1260
- */
1261
1115
  //#endregion
1262
1116
  //#region src/schemas/array/types.d.ts
1263
1117
  /**
@@ -1507,11 +1361,11 @@ type InferOption<TInput$1, TOutput$1> = BaseSchema<TInput$1, TOutput$1, BaseIssu
1507
1361
  /**
1508
1362
  * Infer intersect input type.
1509
1363
  */
1510
- type InferIntersectInput<TOptions$1 extends IntersectOptions | IntersectOptionsAsync> = TOptions$1 extends readonly [InferOption<infer TInput, unknown>, ...infer TRest] ? TRest extends readonly [InferOption<unknown, unknown>, ...InferOption<unknown, unknown>[]] ? TInput & InferIntersectInput<TRest> : TInput : never;
1364
+ type InferIntersectInput<TOptions$1 extends IntersectOptions | IntersectOptionsAsync> = TOptions$1 extends readonly [InferOption<infer TInput, unknown>, ...infer TRest] ? TRest extends readonly [InferOption<unknown, unknown>, ...InferOption<unknown, unknown>[]] ? TInput & InferIntersectInput<TRest> : TInput : IsNever<TOptions$1[number]> extends true ? never : UnionToIntersect<InferInput<TOptions$1[number]>>;
1511
1365
  /**
1512
1366
  * Infer intersect output type.
1513
1367
  */
1514
- type InferIntersectOutput<TOptions$1 extends IntersectOptions | IntersectOptionsAsync> = TOptions$1 extends readonly [InferOption<unknown, infer TOutput>, ...infer TRest] ? TRest extends readonly [InferOption<unknown, unknown>, ...InferOption<unknown, unknown>[]] ? TOutput & InferIntersectOutput<TRest> : TOutput : never; //#endregion
1368
+ type InferIntersectOutput<TOptions$1 extends IntersectOptions | IntersectOptionsAsync> = TOptions$1 extends readonly [InferOption<unknown, infer TOutput>, ...infer TRest] ? TRest extends readonly [InferOption<unknown, unknown>, ...InferOption<unknown, unknown>[]] ? TOutput & InferIntersectOutput<TRest> : TOutput : IsNever<TOptions$1[number]> extends true ? never : UnionToIntersect<InferOutput<TOptions$1[number]>>; //#endregion
1515
1369
  //#region src/schemas/intersect/intersect.d.ts
1516
1370
  /**
1517
1371
  * Intersect schema interface.
@@ -2102,7 +1956,9 @@ type WithQuestionMarks<TObject extends Record<string | number | symbol, unknown>
2102
1956
  /**
2103
1957
  * With readonly type.
2104
1958
  */
2105
- type WithReadonly<TValue$1 extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>, TObject extends WithQuestionMarks<Record<string | number | symbol, unknown>>> = TValue$1 extends SchemaWithPipe<infer TPipe> | SchemaWithPipeAsync<infer TPipe> ? ReadonlyAction<any> extends TPipe[number] ? Readonly<TObject> : TObject : TObject;
1959
+ type WithReadonly<TValue$1 extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>, TObject extends WithQuestionMarks<Record<string | number | symbol, unknown>>> = TValue$1 extends {
1960
+ readonly pipe: readonly unknown[];
1961
+ } ? ReadonlyAction<any> extends TValue$1["pipe"][number] ? Readonly<TObject> : TObject : TObject;
2106
1962
  /**
2107
1963
  * Infer record input type.
2108
1964
  */
@@ -2377,6 +2233,183 @@ declare function readonly<TInput$1>(): ReadonlyAction<TInput$1>; //#endregion
2377
2233
  * Array action type.
2378
2234
  */
2379
2235
  //#endregion
2236
+ //#region src/@types/options.d.ts
2237
+ declare const ZInputFormatType: UnionSchema<[LiteralSchema<"XMLDocument", undefined>, LiteralSchema<"niconicome", undefined>, LiteralSchema<"xml2js", undefined>, LiteralSchema<"formatted", undefined>, LiteralSchema<"legacy", undefined>, LiteralSchema<"legacyOwner", undefined>, LiteralSchema<"owner", undefined>, LiteralSchema<"v1", undefined>, LiteralSchema<"empty", undefined>, LiteralSchema<"default", undefined>], undefined>;
2238
+ type InputFormatType = InferOutput<typeof ZInputFormatType>;
2239
+ type InputFormat = XMLDocument | Xml2jsPacket | FormattedComment[] | FormattedLegacyComment[] | RawApiResponse[] | OwnerComment[] | V1Thread[] | string | undefined;
2240
+ type ModeType = "default" | "html5" | "flash";
2241
+ type BaseOptions = {
2242
+ config: Config;
2243
+ debug: boolean;
2244
+ enableLegacyPiP: boolean;
2245
+ format: InputFormatType;
2246
+ formatted: boolean;
2247
+ keepCA: boolean;
2248
+ mode: ModeType;
2249
+ scale: number;
2250
+ showCollision: boolean;
2251
+ showCommentCount: boolean;
2252
+ showFPS: boolean;
2253
+ useLegacy: boolean;
2254
+ video: HTMLVideoElement | undefined;
2255
+ lazy: boolean;
2256
+ };
2257
+ type Options = Partial<BaseOptions>;
2258
+ type inputFormatType = InputFormatType;
2259
+ type inputFormat = InputFormat;
2260
+ //#endregion
2261
+ //#region src/@types/config.d.ts
2262
+ type ConfigItem<T> = T | MultiConfigItem<T>;
2263
+ type MultiConfigItem<T> = {
2264
+ html5: T;
2265
+ flash: T;
2266
+ };
2267
+ type ConfigSizeItem<T> = {
2268
+ big: T;
2269
+ medium: T;
2270
+ small: T;
2271
+ };
2272
+ type ConfigResizedItem<T> = {
2273
+ default: T;
2274
+ resized: T;
2275
+ };
2276
+ type ConfigFlashFontItem<T> = {
2277
+ gulim: T;
2278
+ simsun: T;
2279
+ defont: T;
2280
+ };
2281
+ type ConfigHTML5FontItem<T> = {
2282
+ gothic: T;
2283
+ mincho: T;
2284
+ defont: T;
2285
+ };
2286
+ type CommentStageSize = {
2287
+ width: number;
2288
+ fullWidth: number;
2289
+ height: number;
2290
+ };
2291
+ type FlashCharList = { [key in "simsunStrong" | "simsunWeak" | "gulim" | "gothic"]: string };
2292
+ type FlashMode = "xp" | "vista";
2293
+ type FlashScriptChar = { [key in "super" | "sub"]: string };
2294
+ type FontList = { [key in "gulim" | "simsun"]: string };
2295
+ type LineCounts = { [key in "default" | "resized" | "doubleResized"]: ConfigSizeItem<number> };
2296
+ type BaseConfig = {
2297
+ cacheAge: number;
2298
+ canvasHeight: number;
2299
+ canvasWidth: number;
2300
+ collisionRange: { [key in "left" | "right"]: number };
2301
+ collisionPadding: number;
2302
+ colors: {
2303
+ [key: string]: string;
2304
+ };
2305
+ commentDrawPadding: number;
2306
+ commentDrawRange: number;
2307
+ commentScale: ConfigItem<number>;
2308
+ commentStageSize: ConfigItem<CommentStageSize>;
2309
+ flashCommentYOffset: ConfigSizeItem<ConfigResizedItem<number>>;
2310
+ flashCommentYPaddingTop: ConfigResizedItem<number>;
2311
+ contextFillLiveOpacity: number;
2312
+ contextLineWidth: ConfigItem<number>;
2313
+ contextStrokeColor: string;
2314
+ contextStrokeInversionColor: string;
2315
+ contextStrokeOpacity: number;
2316
+ flashChar: FlashCharList;
2317
+ flashMode: FlashMode;
2318
+ flashScriptChar: FlashScriptChar;
2319
+ flashThreshold: number;
2320
+ fonts: {
2321
+ flash: FontList;
2322
+ html5: PlatformFont;
2323
+ };
2324
+ fontSize: ConfigItem<ConfigSizeItem<ConfigResizedItem<number>>>;
2325
+ fpsInterval: number;
2326
+ html5HiResCommentCorrection: number;
2327
+ html5LineCounts: ConfigItem<LineCounts>;
2328
+ lineHeight: ConfigItem<ConfigSizeItem<ConfigResizedItem<number>>>;
2329
+ html5MinFontSize: number;
2330
+ sameCAGap: number;
2331
+ sameCAMinScore: number;
2332
+ sameCARange: number;
2333
+ sameCATimestampRange: number;
2334
+ flashLetterSpacing: number;
2335
+ flashScriptCharOffset: number;
2336
+ plugins: IPluginConstructor[];
2337
+ commentPlugins: {
2338
+ class: typeof BaseComment;
2339
+ condition: (comment: FormattedComment, config: BaseConfig, options: BaseOptions) => boolean;
2340
+ }[];
2341
+ commentLimit: number | undefined;
2342
+ hideCommentOrder: "asc" | "desc";
2343
+ lineBreakCount: { [key in CommentSize]: number };
2344
+ nakaCommentSpeedOffset: number;
2345
+ atButtonPadding: number;
2346
+ atButtonRadius: number;
2347
+ flashDoubleResizeHeights: Partial<ConfigSizeItem<{
2348
+ [key: number]: number;
2349
+ }>>;
2350
+ flashLineBreakScale: ConfigSizeItem<number>;
2351
+ compatSpacer: {
2352
+ flash: {
2353
+ [key: string]: Partial<ConfigFlashFontItem<number>>;
2354
+ };
2355
+ html5: {
2356
+ [key: string]: Partial<ConfigHTML5FontItem<number>>;
2357
+ };
2358
+ };
2359
+ };
2360
+ type Config = Partial<BaseConfig>;
2361
+ //#endregion
2362
+ //#region src/@types/cursor.d.ts
2363
+ type Position = {
2364
+ x: number;
2365
+ y: number;
2366
+ };
2367
+ //#endregion
2368
+ //#region src/@types/event.d.ts
2369
+ interface CommentEventBase {
2370
+ type: CommentEventName;
2371
+ timeStamp: number;
2372
+ vpos: number;
2373
+ }
2374
+ interface SeekDisableEvent extends CommentEventBase {
2375
+ type: "seekDisable";
2376
+ }
2377
+ type SeekDisableEventHandler = (event: SeekDisableEvent) => unknown;
2378
+ interface SeekEnableEvent extends CommentEventBase {
2379
+ type: "seekEnable";
2380
+ }
2381
+ type SeekEnableEventHandler = (event: SeekEnableEvent) => unknown;
2382
+ interface CommentDisableEvent extends CommentEventBase {
2383
+ type: "commentDisable";
2384
+ }
2385
+ type CommentDisableEventHandler = (event: CommentDisableEvent) => unknown;
2386
+ interface CommentEnableEvent extends CommentEventBase {
2387
+ type: "commentEnable";
2388
+ }
2389
+ type CommentEnableEventHandler = (event: CommentEnableEvent) => unknown;
2390
+ interface JumpEvent extends CommentEventBase {
2391
+ type: "jump";
2392
+ to: string;
2393
+ message?: string;
2394
+ }
2395
+ type JumpEventHandler = (event: JumpEvent) => unknown;
2396
+ type CommentEventName = "seekDisable" | "seekEnable" | "commentDisable" | "commentEnable" | "jump";
2397
+ type CommentEventHandler = SeekDisableEventHandler | SeekEnableEventHandler | CommentDisableEventHandler | CommentEnableEventHandler | JumpEventHandler;
2398
+ interface CommentEventHandlerMap {
2399
+ seekDisable: SeekDisableEventHandler;
2400
+ seekEnable: SeekEnableEventHandler;
2401
+ commentDisable: CommentDisableEventHandler;
2402
+ commentEnable: CommentEnableEventHandler;
2403
+ jump: JumpEventHandler;
2404
+ }
2405
+ interface CommentEventMap {
2406
+ seekDisable: SeekDisableEvent;
2407
+ seekEnable: SeekEnableEvent;
2408
+ commentDisable: CommentDisableEvent;
2409
+ commentEnable: CommentEnableEvent;
2410
+ jump: JumpEvent;
2411
+ }
2412
+ //#endregion
2380
2413
  //#region src/@types/fonts.d.ts
2381
2414
  type Platform = "win7" | "win8_1" | "win" | "mac10_9" | "mac10_11" | "mac" | "other";
2382
2415
  declare const ZHTML5Fonts: UnionSchema<[LiteralSchema<"gothic", undefined>, LiteralSchema<"mincho", undefined>, LiteralSchema<"defont", undefined>], undefined>;
@@ -2670,7 +2703,7 @@ interface IComment {
2670
2703
  //#endregion
2671
2704
  //#region src/@types/IPlugins.d.ts
2672
2705
  interface IPluginConstructor {
2673
- id: string;
2706
+ id?: string;
2674
2707
  new (Canvas: IRenderer, comments: IComment[]): IPlugin;
2675
2708
  }
2676
2709
  interface IPlugin {
@@ -2689,31 +2722,6 @@ interface InputParser {
2689
2722
  parse: (input: unknown) => FormattedComment[];
2690
2723
  }
2691
2724
  //#endregion
2692
- //#region src/@types/options.d.ts
2693
- declare const ZInputFormatType: UnionSchema<[LiteralSchema<"XMLDocument", undefined>, LiteralSchema<"niconicome", undefined>, LiteralSchema<"xml2js", undefined>, LiteralSchema<"formatted", undefined>, LiteralSchema<"legacy", undefined>, LiteralSchema<"legacyOwner", undefined>, LiteralSchema<"owner", undefined>, LiteralSchema<"v1", undefined>, LiteralSchema<"empty", undefined>, LiteralSchema<"default", undefined>], undefined>;
2694
- type InputFormatType = InferOutput<typeof ZInputFormatType>;
2695
- type InputFormat = XMLDocument | Xml2jsPacket | FormattedComment[] | FormattedLegacyComment[] | RawApiResponse[] | OwnerComment[] | V1Thread[] | string | undefined;
2696
- type ModeType = "default" | "html5" | "flash";
2697
- type BaseOptions = {
2698
- config: Config;
2699
- debug: boolean;
2700
- enableLegacyPiP: boolean;
2701
- format: InputFormatType;
2702
- formatted: boolean;
2703
- keepCA: boolean;
2704
- mode: ModeType;
2705
- scale: number;
2706
- showCollision: boolean;
2707
- showCommentCount: boolean;
2708
- showFPS: boolean;
2709
- useLegacy: boolean;
2710
- video: HTMLVideoElement | undefined;
2711
- lazy: boolean;
2712
- };
2713
- type Options = Partial<BaseOptions>;
2714
- type inputFormatType = InputFormatType;
2715
- type inputFormat = InputFormat;
2716
- //#endregion
2717
2725
  //#region src/@types/renderer.d.ts
2718
2726
  interface IRenderer {
2719
2727
  readonly rendererName: string;
@@ -2740,6 +2748,7 @@ interface IRenderer {
2740
2748
  height: number;
2741
2749
  };
2742
2750
  measureText(text: string): TextMetrics;
2751
+ measureTextAtDrawScale?(text: string, drawScale: number): TextMetrics;
2743
2752
  beginPath(): void;
2744
2753
  closePath(): void;
2745
2754
  moveTo(x: number, y: number): void;
@@ -3051,26 +3060,6 @@ declare const ZMeasureInput: ObjectSchema<{
3051
3060
  }, undefined>;
3052
3061
  type MeasureInput = InferOutput<typeof ZMeasureInput>;
3053
3062
  type ValueOf<T> = T[keyof T];
3054
- //#endregion
3055
- //#region src/contexts/cache.d.ts
3056
- declare let imageCache: {
3057
- [key: string]: {
3058
- image: IRenderer;
3059
- timeout: number;
3060
- };
3061
- };
3062
- declare const resetImageCache: () => void;
3063
- //#endregion
3064
- //#region src/contexts/nicoscript.d.ts
3065
- declare let nicoScripts: NicoScript;
3066
- declare const resetNicoScripts: () => void;
3067
- //#endregion
3068
- //#region src/contexts/plugins.d.ts
3069
- declare let plugins: IPluginList;
3070
- declare const setPlugins: (input: IPluginList) => void;
3071
- declare namespace index_d_exports$3 {
3072
- export { imageCache, nicoScripts, plugins, resetImageCache, resetNicoScripts, setPlugins };
3073
- }
3074
3063
  declare namespace colors_d_exports {
3075
3064
  export { colors };
3076
3065
  }
@@ -3104,15 +3093,14 @@ declare const colors: {
3104
3093
  black2: string;
3105
3094
  };
3106
3095
  declare namespace config_d_exports {
3107
- export { config, defaultConfig, defaultOptions, options, setConfig, setOptions, updateConfig };
3096
+ export { defaultConfig, defaultOptions, resetOptions, setConfig, setOptions, updateConfig };
3108
3097
  }
3109
3098
  declare let defaultConfig: BaseConfig;
3110
3099
  declare const updateConfig: (config: BaseConfig) => void;
3100
+ declare const setConfig: (config: BaseConfig) => void;
3111
3101
  declare const defaultOptions: BaseOptions;
3112
- declare let config: BaseConfig;
3113
- declare let options: BaseOptions;
3114
- declare const setConfig: (value: BaseConfig) => void;
3115
- declare const setOptions: (value: BaseOptions) => void;
3102
+ declare const setOptions: (options: BaseOptions) => void;
3103
+ declare const resetOptions: () => void;
3116
3104
  declare namespace fonts_d_exports {
3117
3105
  export { fontTemplates, fonts };
3118
3106
  }
@@ -3258,11 +3246,23 @@ declare namespace index_d_exports$2 {
3258
3246
  export { CanvasRenderingContext2DError, InvalidFormatError, InvalidOptionError, NotImplementedError };
3259
3247
  }
3260
3248
  declare namespace eventHandler_d_exports {
3261
- export { registerHandler, removeHandler, triggerHandler };
3249
+ export { EventHandler };
3250
+ }
3251
+ declare class EventHandler {
3252
+ private handlerList;
3253
+ private handlerCounts;
3254
+ private readonly banActiveRangeScans;
3255
+ private readonly seekDisableActiveRangeScans;
3256
+ private readonly jumpActiveRangeScans;
3257
+ register<K extends keyof CommentEventHandlerMap>(eventName: K, handler: CommentEventHandlerMap[K]): void;
3258
+ remove<K extends keyof CommentEventHandlerMap>(eventName: K, handler: CommentEventHandlerMap[K]): void;
3259
+ trigger(vpos: number, lastVpos: number, nicoScripts: NicoScript): void;
3260
+ private _updateCounts;
3261
+ private _processCommentDisable;
3262
+ private _processSeekDisable;
3263
+ private _processJump;
3264
+ private _execute;
3262
3265
  }
3263
- declare const registerHandler: <K extends keyof CommentEventHandlerMap>(eventName: K, handler: CommentEventHandlerMap[K]) => void;
3264
- declare const removeHandler: <K extends keyof CommentEventHandlerMap>(eventName: K, handler: CommentEventHandlerMap[K]) => void;
3265
- declare const triggerHandler: (vpos: number, lastVpos: number) => void;
3266
3266
  declare namespace inputParser_d_exports {
3267
3267
  export { convert2formattedComment as default };
3268
3268
  }
@@ -3279,9 +3279,14 @@ declare class CanvasRenderer implements IRenderer {
3279
3279
  private height;
3280
3280
  private static readonly _MT_CACHE_MAX_SIZE;
3281
3281
  private static _mtCache;
3282
+ private static _dsCanvas;
3283
+ private static _dsCtx;
3284
+ private static _dsScale;
3285
+ private static _dsFont;
3282
3286
  private readonly pooled;
3283
3287
  private readonly _onDestroy?;
3284
3288
  constructor(canvas?: HTMLCanvasElement, video?: HTMLVideoElement, padding?: number, onDestroy?: () => void);
3289
+ private resetContextState;
3285
3290
  drawVideo(enableLegacyPip: boolean): void;
3286
3291
  getFont(): string;
3287
3292
  getFillStyle(): string | CanvasGradient | CanvasPattern;
@@ -3303,8 +3308,10 @@ declare class CanvasRenderer implements IRenderer {
3303
3308
  width: number;
3304
3309
  height: number;
3305
3310
  };
3311
+ getImagePadding(): number;
3306
3312
  measureText(text: string): TextMetrics;
3307
- static resetMeasureTextCache(): void;
3313
+ measureTextAtDrawScale(text: string, drawScale: number): TextMetrics;
3314
+ private _measureAtScale;
3308
3315
  beginPath(): void;
3309
3316
  closePath(): void;
3310
3317
  moveTo(x: number, y: number): void;
@@ -3318,6 +3325,101 @@ declare class CanvasRenderer implements IRenderer {
3318
3325
  destroy(): void;
3319
3326
  }
3320
3327
  //#endregion
3328
+ //#region src/renderer/html5css.d.ts
3329
+ declare class HTML5CSSRenderer implements IRenderer {
3330
+ readonly rendererName = "HTML5CSSRenderer";
3331
+ readonly canvas: HTMLCanvasElement;
3332
+ readonly root: HTMLElement;
3333
+ readonly layer: HTMLDivElement;
3334
+ readonly video?: HTMLVideoElement;
3335
+ private helper;
3336
+ private helperDirty;
3337
+ private helperCursor;
3338
+ private pathActive;
3339
+ private textDrawnBeforeDom;
3340
+ private readonly helperSurfaces;
3341
+ private readonly videoSurface?;
3342
+ private width;
3343
+ private height;
3344
+ private state;
3345
+ private readonly stateStack;
3346
+ private readonly nodes;
3347
+ private prevNodeCursor;
3348
+ private activeCanvasSet;
3349
+ private prevCanvasSet;
3350
+ private readonly setupCanvases;
3351
+ private readonly cloneMap;
3352
+ private readonly cloneSourceMap;
3353
+ private duplicateCloneBudgetMap;
3354
+ private externalCanvasSet;
3355
+ private readonly ownedCanvases;
3356
+ private readonly resizeObserver?;
3357
+ private readonly originalRootStyle;
3358
+ private nodeCursor;
3359
+ constructor(root: HTMLElement, video?: HTMLVideoElement);
3360
+ destroy(): void;
3361
+ drawVideo(enableLegacyPip: boolean): void;
3362
+ getFont(): string;
3363
+ getFillStyle(): string;
3364
+ setScale(scale: number, arg1?: number): void;
3365
+ fillRect(x: number, y: number, width: number, height: number): void;
3366
+ strokeRect(x: number, y: number, width: number, height: number): void;
3367
+ fillText(text: string, x: number, y: number): void;
3368
+ strokeText(text: string, x: number, y: number): void;
3369
+ quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void;
3370
+ clearRect(_x: number, _y: number, _width: number, _height: number): void;
3371
+ setFont(font: string): void;
3372
+ setFillStyle(color: string): void;
3373
+ setStrokeStyle(color: string): void;
3374
+ setLineWidth(width: number): void;
3375
+ setGlobalAlpha(alpha: number): void;
3376
+ setSize(width: number, height: number): void;
3377
+ getSize(): {
3378
+ width: number;
3379
+ height: number;
3380
+ };
3381
+ measureText(text: string): TextMetrics;
3382
+ beginPath(): void;
3383
+ closePath(): void;
3384
+ moveTo(x: number, y: number): void;
3385
+ lineTo(x: number, y: number): void;
3386
+ stroke(): void;
3387
+ save(): void;
3388
+ restore(): void;
3389
+ getCanvas(padding?: number): IRenderer;
3390
+ drawImage(image: IRenderer, x: number, y: number, width?: number, height?: number): void;
3391
+ flush(): void;
3392
+ invalidateImage(image: IRenderer): void;
3393
+ private getNode;
3394
+ private positionNode;
3395
+ private updateObjectFitContain;
3396
+ private updateObjectFitContainWithSize;
3397
+ private getHelperSurface;
3398
+ private prepareHelperSurface;
3399
+ private commitHelperSurface;
3400
+ private keepVideoSurfaceFirst;
3401
+ private setupVideoCanvas;
3402
+ private setupSurfaceCanvas;
3403
+ private applyHelperScale;
3404
+ private recreateCurrentHelperSurface;
3405
+ private teardownSurfaceCanvas;
3406
+ private resetHelperContextDefaults;
3407
+ private shouldDrawOnOverflowHelper;
3408
+ private getCanvasByteSize;
3409
+ private reserveDuplicateClone;
3410
+ private releaseDuplicateClone;
3411
+ private resetDuplicateCloneAccounting;
3412
+ private trimHelperSurfaces;
3413
+ private resetState;
3414
+ private restoreFrameStartState;
3415
+ private toRenderState;
3416
+ private normalizeSize;
3417
+ private hideNode;
3418
+ private getInitialSize;
3419
+ private getPositiveNumber;
3420
+ private getNumber;
3421
+ }
3422
+ //#endregion
3321
3423
  //#region src/renderer/webgl2.d.ts
3322
3424
  declare class WebGL2Renderer implements IRenderer {
3323
3425
  readonly rendererName = "WebGL2Renderer";
@@ -3403,7 +3505,7 @@ declare class WebGL2Renderer implements IRenderer {
3403
3505
  destroy(): void;
3404
3506
  }
3405
3507
  declare namespace index_d_exports$1 {
3406
- export { CanvasRenderer, WebGL2Renderer, createRenderer };
3508
+ export { CanvasRenderer, HTML5CSSRenderer, WebGL2Renderer, createRenderer };
3407
3509
  }
3408
3510
  declare function createRenderer(canvas: HTMLCanvasElement, video?: HTMLVideoElement): IRenderer;
3409
3511
  declare namespace typeGuard_d_exports {
@@ -3485,38 +3587,59 @@ declare const arrayEqual: (a: readonly unknown[], b: readonly unknown[]) => bool
3485
3587
  //#region src/utils/color.d.ts
3486
3588
  declare const hex2rgb: (_hex: string) => number[];
3487
3589
  declare const hex2rgba: (_hex: string) => number[];
3488
- declare const getStrokeColor: (comment: FormattedCommentWithSize) => string;
3590
+ declare const getStrokeColor: (comment: FormattedCommentWithSize, config: BaseConfig) => string;
3489
3591
  //#endregion
3490
3592
  //#region src/utils/comment.d.ts
3491
- declare const resetRangePointers: () => void;
3492
- declare const isLineBreakResize: (comment: MeasureTextInput) => boolean;
3493
- declare const getDefaultCommand: (vpos: number) => DefaultCommand;
3494
- declare const parseCommandAndNicoScript: (comment: FormattedComment) => ParseCommandAndNicoScriptResult;
3495
- declare const isFlashComment: (comment: FormattedComment) => boolean;
3496
- declare const isReverseActive: (vpos: number, isOwner: boolean) => boolean;
3497
- declare const isBanActive: (vpos: number) => boolean;
3498
- declare const processFixedComment: (comment: IComment, collision: CollisionItem, timeline: Timeline, lazy?: boolean) => void;
3499
- declare const processMovableComment: (comment: IComment, collision: Collision, timeline: Timeline, lazy?: boolean) => void;
3500
- declare const getFixedPosY: (comment: IComment, collision: CollisionItem) => number;
3501
- declare const getMovablePosY: (comment: IComment, collision: Collision, beforeVpos: number, speed?: number) => number;
3502
- declare const getPosY: (_currentPos: number, targetComment: IComment, collision: IComment[] | undefined) => {
3593
+ declare const DEFAULT_COMMENT_LONG = 300;
3594
+ declare const DEFAULT_NICOSCRIPT_LONG: number;
3595
+ declare const MAX_COMMENT_LONG: number;
3596
+ declare const MAX_NICOSCRIPT_LONG: number;
3597
+ declare const MAX_AT_BUTTON_COMMAND_CHARS = 16384;
3598
+ declare const MAX_AT_BUTTON_TEXT_CHARS = 4096;
3599
+ declare const MAX_AT_BUTTON_MAIL_ENTRIES = 16;
3600
+ declare const MAX_AT_BUTTON_MAIL_CHARS = 64;
3601
+ declare const MAX_AT_BUTTON_LIMIT = 100;
3602
+ declare const MAX_PARSED_COMMAND_MAIL_ENTRIES = 64;
3603
+ declare const MAX_PARSED_COMMAND_MAIL_CHARS = 128;
3604
+ declare const MAX_NICOSCRIPT_COMMAND_CHARS = 16384;
3605
+ declare const MAX_NICOSCRIPT_TEXT_CHARS = 4096;
3606
+ declare const MAX_LAZY_COMMENT_LOOKAHEAD: number;
3607
+ declare const getLazyCommentLookahead: (canvasWidth: number) => number;
3608
+ declare const isLineBreakResize: (comment: MeasureTextInput, config: BaseConfig) => boolean;
3609
+ declare const getDefaultCommand: (vpos: number, nicoScripts: NicoScript) => DefaultCommand;
3610
+ declare const parseCommandAndNicoScript: (comment: FormattedComment, ctx: CommentInstanceContext) => ParseCommandAndNicoScriptResult;
3611
+ declare const isFlashComment: (comment: FormattedComment, config: BaseConfig, options: BaseOptions) => boolean;
3612
+ declare const isReverseActive: (vpos: number, isOwner: boolean, nicoScripts: NicoScript, rangeCache: RangeCacheContext) => boolean;
3613
+ declare const isBanActive: (vpos: number, nicoScripts: NicoScript, rangeCache: RangeCacheContext) => boolean;
3614
+ declare const processFixedComment: (comment: IComment, collision: CollisionItem, timeline: Timeline, lazy: boolean | undefined, config: BaseConfig, touchedTimeline?: Set<number>) => void;
3615
+ declare const processMovableComment: (comment: IComment, collision: Collision, timeline: Timeline, lazy: boolean | undefined, config: BaseConfig, touchedTimeline?: Set<number>) => void;
3616
+ declare const getFixedPosY: (comment: IComment, collision: CollisionItem, config: BaseConfig) => number;
3617
+ declare const getMovablePosY: (comment: IComment, collision: Collision, beforeVpos: number, config: BaseConfig, speed?: number) => number;
3618
+ declare const getPosY: (_currentPos: number, targetComment: IComment, collision: IComment[] | undefined, config: BaseConfig) => {
3503
3619
  currentPos: number;
3504
3620
  isChanged: boolean;
3505
3621
  isBreak: boolean;
3506
3622
  };
3507
- declare const getPosX: (comment: FormattedCommentWithSize, vpos: number, isReverse?: boolean) => number;
3508
- declare const parseFont: (font: CommentFont, size: string | number) => string;
3623
+ declare const getPosX: (comment: FormattedCommentWithSize, vpos: number, config: BaseConfig, isReverse?: boolean) => number;
3624
+ declare const parseFont: (font: CommentFont, size: string | number, config: BaseConfig) => string;
3509
3625
  //#endregion
3510
3626
  //#region src/utils/commentArt.d.ts
3511
- declare const changeCALayer: (rawData: FormattedComment[]) => FormattedComment[];
3627
+ declare const changeCALayer: (rawData: FormattedComment[], config: BaseConfig) => FormattedComment[];
3512
3628
  //#endregion
3513
3629
  //#region src/utils/config.d.ts
3514
3630
  declare const getConfig: <T>(input: ConfigItem<T>, isFlash?: boolean) => T;
3515
3631
  //#endregion
3516
3632
  //#region src/utils/flash.d.ts
3517
- declare const getFlashFontIndex: (part: string) => CommentContentIndex[];
3633
+ declare const MAX_FLASH_COMMENT_CHARS = 16384;
3634
+ declare const MAX_FLASH_COMMENT_LINES = 256;
3635
+ declare const MAX_FLASH_CONTENT_ITEMS = 2048;
3636
+ declare const clampFlashContent: (input: string) => {
3637
+ content: string;
3638
+ lineCount: number;
3639
+ };
3640
+ declare const getFlashFontIndex: (part: string, config: BaseConfig) => CommentContentIndex[];
3518
3641
  declare const getFlashFontName: (font: CommentFlashFontParsed) => CommentFlashFont;
3519
- declare const parseContent: (content: string) => ({
3642
+ declare const parseContent: (content: string, config: BaseConfig) => ({
3520
3643
  type: "spacer";
3521
3644
  char: string;
3522
3645
  charWidth: number;
@@ -3531,20 +3654,20 @@ declare const parseContent: (content: string) => ({
3531
3654
  font?: "defont" | "gulim" | "simsun" | undefined;
3532
3655
  width?: number[] | undefined;
3533
3656
  })[];
3534
- declare const getButtonParts: (comment: FormattedCommentWithSize) => FormattedCommentWithSize;
3657
+ declare const getButtonParts: (comment: FormattedCommentWithSize, config: BaseConfig) => FormattedCommentWithSize;
3535
3658
  declare const buildAtButtonComment: (comment: FormattedCommentWithSize, vpos: number) => FormattedComment | undefined;
3536
3659
  //#endregion
3537
3660
  //#region src/utils/niconico.d.ts
3538
- declare const getLineHeight: (fontSize: CommentSize, isFlash: boolean, resized?: boolean) => number;
3539
- declare const getCharSize: (fontSize: CommentSize, isFlash: boolean) => number;
3540
- declare const measure: (comment: MeasureInput, renderer: IRenderer) => {
3661
+ declare const getLineHeight: (fontSize: CommentSize, isFlash: boolean, config: BaseConfig, resized?: boolean) => number;
3662
+ declare const getCharSize: (fontSize: CommentSize, isFlash: boolean, config: BaseConfig) => number;
3663
+ declare const measure: (comment: MeasureInput, renderer: IRenderer, config: BaseConfig, layerScale?: number) => {
3541
3664
  height: number;
3542
3665
  width: number;
3543
3666
  lineWidth: number[];
3544
3667
  itemWidth: number[][];
3545
3668
  };
3546
- declare const addHTML5PartToResult: (lineContent: CommentContentItem[], part: string, _font?: CommentHTML5Font) => void;
3547
- declare const getFontSizeAndScale: (_charSize: number) => {
3669
+ declare const addHTML5PartToResult: (lineContent: CommentContentItem[], part: string, config: BaseConfig, _font?: CommentHTML5Font) => void;
3670
+ declare const getFontSizeAndScale: (_charSize: number, config: BaseConfig) => {
3548
3671
  scale: number;
3549
3672
  fontSize: number;
3550
3673
  };
@@ -3552,10 +3675,10 @@ declare const getFontSizeAndScale: (_charSize: number) => {
3552
3675
  //#region src/utils/sort.d.ts
3553
3676
  declare const nativeSort: <T>(getter: (input: T) => number) => (a: T, b: T) => 1 | 0 | -1;
3554
3677
  declare namespace index_d_exports {
3555
- export { addHTML5PartToResult, arrayEqual, arrayPush, buildAtButtonComment, changeCALayer, getButtonParts, getCharSize, getConfig, getDefaultCommand, getFixedPosY, getFlashFontIndex, getFlashFontName, getFontSizeAndScale, getLineHeight, getMovablePosY, getPosX, getPosY, getStrokeColor, hex2rgb, hex2rgba, isBanActive, isFlashComment, isLineBreakResize, isReverseActive, measure, nativeSort, parseCommandAndNicoScript, parseContent, parseFont, processFixedComment, processMovableComment, resetRangePointers };
3678
+ export { DEFAULT_COMMENT_LONG, DEFAULT_NICOSCRIPT_LONG, MAX_AT_BUTTON_COMMAND_CHARS, MAX_AT_BUTTON_LIMIT, MAX_AT_BUTTON_MAIL_CHARS, MAX_AT_BUTTON_MAIL_ENTRIES, MAX_AT_BUTTON_TEXT_CHARS, MAX_COMMENT_LONG, MAX_FLASH_COMMENT_CHARS, MAX_FLASH_COMMENT_LINES, MAX_FLASH_CONTENT_ITEMS, MAX_LAZY_COMMENT_LOOKAHEAD, MAX_NICOSCRIPT_COMMAND_CHARS, MAX_NICOSCRIPT_LONG, MAX_NICOSCRIPT_TEXT_CHARS, MAX_PARSED_COMMAND_MAIL_CHARS, MAX_PARSED_COMMAND_MAIL_ENTRIES, RangeCacheContext, addHTML5PartToResult, arrayEqual, arrayPush, buildAtButtonComment, changeCALayer, clampFlashContent, getButtonParts, getCharSize, getConfig, getDefaultCommand, getFixedPosY, getFlashFontIndex, getFlashFontName, getFontSizeAndScale, getLazyCommentLookahead, getLineHeight, getMovablePosY, getPosX, getPosY, getStrokeColor, hex2rgb, hex2rgba, isBanActive, isFlashComment, isLineBreakResize, isReverseActive, measure, nativeSort, parseCommandAndNicoScript, parseContent, parseFont, processFixedComment, processMovableComment };
3556
3679
  }
3557
3680
  declare namespace internal_d_exports {
3558
- export { index_d_exports$4 as comments, index_d_exports$3 as contexts, definition, index_d_exports$2 as errors, eventHandler_d_exports as eventHandler, inputParser_d_exports as inputParser, index_d_exports$1 as renderer, typeGuard_d_exports as typeGuard, index_d_exports as utils };
3681
+ export { index_d_exports$3 as comments, index_d_exports$4 as contexts, definition, index_d_exports$2 as errors, eventHandler_d_exports as eventHandler, inputParser_d_exports as inputParser, index_d_exports$1 as renderer, typeGuard_d_exports as typeGuard, index_d_exports as utils };
3559
3682
  }
3560
3683
  declare const definition: {
3561
3684
  colors: typeof colors_d_exports;
@@ -3570,16 +3693,21 @@ declare class NiconiComments {
3570
3693
  showCollision: boolean;
3571
3694
  showFPS: boolean;
3572
3695
  showCommentCount: boolean;
3573
- private activeInstanceRegistered;
3574
3696
  private lastVpos;
3697
+ private lastFrameBanActive;
3575
3698
  private get lastVposInt();
3576
3699
  private _cachedSplit;
3700
+ private lazyCommentOrderSortedByVpos;
3701
+ private nextUnprocessedCommentIndex;
3577
3702
  private commentArrayIndexMap;
3578
3703
  private processedCommentIndex;
3579
3704
  private comments;
3580
3705
  private readonly renderer;
3581
3706
  private readonly collision;
3582
3707
  private readonly timeline;
3708
+ private readonly ctx;
3709
+ private readonly eventHandler;
3710
+ private plugins;
3583
3711
  static typeGuard: {
3584
3712
  formatted: {
3585
3713
  comment: (i: unknown) => i is FormattedComment;
@@ -3647,16 +3775,19 @@ declare class NiconiComments {
3647
3775
  };
3648
3776
  };
3649
3777
  static default: typeof NiconiComments;
3778
+ static readonly BAN_FRAME_POSITION_RESOLUTION_BUDGET = 256;
3650
3779
  static FlashComment: {
3651
- condition: (comment: FormattedComment) => boolean;
3780
+ condition: (comment: FormattedComment, config: BaseConfig, options: BaseOptions) => boolean;
3652
3781
  class: typeof FlashComment;
3653
3782
  };
3654
3783
  static internal: typeof internal_d_exports;
3655
3784
  constructor(_renderer: IRenderer | HTMLCanvasElement, data: InputFormat, initOptions?: Options);
3656
3785
  destroy(): void;
3657
3786
  private _rebuildCommentArrayIndex;
3787
+ private _advanceNextUnprocessedCommentIndex;
3658
3788
  private preRendering;
3659
3789
  private getCommentPos;
3790
+ private resolveLazyCommentWindow;
3660
3791
  private sortTimelineComment;
3661
3792
  addComments(...rawComments: FormattedComment[]): void;
3662
3793
  drawCanvas(vpos: number, forceRendering?: boolean, cursor?: Position): boolean;
@@ -3669,7 +3800,8 @@ declare class NiconiComments {
3669
3800
  removeEventListener<K extends keyof CommentEventHandlerMap>(eventName: K, handler: CommentEventHandlerMap[K]): void;
3670
3801
  clear(): void;
3671
3802
  click(vpos: number, pos: Position): void;
3803
+ private _log;
3672
3804
  }
3673
3805
  //#endregion
3674
- export { ApiChat, ApiGlobalNumRes, ApiLeaf, ApiPing, ApiThread, BaseConfig, BaseOptions, ButtonList, ButtonParams, ButtonPartLeft, ButtonPartMiddle, ButtonPartRight, Canvas, Collision, CollisionItem, CollisionPos, CommentContentIndex, CommentContentItem, CommentContentItemText, CommentDisableEvent, CommentDisableEventHandler, CommentEnableEvent, CommentEnableEventHandler, CommentEventBase, CommentEventHandler, CommentEventHandlerMap, CommentEventMap, CommentEventName, CommentFlashFont, CommentFlashFontParsed, CommentFont, CommentHTML5Font, CommentLoc, CommentMeasuredContentItem, CommentSize, CommentStageSize, type Config, ConfigItem, Context2D, DefaultCommand, FlashMode, FlashScriptChar, FontItem, FormattedComment, FormattedCommentWithFont, FormattedCommentWithSize, FormattedLegacyComment, FrameActiveState, HTML5Fonts, IComment, IPlugin, IPluginConstructor, IPluginList, IRenderer, InputFormat, InputFormatType, InputParser, JumpEvent, JumpEventHandler, MeasureInput, MeasureTextInput, MeasureTextResult, MultiConfigItem, NicoScript, NicoScriptReplace, NicoScriptReplaceCondition, NicoScriptReplaceRange, NicoScriptReplaceTarget, NicoScriptReverseTarget, Options, OwnerComment, ParseCommandAndNicoScriptResult, ParseContentResult, ParsedCommand, Platform, PlatformFont, Position, RawApiResponse, SeekDisableEvent, SeekDisableEventHandler, SeekEnableEvent, SeekEnableEventHandler, Timeline, V1Comment, V1Thread, ValueOf, Xml2jsChat, Xml2jsChatItem, Xml2jsPacket, ZApiChat, ZApiGlobalNumRes, ZApiLeaf, ZApiPing, ZApiThread, ZCommentContentItem, ZCommentContentItemSpacer, ZCommentContentItemText, ZCommentFlashFont, ZCommentFont, ZCommentHTML5Font, ZCommentLoc, ZCommentMeasuredContentItem, ZCommentMeasuredContentItemText, ZCommentSize, ZFormattedComment, ZFormattedLegacyComment, ZHTML5Fonts, ZInputFormatType, ZMeasureInput, ZNicoScriptReplaceCondition, ZNicoScriptReplaceRange, ZNicoScriptReplaceTarget, ZNicoScriptReverseTarget, ZOwnerComment, ZRawApiResponse, ZV1Comment, ZV1Thread, ZXml2jsChat, ZXml2jsChatItem, ZXml2jsPacket, NiconiComments as default, formattedComment, formattedLegacyComment, inputFormat, inputFormatType, ownerComment, rawApiResponse, v1Thread };
3806
+ 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 FrameActiveState, type HTML5Fonts, type IComment, type IPlugin, type IPluginConstructor, type IPluginList, type IRenderer, type InputFormat, type InputFormatType, type InputParser, 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, type Xml2jsChat, type Xml2jsChatItem, type Xml2jsPacket, type ZApiChat, type ZApiGlobalNumRes, type ZApiLeaf, type ZApiPing, type ZApiThread, type ZCommentContentItem, type ZCommentContentItemSpacer, type ZCommentContentItemText, type ZCommentFlashFont, type ZCommentFont, type ZCommentHTML5Font, type ZCommentLoc, type ZCommentMeasuredContentItem, type ZCommentMeasuredContentItemText, type ZCommentSize, type ZFormattedComment, type ZFormattedLegacyComment, type ZHTML5Fonts, type ZInputFormatType, type ZMeasureInput, type ZNicoScriptReplaceCondition, type ZNicoScriptReplaceRange, type ZNicoScriptReplaceTarget, type ZNicoScriptReverseTarget, type ZOwnerComment, type ZRawApiResponse, type ZV1Comment, type ZV1Thread, type ZXml2jsChat, type ZXml2jsChatItem, type ZXml2jsPacket, NiconiComments as default, type formattedComment, type formattedLegacyComment, type inputFormat, type inputFormatType, type ownerComment, type rawApiResponse, type v1Thread };
3675
3807
  //# sourceMappingURL=bundle.d.ts.map