· 5 years ago · Oct 01, 2020, 06:44 PM
1/**
2 * A single point, expressed as an object {x, y}
3 */
4export type Point = any;
5/**
6 * A single point, expressed as an array [x,y]
7 */
8export type PointArray = number[];
9/**
10 * A Ray intersection point
11 */
12export type RayIntersection = {
13 x: number;
14 y: number;
15 t0: number;
16 t1: number;
17};
18/**
19 * A standard rectangle interface.
20 */
21export type Rectangle = any;
22/**
23 * The expected structure for a Data record
24 */
25export type Data = {
26 string: any;
27 any: any;
28};
29/**
30 * An object of optional keys and values which configure the behavior of a function
31 */
32export type Options = {
33 string: any;
34 any: any;
35};
36export type SceneControlTool = {
37 name: string;
38 label: string;
39 icon: string;
40};
41export type SceneControl = {
42 name: string;
43 title: string;
44 layer: string;
45 icon: string;
46 tools: {
47 name: string;
48 label: string;
49 icon: string;
50 }[];
51};
52export type Combatant = {
53 token: Token;
54 actor: Actor;
55 name: string;
56 players: User[];
57 owner: boolean;
58 visible: boolean;
59};
60/**
61 * An Active Effect instance within a parent Actor or Item.
62 */
63export type ActiveEffectChange = {
64 key: string;
65 value: any;
66 mode: number;
67 priority: number;
68};
69export type QuadtreeObject = {
70 r: any;
71 t: any;
72 n: Set<Quadtree>;
73};
74/**
75 * A Token is an implementation of PlaceableObject which represents an Actor within a viewed Scene on the game canvas.
76 * @extends {PlaceableObject}
77 *
78 * @example
79 * Token.create({
80 * name: "Token Name",
81 * x: 1000,
82 * y: 1000,
83 * displayName: 3,
84 * img: "path/to/token-artwork.png",
85 * width: 2,
86 * height: 2,
87 * scale: 1.2,
88 * elevation: 50,
89 * lockRotation: false,
90 * rotation: 30,
91 * effects: ["icons/stun.png"],
92 * overlayEffect: "icons/dead.png",
93 * vision: true,
94 * dimSight: 60,
95 * brightSight: 0,
96 * dimLight: 40,
97 * brightLight: 20,
98 * sightAngle: 60,
99 * hidden: false,
100 * actorId: "dfgkjt43jkvdfkj34t",
101 * actorLink: true,
102 * actorData: {},
103 * disposition: 1,
104 * displayBars: 3,
105 * bar1: {attribute: "attributes.hp"},
106 * bar2: {attribute: "attributes.sp"}
107 * }
108 */
109declare class Token extends PlaceableObject {
110 constructor(...args: any[]);
111 /**
112 * A Ray which represents the Token's current movement path
113 * @type {Ray}
114 * @private
115 */
116 _movement: Ray;
117 /**
118 * An Object which records the Token's prior velocity dx and dy
119 * This can be used to determine which direction a Token was previously moving
120 * @type {Object}
121 * @private
122 */
123 _velocity: Object;
124 /**
125 * The Token's most recent valid position
126 * @type {Object}
127 * @private
128 */
129 _validPosition: Object;
130 /**
131 * Provide a temporary flag through which th6is Token can be overridden to bypass any movement animation
132 * @type {boolean}
133 */
134 _noAnimate: boolean;
135 /**
136 * Track the set of User entities which are currently targeting this Token
137 * @type {Set.<User>}
138 */
139 targeted: Set<User>;
140 /**
141 * An Actor entity constructed using this Token's data
142 * If actorLink is true, then the entity is the true Actor entity
143 * Otherwise, the Actor entity is a synthetic, constructed using the Token actorData
144 * @type {Actor}
145 */
146 actor: Actor;
147 /**
148 * A reference to the PointSource object which defines this vision source area of effect
149 * @type {PointSource}
150 */
151 vision: PointSource;
152 /**
153 * A reference to the PointSource object which defines this light source area of effect
154 * @type {PointSource}
155 */
156 light: PointSource;
157 /**
158 * A Boolean flag for whether the current game User has permission to control this token
159 * @type {boolean}
160 */
161 get owner(): boolean;
162 /**
163 * A boolean flag for whether the current game User has observer permission for the Token
164 * @type {boolean}
165 */
166 get observer(): boolean;
167 /**
168 * Is the HUD display active for this token?
169 * @return {boolean}
170 */
171 get hasActiveHUD(): boolean;
172 /**
173 * Convenience access to the token's nameplate string
174 * @type {string}
175 */
176 get name(): string;
177 /**
178 * Translate the token's grid width into a pixel width based on the canvas size
179 * @type {number}
180 */
181 get w(): number;
182 /**
183 * Translate the token's grid height into a pixel height based on the canvas size
184 * @type {number}
185 */
186 get h(): number;
187 /**
188 * The Token's current central position
189 * @property x The central x-coordinate
190 * @property y The central y-coordinate
191 * @type {Object}
192 */
193 get center(): any;
194 /**
195 * An indicator for whether or not this token is currently involved in the active combat encounter.
196 * @type {boolean}
197 */
198 get inCombat(): boolean;
199 /**
200 * An indicator for whether the Token is currently targeted by the active game User
201 * @type {boolean}
202 */
203 get isTargeted(): boolean;
204 /**
205 * Determine whether the Token is visible to the calling user's perspective.
206 * Hidden Tokens are only displayed to GM Users.
207 * Non-hidden Tokens are always visible if Token Vision is not required.
208 * Controlled tokens are always visible.
209 * All Tokens are visible to a GM user if no Token is controlled.
210 *
211 * @see {SightLayer#testVisibility}
212 * @type {boolean}
213 */
214 get isVisible(): boolean;
215 /**
216 * Test whether the Token has sight (or blindness) at any radius
217 * @type {boolean}
218 */
219 get hasSight(): boolean;
220 /**
221 * Test whether the Token emits light (or darkness) at any radius
222 * @type {boolean}
223 */
224 get emitsLight(): boolean;
225 /**
226 * Test whether the Token has a limited angle of vision or light emission which would require sight to update on Token rotation
227 * @type {boolean}
228 */
229 get hasLimitedVisionAngle(): boolean;
230 /**
231 * Translate the token's sight distance in units into a radius in pixels.
232 * @return {number} The sight radius in pixels
233 */
234 get dimRadius(): number;
235 /**
236 * The radius of dim light that the Token emits
237 * @return {number}
238 */
239 get dimLightRadius(): number;
240 /**
241 * Translate the token's bright light distance in units into a radius in pixels.
242 * @return {number} The bright radius in pixels
243 */
244 get brightRadius(): number;
245 /**
246 * The named identified for the source object associated with this Token
247 * @return {string}
248 */
249 get sourceId(): string;
250 /**
251 * Update the light and vision source objects associated with this Token
252 * @param {boolean} [defer] Defer refreshing the SightLayer to manually call that refresh later.
253 * @param {boolean} [deleted] Indicate that this light source has been deleted.
254 * @param {boolean} [noUpdateFog] Never update the Fog exploration progress for this update.
255 */
256 updateSource({ defer, deleted, noUpdateFog }?: boolean): void;
257 /**
258 * Test whether this Token is a viable vision source for the current User
259 * @return {boolean}
260 * @private
261 */
262 _isVisionSource(): boolean;
263 /** @override */
264 draw(): Promise<Token>;
265 visible: any;
266 texture: any;
267 border: any;
268 icon: any;
269 bars: any;
270 nameplate: any;
271 tooltip: any;
272 effects: any;
273 target: any;
274 hitArea: any;
275 buttonMode: boolean;
276 /**
277 * Draw resource bars for the Token
278 * @private
279 */
280 _drawAttributeBars(): any;
281 /**
282 * Draw the Sprite icon for the Token
283 * @return {Promise}
284 * @private
285 */
286 _drawIcon(): Promise<any>;
287 /**
288 * Update display of the Token, pulling latest data and re-rendering the display of Token components
289 */
290 refresh(): void;
291 /**
292 * Draw the Token border, taking into consideration the grid type and border color
293 * @private
294 */
295 _refreshBorder(): void;
296 /**
297 * Get the hex color that should be used to render the Token border
298 * @return {*}
299 * @private
300 */
301 _getBorderColor(): any;
302 /**
303 * Refresh the target indicators for the Token.
304 * Draw both target arrows for the primary User as well as indicator pips for other Users targeting the same Token.
305 * @private
306 */
307 _refreshTarget(): void;
308 /**
309 * A helper method to retrieve the underlying data behind one of the Token's attribute bars
310 * @param {string} barName The named bar to retrieve the attribute for
311 * @param {string} alternative An alternative attribute path to get instead of the default one
312 * @return {Object|null} The attribute displayed on the Token bar, if any
313 */
314 getBarAttribute(barName: string, { alternative }?: string): any;
315 /**
316 * Refresh the display of Token attribute bars, rendering latest resource data
317 * If the bar attribute is valid (has a value and max), draw the bar. Otherwise hide it.
318 * @private
319 */
320 drawBars(): void;
321 /**
322 * Draw a single resource bar, given provided data
323 * @param {number} number The Bar number
324 * @param {PIXI.Graphics} bar The Bar container
325 * @param {Object} data Resource data for this bar
326 * @private
327 */
328 _drawBar(number: number, bar: any, data: any): void;
329 /**
330 * Draw the token's nameplate as a text object
331 * @return {PIXI.Text} The Text object for the Token nameplate
332 */
333 _drawNameplate(): any;
334 /**
335 * Draw a text tooltip for the token which can be used to display Elevation or a resource value
336 */
337 drawTooltip(): void;
338 /**
339 * Return the text which should be displayed in a token's tooltip field
340 * @return {string}
341 * @private
342 */
343 _getTooltipText(): string;
344 _getTextStyle(): any;
345 /**
346 * Draw the active effects and overlay effect icons which are present upon the Token
347 */
348 drawEffects(): Promise<void>;
349 _drawEffect(src: any, i: any, bg: any, w: any, tint: any): Promise<void>;
350 /**
351 * Helper method to determine whether a token attribute is viewable under a certain mode
352 * @param {number} mode The mode from CONST.TOKEN_DISPLAY_MODES
353 * @return {boolean} Is the attribute viewable?
354 * @private
355 */
356 _canViewMode(mode: number): boolean;
357 /**
358 * Animate Token movement along a certain path which is defined by a Ray object
359 * @param {Ray} ray The path along which to animate Token movement
360 */
361 animateMovement(ray: Ray): Promise<void>;
362 /**
363 * Animate the continual revealing of Token vision during a movement animation
364 * @private
365 */
366 _onMovementFrame(): void;
367 /**
368 * Terminate animation of this particular Token
369 */
370 stopAnimation(): void;
371 /**
372 * Check for collision when attempting a move to a new position
373 * @param {Point} destination The destination point of the attempted movement
374 * @return {boolean} A true/false indicator for whether the attempted movement caused a collision
375 */
376 checkCollision(destination: any): boolean;
377 /** @override */
378 _onControl({
379 releaseOthers,
380 updateSight,
381 pan,
382 }?: {
383 releaseOthers?: boolean;
384 updateSight?: boolean;
385 pan?: boolean;
386 }): void;
387 /** @override */
388 _onRelease({ updateSight }?: { updateSight?: boolean }): void;
389 /**
390 * Get the center-point coordinate for a given grid position
391 * @param {number} x The grid x-coordinate that represents the top-left of the Token
392 * @param {number} y The grid y-coordinate that represents the top-left of the Token
393 * @return {Object} The coordinate pair which represents the Token's center at position (x, y)
394 */
395 getCenter(x: number, y: number): any;
396 /**
397 * Set the token's position by comparing its center position vs the nearest grid vertex
398 * Return a Promise that resolves to the Token once the animation for the movement has been completed
399 * @param {number} x The x-coordinate of the token center
400 * @param {number} y The y-coordinate of the token center
401 * @param {boolean} [animate] Animate the movement path, default is true
402 * @return {Promise} The Token after animation has completed
403 */
404 setPosition(x: number, y: number, { animate }?: boolean): Promise<any>;
405 /**
406 * Update the Token velocity auto-regressively, shifting increasing weight towards more recent movement
407 * Employ a magic constant chosen to minimize (effectively zero) the likelihood of trigonometric edge cases
408 * @param {Ray} ray The proposed movement ray
409 * @return {Object} An updated velocity with directional memory
410 * @private
411 */
412 _updateVelocity(ray: Ray): any;
413 /**
414 * Set this Token as an active target for the current game User
415 * @param {boolean} targeted Is the Token now targeted?
416 * @param {User|null} user Assign the token as a target for a specific User
417 * @param {boolean} releaseOthers Release other active targets for the same player?
418 * @param {boolean} groupSelection Is this target being set as part of a group selection workflow?
419 */
420 setTarget(targeted?: boolean, { user, releaseOthers, groupSelection }?: User): void;
421 /**
422 * Add or remove the currently controlled Tokens from the active combat encounter
423 * @param {Combat} [combat] A specific combat encounter to which this Token should be added
424 * @return {Promise<Token>} The Token which initiated the toggle
425 */
426 toggleCombat(combat?: Combat): Promise<Token>;
427 /**
428 * Toggle an active effect by it's texture path.
429 * Copy the existing Array in order to ensure the update method detects the data as changed.
430 *
431 * @param {string} texture The texture file-path of the effect icon to toggle on the Token.
432 * @return {Promise<boolean>} Was the texture applied (true) or removed (false)
433 */
434 toggleEffect(texture: string): Promise<boolean>;
435 /**
436 * Set or remove the overlay texture for the Token by providing a new texture path
437 * @param {string} texture The texture file-path of the effect to set as the Token overlay icon
438 * @return {Promise<boolean>} Was the texture applied (true) or removed (false)
439 */
440 toggleOverlay(texture: string): Promise<boolean>;
441 /**
442 * Toggle the visibility state of any Tokens in the currently selected set
443 * @return {Promise}
444 */
445 toggleVisibility(): Promise<any>;
446 /**
447 * Return the token's sight origin, tailored for the direction of their movement velocity to break ties with walls
448 * @return {Object}
449 */
450 getSightOrigin(): any;
451 /**
452 * A generic transformation to turn a certain number of grid units into a radius in canvas pixels.
453 * This function adds additional padding to the light radius equal to half the token width.
454 * This causes light to be measured from the outer token edge, rather than from the center-point.
455 * @param units {Number} The radius in grid units
456 * @return {number} The radius in canvas units
457 */
458 getLightRadius(units: number): number;
459 /**
460 * Perform an incremental token movement, shifting the token's position by some number of grid units.
461 * The offset parameters will move the token by that number of grid spaces in one or both directions.
462 *
463 * @param {number} dx The number of grid units to shift along the X-axis
464 * @param {number} dy The number of grid units to shift along the Y-axis
465 * @return {Promise}
466 */
467 shiftPosition(dx: number, dy: number): Promise<any>;
468 /** @override */
469 _getShiftedPosition(
470 dx: any,
471 dy: any
472 ): {
473 x: any;
474 y: any;
475 };
476 /**
477 * Extend the PlaceableObject.rotate method to prevent rotation if the Token is in the midst of a movement animation
478 */
479 rotate(...args: any[]): void;
480 /** @override */
481 _onCreate(options: any, userId: any): void;
482 /** @override */
483 _onUpdate(data: any, options: any, userId: any): void;
484 /** @override */
485 _onDelete(options: any, userId: any): any;
486 /**
487 * Handle updates to the Token's referenced Actor (either Entity or synthetic)
488 * @param {Object} updateData The changes to Token actorData overrides which are incremental
489 * @private
490 */
491 _onUpdateTokenActor(updateData: any): void;
492 /**
493 * Handle updates to this Token which originate from changes to the base Actor entity
494 * @param {Object} actorData Updated data for the base Actor
495 * @param {Object} updateData Changes to the base Actor which were incremental
496 * @private
497 */
498 _onUpdateBaseActor(actorData: any, updateData: any): void;
499 /**
500 * Handle the possible re-drawing of Token attribute bars depending on whether the tracked attribute changed
501 * @param {Object} updateData An object of changed data
502 * @private
503 */
504 _onUpdateBarAttributes(updateData: any): void;
505 /** @override */
506 _canHUD(user: any, event: any): any;
507 /** @override */
508 _canConfigure(user: any, event: any): boolean;
509 /** @override */
510 _canHover(user: any, event: any): boolean;
511 /** @override */
512 _canView(user: any, event: any): boolean;
513 /** @override */
514 _canDrag(user: any, event: any): boolean;
515 /** @override */
516 _onHoverIn(event: any, options: any): boolean;
517 /** @override */
518 _onHoverOut(event: any): boolean;
519 /** @override */
520 _onClickLeft(event: any): any;
521 /** @override */
522 _onClickLeft2(event: any): void;
523 /** @override */
524 _onClickRight2(event: any): any;
525 /** @override */
526 _onDragLeftDrop(event: any): any;
527 /** @override */
528 _onDragLeftMove(event: any): boolean;
529 /** @extends {Entity.updateEmbeddedEntity} */
530 update(data: any, options: any): Promise<Token>;
531 /** @extends {Entity.deleteEmbeddedEntity} */
532 delete(options: any): Promise<Token>;
533}
534/**
535 * The Actor Entity which represents the protagonists, characters, enemies, and more that inhabit and take actions
536 * within the World.
537 * @extends {Entity}
538 *
539 * @see {@link Actors} Each Actor belongs to the Actors collection.
540 * @see {@link ActorSheet} Each Actor is edited using the ActorSheet application or a subclass thereof.
541 * @see {@link ActorDirectory} All Actors which exist in the world are rendered within the ActorDirectory sidebar tab.
542 *
543 *
544 * @example <caption>Create a new Actor</caption>
545 * let actor = await Actor.create({
546 * name: "New Test Actor",
547 * type: "character",
548 * img: "artwork/character-profile.jpg",
549 * folder: folder.data._id,
550 * sort: 12000,
551 * data: {},
552 * token: {},
553 * items: [],
554 * flags: {}
555 * });
556 *
557 * @example <caption>Retrieve an existing Actor</caption>
558 * let actor = game.actors.get(actorId);
559 */
560declare class Actor extends Entity {
561 /** @override */
562 static get config(): {
563 baseEntity: typeof Actor;
564 collection: any;
565 embeddedEntities: {
566 ActiveEffect: string;
567 OwnedItem: string;
568 };
569 label: string;
570 permissions: {
571 create: string;
572 };
573 };
574 /**
575 * Create a synthetic Actor using a provided Token instance
576 * If the Token data is linked, return the true Actor entity
577 * If the Token data is not linked, create a synthetic Actor using the Token's actorData override
578 * @param {Token} token
579 * @return {Actor}
580 */
581 static fromToken(token: Token): Actor;
582 /**
583 * Create a synthetic Token Actor instance which is used in place of an actual Actor.
584 * Cache the result in Actors.tokens.
585 * @param {Actor} baseActor
586 * @param {Token} token
587 * @return {Actor}
588 */
589 static createTokenActor(baseActor: Actor, token: Token): Actor;
590 constructor(...args: any[]);
591 /**
592 * A reference to a placed Token which creates a synthetic Actor
593 * @type {Token}
594 */
595 token: Token;
596 /**
597 * Construct the Array of Item instances for the Actor
598 * Items are prepared by the Actor.prepareEmbeddedEntities() method
599 * @type {Collection<string,OwnedItem>}
600 */
601 items: Collection<string, OwnedItem>;
602 /**
603 * A set that tracks which keys in the data model were modified by active effects
604 * @type {Data}
605 */
606 overrides: Data;
607 /**
608 * Cache an Array of allowed Token images if using a wildcard path
609 * @type {string[]}
610 * @private
611 */
612 _tokenImages: string[];
613 /**
614 * A convenient reference to the file path of the Actor's profile image
615 * @type {string}
616 */
617 get img(): string;
618 /**
619 * Classify Owned Items by their type
620 * @type {Object<string,Array>}
621 */
622 get itemTypes(): {
623 [x: string]: any[];
624 };
625 /**
626 * Test whether an Actor entity is a synthetic representation of a Token (if true) or a full Entity (if false)
627 * @type {boolean}
628 */
629 get isToken(): boolean;
630 /**
631 * An array of ActiveEffect instances which are present on the Actor which have a limited duration.
632 * @return {ActiveEffect[]}
633 */
634 get temporaryEffects(): ActiveEffect[];
635 /** @override */
636 prepareData(): void;
637 /**
638 * First prepare any derived data which is actor-specific and does not depend on Items or Active Effects
639 */
640 prepareBaseData(): void;
641 /**
642 * Apply final transformations to the Actor data after all effects have been applied
643 */
644 prepareDerivedData(): void;
645 effects: Collection;
646 /**
647 * Prepare a Collection of OwnedItem instances which belong to this Actor.
648 * @param {object[]} items The raw array of item objects
649 * @return {Collection} The owned items collection
650 * @private
651 */
652 _prepareOwnedItems(items: any[]): Collection;
653 /**
654 * Prepare a Collection of ActiveEffect instances which belong to this Actor.
655 * @param {object[]} effects The raw array of active effect objects
656 * @return {Collection} The active effects collection
657 * @private
658 */
659 _prepareActiveEffects(effects: any[]): Collection;
660 /**
661 * Apply any transformations to the Actor data which are caused by ActiveEffects.
662 */
663 applyActiveEffects(): void;
664 /**
665 * Retrieve an Array of active tokens which represent this Actor in the current canvas Scene.
666 * If the canvas is not currently active, or there are no linked actors, the returned Array will be empty.
667 *
668 * @param [linked] {boolean} Only return tokens which are linked to the Actor. Default (false) is to return all
669 * tokens even those which are not linked.
670 *
671 * @return {Token[]} An array of tokens in the current Scene which reference this Actor.
672 */
673 getActiveTokens(linked?: boolean): Token[];
674 /**
675 * Prepare a data object which defines the data schema used by dice roll commands against this Actor
676 * @return {Object}
677 */
678 getRollData(): any;
679 /**
680 * Get an Array of Token images which could represent this Actor
681 * @return {Promise}
682 */
683 getTokenImages(): Promise<any>;
684 /**
685 * Handle how changes to a Token attribute bar are applied to the Actor.
686 * This allows for game systems to override this behavior and deploy special logic.
687 * @param {string} attribute The attribute path
688 * @param {number} value The target attribute value
689 * @param {boolean} isDelta Whether the number represents a relative change (true) or an absolute change (false)
690 * @param {boolean} isBar Whether the new value is part of an attribute bar, or just a direct value
691 * @return {Promise}
692 */
693 modifyTokenAttribute(attribute: string, value: number, isDelta?: boolean, isBar?: boolean): Promise<any>;
694 /** @override */
695 update(data: any, options?: {}): Promise<any>;
696 /** @override */
697 delete(options: any): Promise<Entity | Token>;
698 /** @override */
699 _onUpdate(data: any, options: any, userId: any, context: any): void;
700 /** @override */
701 createEmbeddedEntity(embeddedName: any, data: any, options?: {}): Promise<any>;
702 /**
703 * When Owned Items are created process each item and extract Active Effects to transfer to the Actor.
704 * @param {Data[]} created Created OwnedItem data objects
705 * @param {boolean} [temporary] Is this a temporary item creation?
706 * @return {Data[]} An array of effects to transfer to the Actor
707 * @private
708 */
709 _createItemActiveEffects(
710 created: {
711 string: any;
712 any: any;
713 }[],
714 { temporary }?: boolean
715 ): {
716 string: any;
717 any: any;
718 }[];
719 /** @override */
720 deleteEmbeddedEntity(embeddedName: any, data: any, options?: {}): Promise<any>;
721 /**
722 * When Owned Items are created process each item and extract Active Effects to transfer to the Actor.
723 * @param {Data[]} deleted The array of deleted OwnedItem data
724 * @private
725 */
726 _deleteItemActiveEffects(
727 deleted: {
728 string: any;
729 any: any;
730 }[]
731 ): Promise<any>;
732 /** @override */
733 _onModifyEmbeddedEntity(embeddedName: any, ...args: any[]): void;
734 /**
735 * Get an Item instance corresponding to the Owned Item with a given id
736 * @param {string} itemId The OwnedItem id to retrieve
737 * @return {Item} An Item instance representing the Owned Item within the Actor entity
738 */
739 getOwnedItem(itemId: string): Item;
740 /**
741 * Create a new item owned by this Actor. This redirects its arguments to the createEmbeddedEntity method.
742 * @see {Entity#createEmbeddedEntity}
743 *
744 * @param {Object} itemData Data for the newly owned item
745 * @param {Object} options Item creation options
746 * @param {boolean} options.renderSheet Render the Item sheet for the newly created item data
747 * @return {Promise.<Object>} A Promise resolving to the created Owned Item data
748 */
749 createOwnedItem(
750 itemData: any,
751 options?: {
752 renderSheet: boolean;
753 }
754 ): Promise<any>;
755 /**
756 * Update an owned item using provided new data. This redirects its arguments to the updateEmbeddedEntity method.
757 * @see {Entity#updateEmbeddedEntity}
758 *
759 * @param {Object} itemData Data for the item to update
760 * @param {Object} options Item update options
761 * @return {Promise.<Object>} A Promise resolving to the updated Owned Item data
762 */
763 updateOwnedItem(itemData: any, options?: any): Promise<any>;
764 /**
765 * Delete an owned item by its id. This redirects its arguments to the deleteEmbeddedEntity method.
766 * @see {Entity#deleteEmbeddedEntity}
767 *
768 * @param {string} itemId The ID of the item to delete
769 * @param {Object} options Item deletion options
770 * @return {Promise.<Object>} A Promise resolving to the deleted Owned Item data
771 */
772 deleteOwnedItem(itemId: string, options?: any): Promise<any>;
773 /**
774 * @deprecated since 0.7.0
775 */
776 importItemFromCollection(collection: any, entryId: any): any;
777 /**
778 * @deprecated since 0.7.2
779 * @see {@link Entity#hasPlayerOwner}
780 */
781 get isPC(): boolean;
782}
783/**
784 * The User entity
785 * Each player who connects to a Foundry Virtual Tabletop session is a User.
786 * Users represent human beings (or possibly programmatic players) and are the cornerstone of identity in Foundry VTT.
787 * @type {Entity}
788 *
789 * @param {Object} data The source data for the User entity, usually retrieved from the database.
790 * @param {string} data._id The Entity ID, automatically generated by the Database when a new User is created.
791 * @param {string} data.password An access key for the Entity.
792 * @param {number} data.role The role level for the User, from CONST.USER_ROLES
793 * @param {Object} data.permissions An object of key-value permissions for the User which extend the default functionality
794 of the User's role.
795 * @param {string} data.avatar A web-accessible file path to an avatar image used to represent the User.
796 * @param {string} data.character The _id of the Actor entity that the User has chosen as their primary character.
797 * @param {string} data.color A color string which represents the visual color associated with this particular User.
798 * @param {Object} data.flags A free-form object of key-value pairs which allows modules and systems the ability
799 to store arbitrary data as part of the User object.
800 * @param {Object} options Initialization options which modify the construction of a User entity. See the Entity
801 class for more detail.
802 */
803declare class User extends Entity {
804 /** @override */
805 static get config(): {
806 baseEntity: typeof User;
807 collection: any;
808 embeddedEntities: {};
809 label: string;
810 };
811 constructor(data: any, options: any);
812 /**
813 * Track whether the user is currently active in the game
814 * @type {boolean}
815 */
816 active: boolean;
817 /**
818 * Track references to the current set of Tokens which are targeted by the User
819 * @type {Set.<Token>}
820 */
821 targets: Set<Token>;
822 /**
823 * Track the ID of the Scene that is currently being viewed by the User
824 * @type {string|null}
825 */
826 viewedScene: string | null;
827 /**
828 * Return the User avatar icon or the controlled actor's image
829 * @type {string}
830 */
831 get avatar(): string;
832 /**
833 * Return the Actor instance of the user's impersonated character (or undefined)
834 * @type {Actor}
835 */
836 get character(): Actor;
837 /**
838 * A convenience shortcut for the permissions object of the current User
839 * @type {Object}
840 */
841 get permissions(): any;
842 /**
843 * A flag for whether the current User is a Trusted Player
844 * @return {boolean}
845 */
846 get isTrusted(): boolean;
847 /**
848 * A flag for whether the current User has Assistant GameMaster or full GameMaster role
849 * @return {boolean}
850 */
851 get isGM(): boolean;
852 /**
853 * A flag for whether this User is the connected client
854 * @return {boolean}
855 */
856 get isSelf(): boolean;
857 /**
858 * Test whether the User is able to perform a certain permission action. Game Master users are always allowed to
859 * perform every action, regardless of permissions.
860 *
861 * @param {string} permission The action to test
862 * @return {boolean} Does the user have the ability to perform this action?
863 */
864 can(permission: string): boolean;
865 /**
866 * Test whether the User has a specific permission entitled .This differs from user#can because it does not always
867 * return true for Game Master users and should be used in cases where a permission could be withheld even from
868 * a GM player (for example cursor display, or A/V audio).
869 *
870 * @param {string} permission The action to test
871 * @return {boolean} Does the user have explicit permission to perform this action?
872 */
873 hasPermission(permission: string): boolean;
874 /**
875 * Test whether the User has at least the permission level of a certain role
876 * @param {string|number} role The role name from USER_ROLES to test
877 * @return {boolean} Does the user have at least this role level?
878 */
879 hasRole(role: string | number): boolean;
880 /**
881 * Test whether the User has exactly the permission level of a certain role
882 * @param {string|number} role The role name from USER_ROLES to test
883 * @return {boolean} Does the user have exactly this role level?
884 */
885 isRole(role: string | number): boolean;
886 /**
887 * Sets a user's permission
888 * Modifies the user permissions to grant or restrict access to a feature.
889 *
890 * @param {string} permission The permission name from USER_PERMISSIONS
891 * @param {boolean} allowed Whether to allow or restrict the permission
892 */
893 setPermission(permission: string, allowed: boolean): void;
894 /**
895 * Submit User activity data to the server for broadcast to other players.
896 * This type of data is transient, persisting only for the duration of the session and not saved to any database.
897 *
898 * @param {Object} activityData An object of User activity data to submit to the server for broadcast.
899 * @param {Object} activityData.cursor The coordinates of the user's cursor
900 * @param {boolean} activityData.focus Is the user pulling focus to the cursor coordinates?
901 * @param {boolean} activityData.ping Is the user emitting a ping at the cursor coordinates?
902 * @param {string} activityData.ruler Serialized Ruler coordinate data in JSON format
903 * @param {string} activityData.sceneId The id of the Scene currently being viewed by the User
904 * @param {string[]} activityData.targets An id of Token ids which are targeted by the User
905 */
906 broadcastActivity(activityData?: {
907 cursor: any;
908 focus: boolean;
909 ping: boolean;
910 ruler: string;
911 sceneId: string;
912 targets: string[];
913 }): void;
914 /**
915 * Assign a Macro to a numbered hotbar slot between 1 and 50
916 * @param {Macro|null} macro The Macro entity to assign
917 * @param {number} slot The integer Hotbar slot to fill
918 * @param {number} [fromSlot] An optional origin slot from which the Macro is being shifted
919 * @return {Promise} A Promise which resolves once the User update is complete
920 */
921 assignHotbarMacro(macro: Macro, slot: number, { fromSlot }?: number): Promise<any>;
922 /**
923 * Get an Array of Macro Entities on this User's Hotbar by page
924 * @param {number} page The hotbar page number
925 * @return {Array.<Object>}
926 */
927 getHotbarMacros(page?: number): any[];
928 updateTokenTargets(targetIds: any): void;
929 /** @override */
930 _onCreate(...args: any[]): void;
931 /**
932 * Additional updating steps for the User entity when new data is saved which trigger some related updates.
933 *
934 * Re-draw the active cursor and toggle visibility
935 * Re-draw navigation if the active or viewed scenes have changed
936 * Render the players UI if activity status or other player features have changed
937 * Update the canvas if the player's impersonated character has changed
938 *
939 * @private
940 */
941 _onUpdate(data: any, ...args: any[]): any;
942}
943/**
944 * @typedef {{r: Rectangle, t: any, n: Set<Quadtree>}} QuadtreeObject
945 */
946/**
947 * A Quadtree implementation that supports collision detection for rectangles.
948 *
949 * @param {Rectangle} The outer bounds of the region
950 * @param {object} options Additional options which configure the Quadtree
951 * @param {number} options.maxObjects The maximum number of objects per node
952 * @param {number} options.maxDepth The maximum number of levels within the root Quadtree
953 * @param {number} options._depth The depth level of the sub-tree. For internal use only
954 * @param {number} options._depth Whether this node represents the root of the tree. For internal use.
955 */
956declare class Quadtree {
957 constructor(
958 bounds: any,
959 {
960 maxObjects,
961 maxDepth,
962 _depth,
963 }?: {
964 maxObjects?: number;
965 maxDepth?: number;
966 _depth?: number;
967 }
968 );
969 /**
970 * The bounding rectangle of the region
971 * @type {Rectangle}
972 */
973 bounds: Rectangle;
974 /**
975 * The maximum number of objects allowed within this node before it must split
976 * @type {number}
977 */
978 maxObjects: number;
979 /**
980 * The maximum number of levels that the base quadtree is allowed
981 * @type {number}
982 */
983 maxDepth: number;
984 /**
985 * The depth of this node within the root Quadtree
986 * @type {number}
987 */
988 depth: number;
989 /**
990 * The objects contained at this level of the tree
991 * @type {QuadtreeObject[]}
992 */
993 objects: QuadtreeObject[];
994 /**
995 * Children of this node
996 * @type {Quadtree[]}
997 */
998 nodes: Quadtree[];
999 /**
1000 * Return an array of all the objects in the Quadtree (recursive)
1001 * @return {QuadtreeObject[]}
1002 */
1003 get all(): {
1004 r: any;
1005 t: any;
1006 n: Set<Quadtree>;
1007 }[];
1008 /**
1009 * Clear the quadtree of all existing contents
1010 * @return {Quadtree} The cleared Quadtree
1011 */
1012 clear(): Quadtree;
1013 /**
1014 * Add a rectangle object to the tree
1015 * @param {QuadtreeObject} obj The object being inserted
1016 * @return {Quadtree[]} The Quadtree nodes the object was added to.
1017 */
1018 insert(obj: { r: any; t: any; n: Set<Quadtree> }): Quadtree[];
1019 /**
1020 * Remove an object from the quadtree
1021 * @param {target} The quadtree target being removed
1022 * @return {Quadtree} The Quadtree for method chaining
1023 */
1024 remove(target: any): Quadtree;
1025 /**
1026 * Split this node into 4 sub-nodes.
1027 * @return {Quadtree} The split Quadtree
1028 */
1029 split(): Quadtree;
1030 /**
1031 * Get all the objects which could collide with the provided rectangle
1032 * @param {Rectangle} rect The target rectangle
1033 * @param {Set} _s The existing result set, for internal use.
1034 * @returns {Set} The objects in the Quadtree which represent potential collisions
1035 */
1036 getObjects(rect: any, _s: Set<any>): Set<any>;
1037 /**
1038 * Obtain the leaf nodes to which a target rectangle belongs.
1039 * This traverses the quadtree recursively obtaining the final nodes which have no children.
1040 * @param {Rectangle} rect The target rectangle.
1041 * @return {Quadtree[]} The Quadtree nodes to which the target rectangle belongs
1042 */
1043 getLeafNodes(rect: any): Quadtree[];
1044 /**
1045 * Obtain the child nodes within the current node which a rectangle belongs to.
1046 * Note that this function is not recursive, it only returns nodes at the current or child level.
1047 * @param {Rectangle} rect The target rectangle.
1048 * @return {Quadtree[]} The Quadtree nodes to which the target rectangle belongs
1049 */
1050 getChildNodes(rect: any): Quadtree[];
1051 /**
1052 * Visualize the nodes and objects in the quadtree
1053 * @param {boolean} [objects] Visualize the rectangular bounds of objects in the Quadtree. Default is false.
1054 */
1055 visualize({ objects }?: boolean): void;
1056}
1057declare namespace Quadtree {
1058 export const INDICES: {
1059 br: number;
1060 tl: number;
1061 bl: number;
1062 tr: number;
1063 };
1064}
1065/**
1066 * An Abstract Base Class which defines a Placeable Object which represents an Entity placed on the Canvas
1067 * @extends {PIXI.Container}
1068 * @abstract
1069 * @interface
1070 */
1071declare class PlaceableObject {
1072 /**
1073 * Identify the official EmbeddedEntity name for this PlaceableObject class
1074 * @type {string}
1075 */
1076 static get embeddedName(): string;
1077 /**
1078 * Provide a reference to the canvas layer which contains placeable objects of this type
1079 * @type {PlaceablesLayer}
1080 */
1081 static get layer(): PlaceablesLayer;
1082 /** @extends {Entity.createEmbeddedEntity} */
1083 static create(data: any, options: any): Promise<PlaceableObject | PlaceableObject[]>;
1084 constructor(data: any, scene: any);
1085 /**
1086 * The underlying data object which provides the basis for this placeable object
1087 * @type {Object}
1088 */
1089 data: Object;
1090 /**
1091 * Retain a reference to the Scene within which this Placeable Object resides
1092 * @type {Scene}
1093 */
1094 scene: Scene;
1095 /**
1096 * Track the field of vision for the placeable object.
1097 * This is necessary to determine whether a player has line-of-sight towards a placeable object or vice-versa
1098 * @type {{fov: PIXI.Polygon|null, los: PIXI.Polygon|null}}
1099 */
1100 vision: {
1101 fov: PIXI.Polygon | null;
1102 los: PIXI.Polygon | null;
1103 };
1104 /**
1105 * A control icon for interacting with the object
1106 * @type {ControlIcon}
1107 */
1108 controlIcon: ControlIcon;
1109 /**
1110 * A mouse interaction manager instance which handles mouse workflows related to this object.
1111 * @type {MouseInteractionManager}
1112 */
1113 mouseInteractionManager: MouseInteractionManager;
1114 /**
1115 * An indicator for whether the object is currently controlled
1116 * @type {boolean}
1117 * @private
1118 */
1119 _controlled: boolean;
1120 /**
1121 * An indicator for whether the object is currently a hover target
1122 * @type {boolean}
1123 * @private
1124 */
1125 _hover: boolean;
1126 /**
1127 * A singleton reference to the FormApplication class which configures this object
1128 * @type {FormApplication|null}
1129 * @private
1130 */
1131 _sheet: FormApplication | null;
1132 /**
1133 * The bounding box for this PlaceableObject.
1134 * This is required if the layer uses a Quadtree, otherwise it is optional
1135 * @return {NormalizedRectangle}
1136 */
1137 get bounds(): NormalizedRectangle;
1138 /**
1139 * The central coordinate pair of the placeable object based on it's own width and height
1140 * @type {PIXI.Point}
1141 */
1142 get center(): any;
1143 /**
1144 * The _id of the underlying EmbeddedEntity
1145 * @type {string}
1146 */
1147 get id(): string;
1148 /**
1149 * The field-of-vision polygon for the object, if it has been computed
1150 * @type {PIXI.Polygon|null}
1151 */
1152 get fov(): any;
1153 /** @alias {PlaceableObject.layer} */
1154 get layer(): any;
1155 /**
1156 * The line-of-sight polygon for the object, if it has been computed
1157 * @type {PIXI.Polygon|null}
1158 */
1159 get los(): any;
1160 /**
1161 * A Form Application which is used to configure the properties of this Placeable Object or the EmbeddedEntity
1162 * it represents.
1163 * @type {FormApplication}
1164 */
1165 get sheet(): FormApplication;
1166 /**
1167 * A Universally Unique Identifier (uuid) for this EmbeddedEntity
1168 * @type {string}
1169 */
1170 get uuid(): string;
1171 /**
1172 * Test whether a user can perform a certain interaction with regards to a Placeable Object
1173 * @param {User} user The User performing the action
1174 * @param {string} action The named action being attempted
1175 * @return {boolean} Does the User have rights to perform the action?
1176 */
1177 can(user: User, action: string): boolean;
1178 /**
1179 * Can the User access the HUD for this Placeable Object?
1180 * @private
1181 */
1182 _canHUD(user: any, event: any): boolean;
1183 /**
1184 * Does the User have permission to configure the Placeable Object?
1185 * @private
1186 */
1187 _canConfigure(user: any, event: any): any;
1188 /**
1189 * Does the User have permission to control the Placeable Object?
1190 * @private
1191 */
1192 _canControl(user: any, event: any): any;
1193 /**
1194 * Does the User have permission to view details of the Placeable Object?
1195 * @private
1196 */
1197 _canView(user: any, event: any): any;
1198 /**
1199 * Does the User have permission to create the underlying Embedded Entity?
1200 * @private
1201 */
1202 _canCreate(user: any, event: any): any;
1203 /**
1204 * Does the User have permission to drag this Placeable Object?
1205 * @private
1206 */
1207 _canDrag(user: any, event: any): any;
1208 /**
1209 * Does the User have permission to hover on this Placeable Object?
1210 * @private
1211 */
1212 _canHover(user: any, event: any): any;
1213 /**
1214 * Does the User have permission to update the underlying Embedded Entity?
1215 * @private
1216 */
1217 _canUpdate(user: any, event: any): any;
1218 /**
1219 * Does the User have permission to delete the underlying Embedded Entity?
1220 * @private
1221 */
1222 _canDelete(user: any, event: any): any;
1223 /**
1224 * Clear the display of the existing object
1225 * @return {PlaceableObject} The cleared object
1226 */
1227 clear(): PlaceableObject;
1228 /**
1229 * Clone the placeable object, returning a new object with identical attributes
1230 * The returned object is non-interactive, and has no assigned ID
1231 * If you plan to use it permanently you should call the create method
1232 *
1233 * @return {PlaceableObject} A new object with identical data
1234 */
1235 clone(): PlaceableObject;
1236 /**
1237 * Draw the placeable object into its parent container
1238 * @return {PlaceableObject} The drawn object
1239 */
1240 draw(): PlaceableObject;
1241 /**
1242 * Draw the primary Sprite for the PlaceableObject
1243 * @return {PIXI.Sprite|null}
1244 * @private
1245 */
1246 _drawPrimarySprite(texture: any): any;
1247 /**
1248 * Refresh the current display state of the Placeable Object
1249 * @return {PlaceableObject} The refreshed object
1250 */
1251 refresh(): PlaceableObject;
1252 /** @extends {Entity.updateEmbeddedEntity} */
1253 update(data: any, options: any): Promise<PlaceableObject>;
1254 /** @extends {Entity.deleteEmbeddedEntity} */
1255 delete(options: any): Promise<PlaceableObject>;
1256 /**
1257 * Get the value of a "flag" for this PlaceableObject
1258 * See the setFlag method for more details on flags
1259 *
1260 * @param {string} scope The flag scope which namespaces the key
1261 * @param {string} key The flag key
1262 * @return {*} The flag value
1263 */
1264 getFlag(scope: string, key: string): any;
1265 /**
1266 * Assign a "flag" to this Entity.
1267 * Flags represent key-value type data which can be used to store flexible or arbitrary data required by either
1268 * the core software, game systems, or user-created modules.
1269 *
1270 * Each flag should be set using a scope which provides a namespace for the flag to help prevent collisions.
1271 *
1272 * Flags set by the core software use the "core" scope.
1273 * Flags set by game systems or modules should use the canonical name attribute for the module
1274 * Flags set by an individual world should "world" as the scope.
1275 *
1276 * Flag values can assume almost any data type. Setting a flag value to null will delete that flag.
1277 *
1278 * @param {string} scope The flag scope which namespaces the key
1279 * @param {string} key The flag key
1280 * @param {*} value The flag value
1281 *
1282 * @return {Promise} A Promise resolving to the updated PlaceableObject
1283 */
1284 setFlag(scope: string, key: string, value: any): Promise<any>;
1285 /**
1286 * Remove a flag assigned to the Entity
1287 * @param {string} scope The flag scope which namespaces the key
1288 * @param {string} key The flag key
1289 * @return {Promise} A Promise resolving to the updated Entity
1290 */
1291 unsetFlag(scope: string, key: string): Promise<any>;
1292 /**
1293 * Register pending canvas operations which should occur after a new PlaceableObject of this type is created
1294 * @private
1295 */
1296 _onCreate(): void;
1297 /**
1298 * Define additional steps taken when an existing placeable object of this type is updated with new data
1299 * @private
1300 */
1301 _onUpdate(data: any): void;
1302 zIndex: number;
1303 /**
1304 * Define additional steps taken when an existing placeable object of this type is deleted
1305 * @private
1306 */
1307 _onDelete(): void;
1308 /**
1309 * Assume control over a PlaceableObject, flagging it as controlled and enabling downstream behaviors
1310 * @param {Object} options Additional options which modify the control request
1311 * @param {boolean} options.releaseOthers Release any other controlled objects first
1312 * @return {boolean} A flag denoting whether or not control was successful
1313 */
1314 control(options?: { releaseOthers: boolean }): boolean;
1315 /**
1316 * Additional events which trigger once control of the object is established
1317 * @param {Object} options Optional parameters which apply for specific implementations
1318 * @private
1319 */
1320 _onControl(options: any): void;
1321 /**
1322 * Release control over a PlaceableObject, removing it from the controlled set
1323 * @param {Object} options Options which modify the releasing workflow
1324 * @return {boolean} A Boolean flag confirming the object was released.
1325 */
1326 release(options?: any): boolean;
1327 /**
1328 * Additional events which trigger once control of the object is released
1329 * @param {Object} options Options which modify the releasing workflow
1330 * @private
1331 */
1332 _onRelease(options: any): void;
1333 /**
1334 * Rotate the PlaceableObject to a certain angle of facing
1335 * @param {number} angle The desired angle of rotation
1336 * @param {number} snap Snap the angle of rotation to a certain target degree increment
1337 * @return {Promise<PlaceableObject>} A Promise which resolves once the rotation has completed
1338 */
1339 rotate(angle: number, snap: number): Promise<PlaceableObject>;
1340 /**
1341 * Determine a new angle of rotation for a PlaceableObject either from an explicit angle or from a delta offset.
1342 * @param {number} [angle] An explicit angle, either this or delta must be provided
1343 * @param {number} [delta] A relative angle delta, either this or the angle must be provided
1344 * @param {number} [snap] A precision (in degrees) to which the resulting angle should snap. Default is 0.
1345 * @return {number} The new rotation angle for the object
1346 */
1347 _updateRotation({ angle, delta, snap }?: number): number;
1348 /**
1349 * Obtain a shifted position for the Placeable Object
1350 * @param {number} dx The number of grid units to shift along the X-axis
1351 * @param {number} dy The number of grid units to shift along the Y-axis
1352 * @return {{x, y}} The shifted target coordinates
1353 * @private
1354 */
1355 _getShiftedPosition(
1356 dx: number,
1357 dy: number
1358 ): {
1359 x: any;
1360 y: any;
1361 };
1362 /**
1363 * Activate interactivity for the Placeable Object
1364 */
1365 activateListeners(): void;
1366 /**
1367 * Create a standard MouseInteractionManager for the PlaceableObject
1368 * @private
1369 */
1370 _createInteractionManager(): MouseInteractionManager;
1371 /**
1372 * Actions that should be taken for this Placeable Object when a mouseover event occurs
1373 * @param {PIXI.interaction.InteractionEvent} event
1374 * @param {boolean} hoverOutOthers
1375 * @private
1376 */
1377 _onHoverIn(event: any, { hoverOutOthers }?: boolean): boolean;
1378 /**
1379 * Actions that should be taken for this Placeable Object when a mouseout event occurs
1380 * @param {PIXI.interaction.InteractionEvent} event
1381 * @private
1382 */
1383 _onHoverOut(event: any): boolean;
1384 /**
1385 * Callback actions which occur on a single left-click event to assume control of the object
1386 * @param {PIXI.interaction.InteractionEvent} event
1387 * @private
1388 */
1389 _onClickLeft(event: any): boolean;
1390 /**
1391 * Callback actions which occur on a double left-click event to activate
1392 * @param {PIXI.interaction.InteractionEvent} event
1393 * @private
1394 */
1395 _onClickLeft2(event: any): void;
1396 /**
1397 * Callback actions which occur on a single right-click event to configure properties of the object
1398 * @param {PIXI.interaction.InteractionEvent} event
1399 * @private
1400 */
1401 _onClickRight(event: any): void;
1402 /**
1403 * Callback actions which occur on a double right-click event to configure properties of the object
1404 * @param {PIXI.interaction.InteractionEvent} event
1405 * @private
1406 */
1407 _onClickRight2(event: any): void;
1408 /**
1409 * Callback actions which occur when a mouse-drag action is first begun.
1410 * @param {PIXI.interaction.InteractionEvent} event
1411 * @private
1412 */
1413 _onDragLeftStart(event: any): void;
1414 /**
1415 * Callback actions which occur on a mouse-move operation.
1416 * @param {PIXI.interaction.InteractionEvent} event
1417 * @private
1418 */
1419 _onDragLeftMove(event: any): void;
1420 /**
1421 * Callback actions which occur on a mouse-move operation.
1422 * @param {PIXI.interaction.InteractionEvent} event
1423 * @private
1424 */
1425 _onDragLeftDrop(event: any): any;
1426 /**
1427 * Callback actions which occur on a mouse-move operation.
1428 * @param {PIXI.interaction.InteractionEvent} event
1429 * @private
1430 */
1431 _onDragLeftCancel(event: any): void;
1432}
1433/**
1434 * A ray for the purposes of computing sight and collision
1435 * Given points A[x,y] and B[x,y]
1436 *
1437 * Slope-Intercept form:
1438 * y = a + bx
1439 * y = A.y + ((B.y - A.Y) / (B.x - A.x))x
1440 *
1441 * Parametric form:
1442 * R(t) = (1-t)A + tB
1443 *
1444 * @param {{x: number, y: number}} A The origin of the Ray
1445 * @param {{x: number, y: number}} B The destination of the Ray
1446 */
1447declare class Ray {
1448 /**
1449 * A factory method to construct a Ray from an origin point, an angle, and a distance
1450 * @param {number} x The origin x-coordinate
1451 * @param {number} y The origin y-coordinate
1452 * @param {number} radians The ray angle in radians
1453 * @param {number} distance The distance of the ray in pixels
1454 * @return {Ray} The constructed Ray instance
1455 */
1456 static fromAngle(x: number, y: number, radians: number, distance: number): Ray;
1457 /**
1458 * A factory method to construct a Ray from points in array format.
1459 * @param {number[]} A The origin point [x,y]
1460 * @param {number[]} B The destination point [x,y]
1461 * @return {Ray} The constructed Ray instance
1462 */
1463 static fromArrays(A: number[], B: number[]): Ray;
1464 /**
1465 * An internal helper method for computing the intersection between two lines.
1466 * @private
1467 */
1468 static _getIntersection(
1469 x1: any,
1470 y1: any,
1471 x2: any,
1472 y2: any,
1473 x3: any,
1474 y3: any,
1475 x4: any,
1476 y4: any
1477 ):
1478 | false
1479 | {
1480 x: any;
1481 y: any;
1482 t0: number;
1483 t1: number;
1484 };
1485 constructor(A: any, B: any);
1486 A: any;
1487 B: any;
1488 y0: any;
1489 x0: any;
1490 dx: number;
1491 dy: number;
1492 /**
1493 * The slope of the ray, dy over dx
1494 * @type {number}
1495 */
1496 slope: number;
1497 /**
1498 * The normalized angle of the ray in radians on the range (-PI, PI)
1499 * @type {number}
1500 */
1501 angle: number;
1502 /**
1503 * The distance of the ray
1504 * @type {number}
1505 */
1506 distance: number;
1507 /**
1508 * A bounding rectangle that encompasses the Ray
1509 * @type {NormalizedRectangle}
1510 */
1511 get bounds(): NormalizedRectangle;
1512 /**
1513 * Return the value of the angle normalized to the range (0, 2*PI)
1514 * This is useful for testing whether an angle falls between two others
1515 * @type {number}
1516 */
1517 get normAngle(): number;
1518 /**
1519 * Project the Array by some proportion of it's initial distance.
1520 * Return the coordinates of that point along the path.
1521 * @param {number} t The distance along the Ray
1522 * @return {Object} The coordinates of the projected point
1523 */
1524 project(t: number): any;
1525 /**
1526 * Create a new ray which uses the same origin point, but a slightly offset angle and distance
1527 * @param {number} offset An offset in radians which modifies the angle of the original Ray
1528 * @param {number} [distance] A distance the new ray should project, otherwise uses the same distance.
1529 * @return {Ray} A new Ray with an offset angle
1530 */
1531 shiftAngle(offset: number, distance?: number): Ray;
1532 /**
1533 * Find the point I[x,y] and distance t* on ray R(t) which intersects another ray
1534 * http://paulbourke.net/geometry/pointlineplane/
1535 *
1536 * @param {number[]} coords An array of coordinates [x0, y0, x1, y1] which defines a line segment to test
1537 *
1538 * @return {{x: number, y: number, t0: number, t1: number}|false}
1539 * The point of collision [x,y] the position of that collision point along the Ray (t0) an the tested
1540 * segment (t1). Returns false if no collision occurs.
1541 */
1542 intersectSegment(
1543 coords: number[]
1544 ):
1545 | false
1546 | {
1547 x: number;
1548 y: number;
1549 t0: number;
1550 t1: number;
1551 };
1552}
1553/**
1554 * A helper class used by the Sight Layer to represent a source of vision or illumination.
1555 */
1556declare class PointSource {
1557 /**
1558 * For testing the performance gains of culling render of off-screen sources.
1559 */
1560 static updatePointSourceBounds(): void;
1561 /**
1562 * The light or darkness container for this source
1563 * @type {PIXI.Container}
1564 */
1565 illumination: PIXI.Container;
1566 /**
1567 * This visible color container for this source
1568 * @type {PIXI.Container}
1569 */
1570 coloration: PIXI.Container;
1571 /**
1572 * Internal flag for whether this is a darkness source
1573 * @type {boolean}
1574 */
1575 darkness: boolean;
1576 /**
1577 * Is the light source limited by an angle of emission?
1578 * @type {boolean}
1579 */
1580 limited: boolean;
1581 /**
1582 * The maximum radius of emission for this source
1583 * @type {number}
1584 */
1585 radius: number;
1586 /**
1587 * Internal flag for animation throttling time
1588 * @type {number}
1589 */
1590 _animateTime: number;
1591 /**
1592 * Create the structure of a source Container which can be rendered to the sight layer shadow-map
1593 * @return {PIXI.Container} The constructed light source container
1594 * @private
1595 */
1596 _createContainer(filterClass: any): any;
1597 /**
1598 * Initialize the source with provided object data.
1599 *
1600 * @param {number} x The x-coordinate of the source location
1601 * @param {number} y The y-coordinate of the source location
1602 * @param {number} dim The allowed radius of dim vision or illumination
1603 * @param {number} bright The allowed radius of bright vision or illumination
1604 * @param {number} angle The angle of emission for this point source
1605 * @param {number} rotation The angle of rotation for this point source
1606 * @param {string} color A tint color for the emitted light, if any
1607 * @param {number} alpha An opacity for the emitted light, if any
1608 * @param {number} darknessThreshold A level of darkness beyond which this light is active
1609 * @param {string} type The source type from SOURCE_TYPES
1610 *
1611 * @return {PointSource} A reference to the initialized source
1612 */
1613 initialize({
1614 x,
1615 y,
1616 dim,
1617 bright,
1618 angle,
1619 rotation,
1620 color,
1621 alpha,
1622 animation,
1623 darknessThreshold,
1624 type,
1625 }?: number): PointSource;
1626 x: any;
1627 y: any;
1628 angle: any;
1629 rotation: any;
1630 alpha: any;
1631 color: number;
1632 colorRGB: any[];
1633 darknessThreshold: any;
1634 animation: any;
1635 type: any;
1636 dim: number;
1637 bright: number;
1638 fov: any;
1639 los: any;
1640 /**
1641 * Draw the display of this source for the darkness/light container of the SightLayer.
1642 * @return {PIXI.Container} The rendered light container
1643 */
1644 drawLight(channels: any): any;
1645 /**
1646 * Draw and return a container used to depict the visible color tint of the light source on the LightingLayer
1647 * @return {PIXI.Container} An updated color container for the source
1648 */
1649 drawColor(): any;
1650 /**
1651 * Animate the PointSource, if an animation is enabled and if it currently has rendered containers.
1652 * @param {number} dt Delta time
1653 */
1654 animate(dt: number): void;
1655 /**
1656 * A basic "torch" animation which flickers like a burning flame.
1657 * @param {number} dt Delta time
1658 * @param {number} speed The animation speed, from 1 to 10
1659 * @param {number} intensity The animation intensity, from 1 to 10
1660 */
1661 animateTorch(dt: number, { speed, intensity }?: number): void;
1662 _flickerTime: number;
1663 /**
1664 * A basic "pulse" animation which expands and contracts.
1665 * @param {number} dt Delta time
1666 * @param {number} speed The animation speed, from 1 to 10
1667 * @param {number} intensity The animation intensity, from 1 to 10
1668 */
1669 animatePulse(dt: number, { speed, intensity }?: number): void;
1670 _pulseAngle: any;
1671 /**
1672 * A color-shifting animation which evolves the tint color of the displayed light source.
1673 * @param {number} dt Delta time
1674 * @param {number} speed The animation speed, from 1 to 10
1675 * @param {number} intensity The animation intensity, from 1 to 10
1676 */
1677 animateChroma(dt: number, { speed, intensity }?: number): void;
1678 _priorColor: any;
1679 _targetColor: number[];
1680 /**
1681 * Evolve a value using a stochastic AR(1) process
1682 * @param {number} y The current value
1683 * @param {number} phi The decay rate of prior values
1684 * @param {number} center The stationary mean of the series
1685 * @param {number} sigma The volatility of the process - standard deviation of the error term
1686 * @param {number} max The maximum allowed outcome, or null
1687 * @param {number} min The minimum allowed outcome, or null
1688 * @return {number} The new value of the process
1689 * @private
1690 */
1691 _ar1(y: number, { phi, center, sigma, max, min }?: number): number;
1692}
1693/**
1694 * @typedef {{
1695 * token: Token|null,
1696 * actor: Actor|null,
1697 * name: string,
1698 * players: User[],
1699 * owner: boolean,
1700 * visible: boolean
1701 * }} Combatant
1702 */
1703/**
1704 * The Combat Entity defines a particular combat encounter which can occur within the game session
1705 * Combat instances belong to the CombatEncounters collection
1706 * @extends {Entity}
1707 */
1708declare class Combat extends Entity {
1709 /**
1710 * The configuration setting used to record Combat preferences
1711 * @type {string}
1712 */
1713 static CONFIG_SETTING: string;
1714 /** @override */
1715 static get config(): {
1716 baseEntity: typeof Combat;
1717 collection: any;
1718 embeddedEntities: {
1719 Combatant: string;
1720 };
1721 label: string;
1722 };
1723 constructor(...args: any[]);
1724 /**
1725 * Track the sorted turn order of this combat encounter
1726 * @type {Combatant[]}
1727 */
1728 turns: Combatant[];
1729 /**
1730 * Record the current round, turn, and tokenId to understand changes in the encounter state
1731 * @type {{round: number|null, turn: number|null, tokenId: string|null}}
1732 * @private
1733 */
1734 current: {
1735 round: number | null;
1736 turn: number | null;
1737 tokenId: string | null;
1738 };
1739 /**
1740 * Track the previous round, turn, and tokenId to understand changes in the encounter state
1741 * @type {{round: number|null, turn: number|null, tokenId: string|null}}
1742 * @private
1743 */
1744 previous: {
1745 round: number | null;
1746 turn: number | null;
1747 tokenId: string | null;
1748 };
1749 /**
1750 * Track whether a sound notification is currently being played to avoid double-dipping
1751 * @type {boolean}
1752 * @private
1753 */
1754 _soundPlaying: boolean;
1755 /**
1756 * Return the Array of combatants sorted into initiative order, breaking ties alphabetically by name.
1757 * @return {Combatant[]}
1758 */
1759 setupTurns(): {
1760 token: Token;
1761 actor: Actor;
1762 name: string;
1763 players: User[];
1764 owner: boolean;
1765 visible: boolean;
1766 }[];
1767 /**
1768 * Prepare turn data for one specific combatant.
1769 * @private
1770 */
1771 _prepareCombatant(c: any, scene: any, players: any, settings?: {}): any;
1772 /**
1773 * Define how the array of Combatants is sorted in the displayed list of the tracker.
1774 * This method can be overridden by a system or module which needs to display combatants in an alternative order.
1775 * By default sort by initiative, falling back to name
1776 * @private
1777 */
1778 _sortCombatants(a: any, b: any): any;
1779 /**
1780 * A convenience reference to the Array of combatant data within the Combat entity
1781 * @type {object[]}
1782 */
1783 get combatants(): any[];
1784 /**
1785 * Get the data object for the Combatant who has the current turn
1786 * @type {Combatant}
1787 */
1788 get combatant(): {
1789 token: Token;
1790 actor: Actor;
1791 name: string;
1792 players: User[];
1793 owner: boolean;
1794 visible: boolean;
1795 };
1796 /**
1797 * The numeric round of the Combat encounter
1798 * @type {number}
1799 */
1800 get round(): number;
1801 /**
1802 * The numeric turn of the combat round in the Combat encounter
1803 * @type {number}
1804 */
1805 get turn(): number;
1806 /**
1807 * Get the Scene entity for this Combat encounter
1808 * @return {Scene}
1809 */
1810 get scene(): Scene;
1811 /**
1812 * Return the object of settings which modify the Combat Tracker behavior
1813 * @return {object}
1814 */
1815 get settings(): any;
1816 /**
1817 * Has this combat encounter been started?
1818 * @type {boolean}
1819 */
1820 get started(): boolean;
1821 /**
1822 * Set the current Combat encounter as active within the Scene.
1823 * Deactivate all other Combat encounters within the viewed Scene and set this one as active
1824 * @return {Promise<Combat>}
1825 */
1826 activate(): Promise<Combat>;
1827 /**
1828 * Begin the combat encounter, advancing to round 1 and turn 1
1829 * @return {Promise<Combat>}
1830 */
1831 startCombat(): Promise<Combat>;
1832 /**
1833 * Advance the combat to the next turn
1834 * @return {Promise<Combat>}
1835 */
1836 nextTurn(): Promise<Combat>;
1837 /**
1838 * Rewind the combat to the previous turn
1839 * @return {Promise<Combat>}
1840 */
1841 previousTurn(): Promise<Combat>;
1842 /**
1843 * Advance the combat to the next round
1844 * @return {Promise<Combat>}
1845 */
1846 nextRound(): Promise<Combat>;
1847 /**
1848 * Rewind the combat to the previous round
1849 * @return {Promise<Combat>}
1850 */
1851 previousRound(): Promise<Combat>;
1852 /**
1853 * Reset all combatant initiative scores, setting the turn back to zero
1854 * @return {Promise<Combat>}
1855 */
1856 resetAll(): Promise<Combat>;
1857 /**
1858 * Display a dialog querying the GM whether they wish to end the combat encounter and empty the tracker
1859 * @return {Promise<void>}
1860 */
1861 endCombat(): Promise<void>;
1862 /** @override */
1863 getCombatant(id: any): any;
1864 /**
1865 * Get a Combatant using its Token id
1866 * @param {string} tokenId The id of the Token for which to acquire the combatant
1867 */
1868 getCombatantByToken(
1869 tokenId: string
1870 ): {
1871 token: Token;
1872 actor: Actor;
1873 name: string;
1874 players: User[];
1875 owner: boolean;
1876 visible: boolean;
1877 };
1878 /**
1879 * Set initiative for a single Combatant within the Combat encounter.
1880 * Turns will be updated to keep the same combatant as current in the turn order
1881 * @param {string} id The combatant ID for which to set initiative
1882 * @param {number} value A specific initiative value to set
1883 */
1884 setInitiative(id: string, value: number): Promise<void>;
1885 /**
1886 * Roll initiative for one or multiple Combatants within the Combat entity
1887 * @param {string|string[]} ids A Combatant id or Array of ids for which to roll
1888 * @param {string|null} [formula] A non-default initiative formula to roll. Otherwise the system default is used.
1889 * @param {boolean} [updateTurn] Update the Combat turn after adding new initiative scores to keep the turn on
1890 * the same Combatant.
1891 * @param {object} [messageOptions] Additional options with which to customize created Chat Messages
1892 * @return {Promise<Combat>} A promise which resolves to the updated Combat entity once updates are complete.
1893 */
1894 rollInitiative(ids: string | string[], { formula, updateTurn, messageOptions }?: string): Promise<Combat>;
1895 /**
1896 * Acquire the default dice formula which should be used to roll initiative for a particular combatant.
1897 * Modules or systems could choose to override or extend this to accommodate special situations.
1898 * @private
1899 *
1900 * @param {object} combatant Data for the specific combatant for whom to acquire an initiative formula. This
1901 * is not used by default, but provided to give flexibility for modules and systems.
1902 * @return {string} The initiative formula to use for this combatant.
1903 */
1904 _getInitiativeFormula(combatant: any): string;
1905 /**
1906 * Get a Roll object which represents the initiative roll for a given combatant.
1907 * @private
1908 * @param {object} combatant Data for the specific combatant for whom to acquire an initiative formula. This
1909 * is not used by default, but provided to give flexibility for modules and systems.
1910 * @param {string} formula An explicit Roll formula to use for the combatant.
1911 * @return {Roll} The Roll instance to use for the combatant.
1912 */
1913 _getInitiativeRoll(combatant: any, formula: string): Roll;
1914 /**
1915 * Roll initiative for all non-player actors who have not already rolled
1916 * @param {...*} args Additional arguments forwarded to the Combat.rollInitiative method
1917 */
1918 rollNPC(...args: any[]): Promise<Combat>;
1919 /**
1920 * Roll initiative for all combatants which have not already rolled
1921 * @param {...*} args Additional arguments forwarded to the Combat.rollInitiative method
1922 */
1923 rollAll(...args: any[]): Promise<Combat>;
1924 /**
1925 * Create a new Combatant embedded entity
1926 * @see {@link Combat#createEmbeddedEntity}
1927 */
1928 createCombatant(
1929 data: any,
1930 options: any
1931 ): Promise<
1932 | {
1933 string: any;
1934 any: any;
1935 }
1936 | {
1937 string: any;
1938 any: any;
1939 }[]
1940 >;
1941 /**
1942 * Update an existing Combatant embedded entity
1943 * @see {@link Combat#updateEmbeddedEntity}
1944 */
1945 updateCombatant(data: any, options: any): Promise<Entity | Entity[]>;
1946 /**
1947 * Delete an existing Combatant embedded entity
1948 * @see {@link Combat#deleteEmbeddedEntity}
1949 */
1950 deleteCombatant(
1951 id: any,
1952 options: any
1953 ): Promise<
1954 | {
1955 string: any;
1956 any: any;
1957 }
1958 | {
1959 string: any;
1960 any: any;
1961 }[]
1962 >;
1963 /** @override */
1964 _onCreate(...args: any[]): void;
1965 /** @override */
1966 _onUpdate(data: any, ...args: any[]): void;
1967 /** @override */
1968 _onDelete(...args: any[]): void;
1969 /** @override */
1970 _onDeleteEmbeddedEntity(embeddedName: any, child: any, options: any, userId: any): any;
1971 /** @override */
1972 _onModifyEmbeddedEntity(...args: any[]): void;
1973}
1974/**
1975 * An abstract class pattern for all primary data entities within the Foundry VTT Framework. An entity represents a
1976 * primary data concept, for example: Actor, Item, Scene, or ChatMessage. Each Entity type in Foundry Virtual
1977 * Tabletop extends this base Entity class which ensures similar behavior and workflow across all entity types.
1978 *
1979 * Documentation for this class is provided for reference, but developers should not extend this class directly,
1980 * instead work with or extend the Entity implementations that are referenced in this section of the API documentation.
1981 *
1982 * Entities are instantiated by providing their base data, and an optional Array of Application instances which should
1983 * be automatically refreshed when the Entity experiences an update.
1984 * @abstract
1985 * @interface
1986 *
1987 * @see {@link EntityCollection} The EntityCollection abstract class which contains Entity instances.
1988 * @see {@link Actor} The Actor Entity.
1989 * @see {@link Combat} The Combat Encounter Entity.
1990 * @see {@link Folder} The Folder Entity.
1991 * @see {@link Item} The Item Entity.
1992 * @see {@link JournalEntry} The Journal Entry Entity.
1993 * @see {@link ChatMessage} The Chat Message Entity.
1994 * @see {@link Playlist} The Audio Playlist Entity.
1995 * @see {@link Scene} The Scene Entity.
1996 * @see {@link RollTable} The Rollable Table Entity.
1997 * @see {@link User} The User Entity.
1998 * @see {@link Compendium} The Compendium which may contain Entities in a compendium pack.
1999 *
2000 * @param {Object} data The data Object with which to create the Entity
2001 * @param {Object} options Additional options which modify the created Entity behavior
2002 * @param {Compendium} [options.compendium] A reference to the Compendium pack from which this Entity was drawn.
2003 *
2004 * @example
2005 * let actorData = {name: "John Doe", type: "character", img: "icons/svg/mystery-man.svg"};
2006 * let actor = new Actor(actorData);
2007 */
2008declare class Entity {
2009 /**
2010 * Configure the attributes of this Entity class
2011 * @type {Object}
2012 * @property {Entity} baseEntity The parent class which directly inherits from the Entity interface.
2013 * @property {EntityCollection} collection The EntityCollection instance to which Entities of this type belong.
2014 * @property {string[]} embeddedEntities The names of any Embedded Entities within the Entity data structure.
2015 */
2016 static get config(): any;
2017 /**
2018 * Return a reference to the EntityCollection instance which stores Entity instances of this type. This property is
2019 * available as both a static and instance method and should be overridden by subclass Entity implementations.
2020 * @type {EntityCollection}
2021 * @static
2022 */
2023 static get collection(): EntityCollection;
2024 /**
2025 * The class name of the base Entity type, for example "Actor". This is useful in cases where there is an inheritance
2026 * chain. Many places throughout the framework rely upon the canonical entity name which may not always be equal
2027 * to the class name. This property is available as both a static and instance method.
2028 * @type {string}
2029 *
2030 * @example
2031 * class Actor2ndGen extends Actor {...}
2032 * Actor2ndGen.entity // "Actor"
2033 */
2034 static get entity(): string;
2035 /**
2036 * Test whether a given User has permission to perform some action on this Entity
2037 * @param {User} user The User requesting creation
2038 * @param {string} action The attempted action
2039 * @param {Entity} target The targeted Entity
2040 * @return {boolean} Does the User have permission?
2041 */
2042 static can(user: User, action: string, target: Entity): boolean;
2043 /**
2044 * Activate the Socket event listeners used to receive responses from events which modify database documents
2045 * @param {Socket} socket The active game socket
2046 */
2047 static activateSocketListeners(socket: any): void;
2048 /**
2049 * Create one or multiple new entities using provided input data.
2050 * Data may be provided as a single object to create one Entity, or as an Array of Objects.
2051 * Entities may be temporary (unsaved to the database) by passing the temporary option as true.
2052 * @static
2053 *
2054 * @param {Data|Data[]} data A Data object or array of Data
2055 * @param {Options} options Additional options which customize the creation workflow
2056 * @param {boolean} [options.temporary] Create a temporary entity which is not saved to the world database. Default is false.
2057 * @param {boolean} [options.renderSheet] Display the sheet for the created entity once it is created. Default is false.
2058 *
2059 * @return {Promise<Entity|Entity[]>} The created Entity or array of Entities
2060 *
2061 * @example
2062 * const data = {name: "New Entity", type: "character", img: "path/to/profile.jpg"};
2063 * const created = await Entity.create(data); // Returns one Entity, saved to the database
2064 * const temp = await Entity.create(data, {temporary: true}); // Not saved to the database
2065 *
2066 * @example
2067 * const data = [{name: "Tim", type: "npc"], [{name: "Tom", type: "npc"}];
2068 * const created = await Entity.create(data); // Returns an Array of Entities, saved to the database
2069 * const created = await Entity.create(data, {temporary: true}); // Not saved to the database
2070 */
2071 static create(
2072 data:
2073 | {
2074 string: any;
2075 any: any;
2076 }
2077 | {
2078 string: any;
2079 any: any;
2080 }[],
2081 options?: {
2082 string: any;
2083 any: any;
2084 }
2085 ): Promise<Entity | Entity[]>;
2086 /**
2087 * Handle a SocketResponse from the server when one or multiple Entities are created
2088 * @param {SocketRequest} request The initial request
2089 * @param {Data[]} result An Array of created Entity data
2090 * @param {string} userId The id of the requesting User
2091 * @return {Entity[]} An Array of constructed Entity instances
2092 * @private
2093 */
2094 static _handleCreate({ request, result, userId }?: any): Entity[];
2095 /**
2096 * Update one or multiple existing entities using provided input data.
2097 * Data may be provided as a single object to update one Entity, or as an Array of Objects.
2098 * @static
2099 *
2100 * @param {Data|Data[]} data A Data object or array of Data. Each element must contain the _id of an existing Entity.
2101 * @param {Options} options Additional options which customize the update workflow
2102 * @param {boolean} [options.diff] Difference the provided data against the current to eliminate unnecessary changes.
2103 *
2104 * @return {Promise<Entity|Entity[]>} The updated Entity or array of Entities
2105 *
2106 * @example
2107 * const data = {_id: "12ekjf43kj2312ds", name: "New Name"}};
2108 * const updated = await Entity.update(data); // Updated entity saved to the database
2109 *
2110 * @example
2111 * const data = [{_id: "12ekjf43kj2312ds", name: "New Name 1"}, {_id: "kj549dk48k34jk34", name: "New Name 2"}]};
2112 * const updated = await Entity.update(data); // Returns an Array of Entities, updated in the database
2113 */
2114 static update(
2115 data:
2116 | {
2117 string: any;
2118 any: any;
2119 }
2120 | {
2121 string: any;
2122 any: any;
2123 }[],
2124 options?: {
2125 string: any;
2126 any: any;
2127 }
2128 ): Promise<Entity | Entity[]>;
2129 /**
2130 * Handle a SocketResponse from the server when one or multiple Entities are updated
2131 * @param {SocketRequest} request The initial request
2132 * @param {Data[]} result An Array of updated Entity data
2133 * @param {string} userId The id of the requesting User
2134 * @return {Entity[]} An Array of constructed Entity instances
2135 * @private
2136 */
2137 static _handleUpdate({ request, result, userId }?: any): Entity[];
2138 /**
2139 * Delete one or multiple existing entities using provided ids.
2140 * The target ids may be a single string or an Array of strings.
2141 * @static
2142 *
2143 * @param {string|string[]} data A single id or Array of ids
2144 * @param {Options} options Additional options which customize the deletion workflow
2145
2146 * @return {Promise<Entity|Entity[]>} The deleted Entity or array of Entities
2147 *
2148 * @example
2149 * const id = "12ekjf43kj2312ds";
2150 * const deleted = await Entity.delete(id); // A single deleted entity from the database
2151 *
2152 * @example
2153 * const ids = ["12ekjf43kj2312ds", "kj549dk48k34jk34"];
2154 * const deleted = await Entity.delete(ids); // Returns an Array of deleted Entities
2155 */
2156 static delete(
2157 data: string | string[],
2158 options?: {
2159 string: any;
2160 any: any;
2161 }
2162 ): Promise<Entity | Entity[]>;
2163 /**
2164 * Handle a SocketResponse from the server when one or multiple Entities are deleted
2165 * @param {SocketRequest} request The initial request
2166 * @param {string[]} result An Array of deleted Entity ids
2167 * @param {string} userId The id of the requesting User
2168 * @return {Entity[]} An Array of deleted Entity instances
2169 * @private
2170 */
2171 static _handleDelete({ request, result, userId }?: any): Entity[];
2172 /**
2173 * Handle a SocketResponse from the server when one or multiple Embedded Entities are created
2174 * @param {SocketRequest} request The initial request
2175 * @param {Data[]} result An Array of created Entity data
2176 * @param {string} userId The id of the requesting User
2177 * @return {Data[]} An Array of constructed EmbeddedDocument data
2178 * @private
2179 */
2180 static _handleCreateEmbeddedEntity({
2181 request,
2182 result,
2183 userId,
2184 }?: any): {
2185 string: any;
2186 any: any;
2187 }[];
2188 /**
2189 * Handle a SocketResponse from the server when one or multiple Embedded Entities are updated
2190 * @param {SocketRequest} request The initial request
2191 * @param {Data[]} result An Array of updated Entity data
2192 * @param {string} userId The id of the requesting User
2193 * @return {Data[]} An Array of updated EmbeddedDocument data
2194 * @private
2195 */
2196 static _handleUpdateEmbeddedEntity({
2197 request,
2198 result,
2199 userId,
2200 }?: any): {
2201 string: any;
2202 any: any;
2203 }[];
2204 /**
2205 * Handle a SocketResponse from the server when one or multiple Embedded Entities are deleted
2206 * @param {SocketRequest} request Th2e initial request
2207 * @param {string[]} result An Array of deleted EmbeddedEntity ids
2208 * @param {string} userId The id of the requesting User
2209 * @return {Data[]} An Array of deleted EmbeddedDocument data
2210 * @private
2211 */
2212 static _handleDeleteEmbeddedEntity({
2213 request,
2214 result,
2215 userId,
2216 }?: any): {
2217 string: any;
2218 any: any;
2219 }[];
2220 /**
2221 * A helper function to handle obtaining the dropped Entity data from a dropped event. Entity drop data could have:
2222 * 1. A compendium pack and entry id
2223 * 2. A World Entity _id
2224 * 3. A data object explicitly provided
2225 *
2226 * @param {object} data The data object extracted from a DataTransfer event
2227 * @return {Entity} The Entity data that should be handled by the drop handler
2228 */
2229 static fromDropData(data: any): Entity;
2230 /**
2231 * Provide a Dialog form to create a new Entity of this type.
2232 * Choose a name and a type from a select menu of types.
2233 * @param {object} data Initial data with which to populate the creation form
2234 * @param {object} options Initial positioning and sizing options for the dialog form
2235 * @return {Promise<Entity>} A Promise which resolves to the created Entity
2236 */
2237 static createDialog(data?: any, options?: any): Promise<Entity>;
2238 constructor(data: any, options: any);
2239 /**
2240 * The original source data for the Entity provided upon initialization.
2241 * This reflects the database state of the Entity before any transformations are applied.
2242 * @type {Object}
2243 */
2244 _data: Object;
2245 /**
2246 * The effective data for the Entity.
2247 * This data object may have transformations applied to it.
2248 * @type {Object}
2249 */
2250 data: Object;
2251 /**
2252 * The options object that was used to configure the Entity upon initialization.
2253 * @type {Object}
2254 */
2255 options: Object;
2256 /**
2257 * A collection of Application instances which should be re-rendered whenever this Entity experiences an update to
2258 * its data. The keys of this object are the application ids and the values are Application instances. Each
2259 * Application in this object will have its render method called by {@link Entity#render}.
2260 * @type {Object.<Application>}
2261 * @see {Entity#render}
2262 */
2263 apps: Object<Application>;
2264 /**
2265 * The Entity may optionally belong to a parent Compendium pack. If so this attribute will contain a reference
2266 * to that Compendium object. Otherwise null.
2267 * @type {Compendium|null}
2268 */
2269 compendium: Compendium | null;
2270 /**
2271 * Safely Initialize data structure for the Entity.
2272 * Errors that occur here should be captured and logged, but should not break construction of the Entity instance.
2273 */
2274 _initialize(): void;
2275 /**
2276 * A Universally Unique Identifier (uuid) for this Entity instance
2277 * @type {string}
2278 */
2279 get uuid(): string;
2280 /**
2281 * Prepare data for the Entity whenever the instance is first created or later updated.
2282 * This method can be used to derive any internal attributes which are computed in a formulaic manner.
2283 * For example, in a d20 system - computing an ability modifier based on the value of that ability score.
2284 */
2285 prepareData(): any;
2286 /**
2287 * Prepare Embedded Entities which exist within this parent Entity.
2288 * For example, in the case of an Actor, this method is responsible for preparing the Owned Items the Actor contains.
2289 */
2290 prepareEmbeddedEntities(): void;
2291 /**
2292 * Obtain a reference to the Array of source data within the data object for a certain Embedded Entity name
2293 * @param {string} embeddedName The name of the Embedded Entity type
2294 * @return {object[]} The Array of source data where Embedded Entities of this type are stored
2295 */
2296 getEmbeddedCollection(embeddedName: string): any[];
2297 /**
2298 * Render all of the Application instances which are connected to this Entity by calling their respective
2299 * {@link Application#render} methods.
2300 * @param {boolean} force Force rendering
2301 * @param {Options} context Optional context
2302 */
2303 render(
2304 force: boolean,
2305 context?: {
2306 string: any;
2307 any: any;
2308 }
2309 ): void;
2310 /** @alias {Entity.collection} */
2311 get collection(): any;
2312 /** @alias {Entity.entity} */
2313 get entity(): any;
2314 /**
2315 * A convenience accessor for the _id attribute of the Entity data object.
2316 * @type {string}
2317 */
2318 get id(): string;
2319 /** @alias {Entity#id} */
2320 get _id(): any;
2321 /**
2322 * A convenience accessor for the name attribute of the Entity data object
2323 * @type {string}
2324 */
2325 get name(): string;
2326 /**
2327 * A property which gets or creates a singleton instance of the sheet class used to render and edit data for this
2328 * particular entity type.
2329 * @type {BaseEntitySheet|null}
2330 *
2331 * @example <caption>A subclass of the Actor entity</caption>
2332 * let actor = game.entities.actors[0];
2333 * actor.sheet; // ActorSheet
2334 */
2335 get sheet(): BaseEntitySheet;
2336 /**
2337 * Obtain a reference to the BaseEntitySheet implementation which should be used to render the Entity instance
2338 * configuration sheet.
2339 * @private
2340 */
2341 get _sheetClass(): any;
2342 /**
2343 * Return a reference to the Folder which this Entity belongs to, if any.
2344 * @type {Folder|null}
2345 *
2346 * @example <caption>Entities may belong to Folders</caption>
2347 * let folder = game.folders.entities[0];
2348 * let actor = await Actor.create({name: "New Actor", folder: folder.id});
2349 * console.log(actor.data.folder); // folder.id;
2350 * console.log(actor.folder); // folder;
2351 */
2352 get folder(): Folder;
2353 /**
2354 * Return the permission level that the current game User has over this Entity.
2355 * See the CONST.ENTITY_PERMISSIONS object for an enumeration of these levels.
2356 * @type {number}
2357 *
2358 * @example
2359 * game.user.id; // "dkasjkkj23kjf"
2360 * entity.data.permission; // {default: 1, "dkasjkkj23kjf": 2};
2361 * entity.permission; // 2
2362 */
2363 get permission(): number;
2364 /**
2365 * A boolean indicator for whether or not the current game User has ownership rights for this Entity.
2366 * This property has a setter which allows for ownership rights to be temporarily overridden on a per-instance basis.
2367 * @type {boolean}
2368 */
2369 get owner(): boolean;
2370 /**
2371 * A boolean indicator for whether or not the current game User has at least limited visibility for this Entity.
2372 * @type {boolean}
2373 */
2374 get visible(): boolean;
2375 /**
2376 * A boolean indicator for whether the current game user has ONLY limited visibility for this Entity.
2377 * Note that a GM user's perspective of an Entity is never limited.
2378 * @type {boolean}
2379 */
2380 get limited(): boolean;
2381 /**
2382 * Test whether a provided User a specific permission level (or greater) over the Entity instance
2383 * @param {User} user The user to test for permission
2384 * @param {string|number} permission The permission level or level name to test
2385 * @param {boolean} exact Tests for an exact permission level match, by default this method tests for
2386 * an equal or greater permission level.
2387 * @return {boolean} Whether or not the user has the permission for this Entity.
2388 *
2389 * @example <caption>Test whether a specific user has a certain permission</caption>
2390 * // These two are equivalent
2391 * entity.hasPerm(game.user, "OWNER");
2392 * entity.owner;
2393 * // These two are also equivalent
2394 * entity.hasPerm(game.user, "LIMITED", true);
2395 * entity.limited;
2396 */
2397 hasPerm(user: User, permission: string | number, exact?: boolean): boolean;
2398 /**
2399 * Test whether a given User has permission to perform some action on this Entity
2400 * @alias Entity.can
2401 */
2402 can(user: any, action: any): any;
2403 /**
2404 * Test for whether this Entity can be owned by any non-gamemaster player.
2405 * @return {boolean}
2406 */
2407 get hasPlayerOwner(): boolean;
2408 /**
2409 * Entity-specific actions that should occur when the Entity is first created
2410 * @private
2411 */
2412 _onCreate(data: any, options: any, userId: any): void;
2413 /**
2414 * Entity-specific actions that should occur when the Entity is updated
2415 * @private
2416 */
2417 _onUpdate(data: any, options: any, userId: any): void;
2418 /**
2419 * Update the current Entity using provided input data.
2420 * Data must be provided as a single object which updates the Entity data.
2421 * @see {Entity.update}
2422 *
2423 * @param {Data} data A Data object which updates the Entity
2424 * @param {Options} options Additional options which customize the update workflow
2425 * @return {Promise<Entity>} The updated Entity
2426 */
2427 update(
2428 data: {
2429 string: any;
2430 any: any;
2431 },
2432 options?: {
2433 string: any;
2434 any: any;
2435 }
2436 ): Promise<Entity>;
2437 /**
2438 * Entity-specific actions that should occur when the Entity is deleted
2439 * @private
2440 */
2441 _onDelete(options: any, userId: any): void;
2442 /**
2443 * Delete the current Entity.
2444 * @see {Entity.delete}
2445
2446 * @param {Options} options Options which customize the deletion workflow
2447 * @return {Promise<Entity>} The deleted Entity
2448 */
2449 delete(options?: { string: any; any: any }): Promise<Entity>;
2450 /**
2451 * Get an Embedded Entity by it's id from a named collection in the parent Entity.
2452 *
2453 * @param {string} embeddedName The name of the Embedded Entity type to retrieve
2454 * @param {string} id The numeric ID of the child to retrieve
2455 * @param {boolean} strict Throw an Error if the requested id does not exist, otherwise return null. Default false.
2456 * @return {Object|null} Retrieved data for the requested child, or null
2457 */
2458 getEmbeddedEntity(embeddedName: string, id: string, { strict }?: boolean): any;
2459 /**
2460 * Create one or multiple EmbeddedEntities within this parent Entity.
2461 * Data may be provided as a single Object to create one EmbeddedEntity or as an Array of Objects to create many.
2462 * Entities may be temporary (unsaved to the database) by passing the temporary option as true.
2463 *
2464 * @param {string} embeddedName The name of the Embedded Entity class to create
2465 * @param {Data|Data[]} data A Data object or an Array of Data objects to create
2466 * @param {Options} options Additional creation options which modify the request
2467 * @param {boolean} [options.temporary] Create a temporary entity which is not saved to the world database. Default is false.
2468 * @param {boolean} [options.renderSheet] Display the sheet for each created Embedded Entities once created.
2469 *
2470 * @return {Promise<Data|Data[]>} A Promise which resolves to the created embedded Data once the creation request is successful
2471 *
2472 * @example
2473 * const actor = game.actors.get("dfv934kj23lk6h9k");
2474 * const data = {name: "Magic Sword", type: "weapon", img: "path/to/icon.png"};
2475 * const created = await actor.createEmbeddedEntity("OwnedItem", data); // Returns one EmbeddedEntity, saved to the Actor
2476 * const temp = await actor.createEmbeddedEntity("OwnedItem", data, {temporary: true}); // Not saved to the Actor
2477 *
2478 * @example
2479 * const actor = game.actors.get("dfv934kj23lk6h9k");
2480 * const data = [{name: "Mace of Crushing", type: "weapon"}, {name: "Shield of Defense", type: "armor"}];
2481 * const created = await actor.createEmbeddedEntity("OwnedItem", data); // Returns an Array of EmbeddedEntities, saved to the Actor
2482 * const temp = await actor.createEmbeddedEntity("OwnedItem", data, {temporary: true}); // Not saved to the Actor
2483 */
2484 createEmbeddedEntity(
2485 embeddedName: string,
2486 data:
2487 | {
2488 string: any;
2489 any: any;
2490 }
2491 | {
2492 string: any;
2493 any: any;
2494 }[],
2495 options?: {
2496 string: any;
2497 any: any;
2498 }
2499 ): Promise<
2500 | {
2501 string: any;
2502 any: any;
2503 }
2504 | {
2505 string: any;
2506 any: any;
2507 }[]
2508 >;
2509 /**
2510 * Handle Embedded Entity creation within this Entity with specific callback steps.
2511 * This function is triggered once per EmbeddedEntity which is updated.
2512 * It therefore may run multiple times per creation workflow.
2513 * Any steps defined here should run on a per-EmbeddedEntity basis.
2514 * Steps that should run once for the whole batch should go in _onModifyEmbeddedEntity()
2515 * @private
2516 */
2517 _onCreateEmbeddedEntity(embeddedName: any, child: any, options: any, userId: any): void;
2518 /**
2519 * Update one or multiple existing entities using provided input data.
2520 * Data may be provided as a single object to update one Entity, or as an Array of Objects.
2521 * @static
2522 *
2523 * @param {string} embeddedName The name of the Embedded Entity class to create
2524 * @param {Data|Data[]} data A Data object or array of Data. Each element must contain the _id of an existing Entity.
2525 * @param {Options} options Additional options which customize the update workflow
2526 * @param {boolean} [options.diff] Difference the provided data against the current to eliminate unnecessary changes.
2527 *
2528 * @return {Promise<Entity|Entity[]>} The updated Entity or array of Entities
2529 *
2530 * @example
2531 * const actor = game.actors.get("dfv934kj23lk6h9k");
2532 * const item = actor.data.items.find(i => i.name === "Magic Sword");
2533 * const update = {_id: item._id, name: "Magic Sword +1"};
2534 * const updated = await actor.updateEmbeddedEntity("OwnedItem", update); // Updates one EmbeddedEntity
2535 *
2536 * @example
2537 * const actor = game.actors.get("dfv934kj23lk6h9k");
2538 * const weapons = actor.data.items.filter(i => i.type === "weapon");
2539 * const updates = weapons.map(i => {
2540 * return {_id: i._id, name: i.name + "+1"};
2541 * }
2542 * const updated = await actor.createEmbeddedEntity("OwnedItem", updates); // Updates multiple EmbeddedEntity objects
2543 */
2544 updateEmbeddedEntity(
2545 embeddedName: string,
2546 data:
2547 | {
2548 string: any;
2549 any: any;
2550 }
2551 | {
2552 string: any;
2553 any: any;
2554 }[],
2555 options?: {
2556 string: any;
2557 any: any;
2558 }
2559 ): Promise<Entity | Entity[]>;
2560 /**
2561 * Handle Embedded Entity updates within this Entity with specific callback steps.
2562 * This function is triggered once per EmbeddedEntity which is updated.
2563 * It therefore may run multiple times per creation workflow.
2564 * Any steps defined here should run on a per-EmbeddedEntity basis.
2565 * Steps that should run once for the whole batch should go in _onModifyEmbeddedEntity()
2566 * @private
2567 */
2568 _onUpdateEmbeddedEntity(embeddedName: any, child: any, updateData: any, options: any, userId: any): void;
2569 /**
2570 * Delete one or multiple existing EmbeddedEntity objects using provided input data.
2571 * Data may be provided as a single id to delete one object or as an Array of string ids.
2572 * @static
2573 *
2574 * @param {string} embeddedName The name of the Embedded Entity class to create
2575 * @param {string|string[]} data A Data object or array of Data. Each element must contain the _id of an existing Entity.
2576 * @param {Options} options Additional options which customize the update workflow
2577
2578 * @return {Promise<Data|Data[]>} The deleted Embedded Entities
2579 *
2580 * @example
2581 * const actor = game.actors.get("dfv934kj23lk6h9k");
2582 * const item = actor.data.items.find(i => i.name === "Magic Sword");
2583 * const deleted = await actor.deleteEmbeddedEntity("OwnedItem", item._id); // Deletes one EmbeddedEntity
2584 *
2585 * @example
2586 * const actor = game.actors.get("dfv934kj23lk6h9k");
2587 * const weapons = actor.data.items.filter(i => i.type === "weapon");
2588 * const deletions = weapons.map(i => i._id);
2589 * const deleted = await actor.deleteEmbeddedEntity("OwnedItem", deletions); // Deletes multiple EmbeddedEntity objects
2590
2591 */
2592 deleteEmbeddedEntity(
2593 embeddedName: string,
2594 data: string | string[],
2595 options?: {
2596 string: any;
2597 any: any;
2598 }
2599 ): Promise<
2600 | {
2601 string: any;
2602 any: any;
2603 }
2604 | {
2605 string: any;
2606 any: any;
2607 }[]
2608 >;
2609 /**
2610 * Handle Embedded Entity deletion within this Entity with specific callback steps.
2611 * This function is triggered once per EmbeddedEntity which is updated.
2612 * It therefore may run multiple times per creation workflow.
2613 * Any steps defined here should run on a per-EmbeddedEntity basis.
2614 * Steps that should run once for the whole batch should go in _onModifyEmbeddedEntity()
2615 * @private
2616 */
2617 _onDeleteEmbeddedEntity(embeddedName: any, child: any, options: any, userId: any): void;
2618 /**
2619 * A generic helper since we take the same actions for every type of Embedded Entity update
2620 * Unlike the specific _onCreate, _onUpdate, and _onDelete methods this only runs once per updated batch
2621 * @private
2622 */
2623 _onModifyEmbeddedEntity(embeddedName: any, changes: any, options: any, userId: any, context?: {}): void;
2624 /**
2625 * Get the value of a "flag" for this Entity
2626 * See the setFlag method for more details on flags
2627 *
2628 * @param {string} scope The flag scope which namespaces the key
2629 * @param {string} key The flag key
2630 * @return {*} The flag value
2631 */
2632 getFlag(scope: string, key: string): any;
2633 /**
2634 * Assign a "flag" to this Entity.
2635 * Flags represent key-value type data which can be used to store flexible or arbitrary data required by either
2636 * the core software, game systems, or user-created modules.
2637 *
2638 * Each flag should be set using a scope which provides a namespace for the flag to help prevent collisions.
2639 *
2640 * Flags set by the core software use the "core" scope.
2641 * Flags set by game systems or modules should use the canonical name attribute for the module
2642 * Flags set by an individual world should "world" as the scope.
2643 *
2644 * Flag values can assume almost any data type. Setting a flag value to null will delete that flag.
2645 *
2646 * @param {string} scope The flag scope which namespaces the key
2647 * @param {string} key The flag key
2648 * @param {*} value The flag value
2649 *
2650 * @return {Promise.<Entity>} A Promise resolving to the updated Entity
2651 */
2652 setFlag(scope: string, key: string, value: any): Promise<Entity>;
2653 /**
2654 * Remove a flag assigned to the Entity
2655 * @param {string} scope The flag scope which namespaces the key
2656 * @param {string} key The flag key
2657 * @return {Promise} A Promise resolving to the updated Entity
2658 */
2659 unsetFlag(scope: string, key: string): Promise<any>;
2660 /**
2661 * Sort this Entity relative a target by providing the target, an Array of siblings and other options.
2662 * If the Entity has an rendered sheet, record the sort change as part of a form submission
2663 * See SortingHelper.performIntegerSort for more details
2664 */
2665 sortRelative({
2666 target,
2667 siblings,
2668 sortKey,
2669 sortBefore,
2670 updateData,
2671 }?: {
2672 target?: any;
2673 siblings?: any[];
2674 sortKey?: string;
2675 sortBefore?: boolean;
2676 updateData?: {};
2677 }): Promise<void>;
2678 /**
2679 * Clone an Entity, creating a new Entity using the current data as well as provided creation overrides.
2680 *
2681 * @param {Object} createData Additional data which overrides current Entity data at the time of creation
2682 * @param {Object} options Additional creation options passed to the Entity.create method
2683 * @returns {Promise.<Entity>} A Promise which resolves to the created clone Entity
2684 */
2685 clone(createData?: any, options?: any): Promise<Entity>;
2686 /**
2687 * Serializing an Entity should simply serialize it's inner data, not the entire instance
2688 * @return {Object}
2689 */
2690 toJSON(): any;
2691 /**
2692 * Export entity data to a JSON file which can be saved by the client and later imported into a different session
2693 */
2694 exportToJSON(): void;
2695 /**
2696 * Import data and update this entity
2697 * @param {string} json JSON data string
2698 * @return {Promise.<Entity>} The updated Entity
2699 */
2700 importFromJSON(json: string): Promise<Entity>;
2701 /**
2702 * Render an import dialog for updating the data related to this Entity through an exported JSON file
2703 * @return {Promise.<void>}
2704 */
2705 importFromJSONDialog(): Promise<void>;
2706 /**
2707 * Transform the Entity data to be stored in a Compendium pack.
2708 * Remove any features of the data which are world-specific.
2709 * This function is asynchronous in case any complex operations are required prior to exporting.
2710 *
2711 * @return {Object} A data object of cleaned data ready for compendium import
2712 */
2713 toCompendium(): any;
2714}
2715/**
2716 * A reusable storage concept which blends the functionality of an Array with the efficient key-based lookup of a Map.
2717 * This concept is reused throughout Foundry VTT where a collection of uniquely identified elements is required.
2718 * @extends {Map}
2719 */
2720declare class Collection extends Map<any, any> {
2721 constructor(entries: any);
2722 /**
2723 * When iterating over a Collection, we should iterate over its values instead of over its entries
2724 */
2725 '__@iterator'(): IterableIterator<any>;
2726 /**
2727 * Return an Array of all the entry values in the Collection
2728 * @return {V[]}
2729 */
2730 get entries(): any[];
2731 /**
2732 * Find an entry in the Map using an functional condition.
2733 * @see {Array#find}
2734 *
2735 * @param {Function} condition The functional condition to test
2736 * @return {V|null} The value, if found, otherwise null
2737 *
2738 * @example
2739 * let c = new Collection([["a", "A"], ["b", "B"], ["c", "C"]]);
2740 * let a = c.find(entry => entry === "A");
2741 */
2742 find(condition: Function): any;
2743 /**
2744 * Filter the Collection, returning an Array of entries which match a functional condition.
2745 * @see {Array#filter}
2746 * @param {Function} condition The functional condition to test
2747 * @return {V[]} An Array of matched values
2748 *
2749 * @example
2750 * let c = new Collection([["a", "AA"], ["b", "AB"], ["c", "CC"]]);
2751 * let hasA = c.filters(entry => entry.slice(0) === "A");
2752 */
2753 filter(condition: Function): any[];
2754 /**
2755 * Get an element from the Collection by its key.
2756 * @param {string} key The key of the entry to retrieve
2757 * @param {boolean} strict Throw an Error if the requested id does not exist, otherwise return null. Default false
2758 * @return {V|null} The retrieved entry value, if the key exists, otherwise null
2759 *
2760 * @example
2761 * let c = new Collection([["a", "A"], ["b", "B"], ["c", "C"]]);
2762 * c.get("a"); // "A"
2763 * c.get("d"); // null
2764 * c.get("d", {strict: true}); // throws Error
2765 */
2766 get(key: string, { strict }?: boolean): any;
2767 /**
2768 * Get an entry from the Collection by name.
2769 * Use of this method assumes that the objects stored in the collection have a "name" attribute.
2770 * @param {string} name The name of the entry to retrieve
2771 * @param {boolean} strict Throw an Error if the requested id does not exist, otherwise return null. Default false.
2772 * @return {Entity|null} The retrieved Entity, if one was found, otherwise null;
2773 */
2774 getName(name: string, { strict }?: boolean): Entity;
2775 /**
2776 * Transform each element of the Collection into a new form, returning an Array of transformed values
2777 * @param {Function} transformer The transformation function to apply to each entry value
2778 * @return {V[]} An Array of transformed values
2779 */
2780 map(transformer: Function): any[];
2781 /**
2782 * Reduce the Collection by applying an evaluator function and accumulating entries
2783 * @see {Array#reduce}
2784 * @param {Function} evaluator A function which mutates the accumulator each iteration
2785 * @param {any} initial An initial value which accumulates with each iteration
2786 * @return {any} The accumulated result
2787 *
2788 * @example
2789 * let c = new Collection([["a", "A"], ["b", "B"], ["c", "C"]]);
2790 * let letters = c.reduce((s, l) => {
2791 * return s + l;
2792 * }, ""); // "ABC"
2793 */
2794 reduce(evaluator: Function, initial: any): any;
2795 set(key: any, value: any): Collection;
2796}
2797/**
2798 * An Active Effect instance within a parent Actor or Item.
2799 * @see {@link Actor#effects}
2800 * @see {@link Item#effects} *
2801 * @typedef {{key: string, value: *, mode: number, priority: number}} ActiveEffectChange
2802 * @extends {EmbeddedEntity}
2803 */
2804declare class ActiveEffect extends EmbeddedEntity {
2805 /**
2806 * A factory method which creates an ActiveEffect instance using the configured class.
2807 * @param {...*} args Initialization arguments passed to the ActiveEffect constructor.
2808 * @return {ActiveEffect} The constructed ActiveEffect instance.
2809 */
2810 static create(...args: any[]): ActiveEffect;
2811 constructor(data: any, parent: any);
2812 /**
2813 * Describe whether the ActiveEffect has a temporary duration based on combat turns or rounds.
2814 * @type {boolean}
2815 */
2816 get isTemporary(): boolean;
2817 /**
2818 * Apply this ActiveEffect to a provided Actor.
2819 * @param {Actor} actor The Actor to whom this effect should be applied
2820 * @param {ActiveEffectChange} change The change data being applied
2821 * @return {*} The resulting applied value
2822 */
2823 apply(
2824 actor: Actor,
2825 change: {
2826 key: string;
2827 value: any;
2828 mode: number;
2829 priority: number;
2830 }
2831 ): any;
2832 /**
2833 * Apply an ActiveEffect that uses an ADD application mode.
2834 * @param {Actor} actor The Actor to whom this effect should be applied
2835 * @param {ActiveEffectChange} change The change data being applied
2836 * @return {*} The resulting applied value
2837 * @private
2838 */
2839 _applyAdd(
2840 actor: Actor,
2841 change: {
2842 key: string;
2843 value: any;
2844 mode: number;
2845 priority: number;
2846 }
2847 ): any;
2848 /**
2849 * Apply an ActiveEffect that uses a MULTIPLY application mode.
2850 * @param {Actor} actor The Actor to whom this effect should be applied
2851 * @param {ActiveEffectChange} change The change data being applied
2852 * @return {*} The resulting applied value
2853 * @private
2854 */
2855 _applyMultiply(
2856 actor: Actor,
2857 change: {
2858 key: string;
2859 value: any;
2860 mode: number;
2861 priority: number;
2862 }
2863 ): any;
2864 /**
2865 * Apply an ActiveEffect that uses an OVERRIDE, UPGRADE, or DOWNGRADE application mode.
2866 * @param {Actor} actor The Actor to whom this effect should be applied
2867 * @param {ActiveEffectChange} change The change data being applied
2868 * @return {*} The resulting applied value
2869 * @private
2870 */
2871 _applyOverride(
2872 actor: Actor,
2873 change: {
2874 key: string;
2875 value: any;
2876 mode: number;
2877 priority: number;
2878 }
2879 ): any;
2880 /**
2881 * Apply an ActiveEffect that uses a CUSTOM application mode.
2882 * @param {Actor} actor The Actor to whom this effect should be applied
2883 * @param {ActiveEffectChange} change The change data being applied
2884 * @return {*} The resulting applied value
2885 * @private
2886 */
2887 _applyCustom(
2888 actor: Actor,
2889 change: {
2890 key: string;
2891 value: any;
2892 mode: number;
2893 priority: number;
2894 }
2895 ): any;
2896 /**
2897 * A convenience method for updating an ActiveEffect instance in an parent Actor.
2898 * @see {@link Actor#updateEmbeddedEntity}
2899 * @param {Data} data Differential data with which to update the ActiveEffect.
2900 * @param {Options} options Configuration options which modify the request.
2901 * @return {Promise<Data>} The updated ActiveEffect data.
2902 */
2903 update(
2904 data: {
2905 string: any;
2906 any: any;
2907 },
2908 options: {
2909 string: any;
2910 any: any;
2911 }
2912 ): Promise<{
2913 string: any;
2914 any: any;
2915 }>;
2916 /**
2917 * A convenience method for deleting an ActiveEffect instance in an parent Actor.
2918 * @see {@link Actor#deleteEmbeddedEntity}
2919 * @param {Options} options Configuration options which modify the request.
2920 * @return {Promise<string>} The deleted ActiveEffect _id.
2921 */
2922 delete(options: { string: any; any: any }): Promise<string>;
2923}
2924/**
2925 * The Item entity.
2926 * This base Item refers primarily to items which are not currently owned.
2927 * @type {Entity}
2928 */
2929declare class Item extends Entity {
2930 /** @override */
2931 static get config(): {
2932 baseEntity: typeof Item;
2933 collection: any;
2934 embeddedEntities: {
2935 ActiveEffect: string;
2936 };
2937 label: string;
2938 permissions: {
2939 create: string;
2940 };
2941 };
2942 /**
2943 * A convenience constructor method to create an Item instance which is owned by an Actor
2944 * @param {Object} itemData
2945 * @param {Actor} actor
2946 */
2947 static createOwned(itemData: any, actor: Actor): any;
2948 constructor(data: any, options: any);
2949 /** @override */
2950 prepareData(): void;
2951 effects: Collection;
2952 /**
2953 * Prepare a Collection of ActiveEffect instances which belong to this Item.
2954 * @param {object[]} effects The raw array of active effect objects
2955 * @return {Collection} The active effects collection
2956 * @private
2957 */
2958 _prepareActiveEffects(effects: any[]): Collection;
2959 /**
2960 * A convenience reference to the Actor entity which owns this item, if any
2961 * @type {Actor|null}
2962 */
2963 get actor(): Actor;
2964 /**
2965 * A convenience reference to the image path (data.img) used to represent this Item
2966 * @type {string}
2967 */
2968 get img(): string;
2969 /**
2970 * Return an array of the Active Effect instances which originated from this Item.
2971 * If the Item is owned, the returned instances are the ActiveEffect instances which exist on the owning Actor.
2972 * If the Item is unowned, the returned instances are the ActiveEffect instances which exist on the Item itself.
2973 * @type {ActiveEffect[]}
2974 */
2975 get transferredEffects(): ActiveEffect[];
2976 /**
2977 * A convenience reference to the item type (data.type) of this Item
2978 * @type {string}
2979 */
2980 get type(): string;
2981 /**
2982 * A flag for whether the item is owned by an Actor entity
2983 * @return {boolean}
2984 */
2985 get isOwned(): boolean;
2986 /**
2987 * Override the standard permission test for Item entities as we need to apply a special check for owned items
2988 * OwnedItems have permission that the player has for the parent Actor.
2989 * @return {boolean} Whether or not the user has the permission for this item
2990 */
2991 hasPerm(...args: any[]): boolean;
2992 /** @override */
2993 update(data: any, options: any): Promise<Entity | Entity[]>;
2994 /** @override */
2995 delete(options: any): Promise<any>;
2996}
2997/**
2998 * The Macro entity which implements a triggered chat or script expression which can be quickly activated by the user.
2999 * All users have permission to create and use chat-based Macros, but users must be given special permission to use
3000 * script-based macros.
3001 *
3002 * @extends {Entity}
3003 *
3004 * @see {@link Macros} The EntityCollection of Macro entities
3005 * @see {@link MacroConfig} The Macro Configuration sheet
3006 * @see {@link Hotbar} The Hotbar interface application
3007 */
3008declare class Macro extends Entity {
3009 /** @override */
3010 static get config(): {
3011 baseEntity: typeof Macro;
3012 collection: any;
3013 embeddedEntities: {};
3014 label: string;
3015 };
3016 /** @override */
3017 static can(user: any, action: any, target: any): any;
3018 constructor(data: any, options: any);
3019 /**
3020 * Is the current User the author of this macro?
3021 * @type {boolean}
3022 */
3023 get isAuthor(): boolean;
3024 /**
3025 * Execute the Macro command
3026 * @return {Promise}
3027 */
3028 execute(): Promise<any>;
3029}
3030/**
3031 * The Scene Entity.
3032 * Scenes represent the locations and settings which Actors will explore within the World.
3033 * @extends {Entity}
3034 */
3035declare class Scene extends Entity {
3036 /** @extends {EntityCollection.config} */
3037 static get config(): {
3038 baseEntity: typeof Scene;
3039 collection: any;
3040 embeddedEntities: {
3041 AmbientLight: string;
3042 AmbientSound: string;
3043 Drawing: string;
3044 Note: string;
3045 MeasuredTemplate: string;
3046 Tile: string;
3047 Token: string;
3048 Wall: string;
3049 };
3050 label: string;
3051 };
3052 /** @override */
3053 static _handleCreateEmbeddedEntity({
3054 request,
3055 result,
3056 userId,
3057 }?: {
3058 request: any;
3059 result?: any[];
3060 userId: any;
3061 }): {
3062 string: any;
3063 any: any;
3064 }[];
3065 /** @override */
3066 static _handleUpdateEmbeddedEntity({
3067 request,
3068 result,
3069 userId,
3070 }?: {
3071 request: any;
3072 result?: any[];
3073 userId: any;
3074 }): {
3075 string: any;
3076 any: any;
3077 }[];
3078 /** @override */
3079 static _handleDeleteEmbeddedEntity({
3080 request,
3081 result,
3082 userId,
3083 }?: {
3084 request: any;
3085 result?: any[];
3086 userId: any;
3087 }): {
3088 string: any;
3089 any: any;
3090 }[];
3091 constructor(...args: any[]);
3092 /**
3093 * Track whether the scene is the active view
3094 * @type {boolean}
3095 */
3096 _view: boolean;
3097 /**
3098 * Track the viewed position of each scene (while in memory only, not persisted)
3099 * When switching back to a previously viewed scene, we can automatically pan to the previous position.
3100 * Object with keys: x, y, scale
3101 * @type {Object}
3102 */
3103 _viewPosition: Object;
3104 /**
3105 * A convenience accessor for the background image of the Scene
3106 * @type {string}
3107 */
3108 get img(): string;
3109 /**
3110 * A convenience accessor for whether the Scene is currently active
3111 * @type {boolean}
3112 */
3113 get active(): boolean;
3114 /**
3115 * A convenience accessor for whether the Scene is currently viewed
3116 * @type {boolean}
3117 */
3118 get isView(): boolean;
3119 /**
3120 * A reference to the JournalEntry entity associated with this Scene, or null
3121 * @return {JournalEntry|null}
3122 */
3123 get journal(): JournalEntry;
3124 /**
3125 * A reference to the Playlist entity for this Scene, or null
3126 * @type {Playlist|null}
3127 */
3128 get playlist(): Playlist;
3129 /**
3130 * Set this scene as the current view
3131 */
3132 view(): Promise<any>;
3133 /**
3134 * Set this scene as currently active
3135 * @return {Promise} A Promise which resolves to the current scene once it has been successfully activated
3136 */
3137 activate(): Promise<any>;
3138 /** @override */
3139 clone(createData?: {}, options?: {}): Promise<Entity>;
3140 /** @override */
3141 update(data: any, options?: {}): Promise<any>;
3142 /** @override */
3143 _onCreate(data: any, ...args: any[]): void;
3144 /** @override */
3145 _onUpdate(data: any, options: any, userId: any, context: any): any;
3146 /** @override */
3147 _onDelete(...args: any[]): void;
3148 /**
3149 * Handle Scene activation workflow if the active state is changed to true
3150 * @private
3151 */
3152 _onActivate(active: any): Promise<any>;
3153 /** @override */
3154 _onModifyEmbeddedEntity(...args: any[]): void;
3155 /** @override */
3156 toCompendium(): Promise<any>;
3157 /**
3158 * Create a 300px by 100px thumbnail image for this scene background
3159 * @param {string} [string|null] A background image to use for thumbnail creation, otherwise the current scene
3160 * background is used.
3161 * @param {number} [width] The desired thumbnail width. Default is 300px
3162 * @param {number} [height] The desired thumbnail height. Default is 100px;
3163 * @return {object} The created thumbnail data.
3164 */
3165 createThumbnail({ img, width, height }?: string): any;
3166}
3167/**
3168 * A generic helper for drawing a standard Control Icon
3169 * @type {PIXI.Container}
3170 */
3171declare class ControlIcon {
3172 constructor(
3173 {
3174 texture,
3175 size,
3176 borderColor,
3177 tint,
3178 }?: {
3179 texture: any;
3180 size?: number;
3181 borderColor?: number;
3182 tint?: any;
3183 },
3184 ...args: any[]
3185 );
3186 iconSrc: any;
3187 size: number;
3188 rect: number[];
3189 borderColor: number;
3190 tintColor: any;
3191 interactive: boolean;
3192 interactiveChildren: boolean;
3193 hitArea: any;
3194 bg: any;
3195 icon: any;
3196 border: any;
3197 draw(): Promise<ControlIcon>;
3198 texture: any;
3199 _onHoverIn(event: any): void;
3200 _onHoverOut(event: any): void;
3201}
3202/**
3203 * Handle mouse interaction events for a Canvas object.
3204 * There are three phases of events: hover, click, and drag
3205 *
3206 * Hover Events:
3207 * _handleMouseOver
3208 * action: hoverIn
3209 * _handleMouseOut
3210 * action: hoverOut
3211 *
3212 * Left Click and Double-Click
3213 * _handleMouseDown
3214 * action: clickLeft
3215 * action: clickLeft2
3216 *
3217 * Right Click and Double-Click
3218 * _handleRightDown
3219 * action: clickRight
3220 * action: clickRight2
3221 *
3222 * Drag and Drop
3223 * _handleMouseMove
3224 * action: dragLeftStart
3225 * action: dragLeftMove
3226 * action: dragRightStart
3227 * action: dragLeftMove
3228 * _handleMouseUp
3229 * action: dragLeftDrop
3230 * action: dragRightDrop
3231 * _handleDragCancel
3232 * action: dragLeftCancel
3233 * action: dragRightCancel
3234 */
3235declare class MouseInteractionManager {
3236 constructor(object: any, layer: any, permissions?: {}, callbacks?: {}, options?: {});
3237 object: any;
3238 layer: any;
3239 permissions: {};
3240 callbacks: {};
3241 options: {};
3242 /**
3243 * The current interaction state
3244 * @type {number}
3245 */
3246 state: number;
3247 /**
3248 * Bound handlers which can be added and removed
3249 * @type {{string: Function}}
3250 */
3251 handlers: {
3252 string: Function;
3253 };
3254 /**
3255 * The drag handling time
3256 * @type {number}
3257 */
3258 dragTime: number;
3259 /**
3260 * The time of the last left-click event
3261 * @type {number}
3262 */
3263 lcTime: number;
3264 /**
3265 * The time of the last right-click event
3266 * @type {number}
3267 */
3268 rcTime: number;
3269 /**
3270 * A flag for whether we are right-click dragging
3271 * @type {boolean}
3272 */
3273 _dragRight: boolean;
3274 /**
3275 * Get the target
3276 * @return {*}
3277 */
3278 get target(): any;
3279 /**
3280 * Activate interactivity for the handled object
3281 */
3282 activate(): MouseInteractionManager;
3283 /**
3284 * Test whether the current user has permission to perform a step of the workflow
3285 * @param {string} action The action being attempted
3286 * @param {Event} event The event being handled
3287 * @return {boolean} Can the action be performed?
3288 */
3289 can(action: string, event: Event): boolean;
3290 /**
3291 * Execute a callback function associated with a certain action in the workflow
3292 * @param {string} action The action being attempted
3293 * @param {Event} event The event being handled
3294 */
3295 callback(action: string, event: Event): any;
3296 /**
3297 * A reference to the possible interaction states which can be observed
3298 * @return {Object<string, number>}
3299 */
3300 get states(): {
3301 [x: string]: number;
3302 };
3303 /**
3304 * Activate a set of listeners which handle hover events on the target object
3305 * @private
3306 */
3307 _activateHoverEvents(): void;
3308 /**
3309 * Activate a new set of listeners for click events on the target object
3310 * @private
3311 */
3312 _activateClickEvents(): void;
3313 /**
3314 * Deactivate event listeners for click events on the target object
3315 * @private
3316 */
3317 _deactivateClickEvents(): void;
3318 /**
3319 * Activate events required for handling a drag-and-drop workflow
3320 * @private
3321 */
3322 _activateDragEvents(): void;
3323 /**
3324 * Deactivate events required for handling drag-and-drop workflow.
3325 * @private
3326 */
3327 _deactivateDragEvents(): void;
3328 /**
3329 * Handle mouse-over events which activate downstream listeners and do not stop propagation.
3330 * @private
3331 */
3332 _handleMouseOver(event: any): any;
3333 /**
3334 * Handle mouse-out events which terminate hover workflows and do not stop propagation.
3335 * @private
3336 */
3337 _handleMouseOut(event: any): any;
3338 /**
3339 * Handle mouse-down events which activate downstream listeners.
3340 * Stop further propagation only if the event is allowed by either single or double-click.
3341 * @private
3342 */
3343 _handleMouseDown(event: any): any;
3344 /**
3345 * Handle mouse-down which trigger a single left-click workflow.
3346 * @private
3347 */
3348 _handleClickLeft(event: any): void;
3349 /**
3350 * Handle mouse-down which trigger a single left-click workflow.
3351 * @private
3352 */
3353 _handleClickLeft2(event: any): any;
3354 /**
3355 * Handle right-click mouse-down events.
3356 * Stop further propagation only if the event is allowed by either single or double-click.
3357 * @private
3358 */
3359 _handleRightDown(event: any): any;
3360 /**
3361 * Handle single right-click actions.
3362 * @private
3363 */
3364 _handleClickRight(event: any): void;
3365 /**
3366 * Handle double right-click actions.
3367 * @private
3368 */
3369 _handleClickRight2(event: any): any;
3370 /**
3371 * Handle mouse movement during a drag workflow
3372 * @private
3373 */
3374 _handleMouseMove(event: any): any;
3375 /**
3376 * Handle the beginning of a new drag start workflow, moving all controlled objects on the layer
3377 * @private
3378 */
3379 _handleDragStart(event: any): any;
3380 /**
3381 * Handle the continuation of a drag workflow, moving all controlled objects on the layer
3382 * @private
3383 */
3384 _handleDragMove(event: any): any;
3385 /**
3386 * Handle mouse up events which may optionally conclude a drag workflow
3387 * @private
3388 */
3389 _handleMouseUp(event: any): void;
3390 /**
3391 * Handle the conclusion of a drag workflow, placing all dragged objects back on the layer
3392 * @private
3393 */
3394 _handleDragDrop(event: any): void;
3395 /**
3396 * Handle the cancellation of a drag workflow, resetting back to the original state
3397 * @param {PointerEvent} event
3398 * @private
3399 */
3400 _handleDragCancel(event: PointerEvent): void;
3401}
3402declare namespace MouseInteractionManager {
3403 export const INTERACTION_STATES: {
3404 [x: string]: number;
3405 };
3406}
3407/**
3408 * An abstract pattern for defining an Application responsible for updating some object using an HTML form
3409 *
3410 * A few critical assumptions:
3411 * 1) This application is used to only edit one object at a time
3412 * 2) The template used contains one (and only one) HTML form as it's outer-most element
3413 * 3) This abstract layer has no knowledge of what is being updated, so the implementation must define _updateObject
3414 *
3415 * @extends {Application}
3416 * @abstract
3417 * @interface
3418 *
3419 * @param object {*} Some object or entity which is the target to be updated.
3420 * @param [options] {Object} Additional options which modify the rendering of the sheet.
3421 */
3422declare class FormApplication extends Application {
3423 /**
3424 * Assign the default options which are supported by the entity edit sheet.
3425 * In addition to the default options object supported by the parent Application class, the Form Application
3426 * supports the following additional keys and values:
3427 *
3428 * @returns {Object} options The default options for this FormApplication class, see Application
3429 * @returns {boolean} options.closeOnSubmit Whether to automatically close the application when it's contained
3430 * form is submitted. Default is true.
3431 * @returns {boolean} options.submitOnChange Whether to automatically submit the contained HTML form when an input
3432 * or select element is changed. Default is false.
3433 * @returns {boolean} options.submitOnClose Whether to automatically submit the contained HTML form when the
3434 * application window is manually closed. Default is false.
3435 * @returns {boolean} options.editable Whether the application form is editable - if true, it's fields will
3436 * be unlocked and the form can be submitted. If false, all form fields
3437 * will be disabled and the form cannot be submitted. Default is true.
3438 */
3439 static get defaultOptions(): any;
3440 /**
3441 * @deprecated since 0.7.2
3442 * @see {@link FormDataExtended}
3443 */
3444 static processForm(formElement: any): any;
3445 constructor(object?: {}, options?: {});
3446 /**
3447 * The object target which we are using this form to modify
3448 * @type {*}
3449 */
3450 object: any;
3451 /**
3452 * A convenience reference to the form HTMLElement
3453 * @type {HTMLElement}
3454 */
3455 form: HTMLElement;
3456 /**
3457 * Keep track of any FilePicker instances which are associated with this form
3458 * The values of this Array are inner-objects with references to the FilePicker instances and other metadata
3459 * @type {FilePicker[]}
3460 */
3461 filepickers: FilePicker[];
3462 /**
3463 * Keep track of any mce editors which may be active as part of this form
3464 * The values of this Array are inner-objects with references to the MCE editor and other metadata
3465 * @type {Object}
3466 */
3467 editors: Object;
3468 /**
3469 * Is the Form Application currently editable?
3470 * @type {boolean}
3471 */
3472 get isEditable(): boolean;
3473 /** @override */
3474 getData(options?: {}): {
3475 object: any;
3476 options: any;
3477 title: string;
3478 };
3479 /** @override */
3480 _render(...args: any[]): Promise<void>;
3481 /** @override */
3482 _renderInner(...args: any[]): Promise<any>;
3483 /**
3484 * Activate the default set of listeners for the Entity sheet
3485 * These listeners handle basic stuff like form submission or updating images
3486 *
3487 * @param html {JQuery} The rendered template ready to have listeners attached
3488 */
3489 activateListeners(html: any): void;
3490 /**
3491 * If the form is not editable, disable its input fields
3492 * @param form {HTMLElement}
3493 * @private
3494 */
3495 _disableFields(form: HTMLElement): void;
3496 /**
3497 * Handle standard form submission steps
3498 * @param {Event} event The submit event which triggered this handler
3499 * @param {Object|null} [updateData] Additional specific data keys/values which override or extend the contents of
3500 * the parsed form. This can be used to update other flags or data fields at the
3501 * same time as processing a form submission to avoid multiple database operations.
3502 * @param {boolean} [preventClose] Override the standard behavior of whether to close the form on submit
3503 * @param {boolean} [preventRender] Prevent the application from re-rendering as a result of form submission
3504 * @returns {Promise} A promise which resolves to the validated update data
3505 * @private
3506 */
3507 _onSubmit(event: Event, { updateData, preventClose, preventRender }?: any): Promise<any>;
3508 _submitting: boolean;
3509 _state: any;
3510 /**
3511 * Get an object of update data used to update the form's target object
3512 * @param {object} updateData Additional data that should be merged with the form data
3513 * @return {object} The prepared update data
3514 * @private
3515 */
3516 _getSubmitData(updateData?: any): any;
3517 /**
3518 * Handle changes to an input element, submitting the form if options.submitOnChange is true.
3519 * Do not preventDefault in this handler as other interactions on the form may also be occurring.
3520 * @param {Event} event The initial change event
3521 * @private
3522 */
3523 _onChangeInput(event: Event): Promise<any>;
3524 /**
3525 * Handle the change of a color picker input which enters it's chosen value into a related input field
3526 * @private
3527 */
3528 _onChangeColorPicker(event: any): void;
3529 /**
3530 * Handle changes to a range type input by propagating those changes to the sibling range-value element
3531 * @param {Event} event The initial change event
3532 * @private
3533 */
3534 _onChangeRange(event: Event): void;
3535 /**
3536 * This method is called upon form submission after form data is validated
3537 * @param event {Event} The initial triggering submission event
3538 * @param formData {Object} The object of validated form data with which to update the object
3539 * @returns {Promise} A Promise which resolves once the update operation has completed
3540 * @abstract
3541 */
3542 _updateObject(event: Event, formData: any): Promise<any>;
3543 /**
3544 * Activate a named TinyMCE text editor
3545 * @param {string} name The named data field which the editor modifies.
3546 * @param {object} options TinyMCE initialization options passed to TextEditor.create
3547 * @param {string} initialContent Initial text content for the editor area.
3548 */
3549 activateEditor(name: string, options?: any, initialContent?: string): void;
3550 saveEditor(name: any): Promise<any>;
3551 /**
3552 * Activate a TinyMCE editor instance present within the form
3553 * @param div {HTMLElement}
3554 * @private
3555 */
3556 _activateEditor(div: HTMLElement): void;
3557 /**
3558 * Activate a FilePicker instance present within the form
3559 * @param button {HTMLElement}
3560 * @private
3561 */
3562 _activateFilePicker(button: HTMLElement): void;
3563 /**
3564 * Extend the logic applied when the application is closed to destroy any remaining MCE instances
3565 * This function returns a Promise which resolves once the window closing animation concludes
3566 *
3567 * @param {boolean} options.submit Explicitly specify whether or not to submit the form when closing. Default
3568 * behavior uses the value of FormApplication.options.submitOnClose.
3569 * @return {Promise}
3570 */
3571 close(options?: {}): Promise<any>;
3572 /**
3573 * Submit the contents of a Form Application, processing its content as defined by the Application
3574 * @param {Object|null} options Options passed to the _onSubmit event handler
3575 * @returns {FormApplication} Return a self-reference for convenient method chaining
3576 */
3577 submit(options: any): FormApplication;
3578 /**
3579 * @deprecated since 0.7.3
3580 * @see {@link FormApplication#activateEditor}
3581 */
3582 _createEditor(...args: any[]): any;
3583 /**
3584 * Render the Application by evaluating it's HTML template against the object of data provided by the getData method
3585 * If the Application is rendered as a pop-out window, wrap the contained HTML in an outer frame with window controls
3586 *
3587 * @param {boolean} force Add the rendered application to the DOM if it is not already present. If false, the
3588 * Application will only be re-rendered if it is already present.
3589 * @param {Object} options Additional rendering options which are applied to customize the way that the Application
3590 * is rendered in the DOM.
3591 *
3592 * @param {number} options.left The left positioning attribute
3593 * @param {number} options.top The top positioning attribute
3594 * @param {number} options.width The rendered width
3595 * @param {number} options.height The rendered height
3596 * @param {number} options.scale The rendered transformation scale
3597 * @param {boolean} options.log Whether to display a log message that the Application was rendered
3598 * @param {string} options.renderContext A context-providing string which suggests what event triggered the render
3599 * @param {*} options.renderData The data change which motivated the render request
3600 *
3601 */
3602 render(
3603 force?: boolean,
3604 options?: {
3605 left: number;
3606 top: number;
3607 width: number;
3608 height: number;
3609 scale: number;
3610 log: boolean;
3611 renderContext: string;
3612 renderData: any;
3613 }
3614 ): FormApplication;
3615}
3616/**
3617 * A PIXI.Rectangle where the width and height are always positive and the x and y are always the top-left
3618 */
3619declare class NormalizedRectangle {
3620 constructor(x: any, y: any, width: any, height: any);
3621}
3622/**
3623 * The base PlaceablesLayer subclass of CanvasLayer
3624 * @type {CanvasLayer}
3625 * @abstract
3626 * @interface
3627 */
3628declare class PlaceablesLayer extends CanvasLayer {
3629 /**
3630 * Customize behaviors of this PlaceablesLayer by modifying some behaviors at a class level
3631 * @static
3632 * @type {Object}
3633 *
3634 * @property {boolean} canDragCreate Does this layer support a mouse-drag workflow to create new objects?
3635 * @property {boolean} controllableObjects Can placeable objects in this layer be controlled?
3636 * @property {boolean} rotatableObjects Can placeable objects in this layer be rotated?
3637 * @property {boolean} snapToGrid Do objects in this layer snap to the grid
3638 * @property {number} gridPrecision At what numeric grid precision do objects snap?
3639 */
3640 static get layerOptions(): any;
3641 /**
3642 * Return a reference to the active instance of this canvas layer
3643 * @static
3644 * @type {PlaceablesLayer}
3645 */
3646 static get instance(): PlaceablesLayer;
3647 /**
3648 * Define the named Array within Scene.data containing the placeable objects displayed in this layer
3649 * @static
3650 * @type {string}
3651 */
3652 static get dataArray(): string;
3653 /**
3654 * Define a Container implementation used to render placeable objects contained in this layer
3655 * @static
3656 * @type {PIXI.Container}
3657 */
3658 static get placeableClass(): any;
3659 /**
3660 * Placeable Layer Objects
3661 * @type {PIXI.Container}
3662 */
3663 objects: PIXI.Container;
3664 /**
3665 * Preview Object Placement
3666 */
3667 preview: any;
3668 /**
3669 * Keep track of history so that CTRL+Z can undo changes
3670 * @type {object[]}
3671 */
3672 history: object[];
3673 /**
3674 * Track the PlaceableObject on this layer which is currently being hovered upon
3675 * @type {PlaceableObject}
3676 */
3677 _hover: PlaceableObject;
3678 /**
3679 * Track the set of PlaceableObjects on this layer which are currently controlled by their id
3680 * @type {Object}
3681 */
3682 _controlled: Object;
3683 /**
3684 * Keep track of an object copied with CTRL+C which can be pasted later
3685 * @type {object[]}
3686 */
3687 _copy: object[];
3688 /**
3689 * PlaceableObject layer options
3690 * @type {Object}
3691 */
3692 options: Object;
3693 /**
3694 * A Quadtree which partitions and organizes Walls into quadrants for efficient target identification.
3695 * @type {Quadtree|null}
3696 */
3697 quadtree: Quadtree | null;
3698 /**
3699 * Return the precision relative to the Scene grid with which Placeable objects should be snapped
3700 * @return {number}
3701 */
3702 get gridPrecision(): number;
3703 /**
3704 * If objects on this PlaceableLayer have a HUD UI, provide a reference to its instance
3705 * @type {BasePlaceableHUD|null}
3706 */
3707 get hud(): BasePlaceableHUD;
3708 /**
3709 * A convenience method for accessing the placeable object instances contained in this layer
3710 * @type {PlaceableObject[]}
3711 */
3712 get placeables(): PlaceableObject[];
3713 /**
3714 * An Array of placeable objects in this layer which have the _controlled attribute
3715 * @return {Array.<PlaceableObject>}
3716 */
3717 get controlled(): PlaceableObject[];
3718 /** @override */
3719 draw(): Promise<[any, any, any, any, any, any, any, any, any, any]>;
3720 /**
3721 * Draw a single placeable object
3722 * @return {PlaceableObject}
3723 */
3724 createObject(data: any): PlaceableObject;
3725 /** @override */
3726 tearDown(): Promise<void>;
3727 /**
3728 * Get a PlaceableObject contained in this layer by it's ID
3729 * @param {string} objectId The ID of the contained object to retrieve
3730 * @return {PlaceableObject} The object instance, or undefined
3731 */
3732 get(objectId: string): PlaceableObject;
3733 /**
3734 * Acquire control over all PlaceableObject instances which are visible and controllable within the layer.
3735 * @param {object} options Options passed to the control method of each object
3736 */
3737 controlAll(options?: any): void;
3738 /**
3739 * Release all controlled PlaceableObject instance from this layer.
3740 * @param {object} options Options passed to the release method of each object
3741 * @returns {number} The number of PlaceableObject instances which were released
3742 */
3743 releaseAll(options?: any): number;
3744 /**
3745 * Simultaneously rotate multiple PlaceableObjects using a provided angle or incremental.
3746 * This executes a single database operation using Scene.update.
3747 * If rotating only a single object, it is better to use the PlaceableObject.rotate instance method.
3748
3749 * @param {number} angle A target angle of rotation (in degrees) where zero faces "south"
3750 * @param {number} delta An incremental angle of rotation (in degrees)
3751 * @param {number} snap Snap the resulting angle to a multiple of some increment (in degrees)
3752 * @param {Array|Set} ids An Array or Set of object IDs to target for rotation
3753
3754 * @return {Promise} The resulting Promise from the Scene.update operation
3755 */
3756 rotateMany({ angle, delta, snap, ids }?: number): Promise<any>;
3757 /**
3758 * Simultaneously move multiple PlaceableObjects via keyboard movement offsets.
3759 * This executes a single database operation using Scene.update.
3760 * If moving only a single object, this will delegate to PlaceableObject.update for performance reasons.
3761 *
3762 * @param {number} dx The number of incremental grid units in the horizontal direction
3763 * @param {number} dy The number of incremental grid units in the vertical direction
3764 * @param {boolean} rotate Rotate the token to the keyboard direction instead of moving
3765 * @param {Array|Set} ids An Array or Set of object IDs to target for rotation
3766 *
3767 * @return {Promise} The resulting Promise from the Scene.update operation
3768 */
3769 moveMany({ dx, dy, rotate, ids }?: number): Promise<any>;
3770 /**
3771 * Undo a change to the objects in this layer
3772 * This method is typically activated using CTRL+Z while the layer is active
3773 * @return {Promise}
3774 */
3775 undoHistory(): Promise<any>;
3776 /**
3777 * Create multiple embedded entities in a parent Entity collection using an Array of provided data
3778 *
3779 * @param {object[]} data An Array of update data Objects which provide incremental data
3780 * @param {object} options Additional options which customize the update workflow
3781 *
3782 * @return {Promise<object[]>} A Promise which resolves to the returned socket response (if successful)
3783 */
3784 createMany(data: any[], options?: any): Promise<any[]>;
3785 /**
3786 * Update multiple embedded entities in a parent Entity collection using an Array of provided data
3787 *
3788 * @param {object[]} data An Array of update data Objects which provide incremental data
3789 * @param {object} options Additional options which customize the update workflow
3790 *
3791 * @return {Promise<object[]>} A Promise which resolves to the returned socket response (if successful)
3792 */
3793 updateMany(data: any[], options?: any): Promise<any[]>;
3794 /**
3795 * Simultaneously delete multiple PlaceableObjects.
3796 * This executes a single database operation using Scene.update.
3797 * If deleting only a single object, this will delegate to PlaceableObject.delete for performance reasons.
3798 *
3799 * @param {string[]} ids An Array of object IDs to target for deletion
3800 * @param {object} options Additional options which customize the update workflow
3801 *
3802 * @return {Promise<string[]>} A Promise which resolves to the returned socket response (if successful)
3803 */
3804 deleteMany(ids: string[], options?: any): Promise<string[]>;
3805 /**
3806 * A helper method to prompt for deletion of all PlaceableObject instances within the Scene
3807 * Renders a confirmation dialogue to confirm with the requester that all objects will be deleted
3808 */
3809 deleteAll(): any;
3810 /**
3811 * Record a new CRUD event in the history log so that it can be undone later
3812 * @param {string} type The event type (create, update, delete)
3813 * @param {Object} data The object data
3814 */
3815 storeHistory(type: string, data: any): void;
3816 /**
3817 * Copy currently controlled PlaceableObjects to a temporary Array, ready to paste back into the scene later
3818 * @returns {PlaceableObject[]} The Array of copied PlaceableObject instances
3819 */
3820 copyObjects(): PlaceableObject[];
3821 /**
3822 * Paste currently copied PlaceableObjects back to the layer by creating new copies
3823 * @param {Point} position The destination position for the copied data.
3824 * @param {boolean} [hidden] Paste data in a hidden state, if applicable. Default is false.
3825 * @param {boolean} [snap] Snap the resulting objects to the grid. Default is true.
3826 * @return {Promise.<PlaceableObject[]>} An Array of created PlaceableObject instances
3827 */
3828 pasteObjects(position: any, { hidden, snap }?: boolean): Promise<PlaceableObject[]>;
3829 /**
3830 * Select all PlaceableObject instances which fall within a coordinate rectangle.
3831 *
3832 * @param {number} x The top-left x-coordinate of the selection rectangle
3833 * @param {number} y The top-left y-coordinate of the selection rectangle
3834 * @param {number} width The width of the selection rectangle
3835 * @param {number} height The height of the selection rectangle
3836 * @param {Object} releaseOptions Optional arguments provided to any called release() method
3837 * @param {Object} controlOptions Optional arguments provided to any called control() method
3838 * @return {boolean} A boolean for whether the controlled set was changed in the operation
3839 */
3840 selectObjects({ x, y, width, height, releaseOptions, controlOptions }?: number): boolean;
3841 /**
3842 * Handle left mouse-click events which originate from the Canvas stage and are dispatched to this Layer.
3843 * @see {Canvas#_onClickLeft}
3844 */
3845 _onClickLeft(event: any): void;
3846 /**
3847 * Handle double left-click events which originate from the Canvas stage and are dispatched to this Layer.
3848 * @see {Canvas#_onClickLeft2}
3849 */
3850 _onClickLeft2(event: any): void;
3851 /**
3852 * Start a left-click drag workflow originating from the Canvas stage.
3853 * @see {Canvas#_onDragLeftStart}
3854 */
3855 _onDragLeftStart(event: any): void;
3856 /**
3857 * Continue a left-click drag workflow originating from the Canvas stage.
3858 * @see {Canvas#_onDragLeftMove}
3859 */
3860 _onDragLeftMove(event: any): void;
3861 /**
3862 * Conclude a left-click drag workflow originating from the Canvas stage.
3863 * @see {Canvas#_onDragLeftDrop}
3864 */
3865 _onDragLeftDrop(event: any): void;
3866 /**
3867 * Cancel a left-click drag workflow originating from the Canvas stage.
3868 * @see {Canvas#_onDragLeftDrop}
3869 */
3870 _onDragLeftCancel(event: any): void;
3871 /**
3872 * Handle right mouse-click events which originate from the Canvas stage and are dispatched to this Layer.
3873 * @see {Canvas#_onClickRight}
3874 */
3875 _onClickRight(event: any): void;
3876 /**
3877 * Handle mouse-wheel events at the PlaceableObjects layer level to rotate multiple objects at once.
3878 * This handler will rotate all controlled objects by some incremental angle.
3879 * @param {MouseWheelEvent} event The mousewheel event which originated the request
3880 */
3881 _onMouseWheel(event: WheelEvent): any;
3882 /**
3883 * Handle a DELETE keypress while a placeable object is hovered
3884 * @param {Event} event The delete key press event which triggered the request
3885 * @private
3886 */
3887 _onDeleteKey(event: Event): Promise<any>;
3888}
3889/**
3890 * This class provides an interface and API for conducting dice rolls.
3891 * The basic structure for a dice roll is a string formula and an object of data against which to parse it.
3892 *
3893 * @param formula {String} The string formula to parse
3894 * @param data {Object} The data object against which to parse attributes within the formula
3895 *
3896 * @see {@link Die}
3897 * @see {@link DicePool}
3898 *
3899 * @example
3900 * // Attack with advantage!
3901 * let r = new Roll("2d20kh + @prof + @strMod", {prof: 2, strMod: 4});
3902 *
3903 * // The parsed terms of the roll formula
3904 * console.log(r.terms); // [Die, +, 2, +, 4]
3905 *
3906 * // Execute the roll
3907 * r.evaluate();
3908 *
3909 * // The resulting equation after it was rolled
3910 * console.log(r.result); // 16 + 2 + 4
3911 *
3912 * // The total resulting from the roll
3913 * console.log(r.total); // 22
3914 */
3915declare class Roll {
3916 constructor(formula: any, data?: {});
3917 /**
3918 * The original provided data
3919 * @type {Object}
3920 */
3921 data: Object;
3922 /**
3923 * The identified terms of the Roll
3924 * @type {Array<Roll|DicePool|DiceTerm|number|string>}
3925 */
3926 terms: Array<Roll | DicePool | DiceTerm | number | string>;
3927 /**
3928 * The original formula before evaluation
3929 * @type {string}
3930 */
3931 _formula: string;
3932 /**
3933 * An array of inner terms which were rolled parenthetically
3934 * @type {DiceTerm[]}
3935 */
3936 _dice: DiceTerm[];
3937 /**
3938 * The evaluated results of the Roll
3939 * @type {Array<number|string>}
3940 */
3941 results: Array<number | string>;
3942 /**
3943 * An internal flag for whether the Roll object has been rolled
3944 * @type {boolean}
3945 * @private
3946 */
3947 _rolled: boolean;
3948 /**
3949 * Cache the evaluated total to avoid re-evaluating it
3950 * @type {number|null}
3951 * @private
3952 */
3953 _total: number | null;
3954 /**
3955 * Return an Array of the individual DiceTerm instances contained within this Roll.
3956 * @return {DiceTerm[]}
3957 */
3958 get dice(): DiceTerm[];
3959 /**
3960 * Return a standardized representation for the displayed formula associated with this Roll.
3961 * @return {string}
3962 */
3963 get formula(): string;
3964 /**
3965 * The resulting arithmetic expression after rolls have been evaluated
3966 * @return {string|null}
3967 */
3968 get result(): string;
3969 /**
3970 * Return the total result of the Roll expression if it has been evaluated, otherwise null
3971 * @type {number|null}
3972 */
3973 get total(): number;
3974 /**
3975 * Alter the Roll expression by adding or multiplying the number of dice which are rolled
3976 * @param {number} multiply A factor to multiply. Dice are multiplied before any additions.
3977 * @param {number} add A number of dice to add. Dice are added after multiplication.
3978 * @param {boolean} [multiplyNumeric] Apply multiplication factor to numeric scalar terms
3979 * @return {Roll} The altered Roll expression
3980 */
3981 alter(multiply: number, add: number, { multiplyNumeric }?: boolean): Roll;
3982 /**
3983 * Execute the Roll, replacing dice and evaluating the total result
3984 *
3985 * @param {boolean} [minimize] Produce the minimum possible result from the Roll instead of a random result.
3986 * @param {boolean} [maximize] Produce the maximum possible result from the Roll instead of a random result.
3987 *
3988 * @returns {Roll} The rolled Roll object, able to be chained into other methods
3989 *
3990 * @example
3991 * let r = new Roll("2d6 + 4 + 1d4");
3992 * r.evaluate();
3993 * console.log(r.result); // 5 + 4 + 2
3994 * console.log(r.total); // 11
3995 */
3996 evaluate({ minimize, maximize }?: boolean): Roll;
3997 /**
3998 * Clone the Roll instance, returning a new Roll instance that has not yet been evaluated
3999 * @return {Roll}
4000 */
4001 clone(): Roll;
4002 /**
4003 * Evaluate and return the Roll expression.
4004 * This function simply calls the evaluate() method but is maintained for backwards compatibility.
4005 * @return {Roll} The Roll instance, containing evaluated results and the rolled total.
4006 */
4007 roll(): Roll;
4008 /**
4009 * Create a new Roll object using the original provided formula and data
4010 * Each roll is immutable, so this method returns a new Roll instance using the same data.
4011 *
4012 * @return {Roll} A new Roll object, rolled using the same formula and data
4013 */
4014 reroll(): Roll;
4015 /**
4016 * Split a provided Roll formula to identify it's component terms.
4017 * Some terms are very granular, like a Number of an arithmetic operator
4018 * Other terms are very coarse like an entire inner Roll from a parenthetical expression.
4019 * As a general rule, this function should return an Array of terms which are ready to be evaluated immediately.
4020 * Some terms may require recursive evaluation.
4021 * @private
4022 *
4023 * @param {string} formula The formula to parse
4024 * @return {Array<Roll|DicePool|DiceTerm|number|string>} An array of identified terms
4025 */
4026 _identifyTerms(formula: string): (string | number | Roll | DicePool | DiceTerm)[];
4027 /**
4028 * Prepare the data structure used for the Roll.
4029 * This is factored out to allow for custom Roll classes to do special data preparation using provided input.
4030 * @param {object} data Provided roll data
4031 * @private
4032 */
4033 _prepareData(data: any): any;
4034 /**
4035 * Identify and split a formula into separate terms by arithmetic terms
4036 * @private
4037 */
4038 _splitDiceTerms(formula: any): any;
4039 /**
4040 * Identify and split a formula into separate terms by parenthetical expressions
4041 * @private
4042 */
4043 _splitParentheticalTerms(formula: any): any;
4044 /**
4045 * Identify and split a formula into separate terms by curly braces which represent pooled expressions
4046 * @private
4047 */
4048 _splitPooledTerms(formula: any): any;
4049 /**
4050 * Safely evaluate a formulaic expression using a Proxy environment which is allowed access to Math commands
4051 * @param {string} expression The formula expression to evaluate
4052 * @return {number} The returned numeric result
4053 * @private
4054 */
4055 _safeEval(expression: string): number;
4056 /**
4057 * Render the tooltip HTML for a Roll instance
4058 * @return {Promise<HTMLElement>}
4059 */
4060 getTooltip(): Promise<HTMLElement>;
4061 /**
4062 * Render a Roll instance to HTML
4063 * @param chatOptions {Object} An object configuring the behavior of the resulting chat message.
4064 * @return {Promise.<HTMLElement>} A Promise which resolves to the rendered HTML
4065 */
4066 render(chatOptions?: any): Promise<HTMLElement>;
4067 /**
4068 * Transform a Roll instance into a ChatMessage, displaying the roll result.
4069 * This function can either create the ChatMessage directly, or return the data object that will be used to create.
4070 *
4071 * @param {Object} messageData The data object to use when creating the message
4072 * @param {string|null} [rollMode=null] The template roll mode to use for the message from CONFIG.Dice.rollModes
4073 * @param {boolean} [create=true] Whether to automatically create the chat message, or only return the prepared
4074 * chatData object.
4075 * @return {Promise|Object} A promise which resolves to the created ChatMessage entity, if create is true
4076 * or the Object of prepared chatData otherwise.
4077 */
4078 toMessage(messageData?: any, { rollMode, create }?: string): any;
4079 /**
4080 * Represent the data of the Roll as an object suitable for JSON serialization.
4081 * @return {Object} Structured data which can be serialized into JSON
4082 */
4083 toJSON(): any;
4084 /**
4085 * @deprecated since 0.7.0
4086 * @see {@link Roll#terms}
4087 */
4088 get parts(): (string | number | Roll | DicePool | DiceTerm)[];
4089}
4090declare namespace Roll {
4091 export const ARITHMETIC: string[];
4092 export const MATH_PROXY: Math;
4093 export const PARENTHETICAL_RGX: RegExp;
4094 export const CHAT_TEMPLATE: string;
4095 export const TOOLTIP_TEMPLATE: string;
4096}
4097/**
4098 * The standard application window that is rendered for a large variety of UI elements in Foundry VTT.
4099 * @interface
4100 *
4101 * @param {Object} options Configuration options which control how the application is rendered.
4102 * Application subclasses may add additional supported options, but the
4103 * following configurations are supported for all Applications. The values
4104 * passed to the constructor are combined with the defaultOptions defined
4105 * at the class level.
4106 * @param {string} options.baseApplication A named "base application" which generates an additional hook
4107 * @param {number} options.width The default pixel width for the rendered HTML
4108 * @param {number} options.height The default pixel height for the rendered HTML
4109 * @param {number} options.top The default offset-top position for the rendered HTML
4110 * @param {number} options.left The default offset-left position for the rendered HTML
4111 * @param {boolean} options.popOut Whether to display the application as a pop-out container
4112 * @param {boolean} options.minimizable Whether the rendered application can be minimized (popOut only)
4113 * @param {boolean} options.resizable Whether the rendered application can be drag-resized (popOut only)
4114 * @param {string} options.id The default CSS id to assign to the rendered HTML
4115 * @param {Array.<string>} options.classes An array of CSS string classes to apply to the rendered HTML
4116 * @param {string} options.title A default window title string (popOut only)
4117 * @param {string} options.template The default HTML template path to render for this Application
4118 * @param {Array.<string>} options.scrollY A list of unique CSS selectors which target containers that should
4119 * have their vertical scroll positions preserved during a re-render.
4120 *
4121 * Hooks:
4122 * renderApplication
4123 * closeApplication
4124 * getApplicationHeaderButtons
4125 */
4126declare class Application {
4127 constructor(options?: {});
4128 /**
4129 * The options provided to this application upon initialization
4130 * @type {Object}
4131 */
4132 options: Object;
4133 /**
4134 * The application ID is a unique incrementing integer which is used to identify every application window
4135 * drawn by the VTT
4136 * @type {number}
4137 */
4138 appId: number;
4139 /**
4140 * An internal reference to the HTML element this application renders
4141 * @type {jQuery}
4142 */
4143 _element: jQuery;
4144 /**
4145 * Track the current position and dimensions of the Application UI
4146 * @type {Object}
4147 */
4148 position: Object;
4149 /**
4150 * DragDrop workflow handlers which are active for this Application
4151 * @type {DragDrop[]}
4152 */
4153 _dragDrop: DragDrop[];
4154 /**
4155 * Tab navigation handlers which are active for this Application
4156 * @type {Tabs[]}
4157 */
4158 _tabs: Tabs[];
4159 /**
4160 * SearchFilter handlers which are active for this Application
4161 * @type {SearchFilter[]}
4162 */
4163 _searchFilters: SearchFilter[];
4164 /**
4165 * Track whether the Application is currently minimized
4166 * @type {boolean}
4167 * @private
4168 */
4169 _minimized: boolean;
4170 /**
4171 * Track the render state of the Application
4172 * @see {Application.RENDER_STATES}
4173 * @type {number}
4174 * @private
4175 */
4176 _state: number;
4177 /**
4178 * Track the most recent scroll positions for any vertically scrolling containers
4179 * @type {Object|null}
4180 */
4181 _scrollPositions: Object | null;
4182 /**
4183 * Create drag-and-drop workflow handlers for this Application
4184 * @return {DragDrop[]} An array of DragDrop handlers
4185 * @private
4186 */
4187 _createDragDropHandlers(): DragDrop[];
4188 /**
4189 * Create tabbed navigation handlers for this Application
4190 * @return {Tabs[]} An array of Tabs handlers
4191 * @private
4192 */
4193 _createTabHandlers(): Tabs[];
4194 /**
4195 * Create search filter handlers for this Application
4196 * @return {SearchFilter[]} An array of SearchFilter handlers
4197 * @private
4198 */
4199 _createSearchFilters(): SearchFilter[];
4200 /**
4201 * Return the CSS application ID which uniquely references this UI element
4202 */
4203 get id(): any;
4204 /**
4205 * Return the active application element, if it currently exists in the DOM
4206 * @type {jQuery|HTMLElement}
4207 */
4208 get element(): HTMLElement | typeof jQuery;
4209 /**
4210 * The path to the HTML template file which should be used to render the inner content of the app
4211 * @type {string}
4212 */
4213 get template(): string;
4214 /**
4215 * Control the rendering style of the application. If popOut is true, the application is rendered in its own
4216 * wrapper window, otherwise only the inner app content is rendered
4217 * @type {boolean}
4218 */
4219 get popOut(): boolean;
4220 /**
4221 * Return a flag for whether the Application instance is currently rendered
4222 * @type {boolean}
4223 */
4224 get rendered(): boolean;
4225 /**
4226 * An Application window should define its own title definition logic which may be dynamic depending on its data
4227 * @type {string}
4228 */
4229 get title(): string;
4230 /**
4231 * An application should define the data object used to render its template.
4232 * This function may either return an Object directly, or a Promise which resolves to an Object
4233 * If undefined, the default implementation will return an empty object allowing only for rendering of static HTML
4234 *
4235 * @return {Object|Promise}
4236 */
4237 getData(options?: {}): any;
4238 /**
4239 * Render the Application by evaluating it's HTML template against the object of data provided by the getData method
4240 * If the Application is rendered as a pop-out window, wrap the contained HTML in an outer frame with window controls
4241 *
4242 * @param {boolean} force Add the rendered application to the DOM if it is not already present. If false, the
4243 * Application will only be re-rendered if it is already present.
4244 * @param {Object} options Additional rendering options which are applied to customize the way that the Application
4245 * is rendered in the DOM.
4246 *
4247 * @param {number} options.left The left positioning attribute
4248 * @param {number} options.top The top positioning attribute
4249 * @param {number} options.width The rendered width
4250 * @param {number} options.height The rendered height
4251 * @param {number} options.scale The rendered transformation scale
4252 * @param {boolean} options.log Whether to display a log message that the Application was rendered
4253 * @param {string} options.renderContext A context-providing string which suggests what event triggered the render
4254 * @param {*} options.renderData The data change which motivated the render request
4255 *
4256 */
4257 render(
4258 force?: boolean,
4259 options?: {
4260 left: number;
4261 top: number;
4262 width: number;
4263 height: number;
4264 scale: number;
4265 log: boolean;
4266 renderContext: string;
4267 renderData: any;
4268 }
4269 ): Application;
4270 /**
4271 * An asynchronous inner function which handles the rendering of the Application
4272 * @param {boolean} force Render and display the application even if it is not currently displayed.
4273 * @param {Object} options Provided rendering options, see the render function for details
4274 * @return {Promise}
4275 * @private
4276 */
4277 _render(force?: boolean, options?: any): Promise<any>;
4278 /**
4279 * Persist the scroll positions of containers within the app before re-rendering the content
4280 * @param {jQuery} html The HTML object being traversed
4281 * @param {string[]} selectors CSS selectors which designate elements to save
4282 * @private
4283 */
4284 _saveScrollPositions(html: typeof jQuery, selectors: string[]): void;
4285 /**
4286 * Restore the scroll positions of containers within the app after re-rendering the content
4287 * @param {jQuery} html The HTML object being traversed
4288 * @param {string[]} selectors CSS selectors which designate elements to restore
4289 * @private
4290 */
4291 _restoreScrollPositions(html: typeof jQuery, selectors: string[]): void;
4292 /**
4293 * Render the outer application wrapper
4294 * @return {Promise.<HTMLElement>} A promise resolving to the constructed jQuery object
4295 * @private
4296 */
4297 _renderOuter(options: any): Promise<HTMLElement>;
4298 /**
4299 * Render the inner application content
4300 * @param {Object} data The data used to render the inner template
4301 * @return {Promise.<jQuery>} A promise resolving to the constructed jQuery object
4302 * @private
4303 */
4304 _renderInner(data: any, options: any): Promise<typeof jQuery>;
4305 /**
4306 * Customize how inner HTML is replaced when the application is refreshed
4307 * @param {HTMLElement|jQuery} element The original HTML element
4308 * @param {HTMLElement|jQuery} html New updated HTML
4309 * @private
4310 */
4311 _replaceHTML(element: HTMLElement | typeof jQuery, html: HTMLElement | typeof jQuery, options: any): void;
4312 /**
4313 * Customize how a new HTML Application is added and first appears in the DOC
4314 * @param html {jQuery}
4315 * @private
4316 */
4317 _injectHTML(html: typeof jQuery, options: any): void;
4318 /**
4319 * Specify the set of config buttons which should appear in the Application header.
4320 * Buttons should be returned as an Array of objects.
4321 * The header buttons which are added to the application can be modified by the getApplicationHeaderButtons hook.
4322 * @typedef {{label: string, class: string, icon: string, onclick: Function|null}} ApplicationHeaderButton
4323 * @fires Application#hook:getApplicationHeaderButtons
4324 * @return {ApplicationHeaderButton[]}
4325 * @private
4326 */
4327 _getHeaderButtons(): {
4328 label: string;
4329 class: string;
4330 icon: string;
4331 onclick: Function;
4332 }[];
4333 /**
4334 * Once the HTML for an Application has been rendered, activate event listeners which provide interactivity for
4335 * the application
4336 * @param html {jQuery}
4337 */
4338 activateListeners(html: typeof jQuery): void;
4339 /**
4340 * Handle changes to the active tab in a configured Tabs controller
4341 * @param {MouseEvent} event A left click event
4342 * @param {Tabs} tabs The Tabs controller
4343 * @param {string} active The new active tab name
4344 * @private
4345 */
4346 _onChangeTab(event: MouseEvent, tabs: Tabs, active: string): void;
4347 /**
4348 * Handle changes to search filtering controllers which are bound to the Application
4349 * @param {KeyboardEvent} event The key-up event from keyboard input
4350 * @param {RegExp} query The regular expression to test against
4351 * @param {HTMLElement} html The HTML element which should be filtered
4352 * @private
4353 */
4354 _onSearchFilter(event: KeyboardEvent, query: RegExp, html: HTMLElement): void;
4355 /**
4356 * Define whether a user is able to begin a dragstart workflow for a given drag selector
4357 * @param {string} selector The candidate HTML selector for dragging
4358 * @return {boolean} Can the current user drag this selector?
4359 * @private
4360 */
4361 _canDragStart(selector: string): boolean;
4362 /**
4363 * Define whether a user is able to conclude a drag-and-drop workflow for a given drop selector
4364 * @param {string} selector The candidate HTML selector for the drop target
4365 * @return {boolean} Can the current user drop on this selector?
4366 * @private
4367 */
4368 _canDragDrop(selector: string): boolean;
4369 /**
4370 * Callback actions which occur at the beginning of a drag start workflow.
4371 * @param {DragEvent} event The originating DragEvent
4372 * @private
4373 */
4374 _onDragStart(event: DragEvent): void;
4375 /**
4376 * Callback actions which occur when a dragged element is over a drop target.
4377 * @param {DragEvent} event The originating DragEvent
4378 * @private
4379 */
4380 _onDragOver(event: DragEvent): void;
4381 /**
4382 * Callback actions which occur when a dragged element is dropped on a target.
4383 * @param {DragEvent} event The originating DragEvent
4384 * @private
4385 */
4386 _onDrop(event: DragEvent): void;
4387 /**
4388 * Bring the application to the top of the rendering stack
4389 */
4390 bringToTop(): void;
4391 /**
4392 * Close the application and un-register references to it within UI mappings
4393 * This function returns a Promise which resolves once the window closing animation concludes
4394 * @return {Promise}
4395 */
4396 close(): Promise<any>;
4397 /**
4398 * Minimize the pop-out window, collapsing it to a small tab
4399 * Take no action for applications which are not of the pop-out variety or apps which are already minimized
4400 * @return {Promise} A Promise which resolves to true once the minimization action has completed
4401 */
4402 minimize(): Promise<any>;
4403 /**
4404 * Maximize the pop-out window, expanding it to its original size
4405 * Take no action for applications which are not of the pop-out variety or are already maximized
4406 * @return {Promise} A Promise which resolves to true once the maximization action has completed
4407 */
4408 maximize(): Promise<any>;
4409 /**
4410 * Set the application position and store it's new location.
4411 *
4412 * @param {number|null} left The left offset position in pixels
4413 * @param {number|null} top The top offset position in pixels
4414 * @param {number|null} width The application width in pixels
4415 * @param {number|string|null} height The application height in pixels
4416 * @param {number|null} scale The application scale as a numeric factor where 1.0 is default
4417 *
4418 * @returns {{left: number, top: number, width: number, height: number, scale:number}}
4419 * The updated position object for the application containing the new values
4420 */
4421 setPosition({
4422 left,
4423 top,
4424 width,
4425 height,
4426 scale,
4427 }?: number): {
4428 left: number;
4429 top: number;
4430 width: number;
4431 height: number;
4432 scale: number;
4433 };
4434 /**
4435 * Handle application minimization behavior - collapsing content and reducing the size of the header
4436 * @param {Event} ev
4437 * @private
4438 */
4439 _onToggleMinimize(ev: Event): void;
4440 /**
4441 * Additional actions to take when the application window is resized
4442 * @param {Event} event
4443 * @private
4444 */
4445 _onResize(event: Event): void;
4446}
4447declare namespace Application {
4448 export namespace RENDER_STATES {
4449 export const CLOSING: number;
4450 export const CLOSED: number;
4451 export const NONE: number;
4452 export const RENDERING: number;
4453 export const RENDERED: number;
4454 export const ERROR: number;
4455 }
4456}
4457/**
4458 * The Compendium class provides an interface for interacting with compendium packs which are
4459 * collections of similar Entities which are stored outside of the world database but able to
4460 * be easily imported into an active session.
4461 *
4462 * When the game session is initialized, each available compendium pack is constructed and
4463 * added to the ``game.packs``.
4464 *
4465 * Each Compendium is distinctly referenced using its canonical "collection" name which is a
4466 * unique string that contains the package name which provides the compendium as well as the
4467 * name of the pack within that package. For example, in the DnD5e system, the compendium pack
4468 * which provides the spells available within the SRD has the collection name "dnd5e.spells".
4469 *
4470 * @type {Application}
4471 *
4472 * @param metadata {Object} The compendium metadata, an object provided by game.data
4473 * @param options {Object} Application rendering options
4474 *
4475 * @example
4476 * // Let's learn the collection names of all the compendium packs available within a game
4477 * game.packs.keys();
4478 *
4479 * // Suppose we are working with a particular pack named "dnd5e.spells"
4480 * const pack = game.packs.get("dnd5e.spells");
4481 *
4482 * // We can load the index of the pack which contains all entity IDs, names, and image icons
4483 * pack.getIndex().then(index => console.log(index));
4484 *
4485 * // We can find a specific entry in the compendium by its name
4486 * let entry = pack.index.find(e => e.name === "Acid Splash");
4487 *
4488 * // Given the entity ID of "Acid Splash" we can load the full Entity from the compendium
4489 * pack.getEntity(entry.id).then(spell => console.log(spell));
4490 *
4491 * @example
4492 * // We often may want to programmatically create new Compendium content
4493 * // Let's start by creating a custom spell as an Item instance
4494 * let itemData = {name: "Custom Death Ray", type: "Spell"};
4495 * let item = new Item(itemData);
4496 *
4497 * // Once we have an entity for our new Compendium entry we can import it, if the pack is unlocked
4498 * pack.importEntity(item);
4499 *
4500 * // When the entity is imported into the compendium it will be assigned a new ID, so let's find it
4501 * pack.getIndex().then(index => {
4502 * let entry = index.find(e => e.name === itemData.name));
4503 * console.log(entry);
4504 * });
4505 *
4506 * // If we decide to remove an entry from the compendium we can do that by the entry ID
4507 * pack.removeEntry(entry.id);
4508 */
4509declare class Compendium extends Application {
4510 constructor(metadata: any, options: any);
4511 /**
4512 * The compendium metadata which defines the compendium content and location
4513 * @type {Object}
4514 */
4515 metadata: Object;
4516 /**
4517 * Track whether the compendium pack is locked for editing
4518 * @type {boolean}
4519 */
4520 locked: boolean;
4521 /**
4522 * Track whether the compendium pack is private
4523 * @type {boolean}
4524 */
4525 private: boolean;
4526 /**
4527 * The most recently retrieved index of the Compendium content
4528 * This index is not guaranteed to be current - call getIndex() to reload the index
4529 * @type {object[]}
4530 */
4531 index: object[];
4532 /**
4533 * The canonical Compendium name - comprised of the originating package and the pack name
4534 * @return {string} The canonical collection name
4535 */
4536 get collection(): string;
4537 /**
4538 * The Entity type which is allowed to be stored in this collection
4539 * @type {string}
4540 */
4541 get entity(): string;
4542 /**
4543 * A reference to the Entity class object contained within this Compendium pack
4544 * @return {*}
4545 */
4546 get cls(): any;
4547 /** @override */
4548 getData(
4549 options: any
4550 ): Promise<{
4551 collection: string;
4552 cssClass: string;
4553 index: any;
4554 }>;
4555 /** @override */
4556 close(): Promise<void>;
4557 /**
4558 * Assign configuration metadata settings to the compendium pack
4559 * @param {Object} settings The object of compendium settings to define
4560 * @return {Promise} A Promise which resolves once the setting is updated
4561 */
4562 configure(settings?: any): Promise<any>;
4563 /**
4564 * Delete a world Compendium pack
4565 * This is only allowed for world-level packs by a GM user
4566 * @return {Promise.<Compendium>}
4567 */
4568 delete(): Promise<Compendium>;
4569 /**
4570 * Duplicate a compendium pack to the current World
4571 * @param label
4572 * @return {Promise<Compendium>}
4573 */
4574 duplicate({ label }?: { label: any }): Promise<Compendium>;
4575 /**
4576 * Get the Compendium index
4577 * Contains names and IDs of all data in the compendium
4578 *
4579 * @return {Promise} A Promise containing an index of all compendium entries
4580 */
4581 getIndex(): Promise<any>;
4582 /**
4583 * Get the complete set of content for this compendium, loading all entries in full
4584 * Returns a Promise that resolves to an Array of entries
4585 *
4586 * @return {Promise.<Array>}
4587 */
4588 getContent(): Promise<any[]>;
4589 /**
4590 * Get a single Compendium entry as an Object
4591 * @param {string} entryId The compendium entry ID to retrieve
4592 * @return {Promise.<Object|null>} A Promise containing the return entry data, or null
4593 */
4594 getEntry(entryId: string): Promise<any>;
4595 /**
4596 * Get a single Compendium entry as an Entity instance
4597 * @param {string} entryId The compendium entry ID to load and instantiate
4598 * @return {Promise.<Entity|null>} A Promise containing the returned Entity, if it exists, otherwise null
4599 */
4600 getEntity(entryId: string): Promise<Entity>;
4601 /**
4602 * Fully import the contents of a Compendium pack into a World folder.
4603 * @param {string|null} [folderId] An existing Folder _id to use.
4604 * @param {string} [folderName] A new Folder name to create.
4605 * @return {Promise<*>}
4606 */
4607 importAll({ folderId, folderName }?: string): Promise<any>;
4608 /**
4609 * Cast entry data to an Entity class
4610 * @param {Object} entryData
4611 * @private
4612 */
4613 _toEntity(entryData?: any): any;
4614 /**
4615 * Import a new Entity into a Compendium pack
4616 * @param {Entity} entity The Entity instance you wish to import
4617 * @return {Promise} A Promise which resolves to the created Entity once the operation is complete
4618 */
4619 importEntity(entity: Entity): Promise<any>;
4620 /**
4621 * Create a new Entity within this Compendium Pack using provided data
4622 * @param {Object} data Data with which to create the entry
4623 * @param {Options} options Additional options which modify the creation
4624 * @return {Promise} A Promise which resolves to the created Entity once the operation is complete
4625 */
4626 createEntity(
4627 data: any,
4628 options?: {
4629 string: any;
4630 any: any;
4631 }
4632 ): Promise<any>;
4633 /**
4634 * Update a single Compendium entry programmatically by providing new data with which to update
4635 * @param {Object} data The incremental update with which to update the Entity. Must contain the _id
4636 * @param {Object} options Additional options which modify the update request
4637 * @return {Promise} A Promise which resolves with the updated Entity once the operation is complete
4638 */
4639 updateEntity(data: any, options?: any): Promise<any>;
4640 /**
4641 * Delete a single Compendium entry by its provided _id
4642 * @param {string} id The entry ID to delete
4643 * @param {Object} options Additional options which modify the deletion request
4644 * @return {Promise} A Promise which resolves to the deleted entry ID once the operation is complete
4645 */
4646 deleteEntity(id: string, options?: any): Promise<any>;
4647 /**
4648 * Request that a Compendium pack be migrated to the latest System data template
4649 * @return {Promise.<Compendium>}
4650 */
4651 migrate(options: any): Promise<Compendium>;
4652 /**
4653 * Validate that the current user is able to modify content of this Compendium pack
4654 * @return {boolean}
4655 * @private
4656 */
4657 _assertUserCanModify({ requireGM, requireUnlocked }?: { requireGM?: boolean; requireUnlocked?: boolean }): boolean;
4658 /**
4659 * Register event listeners for Compendium directories
4660 * @private
4661 */
4662 activateListeners(html: any): void;
4663 /** @override */
4664 _onSearchFilter(event: any, query: any, html: any): void;
4665 /**
4666 * Handle opening a single compendium entry by invoking the configured entity class and its sheet
4667 * @param {string} entryId The compendium ID of the entry to display
4668 * @private
4669 */
4670 _onEntry(entryId: string): Promise<any>;
4671 /** @override */
4672 _canDragStart(selector: any): any;
4673 /** @override */
4674 _canDragDrop(selector: any): any;
4675 /** @override */
4676 _onDragStart(event: any): void;
4677 /**
4678 * Handle data being dropped into a Compendium pack
4679 * @private
4680 */
4681 _onDrop(event: any): Promise<any>;
4682 /**
4683 * Render the ContextMenu which applies to each compendium entry
4684 * @private
4685 */
4686 _contextMenu(html: any): void;
4687 /**
4688 * Render the Application by evaluating it's HTML template against the object of data provided by the getData method
4689 * If the Application is rendered as a pop-out window, wrap the contained HTML in an outer frame with window controls
4690 *
4691 * @param {boolean} force Add the rendered application to the DOM if it is not already present. If false, the
4692 * Application will only be re-rendered if it is already present.
4693 * @param {Object} options Additional rendering options which are applied to customize the way that the Application
4694 * is rendered in the DOM.
4695 *
4696 * @param {number} options.left The left positioning attribute
4697 * @param {number} options.top The top positioning attribute
4698 * @param {number} options.width The rendered width
4699 * @param {number} options.height The rendered height
4700 * @param {number} options.scale The rendered transformation scale
4701 * @param {boolean} options.log Whether to display a log message that the Application was rendered
4702 * @param {string} options.renderContext A context-providing string which suggests what event triggered the render
4703 * @param {*} options.renderData The data change which motivated the render request
4704 *
4705 */
4706 render(
4707 force?: boolean,
4708 options?: {
4709 left: number;
4710 top: number;
4711 width: number;
4712 height: number;
4713 scale: number;
4714 log: boolean;
4715 renderContext: string;
4716 renderData: any;
4717 }
4718 ): Compendium;
4719}
4720declare namespace Compendium {
4721 export const CONFIG_SETTING: string;
4722}
4723/**
4724 * Extend the FormApplication pattern to incorporate specific logic for viewing or editing Entity instances.
4725 * See the FormApplication documentation for more complete description of this interface.
4726 *
4727 * @extends {FormApplication}
4728 * @abstract
4729 * @interface
4730 *
4731 * @param {Entity} object An Entity which should be managed by this form sheet.
4732 * @param {Object} [options] Optional configuration parameters for how the form behaves.
4733 */
4734declare class BaseEntitySheet extends FormApplication {
4735 constructor(object: any, options: any);
4736 /**
4737 * A convenience accessor for the object property, which in the case of a BaseEntitySheet is an Entity instance.
4738 * @type {Entity}
4739 */
4740 get entity(): Entity;
4741 /** @override */
4742 render(force: any, options: any): void | BaseEntitySheet;
4743 /** @override */
4744 getData(
4745 options: any
4746 ): {
4747 cssClass: string;
4748 editable: boolean;
4749 entity: any;
4750 limited: boolean;
4751 options: any;
4752 owner: boolean;
4753 title: string;
4754 };
4755 /** @override */
4756 _updateObject(event: any, formData: any): Promise<Entity>;
4757}
4758/**
4759 * The Folder Entity
4760 * @extends {Entity}
4761 */
4762declare class Folder extends Entity {
4763 /** @override */
4764 static get config(): {
4765 baseEntity: typeof Folder;
4766 collection: any;
4767 embeddedEntities: {};
4768 label: string;
4769 };
4770 /**
4771 * Create a new Folder by rendering a dialog window to provide basic creation details
4772 * @param {object} data Initial data with which to populate the creation form
4773 * @param {object} options Initial positioning and sizing options for the dialog form
4774 * @return {FolderConfig} An active FolderConfig instance for creating the new Folder entity
4775 */
4776 static createDialog(data?: any, options?: any): FolderConfig;
4777 /** @override */
4778 static _handleDelete({ request, result, userId }: { request: any; result: any; userId: any }): any;
4779 constructor(data: any, options: any);
4780 /**
4781 * Return whether the folder is displayed in the sidebar to the current user
4782 * @type {boolean}
4783 */
4784 get displayed(): boolean;
4785 /**
4786 * Return whether the folder is currently expanded within the sidebar interface
4787 * @type {boolean}
4788 */
4789 get expanded(): boolean;
4790 /**
4791 * A reference to the parent Folder if one is set, otherwise null
4792 * @type {Folder|null}
4793 */
4794 get parent(): Folder;
4795 /**
4796 * Return the named Entity type for elements in this folder.
4797 * @return {string}
4798 */
4799 get type(): string;
4800 /**
4801 * A reference to the EntityCollection of Entities for this folder type.
4802 * @return {EntityCollection}
4803 */
4804 get collection(): EntityCollection;
4805 /**
4806 * Return an Array of the Entities which are contained within this Folder
4807 * @type {Entity[]}
4808 */
4809 get entities(): Entity[];
4810 /**
4811 * Export all Entities contained in this Folder to a given Compendium pack.
4812 * Optionally update existing Entities within the Pack by name, otherwise append all new entries.
4813 * @param {Compendium} pack A Compendium pack to which the entities will be exported
4814 * @param {boolean} updateByName Update existing entries in the Compendium pack, matching by name
4815 * @return {Promise<Compendium>} The updated Compendium Pack
4816 */
4817 exportToCompendium(pack: Compendium, { updateByName }?: boolean): Promise<Compendium>;
4818}
4819/**
4820 * An iterable container of Entity objects within the Foundry Virtual Tabletop framework.
4821 * Each Entity type has it's own subclass of EntityCollection, which defines the abstract interface.
4822 * @abstract
4823 * @interface
4824 * @extends {Collection}
4825 *
4826 * @param {object[]} data An Array of Entity data from which to create instances
4827 */
4828declare class EntityCollection extends Collection {
4829 /**
4830 * Return a reference to the singleton instance of this EntityCollection, or null if it has not yet been created.
4831 * @type {EntityCollection|null}
4832 */
4833 static get instance(): EntityCollection;
4834 constructor(data: any);
4835 /**
4836 * The source data is, itself, a mapping of IDs to data objects
4837 * @type {object[]}
4838 */
4839 _source: object[];
4840 /**
4841 * An Array of application references which will be automatically updated when the collection content changes
4842 * @type {Application[]}
4843 */
4844 apps: Application[];
4845 /**
4846 * Initialize the Map object and all its contained entities
4847 * @param {Entity[]} data
4848 * @private
4849 */
4850 _initialize(data: Entity[]): void;
4851 /**
4852 * An array of all the Entities in the EntityCollection.
4853 * @alias {Collection#entries}
4854 * @return {Entity[]}
4855 */
4856 get entities(): Entity[];
4857 /**
4858 * Render any Applications associated with this EntityCollection
4859 * @return {this} A reference to the rendered EntityCollection
4860 */
4861 render(...args: any[]): EntityCollection;
4862 /**
4863 * The EntityCollection name
4864 * @type {string}
4865 */
4866 get name(): string;
4867 /**
4868 * Return a reference to the SidebarDirectory application for this EntityCollection, or null if it has not yet been created.
4869 * @type {SidebarDirectory|null}
4870 */
4871 get directory(): SidebarDirectory;
4872 /**
4873 * Return a reference to the base Entity name which is contained within this EntityCollection.
4874 * @type {string}
4875 * @abstract
4876 */
4877 get entity(): string;
4878 /**
4879 * Return a reference to the Entity subclass which should be used when creating elements of this EntityCollection.
4880 * This should always be an explicit reference to the class which is used in this game to represent the entity,
4881 * and not the base implementation of that entity type.
4882 * @type {Entity}
4883 */
4884 get object(): Entity;
4885 /**
4886 * Add a new Entity to the EntityCollection, asserting that they are of the correct type.
4887 * @param entity {Entity} The entity instance to add to the collection
4888 */
4889 insert(entity: Entity): void;
4890 /**
4891 * Remove an Entity from the EntityCollection by its ID.
4892 * @param id {string} The entity ID which should be removed
4893 */
4894 remove(id: string): void;
4895 /**
4896 * Import an Entity from a compendium collection, adding it to the current World.
4897 * @param {string} collection The name of the pack from which to import
4898 * @param {string} entryId The ID of the compendium entry to import
4899 * @param {Object} [updateData] Optional additional data used to modify the imported Entity before it is created
4900 * @param {Object} [options] Optional arguments passed to the Entity.create method
4901 * @return {Promise.<Entity>} A Promise containing the imported Entity
4902 */
4903 importFromCollection(collection: string, entryId: string, updateData?: any, options?: any): Promise<Entity>;
4904 /**
4905 * Apply data transformations when importing an Entity from a Compendium pack
4906 * @param {Object} data The original Compendium entry data
4907 * @return {Object} The processed data ready for Entity creation
4908 */
4909 fromCompendium(data: any): any;
4910 set(key: any, value: any): EntityCollection;
4911}
4912/**
4913 * An abstract class implementation for an EmbeddedEntity object within a parent Entity
4914 * @abstract
4915 * @interface
4916 */
4917declare class EmbeddedEntity {
4918 constructor(data: any, parent: any);
4919 /**
4920 * The embedded entity data object
4921 * @type {Data}
4922 */
4923 data: Data;
4924 /**
4925 * The parent Entity to which this belongs
4926 * @type {Entity}
4927 */
4928 parent: Entity;
4929 /**
4930 * A reference to the _id attribute of the EmbeddedEntity data
4931 * @type {string}
4932 */
4933 get id(): string;
4934 /**
4935 * Data preparation steps taken by the EmbeddedEntity instance when it's underlying data changes
4936 */
4937 prepareData(): void;
4938}
4939/**
4940 * The JournalEntry class
4941 * @extends {Entity}
4942 */
4943declare class JournalEntry extends Entity {
4944 /** @override */
4945 static get config(): {
4946 baseEntity: typeof JournalEntry;
4947 collection: any;
4948 embeddedEntities: {};
4949 label: string;
4950 permissions: {
4951 create: string;
4952 };
4953 };
4954 constructor(data: any, options: any);
4955 /**
4956 * Return a reference to the Note instance for this JournalEntry in the current Scene, if any
4957 * @type {Note}
4958 */
4959 get sceneNote(): Note;
4960 /** @override */
4961 _onUpdate(data: any, ...args: any[]): void;
4962 /** @override */
4963 _onDelete(...args: any[]): void;
4964 /**
4965 * Show the JournalEntry to connected players.
4966 * By default the entry will only be shown to players who have permission to observe it.
4967 * If the parameter force is passed, the entry will be shown to all players regardless of normal permission.
4968 *
4969 * @param {string} mode Which JournalEntry mode to display? Default is text.
4970 * @param {boolean} force Display the entry to all players regardless of normal permissions
4971 * @return {Promise} A Promise that resolves back to the shown entry once the request is processed
4972 */
4973 show(mode?: string, force?: boolean): Promise<any>;
4974 /**
4975 * If the JournalEntry has a pinned note on the canvas, this method will animate to that note
4976 * The note will also be highlighted as if hovered upon by the mouse
4977 */
4978 panToNote({ scale, duration }?: { scale?: number; duration?: number }): void;
4979}
4980/**
4981 * The Playlist Entity.
4982 * Each Playlist is a collection of Sounds which are used to provide background music and sound effects.
4983 * @extends {Entity}
4984 */
4985declare class Playlist extends Entity {
4986 /** @override */
4987 static get config(): {
4988 baseEntity: typeof Playlist;
4989 collection: any;
4990 embeddedEntities: {
4991 PlaylistSound: string;
4992 };
4993 label: string;
4994 };
4995 constructor(...args: any[]);
4996 /**
4997 * Each sound which is played within the Playlist has a created Howl instance.
4998 * The keys of this object are the sound IDs and the values are the Howl instances.
4999 * @type {Object}
5000 */
5001 audio: Object;
5002 /**
5003 * Playlists may have a playback order which defines the sequence of Playlist Sounds
5004 * @type {string[]}
5005 */
5006 playbackOrder: string[];
5007 /**
5008 * Set up the Howl object by calling the core AudioHelper utility
5009 * @param {Object} sound The PlaylistSound for which to create an audio object
5010 * @return {Object} The created audio object
5011 * @private
5012 */
5013 _createAudio(sound: any): any;
5014 /**
5015 * This callback triggers whenever a sound concludes playback
5016 * Mark the concluded sound as no longer playing and possibly trigger playback for a subsequent sound depending on
5017 * the playlist mode.
5018 *
5019 * @param {string} soundId The sound ID of the track which is ending playback
5020 * @private
5021 */
5022 _onEnd(soundId: string): Promise<void>;
5023 /**
5024 * Generate a new playback order for the playlist.
5025 * Use a seed for randomization to (hopefully) guarantee that all clients generate the same random order.
5026 * The seed is based on the first 9 characters of the UTC datetime multiplied by the index order of the playlist.
5027 * @private
5028 */
5029 _getPlaybackOrder(): any[];
5030 /**
5031 * Get the next sound which should be played in the Playlist after the current sound completes
5032 * @param {string} soundId The ID of the currently playing sound
5033 * @return {Object} The sound data for the next sound to play
5034 * @private
5035 */
5036 _getNextSound(soundId: string): any;
5037 /**
5038 * An Array of the sound data contained within this Playlist entity
5039 * @type {object[]}
5040 */
5041 get sounds(): any[];
5042 /**
5043 * The playback mode for the Playlist instance
5044 * @type {number}
5045 */
5046 get mode(): number;
5047 /**
5048 * An indicator for whether any Sound within the Playlist is currently playing
5049 * @type {boolean}
5050 */
5051 get playing(): boolean;
5052 /**
5053 * Play (or stop) a single sound from the Playlist
5054 * @param sound {Object} The sound object to begin playback
5055 */
5056 playSound(sound: any): void;
5057 /**
5058 * Begin simultaneous playback for all sounds in the Playlist
5059 * @return {Promise} A Promise which resolves once the Playlist update is complete
5060 */
5061 playAll(): Promise<any>;
5062 /**
5063 * End playback for any/all currently playing sounds within the Playlist
5064 * @return {Promise} A Promise which resolves once the Playlist update is complete
5065 */
5066 stopAll(): Promise<any>;
5067 /**
5068 * Cycle the playlist mode
5069 * @return {Promise.<Playlist>} A promise which resolves to the updated Playlist instance
5070 */
5071 cycleMode(): Promise<Playlist>;
5072 /** @override */
5073 _onUpdate(response: any): void;
5074 /** @override */
5075 _onModifyEmbeddedEntity(...args: any[]): void;
5076 /** @override */
5077 toCompendium(): Promise<any>;
5078}
5079/**
5080 * The FilePicker application renders contents of the server-side public directory
5081 * This app allows for navigating and uploading files to the public path
5082 * @type {Application}
5083 */
5084declare class FilePicker extends Application {
5085 constructor(options?: {});
5086 /**
5087 * The full requested path given by the user
5088 * @type {string}
5089 */
5090 request: string;
5091 /**
5092 * The file sources which are available for browsing
5093 * @type {Object}
5094 */
5095 sources: Object;
5096 /**
5097 * Track the active source tab which is being browsed
5098 * @type {string}
5099 */
5100 activeSource: string;
5101 /**
5102 * The latest set of results browsed from the server
5103 * @type {Object}
5104 */
5105 results: Object;
5106 /**
5107 * The general file type which controls the set of extensions which will be accepted
5108 * @type {string}
5109 */
5110 type: string;
5111 /**
5112 * The target HTML element this file picker is bound to
5113 * @type {HTMLElement}
5114 */
5115 field: HTMLElement;
5116 /**
5117 * A button which controls the display of the picker UI
5118 * @type {HTMLElement}
5119 */
5120 button: HTMLElement;
5121 /**
5122 * The display mode of the FilePicker UI
5123 * @type {string}
5124 */
5125 displayMode: string;
5126 /**
5127 * The current set of file extensions which are being filtered upon
5128 * @type {string[]}
5129 */
5130 extensions: string[];
5131 _loaded: boolean;
5132 /**
5133 * Given a current file path, determine the directory it belongs to
5134 * @param {string} target The currently requested target path
5135 * @return {string[]} An array of the inferred source and target directory path
5136 */
5137 _inferCurrentDirectory(target: string): string[];
5138 /**
5139 * Get the valid file extensions for a given named file picker type
5140 * @param {string} type
5141 * @return {string[]}
5142 * @private
5143 */
5144 _getExtensions(type: string): string[];
5145 /** @override */
5146 get title(): any;
5147 /**
5148 * Return the source object for the currently active source
5149 * @return {Object}
5150 */
5151 get source(): any;
5152 /**
5153 * Return the target directory for the currently active source
5154 * @return {string}
5155 */
5156 get target(): string;
5157 /**
5158 * Return a flag for whether the current user is able to upload file content
5159 * @return {boolean}
5160 */
5161 get canUpload(): boolean;
5162 /** @override */
5163 getData(
5164 options: any
5165 ): Promise<{
5166 bucket: any;
5167 canGoBack: boolean;
5168 canUpload: boolean;
5169 canSelect: boolean;
5170 cssClass: string;
5171 dirs: any;
5172 displayMode: any;
5173 extensions: string[];
5174 files: any;
5175 isS3: boolean;
5176 noResults: boolean;
5177 request: any;
5178 source: any;
5179 sources: any;
5180 target: string;
5181 tileSize: any;
5182 user: any;
5183 }>;
5184 /**
5185 * Browse to a specific location for this FilePicker instance
5186 * @param {string} target The target within the currently active source location.
5187 * @param {Object} options Browsing options
5188 */
5189 browse(target: string, options?: any): Promise<any>;
5190 result: any;
5191 /**
5192 * Additional actions performed when the file-picker UI is rendered
5193 */
5194 render(force: any, options: any): any;
5195 /**
5196 * Activate listeners to handle user interactivity for the FilePicker UI
5197 * @param html
5198 */
5199 activateListeners(html: any): void;
5200 /**
5201 * Handle a click event to change the display mode of the File Picker
5202 * @param {MouseEvent} event The triggering click event
5203 * @private
5204 */
5205 _onChangeDisplayMode(event: MouseEvent): void;
5206 /** @override */
5207 _onChangeTab(event: any, tabs: any, active: any): void;
5208 /** @override */
5209 _canDragStart(selector: any): any;
5210 /** @override */
5211 _canDragDrop(selector: any): boolean;
5212 /** @override */
5213 _onDragStart(event: any): void;
5214 /** @override */
5215 _onDrop(event: any): Promise<any>;
5216 /**
5217 * Handle user submission of the address bar to request an explicit target
5218 * @param {KeyboardEvent} event The originating keydown event
5219 * @private
5220 */
5221 _onRequestTarget(event: KeyboardEvent): void;
5222 /**
5223 * Handle requests from the IntersectionObserver to lazily load an image file
5224 * @private
5225 */
5226 _onLazyLoadImages(...args: any[]): any;
5227 /**
5228 * Handle file or folder selection within the file picker
5229 * @param {Event} event The originating click event
5230 * @private
5231 */
5232 _onPick(event: Event): Promise<any>;
5233 /**
5234 * Handle backwards navigation of the fol6der structure
5235 * @private
5236 */
5237 _onClickDirectoryControl(event: any): any;
5238 /**
5239 * Present the user with a dialog to create a subdirectory within their currently browsed file storate location.
5240 * @private
5241 */
5242 _createDirectoryDialog(source: any): any;
5243 /**
5244 * Handle changes to the bucket selector
5245 * @private
5246 */
5247 _onChangeBucket(event: any): Promise<any>;
5248 /** @override */
5249 _onSearchFilter(event: any, query: any, html: any): void;
5250 /**
5251 * Handle file picker form submission
5252 * @param ev {Event}
5253 * @private
5254 */
5255 _onSubmit(ev: Event): any;
5256 /**
5257 * Handle file upload
5258 * @param ev
5259 * @private
5260 */
5261 _onUpload(ev: any): Promise<any>;
5262}
5263declare namespace FilePicker {
5264 export const LAST_BROWSED_DIRECTORY: string;
5265 export const LAST_TILE_SIZE: any;
5266 export const DISPLAY_MODES: {
5267 [x: string]: number;
5268 };
5269 export const S3_BUCKETS: Array | null;
5270}
5271/**
5272 * An abstract pattern for primary layers of the game canvas to implement
5273 * @type {PIXI.Container}
5274 * @abstract
5275 * @interface
5276 */
5277declare class CanvasLayer {
5278 /**
5279 * Track whether the canvas layer is currently active for interaction
5280 * @type {boolean}
5281 */
5282 _active: boolean;
5283 interactive: boolean;
5284 interactiveChildren: boolean;
5285 /**
5286 * The canonical name of the CanvasLayer
5287 * @return {string}
5288 */
5289 get name(): string;
5290 /**
5291 * Deconstruct data used in the current layer in preparation to re-draw the canvas
5292 */
5293 tearDown(): void;
5294 renderable: boolean;
5295 /**
5296 * Draw the canvas layer, rendering its internal components and returning a Promise
5297 * The Promise resolves to the drawn layer once its contents are successfully rendered.
5298 * @return {Promise<CanvasLayer>}
5299 */
5300 draw(): Promise<CanvasLayer>;
5301 width: any;
5302 height: any;
5303 hitArea: any;
5304 /**
5305 * Activate the CanvasLayer, deactivating other layers and marking this layer's children as interactive
5306 */
5307 activate(): void;
5308 /**
5309 * Deactivate the CanvasLayer, removing interactivity from its children
5310 */
5311 deactivate(): void;
5312}
5313/**
5314 * An abstract base class for displaying a heads-up-display interface bound to a Placeable Object on the canvas
5315 * @type {Application}
5316 * @abstract
5317 * @interface
5318 */
5319declare class BasePlaceableHUD extends Application {
5320 /** @override */
5321 static get defaultOptions(): any;
5322 constructor(...args: any[]);
5323 /**
5324 * Reference a PlaceableObject this HUD is currently bound to
5325 * @type {PlaceableObject}
5326 */
5327 object: PlaceableObject;
5328 /**
5329 * Convenience access for the canvas layer which this HUD modifies
5330 * @type {PlaceablesLayer}
5331 */
5332 get layer(): PlaceablesLayer;
5333 /**
5334 * Bind the HUD to a new PlaceableObject and display it
5335 * @param {PlaceableObject} object A PlaceableObject instance to which the HUD should be bound
5336 */
5337 bind(object: PlaceableObject): void;
5338 /**
5339 * Clear the HUD by fading out it's active HTML and recording the new display state
5340 */
5341 clear(): void;
5342 /** @override */
5343 _render(...args: any[]): Promise<void>;
5344 /** @override */
5345 getData(options: any): any;
5346 /** @override */
5347 setPosition({
5348 left,
5349 top,
5350 width,
5351 height,
5352 scale,
5353 }?: {
5354 left: any;
5355 top: any;
5356 width: any;
5357 height: any;
5358 scale: any;
5359 }): void;
5360 /** @override */
5361 activateListeners(html: any): void;
5362 /**
5363 * Toggle the visible state of all controlled objects in the Layer
5364 * @param {PointerEvent} event The originating click event
5365 * @private
5366 */
5367 _onToggleVisibility(event: PointerEvent): Promise<void>;
5368 /**
5369 * Toggle locked state of all controlled objects in the Layer
5370 * @param {PointerEvent} event The originating click event
5371 * @private
5372 */
5373 _onToggleLocked(event: PointerEvent): Promise<void>;
5374 /**
5375 * Handle sorting the z-order of the object
5376 * @param event
5377 * @param up
5378 * @return {Promise<void>}
5379 * @private
5380 */
5381 _onSort(up: any, event: any): Promise<void>;
5382 /**
5383 * Render the Application by evaluating it's HTML template against the object of data provided by the getData method
5384 * If the Application is rendered as a pop-out window, wrap the contained HTML in an outer frame with window controls
5385 *
5386 * @param {boolean} force Add the rendered application to the DOM if it is not already present. If false, the
5387 * Application will only be re-rendered if it is already present.
5388 * @param {Object} options Additional rendering options which are applied to customize the way that the Application
5389 * is rendered in the DOM.
5390 *
5391 * @param {number} options.left The left positioning attribute
5392 * @param {number} options.top The top positioning attribute
5393 * @param {number} options.width The rendered width
5394 * @param {number} options.height The rendered height
5395 * @param {number} options.scale The rendered transformation scale
5396 * @param {boolean} options.log Whether to display a log message that the Application was rendered
5397 * @param {string} options.renderContext A context-providing string which suggests what event triggered the render
5398 * @param {*} options.renderData The data change which motivated the render request
5399 *
5400 */
5401 render(
5402 force?: boolean,
5403 options?: {
5404 left: number;
5405 top: number;
5406 width: number;
5407 height: number;
5408 scale: number;
5409 log: boolean;
5410 renderContext: string;
5411 renderData: any;
5412 }
5413 ): BasePlaceableHUD;
5414}
5415declare class Array<T> {
5416 [n: number]: T;
5417 constructor(arrayLength?: number);
5418 constructor(arrayLength: number);
5419 constructor(...items: T_2[]);
5420 length: number;
5421 toString(): string;
5422 toLocaleString(): string;
5423 pop(): T;
5424 push(...items: T[]): number;
5425 concat(...items: ConcatArray<T>[]): T[];
5426 concat(...items: (T | ConcatArray<T>)[]): T[];
5427 join(separator?: string): string;
5428 reverse(): T[];
5429 shift(): T;
5430 slice(start?: number, end?: number): T[];
5431 sort(compareFn?: (a: T, b: T) => number): T[];
5432 splice(start: number, deleteCount?: number): T[];
5433 splice(start: number, deleteCount: number, ...items: T[]): T[];
5434 unshift(...items: T[]): number;
5435 indexOf(searchElement: T, fromIndex?: number): number;
5436 lastIndexOf(searchElement: T, fromIndex?: number): number;
5437 every(callbackfn: (value: T, index: number, array: T[]) => unknown, thisArg?: any): boolean;
5438 some(callbackfn: (value: T, index: number, array: T[]) => unknown, thisArg?: any): boolean;
5439 forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void;
5440 map<U>(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[];
5441 filter<S extends T>(callbackfn: (value: T, index: number, array: T[]) => value is S, thisArg?: any): S[];
5442 filter(callbackfn: (value: T, index: number, array: T[]) => unknown, thisArg?: any): T[];
5443 reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T): T;
5444 reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue: T): T;
5445 reduce<U_1>(
5446 callbackfn: (previousValue: U_1, currentValue: T, currentIndex: number, array: T[]) => U_1,
5447 initialValue: U_1
5448 ): U_1;
5449 reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T): T;
5450 reduceRight(
5451 callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T,
5452 initialValue: T
5453 ): T;
5454 reduceRight<U_2>(
5455 callbackfn: (previousValue: U_2, currentValue: T, currentIndex: number, array: T[]) => U_2,
5456 initialValue: U_2
5457 ): U_2;
5458 /**
5459 * An object of optional keys and values which configure the behavior of a function
5460 * @typedef {{string, any}} Options
5461 */
5462 find<S_1 extends T>(predicate: (this: void, value: T, index: number, obj: T[]) => value is S_1, thisArg?: any): S_1;
5463 find(predicate: (value: T, index: number, obj: T[]) => unknown, thisArg?: any): T;
5464 findIndex(predicate: (value: T, index: number, obj: T[]) => unknown, thisArg?: any): number;
5465 fill(value: T, start?: number, end?: number): T[];
5466 copyWithin(target: number, start: number, end?: number): T[];
5467 '__@iterator'(): IterableIterator<T>;
5468 entries(): IterableIterator<[number, T]>;
5469 keys(): IterableIterator<number>;
5470 values(): IterableIterator<T>;
5471 '__@unscopables'(): {
5472 copyWithin: boolean;
5473 entries: boolean;
5474 fill: boolean;
5475 find: boolean;
5476 findIndex: boolean;
5477 keys: boolean;
5478 values: boolean;
5479 };
5480 /**
5481 * An object of optional keys and values which configure the behavior of a function
5482 * @typedef {{string, any}} Options
5483 */
5484 includes(searchElement: T, fromIndex?: number): boolean;
5485 flatMap<U_3, This = undefined>(
5486 callback: (this: This, value: T, index: number, array: T[]) => U_3 | readonly U_3[],
5487 thisArg?: This
5488 ): U_3[];
5489 flat<U_4>(this: U_4[][][][][][][][], depth: 7): U_4[];
5490 flat<U_5>(this: U_5[][][][][][][], depth: 6): U_5[];
5491 flat<U_6>(this: U_6[][][][][][], depth: 5): U_6[];
5492 flat<U_7>(this: U_7[][][][][], depth: 4): U_7[];
5493 flat<U_8>(this: U_8[][][][], depth: 3): U_8[];
5494 flat<U_9>(this: U_9[][][], depth: 2): U_9[];
5495 flat<U_10>(this: U_10[][], depth?: 1): U_10[];
5496 flat<U_11>(this: U_11[], depth: 0): U_11[];
5497 flat<U_12>(depth?: number): any[];
5498 deepFlatten(): any;
5499 equals(other: any[]): boolean;
5500 partition(rule: Function): any[];
5501 filterJoin(sep: string): string;
5502 findSplice(find: Function, replace?: any): any;
5503}
5504interface Array<T> {
5505 [n: number]: T;
5506 length: number;
5507 toString(): string;
5508 toLocaleString(): string;
5509 pop(): T;
5510 push(...items: T[]): number;
5511 concat(...items: ConcatArray<T>[]): T[];
5512 concat(...items: (T | ConcatArray<T>)[]): T[];
5513 join(separator?: string): string;
5514 reverse(): T[];
5515 shift(): T;
5516 slice(start?: number, end?: number): T[];
5517 sort(compareFn?: (a: T, b: T) => number): T[];
5518 splice(start: number, deleteCount?: number): T[];
5519 splice(start: number, deleteCount: number, ...items: T[]): T[];
5520 unshift(...items: T[]): number;
5521 indexOf(searchElement: T, fromIndex?: number): number;
5522 lastIndexOf(searchElement: T, fromIndex?: number): number;
5523 every(callbackfn: (value: T, index: number, array: T[]) => unknown, thisArg?: any): boolean;
5524 some(callbackfn: (value: T, index: number, array: T[]) => unknown, thisArg?: any): boolean;
5525 forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void;
5526 map<U>(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[];
5527 filter<S extends T>(callbackfn: (value: T, index: number, array: T[]) => value is S, thisArg?: any): S[];
5528 filter(callbackfn: (value: T, index: number, array: T[]) => unknown, thisArg?: any): T[];
5529 reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T): T;
5530 reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue: T): T;
5531 reduce<U_1>(
5532 callbackfn: (previousValue: U_1, currentValue: T, currentIndex: number, array: T[]) => U_1,
5533 initialValue: U_1
5534 ): U_1;
5535 reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T): T;
5536 reduceRight(
5537 callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T,
5538 initialValue: T
5539 ): T;
5540 reduceRight<U_2>(
5541 callbackfn: (previousValue: U_2, currentValue: T, currentIndex: number, array: T[]) => U_2,
5542 initialValue: U_2
5543 ): U_2;
5544 /**
5545 * An object of optional keys and values which configure the behavior of a function
5546 * @typedef {{string, any}} Options
5547 */
5548 find<S_1 extends T>(predicate: (this: void, value: T, index: number, obj: T[]) => value is S_1, thisArg?: any): S_1;
5549 find(predicate: (value: T, index: number, obj: T[]) => unknown, thisArg?: any): T;
5550 findIndex(predicate: (value: T, index: number, obj: T[]) => unknown, thisArg?: any): number;
5551 fill(value: T, start?: number, end?: number): T[];
5552 copyWithin(target: number, start: number, end?: number): T[];
5553 '__@iterator'(): IterableIterator<T>;
5554 entries(): IterableIterator<[number, T]>;
5555 keys(): IterableIterator<number>;
5556 values(): IterableIterator<T>;
5557 '__@unscopables'(): {
5558 copyWithin: boolean;
5559 entries: boolean;
5560 fill: boolean;
5561 find: boolean;
5562 findIndex: boolean;
5563 keys: boolean;
5564 values: boolean;
5565 };
5566 /**
5567 * An object of optional keys and values which configure the behavior of a function
5568 * @typedef {{string, any}} Options
5569 */
5570 includes(searchElement: T, fromIndex?: number): boolean;
5571 flatMap<U_3, This = undefined>(
5572 callback: (this: This, value: T, index: number, array: T[]) => U_3 | readonly U_3[],
5573 thisArg?: This
5574 ): U_3[];
5575 flat<U_4>(this: U_4[][][][][][][][], depth: 7): U_4[];
5576 flat<U_5>(this: U_5[][][][][][][], depth: 6): U_5[];
5577 flat<U_6>(this: U_6[][][][][][], depth: 5): U_6[];
5578 flat<U_7>(this: U_7[][][][][], depth: 4): U_7[];
5579 flat<U_8>(this: U_8[][][][], depth: 3): U_8[];
5580 flat<U_9>(this: U_9[][][], depth: 2): U_9[];
5581 flat<U_10>(this: U_10[][], depth?: 1): U_10[];
5582 flat<U_11>(this: U_11[], depth: 0): U_11[];
5583 flat<U_12>(depth?: number): any[];
5584 deepFlatten(): any;
5585 equals(other: any[]): boolean;
5586 partition(rule: Function): any[];
5587 filterJoin(sep: string): string;
5588 findSplice(find: Function, replace?: any): any;
5589}
5590/**
5591 * A dice pool represents a set of Roll expressions which are collectively modified to compute an effective total
5592 * across all Rolls in the pool. The final total for the pool is defined as the sum over kept rolls, relative to any
5593 * success count or margin.
5594 *
5595 * @example
5596 * // Consider 3 rolls
5597 * let r1 = new Roll("4d6");
5598 * let r2 = new Roll("3d8");
5599 * let r3 = new Roll("2d10");
5600 *
5601 * // Keep the highest of the 3 roll expressions
5602 * let pool = new DicePool({
5603 * rolls: [r1,r2,r3],
5604 * modifiers: ["kh"]
5605 * });
5606 * pool.evaluate();
5607 *
5608 * @example
5609 * // Construct a DicePool from a string formula
5610 * let pool = DicePool.fromExpression("{4d6,3d8,2d10}kh");
5611 */
5612declare class DicePool {
5613 /**
5614 * Define the modifiers that can be used for this particular DiceTerm type.
5615 * @type {{string: (string|Function)}}
5616 * @public
5617 */
5618 static MODIFIERS: {
5619 string: string | Function;
5620 };
5621 /**
5622 * A regular expression pattern which identifies a potential DicePool modifier
5623 * @type {RegExp}
5624 */
5625 static MODIFIER_REGEX: RegExp;
5626 /**
5627 * A regular expression used to identify a valid Dice Pool
5628 * @type {RegExp}
5629 */
5630 static POOL_REGEX: RegExp;
5631 /**
5632 * Reconstruct a DicePool instance from a provided data Object
5633 * @param {Object} data The provided data
5634 * @return {DicePool} The constructed Dice Pool
5635 */
5636 static fromData(data: any): DicePool;
5637 /**
5638 * Given a string formula, create and return an evaluated DicePool object
5639 * @param {string} formula The string formula to parse
5640 * @param {object} [options] Additional options applied to the DicePool
5641 * @param {object} [data] A data object which defines data substitutions for Rolls in the DicePool
5642 *
5643 * @return {DicePool|null} The evaluated DicePool object or null if the formula is invalid
5644 */
5645 static fromExpression(formula: string, options?: any, data?: any): DicePool;
5646 /**
5647 * Reconstruct a DicePool instance from a provided data Object
5648 * @param {string} json The serialized JSON string
5649 * @return {DicePool} The constructed Dice Pool
5650 */
5651 static fromJSON(json: string): DicePool;
5652 constructor({ rolls, modifiers, options }?: { rolls?: any[]; modifiers?: any[]; options?: {} });
5653 /**
5654 * The elements of a Dice Pool must be Roll objects or numbers
5655 * @type {Array<Roll|number>}
5656 */
5657 rolls: Array<Roll | number>;
5658 /**
5659 * The string modifiers applied to resolve the pool
5660 * @type {string[]}
5661 */
5662 modifiers: string[];
5663 /**
5664 * An object of additional options which modify the pool
5665 * @type {object}
5666 */
5667 options: object;
5668 /**
5669 * The array of dice pool results which have been rolled
5670 * @type {Array<{result: number, active: boolean}>}
5671 */
5672 results: Array<{
5673 result: number;
5674 active: boolean;
5675 }>;
5676 /**
5677 * An internal flag for whether the dice term has been evaluated
5678 * @type {boolean}
5679 * @private
5680 */
5681 _evaluated: boolean;
5682 /**
5683 * Cache the evaluated total to avoid re-evaluating it
5684 * @type {number|null}
5685 * @private
5686 */
5687 _total: number | null;
5688 /**
5689 * Return an Array of each individual DiceTerm instances contained within the DicePool.
5690 * @return {DiceTerm[]}
5691 */
5692 get dice(): DiceTerm[];
5693 /**
5694 * Return a standardized representation for the displayed formula associated with this DicePool.
5695 * @return {string}
5696 */
5697 get formula(): string;
5698 /**
5699 * Return the total result of the DicePool if it has been evaluated
5700 * @type {number|null}
5701 */
5702 get total(): number;
5703 /**
5704 * Return an array of rolled values which are still active within the DicePool
5705 * @type {number[]}
5706 */
5707 get values(): number[];
5708 /**
5709 * Alter the DiceTerm by adding or multiplying the number of dice which are rolled
5710 * @param {any[]} args Arguments passed to each contained Roll#alter method.
5711 * @return {DicePool} The altered pool
5712 */
5713 alter(...args: any[]): DicePool;
5714 /**
5715 * Evaluate the DicePool, populating the results Array.
5716 * @param {boolean} [minimize] Apply the minimum possible result for each roll.
5717 * @param {boolean} [maximize] Apply the maximum possible result for each roll.
5718 * @returns {DiceTerm} The evaluated dice term
5719 */
5720 evaluate({ minimize, maximize }?: boolean): DiceTerm;
5721 /**
5722 * Sequentially evaluate each dice roll modifier by passing the term to its evaluation function
5723 * Augment or modify the results array.
5724 * @private
5725 */
5726 _evaluateModifiers(): void;
5727 /**
5728 * Convert the DicePool instance into an Object which can be serialized to JSON
5729 * @return {Object} The converted data
5730 */
5731 toJSON(): any;
5732 /**
5733 * Keep a certain number of highest or lowest dice rolls from the result set.
5734 *
5735 * {1d6,1d8,1d10,1d12}kh2 Keep the 2 best rolls from the pool
5736 * {1d12,6}kl Keep the lowest result in the pool
5737 *
5738 * @param {string} modifier The matched modifier query
5739 */
5740 keep(modifier: string): any;
5741 /**
5742 * Keep a certain number of highest or lowest dice rolls from the result set.
5743 *
5744 * {1d6,1d8,1d10,1d12}dl3 Drop the 3 worst results in the pool
5745 * {1d12,6}dh Drop the highest result in the pool
5746 *
5747 * @param {string} modifier The matched modifier query
5748 */
5749 drop(modifier: string): any;
5750 /**
5751 * Count the number of successful results which occurred in the pool.
5752 * Successes are counted relative to some target, or relative to the maximum possible value if no target is given.
5753 * Applying a count-success modifier to the results re-casts all results to 1 (success) or 0 (failure)
5754 *
5755 * 20d20cs Count the number of dice which rolled a 20
5756 * 20d20cs>10 Count the number of dice which rolled higher than 10
5757 * 20d20cs<10 Count the number of dice which rolled less than 10
5758 *
5759 * @param {string} modifier The matched modifier query
5760 */
5761 countSuccess(modifier: string): any;
5762 /**
5763 * Count the number of failed results which occurred in a given result set.
5764 * Failures are counted relative to some target, or relative to the lowest possible value if no target is given.
5765 * Applying a count-failures modifier to the results re-casts all results to 1 (failure) or 0 (non-failure)
5766 *
5767 * 6d6cf Count the number of dice which rolled a 1 as failures
5768 * 6d6cf<=3 Count the number of dice which rolled less than 3 as failures
5769 * 6d6cf>4 Count the number of dice which rolled greater than 4 as failures
5770 *
5771 * @param {string} modifier The matched modifier query
5772 */
5773 countFailures(modifier: string): any;
5774}
5775/**
5776 * An abstract base class for any term which appears in a dice roll formula
5777 * @abstract
5778 *
5779 * @param {object} termData Data used to create the Dice Term, including the following:
5780 * @param {number} termData.number The number of dice of this term to roll, before modifiers are applied
5781 * @param {number} termData.faces The number of faces on each die of this type
5782 * @param {string[]} termData.modifiers An array of modifiers applied to the results
5783 * @param {object} termData.options Additional options that modify the term
5784 */
5785declare class DiceTerm {
5786 constructor({
5787 number,
5788 faces,
5789 modifiers,
5790 options,
5791 }?: {
5792 number?: number;
5793 faces?: number;
5794 modifiers?: any[];
5795 options?: {};
5796 });
5797 /**
5798 * The number of dice of this term to roll, before modifiers are applied
5799 * @type {number}
5800 */
5801 number: number;
5802 /**
5803 * The number of faces on the die
5804 * @type {number}
5805 */
5806 faces: number;
5807 /**
5808 * An Array of dice term modifiers which are applied
5809 * @type {string[]}
5810 */
5811 modifiers: string[];
5812 /**
5813 * An object of additional options which modify the dice term
5814 * @type {object}
5815 */
5816 options: object;
5817 /**
5818 * The array of dice term results which have been rolled
5819 * @type {object[]}
5820 */
5821 results: object[];
5822 /**
5823 * An internal flag for whether the dice term has been evaluated
5824 * @type {boolean}
5825 * @private
5826 */
5827 _evaluated: boolean;
5828 /**
5829 * Return a standardized representation for the displayed formula associated with this DiceTerm
5830 * @return {string}
5831 */
5832 get formula(): string;
5833 /**
5834 * Return the total result of the DiceTerm if it has been evaluated
5835 * @type {number|null}
5836 */
5837 get total(): number;
5838 /**
5839 * Return an array of rolled values which are still active within this term
5840 * @type {number[]}
5841 */
5842 get values(): number[];
5843 /**
5844 * Alter the DiceTerm by adding or multiplying the number of dice which are rolled
5845 * @param {number} multiply A factor to multiply. Dice are multiplied before any additions.
5846 * @param {number} add A number of dice to add. Dice are added after multiplication.
5847 * @return {DiceTerm} The altered term
5848 */
5849 alter(multiply: number, add: number): DiceTerm;
5850 /**
5851 * Evaluate the roll term, populating the results Array.
5852 * @param {boolean} [minimize] Apply the minimum possible result for each roll.
5853 * @param {boolean} [maximize] Apply the maximum possible result for each roll.
5854 * @returns {DiceTerm} The evaluated dice term
5855 */
5856 evaluate({ minimize, maximize }?: boolean): DiceTerm;
5857 /**
5858 * Roll the DiceTerm by mapping a random uniform draw against the faces of the dice term.
5859 * @param {boolean} [minimize] Apply the minimum possible result instead of a random result.
5860 * @param {boolean} [maximize] Apply the maximum possible result instead of a random result.
5861 * @return {object}
5862 */
5863 roll({ minimize, maximize }?: boolean): any;
5864 /**
5865 * Sequentially evaluate each dice roll modifier by passing the term to its evaluation function
5866 * Augment or modify the results array.
5867 * @private
5868 */
5869 _evaluateModifiers(): void;
5870 /**
5871 * Serialize the DiceTerm to a JSON string which allows it to be saved in the database or embedded in text.
5872 * This method should return an object suitable for passing to the JSON.stringify function.
5873 * @return {object}
5874 */
5875 toJSON(): any;
5876}
5877declare namespace DiceTerm {
5878 export const DENOMINATION: string;
5879 export const MODIFIERS: {
5880 string: string | Function;
5881 };
5882 export const MODIFIER_REGEX: RegExp;
5883 export const MODIFIERS_REGEX: string;
5884 export const FLAVOR_TEXT_REGEX: string;
5885}
5886declare var RegExp: RegExpConstructor;
5887interface RegExp {
5888 exec(string: string): RegExpExecArray;
5889 test(string: string): boolean;
5890 readonly source: string;
5891 readonly global: boolean;
5892 readonly ignoreCase: boolean;
5893 readonly multiline: boolean;
5894 lastIndex: number;
5895 compile(): RegExp;
5896 readonly flags: string;
5897 readonly sticky: boolean;
5898 readonly unicode: boolean;
5899 '__@match'(string: string): RegExpMatchArray;
5900 '__@replace'(string: string, replaceValue: string): string;
5901 '__@replace'(string: string, replacer: (substring: string, ...args: any[]) => string): string;
5902 '__@search'(string: string): number;
5903 '__@split'(string: string, limit?: number): string[];
5904 readonly dotAll: boolean;
5905 '__@matchAll'(str: string): IterableIterator<RegExpMatchArray>;
5906}
5907declare namespace jQuery {
5908 export namespace fn {}
5909}
5910/**
5911 * A controller class for managing drag and drop workflows within an Application instance.
5912 * The controller manages the following actions: dragstart, dragover, drop
5913 * @see {@link Application}
5914 *
5915 * @param {string} dragSelector The CSS selector used to target draggable elements.
5916 * @param {string} dropSelector The CSS selector used to target viable drop targets.
5917 * @param {Object<string,Function>} permissions An object of permission test functions for each action
5918 * @param {Object<string,Function>} callbacks An object of callback functions for each action
5919 *
5920 * @example
5921 * const dragDrop = new DragDrop({
5922 * dragSelector: ".item",
5923 * dropSelector: ".items",
5924 * permissions: { dragstart: this._canDragStart.bind(this), drop: this._canDragDrop.bind(this) }
5925 * callbacks: { dragstart: this._onDragStart.bind(this), drop: this._onDragDrop.bind(this) }
5926 * });
5927 * dragDrop.bind(html);
5928 */
5929declare class DragDrop {
5930 static createDragImage(img: any, width: any, height: any): HTMLElement;
5931 constructor({
5932 dragSelector,
5933 dropSelector,
5934 permissions,
5935 callbacks,
5936 }?: {
5937 dragSelector?: any;
5938 dropSelector?: any;
5939 permissions?: {};
5940 callbacks?: {};
5941 });
5942 /**
5943 * The HTML selector which identifies draggable elements
5944 * @type {string}
5945 */
5946 dragSelector: string;
5947 /**
5948 * The HTML selector which identifies drop targets
5949 * @type {string}
5950 */
5951 dropSelector: string;
5952 /**
5953 * A set of permission checking functions for each action of the Drag and Drop workflow
5954 * @type {Object}
5955 */
5956 permissions: Object;
5957 /**
5958 * A set of callback functions for each action of the Drag and Drop workflow
5959 * @type {Object}
5960 */
5961 callbacks: Object;
5962 /**
5963 * Bind the DragDrop controller to an HTML application
5964 * @param {HTMLElement} html The HTML element to which the handler is bound
5965 */
5966 bind(html: HTMLElement): DragDrop;
5967 /**
5968 * Execute a callback function associated with a certain action in the workflow
5969 * @param {DragEvent} event The drag event being handled
5970 * @param {string} action The action being attempted
5971 */
5972 callback(event: DragEvent, action: string): any;
5973 /**
5974 * Test whether the current user has permission to perform a step of the workflow
5975 * @param {string} action The action being attempted
5976 * @param {string} selector The selector being targeted
5977 * @return {boolean} Can the action be performed?
5978 */
5979 can(action: string, selector: string): boolean;
5980 /**
5981 * Handle the start of a drag workflow
5982 * @param {DragEvent} event The drag event being handled
5983 * @private
5984 */
5985 _handleDragStart(event: DragEvent): void;
5986 /**
5987 * Handle a dragged element over a droppable target
5988 * @param {DragEvent} event The drag event being handled
5989 * @private
5990 */
5991 _handleDragOver(event: DragEvent): boolean;
5992 /**
5993 * Handle a dragged element dropped on a droppable target
5994 * @param {DragEvent} event The drag event being handled
5995 * @private
5996 */
5997 _handleDrop(event: DragEvent): any;
5998}
5999/**
6000 * A controller class for managing tabbed navigation within an Application instance.
6001 * @see {@link Application}
6002 *
6003 * @param {string} navSelector The CSS selector used to target the navigation element for these tabs
6004 * @param {string} contentSelector The CSS selector used to target the content container for these tabs
6005 * @param {string} initial The tab name of the initially active tab
6006 * @param {Function|null} callback An optional callback function that executes when the active tab is changed
6007 *
6008 * @example
6009 * <!-- Example HTML -->
6010 * <nav class="tabs" data-group="primary-tabs">
6011 * <a class="item" data-tab="tab1">Tab 1</li>
6012 * <a class="item" data-tab="tab2">Tab 2</li>
6013 * </nav>
6014 *
6015 * <section class="content">
6016 * <div class="tab" data-tab="tab1" data-group="primary-tabs">Content 1</div>
6017 * <div class="tab" data-tab="tab2" data-group="primary-tabs">Content 2</div>
6018 * </section>
6019 *
6020 * @example
6021 * // JavaScript
6022 * const tabs = new Tabs({navSelector: ".tabs", contentSelector: ".content", initial: "tab1"});
6023 * tabs.bind(html);
6024 */
6025declare class Tabs {
6026 constructor({
6027 navSelector,
6028 contentSelector,
6029 initial,
6030 callback,
6031 }?: {
6032 navSelector: any;
6033 contentSelector: any;
6034 initial: any;
6035 callback: any;
6036 });
6037 /**
6038 * The value of the active tab
6039 * @type {string}
6040 */
6041 active: string;
6042 /**
6043 * A callback function to trigger when the tab is changed
6044 * @type {Function|null}
6045 */
6046 callback: Function | null;
6047 /**
6048 * The CSS selector used to target the tab navigation element
6049 * @type {string}
6050 */
6051 _navSelector: string;
6052 /**
6053 * A reference to the HTML navigation element the tab controller is bound to
6054 * @type {HTMLElement|null}
6055 */
6056 _nav: HTMLElement | null;
6057 /**
6058 * The CSS selector used to target the tab content element
6059 * @type {string}
6060 */
6061 _contentSelector: string;
6062 /**
6063 * A reference to the HTML container element of the tab content
6064 * @type {HTMLElement|null}
6065 */
6066 _content: HTMLElement | null;
6067 /**
6068 * Bind the Tabs controller to an HTML application
6069 * @param {HTMLElement} html
6070 */
6071 bind(html: HTMLElement): void;
6072 /**
6073 * Activate a new tab by name
6074 * @param {string} tabName
6075 * @param {boolean} triggerCallback
6076 */
6077 activate(tabName: string, { triggerCallback }?: boolean): void;
6078 /**
6079 * Handle click events on the tab navigation entries
6080 * @param {MouseEvent} event A left click event
6081 * @private
6082 */
6083 _onClickNav(event: MouseEvent): void;
6084}
6085/**
6086 * A controller class for managing a text input widget that filters the contents of some other UI element
6087 * @see {@link Application}
6088 *
6089 * @param {string} inputSelector The CSS selector used to target the text input element.
6090 * @param {string} contentSelector The CSS selector used to target the content container for these tabs.
6091 * @param {string} initial The initial value of the search query.
6092 * @param {Function} callback A callback function which executes when the filter changes.
6093 * @param {number} delay The number of milliseconds to wait for text input before processing.
6094 */
6095declare class SearchFilter {
6096 constructor({
6097 inputSelector,
6098 contentSelector,
6099 initial,
6100 callback,
6101 delay,
6102 }?: {
6103 inputSelector: any;
6104 contentSelector: any;
6105 initial?: string;
6106 callback: any;
6107 delay?: number;
6108 });
6109 /**
6110 * The value of the current query string
6111 * @type {string}
6112 */
6113 query: string;
6114 /**
6115 * A callback function to trigger when the tab is changed
6116 * @type {Function|null}
6117 */
6118 callback: Function | null;
6119 /**
6120 * The CSS selector used to target the tab navigation element
6121 * @type {string}
6122 */
6123 _inputSelector: string;
6124 /**
6125 * A reference to the HTML navigation element the tab controller is bound to
6126 * @type {HTMLElement|null}
6127 */
6128 _input: HTMLElement | null;
6129 /**
6130 * The CSS selector used to target the tab content element
6131 * @type {string}
6132 */
6133 _contentSelector: string;
6134 /**
6135 * A reference to the HTML container element of the tab content
6136 * @type {HTMLElement|null}
6137 */
6138 _content: HTMLElement | null;
6139 /**
6140 * A debounced function which applies the search filtering
6141 * @type {Function}
6142 */
6143 _filter: Function;
6144 /**
6145 * Bind the SearchFilter controller to an HTML application
6146 * @param {HTMLElement} html
6147 */
6148 bind(html: HTMLElement): void;
6149 /**
6150 * Handle key-up events within the filter input field
6151 * @param {KeyboardEvent} event The key-up event
6152 * @private
6153 */
6154 _onKeyUp(event: KeyboardEvent): void;
6155}
6156/**
6157 * Edit a folder, configuring its name and appearance
6158 * @extends {FormApplication}
6159 */
6160declare class FolderConfig extends FormApplication {
6161 constructor(object?: {}, options?: {});
6162 /** @override */
6163 get title(): any;
6164 /** @override */
6165 getData(
6166 options: any
6167 ): Promise<{
6168 folder: any;
6169 submitText: any;
6170 }>;
6171 /** @override */
6172 _updateObject(event: any, formData: any): Promise<any>;
6173 /**
6174 * Render the Application by evaluating it's HTML template against the object of data provided by the getData method
6175 * If the Application is rendered as a pop-out window, wrap the contained HTML in an outer frame with window controls
6176 *
6177 * @param {boolean} force Add the rendered application to the DOM if it is not already present. If false, the
6178 * Application will only be re-rendered if it is already present.
6179 * @param {Object} options Additional rendering options which are applied to customize the way that the Application
6180 * is rendered in the DOM.
6181 *
6182 * @param {number} options.left The left positioning attribute
6183 * @param {number} options.top The top positioning attribute
6184 * @param {number} options.width The rendered width
6185 * @param {number} options.height The rendered height
6186 * @param {number} options.scale The rendered transformation scale
6187 * @param {boolean} options.log Whether to display a log message that the Application was rendered
6188 * @param {string} options.renderContext A context-providing string which suggests what event triggered the render
6189 * @param {*} options.renderData The data change which motivated the render request
6190 *
6191 */
6192 render(
6193 force?: boolean,
6194 options?: {
6195 left: number;
6196 top: number;
6197 width: number;
6198 height: number;
6199 scale: number;
6200 log: boolean;
6201 renderContext: string;
6202 renderData: any;
6203 }
6204 ): FolderConfig;
6205}
6206/**
6207 * A shared pattern for the sidebar directory which Actors, Items, and Scenes all use
6208 * @extends {SidebarTab}
6209 * @abstract
6210 * @interface
6211 */
6212declare class SidebarDirectory extends SidebarTab {
6213 /**
6214 * The named entity which this Sidebar Directory contains
6215 * @type {string}
6216 */
6217 static get entity(): string;
6218 /**
6219 * The Entity collection which this Sidebar Directory contains
6220 * @type {EntityCollection}
6221 */
6222 static get collection(): EntityCollection;
6223 /**
6224 * A reference to the Entity class which is displayed within this EntityCollection
6225 * @return {Entity}
6226 */
6227 static get cls(): Entity;
6228 /**
6229 * Given an entity type and a list of entities, set up the folder tree for that entity
6230 * @param {Folder[]} folders The Array of Folder objects to organize
6231 * @param {Entity[]} entities The Array of Entity objects to organize
6232 * @param {string} sortMode How should entities or Folders be sorted? (a)lphabetic or (n)umeric
6233 * @return {Object} A tree structure containing the folders and entities
6234 */
6235 static setupFolders(folders: Folder[], entities: Entity[], sortMode?: string): any;
6236 /**
6237 * Populate a single folder with child folders and content
6238 * This method is called recursively when building the folder tree
6239 * @private
6240 */
6241 static _populate(
6242 folder: any,
6243 folders: any,
6244 entities: any,
6245 {
6246 allowChildren,
6247 }?: {
6248 allowChildren?: boolean;
6249 }
6250 ): any[];
6251 constructor(options: any);
6252 /**
6253 * References to the set of Entities which are displayed in the Sidebar
6254 * @type {Entity[]}
6255 */
6256 entities: Entity[];
6257 /**
6258 * Reference the set of Folders which exist in this Sidebar
6259 * @type {Folder[]}
6260 */
6261 folders: Folder[];
6262 /**
6263 * Initialize the content of the directory by categorizing folders and entities into a hierarchical tree structure.
6264 */
6265 initialize(): void;
6266 tree: any;
6267 /** @override */
6268 render(force: any, context?: {}): SidebarDirectory;
6269 /** @override */
6270 getData(
6271 options: any
6272 ): {
6273 user: any;
6274 tree: any;
6275 canCreate: any;
6276 sidebarIcon: any;
6277 };
6278 /** @override */
6279 _onSearchFilter(event: any, query: any, html: any): void;
6280 /**
6281 * Collapse all subfolders in this directory
6282 */
6283 collapseAll(): void;
6284 /**
6285 * Activate event listeners triggered within the Actor Directory HTML
6286 */
6287 activateListeners(html: any): void;
6288 /**
6289 * Handle clicking on an Entity name in the Sidebar directory
6290 * @param {Event} event The originating click event
6291 * @private
6292 */
6293 _onClickEntityName(event: Event): void;
6294 /**
6295 * Handle new creation request
6296 * @param {MouseEvent} event The originating button click event
6297 * @private
6298 */
6299 _onCreateEntity(event: MouseEvent): Promise<any>;
6300 /**
6301 * Create a new Folder in this SidebarDirectory
6302 * @param {MouseEvent} event The originating button click event
6303 * @private
6304 */
6305 _onCreateFolder(event: MouseEvent): void;
6306 /**
6307 * Handle toggling the collapsed or expanded state of a folder within the directory tab
6308 * @param {MouseEvent} event The originating click event
6309 * @private
6310 */
6311 _toggleFolder(event: MouseEvent): void;
6312 /** @override */
6313 _onDragStart(event: any): void;
6314 _dragType: any;
6315 /** @override */
6316 _onDrop(event: any): boolean;
6317 /**
6318 * Define the behavior of the sidebar tab when it received a dropped data object
6319 * @param {Event} event The original drop event
6320 * @param {Object} data The data being dropped
6321 * @private
6322 */
6323 _handleDropData(event: Event, data: any): any;
6324 /**
6325 * Default folder context actions
6326 * @param html {jQuery}
6327 * @private
6328 */
6329 _contextMenu(html: typeof jQuery): void;
6330 /**
6331 * Get the set of ContextMenu options which should be used for Folders in a SidebarDirectory
6332 * @return {object[]} The Array of context options passed to the ContextMenu instance
6333 * @private
6334 */
6335 _getFolderContextOptions(): any[];
6336 /**
6337 * Get the set of ContextMenu options which should be used for Entities in a SidebarDirectory
6338 * @return {object[]} The Array of context options passed to the ContextMenu instance
6339 * @private
6340 */
6341 _getEntryContextOptions(): any[];
6342}
6343/**
6344 * A Note is an implementation of PlaceableObject which represents an annotated location within the Scene.
6345 * Each Note links to a JournalEntry entity and represents it's location on the map.
6346 * @extends {PlaceableObject}
6347 *
6348 * @example
6349 * Note.create({
6350 * entryId: journalEntry.id,
6351 * x: 1000,
6352 * y: 1000,
6353 * icon: "icons/my-journal-icon.svg",
6354 * iconSize: 40,
6355 * iconTint: "#00FF000",
6356 * text: "A custom label",
6357 * fontSize: 48,
6358 * textAnchor: CONST.TEXT_ANCHOR_POINTS.CENTER,
6359 * textColor: "#00FFFF"
6360 * });
6361 */
6362declare class Note extends PlaceableObject {
6363 constructor(...args: any[]);
6364 /**
6365 * The associated JournalEntry which is described by this note
6366 * @type {JournalEntry}
6367 */
6368 entry: JournalEntry;
6369 /**
6370 * Return the text label which describes the Note
6371 * Use a manually specified label with a fallback to the JournalEntry name
6372 * @type {string}
6373 */
6374 get text(): string;
6375 /**
6376 * The Map Note icon size
6377 * @type {number}
6378 */
6379 get size(): number;
6380 /** @override */
6381 draw(): Promise<Note>;
6382 tooltip: any;
6383 /**
6384 * Draw the ControlIcon for the Map Note
6385 * @return {ControlIcon}
6386 * @private
6387 */
6388 _drawControlIcon(): ControlIcon;
6389 /**
6390 * Draw the map note Tooltip as a Text object
6391 * @return {PIXI.Text}
6392 */
6393 _drawTooltip(): any;
6394 /**
6395 * Define a PIXI TextStyle object which is used for the tooltip displayed for this Note
6396 * @returns {PIXI.TextStyle}
6397 */
6398 _getTextStyle(): any;
6399 /** @override */
6400 refresh(): Note;
6401 visible: boolean;
6402 /** @override */
6403 _onUpdate(data: any): Promise<Note>;
6404 /** @override */
6405 _canHover(user: any): boolean;
6406 /** @override */
6407 _canView(user: any): boolean;
6408 /** @override */
6409 _onHoverIn(event: any, options: any): boolean;
6410 /** @override */
6411 _onHoverOut(event: any): boolean;
6412 /** @override */
6413 _onClickLeft2(event: any): void;
6414 /** @extends {Entity.updateEmbeddedEntity} */
6415 update(data: any, options: any): Promise<Note>;
6416 /** @extends {Entity.deleteEmbeddedEntity} */
6417 delete(options: any): Promise<Note>;
6418}
6419/**
6420 * An abstract pattern followed by the different tabs of the sidebar
6421 * @type {Application}
6422 * @abstract
6423 * @interface
6424 */
6425declare class SidebarTab extends Application {
6426 /** @override */
6427 static get defaultOptions(): any;
6428 constructor(...args: any[]);
6429 /**
6430 * The base name of this sidebar tab
6431 * @type {string}
6432 */
6433 tabName: string;
6434 /**
6435 * A reference to the pop-out variant of this SidebarTab, if one exists
6436 * @type {SidebarTab}
6437 * @private
6438 */
6439 _popout: SidebarTab;
6440 /**
6441 * Denote whether or not this is the original version of the sidebar tab, or a pop-out variant
6442 * @type {SidebarTab}
6443 */
6444 _original: SidebarTab;
6445 /** @override */
6446 _renderInner(data: any): Promise<any>;
6447 /** @override */
6448 _render(...args: any[]): Promise<any>;
6449 /**
6450 * Activate this SidebarTab, switching focus to it
6451 */
6452 activate(): void;
6453 /**
6454 * Create a second instance of this SidebarTab class which represents a singleton popped-out container
6455 * @return {SidebarTab} The popped out sidebar tab instance
6456 */
6457 createPopout(): SidebarTab;
6458 /**
6459 * Render the SidebarTab as a pop-out container
6460 */
6461 renderPopout(): void;
6462 /**
6463 * Handle lazy loading for sidebar images to only load them once they become observed
6464 * @param entries
6465 * @param observer
6466 */
6467 _onLazyLoadImage(entries: any, observer: any): void;
6468 /**
6469 * Render the Application by evaluating it's HTML template against the object of data provided by the getData method
6470 * If the Application is rendered as a pop-out window, wrap the contained HTML in an outer frame with window controls
6471 *
6472 * @param {boolean} force Add the rendered application to the DOM if it is not already present. If false, the
6473 * Application will only be re-rendered if it is already present.
6474 * @param {Object} options Additional rendering options which are applied to customize the way that the Application
6475 * is rendered in the DOM.
6476 *
6477 * @param {number} options.left The left positioning attribute
6478 * @param {number} options.top The top positioning attribute
6479 * @param {number} options.width The rendered width
6480 * @param {number} options.height The rendered height
6481 * @param {number} options.scale The rendered transformation scale
6482 * @param {boolean} options.log Whether to display a log message that the Application was rendered
6483 * @param {string} options.renderContext A context-providing string which suggests what event triggered the render
6484 * @param {*} options.renderData The data change which motivated the render request
6485 *
6486 */
6487 render(
6488 force?: boolean,
6489 options?: {
6490 left: number;
6491 top: number;
6492 width: number;
6493 height: number;
6494 scale: number;
6495 log: boolean;
6496 renderContext: string;
6497 renderData: any;
6498 }
6499 ): SidebarTab;
6500}
6501