@embedpdf/core 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,567 @@
1
+ import { Rotation, PdfDocumentObject, PdfPageObject, PdfPageObjectWithRotatedSize, PdfEngine } from '@embedpdf/models';
2
+
3
+ /** Represents an action with a type and optional payload */
4
+ interface Action {
5
+ type: string;
6
+ payload?: any;
7
+ }
8
+ /** A reducer function that updates a specific state based on an action */
9
+ type Reducer<State, Action> = (state: State, action: Action) => State;
10
+ /**
11
+ * Represents the overall store state, with a typed core and plugin states
12
+ */
13
+ interface StoreState<CoreState> {
14
+ core: CoreState;
15
+ plugins: Record<string, any>;
16
+ }
17
+ /**
18
+ * The signature of a main-store listener. You now receive:
19
+ * - `action` => The action that was dispatched
20
+ * - `newState` => The store state *after* the update
21
+ * - `oldState` => The store state *before* the update
22
+ */
23
+ type StoreListener<CoreState> = (action: Action, newState: StoreState<CoreState>, oldState: StoreState<CoreState>) => void;
24
+ /**
25
+ * The signature of a plugin-store listener. You now receive:
26
+ * - `action` => The action that was dispatched
27
+ * - `newPluginState` => The plugin state *after* the update
28
+ * - `oldPluginState` => The plugin state *before* the update
29
+ */
30
+ type PluginListener = (action: Action, newPluginState: any, oldPluginState: any) => void;
31
+
32
+ /**
33
+ * A type-safe store handle for plugins, providing access to plugin-specific state and actions.
34
+ */
35
+ declare class PluginStore<PluginState, PluginAction extends Action> {
36
+ private store;
37
+ private pluginId;
38
+ /**
39
+ * Initializes the PluginStore with the main store and plugin ID.
40
+ * @param store The main store instance.
41
+ * @param pluginId The unique identifier for the plugin.
42
+ */
43
+ constructor(store: Store<any, any>, pluginId: string);
44
+ /**
45
+ * Gets the current state of the plugin.
46
+ * @returns The plugin's state.
47
+ */
48
+ getState(): PluginState;
49
+ /**
50
+ * Dispatches an action for the plugin and returns the *new* global state.
51
+ * If you only need the plugin’s updated state, call `getState()` afterward.
52
+ * @param action The action to dispatch.
53
+ * @returns The updated global store state (after plugin reducer).
54
+ */
55
+ dispatch(action: PluginAction): PluginState;
56
+ /**
57
+ * Subscribes to state changes only for this specific plugin.
58
+ * You now receive (action, newPluginState, oldPluginState) in the callback.
59
+ *
60
+ * @param listener The callback to invoke when plugin state changes.
61
+ * @returns A function to unsubscribe the listener.
62
+ */
63
+ subscribeToState(listener: (action: PluginAction, newState: PluginState, oldState: PluginState) => void): () => void;
64
+ /**
65
+ * Subscribes to a specific action type for the plugin.
66
+ * This still uses the main store's `onAction`, so you get the *global*
67
+ * old/new store states there. If you specifically want old/new plugin state,
68
+ * use `subscribeToState` instead.
69
+ *
70
+ * @param type The action type to listen for.
71
+ * @param handler The callback to invoke when the action occurs.
72
+ * @returns A function to unsubscribe the handler.
73
+ */
74
+ onAction<T extends PluginAction['type']>(type: T, handler: (action: Extract<PluginAction, {
75
+ type: T;
76
+ }>, state: PluginState, oldState: PluginState) => void): () => void;
77
+ }
78
+
79
+ /**
80
+ * A generic, type-safe store class managing core and plugin states, reducers, and subscriptions.
81
+ * @template CoreState The type of the core state.
82
+ * @template CoreAction The type of actions handled by core reducers (extends Action).
83
+ */
84
+ declare class Store<CoreState, CoreAction extends Action = Action> {
85
+ initialCoreState: CoreState;
86
+ private state;
87
+ private coreReducer;
88
+ private pluginReducers;
89
+ private listeners;
90
+ private pluginListeners;
91
+ /**
92
+ * Initializes the store with the provided core state.
93
+ * @param reducer The core reducer function
94
+ * @param initialCoreState The initial core state
95
+ */
96
+ constructor(reducer: Reducer<CoreState, CoreAction>, initialCoreState: CoreState);
97
+ /**
98
+ * Adds a reducer for a plugin-specific state.
99
+ * @param pluginId The unique identifier for the plugin.
100
+ * @param reducer The reducer function for the plugin state.
101
+ * @param initialState The initial state for the plugin.
102
+ */
103
+ addPluginReducer<PluginState>(pluginId: string, reducer: Reducer<PluginState, Action>, initialState: PluginState): void;
104
+ /**
105
+ * Dispatches an action *only* to the core reducer.
106
+ * Notifies the global store listeners with (action, newState, oldState).
107
+ *
108
+ * @param action The action to dispatch, typed as CoreAction
109
+ * @returns The updated *global* store state
110
+ */
111
+ dispatchToCore(action: CoreAction): StoreState<CoreState>;
112
+ /**
113
+ * Dispatches an action *only* to a specific plugin.
114
+ * Optionally notifies global store listeners if `notifyGlobal` is true.
115
+ * Always notifies plugin-specific listeners with (action, newPluginState, oldPluginState).
116
+ *
117
+ * @param pluginId The plugin identifier
118
+ * @param action The plugin action to dispatch
119
+ * @param notifyGlobal Whether to also notify global store listeners
120
+ * @returns The updated *global* store state
121
+ */
122
+ dispatchToPlugin<PluginAction extends Action>(pluginId: string, action: PluginAction, notifyGlobal?: boolean): any;
123
+ /**
124
+ * Dispatches an action to update the state using:
125
+ * - the core reducer (if it's a CoreAction)
126
+ * - *all* plugin reducers (regardless of action type), with no global notify for each plugin
127
+ *
128
+ * Returns the new *global* store state after all reducers have processed the action.
129
+ *
130
+ * @param action The action to dispatch (can be CoreAction or any Action).
131
+ */
132
+ dispatch(action: CoreAction | Action): StoreState<CoreState>;
133
+ /**
134
+ * Returns a shallow copy of the current state.
135
+ * @returns The current store state.
136
+ */
137
+ getState(): StoreState<CoreState>;
138
+ /**
139
+ * Subscribes a listener to *global* state changes.
140
+ * The callback signature is now (action, newState, oldState).
141
+ *
142
+ * @param listener The callback to invoke on state changes
143
+ * @returns A function to unsubscribe the listener
144
+ */
145
+ subscribe(listener: StoreListener<CoreState>): () => void;
146
+ /**
147
+ * Subscribes a listener to *plugin-specific* state changes.
148
+ * The callback signature is now (action, newPluginState, oldPluginState).
149
+ *
150
+ * @param pluginId The unique identifier for the plugin.
151
+ * @param listener The callback to invoke on plugin state changes.
152
+ * @returns A function to unsubscribe the listener.
153
+ */
154
+ subscribeToPlugin(pluginId: string, listener: PluginListener): () => void;
155
+ /**
156
+ * Subscribes to a specific action type (only from the core's action union).
157
+ * The callback signature is (action, newState, oldState).
158
+ *
159
+ * @param type The action type to listen for.
160
+ * @param handler The callback to invoke when the action occurs.
161
+ * @returns A function to unsubscribe the handler.
162
+ */
163
+ onAction<T extends CoreAction['type']>(type: T, handler: (action: Extract<CoreAction, {
164
+ type: T;
165
+ }>, state: StoreState<CoreState>, oldState: StoreState<CoreState>) => void): () => void;
166
+ /**
167
+ * Gets a PluginStore handle for a specific plugin.
168
+ * @param pluginId The unique identifier for the plugin.
169
+ * @returns A PluginStore instance for the plugin.
170
+ */
171
+ getPluginStore<PluginState, PluginAction extends Action>(pluginId: string): PluginStore<PluginState, PluginAction>;
172
+ /**
173
+ * Helper method to check if an action is a CoreAction.
174
+ * Adjust if you have a more refined way to differentiate CoreAction vs. any other Action.
175
+ */
176
+ private isCoreAction;
177
+ /**
178
+ * Destroy the store: drop every listener and plugin reducer
179
+ */
180
+ destroy(): void;
181
+ }
182
+
183
+ interface CoreState {
184
+ scale: number;
185
+ rotation: Rotation;
186
+ document: PdfDocumentObject | null;
187
+ pages: PdfPageObject[][];
188
+ loading: boolean;
189
+ error: string | null;
190
+ }
191
+ declare const initialCoreState: (config?: PluginRegistryConfig) => CoreState;
192
+
193
+ declare const LOAD_DOCUMENT = "LOAD_DOCUMENT";
194
+ declare const SET_DOCUMENT = "SET_DOCUMENT";
195
+ declare const SET_DOCUMENT_ERROR = "SET_DOCUMENT_ERROR";
196
+ declare const SET_SCALE = "SET_SCALE";
197
+ declare const SET_ROTATION = "SET_ROTATION";
198
+ declare const SET_PAGES = "SET_PAGES";
199
+ interface LoadDocumentAction {
200
+ type: typeof LOAD_DOCUMENT;
201
+ }
202
+ interface SetDocumentAction {
203
+ type: typeof SET_DOCUMENT;
204
+ payload: PdfDocumentObject;
205
+ }
206
+ interface SetDocumentErrorAction {
207
+ type: typeof SET_DOCUMENT_ERROR;
208
+ payload: string;
209
+ }
210
+ interface SetScaleAction {
211
+ type: typeof SET_SCALE;
212
+ payload: number;
213
+ }
214
+ interface SetRotationAction {
215
+ type: typeof SET_ROTATION;
216
+ payload: Rotation;
217
+ }
218
+ interface SetPagesAction {
219
+ type: typeof SET_PAGES;
220
+ payload: PdfPageObject[][];
221
+ }
222
+ type DocumentAction = LoadDocumentAction | SetDocumentAction | SetDocumentErrorAction | SetScaleAction | SetRotationAction | SetPagesAction;
223
+ type CoreAction = DocumentAction;
224
+ declare const loadDocument: () => CoreAction;
225
+ declare const setDocument: (document: PdfDocumentObject) => CoreAction;
226
+ declare const setDocumentError: (error: string) => CoreAction;
227
+ declare const setScale: (scale: number) => CoreAction;
228
+ declare const setRotation: (rotation: Rotation) => CoreAction;
229
+ declare const setPages: (pages: PdfPageObject[][]) => CoreAction;
230
+
231
+ declare const getPagesWithRotatedSize: (state: CoreState) => PdfPageObjectWithRotatedSize[][];
232
+
233
+ interface IPlugin<TConfig = unknown> {
234
+ id: string;
235
+ initialize?(config: TConfig): Promise<void>;
236
+ destroy?(): Promise<void> | void;
237
+ provides?(): any;
238
+ postInitialize?(): Promise<void>;
239
+ ready?(): Promise<void>;
240
+ }
241
+ interface BasePluginConfig {
242
+ enabled?: boolean;
243
+ }
244
+ interface PluginRegistryConfig {
245
+ rotation?: Rotation;
246
+ scale?: number;
247
+ }
248
+ interface PluginManifest<TConfig = unknown> {
249
+ id: string;
250
+ name: string;
251
+ version: string;
252
+ provides: string[];
253
+ requires: string[];
254
+ optional: string[];
255
+ defaultConfig: TConfig;
256
+ metadata?: {
257
+ description?: string;
258
+ author?: string;
259
+ homepage?: string;
260
+ [key: string]: unknown;
261
+ };
262
+ }
263
+ interface PluginPackage<T extends IPlugin<TConfig>, TConfig = unknown, TState = unknown, TAction extends Action = Action> {
264
+ manifest: PluginManifest<TConfig>;
265
+ create(registry: PluginRegistry, engine: PdfEngine, config: TConfig): T;
266
+ reducer: Reducer<TState, TAction>;
267
+ initialState: TState | ((coreState: CoreState, config: TConfig) => TState);
268
+ }
269
+ type PluginStatus = 'registered' | 'active' | 'error' | 'disabled' | 'unregistered';
270
+ interface PluginBatchRegistration<T extends IPlugin<TConfig>, TConfig = unknown, TState = unknown, TAction extends Action = Action> {
271
+ package: PluginPackage<T, TConfig, TState, TAction>;
272
+ config?: Partial<TConfig>;
273
+ }
274
+ interface GlobalStoreState<TPlugins extends Record<string, any> = {}> {
275
+ core: CoreState;
276
+ plugins: TPlugins;
277
+ }
278
+
279
+ declare class PluginRegistry {
280
+ private plugins;
281
+ private manifests;
282
+ private capabilities;
283
+ private status;
284
+ private resolver;
285
+ private configurations;
286
+ private engine;
287
+ private engineInitialized;
288
+ private store;
289
+ private initPromise;
290
+ private pendingRegistrations;
291
+ private processingRegistrations;
292
+ private initialized;
293
+ private isInitializing;
294
+ private initialCoreState;
295
+ private pluginsReadyPromise;
296
+ private destroyed;
297
+ constructor(engine: PdfEngine, config?: PluginRegistryConfig);
298
+ /**
299
+ * Ensure engine is initialized before proceeding
300
+ */
301
+ private ensureEngineInitialized;
302
+ /**
303
+ * Register a plugin without initializing it
304
+ */
305
+ registerPlugin<TPlugin extends IPlugin<TConfig>, TConfig = unknown, TState = unknown, TAction extends Action = Action>(pluginPackage: PluginPackage<TPlugin, TConfig, TState, TAction>, config?: Partial<TConfig>): void;
306
+ /**
307
+ * Get the central store instance
308
+ */
309
+ getStore(): Store<CoreState, CoreAction>;
310
+ /**
311
+ * Get the engine instance
312
+ */
313
+ getEngine(): PdfEngine;
314
+ /**
315
+ * Get a promise that resolves when all plugins are ready
316
+ */
317
+ pluginsReady(): Promise<void>;
318
+ /**
319
+ * INITIALISE THE REGISTRY – runs once no-matter-how-many calls *
320
+ */
321
+ initialize(): Promise<void>;
322
+ /**
323
+ * Initialize a single plugin with all necessary checks
324
+ */
325
+ private initializePlugin;
326
+ getPluginConfig<TConfig>(pluginId: string): TConfig;
327
+ private validateConfig;
328
+ updatePluginConfig<TConfig>(pluginId: string, config: Partial<TConfig>): Promise<void>;
329
+ /**
330
+ * Register multiple plugins at once
331
+ */
332
+ registerPluginBatch(registrations: PluginBatchRegistration<IPlugin<any>, any, any, any>[]): void;
333
+ /**
334
+ * Unregister a plugin
335
+ */
336
+ unregisterPlugin(pluginId: string): Promise<void>;
337
+ /**
338
+ * Get a plugin instance
339
+ * @param pluginId The ID of the plugin to get
340
+ * @returns The plugin instance or null if not found
341
+ */
342
+ getPlugin<T extends IPlugin>(pluginId: string): T | null;
343
+ /**
344
+ * Get a plugin that provides a specific capability
345
+ * @param capability The capability to get a provider for
346
+ * @returns The plugin providing the capability or null if not found
347
+ */
348
+ getCapabilityProvider(capability: string): IPlugin | null;
349
+ /**
350
+ * Check if a capability is available
351
+ */
352
+ hasCapability(capability: string): boolean;
353
+ /**
354
+ * Get all registered plugins
355
+ */
356
+ getAllPlugins(): IPlugin[];
357
+ /**
358
+ * Get plugin status
359
+ */
360
+ getPluginStatus(pluginId: string): PluginStatus;
361
+ /**
362
+ * Validate plugin object
363
+ */
364
+ private validatePlugin;
365
+ /**
366
+ * Validate plugin manifest
367
+ */
368
+ private validateManifest;
369
+ isDestroyed(): boolean;
370
+ /**
371
+ * DESTROY EVERYTHING – waits for any ongoing initialise(), once *
372
+ */
373
+ destroy(): Promise<void>;
374
+ }
375
+
376
+ declare class DependencyResolver {
377
+ private dependencyGraph;
378
+ addNode(id: string, dependencies?: string[]): void;
379
+ private hasCircularDependencies;
380
+ resolveLoadOrder(): string[];
381
+ }
382
+
383
+ /**
384
+ * Helper function to create a properly typed plugin registration
385
+ */
386
+ declare function createPluginRegistration<T extends IPlugin<TConfig>, TConfig, TState, TAction extends Action>(pluginPackage: PluginPackage<T, TConfig, TState, TAction>, config?: Partial<TConfig>): PluginBatchRegistration<T, TConfig, any, any>;
387
+
388
+ declare class PluginRegistrationError extends Error {
389
+ constructor(message: string);
390
+ }
391
+ declare class PluginNotFoundError extends Error {
392
+ constructor(message: string);
393
+ }
394
+ declare class CircularDependencyError extends Error {
395
+ constructor(message: string);
396
+ }
397
+ declare class CapabilityNotFoundError extends Error {
398
+ constructor(message: string);
399
+ }
400
+ declare class CapabilityConflictError extends Error {
401
+ constructor(message: string);
402
+ }
403
+ declare class PluginInitializationError extends Error {
404
+ constructor(message: string);
405
+ }
406
+ declare class PluginConfigurationError extends Error {
407
+ constructor(message: string);
408
+ }
409
+
410
+ interface StateChangeHandler<TState> {
411
+ (state: TState): void;
412
+ }
413
+ declare abstract class BasePlugin<TConfig = unknown, TCapability = unknown, TState = unknown, TAction extends Action = Action> implements IPlugin<TConfig> {
414
+ readonly id: string;
415
+ protected registry: PluginRegistry;
416
+ static readonly id: string;
417
+ protected pluginStore: PluginStore<TState, TAction>;
418
+ protected coreStore: Store<CoreState, CoreAction>;
419
+ private debouncedActions;
420
+ private unsubscribeFromState;
421
+ private unsubscribeFromCoreStore;
422
+ private _capability?;
423
+ private readyPromise;
424
+ private readyResolve;
425
+ constructor(id: string, registry: PluginRegistry);
426
+ /** Construct the public capability (called once & cached). */
427
+ protected abstract buildCapability(): TCapability;
428
+ provides(): Readonly<TCapability>;
429
+ /**
430
+ * Initialize plugin with config
431
+ */
432
+ abstract initialize(config: TConfig): Promise<void>;
433
+ /**
434
+ * Get a copy of the current state
435
+ */
436
+ protected get state(): Readonly<TState>;
437
+ /**
438
+ * Get a copy of the current core state
439
+ */
440
+ protected get coreState(): Readonly<StoreState<CoreState>>;
441
+ /**
442
+ * @deprecated use `this.state` Get a copy of the current state
443
+ */
444
+ protected getState(): TState;
445
+ /**
446
+ * @deprecated use `this.coreState` Get a copy of the current core state
447
+ */
448
+ protected getCoreState(): StoreState<CoreState>;
449
+ /**
450
+ * Core Dispatch
451
+ */
452
+ protected dispatchCoreAction(action: CoreAction): StoreState<CoreState>;
453
+ /**
454
+ * Dispatch an action
455
+ */
456
+ protected dispatch(action: TAction): TState;
457
+ /**
458
+ * Dispatch an action with debouncing to prevent rapid repeated calls
459
+ * @param action The action to dispatch
460
+ * @param debounceTime Time in ms to debounce (default: 100ms)
461
+ * @returns boolean indicating whether the action was dispatched or debounced
462
+ */
463
+ protected debouncedDispatch(action: TAction, debounceTime?: number): boolean;
464
+ /**
465
+ * Subscribe to state changes
466
+ */
467
+ protected subscribe(listener: (action: TAction, state: TState) => void): () => void;
468
+ /**
469
+ * Subscribe to core store changes
470
+ */
471
+ protected subscribeToCoreStore(listener: (action: Action, state: StoreState<CoreState>) => void): () => void;
472
+ /**
473
+ * Called when the plugin store state is updated
474
+ * @param oldState Previous state
475
+ * @param newState New state
476
+ */
477
+ protected onStoreUpdated(oldState: TState, newState: TState): void;
478
+ /**
479
+ * Called when the core store state is updated
480
+ * @param oldState Previous state
481
+ * @param newState New state
482
+ */
483
+ protected onCoreStoreUpdated(oldState: StoreState<CoreState>, newState: StoreState<CoreState>): void;
484
+ /**
485
+ * Cleanup method to be called when plugin is being destroyed
486
+ */
487
+ destroy(): void;
488
+ /**
489
+ * Returns a promise that resolves when the plugin is ready
490
+ */
491
+ ready(): Promise<void>;
492
+ /**
493
+ * Mark the plugin as ready
494
+ */
495
+ protected markReady(): void;
496
+ /**
497
+ * Reset the ready state (useful for plugins that need to reinitialize)
498
+ */
499
+ protected resetReady(): void;
500
+ }
501
+
502
+ type EventHandler<T> = (data: T) => void;
503
+ interface BaseEventControlOptions {
504
+ wait: number;
505
+ }
506
+ interface DebounceOptions extends BaseEventControlOptions {
507
+ mode: 'debounce';
508
+ }
509
+ interface ThrottleOptions extends BaseEventControlOptions {
510
+ mode: 'throttle';
511
+ throttleMode?: 'leading-trailing' | 'trailing';
512
+ }
513
+ type EventControlOptions = DebounceOptions | ThrottleOptions;
514
+ declare class EventControl<T> {
515
+ private handler;
516
+ private options;
517
+ private timeoutId?;
518
+ private lastRun;
519
+ constructor(handler: EventHandler<T>, options: EventControlOptions);
520
+ handle: (data: T) => void;
521
+ private debounce;
522
+ private throttle;
523
+ destroy(): void;
524
+ }
525
+
526
+ type Listener<T = any> = (value: T) => void;
527
+ type Unsubscribe = () => void;
528
+ type EventHook<T = any> = ((listener: Listener<T>) => Unsubscribe) | ((listener: Listener<T>, options?: EventControlOptions) => Unsubscribe);
529
+ interface Emitter<T = any> {
530
+ emit(value?: T): void;
531
+ on(listener: Listener<T>): Unsubscribe;
532
+ off(listener: Listener<T>): void;
533
+ clear(): void;
534
+ }
535
+ declare function createEmitter<T = any>(): Emitter<T>;
536
+ interface BehaviorEmitter<T = any> extends Omit<Emitter<T>, 'on' | 'off'> {
537
+ readonly value?: T;
538
+ on: EventHook<T>;
539
+ off(listener: Listener<T>): void;
540
+ select<U>(selector: (v: T) => U, equality?: (a: U, b: U) => boolean): EventHook<U>;
541
+ }
542
+ declare function createBehaviorEmitter<T = any>(initial?: T, equality?: (a: T, b: T) => boolean): BehaviorEmitter<T>;
543
+
544
+ /**
545
+ * Restrict a numeric value to the inclusive range [min, max].
546
+ *
547
+ * @example
548
+ * clamp( 5, 0, 10) // 5
549
+ * clamp(-3, 0, 10) // 0
550
+ * clamp(17, 0, 10) // 10
551
+ */
552
+ declare function clamp(value: number, min: number, max: number): number;
553
+ /**
554
+ * Deeply compares two values (objects, arrays, primitives)
555
+ * with the following rules:
556
+ * - Objects are compared ignoring property order.
557
+ * - Arrays are compared ignoring element order (multiset comparison).
558
+ * - Primitives are compared by strict equality.
559
+ * - null/undefined are treated as normal primitives.
560
+ *
561
+ * @param a First value
562
+ * @param b Second value
563
+ * @param visited Used internally to detect cycles
564
+ */
565
+ declare function arePropsEqual(a: any, b: any, visited?: Set<any>): boolean;
566
+
567
+ export { type Action, type BaseEventControlOptions, BasePlugin, type BasePluginConfig, type BehaviorEmitter, CapabilityConflictError, CapabilityNotFoundError, CircularDependencyError, type CoreAction, type CoreState, type DebounceOptions, DependencyResolver, type DocumentAction, type Emitter, EventControl, type EventControlOptions, type EventHandler, type EventHook, type GlobalStoreState, type IPlugin, LOAD_DOCUMENT, type Listener, type LoadDocumentAction, type PluginBatchRegistration, PluginConfigurationError, PluginInitializationError, type PluginListener, type PluginManifest, PluginNotFoundError, type PluginPackage, PluginRegistrationError, PluginRegistry, type PluginRegistryConfig, type PluginStatus, type Reducer, SET_DOCUMENT, SET_DOCUMENT_ERROR, SET_PAGES, SET_ROTATION, SET_SCALE, type SetDocumentAction, type SetDocumentErrorAction, type SetPagesAction, type SetRotationAction, type SetScaleAction, type StateChangeHandler, type StoreListener, type StoreState, type ThrottleOptions, type Unsubscribe, arePropsEqual, clamp, createBehaviorEmitter, createEmitter, createPluginRegistration, getPagesWithRotatedSize, initialCoreState, loadDocument, setDocument, setDocumentError, setPages, setRotation, setScale };