react-iiif-vault 1.2.6 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle.d.ts +74 -24
- package/dist/bundle.global.js +24 -24
- package/dist/canvas-panel.cjs +5 -5
- package/dist/canvas-panel.d.cts +2 -2
- package/dist/canvas-panel.d.ts +2 -2
- package/dist/canvas-panel.js +1 -1
- package/dist/chunk-5PAZ34A4.js +48 -0
- package/dist/chunk-FZEYDVWC.js +1 -0
- package/dist/{index-BmF5JPHb.d.cts → index-Bm0eAQri.d.ts} +4 -2
- package/dist/{index-jRxSNVAX.d.ts → index-CK5q0i1-.d.cts} +4 -2
- package/dist/index.cjs +7 -7
- package/dist/index.d.cts +63 -25
- package/dist/index.d.ts +63 -25
- package/dist/index.js +1 -1
- package/dist/{useRenderingStrategy-D2R_H2aP.d.cts → useRenderingStrategy-DUTiqfD8.d.cts} +13 -3
- package/dist/{useRenderingStrategy-D2R_H2aP.d.ts → useRenderingStrategy-DUTiqfD8.d.ts} +13 -3
- package/dist/utils.cjs +1 -1
- package/dist/utils.d.cts +2 -2
- package/dist/utils.d.ts +2 -2
- package/dist/utils.js +1 -1
- package/package.json +3 -2
- package/dist/chunk-DXFXJCXN.js +0 -1
- package/dist/chunk-QKLET6KX.js +0 -48
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { S as SimpleViewerContext, a as SimpleViewerProps } from './index-
|
|
2
|
-
export { C as CanvasPanel, c as SimpleViewerActions, d as SimpleViewerActionsType, b as SimpleViewerReducerState } from './index-
|
|
1
|
+
import { S as SimpleViewerContext, a as SimpleViewerProps } from './index-CK5q0i1-.cjs';
|
|
2
|
+
export { C as CanvasPanel, c as SimpleViewerActions, d as SimpleViewerActionsType, b as SimpleViewerReducerState } from './index-CK5q0i1-.cjs';
|
|
3
3
|
import * as React$1 from 'react';
|
|
4
4
|
import React__default, { ReactNode, FunctionComponent, RefObject } from 'react';
|
|
5
5
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
@@ -10,15 +10,16 @@ import { RenderState, InputShape, SlowState } from 'polygon-editor';
|
|
|
10
10
|
import { BoxStyle, Preset } from '@atlas-viewer/atlas';
|
|
11
11
|
import * as zustand_vanilla from 'zustand/vanilla';
|
|
12
12
|
import { StoreApi } from 'zustand/vanilla';
|
|
13
|
+
import * as zustand from 'zustand';
|
|
14
|
+
import { StoreApi as StoreApi$1 } from 'zustand';
|
|
15
|
+
import { C as ComplexTimelineStrategy, T as TimelineKeyframe, U as UnknownStrategy, M as MediaStrategy, d as ImageServiceLoaderType } from './useRenderingStrategy-DUTiqfD8.cjs';
|
|
16
|
+
export { f as AnnotationPageDescription, A as AudioSequence, m as ChoiceEvents, E as EmptyStrategy, I as ImageWithOptionalService, R as RenderingStrategy, j as Single3DModelStrategy, b as SingleAudio, a as SingleImageStrategy, c as SingleVideo, e as SingleYouTubeVideo, S as StrategyActions, h as TextualContentStrategy, l as UseRenderingStrategy, n as UseRenderingStrategyOptions, V as VideoSequence, k as get3dStrategy, g as getImageStrategy, i as getTextualContentStrategy, u as useLoadImageService, o as useRenderingStrategy } from './useRenderingStrategy-DUTiqfD8.cjs';
|
|
13
17
|
import * as mitt from 'mitt';
|
|
14
18
|
import { Emitter, EventType, Handler } from 'mitt';
|
|
15
19
|
import { Vault, VaultOptions, NormalizedEntity, IIIFStore } from '@iiif/helpers/vault';
|
|
16
|
-
import * as zustand from 'zustand';
|
|
17
20
|
import * as _iiif_helpers from '@iiif/helpers';
|
|
18
21
|
import { Paintables, ComplexChoice } from '@iiif/helpers';
|
|
19
22
|
import { CanvasNormalized, AnnotationNormalized, AnnotationPageNormalized, CollectionNormalized, ManifestNormalized, RangeNormalized } from '@iiif/presentation-3-normalized';
|
|
20
|
-
import { R as RenderingStrategy } from './useRenderingStrategy-D2R_H2aP.cjs';
|
|
21
|
-
export { e as AnnotationPageDescription, A as AudioSequence, l as ChoiceEvents, C as ComplexTimelineStrategy, E as EmptyStrategy, j as ImageServiceLoaderType, I as ImageWithOptionalService, M as MediaStrategy, h as Single3DModelStrategy, b as SingleAudio, a as SingleImageStrategy, c as SingleVideo, d as SingleYouTubeVideo, S as StrategyActions, T as TextualContentStrategy, U as UnknownStrategy, k as UseRenderingStrategy, m as UseRenderingStrategyOptions, V as VideoSequence, i as get3dStrategy, g as getImageStrategy, f as getTextualContentStrategy, u as useLoadImageService, n as useRenderingStrategy } from './useRenderingStrategy-D2R_H2aP.cjs';
|
|
22
23
|
export { emptyActions, emptyStrategy, getParsedTargetSelector, getRenderingStrategy, parseSpecificResource, unknownResponse, unsupportedStrategy } from './utils.cjs';
|
|
23
24
|
import { VaultZustandStore } from '@iiif/helpers/vault/store';
|
|
24
25
|
import * as _iiif_helpers_painting_annotations from '@iiif/helpers/painting-annotations';
|
|
@@ -445,23 +446,6 @@ declare function CollectionContext({ collection, children }: {
|
|
|
445
446
|
children: ReactNode;
|
|
446
447
|
}): react_jsx_runtime.JSX.Element;
|
|
447
448
|
|
|
448
|
-
interface EventContext {
|
|
449
|
-
emitter: Emitter<any>;
|
|
450
|
-
}
|
|
451
|
-
declare const defaultEmitter: Emitter<Record<EventType, unknown>>;
|
|
452
|
-
declare const ReactEventContext: React__default.Context<{
|
|
453
|
-
emitter: Emitter<Record<EventType, unknown>>;
|
|
454
|
-
}>;
|
|
455
|
-
declare function useEventEmitter<Events extends Record<EventType, unknown>>(): Emitter<Events>;
|
|
456
|
-
declare function EventsProvider({ emitter, children }: EventContext & {
|
|
457
|
-
children: React__default.ReactNode;
|
|
458
|
-
}): react_jsx_runtime.JSX.Element;
|
|
459
|
-
|
|
460
|
-
declare function ManifestContext({ manifest, children }: {
|
|
461
|
-
manifest: string;
|
|
462
|
-
children: ReactNode;
|
|
463
|
-
}): react_jsx_runtime.JSX.Element;
|
|
464
|
-
|
|
465
449
|
type MediaPlayerState = {
|
|
466
450
|
isPlaying: boolean;
|
|
467
451
|
isMuted: boolean;
|
|
@@ -494,6 +478,58 @@ declare function useSimpleMediaPlayer(props: {
|
|
|
494
478
|
MediaPlayerActions
|
|
495
479
|
];
|
|
496
480
|
|
|
481
|
+
interface ComplexTimelineStore extends MediaPlayerActions {
|
|
482
|
+
complexTimeline: ComplexTimelineStrategy;
|
|
483
|
+
visibleElements: Record<string, TimelineKeyframe | null>;
|
|
484
|
+
isReady: boolean;
|
|
485
|
+
isBuffering: boolean;
|
|
486
|
+
bufferMap: Record<string, boolean>;
|
|
487
|
+
isMuted: boolean;
|
|
488
|
+
playRequested: boolean;
|
|
489
|
+
isPlaying: boolean;
|
|
490
|
+
isFinished: boolean;
|
|
491
|
+
volume: number;
|
|
492
|
+
duration: number;
|
|
493
|
+
primeTime: number;
|
|
494
|
+
clockRunning: boolean;
|
|
495
|
+
clockStartTime: number;
|
|
496
|
+
currentPrime: TimelineKeyframe | null;
|
|
497
|
+
clockStartRequests: number;
|
|
498
|
+
startClock: () => void;
|
|
499
|
+
stopClock: () => void;
|
|
500
|
+
setElement: (id: string, element: HTMLVideoElement | HTMLAudioElement) => void;
|
|
501
|
+
removeElement: (id: string) => void;
|
|
502
|
+
applyKeyframes(newIdx: number, keyframes: TimelineKeyframe[]): void;
|
|
503
|
+
nextKeyframeIndex: number;
|
|
504
|
+
setProgressElement(div: HTMLDivElement): void;
|
|
505
|
+
setCurrentTimeElement(div: HTMLDivElement): void;
|
|
506
|
+
clearProgressElement(): void;
|
|
507
|
+
clearCurrentTimeElement(): void;
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
declare function ComplexTimelineProvider({ children, store, }: {
|
|
511
|
+
children: React.ReactNode;
|
|
512
|
+
store: StoreApi$1<ComplexTimelineStore>;
|
|
513
|
+
}): react_jsx_runtime.JSX.Element;
|
|
514
|
+
declare function useComplexTimeline<T>(selector: (store: ComplexTimelineStore) => T): T;
|
|
515
|
+
|
|
516
|
+
interface EventContext {
|
|
517
|
+
emitter: Emitter<any>;
|
|
518
|
+
}
|
|
519
|
+
declare const defaultEmitter: Emitter<Record<EventType, unknown>>;
|
|
520
|
+
declare const ReactEventContext: React__default.Context<{
|
|
521
|
+
emitter: Emitter<Record<EventType, unknown>>;
|
|
522
|
+
}>;
|
|
523
|
+
declare function useEventEmitter<Events extends Record<EventType, unknown>>(): Emitter<Events>;
|
|
524
|
+
declare function EventsProvider({ emitter, children }: EventContext & {
|
|
525
|
+
children: React__default.ReactNode;
|
|
526
|
+
}): react_jsx_runtime.JSX.Element;
|
|
527
|
+
|
|
528
|
+
declare function ManifestContext({ manifest, children }: {
|
|
529
|
+
manifest: string;
|
|
530
|
+
children: ReactNode;
|
|
531
|
+
}): react_jsx_runtime.JSX.Element;
|
|
532
|
+
|
|
497
533
|
declare function useMediaState(): MediaPlayerState;
|
|
498
534
|
declare function useMediaActions(): MediaPlayerActions;
|
|
499
535
|
declare function useMediaElements(): {
|
|
@@ -691,7 +727,9 @@ declare function AnnotationStyleProvider({ theme, children, }: {
|
|
|
691
727
|
children: React.ReactNode;
|
|
692
728
|
}): react_jsx_runtime.JSX.Element;
|
|
693
729
|
|
|
694
|
-
declare function getVideoStrategy(canvas: CanvasNormalized, paintables: Paintables):
|
|
730
|
+
declare function getVideoStrategy(canvas: CanvasNormalized, paintables: Paintables): UnknownStrategy | MediaStrategy;
|
|
731
|
+
|
|
732
|
+
declare function getComplexTimelineStrategy(canvas: CanvasNormalized, paintables: Paintables, loadImageService: ImageServiceLoaderType): ComplexTimelineStrategy;
|
|
695
733
|
|
|
696
734
|
declare function useAnnotation(options?: {
|
|
697
735
|
id: string;
|
|
@@ -986,7 +1024,7 @@ declare function LanguageProvider(props: {
|
|
|
986
1024
|
children: ReactNode;
|
|
987
1025
|
}): react_jsx_runtime.JSX.Element;
|
|
988
1026
|
declare function TransliterationProvider(props: {
|
|
989
|
-
convert: null | ((input: string) => string);
|
|
1027
|
+
convert: null | ((input: string, targetLang: string) => string);
|
|
990
1028
|
children: ReactNode;
|
|
991
1029
|
}): react_jsx_runtime.JSX.Element;
|
|
992
1030
|
declare function useTransliteration(): ((input: string, targetLang: string) => string) | null;
|
|
@@ -1082,4 +1120,4 @@ declare function findAllCanvasesInRange(vault: Vault, range: RangeNormalized): A
|
|
|
1082
1120
|
declare function findManifestSelectedRange(vault: Vault, manifest: ManifestNormalized, canvasId: string): null | RangeNormalized;
|
|
1083
1121
|
declare function findSelectedRange(vault: Vault, range: RangeNormalized, canvasId: string): null | RangeNormalized;
|
|
1084
1122
|
|
|
1085
|
-
export { AnnotationContext, AnnotationPageContext, AnnotationStyleProvider, type AnnotationStyles, type AnnotationThemeDefinition, Auth, type AuthAccessState, type AuthContextActions, type AuthContextCurrentActions, type AuthContextState, AuthProvider, AuthRContext, AuthReactContext, AuthReactContextActions, type AuthState, CanvasAnnotations, CanvasContext, CollectionContext, CombinedMetadata, ContextBridge, CreateCustomShape, type CreateCustomShapeProps, EventsProvider, Image, type ImageProps, ImageServiceLoaderContext, type ImageServiceRequestOptions, InnerViewerProvider, LanguageProvider, LanguageString, LocaleString, ManifestContext, ManifestMetadata, type MediaPlayerActions, MediaPlayerProvider, type MediaPlayerState, Metadata, type MetadataProps, PolygonSelector, type PolygonSelectorProps, type ProbeStore, RangeContext, ReactEventContext, ReactVaultContext, RenderSvgEditorControls,
|
|
1123
|
+
export { AnnotationContext, AnnotationPageContext, AnnotationStyleProvider, type AnnotationStyles, type AnnotationThemeDefinition, Auth, type AuthAccessState, type AuthContextActions, type AuthContextCurrentActions, type AuthContextState, AuthProvider, AuthRContext, AuthReactContext, AuthReactContextActions, type AuthState, CanvasAnnotations, CanvasContext, CollectionContext, CombinedMetadata, ComplexTimelineProvider, ComplexTimelineStrategy, ContextBridge, CreateCustomShape, type CreateCustomShapeProps, EventsProvider, Image, type ImageProps, ImageServiceLoaderContext, ImageServiceLoaderType, type ImageServiceRequestOptions, InnerViewerProvider, LanguageProvider, LanguageString, LocaleString, ManifestContext, ManifestMetadata, type MediaPlayerActions, MediaPlayerProvider, type MediaPlayerState, MediaStrategy, Metadata, type MetadataProps, PolygonSelector, type PolygonSelectorProps, type ProbeStore, RangeContext, ReactEventContext, ReactVaultContext, RenderSvgEditorControls, type ResourceContextType, ResourceProvider, ResourceReactContext, type ResourceRequestOptions, SelectorControllerProvider, type SelectorHelperEventTypes, SequenceThumbnails, SimpleViewerContext, SimpleViewerProps, SimpleViewerProvider, SimpleViewerReactContext, SingleCanvasThumbnail, type SvgTheme, TimelineKeyframe, TranslationProvider, TransliterationProvider, UnknownStrategy, type VaultActivatedAnnotation, VaultProvider, ViewerPresetContext, VirtualAnnotationProvider, VisibleCanvasReactContext, authDetailsForResource, createAuthStateStore, createProbe, defaultEmitter, findAllCanvasesInRange, findFirstCanvasFromRange, findManifestSelectedRange, findSelectedRange, flattenAnnotationPageIds, formatTime, getComplexTimelineStrategy, getDefaultAnnotationStyles, getManifestSequence, getVideoStrategy, getVisibleCanvasesFromCanvasId, hasAuth, makeAccessServiceRequest, makeAccessTokenRequest, svgThemes, useAnnotation, useAnnotationPage, useAnnotationPageManager, useAnnotationStyles, useAnnotationsAtTime, useAuthActions, useAuthService, useAuthStore, useAuthToken, useAuthTokens, useCanvas, useCanvasChoices, useCanvasClock, useCanvasSequence, useCanvasStartTime, useCanvasSubset, useClosestLanguage, useCollection, useComplexTimeline, useContextBridge, useCreateLocaleString, useCurrentAuth, useDispatch, useEventEmitter, useEventListener, useExistingVault, useExternalCollection, useExternalManifest, useExternalResource, useIIIFLanguage, useImage, useImageService, useImageServiceLoader, useImageTile, useIsAuthEnabled, useLocaleString, useManifest, useMediaActions, useMediaElements, useMediaState, usePaintables, usePaintingAnnotations, usePolygonHelper, useRange, useResourceContext, useResourceEvents, useResources, useSearchService, useSelectorController, useSelectorEmitter, useSelectorEvents, useSelectorHelper, useSimpleMediaPlayer, useSimpleViewer, useStyleHelper, useStyles, useSvgEditor, useThumbnail, useTranslations, useTransliteration, useVault, useVaultEffect, useVaultSelector, useViewerPreset, useVirtualAnnotationPage, useVirtualAnnotationPageContext, useVisibleCanvases };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { S as SimpleViewerContext, a as SimpleViewerProps } from './index-
|
|
2
|
-
export { C as CanvasPanel, c as SimpleViewerActions, d as SimpleViewerActionsType, b as SimpleViewerReducerState } from './index-
|
|
1
|
+
import { S as SimpleViewerContext, a as SimpleViewerProps } from './index-Bm0eAQri.js';
|
|
2
|
+
export { C as CanvasPanel, c as SimpleViewerActions, d as SimpleViewerActionsType, b as SimpleViewerReducerState } from './index-Bm0eAQri.js';
|
|
3
3
|
import * as React$1 from 'react';
|
|
4
4
|
import React__default, { ReactNode, FunctionComponent, RefObject } from 'react';
|
|
5
5
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
@@ -10,15 +10,16 @@ import { RenderState, InputShape, SlowState } from 'polygon-editor';
|
|
|
10
10
|
import { BoxStyle, Preset } from '@atlas-viewer/atlas';
|
|
11
11
|
import * as zustand_vanilla from 'zustand/vanilla';
|
|
12
12
|
import { StoreApi } from 'zustand/vanilla';
|
|
13
|
+
import * as zustand from 'zustand';
|
|
14
|
+
import { StoreApi as StoreApi$1 } from 'zustand';
|
|
15
|
+
import { C as ComplexTimelineStrategy, T as TimelineKeyframe, U as UnknownStrategy, M as MediaStrategy, d as ImageServiceLoaderType } from './useRenderingStrategy-DUTiqfD8.js';
|
|
16
|
+
export { f as AnnotationPageDescription, A as AudioSequence, m as ChoiceEvents, E as EmptyStrategy, I as ImageWithOptionalService, R as RenderingStrategy, j as Single3DModelStrategy, b as SingleAudio, a as SingleImageStrategy, c as SingleVideo, e as SingleYouTubeVideo, S as StrategyActions, h as TextualContentStrategy, l as UseRenderingStrategy, n as UseRenderingStrategyOptions, V as VideoSequence, k as get3dStrategy, g as getImageStrategy, i as getTextualContentStrategy, u as useLoadImageService, o as useRenderingStrategy } from './useRenderingStrategy-DUTiqfD8.js';
|
|
13
17
|
import * as mitt from 'mitt';
|
|
14
18
|
import { Emitter, EventType, Handler } from 'mitt';
|
|
15
19
|
import { Vault, VaultOptions, NormalizedEntity, IIIFStore } from '@iiif/helpers/vault';
|
|
16
|
-
import * as zustand from 'zustand';
|
|
17
20
|
import * as _iiif_helpers from '@iiif/helpers';
|
|
18
21
|
import { Paintables, ComplexChoice } from '@iiif/helpers';
|
|
19
22
|
import { CanvasNormalized, AnnotationNormalized, AnnotationPageNormalized, CollectionNormalized, ManifestNormalized, RangeNormalized } from '@iiif/presentation-3-normalized';
|
|
20
|
-
import { R as RenderingStrategy } from './useRenderingStrategy-D2R_H2aP.js';
|
|
21
|
-
export { e as AnnotationPageDescription, A as AudioSequence, l as ChoiceEvents, C as ComplexTimelineStrategy, E as EmptyStrategy, j as ImageServiceLoaderType, I as ImageWithOptionalService, M as MediaStrategy, h as Single3DModelStrategy, b as SingleAudio, a as SingleImageStrategy, c as SingleVideo, d as SingleYouTubeVideo, S as StrategyActions, T as TextualContentStrategy, U as UnknownStrategy, k as UseRenderingStrategy, m as UseRenderingStrategyOptions, V as VideoSequence, i as get3dStrategy, g as getImageStrategy, f as getTextualContentStrategy, u as useLoadImageService, n as useRenderingStrategy } from './useRenderingStrategy-D2R_H2aP.js';
|
|
22
23
|
export { emptyActions, emptyStrategy, getParsedTargetSelector, getRenderingStrategy, parseSpecificResource, unknownResponse, unsupportedStrategy } from './utils.js';
|
|
23
24
|
import { VaultZustandStore } from '@iiif/helpers/vault/store';
|
|
24
25
|
import * as _iiif_helpers_painting_annotations from '@iiif/helpers/painting-annotations';
|
|
@@ -445,23 +446,6 @@ declare function CollectionContext({ collection, children }: {
|
|
|
445
446
|
children: ReactNode;
|
|
446
447
|
}): react_jsx_runtime.JSX.Element;
|
|
447
448
|
|
|
448
|
-
interface EventContext {
|
|
449
|
-
emitter: Emitter<any>;
|
|
450
|
-
}
|
|
451
|
-
declare const defaultEmitter: Emitter<Record<EventType, unknown>>;
|
|
452
|
-
declare const ReactEventContext: React__default.Context<{
|
|
453
|
-
emitter: Emitter<Record<EventType, unknown>>;
|
|
454
|
-
}>;
|
|
455
|
-
declare function useEventEmitter<Events extends Record<EventType, unknown>>(): Emitter<Events>;
|
|
456
|
-
declare function EventsProvider({ emitter, children }: EventContext & {
|
|
457
|
-
children: React__default.ReactNode;
|
|
458
|
-
}): react_jsx_runtime.JSX.Element;
|
|
459
|
-
|
|
460
|
-
declare function ManifestContext({ manifest, children }: {
|
|
461
|
-
manifest: string;
|
|
462
|
-
children: ReactNode;
|
|
463
|
-
}): react_jsx_runtime.JSX.Element;
|
|
464
|
-
|
|
465
449
|
type MediaPlayerState = {
|
|
466
450
|
isPlaying: boolean;
|
|
467
451
|
isMuted: boolean;
|
|
@@ -494,6 +478,58 @@ declare function useSimpleMediaPlayer(props: {
|
|
|
494
478
|
MediaPlayerActions
|
|
495
479
|
];
|
|
496
480
|
|
|
481
|
+
interface ComplexTimelineStore extends MediaPlayerActions {
|
|
482
|
+
complexTimeline: ComplexTimelineStrategy;
|
|
483
|
+
visibleElements: Record<string, TimelineKeyframe | null>;
|
|
484
|
+
isReady: boolean;
|
|
485
|
+
isBuffering: boolean;
|
|
486
|
+
bufferMap: Record<string, boolean>;
|
|
487
|
+
isMuted: boolean;
|
|
488
|
+
playRequested: boolean;
|
|
489
|
+
isPlaying: boolean;
|
|
490
|
+
isFinished: boolean;
|
|
491
|
+
volume: number;
|
|
492
|
+
duration: number;
|
|
493
|
+
primeTime: number;
|
|
494
|
+
clockRunning: boolean;
|
|
495
|
+
clockStartTime: number;
|
|
496
|
+
currentPrime: TimelineKeyframe | null;
|
|
497
|
+
clockStartRequests: number;
|
|
498
|
+
startClock: () => void;
|
|
499
|
+
stopClock: () => void;
|
|
500
|
+
setElement: (id: string, element: HTMLVideoElement | HTMLAudioElement) => void;
|
|
501
|
+
removeElement: (id: string) => void;
|
|
502
|
+
applyKeyframes(newIdx: number, keyframes: TimelineKeyframe[]): void;
|
|
503
|
+
nextKeyframeIndex: number;
|
|
504
|
+
setProgressElement(div: HTMLDivElement): void;
|
|
505
|
+
setCurrentTimeElement(div: HTMLDivElement): void;
|
|
506
|
+
clearProgressElement(): void;
|
|
507
|
+
clearCurrentTimeElement(): void;
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
declare function ComplexTimelineProvider({ children, store, }: {
|
|
511
|
+
children: React.ReactNode;
|
|
512
|
+
store: StoreApi$1<ComplexTimelineStore>;
|
|
513
|
+
}): react_jsx_runtime.JSX.Element;
|
|
514
|
+
declare function useComplexTimeline<T>(selector: (store: ComplexTimelineStore) => T): T;
|
|
515
|
+
|
|
516
|
+
interface EventContext {
|
|
517
|
+
emitter: Emitter<any>;
|
|
518
|
+
}
|
|
519
|
+
declare const defaultEmitter: Emitter<Record<EventType, unknown>>;
|
|
520
|
+
declare const ReactEventContext: React__default.Context<{
|
|
521
|
+
emitter: Emitter<Record<EventType, unknown>>;
|
|
522
|
+
}>;
|
|
523
|
+
declare function useEventEmitter<Events extends Record<EventType, unknown>>(): Emitter<Events>;
|
|
524
|
+
declare function EventsProvider({ emitter, children }: EventContext & {
|
|
525
|
+
children: React__default.ReactNode;
|
|
526
|
+
}): react_jsx_runtime.JSX.Element;
|
|
527
|
+
|
|
528
|
+
declare function ManifestContext({ manifest, children }: {
|
|
529
|
+
manifest: string;
|
|
530
|
+
children: ReactNode;
|
|
531
|
+
}): react_jsx_runtime.JSX.Element;
|
|
532
|
+
|
|
497
533
|
declare function useMediaState(): MediaPlayerState;
|
|
498
534
|
declare function useMediaActions(): MediaPlayerActions;
|
|
499
535
|
declare function useMediaElements(): {
|
|
@@ -691,7 +727,9 @@ declare function AnnotationStyleProvider({ theme, children, }: {
|
|
|
691
727
|
children: React.ReactNode;
|
|
692
728
|
}): react_jsx_runtime.JSX.Element;
|
|
693
729
|
|
|
694
|
-
declare function getVideoStrategy(canvas: CanvasNormalized, paintables: Paintables):
|
|
730
|
+
declare function getVideoStrategy(canvas: CanvasNormalized, paintables: Paintables): UnknownStrategy | MediaStrategy;
|
|
731
|
+
|
|
732
|
+
declare function getComplexTimelineStrategy(canvas: CanvasNormalized, paintables: Paintables, loadImageService: ImageServiceLoaderType): ComplexTimelineStrategy;
|
|
695
733
|
|
|
696
734
|
declare function useAnnotation(options?: {
|
|
697
735
|
id: string;
|
|
@@ -986,7 +1024,7 @@ declare function LanguageProvider(props: {
|
|
|
986
1024
|
children: ReactNode;
|
|
987
1025
|
}): react_jsx_runtime.JSX.Element;
|
|
988
1026
|
declare function TransliterationProvider(props: {
|
|
989
|
-
convert: null | ((input: string) => string);
|
|
1027
|
+
convert: null | ((input: string, targetLang: string) => string);
|
|
990
1028
|
children: ReactNode;
|
|
991
1029
|
}): react_jsx_runtime.JSX.Element;
|
|
992
1030
|
declare function useTransliteration(): ((input: string, targetLang: string) => string) | null;
|
|
@@ -1082,4 +1120,4 @@ declare function findAllCanvasesInRange(vault: Vault, range: RangeNormalized): A
|
|
|
1082
1120
|
declare function findManifestSelectedRange(vault: Vault, manifest: ManifestNormalized, canvasId: string): null | RangeNormalized;
|
|
1083
1121
|
declare function findSelectedRange(vault: Vault, range: RangeNormalized, canvasId: string): null | RangeNormalized;
|
|
1084
1122
|
|
|
1085
|
-
export { AnnotationContext, AnnotationPageContext, AnnotationStyleProvider, type AnnotationStyles, type AnnotationThemeDefinition, Auth, type AuthAccessState, type AuthContextActions, type AuthContextCurrentActions, type AuthContextState, AuthProvider, AuthRContext, AuthReactContext, AuthReactContextActions, type AuthState, CanvasAnnotations, CanvasContext, CollectionContext, CombinedMetadata, ContextBridge, CreateCustomShape, type CreateCustomShapeProps, EventsProvider, Image, type ImageProps, ImageServiceLoaderContext, type ImageServiceRequestOptions, InnerViewerProvider, LanguageProvider, LanguageString, LocaleString, ManifestContext, ManifestMetadata, type MediaPlayerActions, MediaPlayerProvider, type MediaPlayerState, Metadata, type MetadataProps, PolygonSelector, type PolygonSelectorProps, type ProbeStore, RangeContext, ReactEventContext, ReactVaultContext, RenderSvgEditorControls,
|
|
1123
|
+
export { AnnotationContext, AnnotationPageContext, AnnotationStyleProvider, type AnnotationStyles, type AnnotationThemeDefinition, Auth, type AuthAccessState, type AuthContextActions, type AuthContextCurrentActions, type AuthContextState, AuthProvider, AuthRContext, AuthReactContext, AuthReactContextActions, type AuthState, CanvasAnnotations, CanvasContext, CollectionContext, CombinedMetadata, ComplexTimelineProvider, ComplexTimelineStrategy, ContextBridge, CreateCustomShape, type CreateCustomShapeProps, EventsProvider, Image, type ImageProps, ImageServiceLoaderContext, ImageServiceLoaderType, type ImageServiceRequestOptions, InnerViewerProvider, LanguageProvider, LanguageString, LocaleString, ManifestContext, ManifestMetadata, type MediaPlayerActions, MediaPlayerProvider, type MediaPlayerState, MediaStrategy, Metadata, type MetadataProps, PolygonSelector, type PolygonSelectorProps, type ProbeStore, RangeContext, ReactEventContext, ReactVaultContext, RenderSvgEditorControls, type ResourceContextType, ResourceProvider, ResourceReactContext, type ResourceRequestOptions, SelectorControllerProvider, type SelectorHelperEventTypes, SequenceThumbnails, SimpleViewerContext, SimpleViewerProps, SimpleViewerProvider, SimpleViewerReactContext, SingleCanvasThumbnail, type SvgTheme, TimelineKeyframe, TranslationProvider, TransliterationProvider, UnknownStrategy, type VaultActivatedAnnotation, VaultProvider, ViewerPresetContext, VirtualAnnotationProvider, VisibleCanvasReactContext, authDetailsForResource, createAuthStateStore, createProbe, defaultEmitter, findAllCanvasesInRange, findFirstCanvasFromRange, findManifestSelectedRange, findSelectedRange, flattenAnnotationPageIds, formatTime, getComplexTimelineStrategy, getDefaultAnnotationStyles, getManifestSequence, getVideoStrategy, getVisibleCanvasesFromCanvasId, hasAuth, makeAccessServiceRequest, makeAccessTokenRequest, svgThemes, useAnnotation, useAnnotationPage, useAnnotationPageManager, useAnnotationStyles, useAnnotationsAtTime, useAuthActions, useAuthService, useAuthStore, useAuthToken, useAuthTokens, useCanvas, useCanvasChoices, useCanvasClock, useCanvasSequence, useCanvasStartTime, useCanvasSubset, useClosestLanguage, useCollection, useComplexTimeline, useContextBridge, useCreateLocaleString, useCurrentAuth, useDispatch, useEventEmitter, useEventListener, useExistingVault, useExternalCollection, useExternalManifest, useExternalResource, useIIIFLanguage, useImage, useImageService, useImageServiceLoader, useImageTile, useIsAuthEnabled, useLocaleString, useManifest, useMediaActions, useMediaElements, useMediaState, usePaintables, usePaintingAnnotations, usePolygonHelper, useRange, useResourceContext, useResourceEvents, useResources, useSearchService, useSelectorController, useSelectorEmitter, useSelectorEvents, useSelectorHelper, useSimpleMediaPlayer, useSimpleViewer, useStyleHelper, useStyles, useSvgEditor, useThumbnail, useTranslations, useTransliteration, useVault, useVaultEffect, useVaultSelector, useViewerPreset, useVirtualAnnotationPage, useVirtualAnnotationPageContext, useVisibleCanvases };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{$ as wo,A as to,Aa as on,B as oo,Ba as D,C as no,Ca as nn,D as ro,Da as mn,E as io,Ea as un,F as ao,Fa as le,G as so,Ga as dn,H as lo,Ha as fn,I as co,Ia as gn,J as mo,Ja as pn,K as uo,Ka as hn,L as fo,La as yn,M as go,Ma as vn,N as po,Na as ce,O as ho,P as yo,Q as vo,R as xo,S as bo,T as So,U as ie,V as Co,W as Io,X as ae,Y as ko,Z as Po,_ as To,a as Wt,aa as Ro,b as A,ba as Eo,c as B,ca as Mo,d as Dt,da as No,e as Ft,ea as Bo,f as Ot,fa as T,g as te,ga as Lo,h as $t,ha as Ho,i as Vt,ia as Ao,j as oe,ja as zo,k as P,ka as qo,l as z,la as Wo,m as Xt,ma as Do,n as ne,na as Fo,o as q,oa as Oo,p as Yt,pa as $o,q as _t,qa as Vo,r as Kt,ra as Xo,s as Qt,sa as Yo,t as Ut,ta as _o,u as Gt,ua as N,v as Jt,va as jo,w as re,wa as se,x as Zt,xa as en,y as jt,ya as tn,z as eo,za as W}from"./chunk-QKLET6KX.js";import{a as Ko,b as Qo,c as Uo,d as Go,e as Jo,f as Zo,g as rn,h as an,i as sn,j as ln,k as cn}from"./chunk-DXFXJCXN.js";import{useCanvas as We}from"@atlas-viewer/atlas";import{forwardRef as De,useImperativeHandle as Fe}from"react";import{Fragment as Oe,jsx as me}from"react/jsx-runtime";var kn=De(function({canvasId:t},o){let n=We(),i=se(t||n?.id),a=P();return Fe(o,()=>i,[t,n]),!n||i.enabledPageIds.length===0?null:me(Oe,{children:i.enabledPageIds.map(s=>me(ce.RenderAnnotationPage,{page:a.get(s)},s))})});import{useMemo as Xe}from"react";import{useMemo as $e}from"react";import{Fragment as Ve,jsx as C,jsxs as F}from"react/jsx-runtime";function O({metadata:e=[],config:t,labelWidth:o=16,showEmptyMessage:n=!0,allowHtml:i,emptyFallback:a,classes:s={},emptyMessage:l="No metadata available",emptyValueFallback:u="No value",emptyLabelFallback:m="",separator:c,tableFooter:f,tableHeader:x}){let y=$e(()=>{let p=(t||[]).reduce((g,b)=>[...g,...b.keys],[]),d={};for(let g of e){let b=g&&g.label?Object.values(g.label):[];for(let r of b)if(r&&r.length&&(p.indexOf(`metadata.${r[0]}`)!==-1||p.length===0)&&g){let S=`metadata.${r[0]}`;d[S]=d[S]?d[S]:[],d[S].push(g);break}}return d},[t,e]);return Object.keys(y).length===0&&n?C(Ve,{children:a})||C("div",{className:s.empty,children:l}):t&&t.length?F("table",{className:s.container,children:[x,C("tbody",{children:t.map((p,d)=>{let g=[];for(let b of p.keys)for(let r of y[b]||[])g.push(C(N,{enableDangerouslySetInnerHTML:i,defaultText:u,separator:c,children:r.value},d+"__"+b));return g.length===0?null:F("tr",{className:s.row,children:[C("td",{className:s.label,style:o?{minWidth:o}:{},children:C(N,{enableDangerouslySetInnerHTML:i,separator:c,defaultText:m,children:p.label})}),C("td",{className:s.value,children:g})]},d)})}),f]}):F("table",{className:s.container,children:[x,C("tbody",{children:e&&e.length?e.map((p,d)=>p?F("tr",{className:s.row,children:[C("td",{className:s.label,style:o?{minWidth:o}:{},children:C(N,{enableDangerouslySetInnerHTML:i,defaultText:u,separator:c,children:p.label})}),C("td",{className:s.value,children:C(N,{enableDangerouslySetInnerHTML:i,defaultText:u,separator:c,children:p.value})})]},d):null):null}),f]})}import{jsx as Ye}from"react/jsx-runtime";function qn(e){let t=q(),o=T(),n=re(),i=Xe(()=>{let a=t?.metadata||[],s=o?.metadata||[],l=n?.metadata||[];return[...a,...s,...l]},[t,o,n]);return Ye(O,{metadata:i,...e})}import{useEffect as Ue,useState as Ge}from"react";import{createImageServiceRequest as _e,imageServiceRequestToString as Ke}from"@atlas-viewer/iiif-image-api";import{useMemo as Qe}from"react";function Q(e,t={},o=[]){return Qe(()=>{if(!e)return null;let n=t.quality;e&&e.extraQualities&&t.quality&&(e.extraQualities.includes(t.quality)||(n="default"));let i=_e(e);return Ke({identifier:i.identifier,server:i.server,scheme:i.scheme,type:"image",size:{max:!t.size?.width&&!t.size?.height,confined:!1,upscaled:!1,...t.size||{}},format:t.format||"jpg",region:t.region||{full:!0},rotation:t?.rotation?Number.isInteger(t.rotation)?{angle:t.rotation}:t.rotation:{angle:0},quality:n||"default",prefix:i.prefix,originalPath:i.originalPath})},[...o])}import{jsx as $}from"react/jsx-runtime";function Je(e){let t=typeof e.src=="string"?e.src:e.src.id,o=W(),[n,i]=Ge(!1),a;if(t){let l=o.loadServiceSync({id:t});l&&(a=l)}!a&&!n&&o.loadService({id:t}).then(()=>{i(!0)});let s=Q(a,{size:e.size,selector:e.region,rotation:e.rotation,format:e.format,region:e.region,quality:e.quality},[n,e.src,e.size,e.region,e.rotation,e.format,e.region,e.quality]);return Ue(()=>()=>{i(!1)},[t]),s?$("img",{src:s,alt:e.alt,className:e.className,style:e.style}):$(Ze,{...e,fetchImageService:!1})}function Ze(e){if(e.fetchImageService)return $(Je,{...e});let t=typeof e.src=="string"?{id:e.src,profile:"level0"}:e.src,o=Q(t,{size:e.size,selector:e.region,rotation:e.rotation,format:e.format,region:e.region,quality:e.quality},[e.src,e.size,e.region,e.rotation,e.format,e.region,e.quality]);return o?$("img",{src:o,alt:e.alt,className:e.className,style:e.style}):null}import{jsx as je}from"react/jsx-runtime";function jn(e){let t=q();return je(O,{metadata:t?.metadata||[],...e})}import{useLayoutEffect as rt,useRef as it}from"react";import*as U from"react-lazy-load-image-component";import{getValue as et}from"@iiif/helpers/i18n";import{Fragment as ue,jsx as w,jsxs as nt}from"react/jsx-runtime";var{LazyLoadComponent:tt}=U||U.default;function de(e){let{size:t,visible:o,classes:n,canvasId:i,figure:a}=e,s=t?.width||128,l=t?.height||t?.width||128,u=w(ot,{...e}),m=w(tt,{threshold:300,style:{height:l,width:s},visibleByDefault:o,children:i?w(oe,{canvas:i,children:u}):u});return a?w("figure",{className:n?.figure,children:m}):m}function ot({fallback:e,size:t,classes:o,showLabel:n,alt:i,dereference:a=!1}){let s=T(),l=t?.width||128,u=t?.height||t?.width||128,m=i||et(s?.label)||"",c=le({width:l,height:u},a);return!c||c.type!=="fixed"?w(ue,{children:e}):nt(ue,{children:[w("div",{className:o?.imageWrapper,children:w("img",{className:o?.img,src:c.id,alt:m})}),n?w(N,{as:"figcaption",className:o?.label,children:s?.label}):null]})}import{jsx as L}from"react/jsx-runtime";function dr({flat:e,size:t,classes:o={},showLabel:n,figure:i,fallback:a}){let s=it(null),{items:l,sequence:u,currentSequenceIndex:m,setSequenceIndex:c}=ie(),f={row:o.selected?.row||o.row,item:o.selected?.item||o.item,figure:o.selected?.figure||o.figure,img:o.selected?.img||o.img,label:o.selected?.label||o.label,imageWrapper:o.selected?.imageWrapper||o.imageWrapper};rt(()=>{if(!s.current)return;let y=s.current.querySelector("[data-selected=true]");y&&y.scrollIntoView({behavior:"smooth",block:"nearest",inline:"center"})},[m]);let x=[];for(let y of u){let I=[],p=u[m]===y;for(let d of y){let g=l[d];I.push(L("div",{className:p?f.item:o.item,children:L(de,{classes:p?f:o,canvasId:g.id,size:t,showLabel:n,figure:i,placeholder:L("div",{style:{height:128,width:128}}),fallback:a})},d))}if(e){x.push(I);continue}x.push(L("div",{onClick:d=>{c(u.indexOf(y))},"data-selected":p,className:p?f.row:o.row,children:I}))}return L("div",{ref:s,className:o.container,children:x})}import{Fragment as fe,jsx as R,jsxs as ge}from"react/jsx-runtime";var at={draw:!0,polygon:!0,line:!0,lineBox:!0,square:!0,triangle:!0,hexagon:!0,circle:!0,delete:!0};function pr({helper:e,showShapes:t,state:o,enabled:n=at,classNames:i={},icons:a={}}){return ge(fe,{children:[t?ge(fe,{children:[n.draw&&R("button",{className:i.button,onClick:()=>{e.stamps.clear(),e.draw.enable()},"data-active":!o.lineMode&&!o.selectedStamp&&t&&o.drawMode,children:a.DrawIcon||"Draw"}),n.polygon&&R("button",{className:i.button,"data-active":!o.lineMode&&!o.selectedStamp&&t&&!o.drawMode,onClick:()=>{e.stamps.clear(),e.draw.disable(),e.modes.disableLineBoxMode(),e.modes.disableLineMode()},children:a.PolygonIcon||"Polygon"}),n.line&&R("button",{className:i.button,"data-active":o.lineMode&&!o.lineBoxMode,onClick:()=>{e.modes.enableLineMode()},children:a.LineIcon||"Line"}),n.lineBox&&R("button",{className:i.button,"data-active":o.lineBoxMode,onClick:()=>{e.modes.enableLineBoxMode()},children:a.LineBoxIcon||"LineBox"}),n.square&&R("button",{className:i.button,"data-active":o.selectedStamp?.id==="square",onClick:()=>{e.stamps.square()},children:a.SquareIcon||"Square"}),n.triangle&&R("button",{className:i.button,"data-active":o.selectedStamp?.id==="triangle",onClick:()=>{e.stamps.triangle()},children:a.TriangleIcon||"Triangle"}),n.hexagon&&R("button",{className:i.button,"data-active":o.selectedStamp?.id==="hexagon",onClick:()=>{e.stamps.hexagon()},children:a.HexagonIcon||"Hexagon"})]}):null,o.showBoundingBox&&n.delete&&R("button",{className:i.button,onClick:()=>e.key.down("Backspace"),children:a.DeleteForeverIcon||"Delete"})]})}import{createContext as st,useCallback as pe,useContext as ye,useEffect as he,useMemo as G,useState as lt}from"react";import ve from"mitt";import{jsx as ct}from"react/jsx-runtime";var V=st(ve());V.displayName="SelectorHelper";function Ir({children:e}){return ct(V.Provider,{value:G(()=>ve(),[]),children:e})}function kr(){return ye(V)}function xe(e){let t=be(),[o,n]=lt(!1);he(()=>t.withSelector(e).on("highlight",()=>{n(!0)}),[t,e]),he(()=>t.withSelector(e).on("clear-highlight",()=>{n(!1)}),[t,e]);let i=pe(s=>{t.emit("click",{selectorId:e,event:s})},[e,t]),a=pe(s=>{t.emit("hover",{selectorId:e,event:s})},[e,t]);return{controller:t,onClick:i,onHover:a,isHighlighted:o}}function be(){let e=ye(V);return G(()=>({withSelector(t){return{on(o,n){let i=a=>{a&&a.selectorId===t&&n(a)};return e.on(o,i),()=>{e.off(o,i)}},emit(o,n){e.emit(o,{...n,selectorId:t})}}},on(t,o){return e.on(t,o),()=>{e.off(t,o)}},emit(t,o){e.emit(t,o)}}),[e])}function Pr(){let e=be();return G(()=>({withSelector(t){return{highlight(){e.emit("highlight",{selectorId:t})},clearHighlight(){e.emit("clear-highlight",{selectorId:t})},zoomTo(){e.emit("zoom-to",{selectorId:t})},addEventListener(o,n){return e.emit("event-listener",{selectorId:t,name:o,callback:n}),()=>{e.emit("remove-event-listener",{selectorId:t,name:o,callback:n})}},getImagePreview(){return new Promise((o,n)=>{e.emit("image-preview-request",{selectorId:t,resolve:o,reject:n})})},on(o,n){return e.withSelector(t).on(o,n)}}},highlight(t){e.emit("highlight",{selectorId:t})},clearHighlight(t){e.emit("clear-highlight",{selectorId:t})},zoomTo(t){e.emit("zoom-to",{selectorId:t})},addEventListener(t,o,n){return e.emit("event-listener",{selectorId:t,name:o,callback:n}),()=>{e.emit("remove-event-listener",{selectorId:t,name:o,callback:n})}},getImagePreview(t){return new Promise((o,n)=>{e.emit("image-preview-request",{selectorId:t,resolve:o,reject:n})})},on(t,o){return e.on(t,o)}}),[e])}import{createContext as mt,useContext as ut,useMemo as dt}from"react";import{jsx as ft}from"react/jsx-runtime";function Se(){return{default:{backgroundColor:"rgba(0,0,0,0)",borderWidth:"2px",borderColor:"rgba(252,0,98, .5)"},highlighted:{backgroundColor:"rgba(75, 103, 225, 0.4)",borderWidth:"1px",borderColor:"rgba(75,103,225,0.99)"},hidden:{borderWidth:"0px",borderColor:"rgba(0,0,0,0)",backgroundColor:"rgba(0,0,0,0)",hidden:!0}}}var J=mt(Se());J.displayName="AnnotationStyle";function Ce(){return ut(J)}function Er({theme:e,children:t}){let o=dt(()=>e||Se(),[e]);return ft(J.Provider,{value:o,children:t})}import{HTMLPortal as xt,useAtlas as bt}from"@atlas-viewer/atlas";import{useEffect as ke,useRef as E,useState as Pe}from"react";import{useEffect as gt,useMemo as pt,useState as ht}from"react";import{createHelper as yt}from"polygon-editor";function Ie(e,t,o){let[n,i]=ht({}),a=pt(()=>yt(e,o),[]);return gt(()=>(a.clock.start(t,i),()=>{a.clock.stop()}),[]),{state:n,helper:a}}import{createSvgHelpers as vt}from"polygon-editor";import{Fragment as Te,jsx as v,jsxs as we}from"react/jsx-runtime";var M=vt();function Re(e,t){let{image:o,currentShape:n,onChange:i,hideShapeLines:a}=e,s=E(),l=E(),u=E(),m=E(),c=E(),f=E(),x=E(),y=E(),[I,p]=Pe(null),[d,g]=Pe(!1),{helper:b,state:r}=Ie(n,(h,k)=>{M.updateTransitionBoundingBox(l.current,h,k),M.updateBoundingBoxPolygon(s.current,h,k),M.updateTransitionShape(f.current,h,k),M.updateClosestLinePointTransform(m.current,h,k),M.updateSelectBox(u.current,h,k),M.updatePointLine(x.current,h,k),M.updateDrawPreview(c.current,h,k,3),M.updateLineBox(y.current,h),p(h.transitionDirection),g(h.transitionRotate)},i);ke(()=>{b.setShape(n||null)},t),ke(()=>{let h=()=>{b.modifiers.reset()};return document.addEventListener("mouseleave",h),()=>{document.removeEventListener("mouseleave",h)}},[]);let S=we(Te,{children:[v("marker",{id:"dot",viewBox:"0 0 10 10",refX:"5",refY:"5",markerWidth:"5",markerHeight:"5",children:v("circle",{cx:"5",cy:"5",r:"4",className:"marker"})}),v("marker",{id:"selected",viewBox:"0 0 10 10",refX:"5",refY:"5",markerWidth:"5",markerHeight:"5",children:v("circle",{cx:"5",cy:"5",r:"4",fill:"#FAFF00"})}),v("marker",{id:"resizer",viewBox:"0 0 10 10",refX:"5",refY:"5",markerWidth:"5",markerHeight:"5",children:v("rect",{width:"10",height:"10",stroke:"#FF0DCB",fill:"#fff",strokeWidth:2})})]}),_=n?n.open?"polyline":"polygon":null,ee=!r.showBoundingBox&&r.closestPoint!==null&&r.actionIntentType==="select-point",Ae=r.actionIntentType==="add-open-point",ze=r.transitionIntentType==="split-line",K=r.transitioning&&r.selectedStamp&&r.transitionIntentType==="stamp-shape",qe=n&&_?we(Te,{children:[v(_,{fill:!r.transitioning&&r.showBoundingBox?"rgba(255, 0, 0, .5)":"none",strokeWidth:K?0:2,stroke:a?"transparent":"#000",points:n.points.map(h=>h.join(",")).join(" "),vectorEffect:"non-scaling-stroke",markerStart:r.showBoundingBox?void 0:"url(#dot)",markerMid:r.showBoundingBox?void 0:"url(#dot)",markerEnd:r.showBoundingBox?void 0:"url(#dot)",style:{pointerEvents:"none"}}),r.lineBoxMode&&r.actionIntentType==="close-line-box"?v("polygon",{fill:"rgba(255, 0, 0, .4)",ref:y,stroke:"#000",strokeWidth:2,vectorEffect:"non-scaling-stroke"}):null,r.transitionIntentType==="draw-shape"&&r.transitioning?v("polyline",{ref:c,fill:"none",stroke:"rgba(255, 0, 0, .5)",strokeWidth:2,vectorEffect:"non-scaling-stroke"}):null,!r.showBoundingBox&&r.selectedPoints&&r.selectedPoints.length?v("polyline",{strokeWidth:2,vectorEffect:"non-scaling-stroke",stroke:"transparent",markerStart:"url(#selected)",markerMid:"url(#selected)",markerEnd:"url(#selected)",fill:"transparent",points:n.points.filter((h,k)=>r.selectedPoints?.includes(k)).map(h=>h.join(",")).join(" ")}):null,ee&&r.closestPoint!==null&&n.points[r.closestPoint]?v("polyline",{strokeWidth:2,vectorEffect:"non-scaling-stroke",stroke:"transparent",markerStart:"url(#selected)",markerMid:"url(#selected)",markerEnd:"url(#selected)",fill:"transparent",points:`${n.points[r.closestPoint][0]},${n.points[r.closestPoint][1]}`}):null,!r.transitioning&&(r.actionIntentType==="add-open-point"||r.actionIntentType==="close-shape"||r.actionIntentType==="close-shape-line")?v("polyline",{stroke:"#000",ref:x,strokeWidth:r.actionIntentType==="close-shape"?2:1,vectorEffect:"non-scaling-stroke"}):null,r.hasClosestLine&&(!r.transitionIntentType||r.transitionIntentType==="split-line")?v("g",{ref:m,children:v("polyline",{style:{opacity:.5},markerStart:"url(#dot)",points:"0,0 10,10",vectorEffect:"non-scaling-stroke",fill:"transparent",strokeWidth:2})}):null,r.transitioning?v(_,{ref:f,fill:n.open?"none":"rgba(255, 0, 0, .5)",stroke:"rgba(255, 0, 0, .5)",strokeWidth:n.open?2:0}):null,r.transitioning&&r.transitionIntentType==="select-multiple-points"?v("rect",{ref:u,fill:"rgba(255, 255, 255, .3)",strokeWidth:1,stroke:"rgba(0,0,0,.2)",vectorEffect:"non-scaling-stroke"}):null,r.showBoundingBox?null:v("g",{name:"controls",children:!1}),r.showBoundingBox&&!K?v("polygon",{ref:s,strokeWidth:2,stroke:"#FF0DCB",fill:"none",markerStart:"url(#resizer)",markerMid:"url(#resizer)",markerEnd:"url(#resizer)",vectorEffect:"non-scaling-stroke"}):null]}):null;return{helper:b,state:r,isAddingPoint:Ae,isSplitting:ze,isStamping:K,isHoveringPoint:ee,transitionDirection:I,transitionRotate:d,defs:S,editor:qe}}import{useEffect as Z}from"react";import{createPortal as St}from"react-dom";import{Fragment as Ee,jsx as H,jsxs as X}from"react/jsx-runtime";var Ct=[{name:"Default",outer:{borderWidth:4,borderColor:"rgba(255, 255, 255, .4)"},inner:{borderWidth:2,borderColor:"#000"}},{name:"High contrast",outer:{borderWidth:3,borderColor:"#fff"},inner:{borderWidth:1,borderColor:"#000"}},{name:"Lightsaber",outer:{borderWidth:"4",borderColor:"rgba(56,68,255,0.64)"},inner:{borderWidth:"2",borderColor:"#fff"}},{name:"Bright",outer:{borderWidth:"6",borderColor:"#25d527"},inner:{borderWidth:"3",borderColor:"#a916ff"}},{name:"pink",outer:{borderWidth:"4",borderColor:"#ff00ff"},inner:{borderWidth:"2",borderColor:"#ffffff"}},{name:"fine (dark)",outer:{borderWidth:"1",borderColor:"#000000"},inner:{}},{name:"fine (light)",outer:{borderWidth:"1",borderColor:"#FFF"},inner:{}}];function Me(e){let t=e.theme||Ct[0],o=bt(),{image:n}=e,{helper:i,defs:a,editor:s,state:l,transitionDirection:u,isSplitting:m,transitionRotate:c,isHoveringPoint:f,isAddingPoint:x,isStamping:y}=Re({currentShape:e.shape||null,onChange:e.updateShape,image:e.image,hideShapeLines:!0},[]),I=r=>{i.pointer([[~~r.atlas.x,~~r.atlas.y]])};Z(()=>{let r=S=>{i.key.up(S.key)};return document.addEventListener("keyup",r),()=>{document.removeEventListener("keyup",r)}},[]),Z(()=>{let r=S=>{i.key.down(S.key)};return document.addEventListener("keydown",r),()=>{document.removeEventListener("keydown",r)}},[]),Z(()=>{let r=[];return u&&r.push(`atlas-cursor-${u}`),l.actionIntentType==="cut-line"&&l.modifiers?.Shift&&r.push("atlas-cursor-cut"),(f||l.transitionIntentType==="move-shape"||l.transitionIntentType==="move-point")&&r.push("atlas-cursor-move"),x&&r.push("atlas-cursor-crosshair"),m&&r.push("atlas-cursor-copy"),c&&r.push("atlas-cursor-rotate"),l.transitionIntentType==="draw-shape"&&r.push("atlas-cursor-draw"),o?.canvas&&o.canvas.classList.add(...r),()=>{o?.canvas&&o.canvas.classList.remove(...r)}},[o?.canvas,x,f,m,l.modifiers?.Shift,l.actionIntentType,l.transitionIntentType,u,c]);let p=e.shape&&e.shape?.points.length===0,d=e.renderControls?e.renderControls(i,l,p):null,g=document.getElementById(e.controlsHtmlId||"atlas-controls"),b="shape";return H(Ee,{children:X("world-object",{height:n.height,width:n.width,onMouseMove:I,onMouseDown:i.pointerDown,onMouseUp:i.pointerUp,onMouseLeave:i.blur,children:[e.shape?X(Ee,{children:[H(b,{open:e.shape.open,points:e.shape.points,relativeStyle:!0,style:y?{}:t.outer}),H(b,{open:e.shape.open,points:e.shape.points,relativeStyle:!0,style:y?{}:t.inner})]}):null,X(xt,{relative:!0,interactive:!1,children:[H("div",{style:{position:"absolute",top:0,right:0,left:0,bottom:0},children:X("svg",{width:"100%",height:"100%",viewBox:`0 0 ${n.width} ${n.height}`,tabIndex:-1,children:[H("defs",{children:a}),s]})}),g?St(d,g,"controls"):null]})]})})}import{jsx as Ne}from"react/jsx-runtime";function ri(e){let t=T(),o=e.annotationBucket,n=e.readOnly,i=e.id,{onClick:a,isHighlighted:s}=xe(e.id),l=Ce(),u=s?l.highlighted:l[o||"hidden"]||l.hidden;if(!t)return null;if(n){let m="shape",c=e.polygon,f=c.open;return c?Ne(m,{id:`shape-${i}`,points:c.points,open:f,onClick:a,relativeStyle:!0,target:{x:0,y:0,width:t.width,height:t.height},style:u}):null}return Ne(Me,{image:t,shape:e.polygon||{id:e.id,open:!0,points:[]},updateShape:e.updatePolygon,theme:e.theme,controlsHtmlId:e.controlsHtmlId,renderControls:e.renderControls})}import{jsx as It}from"react/jsx-runtime";function li({annotation:e,children:t}){return It(B,{value:{annotation:e},children:t})}import{jsx as kt}from"react/jsx-runtime";function di({annotationPage:e,children:t}){return kt(B,{value:{annotationPage:e},children:t})}import{jsx as Pt}from"react/jsx-runtime";function hi({collection:e,children:t}){return Pt(B,{value:{collection:e},children:t})}function bi(e,t={}){return D(t)}import{useCanvas as Tt}from"@atlas-viewer/atlas";import{useEffect as wt,useMemo as j,useState as Rt}from"react";function Ti({canvasId:e}={}){let t=Tt(),o=ne(),n=j(()=>e?[e]:t?[t.id]:o.map(m=>m.id),[e,t,o]),[i,a]=Rt({}),s=ae();wt(()=>{let m=c=>{let f=c.partOf.canvasId;f&&a(x=>({...x,[f]:c.choice}))};return s.on("choice-change",m),()=>{s.off("choice-change",m)}},[]);let l=j(()=>{let m=[];for(let c of n){let f=i[c];f&&m.push({canvasId:c,choice:f})}return m},[n,i]),u=j(()=>({makeChoice:(m,c)=>{s.emit("make-choice",{choiceId:m,...c})}}),[s]);return{choices:l,actions:u}}function Ri(e,t=!1){}function Bi(e){let o=A().manifest,n=e?e.map(i=>typeof i=="string"?i:i?.id):[];return z(i=>{let a=o?i.iiif.entities.Manifest[o]:void 0,s=a?.items||[];if(typeof e>"u")return s;let l=[];for(let u of a?.items||[])n.indexOf(u.id)!==-1&&l.push(u);return l},[n.join("/")])}import{useMemo as Et}from"react";function qi(e,t=[]){let{id:o,selector:n}=e,i=A(),a=o||i.collection,s=z(l=>a?l.iiif.entities.Collection[a]:void 0,[a]);return Et(()=>{if(s)return n?n(s):s},[s,n,...t])}import{useEffect as Mt,useMemo as Nt}from"react";import{createEventsHelper as Bt}from"@iiif/helpers/events";function $i(e,t,o,n,i=[]){let a=P(),s=Nt(()=>Bt(a),[a]);Mt(()=>{let l=e;return l?(s.addEventListener(l,t,o,n),()=>{s.removeEventListener(l,t,o)}):()=>{}},[s,e,t,...i])}function _i(e,t){let{id:o,isLoaded:n,error:i,resource:a,requestId:s,cached:l}=te(e,t);return{id:o,isLoaded:n,error:i,manifest:a,requestId:s,cached:l}}import{getImageServices as Be}from"@atlas-viewer/iiif-image-api";import{useEffect as Lt,useMemo as Le,useState as Y}from"react";function He({cacheKey:e}={}){let t=T(),o=D(),n=P(),i=W(),[a,s]=Y(void 0),[l,u]=Y(!1),[m,c]=Y("idle"),[f,x]=Y(void 0),y=t?t.id:"undefined",I=Le(()=>{try{if(t&&o.length){let d=o[0],g=n.get(d.body[0]),r=Be(g)[0];return r&&i.loadServiceSync({id:r.id||r["@id"],width:r.width||t.width,height:r.height||t.height})||void 0}}catch(d){console.error(d)}},[y,e,t]),p=m==="success"&&a?a:I;return Lt(()=>{(async()=>{try{if(t&&o.length){let d=o[0],g=n.get(d.body[0]),r=Be(g)[0];if(!r)return;u(!0),c("loading");try{let S=await i.loadService({id:r.id||r["@id"],width:r.width||t.width,height:r.height||t.height})||void 0;s(S),c("success"),u(!1)}catch(S){c("error"),x(S)}}}catch(d){c("error"),x(d)}})()},[y,e]),Le(()=>({data:p,isFetching:l,status:m,error:f}),[p,l,m,f])}function oa(){let e=He();return{isLoading:e.isFetching,tile:e.data?{id:e.data.id||e.data["@id"],width:e.data.width,height:e.data.height,imageService:e.data,thumbnail:void 0}:null}}import{createStylesHelper as Ht}from"@iiif/helpers/styles";import{useMemo as At}from"react";function sa(){let e=P();return At(()=>Ht(e),[e])}export*from"@iiif/helpers/annotation-targets";export{li as AnnotationContext,di as AnnotationPageContext,Er as AnnotationStyleProvider,yo as Auth,lo as AuthProvider,io as AuthRContext,ao as AuthReactContext,so as AuthReactContextActions,kn as CanvasAnnotations,oe as CanvasContext,ce as CanvasPanel,hi as CollectionContext,qn as CombinedMetadata,To as ContextBridge,Me as CreateCustomShape,ko as EventsProvider,Ze as Image,tn as ImageServiceLoaderContext,bo as InnerViewerProvider,Wo as LanguageProvider,Vo as LanguageString,N as LocaleString,Vt as ManifestContext,jn as ManifestMetadata,yn as MediaPlayerProvider,O as Metadata,ri as PolygonSelector,Yt as RangeContext,Io as ReactEventContext,Dt as ReactVaultContext,pr as RenderSvgEditorControls,B as ResourceProvider,Wt as ResourceReactContext,Ir as SelectorControllerProvider,dr as SequenceThumbnails,So as SimpleViewerProvider,xo as SimpleViewerReactContext,de as SingleCanvasThumbnail,qo as TranslationProvider,Do as TransliterationProvider,Ft as VaultProvider,No as ViewerPresetContext,Mo as VirtualAnnotationProvider,Xt as VisibleCanvasReactContext,oo as authDetailsForResource,eo as createAuthStateStore,to as createProbe,Co as defaultEmitter,Uo as emptyActions,Zo as emptyStrategy,Kt as findAllCanvasesInRange,_t as findFirstCanvasFromRange,Qt as findManifestSelectedRange,Ut as findSelectedRange,jo as flattenAnnotationPageIds,dn as formatTime,rn as get3dStrategy,Se as getDefaultAnnotationStyles,an as getImageStrategy,Jt as getManifestSequence,Qo as getParsedTargetSelector,cn as getRenderingStrategy,sn as getTextualContentStrategy,ln as getVideoStrategy,Gt as getVisibleCanvasesFromCanvasId,jt as hasAuth,ro as makeAccessServiceRequest,no as makeAccessTokenRequest,Ko as parseSpecificResource,Ct as svgThemes,Go as unknownResponse,Jo as unsupportedStrategy,Ao as useAnnotation,zo as useAnnotationPage,se as useAnnotationPageManager,Ce as useAnnotationStyles,bi as useAnnotationsAtTime,uo as useAuthActions,go as useAuthService,mo as useAuthStore,ho as useAuthToken,po as useAuthTokens,T as useCanvas,Ti as useCanvasChoices,Ri as useCanvasClock,Zt as useCanvasSequence,vn as useCanvasStartTime,Bi as useCanvasSubset,Xo as useClosestLanguage,qi as useCollection,Po as useContextBridge,_o as useCreateLocaleString,fo as useCurrentAuth,wo as useDispatch,ae as useEventEmitter,$i as useEventListener,Ot as useExistingVault,_i as useExternalCollection,$t as useExternalManifest,te as useExternalResource,Oo as useIIIFLanguage,Q as useImage,He as useImageService,W as useImageServiceLoader,oa as useImageTile,co as useIsAuthEnabled,on as useLoadImageService,Yo as useLocaleString,q as useManifest,pn as useMediaActions,hn as useMediaElements,gn as useMediaState,nn as usePaintables,D as usePaintingAnnotations,Ie as usePolygonHelper,re as useRange,mn as useRenderingStrategy,A as useResourceContext,Lo as useResourceEvents,en as useResources,vo as useSearchService,be as useSelectorController,kr as useSelectorEmitter,xe as useSelectorEvents,Pr as useSelectorHelper,fn as useSimpleMediaPlayer,ie as useSimpleViewer,sa as useStyleHelper,Ho as useStyles,Re as useSvgEditor,le as useThumbnail,$o as useTranslations,Fo as useTransliteration,P as useVault,un as useVaultEffect,z as useVaultSelector,Bo as useViewerPreset,Ro as useVirtualAnnotationPage,Eo as useVirtualAnnotationPageContext,ne as useVisibleCanvases};
|
|
1
|
+
import{$ as wo,A as to,Aa as on,B as oo,Ba as D,C as no,Ca as nn,D as ro,Da as un,E as io,Ea as dn,F as ao,Fa as le,G as so,Ga as fn,H as lo,Ha as pn,I as co,Ia as gn,J as mo,Ja as hn,K as uo,Ka as yn,L as fo,La as vn,M as po,Ma as xn,N as go,Na as bn,O as ho,Oa as Sn,P as yo,Pa as ce,Q as vo,R as xo,S as bo,T as So,U as ie,V as Co,W as Io,X as ae,Y as ko,Z as Po,_ as To,a as Wt,aa as Ro,b as A,ba as Eo,c as B,ca as Mo,d as Dt,da as No,e as Ft,ea as Bo,f as Ot,fa as T,g as te,ga as Lo,h as $t,ha as Ho,i as Vt,ia as Ao,j as oe,ja as zo,k as P,ka as qo,l as z,la as Wo,m as Xt,ma as Do,n as ne,na as Fo,o as q,oa as Oo,p as Yt,pa as $o,q as _t,qa as Vo,r as Kt,ra as Xo,s as Qt,sa as Yo,t as Ut,ta as _o,u as Gt,ua as N,v as Jt,va as jo,w as re,wa as se,x as Zt,xa as en,y as jt,ya as tn,z as eo,za as W}from"./chunk-5PAZ34A4.js";import{a as Ko,b as Qo,c as Uo,d as Go,e as Jo,f as Zo,g as rn,h as an,i as sn,j as ln,k as cn,l as mn}from"./chunk-FZEYDVWC.js";import{useCanvas as We}from"@atlas-viewer/atlas";import{forwardRef as De,useImperativeHandle as Fe}from"react";import{Fragment as Oe,jsx as me}from"react/jsx-runtime";var wn=De(function({canvasId:t},o){let n=We(),i=se(t||n?.id),a=P();return Fe(o,()=>i,[t,n]),!n||i.enabledPageIds.length===0?null:me(Oe,{children:i.enabledPageIds.map(s=>me(ce.RenderAnnotationPage,{page:a.get(s)},s))})});import{useMemo as Xe}from"react";import{useMemo as $e}from"react";import{Fragment as Ve,jsx as C,jsxs as F}from"react/jsx-runtime";function O({metadata:e=[],config:t,labelWidth:o=16,showEmptyMessage:n=!0,allowHtml:i,emptyFallback:a,classes:s={},emptyMessage:l="No metadata available",emptyValueFallback:u="No value",emptyLabelFallback:m="",separator:c,tableFooter:f,tableHeader:x}){let h=$e(()=>{let g=(t||[]).reduce((p,b)=>[...p,...b.keys],[]),d={};for(let p of e){let b=p&&p.label?Object.values(p.label):[];for(let r of b)if(r&&r.length&&(g.indexOf(`metadata.${r[0]}`)!==-1||g.length===0)&&p){let S=`metadata.${r[0]}`;d[S]=d[S]?d[S]:[],d[S].push(p);break}}return d},[t,e]);return Object.keys(h).length===0&&n?C(Ve,{children:a})||C("div",{className:s.empty,children:l}):t&&t.length?F("table",{className:s.container,children:[x,C("tbody",{children:t.map((g,d)=>{let p=[];for(let b of g.keys)for(let r of h[b]||[])p.push(C(N,{enableDangerouslySetInnerHTML:i,defaultText:u,separator:c,children:r.value},d+"__"+b));return p.length===0?null:F("tr",{className:s.row,children:[C("td",{className:s.label,style:o?{minWidth:o}:{},children:C(N,{enableDangerouslySetInnerHTML:i,separator:c,defaultText:m,children:g.label})}),C("td",{className:s.value,children:p})]},d)})}),f]}):F("table",{className:s.container,children:[x,C("tbody",{children:e&&e.length?e.map((g,d)=>g?F("tr",{className:s.row,children:[C("td",{className:s.label,style:o?{minWidth:o}:{},children:C(N,{enableDangerouslySetInnerHTML:i,defaultText:u,separator:c,children:g.label})}),C("td",{className:s.value,children:C(N,{enableDangerouslySetInnerHTML:i,defaultText:u,separator:c,children:g.value})})]},d):null):null}),f]})}import{jsx as Ye}from"react/jsx-runtime";function Fn(e){let t=q(),o=T(),n=re(),i=Xe(()=>{let a=t?.metadata||[],s=o?.metadata||[],l=n?.metadata||[];return[...a,...s,...l]},[t,o,n]);return Ye(O,{metadata:i,...e})}import{useEffect as Ue,useState as Ge}from"react";import{createImageServiceRequest as _e,imageServiceRequestToString as Ke}from"@atlas-viewer/iiif-image-api";import{useMemo as Qe}from"react";function Q(e,t={},o=[]){return Qe(()=>{if(!e)return null;let n=t.quality;e&&e.extraQualities&&t.quality&&(e.extraQualities.includes(t.quality)||(n="default"));let i=_e(e);return Ke({identifier:i.identifier,server:i.server,scheme:i.scheme,type:"image",size:{max:!t.size?.width&&!t.size?.height,confined:!1,upscaled:!1,...t.size||{}},format:t.format||"jpg",region:t.region||{full:!0},rotation:t?.rotation?Number.isInteger(t.rotation)?{angle:t.rotation}:t.rotation:{angle:0},quality:n||"default",prefix:i.prefix,originalPath:i.originalPath})},[...o])}import{jsx as $}from"react/jsx-runtime";function Je(e){let t=typeof e.src=="string"?e.src:e.src.id,o=W(),[n,i]=Ge(!1),a;if(t){let l=o.loadServiceSync({id:t});l&&(a=l)}!a&&!n&&o.loadService({id:t}).then(()=>{i(!0)});let s=Q(a,{size:e.size,selector:e.region,rotation:e.rotation,format:e.format,region:e.region,quality:e.quality},[n,e.src,e.size,e.region,e.rotation,e.format,e.region,e.quality]);return Ue(()=>()=>{i(!1)},[t]),s?$("img",{src:s,alt:e.alt,className:e.className,style:e.style}):$(Ze,{...e,fetchImageService:!1})}function Ze(e){if(e.fetchImageService)return $(Je,{...e});let t=typeof e.src=="string"?{id:e.src,profile:"level0"}:e.src,o=Q(t,{size:e.size,selector:e.region,rotation:e.rotation,format:e.format,region:e.region,quality:e.quality},[e.src,e.size,e.region,e.rotation,e.format,e.region,e.quality]);return o?$("img",{src:o,alt:e.alt,className:e.className,style:e.style}):null}import{jsx as je}from"react/jsx-runtime";function or(e){let t=q();return je(O,{metadata:t?.metadata||[],...e})}import{useLayoutEffect as rt,useRef as it}from"react";import*as U from"react-lazy-load-image-component";import{getValue as et}from"@iiif/helpers/i18n";import{Fragment as ue,jsx as w,jsxs as nt}from"react/jsx-runtime";var{LazyLoadComponent:tt}=U||U.default;function de(e){let{size:t,visible:o,classes:n,canvasId:i,figure:a}=e,s=t?.width||128,l=t?.height||t?.width||128,u=w(ot,{...e}),m=w(tt,{threshold:300,style:{height:l,width:s},visibleByDefault:o,children:i?w(oe,{canvas:i,children:u}):u});return a?w("figure",{className:n?.figure,children:m}):m}function ot({fallback:e,size:t,classes:o,showLabel:n,alt:i,dereference:a=!1}){let s=T(),l=t?.width||128,u=t?.height||t?.width||128,m=i||et(s?.label)||"",c=le({width:l,height:u},a);return!c||c.type!=="fixed"?w(ue,{children:e}):nt(ue,{children:[w("div",{className:o?.imageWrapper,children:w("img",{className:o?.img,src:c.id,alt:m})}),n?w(N,{as:"figcaption",className:o?.label,children:s?.label}):null]})}import{jsx as L}from"react/jsx-runtime";function gr({flat:e,size:t,classes:o={},showLabel:n,figure:i,fallback:a}){let s=it(null),{items:l,sequence:u,currentSequenceIndex:m,setSequenceIndex:c}=ie(),f={row:o.selected?.row||o.row,item:o.selected?.item||o.item,figure:o.selected?.figure||o.figure,img:o.selected?.img||o.img,label:o.selected?.label||o.label,imageWrapper:o.selected?.imageWrapper||o.imageWrapper};rt(()=>{if(!s.current)return;let h=s.current.querySelector("[data-selected=true]");h&&h.scrollIntoView({behavior:"smooth",block:"nearest",inline:"center"})},[m]);let x=[];for(let h of u){let I=[],g=u[m]===h;for(let d of h){let p=l[d];I.push(L("div",{className:g?f.item:o.item,children:L(de,{classes:g?f:o,canvasId:p.id,size:t,showLabel:n,figure:i,placeholder:L("div",{style:{height:128,width:128}}),fallback:a})},d))}if(e){x.push(I);continue}x.push(L("div",{onClick:d=>{c(u.indexOf(h))},"data-selected":g,className:g?f.row:o.row,children:I},h.join("-")))}return L("div",{ref:s,className:o.container,children:x})}import{Fragment as fe,jsx as R,jsxs as pe}from"react/jsx-runtime";var at={draw:!0,polygon:!0,line:!0,lineBox:!0,square:!0,triangle:!0,hexagon:!0,circle:!0,delete:!0};function vr({helper:e,showShapes:t,state:o,enabled:n=at,classNames:i={},icons:a={}}){return pe(fe,{children:[t?pe(fe,{children:[n.draw&&R("button",{className:i.button,onClick:()=>{e.stamps.clear(),e.draw.enable()},"data-active":!o.lineMode&&!o.selectedStamp&&t&&o.drawMode,children:a.DrawIcon||"Draw"}),n.polygon&&R("button",{className:i.button,"data-active":!o.lineMode&&!o.selectedStamp&&t&&!o.drawMode,onClick:()=>{e.stamps.clear(),e.draw.disable(),e.modes.disableLineBoxMode(),e.modes.disableLineMode()},children:a.PolygonIcon||"Polygon"}),n.line&&R("button",{className:i.button,"data-active":o.lineMode&&!o.lineBoxMode,onClick:()=>{e.modes.enableLineMode()},children:a.LineIcon||"Line"}),n.lineBox&&R("button",{className:i.button,"data-active":o.lineBoxMode,onClick:()=>{e.modes.enableLineBoxMode()},children:a.LineBoxIcon||"LineBox"}),n.square&&R("button",{className:i.button,"data-active":o.selectedStamp?.id==="square",onClick:()=>{e.stamps.square()},children:a.SquareIcon||"Square"}),n.triangle&&R("button",{className:i.button,"data-active":o.selectedStamp?.id==="triangle",onClick:()=>{e.stamps.triangle()},children:a.TriangleIcon||"Triangle"}),n.hexagon&&R("button",{className:i.button,"data-active":o.selectedStamp?.id==="hexagon",onClick:()=>{e.stamps.hexagon()},children:a.HexagonIcon||"Hexagon"})]}):null,o.showBoundingBox&&n.delete&&R("button",{className:i.button,onClick:()=>e.key.down("Backspace"),children:a.DeleteForeverIcon||"Delete"})]})}import{createContext as st,useCallback as ge,useContext as ye,useEffect as he,useMemo as G,useState as lt}from"react";import ve from"mitt";import{jsx as ct}from"react/jsx-runtime";var V=st(ve());V.displayName="SelectorHelper";function Tr({children:e}){return ct(V.Provider,{value:G(()=>ve(),[]),children:e})}function wr(){return ye(V)}function xe(e){let t=be(),[o,n]=lt(!1);he(()=>t.withSelector(e).on("highlight",()=>{n(!0)}),[t,e]),he(()=>t.withSelector(e).on("clear-highlight",()=>{n(!1)}),[t,e]);let i=ge(s=>{t.emit("click",{selectorId:e,event:s})},[e,t]),a=ge(s=>{t.emit("hover",{selectorId:e,event:s})},[e,t]);return{controller:t,onClick:i,onHover:a,isHighlighted:o}}function be(){let e=ye(V);return G(()=>({withSelector(t){return{on(o,n){let i=a=>{a&&a.selectorId===t&&n(a)};return e.on(o,i),()=>{e.off(o,i)}},emit(o,n){e.emit(o,{...n,selectorId:t})}}},on(t,o){return e.on(t,o),()=>{e.off(t,o)}},emit(t,o){e.emit(t,o)}}),[e])}function Rr(){let e=be();return G(()=>({withSelector(t){return{highlight(){e.emit("highlight",{selectorId:t})},clearHighlight(){e.emit("clear-highlight",{selectorId:t})},zoomTo(){e.emit("zoom-to",{selectorId:t})},addEventListener(o,n){return e.emit("event-listener",{selectorId:t,name:o,callback:n}),()=>{e.emit("remove-event-listener",{selectorId:t,name:o,callback:n})}},getImagePreview(){return new Promise((o,n)=>{e.emit("image-preview-request",{selectorId:t,resolve:o,reject:n})})},on(o,n){return e.withSelector(t).on(o,n)}}},highlight(t){e.emit("highlight",{selectorId:t})},clearHighlight(t){e.emit("clear-highlight",{selectorId:t})},zoomTo(t){e.emit("zoom-to",{selectorId:t})},addEventListener(t,o,n){return e.emit("event-listener",{selectorId:t,name:o,callback:n}),()=>{e.emit("remove-event-listener",{selectorId:t,name:o,callback:n})}},getImagePreview(t){return new Promise((o,n)=>{e.emit("image-preview-request",{selectorId:t,resolve:o,reject:n})})},on(t,o){return e.on(t,o)}}),[e])}import{createContext as mt,useContext as ut,useMemo as dt}from"react";import{jsx as ft}from"react/jsx-runtime";function Se(){return{default:{backgroundColor:"rgba(0,0,0,0)",borderWidth:"2px",borderColor:"rgba(252,0,98, .5)"},highlighted:{backgroundColor:"rgba(75, 103, 225, 0.4)",borderWidth:"1px",borderColor:"rgba(75,103,225,0.99)"},hidden:{borderWidth:"0px",borderColor:"rgba(0,0,0,0)",backgroundColor:"rgba(0,0,0,0)",hidden:!0}}}var J=mt(Se());J.displayName="AnnotationStyle";function Ce(){return ut(J)}function Br({theme:e,children:t}){let o=dt(()=>e||Se(),[e]);return ft(J.Provider,{value:o,children:t})}import{HTMLPortal as xt,useAtlas as bt}from"@atlas-viewer/atlas";import{useEffect as ke,useRef as E,useState as Pe}from"react";import{useEffect as pt,useMemo as gt,useState as ht}from"react";import{createHelper as yt}from"polygon-editor";function Ie(e,t,o){let[n,i]=ht({}),a=gt(()=>yt(e,o),[]);return pt(()=>(a.clock.start(t,i),()=>{a.clock.stop()}),[]),{state:n,helper:a}}import{createSvgHelpers as vt}from"polygon-editor";import{Fragment as Te,jsx as v,jsxs as we}from"react/jsx-runtime";var M=vt();function Re(e,t){let{image:o,currentShape:n,onChange:i,hideShapeLines:a}=e,s=E(),l=E(),u=E(),m=E(),c=E(),f=E(),x=E(),h=E(),[I,g]=Pe(null),[d,p]=Pe(!1),{helper:b,state:r}=Ie(n,(y,k)=>{M.updateTransitionBoundingBox(l.current,y,k),M.updateBoundingBoxPolygon(s.current,y,k),M.updateTransitionShape(f.current,y,k),M.updateClosestLinePointTransform(m.current,y,k),M.updateSelectBox(u.current,y,k),M.updatePointLine(x.current,y,k),M.updateDrawPreview(c.current,y,k,3),M.updateLineBox(h.current,y),g(y.transitionDirection),p(y.transitionRotate)},i);ke(()=>{b.setShape(n||null)},t),ke(()=>{let y=()=>{b.modifiers.reset()};return document.addEventListener("mouseleave",y),()=>{document.removeEventListener("mouseleave",y)}},[]);let S=we(Te,{children:[v("marker",{id:"dot",viewBox:"0 0 10 10",refX:"5",refY:"5",markerWidth:"5",markerHeight:"5",children:v("circle",{cx:"5",cy:"5",r:"4",className:"marker"})}),v("marker",{id:"selected",viewBox:"0 0 10 10",refX:"5",refY:"5",markerWidth:"5",markerHeight:"5",children:v("circle",{cx:"5",cy:"5",r:"4",fill:"#FAFF00"})}),v("marker",{id:"resizer",viewBox:"0 0 10 10",refX:"5",refY:"5",markerWidth:"5",markerHeight:"5",children:v("rect",{width:"10",height:"10",stroke:"#FF0DCB",fill:"#fff",strokeWidth:2})})]}),_=n?n.open?"polyline":"polygon":null,ee=!r.showBoundingBox&&r.closestPoint!==null&&r.actionIntentType==="select-point",Ae=r.actionIntentType==="add-open-point",ze=r.transitionIntentType==="split-line",K=r.transitioning&&r.selectedStamp&&r.transitionIntentType==="stamp-shape",qe=n&&_?we(Te,{children:[v(_,{fill:!r.transitioning&&r.showBoundingBox?"rgba(255, 0, 0, .5)":"none",strokeWidth:K?0:2,stroke:a?"transparent":"#000",points:n.points.map(y=>y.join(",")).join(" "),vectorEffect:"non-scaling-stroke",markerStart:r.showBoundingBox?void 0:"url(#dot)",markerMid:r.showBoundingBox?void 0:"url(#dot)",markerEnd:r.showBoundingBox?void 0:"url(#dot)",style:{pointerEvents:"none"}}),r.lineBoxMode&&r.actionIntentType==="close-line-box"?v("polygon",{fill:"rgba(255, 0, 0, .4)",ref:h,stroke:"#000",strokeWidth:2,vectorEffect:"non-scaling-stroke"}):null,r.transitionIntentType==="draw-shape"&&r.transitioning?v("polyline",{ref:c,fill:"none",stroke:"rgba(255, 0, 0, .5)",strokeWidth:2,vectorEffect:"non-scaling-stroke"}):null,!r.showBoundingBox&&r.selectedPoints&&r.selectedPoints.length?v("polyline",{strokeWidth:2,vectorEffect:"non-scaling-stroke",stroke:"transparent",markerStart:"url(#selected)",markerMid:"url(#selected)",markerEnd:"url(#selected)",fill:"transparent",points:n.points.filter((y,k)=>r.selectedPoints?.includes(k)).map(y=>y.join(",")).join(" ")}):null,ee&&r.closestPoint!==null&&n.points[r.closestPoint]?v("polyline",{strokeWidth:2,vectorEffect:"non-scaling-stroke",stroke:"transparent",markerStart:"url(#selected)",markerMid:"url(#selected)",markerEnd:"url(#selected)",fill:"transparent",points:`${n.points[r.closestPoint][0]},${n.points[r.closestPoint][1]}`}):null,!r.transitioning&&(r.actionIntentType==="add-open-point"||r.actionIntentType==="close-shape"||r.actionIntentType==="close-shape-line")?v("polyline",{stroke:"#000",ref:x,strokeWidth:r.actionIntentType==="close-shape"?2:1,vectorEffect:"non-scaling-stroke"}):null,r.hasClosestLine&&(!r.transitionIntentType||r.transitionIntentType==="split-line")?v("g",{ref:m,children:v("polyline",{style:{opacity:.5},markerStart:"url(#dot)",points:"0,0 10,10",vectorEffect:"non-scaling-stroke",fill:"transparent",strokeWidth:2})}):null,r.transitioning?v(_,{ref:f,fill:n.open?"none":"rgba(255, 0, 0, .5)",stroke:"rgba(255, 0, 0, .5)",strokeWidth:n.open?2:0}):null,r.transitioning&&r.transitionIntentType==="select-multiple-points"?v("rect",{ref:u,fill:"rgba(255, 255, 255, .3)",strokeWidth:1,stroke:"rgba(0,0,0,.2)",vectorEffect:"non-scaling-stroke"}):null,r.showBoundingBox?null:v("g",{name:"controls",children:!1}),r.showBoundingBox&&!K?v("polygon",{ref:s,strokeWidth:2,stroke:"#FF0DCB",fill:"none",markerStart:"url(#resizer)",markerMid:"url(#resizer)",markerEnd:"url(#resizer)",vectorEffect:"non-scaling-stroke"}):null]}):null;return{helper:b,state:r,isAddingPoint:Ae,isSplitting:ze,isStamping:K,isHoveringPoint:ee,transitionDirection:I,transitionRotate:d,defs:S,editor:qe}}import{useEffect as Z}from"react";import{createPortal as St}from"react-dom";import{Fragment as Ee,jsx as H,jsxs as X}from"react/jsx-runtime";var Ct=[{name:"Default",outer:{borderWidth:4,borderColor:"rgba(255, 255, 255, .4)"},inner:{borderWidth:2,borderColor:"#000"}},{name:"High contrast",outer:{borderWidth:3,borderColor:"#fff"},inner:{borderWidth:1,borderColor:"#000"}},{name:"Lightsaber",outer:{borderWidth:"4",borderColor:"rgba(56,68,255,0.64)"},inner:{borderWidth:"2",borderColor:"#fff"}},{name:"Bright",outer:{borderWidth:"6",borderColor:"#25d527"},inner:{borderWidth:"3",borderColor:"#a916ff"}},{name:"pink",outer:{borderWidth:"4",borderColor:"#ff00ff"},inner:{borderWidth:"2",borderColor:"#ffffff"}},{name:"fine (dark)",outer:{borderWidth:"1",borderColor:"#000000"},inner:{}},{name:"fine (light)",outer:{borderWidth:"1",borderColor:"#FFF"},inner:{}}];function Me(e){let t=e.theme||Ct[0],o=bt(),{image:n}=e,{helper:i,defs:a,editor:s,state:l,transitionDirection:u,isSplitting:m,transitionRotate:c,isHoveringPoint:f,isAddingPoint:x,isStamping:h}=Re({currentShape:e.shape||null,onChange:e.updateShape,image:e.image,hideShapeLines:!0},[]),I=r=>{i.pointer([[~~r.atlas.x,~~r.atlas.y]])};Z(()=>{let r=S=>{i.key.up(S.key)};return document.addEventListener("keyup",r),()=>{document.removeEventListener("keyup",r)}},[]),Z(()=>{let r=S=>{i.key.down(S.key)};return document.addEventListener("keydown",r),()=>{document.removeEventListener("keydown",r)}},[]),Z(()=>{let r=[];return u&&r.push(`atlas-cursor-${u}`),l.actionIntentType==="cut-line"&&l.modifiers?.Shift&&r.push("atlas-cursor-cut"),(f||l.transitionIntentType==="move-shape"||l.transitionIntentType==="move-point")&&r.push("atlas-cursor-move"),x&&r.push("atlas-cursor-crosshair"),m&&r.push("atlas-cursor-copy"),c&&r.push("atlas-cursor-rotate"),l.transitionIntentType==="draw-shape"&&r.push("atlas-cursor-draw"),o?.canvas&&o.canvas.classList.add(...r),()=>{o?.canvas&&o.canvas.classList.remove(...r)}},[o?.canvas,x,f,m,l.modifiers?.Shift,l.actionIntentType,l.transitionIntentType,u,c]);let g=e.shape&&e.shape?.points.length===0,d=e.renderControls?e.renderControls(i,l,g):null,p=document.getElementById(e.controlsHtmlId||"atlas-controls"),b="shape";return H(Ee,{children:X("world-object",{height:n.height,width:n.width,onMouseMove:I,onMouseDown:i.pointerDown,onMouseUp:i.pointerUp,onMouseLeave:i.blur,children:[e.shape?X(Ee,{children:[H(b,{open:e.shape.open,points:e.shape.points,relativeStyle:!0,style:h?{}:t.outer}),H(b,{open:e.shape.open,points:e.shape.points,relativeStyle:!0,style:h?{}:t.inner})]}):null,X(xt,{relative:!0,interactive:!1,children:[H("div",{style:{position:"absolute",top:0,right:0,left:0,bottom:0},children:X("svg",{width:"100%",height:"100%",viewBox:`0 0 ${n.width} ${n.height}`,tabIndex:-1,children:[H("defs",{children:a}),s]})}),p?St(d,p,"controls"):null]})]})})}import{jsx as Ne}from"react/jsx-runtime";function si(e){let t=T(),o=e.annotationBucket,n=e.readOnly,i=e.id,{onClick:a,isHighlighted:s}=xe(e.id),l=Ce(),u=s?l.highlighted:l[o||"hidden"]||l.hidden;if(!t)return null;if(n){let m="shape",c=e.polygon,f=c.open;return c?Ne(m,{id:`shape-${i}`,points:c.points,open:f,onClick:a,relativeStyle:!0,target:{x:0,y:0,width:t.width,height:t.height},style:u}):null}return Ne(Me,{image:t,shape:e.polygon||{id:e.id,open:!0,points:[]},updateShape:e.updatePolygon,theme:e.theme,controlsHtmlId:e.controlsHtmlId,renderControls:e.renderControls})}import{jsx as It}from"react/jsx-runtime";function ui({annotation:e,children:t}){return It(B,{value:{annotation:e},children:t})}import{jsx as kt}from"react/jsx-runtime";function gi({annotationPage:e,children:t}){return kt(B,{value:{annotationPage:e},children:t})}import{jsx as Pt}from"react/jsx-runtime";function xi({collection:e,children:t}){return Pt(B,{value:{collection:e},children:t})}function Ii(e,t={}){return D(t)}import{useCanvas as Tt}from"@atlas-viewer/atlas";import{useEffect as wt,useMemo as j,useState as Rt}from"react";function Ei({canvasId:e}={}){let t=Tt(),o=ne(),n=j(()=>e?[e]:t?[t.id]:o.map(m=>m.id),[e,t,o]),[i,a]=Rt({}),s=ae();wt(()=>{let m=c=>{let f=c.partOf.canvasId;f&&a(x=>({...x,[f]:c.choice}))};return s.on("choice-change",m),()=>{s.off("choice-change",m)}},[]);let l=j(()=>{let m=[];for(let c of n){let f=i[c];f&&m.push({canvasId:c,choice:f})}return m},[n,i]),u=j(()=>({makeChoice:(m,c)=>{s.emit("make-choice",{choiceId:m,...c})}}),[s]);return{choices:l,actions:u}}function Ni(e,t=!1){}function Ai(e){let o=A().manifest,n=e?e.map(i=>typeof i=="string"?i:i?.id):[];return z(i=>{let a=o?i.iiif.entities.Manifest[o]:void 0,s=a?.items||[];if(typeof e>"u")return s;let l=[];for(let u of a?.items||[])n.indexOf(u.id)!==-1&&l.push(u);return l},[n.join("/")])}import{useMemo as Et}from"react";function Fi(e,t=[]){let{id:o,selector:n}=e,i=A(),a=o||i.collection,s=z(l=>a?l.iiif.entities.Collection[a]:void 0,[a]);return Et(()=>{if(s)return n?n(s):s},[s,n,...t])}import{useEffect as Mt,useMemo as Nt}from"react";import{createEventsHelper as Bt}from"@iiif/helpers/events";function Yi(e,t,o,n,i=[]){let a=P(),s=Nt(()=>Bt(a),[a]);Mt(()=>{let l=e;return l?(s.addEventListener(l,t,o,n),()=>{s.removeEventListener(l,t,o)}):()=>{}},[s,e,t,...i])}function Ui(e,t){let{id:o,isLoaded:n,error:i,resource:a,requestId:s,cached:l}=te(e,t);return{id:o,isLoaded:n,error:i,manifest:a,requestId:s,cached:l}}import{getImageServices as Be}from"@atlas-viewer/iiif-image-api";import{useEffect as Lt,useMemo as Le,useState as Y}from"react";function He({cacheKey:e}={}){let t=T(),o=D(),n=P(),i=W(),[a,s]=Y(void 0),[l,u]=Y(!1),[m,c]=Y("idle"),[f,x]=Y(void 0),h=t?t.id:"undefined",I=Le(()=>{try{if(t&&o.length){let d=o[0],p=n.get(d.body[0]),r=Be(p)[0];return r&&i.loadServiceSync({id:r.id||r["@id"],width:r.width||t.width,height:r.height||t.height})||void 0}}catch(d){console.error(d)}},[h,e,t]),g=m==="success"&&a?a:I;return Lt(()=>{(async()=>{try{if(t&&o.length){let d=o[0],p=n.get(d.body[0]),r=Be(p)[0];if(!r)return;u(!0),c("loading");try{let S=await i.loadService({id:r.id||r["@id"],width:r.width||t.width,height:r.height||t.height})||void 0;s(S),c("success"),u(!1)}catch(S){c("error"),x(S)}}}catch(d){c("error"),x(d)}})()},[h,e]),Le(()=>({data:g,isFetching:l,status:m,error:f}),[g,l,m,f])}function ia(){let e=He();return{isLoading:e.isFetching,tile:e.data?{id:e.data.id||e.data["@id"],width:e.data.width,height:e.data.height,imageService:e.data,thumbnail:void 0}:null}}import{createStylesHelper as Ht}from"@iiif/helpers/styles";import{useMemo as At}from"react";function ma(){let e=P();return At(()=>Ht(e),[e])}export*from"@iiif/helpers/annotation-targets";export{ui as AnnotationContext,gi as AnnotationPageContext,Br as AnnotationStyleProvider,yo as Auth,lo as AuthProvider,io as AuthRContext,ao as AuthReactContext,so as AuthReactContextActions,wn as CanvasAnnotations,oe as CanvasContext,ce as CanvasPanel,xi as CollectionContext,Fn as CombinedMetadata,bn as ComplexTimelineProvider,To as ContextBridge,Me as CreateCustomShape,ko as EventsProvider,Ze as Image,tn as ImageServiceLoaderContext,bo as InnerViewerProvider,Wo as LanguageProvider,Vo as LanguageString,N as LocaleString,Vt as ManifestContext,or as ManifestMetadata,vn as MediaPlayerProvider,O as Metadata,si as PolygonSelector,Yt as RangeContext,Io as ReactEventContext,Dt as ReactVaultContext,vr as RenderSvgEditorControls,B as ResourceProvider,Wt as ResourceReactContext,Tr as SelectorControllerProvider,gr as SequenceThumbnails,So as SimpleViewerProvider,xo as SimpleViewerReactContext,de as SingleCanvasThumbnail,qo as TranslationProvider,Do as TransliterationProvider,Ft as VaultProvider,No as ViewerPresetContext,Mo as VirtualAnnotationProvider,Xt as VisibleCanvasReactContext,oo as authDetailsForResource,eo as createAuthStateStore,to as createProbe,Co as defaultEmitter,Uo as emptyActions,Zo as emptyStrategy,Kt as findAllCanvasesInRange,_t as findFirstCanvasFromRange,Qt as findManifestSelectedRange,Ut as findSelectedRange,jo as flattenAnnotationPageIds,fn as formatTime,rn as get3dStrategy,cn as getComplexTimelineStrategy,Se as getDefaultAnnotationStyles,an as getImageStrategy,Jt as getManifestSequence,Qo as getParsedTargetSelector,mn as getRenderingStrategy,sn as getTextualContentStrategy,ln as getVideoStrategy,Gt as getVisibleCanvasesFromCanvasId,jt as hasAuth,ro as makeAccessServiceRequest,no as makeAccessTokenRequest,Ko as parseSpecificResource,Ct as svgThemes,Go as unknownResponse,Jo as unsupportedStrategy,Ao as useAnnotation,zo as useAnnotationPage,se as useAnnotationPageManager,Ce as useAnnotationStyles,Ii as useAnnotationsAtTime,uo as useAuthActions,po as useAuthService,mo as useAuthStore,ho as useAuthToken,go as useAuthTokens,T as useCanvas,Ei as useCanvasChoices,Ni as useCanvasClock,Zt as useCanvasSequence,xn as useCanvasStartTime,Ai as useCanvasSubset,Xo as useClosestLanguage,Fi as useCollection,Sn as useComplexTimeline,Po as useContextBridge,_o as useCreateLocaleString,fo as useCurrentAuth,wo as useDispatch,ae as useEventEmitter,Yi as useEventListener,Ot as useExistingVault,Ui as useExternalCollection,$t as useExternalManifest,te as useExternalResource,Oo as useIIIFLanguage,Q as useImage,He as useImageService,W as useImageServiceLoader,ia as useImageTile,co as useIsAuthEnabled,on as useLoadImageService,Yo as useLocaleString,q as useManifest,hn as useMediaActions,yn as useMediaElements,gn as useMediaState,nn as usePaintables,D as usePaintingAnnotations,Ie as usePolygonHelper,re as useRange,un as useRenderingStrategy,A as useResourceContext,Lo as useResourceEvents,en as useResources,vo as useSearchService,be as useSelectorController,wr as useSelectorEmitter,xe as useSelectorEvents,Rr as useSelectorHelper,pn as useSimpleMediaPlayer,ie as useSimpleViewer,ma as useStyleHelper,Ho as useStyles,Re as useSvgEditor,le as useThumbnail,$o as useTranslations,Fo as useTransliteration,P as useVault,dn as useVaultEffect,z as useVaultSelector,Bo as useViewerPreset,Ro as useVirtualAnnotationPage,Eo as useVirtualAnnotationPageContext,ne as useVisibleCanvases};
|
|
@@ -79,7 +79,7 @@ type SingleImageStrategy = {
|
|
|
79
79
|
choice?: ChoiceDescription;
|
|
80
80
|
annotations?: AnnotationPageDescription;
|
|
81
81
|
};
|
|
82
|
-
declare function getImageStrategy(canvas: CanvasNormalized, paintables: Paintables, loadImageService: ImageServiceLoaderType):
|
|
82
|
+
declare function getImageStrategy(canvas: CanvasNormalized, paintables: Paintables, loadImageService: ImageServiceLoaderType): SingleImageStrategy | UnknownStrategy;
|
|
83
83
|
|
|
84
84
|
type Single3DModelStrategy = {
|
|
85
85
|
type: '3d-model';
|
|
@@ -109,10 +109,20 @@ type MediaStrategy = {
|
|
|
109
109
|
};
|
|
110
110
|
type ComplexTimelineStrategy = {
|
|
111
111
|
type: 'complex-timeline';
|
|
112
|
-
items: Array<
|
|
112
|
+
items: Array<SingleImageStrategy['image'] | SingleAudio | SingleVideo | SingleYouTubeVideo>;
|
|
113
|
+
keyframes: TimelineKeyframe[];
|
|
114
|
+
duration: number;
|
|
113
115
|
choice?: ChoiceDescription;
|
|
114
116
|
annotations?: AnnotationPageDescription;
|
|
115
117
|
};
|
|
118
|
+
interface TimelineKeyframe {
|
|
119
|
+
id: string;
|
|
120
|
+
type: 'enter' | 'exit' | 'change';
|
|
121
|
+
resourceType: 'image' | 'audio' | 'video';
|
|
122
|
+
timeDelta?: number;
|
|
123
|
+
isPrime?: boolean;
|
|
124
|
+
time: number;
|
|
125
|
+
}
|
|
116
126
|
type EmptyStrategy = {
|
|
117
127
|
type: 'empty';
|
|
118
128
|
image: null;
|
|
@@ -158,4 +168,4 @@ type UseRenderingStrategyOptions = {
|
|
|
158
168
|
};
|
|
159
169
|
declare function useRenderingStrategy(options?: UseRenderingStrategyOptions): UseRenderingStrategy;
|
|
160
170
|
|
|
161
|
-
export { type AudioSequence as A, type ComplexTimelineStrategy as C, type EmptyStrategy as E, type ImageWithOptionalService as I, type MediaStrategy as M, type RenderingStrategy as R, type StrategyActions as S, type
|
|
171
|
+
export { type AudioSequence as A, type ComplexTimelineStrategy as C, type EmptyStrategy as E, type ImageWithOptionalService as I, type MediaStrategy as M, type RenderingStrategy as R, type StrategyActions as S, type TimelineKeyframe as T, type UnknownStrategy as U, type VideoSequence as V, type SingleImageStrategy as a, type SingleAudio as b, type SingleVideo as c, type ImageServiceLoaderType as d, type SingleYouTubeVideo as e, type AnnotationPageDescription as f, getImageStrategy as g, type TextualContentStrategy as h, getTextualContentStrategy as i, type Single3DModelStrategy as j, get3dStrategy as k, type UseRenderingStrategy as l, type ChoiceEvents as m, type UseRenderingStrategyOptions as n, useRenderingStrategy as o, useLoadImageService as u };
|
|
@@ -79,7 +79,7 @@ type SingleImageStrategy = {
|
|
|
79
79
|
choice?: ChoiceDescription;
|
|
80
80
|
annotations?: AnnotationPageDescription;
|
|
81
81
|
};
|
|
82
|
-
declare function getImageStrategy(canvas: CanvasNormalized, paintables: Paintables, loadImageService: ImageServiceLoaderType):
|
|
82
|
+
declare function getImageStrategy(canvas: CanvasNormalized, paintables: Paintables, loadImageService: ImageServiceLoaderType): SingleImageStrategy | UnknownStrategy;
|
|
83
83
|
|
|
84
84
|
type Single3DModelStrategy = {
|
|
85
85
|
type: '3d-model';
|
|
@@ -109,10 +109,20 @@ type MediaStrategy = {
|
|
|
109
109
|
};
|
|
110
110
|
type ComplexTimelineStrategy = {
|
|
111
111
|
type: 'complex-timeline';
|
|
112
|
-
items: Array<
|
|
112
|
+
items: Array<SingleImageStrategy['image'] | SingleAudio | SingleVideo | SingleYouTubeVideo>;
|
|
113
|
+
keyframes: TimelineKeyframe[];
|
|
114
|
+
duration: number;
|
|
113
115
|
choice?: ChoiceDescription;
|
|
114
116
|
annotations?: AnnotationPageDescription;
|
|
115
117
|
};
|
|
118
|
+
interface TimelineKeyframe {
|
|
119
|
+
id: string;
|
|
120
|
+
type: 'enter' | 'exit' | 'change';
|
|
121
|
+
resourceType: 'image' | 'audio' | 'video';
|
|
122
|
+
timeDelta?: number;
|
|
123
|
+
isPrime?: boolean;
|
|
124
|
+
time: number;
|
|
125
|
+
}
|
|
116
126
|
type EmptyStrategy = {
|
|
117
127
|
type: 'empty';
|
|
118
128
|
image: null;
|
|
@@ -158,4 +168,4 @@ type UseRenderingStrategyOptions = {
|
|
|
158
168
|
};
|
|
159
169
|
declare function useRenderingStrategy(options?: UseRenderingStrategyOptions): UseRenderingStrategy;
|
|
160
170
|
|
|
161
|
-
export { type AudioSequence as A, type ComplexTimelineStrategy as C, type EmptyStrategy as E, type ImageWithOptionalService as I, type MediaStrategy as M, type RenderingStrategy as R, type StrategyActions as S, type
|
|
171
|
+
export { type AudioSequence as A, type ComplexTimelineStrategy as C, type EmptyStrategy as E, type ImageWithOptionalService as I, type MediaStrategy as M, type RenderingStrategy as R, type StrategyActions as S, type TimelineKeyframe as T, type UnknownStrategy as U, type VideoSequence as V, type SingleImageStrategy as a, type SingleAudio as b, type SingleVideo as c, type ImageServiceLoaderType as d, type SingleYouTubeVideo as e, type AnnotationPageDescription as f, getImageStrategy as g, type TextualContentStrategy as h, getTextualContentStrategy as i, type Single3DModelStrategy as j, get3dStrategy as k, type UseRenderingStrategy as l, type ChoiceEvents as m, type UseRenderingStrategyOptions as n, useRenderingStrategy as o, useLoadImageService as u };
|
package/dist/utils.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var T=Object.defineProperty;var B=Object.getOwnPropertyDescriptor;var D=Object.getOwnPropertyNames;var O=Object.prototype.hasOwnProperty;var A=(e,t)=>{for(var i in t)T(e,i,{get:t[i],enumerable:!0})},V=(e,t,i,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of D(t))!O.call(e,o)&&o!==i&&T(e,o,{get:()=>t[o],enumerable:!(r=B(t,o))||r.enumerable});return e};var U=e=>V(T({},"__esModule",{value:!0}),e);var F={};A(F,{emptyActions:()=>M,emptyStrategy:()=>C,getParsedTargetSelector:()=>y,getRenderingStrategy:()=>Y,parseSpecificResource:()=>W,unknownResponse:()=>f,unsupportedStrategy:()=>m});module.exports=U(F);var w=require("@iiif/helpers");function W(e){return e.type==="SpecificResource"?[e.source,{selector:e.selector}]:[e,{selector:null}]}function y(e,t){let{selector:i,source:r}=(0,w.expandTarget)(t);if(r.id!==e.id)return[null,r];let o={type:"BoxSelector",spatial:{x:0,y:0,width:Number(e.width),height:Number(e.height)}};return[i?i.type==="TemporalSelector"?{type:"TemporalBoxSelector",temporal:i.temporal,spatial:o.spatial}:i:null,r]}var M={makeChoice:()=>{}},f={type:"unknown"},m=e=>({type:"unknown",reason:e,annotations:{pages:[]}}),C=(e,t)=>({type:"empty",width:e,height:t,annotations:{pages:[]},image:null,images:[]});var L=["model/gltf-binary"];function P(e,t){let r=t.items[0].resource;return r.format?L.indexOf(r.format)===-1?m(`3D format: ${r.format} is unsupported`):{type:"3d-model",model:r}:m("Unknown format")}function b(e,t){if(!e.duration)return m("No duration on canvas");if(t.items.length>1)return m("Only one audio source supported");let i=t.items[0]?.resource;return i?i.format?{type:"media",media:{annotationId:t.items[0].annotationId,duration:e.duration,url:i.id,type:"Sound",target:{type:"TemporalSelector",temporal:{startTime:0,endTime:e.duration}},format:i.format,selector:{type:"TemporalSelector",temporal:{startTime:0,endTime:e.duration}}},annotations:{pages:[]}}:m("Audio does not have format"):m("Unknown audio")}var v=require("@atlas-viewer/iiif-image-api");var I=require("@iiif/helpers/annotation-targets");function S(e,t,i){let r=[];for(let o of t.items){let s=o.resource&&o.resource.type==="SpecificResource"?o.resource.source:o.resource;if(!s.id)return m("No resource Identifier");let p;if(s.service){let g=(0,v.getImageServices)(s);g[0]&&(p=i(g[0],e))}let d={type:"BoxSelector",spatial:{x:0,y:0,width:Number(e.width),height:Number(e.height)}},[n,a]=y(e,o.target);if(!(a.id===e.id||decodeURIComponent(a.id||"")===(e.id||"")))continue;let c=o.resource.width&&o.resource.height?{type:"BoxSelector",spatial:{x:0,y:0,width:o.resource.width,height:o.resource.height}}:void 0,l=o.resource.type==="SpecificResource"?(0,I.expandTarget)(o.resource):null;if(o.selector){let g=(0,I.expandTarget)({type:"SpecificResource",source:o.resource,selector:o.selector});g&&(l=g)}let u=l&&l.selector&&(l.selector.type==="BoxSelector"||l.selector.type==="TemporalBoxSelector")?{type:"BoxSelector",spatial:{x:l.selector.spatial.x,y:l.selector.spatial.y,width:l.selector.spatial.width,height:l.selector.spatial.height}}:void 0;p&&!p.id&&(p.id=p["@id"]);let z={id:s.id,type:"Image",annotationId:o.annotationId,width:Number(n||u?s.width:e.width),height:Number(n||u?s.height:e.height),service:p,sizes:p&&p.sizes?p.sizes:s.width&&s.height?[{width:s.width,height:s.height}]:[],target:n&&n.type!=="PointSelector"?n:d,selector:u||{type:"BoxSelector",spatial:{x:0,y:0,width:Number(e.width),height:Number(e.height)}}};r.push(z)}return{type:"images",image:r[0],images:r,choice:t.choice}}function R(e,t={},i){let r=e.language||i||"none";switch(e.type){case"TextualBody":{typeof e.value<"u"&&(t[r]=e.value);break}case"List":case"Composite":case"Choice":e.items&&e.items.forEach(o=>R(o,t,r))}return t}function k(e,t){let i=[];return t.items.forEach(r=>{if(r.resource){let[o]=y(e,r.target);i.push({annotationId:r.annotationId,text:R(r.resource),target:o})}}),{type:"textual-content",items:i}}var h=require("@iiif/helpers"),E=/^.*(?:(?:youtu\.be\/|v\/|vi\/|u\/\w\/|embed\/|shorts\/)|(?:(?:watch)?\?vi?=|&vi?=))([^#&?]*).*/;function x(e,t){let i=t.items.filter(c=>c.type==="video"),r=!1;if(e.duration||(r=!0),i.length>1)return m("Only one video source supported");let o=i[0]?.resource,s=!!(o.service||[]).find(c=>(c.profile||"").includes("youtube.com"));if(!s&&r)return m("Video does not have duration");if(!o)return m("Unknown video");if((!o.format||o.format==="text/html")&&!s)return m("Video does not have format");let p=t.items[0],d={annotationId:t.items[0].annotationId,duration:e.duration,url:o.id,type:"Video",target:{type:"TemporalSelector",temporal:{startTime:0,endTime:e.duration}},format:o.format,selector:{type:"TemporalSelector",temporal:{startTime:0,endTime:e.duration}}},n=(0,h.expandTarget)(p.target);n.selector&&n.selector.type==="TemporalBoxSelector"&&(d.target=n.selector);let{selector:a}=(0,h.parseSelector)(p.selector);if(a===null){let c=d.target.temporal.startTime,u=(d.target.temporal.endTime||e.duration)-c;d.selector={type:"TemporalSelector",temporal:{startTime:0,endTime:u}}}else a.type==="TemporalSelector"&&(d.selector=a);if(s){d.type="VideoYouTube";let c=o.id.match(E);if(!c[1])return m("Video is not known youtube video");d.youTubeId=c[1]}return{type:"media",media:d,annotations:{pages:[]}}}function N(e,t,i){let r={type:"complex-timeline",items:[],keyframes:[],duration:e.duration||0},o={type:"complex-choice",items:[]};function s(n){n.choice&&(n.choice.type==="complex-choice"?o.items.push(...n.choice.items):o.items.push(n.choice))}for(let n of t.items){if(n.type==="image"){let a=S(e,{choice:null,allChoices:null,types:["image"],items:[n]},i);if(a.type==="images"){s(a),r.items.push(a.image);let c={id:a.image.annotationId,type:"enter",resourceType:"image",time:a.image.target?.temporal?.startTime||0};r.keyframes.push(c);let l={id:a.image.annotationId,type:"exit",resourceType:"image",time:a.image.target?.temporal?.endTime||e.duration||0};r.keyframes.push(l)}}if(n.type==="video"){let a=x(e,{choice:null,allChoices:null,types:["video"],items:[n]});if(a.type==="media"){s(a);let c=a.media;r.items.push(c);let l={id:c.annotationId,type:"enter",resourceType:"video",time:c.target?.temporal?.startTime||0};r.keyframes.push(l);let u={id:c.annotationId,type:"exit",resourceType:"video",time:c.target?.temporal?.endTime||e.duration||0};r.keyframes.push(u)}}}r.keyframes.sort((n,a)=>n.time-a.time);let p=[],d=[];for(let n of r.keyframes){if(n.resourceType==="image"){d.push(n);continue}if(n.type==="enter"){p.length===0&&(n.isPrime=!0),p.push(n),d.push(n);continue}if(n.type==="exit"&&(d.push(n),p=p.filter(a=>a.id!==n.id),p.length!==0)){let a=p[0],c={id:a.id,type:"change",isPrime:!0,resourceType:a.resourceType,time:n.time};d.push(c)}}return r.keyframes=d,o.items.length&&(r.choice=o),r}function Y({canvas:e,paintables:t,supports:i,loadImageService:r}){if(!e)return f;if(t.types.length===0)return i.indexOf("empty")!==-1?C(e.width,e.height):f;if(t.types.length!==1)if(t.types.length===2&&t.types.indexOf("text")!==-1)t.types=t.types.filter(s=>s!=="text");else return i.indexOf("complex-timeline")===-1?m("Complex timeline not supported"):N(e,t,r);let o=t.types[0];return o==="image"?i.indexOf("images")===-1?m("Image not supported"):S(e,t,r):o==="Model"||o==="model"?i.indexOf("3d-model")===-1?m("3D not supported"):P(e,t):o==="textualbody"?i.indexOf("textual-content")===-1?m("Textual content not supported"):k(e,t):o==="sound"||o==="audio"?i.indexOf("media")===-1?m("Media not supported"):b(e,t):o==="video"?i.indexOf("media")===-1?m("Media not supported"):x(e,t):f}
|
package/dist/utils.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { l as UseRenderingStrategy, U as UnknownStrategy, R as RenderingStrategy, d as ImageServiceLoaderType } from './useRenderingStrategy-DUTiqfD8.cjs';
|
|
2
2
|
import { CanvasNormalized } from '@iiif/presentation-3-normalized';
|
|
3
3
|
import { Paintables } from '@iiif/helpers/painting-annotations';
|
|
4
4
|
import { ContentResource, W3CAnnotationTarget, PointSelector } from '@iiif/presentation-3';
|
|
@@ -19,7 +19,7 @@ declare const emptyActions: {
|
|
|
19
19
|
makeChoice: () => void;
|
|
20
20
|
};
|
|
21
21
|
declare const unknownResponse: UseRenderingStrategy[0];
|
|
22
|
-
declare const unsupportedStrategy: (reason: string) =>
|
|
22
|
+
declare const unsupportedStrategy: (reason: string) => UnknownStrategy;
|
|
23
23
|
declare const emptyStrategy: (width: number, height: number) => UseRenderingStrategy[0];
|
|
24
24
|
|
|
25
25
|
interface GetRenderStrategyOptions {
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { l as UseRenderingStrategy, U as UnknownStrategy, R as RenderingStrategy, d as ImageServiceLoaderType } from './useRenderingStrategy-DUTiqfD8.js';
|
|
2
2
|
import { CanvasNormalized } from '@iiif/presentation-3-normalized';
|
|
3
3
|
import { Paintables } from '@iiif/helpers/painting-annotations';
|
|
4
4
|
import { ContentResource, W3CAnnotationTarget, PointSelector } from '@iiif/presentation-3';
|
|
@@ -19,7 +19,7 @@ declare const emptyActions: {
|
|
|
19
19
|
makeChoice: () => void;
|
|
20
20
|
};
|
|
21
21
|
declare const unknownResponse: UseRenderingStrategy[0];
|
|
22
|
-
declare const unsupportedStrategy: (reason: string) =>
|
|
22
|
+
declare const unsupportedStrategy: (reason: string) => UnknownStrategy;
|
|
23
23
|
declare const emptyStrategy: (width: number, height: number) => UseRenderingStrategy[0];
|
|
24
24
|
|
|
25
25
|
interface GetRenderStrategyOptions {
|
package/dist/utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as o,b as r,c as e,d as f,e as m,f as p,
|
|
1
|
+
import{a as o,b as r,c as e,d as f,e as m,f as p,l as t}from"./chunk-FZEYDVWC.js";export{e as emptyActions,p as emptyStrategy,r as getParsedTargetSelector,t as getRenderingStrategy,o as parseSpecificResource,f as unknownResponse,m as unsupportedStrategy};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-iiif-vault",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"dependencies": {
|
|
61
61
|
"@atlas-viewer/atlas": "^2.2.4",
|
|
62
62
|
"@atlas-viewer/iiif-image-api": "^2.2.0",
|
|
63
|
-
"@iiif/helpers": "^1.2.
|
|
63
|
+
"@iiif/helpers": "^1.2.15",
|
|
64
64
|
"@iiif/parser": "^2.1.2",
|
|
65
65
|
"@iiif/presentation-2": "^1.0.4",
|
|
66
66
|
"@iiif/presentation-3": "^2.2.3",
|
|
@@ -70,6 +70,7 @@
|
|
|
70
70
|
"react-error-boundary": "^4.0.13",
|
|
71
71
|
"react-lazy-load-image-component": "^1.6.0",
|
|
72
72
|
"react-reconciler": "~0.29.0",
|
|
73
|
+
"tiny-invariant": "^1.3.3",
|
|
73
74
|
"zustand": "^4.5.2"
|
|
74
75
|
},
|
|
75
76
|
"peerDependencies": {
|