react-iiif-vault 2.0.1 → 2.0.4
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 +83 -5
- package/dist/bundle.global.js +73 -48
- package/dist/canvas-panel.cjs +6 -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-223VJXTE.js +1 -0
- package/dist/chunk-SNWQWQTN.js +49 -0
- package/dist/chunk-UNH7HXGJ.js +0 -0
- package/dist/{index-CawyvZZf.d.cts → index-Btmqi4an.d.cts} +11 -3
- package/dist/{index-yy_738ck.d.ts → index-Cxmpcndt.d.ts} +11 -3
- package/dist/index.cjs +8 -7
- package/dist/index.d.cts +77 -9
- package/dist/index.d.ts +77 -9
- package/dist/index.js +1 -1
- package/dist/{useRenderingStrategy-PvoNjiMV.d.cts → useRenderingStrategy-CHg8UC3-.d.cts} +3 -1
- package/dist/{useRenderingStrategy-PvoNjiMV.d.ts → useRenderingStrategy-CHg8UC3-.d.ts} +3 -1
- package/dist/{utils-DyrEcegR.d.ts → utils-B4O1xptf.d.ts} +1 -1
- package/dist/{utils-BVhGgVd5.d.cts → utils-C0dpk-mp.d.cts} +1 -1
- 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 +11 -7
- package/dist/chunk-5VWTU5L4.js +0 -48
- package/dist/chunk-OTG27VBE.js +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
export * from '@iiif/helpers/annotation-targets';
|
|
2
|
-
import { S as SVGTheme, R as RenderContextProps, A as AudioComponentProps, V as VideoComponentProps, u as useSvgEditor, a as SimpleViewerContext, b as AtlasStore, c as AnnotationRequest, d as AnnotationResponse, e as AnnotationRequestOptions, f as SimpleViewerProps } from './index-
|
|
3
|
-
export { h as AtlasStoreEvents, n as AtlasStoreProvider, k as AtlasStoreReactContext, g as CanvasPanel, C as CanvasPanelProps, i as CreateAtlasStoreProps, o as RenderAnnotation, q as RenderAnnotationPage, x as SimpleViewerActions, y as SimpleViewerActionsType, w as SimpleViewerReducerState, j as createAtlasStore, v as defaultSvgTheme, m as getAtlasStoreByName, p as polygonToTarget, r as requestToAnnotationResponse, t as useAtlasContextMenu, l as useAtlasStore, s as useContextMenuStore } from './index-
|
|
2
|
+
import { S as SVGTheme, R as RenderContextProps, A as AudioComponentProps, V as VideoComponentProps, u as useSvgEditor, a as SimpleViewerContext, b as AtlasStore, c as AnnotationRequest, d as AnnotationResponse, e as AnnotationRequestOptions, f as SimpleViewerProps } from './index-Btmqi4an.cjs';
|
|
3
|
+
export { h as AtlasStoreEvents, n as AtlasStoreProvider, k as AtlasStoreReactContext, g as CanvasPanel, C as CanvasPanelProps, i as CreateAtlasStoreProps, o as RenderAnnotation, q as RenderAnnotationPage, x as SimpleViewerActions, y as SimpleViewerActionsType, w as SimpleViewerReducerState, j as createAtlasStore, v as defaultSvgTheme, m as getAtlasStoreByName, p as polygonToTarget, r as requestToAnnotationResponse, t as useAtlasContextMenu, l as useAtlasStore, s as useContextMenuStore } from './index-Btmqi4an.cjs';
|
|
4
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
|
+
import { BoxStyle, AtlasProps, Preset } from '@atlas-viewer/atlas';
|
|
5
6
|
import * as React$1 from 'react';
|
|
6
7
|
import React__default, { ReactNode, FunctionComponent, RefObject, Context } from 'react';
|
|
7
|
-
import { R as RenderingStrategy, b as StrategyActions, M as MediaStrategy, c as SingleImageStrategy, E as EmptyStrategy, C as ComplexTimelineStrategy, I as ImageWithOptionalService, T as TimelineKeyframe, d as ImageServiceLoaderType, U as UnknownStrategy } from './useRenderingStrategy-
|
|
8
|
-
export { i as AnnotationPageDescription, A as AudioSequence, n as ChoiceEvents, e as Single3DModelStrategy, S as SingleAudio, a as SingleVideo, h as SingleYouTubeVideo, k as TextContent, j as TextualContentStrategy, m as UseRenderingStrategy, o as UseRenderingStrategyOptions, V as VideoSequence, g as get3dStrategy, f as getImageStrategy, l as getTextualContentStrategy, u as useLoadImageService, p as useRenderingStrategy } from './useRenderingStrategy-
|
|
8
|
+
import { R as RenderingStrategy, b as StrategyActions, M as MediaStrategy, c as SingleImageStrategy, E as EmptyStrategy, C as ComplexTimelineStrategy, I as ImageWithOptionalService, T as TimelineKeyframe, d as ImageServiceLoaderType, U as UnknownStrategy } from './useRenderingStrategy-CHg8UC3-.cjs';
|
|
9
|
+
export { i as AnnotationPageDescription, A as AudioSequence, n as ChoiceEvents, e as Single3DModelStrategy, S as SingleAudio, a as SingleVideo, h as SingleYouTubeVideo, k as TextContent, j as TextualContentStrategy, m as UseRenderingStrategy, o as UseRenderingStrategyOptions, V as VideoSequence, g as get3dStrategy, f as getImageStrategy, l as getTextualContentStrategy, u as useLoadImageService, p as useRenderingStrategy } from './useRenderingStrategy-CHg8UC3-.cjs';
|
|
9
10
|
import * as _iiif_helpers from '@iiif/helpers';
|
|
10
11
|
import { ChoiceDescription, Paintables, ComplexChoice, SupportedSelector, SvgSelector, BoxSelector } from '@iiif/helpers';
|
|
11
|
-
import { BoxStyle, AtlasProps, Preset } from '@atlas-viewer/atlas';
|
|
12
12
|
import * as polygon_editor from 'polygon-editor';
|
|
13
13
|
import { InputShape, PolygonEvents } from 'polygon-editor';
|
|
14
14
|
import { InternationalString, ImageService as ImageService$1, ImageSize, AuthProbeService2, Auth2LocationResource, Auth2SubstituteResource, AuthAccessService2, AuthAccessTokenService2, AuthAccessToken2, SearchServiceQueryParams, SearchServiceSearchResponse, SearchService as SearchService$1, SearchServiceAutocomplete, Reference, Annotation, SvgSelector as SvgSelector$1, FragmentSelector } from '@iiif/presentation-3';
|
|
@@ -22,12 +22,49 @@ import { Emitter, EventType, Handler } from 'mitt';
|
|
|
22
22
|
import { ImageServiceLoader, ImageCandidateRequest, ImageCandidate } from '@iiif/helpers/image-service';
|
|
23
23
|
import { Vault, VaultOptions, NormalizedEntity, IIIFStore } from '@iiif/helpers/vault';
|
|
24
24
|
import { CanvasNormalized, AnnotationNormalized, AnnotationPageNormalized, CollectionNormalized, ManifestNormalized, RangeNormalized } from '@iiif/presentation-3-normalized';
|
|
25
|
-
import { C as CompatVault } from './utils-
|
|
26
|
-
export { e as emptyActions, c as emptyStrategy, a as getParsedTargetSelector, g as getRenderingStrategy, p as parseSpecificResource, u as unknownResponse, b as unsupportedStrategy } from './utils-
|
|
25
|
+
import { C as CompatVault } from './utils-C0dpk-mp.cjs';
|
|
26
|
+
export { e as emptyActions, c as emptyStrategy, a as getParsedTargetSelector, g as getRenderingStrategy, p as parseSpecificResource, u as unknownResponse, b as unsupportedStrategy } from './utils-C0dpk-mp.cjs';
|
|
27
27
|
import { VaultZustandStore } from '@iiif/helpers/vault/store';
|
|
28
28
|
import * as _iiif_helpers_painting_annotations from '@iiif/helpers/painting-annotations';
|
|
29
29
|
import * as _iiif_helpers_styles from '@iiif/helpers/styles';
|
|
30
30
|
|
|
31
|
+
type RegionHighlightType = {
|
|
32
|
+
id: any;
|
|
33
|
+
x: number;
|
|
34
|
+
y: number;
|
|
35
|
+
width: number;
|
|
36
|
+
height: number;
|
|
37
|
+
};
|
|
38
|
+
declare function RegionHighlight({ id, interactive, region, onClick, onHover, onSave, aspectRatio, maintainAspectRatio, disableCardinalControls, isEditing, style, }: {
|
|
39
|
+
id?: string;
|
|
40
|
+
region: RegionHighlightType;
|
|
41
|
+
isEditing: boolean;
|
|
42
|
+
onSave?: (annotation: RegionHighlightType) => void;
|
|
43
|
+
onClick?: (annotation: RegionHighlightType) => void;
|
|
44
|
+
onHover?: (annotation: RegionHighlightType) => void;
|
|
45
|
+
aspectRatio?: number;
|
|
46
|
+
maintainAspectRatio?: boolean;
|
|
47
|
+
disableCardinalControls?: boolean;
|
|
48
|
+
interactive?: boolean;
|
|
49
|
+
style?: BoxStyle;
|
|
50
|
+
}): react_jsx_runtime.JSX.Element;
|
|
51
|
+
|
|
52
|
+
type ResizeWorldItemProps = JSX.IntrinsicElements['worldObject'] & {
|
|
53
|
+
handleSize?: number;
|
|
54
|
+
resizable?: boolean;
|
|
55
|
+
aspectRatio?: number;
|
|
56
|
+
onSave: (pos: Partial<{
|
|
57
|
+
x: number;
|
|
58
|
+
y: number;
|
|
59
|
+
width: number;
|
|
60
|
+
height: number;
|
|
61
|
+
}>) => void;
|
|
62
|
+
children?: ReactNode;
|
|
63
|
+
maintainAspectRatio?: boolean;
|
|
64
|
+
disableCardinalControls?: boolean;
|
|
65
|
+
};
|
|
66
|
+
declare function ResizeWorldItem({ handleSize: _handleSize, resizable, onSave, children, maintainAspectRatio, disableCardinalControls, aspectRatio, ...props }: ResizeWorldItemProps): react_jsx_runtime.JSX.Element;
|
|
67
|
+
|
|
31
68
|
declare function RenderAnnotationEditing({ theme, renderContextMenu, children, }: {
|
|
32
69
|
theme?: Partial<SVGTheme>;
|
|
33
70
|
renderContextMenu?: (options: RenderContextProps) => React.ReactNode;
|
|
@@ -93,10 +130,11 @@ declare function RenderEmptyStrategy({ backgroundStyle, alwaysShowBackground }:
|
|
|
93
130
|
interface ImageStrategyProps {
|
|
94
131
|
isStatic?: boolean;
|
|
95
132
|
enableSizes?: boolean;
|
|
133
|
+
enableAnnotations?: boolean;
|
|
96
134
|
onClickPaintingAnnotation?: (id: string, image: ImageWithOptionalService, e: any) => void;
|
|
97
135
|
children?: ReactNode;
|
|
98
136
|
}
|
|
99
|
-
declare function RenderImageStrategy({ isStatic, enableSizes, onClickPaintingAnnotation, children, }: ImageStrategyProps): react_jsx_runtime.JSX.Element | null;
|
|
137
|
+
declare function RenderImageStrategy({ isStatic, enableSizes, enableAnnotations, onClickPaintingAnnotation, children, }: ImageStrategyProps): react_jsx_runtime.JSX.Element | null;
|
|
100
138
|
|
|
101
139
|
interface TextualContextStrategyProps {
|
|
102
140
|
onClickPaintingAnnotation?: (id: string, e: any) => void;
|
|
@@ -1129,6 +1167,36 @@ declare function useRange<T>(options?: {
|
|
|
1129
1167
|
selector: (range: RangeNormalized) => T;
|
|
1130
1168
|
}, deps?: any[]): T | undefined;
|
|
1131
1169
|
|
|
1170
|
+
declare function useStaticRenderingStrategy({ supports }?: {
|
|
1171
|
+
supports?: Array<RenderingStrategy['type']>;
|
|
1172
|
+
}): RenderingStrategy;
|
|
1173
|
+
|
|
1174
|
+
interface StylesheetStore {
|
|
1175
|
+
stylesheets: Record<string, string>;
|
|
1176
|
+
loading: string[];
|
|
1177
|
+
errors: Array<{
|
|
1178
|
+
url: string;
|
|
1179
|
+
error: Error;
|
|
1180
|
+
}>;
|
|
1181
|
+
loadStylesheet(url: string): Promise<string>;
|
|
1182
|
+
setStylesheet(value: string, url?: string): string;
|
|
1183
|
+
parseStylesheet(stylesheet: Annotation['stylesheet'] | null): Promise<null | {
|
|
1184
|
+
id: string;
|
|
1185
|
+
type: 'CssStylesheet';
|
|
1186
|
+
value: string;
|
|
1187
|
+
}>;
|
|
1188
|
+
}
|
|
1189
|
+
declare const useStylesheetStore: zustand.UseBoundStore<zustand.StoreApi<StylesheetStore>>;
|
|
1190
|
+
declare function useRemoteStylesheet(stylesheet?: Annotation['stylesheet'] | null): readonly [Record<string, string>, {
|
|
1191
|
+
readonly id: string;
|
|
1192
|
+
readonly stylesheets: Record<string, string>;
|
|
1193
|
+
readonly loading: string[];
|
|
1194
|
+
readonly errors: {
|
|
1195
|
+
url: string;
|
|
1196
|
+
error: Error;
|
|
1197
|
+
}[];
|
|
1198
|
+
}];
|
|
1199
|
+
|
|
1132
1200
|
declare function useRequestAnnotation(opts?: {
|
|
1133
1201
|
onSuccess?: (r: AnnotationResponse) => void;
|
|
1134
1202
|
}): {
|
|
@@ -1347,4 +1415,4 @@ declare function getManifestSequence(vault: Vault, manifestOrRange: ManifestNorm
|
|
|
1347
1415
|
skipNonPaged?: boolean;
|
|
1348
1416
|
}): [Reference<'Canvas'>[], number[][]];
|
|
1349
1417
|
|
|
1350
|
-
export { AnnotationContext, AnnotationPageContext, AnnotationRequest, AnnotationRequestOptions, AnnotationResponse, type AnnotationStrategyProps, AnnotationStyleProvider, type AnnotationStyles, type AnnotationThemeDefinition, AtlasStore, Auth, type AuthAccessState, type AuthContextActions, type AuthContextCurrentActions, type AuthContextState, AuthProvider, AuthRContext, AuthReactContext, AuthReactContextActions, type AuthState, CanvasAnnotations, CanvasContext, CanvasStrategyProvider, CanvasWorldObject, CollectionContext, CombinedMetadata, ComplexTimelineProvider, ComplexTimelineStrategy, ContextBridge, type ControlsContext, ControlsReactContext, CreateCustomShape, type CreateCustomShapeProps, CustomContextBridge, CustomContextBridgeProvider, DefaultEditingTools, EmptyStrategy, EventEmitterProvider, EventsProvider, Image, type ImageProps, ImageService, ImageServiceLoaderContext, ImageServiceLoaderType, type ImageServiceRequestOptions, type ImageStrategyProps, ImageWithOptionalService, InnerViewerProvider, LanguageProvider, LanguageString, LocaleString, ManifestContext, ManifestMetadata, type MediaPlayerActions, MediaPlayerProvider, type MediaPlayerState, MediaStrategy, Metadata, type MetadataProps, PolygonSelector, type PolygonSelectorProps, type ProbeStore, RangeContext, ReactEmitterContext, ReactEventContext, ReactVaultContext, Render3DModelStrategy, RenderAccompanyingCanvas, RenderAnnotationEditing, RenderAnnotationStrategy, RenderAudioStrategy, RenderComplexTimelineStrategy, RenderContextProps, RenderEmptyStrategy, RenderImageStrategy, RenderSvgEditorControls, RenderTextualContentStrategy, RenderVideoStrategy, RenderYouTubeStrategy, RenderingStrategy, type ResourceContextType, ResourceProvider, ResourceReactContext, type ResourceRequestOptions, SVGTheme, SelectorControllerProvider, type SelectorHelperEventTypes, SequenceThumbnails, SimpleViewerContext, SimpleViewerProps, SimpleViewerProvider, SimpleViewerReactContext, SingleCanvasThumbnail, SingleImageStrategy, StrategyActions, type StrategyContext, StrategyReactContext, type SvgTheme, ThumbnailFallbackImage, TimelineKeyframe, TranslationProvider, TransliterationProvider, UnknownStrategy, type VaultActivatedAnnotation, VaultProvider, ViewerPresetContext, VirtualAnnotationProvider, VisibleCanvasReactContext, annotationResponseToSelector, authDetailsForResource, createAuthStateStore, createProbe, defaultEmitter, findAllCanvasesInRange, findFirstCanvasFromRange, findManifestSelectedRange, findSelectedRange, flattenAnnotationPageIds, formatTime, getComplexTimelineStrategy, getDefaultAnnotationStyles, getManifestSequence, getVideoStrategy, getVisibleCanvasesFromCanvasId, hasAuth, isBoxSelector, isRectangle, isSvgSelector, makeAccessServiceRequest, makeAccessTokenRequest, seraliseSupportedSelector, svgThemes, targetIntersects, useAnnotation, useAnnotationPage, useAnnotationPageManager, useAnnotationStyles, useAnnotationsAtTime, useAuthActions, useAuthService, useAuthStore, useAuthToken, useAuthTokens, useCanvas, useCanvasChoices, useCanvasClock, useCanvasSequence, useCanvasStartTime, useCanvasSubset, useClosestLanguage, useCollection, useComplexTimeline, useContextBridge, useCreateLocaleString, useCurrentAnnotationActions, useCurrentAnnotationMetadata, useCurrentAnnotationRequest, useCurrentAnnotationTransition, useCurrentAuth, useCustomContextBridge, useDispatch, useEmitter, useEvent, useEventEmitter, useEventListener, useExistingVault, useExternalCollection, useExternalManifest, useExternalResource, useIIIFLanguage, useImage, useImageService, useImageServiceLoader, useImageTile, useIsAuthEnabled, useLocaleString, useManifest, useMediaActions, useMediaElements, useMediaState, usePaintables, usePaintingAnnotations, usePolygonHelper, useRange, useRenderControls, useRequestAnnotation, useResourceContext, useResourceEvents, useResources, useSearchService, useSelectorController, useSelectorEmitter, useSelectorEvents, useSelectorHelper, useSimpleMediaPlayer, useSimpleViewer, useStrategy, useStyleHelper, useStyles, useSvgEditor, useSvgEditorControls, useThumbnail, useTranslations, useTransliteration, useVault, useVaultEffect, useVaultSelector, useViewerPreset, useVirtualAnnotationPage, useVirtualAnnotationPageContext, useVisibleCanvases };
|
|
1418
|
+
export { AnnotationContext, AnnotationPageContext, AnnotationRequest, AnnotationRequestOptions, AnnotationResponse, type AnnotationStrategyProps, AnnotationStyleProvider, type AnnotationStyles, type AnnotationThemeDefinition, AtlasStore, Auth, type AuthAccessState, type AuthContextActions, type AuthContextCurrentActions, type AuthContextState, AuthProvider, AuthRContext, AuthReactContext, AuthReactContextActions, type AuthState, CanvasAnnotations, CanvasContext, CanvasStrategyProvider, CanvasWorldObject, CollectionContext, CombinedMetadata, ComplexTimelineProvider, ComplexTimelineStrategy, ContextBridge, type ControlsContext, ControlsReactContext, CreateCustomShape, type CreateCustomShapeProps, CustomContextBridge, CustomContextBridgeProvider, DefaultEditingTools, EmptyStrategy, EventEmitterProvider, EventsProvider, Image, type ImageProps, ImageService, ImageServiceLoaderContext, ImageServiceLoaderType, type ImageServiceRequestOptions, type ImageStrategyProps, ImageWithOptionalService, InnerViewerProvider, LanguageProvider, LanguageString, LocaleString, ManifestContext, ManifestMetadata, type MediaPlayerActions, MediaPlayerProvider, type MediaPlayerState, MediaStrategy, Metadata, type MetadataProps, PolygonSelector, type PolygonSelectorProps, type ProbeStore, RangeContext, ReactEmitterContext, ReactEventContext, ReactVaultContext, RegionHighlight, Render3DModelStrategy, RenderAccompanyingCanvas, RenderAnnotationEditing, RenderAnnotationStrategy, RenderAudioStrategy, RenderComplexTimelineStrategy, RenderContextProps, RenderEmptyStrategy, RenderImageStrategy, RenderSvgEditorControls, RenderTextualContentStrategy, RenderVideoStrategy, RenderYouTubeStrategy, RenderingStrategy, ResizeWorldItem, type ResourceContextType, ResourceProvider, ResourceReactContext, type ResourceRequestOptions, SVGTheme, SelectorControllerProvider, type SelectorHelperEventTypes, SequenceThumbnails, SimpleViewerContext, SimpleViewerProps, SimpleViewerProvider, SimpleViewerReactContext, SingleCanvasThumbnail, SingleImageStrategy, StrategyActions, type StrategyContext, StrategyReactContext, type SvgTheme, ThumbnailFallbackImage, TimelineKeyframe, TranslationProvider, TransliterationProvider, UnknownStrategy, type VaultActivatedAnnotation, VaultProvider, ViewerPresetContext, VirtualAnnotationProvider, VisibleCanvasReactContext, annotationResponseToSelector, authDetailsForResource, createAuthStateStore, createProbe, defaultEmitter, findAllCanvasesInRange, findFirstCanvasFromRange, findManifestSelectedRange, findSelectedRange, flattenAnnotationPageIds, formatTime, getComplexTimelineStrategy, getDefaultAnnotationStyles, getManifestSequence, getVideoStrategy, getVisibleCanvasesFromCanvasId, hasAuth, isBoxSelector, isRectangle, isSvgSelector, makeAccessServiceRequest, makeAccessTokenRequest, seraliseSupportedSelector, svgThemes, targetIntersects, useAnnotation, useAnnotationPage, useAnnotationPageManager, useAnnotationStyles, useAnnotationsAtTime, useAuthActions, useAuthService, useAuthStore, useAuthToken, useAuthTokens, useCanvas, useCanvasChoices, useCanvasClock, useCanvasSequence, useCanvasStartTime, useCanvasSubset, useClosestLanguage, useCollection, useComplexTimeline, useContextBridge, useCreateLocaleString, useCurrentAnnotationActions, useCurrentAnnotationMetadata, useCurrentAnnotationRequest, useCurrentAnnotationTransition, useCurrentAuth, useCustomContextBridge, useDispatch, useEmitter, useEvent, useEventEmitter, useEventListener, useExistingVault, useExternalCollection, useExternalManifest, useExternalResource, useIIIFLanguage, useImage, useImageService, useImageServiceLoader, useImageTile, useIsAuthEnabled, useLocaleString, useManifest, useMediaActions, useMediaElements, useMediaState, usePaintables, usePaintingAnnotations, usePolygonHelper, useRange, useRemoteStylesheet, useRenderControls, useRequestAnnotation, useResourceContext, useResourceEvents, useResources, useSearchService, useSelectorController, useSelectorEmitter, useSelectorEvents, useSelectorHelper, useSimpleMediaPlayer, useSimpleViewer, useStaticRenderingStrategy, useStrategy, useStyleHelper, useStyles, useStylesheetStore, useSvgEditor, useSvgEditorControls, useThumbnail, useTranslations, useTransliteration, useVault, useVaultEffect, useVaultSelector, useViewerPreset, useVirtualAnnotationPage, useVirtualAnnotationPageContext, useVisibleCanvases };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
export * from '@iiif/helpers/annotation-targets';
|
|
2
|
-
import { S as SVGTheme, R as RenderContextProps, A as AudioComponentProps, V as VideoComponentProps, u as useSvgEditor, a as SimpleViewerContext, b as AtlasStore, c as AnnotationRequest, d as AnnotationResponse, e as AnnotationRequestOptions, f as SimpleViewerProps } from './index-
|
|
3
|
-
export { h as AtlasStoreEvents, n as AtlasStoreProvider, k as AtlasStoreReactContext, g as CanvasPanel, C as CanvasPanelProps, i as CreateAtlasStoreProps, o as RenderAnnotation, q as RenderAnnotationPage, x as SimpleViewerActions, y as SimpleViewerActionsType, w as SimpleViewerReducerState, j as createAtlasStore, v as defaultSvgTheme, m as getAtlasStoreByName, p as polygonToTarget, r as requestToAnnotationResponse, t as useAtlasContextMenu, l as useAtlasStore, s as useContextMenuStore } from './index-
|
|
2
|
+
import { S as SVGTheme, R as RenderContextProps, A as AudioComponentProps, V as VideoComponentProps, u as useSvgEditor, a as SimpleViewerContext, b as AtlasStore, c as AnnotationRequest, d as AnnotationResponse, e as AnnotationRequestOptions, f as SimpleViewerProps } from './index-Cxmpcndt.js';
|
|
3
|
+
export { h as AtlasStoreEvents, n as AtlasStoreProvider, k as AtlasStoreReactContext, g as CanvasPanel, C as CanvasPanelProps, i as CreateAtlasStoreProps, o as RenderAnnotation, q as RenderAnnotationPage, x as SimpleViewerActions, y as SimpleViewerActionsType, w as SimpleViewerReducerState, j as createAtlasStore, v as defaultSvgTheme, m as getAtlasStoreByName, p as polygonToTarget, r as requestToAnnotationResponse, t as useAtlasContextMenu, l as useAtlasStore, s as useContextMenuStore } from './index-Cxmpcndt.js';
|
|
4
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
|
+
import { BoxStyle, AtlasProps, Preset } from '@atlas-viewer/atlas';
|
|
5
6
|
import * as React$1 from 'react';
|
|
6
7
|
import React__default, { ReactNode, FunctionComponent, RefObject, Context } from 'react';
|
|
7
|
-
import { R as RenderingStrategy, b as StrategyActions, M as MediaStrategy, c as SingleImageStrategy, E as EmptyStrategy, C as ComplexTimelineStrategy, I as ImageWithOptionalService, T as TimelineKeyframe, d as ImageServiceLoaderType, U as UnknownStrategy } from './useRenderingStrategy-
|
|
8
|
-
export { i as AnnotationPageDescription, A as AudioSequence, n as ChoiceEvents, e as Single3DModelStrategy, S as SingleAudio, a as SingleVideo, h as SingleYouTubeVideo, k as TextContent, j as TextualContentStrategy, m as UseRenderingStrategy, o as UseRenderingStrategyOptions, V as VideoSequence, g as get3dStrategy, f as getImageStrategy, l as getTextualContentStrategy, u as useLoadImageService, p as useRenderingStrategy } from './useRenderingStrategy-
|
|
8
|
+
import { R as RenderingStrategy, b as StrategyActions, M as MediaStrategy, c as SingleImageStrategy, E as EmptyStrategy, C as ComplexTimelineStrategy, I as ImageWithOptionalService, T as TimelineKeyframe, d as ImageServiceLoaderType, U as UnknownStrategy } from './useRenderingStrategy-CHg8UC3-.js';
|
|
9
|
+
export { i as AnnotationPageDescription, A as AudioSequence, n as ChoiceEvents, e as Single3DModelStrategy, S as SingleAudio, a as SingleVideo, h as SingleYouTubeVideo, k as TextContent, j as TextualContentStrategy, m as UseRenderingStrategy, o as UseRenderingStrategyOptions, V as VideoSequence, g as get3dStrategy, f as getImageStrategy, l as getTextualContentStrategy, u as useLoadImageService, p as useRenderingStrategy } from './useRenderingStrategy-CHg8UC3-.js';
|
|
9
10
|
import * as _iiif_helpers from '@iiif/helpers';
|
|
10
11
|
import { ChoiceDescription, Paintables, ComplexChoice, SupportedSelector, SvgSelector, BoxSelector } from '@iiif/helpers';
|
|
11
|
-
import { BoxStyle, AtlasProps, Preset } from '@atlas-viewer/atlas';
|
|
12
12
|
import * as polygon_editor from 'polygon-editor';
|
|
13
13
|
import { InputShape, PolygonEvents } from 'polygon-editor';
|
|
14
14
|
import { InternationalString, ImageService as ImageService$1, ImageSize, AuthProbeService2, Auth2LocationResource, Auth2SubstituteResource, AuthAccessService2, AuthAccessTokenService2, AuthAccessToken2, SearchServiceQueryParams, SearchServiceSearchResponse, SearchService as SearchService$1, SearchServiceAutocomplete, Reference, Annotation, SvgSelector as SvgSelector$1, FragmentSelector } from '@iiif/presentation-3';
|
|
@@ -22,12 +22,49 @@ import { Emitter, EventType, Handler } from 'mitt';
|
|
|
22
22
|
import { ImageServiceLoader, ImageCandidateRequest, ImageCandidate } from '@iiif/helpers/image-service';
|
|
23
23
|
import { Vault, VaultOptions, NormalizedEntity, IIIFStore } from '@iiif/helpers/vault';
|
|
24
24
|
import { CanvasNormalized, AnnotationNormalized, AnnotationPageNormalized, CollectionNormalized, ManifestNormalized, RangeNormalized } from '@iiif/presentation-3-normalized';
|
|
25
|
-
import { C as CompatVault } from './utils-
|
|
26
|
-
export { e as emptyActions, c as emptyStrategy, a as getParsedTargetSelector, g as getRenderingStrategy, p as parseSpecificResource, u as unknownResponse, b as unsupportedStrategy } from './utils-
|
|
25
|
+
import { C as CompatVault } from './utils-B4O1xptf.js';
|
|
26
|
+
export { e as emptyActions, c as emptyStrategy, a as getParsedTargetSelector, g as getRenderingStrategy, p as parseSpecificResource, u as unknownResponse, b as unsupportedStrategy } from './utils-B4O1xptf.js';
|
|
27
27
|
import { VaultZustandStore } from '@iiif/helpers/vault/store';
|
|
28
28
|
import * as _iiif_helpers_painting_annotations from '@iiif/helpers/painting-annotations';
|
|
29
29
|
import * as _iiif_helpers_styles from '@iiif/helpers/styles';
|
|
30
30
|
|
|
31
|
+
type RegionHighlightType = {
|
|
32
|
+
id: any;
|
|
33
|
+
x: number;
|
|
34
|
+
y: number;
|
|
35
|
+
width: number;
|
|
36
|
+
height: number;
|
|
37
|
+
};
|
|
38
|
+
declare function RegionHighlight({ id, interactive, region, onClick, onHover, onSave, aspectRatio, maintainAspectRatio, disableCardinalControls, isEditing, style, }: {
|
|
39
|
+
id?: string;
|
|
40
|
+
region: RegionHighlightType;
|
|
41
|
+
isEditing: boolean;
|
|
42
|
+
onSave?: (annotation: RegionHighlightType) => void;
|
|
43
|
+
onClick?: (annotation: RegionHighlightType) => void;
|
|
44
|
+
onHover?: (annotation: RegionHighlightType) => void;
|
|
45
|
+
aspectRatio?: number;
|
|
46
|
+
maintainAspectRatio?: boolean;
|
|
47
|
+
disableCardinalControls?: boolean;
|
|
48
|
+
interactive?: boolean;
|
|
49
|
+
style?: BoxStyle;
|
|
50
|
+
}): react_jsx_runtime.JSX.Element;
|
|
51
|
+
|
|
52
|
+
type ResizeWorldItemProps = JSX.IntrinsicElements['worldObject'] & {
|
|
53
|
+
handleSize?: number;
|
|
54
|
+
resizable?: boolean;
|
|
55
|
+
aspectRatio?: number;
|
|
56
|
+
onSave: (pos: Partial<{
|
|
57
|
+
x: number;
|
|
58
|
+
y: number;
|
|
59
|
+
width: number;
|
|
60
|
+
height: number;
|
|
61
|
+
}>) => void;
|
|
62
|
+
children?: ReactNode;
|
|
63
|
+
maintainAspectRatio?: boolean;
|
|
64
|
+
disableCardinalControls?: boolean;
|
|
65
|
+
};
|
|
66
|
+
declare function ResizeWorldItem({ handleSize: _handleSize, resizable, onSave, children, maintainAspectRatio, disableCardinalControls, aspectRatio, ...props }: ResizeWorldItemProps): react_jsx_runtime.JSX.Element;
|
|
67
|
+
|
|
31
68
|
declare function RenderAnnotationEditing({ theme, renderContextMenu, children, }: {
|
|
32
69
|
theme?: Partial<SVGTheme>;
|
|
33
70
|
renderContextMenu?: (options: RenderContextProps) => React.ReactNode;
|
|
@@ -93,10 +130,11 @@ declare function RenderEmptyStrategy({ backgroundStyle, alwaysShowBackground }:
|
|
|
93
130
|
interface ImageStrategyProps {
|
|
94
131
|
isStatic?: boolean;
|
|
95
132
|
enableSizes?: boolean;
|
|
133
|
+
enableAnnotations?: boolean;
|
|
96
134
|
onClickPaintingAnnotation?: (id: string, image: ImageWithOptionalService, e: any) => void;
|
|
97
135
|
children?: ReactNode;
|
|
98
136
|
}
|
|
99
|
-
declare function RenderImageStrategy({ isStatic, enableSizes, onClickPaintingAnnotation, children, }: ImageStrategyProps): react_jsx_runtime.JSX.Element | null;
|
|
137
|
+
declare function RenderImageStrategy({ isStatic, enableSizes, enableAnnotations, onClickPaintingAnnotation, children, }: ImageStrategyProps): react_jsx_runtime.JSX.Element | null;
|
|
100
138
|
|
|
101
139
|
interface TextualContextStrategyProps {
|
|
102
140
|
onClickPaintingAnnotation?: (id: string, e: any) => void;
|
|
@@ -1129,6 +1167,36 @@ declare function useRange<T>(options?: {
|
|
|
1129
1167
|
selector: (range: RangeNormalized) => T;
|
|
1130
1168
|
}, deps?: any[]): T | undefined;
|
|
1131
1169
|
|
|
1170
|
+
declare function useStaticRenderingStrategy({ supports }?: {
|
|
1171
|
+
supports?: Array<RenderingStrategy['type']>;
|
|
1172
|
+
}): RenderingStrategy;
|
|
1173
|
+
|
|
1174
|
+
interface StylesheetStore {
|
|
1175
|
+
stylesheets: Record<string, string>;
|
|
1176
|
+
loading: string[];
|
|
1177
|
+
errors: Array<{
|
|
1178
|
+
url: string;
|
|
1179
|
+
error: Error;
|
|
1180
|
+
}>;
|
|
1181
|
+
loadStylesheet(url: string): Promise<string>;
|
|
1182
|
+
setStylesheet(value: string, url?: string): string;
|
|
1183
|
+
parseStylesheet(stylesheet: Annotation['stylesheet'] | null): Promise<null | {
|
|
1184
|
+
id: string;
|
|
1185
|
+
type: 'CssStylesheet';
|
|
1186
|
+
value: string;
|
|
1187
|
+
}>;
|
|
1188
|
+
}
|
|
1189
|
+
declare const useStylesheetStore: zustand.UseBoundStore<zustand.StoreApi<StylesheetStore>>;
|
|
1190
|
+
declare function useRemoteStylesheet(stylesheet?: Annotation['stylesheet'] | null): readonly [Record<string, string>, {
|
|
1191
|
+
readonly id: string;
|
|
1192
|
+
readonly stylesheets: Record<string, string>;
|
|
1193
|
+
readonly loading: string[];
|
|
1194
|
+
readonly errors: {
|
|
1195
|
+
url: string;
|
|
1196
|
+
error: Error;
|
|
1197
|
+
}[];
|
|
1198
|
+
}];
|
|
1199
|
+
|
|
1132
1200
|
declare function useRequestAnnotation(opts?: {
|
|
1133
1201
|
onSuccess?: (r: AnnotationResponse) => void;
|
|
1134
1202
|
}): {
|
|
@@ -1347,4 +1415,4 @@ declare function getManifestSequence(vault: Vault, manifestOrRange: ManifestNorm
|
|
|
1347
1415
|
skipNonPaged?: boolean;
|
|
1348
1416
|
}): [Reference<'Canvas'>[], number[][]];
|
|
1349
1417
|
|
|
1350
|
-
export { AnnotationContext, AnnotationPageContext, AnnotationRequest, AnnotationRequestOptions, AnnotationResponse, type AnnotationStrategyProps, AnnotationStyleProvider, type AnnotationStyles, type AnnotationThemeDefinition, AtlasStore, Auth, type AuthAccessState, type AuthContextActions, type AuthContextCurrentActions, type AuthContextState, AuthProvider, AuthRContext, AuthReactContext, AuthReactContextActions, type AuthState, CanvasAnnotations, CanvasContext, CanvasStrategyProvider, CanvasWorldObject, CollectionContext, CombinedMetadata, ComplexTimelineProvider, ComplexTimelineStrategy, ContextBridge, type ControlsContext, ControlsReactContext, CreateCustomShape, type CreateCustomShapeProps, CustomContextBridge, CustomContextBridgeProvider, DefaultEditingTools, EmptyStrategy, EventEmitterProvider, EventsProvider, Image, type ImageProps, ImageService, ImageServiceLoaderContext, ImageServiceLoaderType, type ImageServiceRequestOptions, type ImageStrategyProps, ImageWithOptionalService, InnerViewerProvider, LanguageProvider, LanguageString, LocaleString, ManifestContext, ManifestMetadata, type MediaPlayerActions, MediaPlayerProvider, type MediaPlayerState, MediaStrategy, Metadata, type MetadataProps, PolygonSelector, type PolygonSelectorProps, type ProbeStore, RangeContext, ReactEmitterContext, ReactEventContext, ReactVaultContext, Render3DModelStrategy, RenderAccompanyingCanvas, RenderAnnotationEditing, RenderAnnotationStrategy, RenderAudioStrategy, RenderComplexTimelineStrategy, RenderContextProps, RenderEmptyStrategy, RenderImageStrategy, RenderSvgEditorControls, RenderTextualContentStrategy, RenderVideoStrategy, RenderYouTubeStrategy, RenderingStrategy, type ResourceContextType, ResourceProvider, ResourceReactContext, type ResourceRequestOptions, SVGTheme, SelectorControllerProvider, type SelectorHelperEventTypes, SequenceThumbnails, SimpleViewerContext, SimpleViewerProps, SimpleViewerProvider, SimpleViewerReactContext, SingleCanvasThumbnail, SingleImageStrategy, StrategyActions, type StrategyContext, StrategyReactContext, type SvgTheme, ThumbnailFallbackImage, TimelineKeyframe, TranslationProvider, TransliterationProvider, UnknownStrategy, type VaultActivatedAnnotation, VaultProvider, ViewerPresetContext, VirtualAnnotationProvider, VisibleCanvasReactContext, annotationResponseToSelector, authDetailsForResource, createAuthStateStore, createProbe, defaultEmitter, findAllCanvasesInRange, findFirstCanvasFromRange, findManifestSelectedRange, findSelectedRange, flattenAnnotationPageIds, formatTime, getComplexTimelineStrategy, getDefaultAnnotationStyles, getManifestSequence, getVideoStrategy, getVisibleCanvasesFromCanvasId, hasAuth, isBoxSelector, isRectangle, isSvgSelector, makeAccessServiceRequest, makeAccessTokenRequest, seraliseSupportedSelector, svgThemes, targetIntersects, useAnnotation, useAnnotationPage, useAnnotationPageManager, useAnnotationStyles, useAnnotationsAtTime, useAuthActions, useAuthService, useAuthStore, useAuthToken, useAuthTokens, useCanvas, useCanvasChoices, useCanvasClock, useCanvasSequence, useCanvasStartTime, useCanvasSubset, useClosestLanguage, useCollection, useComplexTimeline, useContextBridge, useCreateLocaleString, useCurrentAnnotationActions, useCurrentAnnotationMetadata, useCurrentAnnotationRequest, useCurrentAnnotationTransition, useCurrentAuth, useCustomContextBridge, useDispatch, useEmitter, useEvent, useEventEmitter, useEventListener, useExistingVault, useExternalCollection, useExternalManifest, useExternalResource, useIIIFLanguage, useImage, useImageService, useImageServiceLoader, useImageTile, useIsAuthEnabled, useLocaleString, useManifest, useMediaActions, useMediaElements, useMediaState, usePaintables, usePaintingAnnotations, usePolygonHelper, useRange, useRenderControls, useRequestAnnotation, useResourceContext, useResourceEvents, useResources, useSearchService, useSelectorController, useSelectorEmitter, useSelectorEvents, useSelectorHelper, useSimpleMediaPlayer, useSimpleViewer, useStrategy, useStyleHelper, useStyles, useSvgEditor, useSvgEditorControls, useThumbnail, useTranslations, useTransliteration, useVault, useVaultEffect, useVaultSelector, useViewerPreset, useVirtualAnnotationPage, useVirtualAnnotationPageContext, useVisibleCanvases };
|
|
1418
|
+
export { AnnotationContext, AnnotationPageContext, AnnotationRequest, AnnotationRequestOptions, AnnotationResponse, type AnnotationStrategyProps, AnnotationStyleProvider, type AnnotationStyles, type AnnotationThemeDefinition, AtlasStore, Auth, type AuthAccessState, type AuthContextActions, type AuthContextCurrentActions, type AuthContextState, AuthProvider, AuthRContext, AuthReactContext, AuthReactContextActions, type AuthState, CanvasAnnotations, CanvasContext, CanvasStrategyProvider, CanvasWorldObject, CollectionContext, CombinedMetadata, ComplexTimelineProvider, ComplexTimelineStrategy, ContextBridge, type ControlsContext, ControlsReactContext, CreateCustomShape, type CreateCustomShapeProps, CustomContextBridge, CustomContextBridgeProvider, DefaultEditingTools, EmptyStrategy, EventEmitterProvider, EventsProvider, Image, type ImageProps, ImageService, ImageServiceLoaderContext, ImageServiceLoaderType, type ImageServiceRequestOptions, type ImageStrategyProps, ImageWithOptionalService, InnerViewerProvider, LanguageProvider, LanguageString, LocaleString, ManifestContext, ManifestMetadata, type MediaPlayerActions, MediaPlayerProvider, type MediaPlayerState, MediaStrategy, Metadata, type MetadataProps, PolygonSelector, type PolygonSelectorProps, type ProbeStore, RangeContext, ReactEmitterContext, ReactEventContext, ReactVaultContext, RegionHighlight, Render3DModelStrategy, RenderAccompanyingCanvas, RenderAnnotationEditing, RenderAnnotationStrategy, RenderAudioStrategy, RenderComplexTimelineStrategy, RenderContextProps, RenderEmptyStrategy, RenderImageStrategy, RenderSvgEditorControls, RenderTextualContentStrategy, RenderVideoStrategy, RenderYouTubeStrategy, RenderingStrategy, ResizeWorldItem, type ResourceContextType, ResourceProvider, ResourceReactContext, type ResourceRequestOptions, SVGTheme, SelectorControllerProvider, type SelectorHelperEventTypes, SequenceThumbnails, SimpleViewerContext, SimpleViewerProps, SimpleViewerProvider, SimpleViewerReactContext, SingleCanvasThumbnail, SingleImageStrategy, StrategyActions, type StrategyContext, StrategyReactContext, type SvgTheme, ThumbnailFallbackImage, TimelineKeyframe, TranslationProvider, TransliterationProvider, UnknownStrategy, type VaultActivatedAnnotation, VaultProvider, ViewerPresetContext, VirtualAnnotationProvider, VisibleCanvasReactContext, annotationResponseToSelector, authDetailsForResource, createAuthStateStore, createProbe, defaultEmitter, findAllCanvasesInRange, findFirstCanvasFromRange, findManifestSelectedRange, findSelectedRange, flattenAnnotationPageIds, formatTime, getComplexTimelineStrategy, getDefaultAnnotationStyles, getManifestSequence, getVideoStrategy, getVisibleCanvasesFromCanvasId, hasAuth, isBoxSelector, isRectangle, isSvgSelector, makeAccessServiceRequest, makeAccessTokenRequest, seraliseSupportedSelector, svgThemes, targetIntersects, useAnnotation, useAnnotationPage, useAnnotationPageManager, useAnnotationStyles, useAnnotationsAtTime, useAuthActions, useAuthService, useAuthStore, useAuthToken, useAuthTokens, useCanvas, useCanvasChoices, useCanvasClock, useCanvasSequence, useCanvasStartTime, useCanvasSubset, useClosestLanguage, useCollection, useComplexTimeline, useContextBridge, useCreateLocaleString, useCurrentAnnotationActions, useCurrentAnnotationMetadata, useCurrentAnnotationRequest, useCurrentAnnotationTransition, useCurrentAuth, useCustomContextBridge, useDispatch, useEmitter, useEvent, useEventEmitter, useEventListener, useExistingVault, useExternalCollection, useExternalManifest, useExternalResource, useIIIFLanguage, useImage, useImageService, useImageServiceLoader, useImageTile, useIsAuthEnabled, useLocaleString, useManifest, useMediaActions, useMediaElements, useMediaState, usePaintables, usePaintingAnnotations, usePolygonHelper, useRange, useRemoteStylesheet, useRenderControls, useRequestAnnotation, useResourceContext, useResourceEvents, useResources, useSearchService, useSelectorController, useSelectorEmitter, useSelectorEvents, useSelectorHelper, useSimpleMediaPlayer, useSimpleViewer, useStaticRenderingStrategy, useStrategy, useStyleHelper, useStyles, useStylesheetStore, useSvgEditor, useSvgEditorControls, useThumbnail, useTranslations, useTransliteration, useVault, useVaultEffect, useVaultSelector, useViewerPreset, useVirtualAnnotationPage, useVirtualAnnotationPageContext, useVisibleCanvases };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{$ as zo,$a as q,A as uo,Aa as rr,Ab as Yr,B as fo,Ba as nr,Bb as Gr,C as po,Ca as ir,Cb as rn,D as go,Da as ar,Db as ve,E as ho,Ea as sr,Eb as nn,F as yo,Fa as lr,Fb as xe,G as vo,Ga as cr,Gb as D,H as xo,Ha as mr,Hb as an,I as So,Ia as ur,Ib as fn,J as bo,Ja as dr,Jb as pn,K as Co,Ka as fr,Kb as gn,L as Io,La as de,Lb as Se,M as Ro,Ma as fe,Mb as be,N as Po,Na as pr,Nb as Ce,O as wo,Oa as gr,P as To,Pa as pe,Q as qo,Qa as ge,R as Ao,Ra as hr,S as No,Sa as yr,T as Eo,Ta as vr,U as ae,Ua as xr,V as ko,Va as Sr,W as Mo,Wa as br,X as Ho,Xa as Cr,Y as B,Ya as Ir,Z as se,Za as Rr,_ as le,_a as Pr,a as Xt,aa as Lo,ab as he,b as H,ba as Bo,bb as wr,c as A,ca as ce,cb as Tr,d as oe,da as me,db as qr,e as Yt,ea as Do,eb as Ar,f as Gt,fa as Wo,fb as X,g as P,ga as R,gb as Nr,h as z,ha as Oo,hb as Er,i as Jt,ia as Fo,ib as kr,j as re,ja as Vo,jb as Mr,k as Zt,ka as $o,kb as Hr,l as L,la as Ko,lb as zr,m as ne,ma as w,mb as Lr,n as jt,na as _o,nb as Br,o as eo,oa as Qo,ob as Dr,p as to,pa as Uo,pb as Wr,q as oo,qa as Xo,qb as ye,r as ro,ra as Yo,rb as Or,s as no,sa as Go,sb as Fr,t as io,ta as Jo,tb as Vr,u as ao,ua as Zo,ub as $r,v as so,va as jo,vb as Kr,w as ie,wa as er,wb as _r,x as lo,xa as ue,xb as Qr,y as co,ya as tr,yb as Ur,z as mo,za as or,zb as Xr}from"./chunk-5VWTU5L4.js";import{a as Jr,b as Zr,c as jr,d as en,e as tn,f as on,g as sn,h as ln,i as cn,j as mn,k as un,l as dn}from"./chunk-OTG27VBE.js";export*from"@iiif/helpers/annotation-targets";import{useEffect as Xe}from"react";import{useCallback as Ie,useEffect as Qe,useRef as Ue,useState as W}from"react";import{useStore as N}from"zustand";function Re(e){let[t,o]=W(0),r=R(),n=N(r,y=>y.tool.enabled),i=N(r,y=>y.tool.requestId),a=N(r,y=>y.getRequestId),s=N(r,y=>y.requestAnnotation),d=N(r,y=>y.completeRequest),m=N(r,y=>y.cancelRequest),l=Ue(e?.onSuccess);l.current=e?.onSuccess;let[p,v]=W(!1),[b,S]=W(null),[c,u]=W(null),f=n&&i!==c,g=n&&i===c,h=Ie(async(y,_e)=>{if(c){let te=l.current;v(!0);let M=await s(y,{..._e,requestId:c});if(M)return te?.(M),o(U=>U+1),v(!1),S(M),M;let Q={id:c,cancelled:!0,...me(y)};return te?.(Q),S(Q),o(U=>U+1),v(!1),Q}return null},[s,c]),x=Ie(()=>{S(null),v(!1)},[]);return Qe(()=>{let y=a();return u(y.requestId),()=>{y.clear()}},[t]),{id:t,busy:f,isPending:p,isActive:g,requestId:c,requestAnnotation:h,cancelRequest:()=>c?m(c):void 0,completeRequest:()=>c?d(c):void 0,reset:x,data:b}}var In=[{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 Pe(e){let{id:t,data:o,requestAnnotation:r,cancelRequest:n,isPending:i}=Re({onSuccess:a=>{e.updateShape(a.polygon)}});return Xe(()=>(r({type:"polygon",open:e.shape?.open,points:e.shape?.points}),()=>{n()}),[]),null}import{createContext as Ye,useCallback as we,useContext as qe,useEffect as Te,useMemo as Y,useState as Ge}from"react";import Ae from"mitt";import{jsx as Je}from"react/jsx-runtime";var O=Ye(Ae());O.displayName="SelectorHelper";function Nn({children:e}){return Je(O.Provider,{value:Y(()=>Ae(),[]),children:e})}function En(){return qe(O)}function Ne(e){let t=Ee(),[o,r]=Ge(!1);Te(()=>t.withSelector(e).on("highlight",()=>{r(!0)}),[t,e]),Te(()=>t.withSelector(e).on("clear-highlight",()=>{r(!1)}),[t,e]);let n=we(a=>{t.emit("click",{selectorId:e,event:a})},[e,t]),i=we(a=>{t.emit("hover",{selectorId:e,event:a})},[e,t]);return{controller:t,onClick:n,onHover:i,isHighlighted:o}}function Ee(){let e=qe(O);return Y(()=>({withSelector(t){return{on(o,r){let n=i=>{i&&i.selectorId===t&&r(i)};return e.on(o,n),()=>{e.off(o,n)}},emit(o,r){e.emit(o,{...r,selectorId:t})}}},on(t,o){return e.on(t,o),()=>{e.off(t,o)}},emit(t,o){e.emit(t,o)}}),[e])}function kn(){let e=Ee();return Y(()=>({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,r){return e.emit("event-listener",{selectorId:t,name:o,callback:r}),()=>{e.emit("remove-event-listener",{selectorId:t,name:o,callback:r})}},getImagePreview(){return new Promise((o,r)=>{e.emit("image-preview-request",{selectorId:t,resolve:o,reject:r})})},on(o,r){return e.withSelector(t).on(o,r)}}},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,r){return e.emit("event-listener",{selectorId:t,name:o,callback:r}),()=>{e.emit("remove-event-listener",{selectorId:t,name:o,callback:r})}},getImagePreview(t){return new Promise((o,r)=>{e.emit("image-preview-request",{selectorId:t,resolve:o,reject:r})})},on(t,o){return e.on(t,o)}}),[e])}import{createContext as Ze,useContext as je,useMemo as et}from"react";import{jsx as tt}from"react/jsx-runtime";function ke(){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 G=Ze(ke());G.displayName="AnnotationStyle";function Me(){return je(G)}function Ln({theme:e,children:t}){let o=et(()=>e||ke(),[e]);return tt(G.Provider,{value:o,children:t})}import{jsx as He}from"react/jsx-runtime";function _n(e){let t=w(),o=e.annotationBucket,r=e.readOnly,n=e.id,{onClick:i,isHighlighted:a}=Ne(e.id),s=Me(),d=a?s.highlighted:s[o||"hidden"]||s.hidden;if(!t)return null;if(r){let m="shape",l=e.polygon,p=l.open;return l?He(m,{id:`shape-${n}`,points:l.points,open:p,onClick:i,relativeStyle:!0,target:{x:0,y:0,width:t.width,height:t.height},style:d}):null}return He(Pe,{image:t,shape:e.polygon||{id:e.id,open:!0,points:[]},updateShape:e.updatePolygon,theme:e.theme,controlsHtmlId:e.controlsHtmlId,renderControls:e.renderControls})}import{useCanvas as ot}from"@atlas-viewer/atlas";import{forwardRef as rt,useImperativeHandle as nt}from"react";import{Fragment as it,jsx as ze}from"react/jsx-runtime";var jn=rt(function({canvasId:t},o){let r=ot(),n=ve(t||r?.id),i=P();return nt(o,()=>n,[t,r]),!r||n.enabledPageIds.length===0?null:ze(it,{children:n.enabledPageIds.map(a=>ze(Ce.RenderAnnotationPage,{page:i.get(a)},a))})});import{useMemo as lt}from"react";import{useMemo as at}from"react";import{Fragment as st,jsx as C,jsxs as F}from"react/jsx-runtime";function V({metadata:e=[],config:t,labelWidth:o=16,showEmptyMessage:r=!0,allowHtml:n,emptyFallback:i,classes:a={},emptyMessage:s="No metadata available",emptyValueFallback:d="No value",emptyLabelFallback:m="",separator:l,tableFooter:p,tableHeader:v}){let b=at(()=>{let c=(t||[]).reduce((f,g)=>[...f,...g.keys],[]),u={};for(let f of e){let g=f&&f.label?Object.values(f.label):[];for(let h of g)if(h&&h.length&&(c.indexOf(`metadata.${h[0]}`)!==-1||c.length===0)&&f){let x=`metadata.${h[0]}`;u[x]=u[x]?u[x]:[],u[x].push(f);break}}return u},[t,e]);return Object.keys(b).length===0&&r?C(st,{children:i})||C("div",{className:a.empty,children:s}):t&&t.length?F("table",{className:a.container,children:[v,C("tbody",{children:t.map((c,u)=>{let f=[];for(let g of c.keys)for(let h of b[g]||[])f.push(C(q,{enableDangerouslySetInnerHTML:n,defaultText:d,separator:l,children:h.value},u+"__"+g));return f.length===0?null:F("tr",{className:a.row,children:[C("td",{className:a.label,style:o?{minWidth:o}:{},children:C(q,{enableDangerouslySetInnerHTML:n,separator:l,defaultText:m,children:c.label})}),C("td",{className:a.value,children:f})]},u)})}),p]}):F("table",{className:a.container,children:[v,C("tbody",{children:e&&e.length?e.map((c,u)=>c?F("tr",{className:a.row,children:[C("td",{className:a.label,style:o?{minWidth:o}:{},children:C(q,{enableDangerouslySetInnerHTML:n,defaultText:d,separator:l,children:c.label})}),C("td",{className:a.value,children:C(q,{enableDangerouslySetInnerHTML:n,defaultText:d,separator:l,children:c.value})})]},u):null):null}),p]})}import{jsx as ct}from"react/jsx-runtime";function di(e){let t=L(),o=w(),r=ie(),n=lt(()=>{let i=t?.metadata||[],a=o?.metadata||[],s=r?.metadata||[];return[...i,...a,...s]},[t,o,r]);return ct(V,{metadata:n,...e})}import{useEffect as ft,useState as pt}from"react";import{createImageServiceRequest as mt,imageServiceRequestToString as ut}from"@iiif/parser/image-3";import{useMemo as dt}from"react";function J(e,t={},o=[]){return dt(()=>{if(!e)return null;let r=t.quality;e&&e.extraQualities&&t.quality&&(e.extraQualities.includes(t.quality)||(r="default"));let n=mt(e);return ut({identifier:n.identifier,server:n.server,scheme:n.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:r||"default",prefix:n.prefix,originalPath:n.originalPath})},[...o])}import{jsx as $}from"react/jsx-runtime";function gt(e){let t=typeof e.src=="string"?e.src:e.src.id,o=de(),[r,n]=pt(!1),i;if(t){let s=o.loadServiceSync({id:t});s&&(i=s)}!i&&!r&&o.loadService({id:t}).then(()=>{n(!0)});let a=J(i,{size:e.size,selector:e.region,rotation:e.rotation,format:e.format,region:e.region,quality:e.quality},[r,e.src,e.size,e.region,e.rotation,e.format,e.region,e.quality]);return ft(()=>()=>{n(!1)},[t]),a?$("img",{src:a,alt:e.alt,className:e.className,style:e.style}):$(ht,{...e,fetchImageService:!1})}function ht(e){if(e.fetchImageService)return $(gt,{...e});let t=typeof e.src=="string"?{id:e.src,profile:"level0"}:e.src,o=J(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{useMemo as yt,useState as vt}from"react";import{ErrorBoundary as xt}from"react-error-boundary";import{jsx as E,jsxs as bt}from"react/jsx-runtime";function Mi({src:e,errorFallback:t,interactive:o,skipSizes:r,children:n,renderViewerControls:i,viewControlsDeps:a,fluid:s,x:d,y:m,...l}){let[p,v]=vt(),b=t||Se,[S,c]=xe(),u=yt(()=>{let g=c[e]?.status,h=S({id:e},{});return h?.height&&h.width&&g!=="loading"?{id:e,width:h.width,height:h.height,service:h,type:"Image",selector:{type:"BoxSelector",spatial:{x:0,y:0,width:h.width,height:h.height}},target:{type:"BoxSelector",spatial:{x:0,y:0,width:h.width,height:h.height}}}:null},[S,e,c]);if(!u||!u.height||!u.width)return null;let f=s?void 0:l.homePosition?l.homePosition.width/l.homePosition.height:u.width/u.height;return E(xt,{resetKeys:[],fallbackRender:g=>E(b,{...l,...g}),children:E(be,{...l,aspectRatio:f,containerProps:{style:{position:"relative"},...l.containerProps||{}},onCreated:g=>{v(g),l.onCreated&&l.onCreated(g)},children:bt(X.Provider,{value:p,children:[E(he,{image:u,id:u.id,isStatic:!o,x:d,y:m},u.id),E(St,{viewerPreset:p,renderViewerControls:i,image:u,src:e,viewControlsDeps:a}),n]})})})}function St({viewerPreset:e,renderViewerControls:t,image:o,src:r,viewControlsDeps:n}){return ue(e&&t?"overlay":"none",`canvas-portal-controls-${r}`,X.Provider,t&&o?{value:e||null,children:t({image:o,images:[o],type:"images"})}:{},[r,e,...n||[]]),null}import{jsx as Ct}from"react/jsx-runtime";function Wi(e){let t=L();return Ct(V,{metadata:t?.metadata||[],...e})}import{useLayoutEffect as Tt,useRef as qt}from"react";import*as Z from"react-lazy-load-image-component";import{getValue as It}from"@iiif/helpers/i18n";import{Fragment as Le,jsx as T,jsxs as wt}from"react/jsx-runtime";var{LazyLoadComponent:Rt}=Z||Z.default;function Be(e){let{size:t,visible:o,classes:r,canvasId:n,figure:i}=e,a=t?.width||128,s=t?.height||t?.width||128,d=T(Pt,{...e}),m=T(Rt,{threshold:300,style:{height:s,width:a},visibleByDefault:o,children:n?T(oe,{canvas:n,children:d}):d});return i?T("figure",{className:r?.figure,children:m}):m}function Pt({fallback:e,size:t,classes:o,showLabel:r,alt:n,dereference:i=!1}){let a=w(),s=t?.width||128,d=t?.height||t?.width||128,m=n||It(a?.label)||"",l=fe({width:s,height:d,allowUnsafe:!0},i);return!l||l.type!=="fixed"?T(Le,{children:e}):wt(Le,{children:[T("div",{className:o?.imageWrapper,children:T("img",{className:o?.img,src:l.id,alt:m})}),r?T(q,{as:"figcaption",className:o?.label,children:a?.label}):null]})}import{jsx as k}from"react/jsx-runtime";function Zi({scrollBehaviour:e,dereference:t,flat:o,size:r,classes:n={},showLabel:i,figure:a,fallback:s}){let d=qt(null),{items:m,sequence:l,currentSequenceIndex:p,setSequenceIndex:v}=ae(),b={row:n.selected?.row||n.row,item:n.selected?.item||n.item,figure:n.selected?.figure||n.figure,img:n.selected?.img||n.img,label:n.selected?.label||n.label,imageWrapper:n.selected?.imageWrapper||n.imageWrapper};Tt(()=>{if(!d.current)return;let c=d.current.querySelector("[data-selected=true]");c&&c.scrollIntoView({behavior:e||"instant",block:"nearest",inline:"center"})},[p]);let S=[];for(let c of l){let u=[],f=l[p]===c;for(let g of c){let h=m[g];u.push(k("div",{className:f?b.item:n.item,children:k(Be,{classes:f?b:n,canvasId:h.id,size:r,dereference:t,showLabel:i,figure:a,placeholder:k("div",{style:{height:128,width:128}}),fallback:s})},g))}if(o){S.push(u);continue}S.push(k("div",{onClick:g=>{v(l.indexOf(c))},"data-selected":f,className:f?b.row:n.row,children:u},c.join("-")))}return k("div",{ref:d,className:n.container,children:S})}import{useStore as K}from"zustand";function De(){let e=R(),t=K(e,i=>i.completeRequest),o=K(e,i=>i.polygonState.currentTool),r=K(e,i=>i.polygonState.selectedStamp),n=K(e,i=>i.switchTool);return{completeRequest:t,currentTool:o,selectedStamp:r,switchTool:n}}import{Fragment as We,jsx as I,jsxs as Oe}from"react/jsx-runtime";var At={draw:!0,polygon:!0,line:!0,lineBox:!0,box:!0,triangle:!0,hexagon:!0,circle:!0,delete:!0,pen:!0};function ia({showShapes:e=!0,enabled:t=At,classNames:o={},icons:r={}}){let{currentTool:n,switchTool:i,selectedStamp:a}=De();return Oe(We,{children:[n,I("button",{className:o.button,onClick:i.pointer,"data-active":n==="pointer",children:r.PointerIcon||"Pointer"}),I("button",{className:o.button,onClick:i.hand,"data-active":n==="hand",children:r.HandIcon||"Hand"}),e?Oe(We,{children:[t.box&&I("button",{className:o.button,onClick:i.box,"data-active":n==="box",children:r.BoxIcon||"Box"}),t.pen&&I("button",{className:o.button,onClick:i.pen,"data-active":n==="pen",children:r.PenIcon||"Pen"}),t.draw&&I("button",{className:o.button,onClick:i.draw,"data-active":n==="pencil",children:r.DrawIcon||"Draw"}),t.line&&I("button",{className:o.button,onClick:i.line,"data-active":n==="line",children:r.LineIcon||"Line"}),t.lineBox&&I("button",{className:o.button,onClick:i.lineBox,"data-active":n==="lineBox",children:r.LineBoxIcon||"LineBox"}),t.triangle&&I("button",{className:o.button,onClick:i.triangle,"data-active":n==="stamp"&&a?.id==="triangle",children:r.TriangleIcon||"Triangle"}),t.hexagon&&I("button",{className:o.button,onClick:i.hexagon,"data-active":n==="stamp"&&a?.id==="hexagon",children:r.HexagonIcon||"Hexagon"}),t.circle&&I("button",{className:o.button,"data-active":n==="stamp"&&a?.id==="circle",onClick:i.circle,children:r.CircleIcon||"Circle"})]}):null,t.delete&&I("button",{className:o.button,onClick:i.remove,children:r.DeleteForeverIcon||"Delete"})]})}import{jsx as Nt}from"react/jsx-runtime";function ca({annotation:e,children:t}){return Nt(A,{value:{annotation:e},children:t})}import{jsx as Et}from"react/jsx-runtime";function fa({annotationPage:e,children:t}){return Et(A,{value:{annotationPage:e},children:t})}import{jsx as kt}from"react/jsx-runtime";function ya({collection:e,children:t}){return kt(A,{value:{collection:e},children:t})}function ba(e,t={}){return D(t)}import{useCanvas as Mt}from"@atlas-viewer/atlas";import{useEffect as Ht,useMemo as j,useState as zt}from"react";function Ta({canvasId:e}={}){let t=Mt(),o=re(),r=j(()=>e?[e]:t?[t.id]:o.map(m=>m.id),[e,t,o]),[n,i]=zt({}),a=ye();Ht(()=>{let m=l=>{let p=l.partOf.canvasId;p&&i(v=>({...v,[p]:l.choice}))};return a.on("choice-change",m),()=>{a.off("choice-change",m)}},[]);let s=j(()=>{let m=[];for(let l of r){let p=n[l];p&&m.push({canvasId:l,choice:p})}return m},[r,n]),d=j(()=>({makeChoice:(m,l)=>{a.emit("make-choice",{choiceId:m,...l})}}),[a]);return{choices:s,actions:d}}function Aa(e,t=!1){}function Ma(e){let o=H().manifest,r=e?e.map(n=>typeof n=="string"?n:n?.id):[];return z(n=>{let i=o?n.iiif.entities.Manifest[o]:void 0,a=i?.items||[];if(typeof e>"u")return a;let s=[];for(let d of i?.items||[])r.indexOf(d.id)!==-1&&s.push(d);return s},[r.join("/")])}import{useMemo as Lt}from"react";function Da(e,t=[]){let{id:o,selector:r}=e,n=H(),i=o||n.collection,a=z(s=>i?s.iiif.entities.Collection[i]:void 0,[i]);return Lt(()=>{if(a)return r?r(a):a},[a,r,...t])}import{startTransition as Bt,useMemo as Dt}from"react";import{useStore as Fe}from"zustand";function $a(){let e=R(),t=Fe(e,r=>r.completeRequest),o=Fe(e,r=>r.cancelRequest);return Dt(()=>({saveAnnotation:()=>{Bt(()=>{t()})},cancelRequest:o}),[t,o])}import{useCallback as Wt}from"react";import{useStore as ee}from"zustand";function Xa({requestId:e}={}){let t=R(),o=ee(t,s=>s.metadata),r=ee(t,s=>s.tool.requestId),n=e||r,i=ee(t,s=>s.setMetadata),a=Wt(s=>i(s,n||void 0),[i,n]);return[n?o[n]||{}:{},a]}import{useStore as Ot}from"zustand";function ja(e){let t=R(),o=Ot(t,r=>r.tool.requestId);B("polygons.start-transition",r=>{e.requestId&&o!==e.requestId||e?.onStart?.(r.transitionIntent)},[o,e.requestId]),B("polygons.end-transition",r=>{e.requestId&&o!==e.requestId||e?.onEnd?.(r.transitionIntent,r.response)},[o,e.requestId]),B("polygons.transition",r=>{e.requestId&&o!==e.requestId||e?.onTransition?.(r.transitionIntent)},[o,e.requestId])}import{useEffect as Ft,useMemo as Vt}from"react";import{createEventsHelper as $t}from"@iiif/helpers/events";function ns(e,t,o,r,n=[]){let i=P(),a=Vt(()=>$t(i),[i]);Ft(()=>{let s=e;return s?(a.addEventListener(s,t,o,r),()=>{a.removeEventListener(s,t,o)}):()=>{}},[a,e,t,...n])}function ls(e,t){let{id:o,isLoaded:r,error:n,resource:i,requestId:a,cached:s}=ne(e,t);return{id:o,isLoaded:r,error:n,manifest:i,requestId:a,cached:s}}import{getImageServices as Ve}from"@iiif/parser/image-3";import{useEffect as Kt,useMemo as $e,useState as _}from"react";function Ke({cacheKey:e}={}){let t=w(),o=D(),r=P(),n=pe(),i=ge(),[a,s]=_(void 0),[d,m]=_(!1),[l,p]=_("idle"),[v,b]=_(void 0),S=t?t.id:"undefined",c=$e(()=>{try{if(t&&o.length){let f=o[0],g=r.get(f.body[0]),x=Ve(g)[0];return x&&n(x,{width:x.width||t.width,height:x.height||t.height},!0)||void 0}}catch(f){console.error(f)}},[S,e,t]),u=l==="success"&&a?a:c;return Kt(()=>{(async()=>{try{if(t&&o.length){let f=o[0],g=r.get(f.body[0]),x=Ve(g)[0];if(!x)return;m(!0),p("loading");try{let y=await i(x,{width:x.width||t.width,height:x.height||t.height})||void 0;s(y),p("success"),m(!1)}catch(y){p("error"),b(y)}}}catch(f){p("error"),b(f)}})()},[S,e]),$e(()=>({data:u,isFetching:d,status:l,error:v}),[u,d,l,v])}function vs(){let e=Ke();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 _t}from"@iiif/helpers/styles";import{useMemo as Qt}from"react";function Is(){let e=P();return Qt(()=>_t(e),[e])}function Ps(e,t){let{x:o,y:r,width:n,height:i}=e,{x:a,y:s}=t,{width:d,height:m}=t;return o+n>a&&o<a+d&&r+i>s&&r<s+m}import Ut from"tiny-invariant";function Es(e,t){let o=e.boundingBox||le(e.polygon);if(e.polygon&&!se(e.polygon.points)){let r=e.target||ce(e.polygon,t);return Ut(r?.type==="SvgSelector"),{type:"SvgSelector",points:e.polygon.points,spatial:{unit:"pixel",...o||{}},svgShape:e.polygon.open?"polyline":"polygon",svg:r.value}}return{type:"BoxSelector",spatial:o}}export{ca as AnnotationContext,fa as AnnotationPageContext,Ln as AnnotationStyleProvider,Fo as AtlasStoreProvider,Wo as AtlasStoreReactContext,To as Auth,xo as AuthProvider,ho as AuthRContext,yo as AuthReactContext,vo as AuthReactContextActions,jn as CanvasAnnotations,oe as CanvasContext,Ce as CanvasPanel,pn as CanvasStrategyProvider,gn as CanvasWorldObject,ya as CollectionContext,di as CombinedMetadata,wr as ComplexTimelineProvider,_r as ContextBridge,nr as ControlsReactContext,Pe as CreateCustomShape,Vr as CustomContextBridge,$r as CustomContextBridgeProvider,Gr as DefaultEditingTools,Mo as EventEmitterProvider,Or as EventsProvider,ht as Image,Mi as ImageService,fr as ImageServiceLoaderContext,No as InnerViewerProvider,yr as LanguageProvider,Cr as LanguageString,q as LocaleString,eo as ManifestContext,Wi as ManifestMetadata,Jo as MediaPlayerProvider,V as Metadata,_n as PolygonSelector,to as RangeContext,ko as ReactEmitterContext,Wr as ReactEventContext,Yt as ReactVaultContext,rr as Render3DModelStrategy,ar as RenderAccompanyingCanvas,_o as RenderAnnotation,Yr as RenderAnnotationEditing,Uo as RenderAnnotationPage,ur as RenderAnnotationStrategy,gr as RenderAudioStrategy,qr as RenderComplexTimelineStrategy,Ar as RenderEmptyStrategy,Er as RenderImageStrategy,ia as RenderSvgEditorControls,kr as RenderTextualContentStrategy,Mr as RenderVideoStrategy,Hr as RenderYouTubeStrategy,A as ResourceProvider,Xt as ResourceReactContext,Nn as SelectorControllerProvider,Zi as SequenceThumbnails,Eo as SimpleViewerProvider,Ao as SimpleViewerReactContext,Be as SingleCanvasThumbnail,tr as StrategyReactContext,pr as ThumbnailFallbackImage,hr as TranslationProvider,vr as TransliterationProvider,Gt as VaultProvider,X as ViewerPresetContext,mr as VirtualAnnotationProvider,Jt as VisibleCanvasReactContext,Es as annotationResponseToSelector,fo as authDetailsForResource,Do as createAtlasStore,mo as createAuthStateStore,uo as createProbe,Dr as defaultEmitter,Lr as defaultSvgTheme,jr as emptyActions,on as emptyStrategy,ro as findAllCanvasesInRange,oo as findFirstCanvasFromRange,no as findManifestSelectedRange,io as findSelectedRange,rn as flattenAnnotationPageIds,jo as formatTime,sn as get3dStrategy,Oo as getAtlasStoreByName,un as getComplexTimelineStrategy,ke as getDefaultAnnotationStyles,ln as getImageStrategy,so as getManifestSequence,Zr as getParsedTargetSelector,dn as getRenderingStrategy,cn as getTextualContentStrategy,mn as getVideoStrategy,ao as getVisibleCanvasesFromCanvasId,co as hasAuth,Lo as isBoxSelector,se as isRectangle,zo as isSvgSelector,go as makeAccessServiceRequest,po as makeAccessTokenRequest,Jr as parseSpecificResource,ce as polygonToTarget,me as requestToAnnotationResponse,Bo as seraliseSupportedSelector,In as svgThemes,Ps as targetIntersects,en as unknownResponse,tn as unsupportedStrategy,Ko as useAnnotation,Qo as useAnnotationPage,ve as useAnnotationPageManager,Me as useAnnotationStyles,ba as useAnnotationsAtTime,Ur as useAtlasContextMenu,R as useAtlasStore,Co as useAuthActions,Ro as useAuthService,bo as useAuthStore,wo as useAuthToken,Po as useAuthTokens,w as useCanvas,Ta as useCanvasChoices,Aa as useCanvasClock,lo as useCanvasSequence,Zo as useCanvasStartTime,Ma as useCanvasSubset,Ir as useClosestLanguage,Da as useCollection,Tr as useComplexTimeline,Kr as useContextBridge,Qr as useContextMenuStore,Pr as useCreateLocaleString,$a as useCurrentAnnotationActions,Xa as useCurrentAnnotationMetadata,Xr as useCurrentAnnotationRequest,ja as useCurrentAnnotationTransition,Io as useCurrentAuth,Fr as useCustomContextBridge,sr as useDispatch,Ho as useEmitter,B as useEvent,ye as useEventEmitter,ns as useEventListener,Zt as useExistingVault,ls as useExternalCollection,jt as useExternalManifest,ne as useExternalResource,Sr as useIIIFLanguage,J as useImage,Ke as useImageService,de as useImageServiceLoader,vs as useImageTile,So as useIsAuthEnabled,xe as useLoadImageService,Rr as useLocaleString,L as useManifest,Yo as useMediaActions,Go as useMediaElements,Xo as useMediaState,an as usePaintables,D as usePaintingAnnotations,zr as usePolygonHelper,ie as useRange,ir as useRenderControls,fn as useRenderingStrategy,Re as useRequestAnnotation,H as useResourceContext,Vo as useResourceEvents,nn as useResources,qo as useSearchService,Ee as useSelectorController,En as useSelectorEmitter,Ne as useSelectorEvents,kn as useSelectorHelper,er as useSimpleMediaPlayer,ae as useSimpleViewer,or as useStrategy,Is as useStyleHelper,$o as useStyles,Br as useSvgEditor,De as useSvgEditorControls,fe as useThumbnail,br as useTranslations,xr as useTransliteration,P as useVault,dr as useVaultEffect,z as useVaultSelector,Nr as useViewerPreset,lr as useVirtualAnnotationPage,cr as useVirtualAnnotationPageContext,re as useVisibleCanvases};
|
|
1
|
+
import{$ as ko,$a as Ir,A as lo,Aa as er,Ab as _r,B as co,Ba as tr,Bb as Qr,C as mo,Ca as or,Cb as Ur,D as uo,Da as rr,Db as Xr,E as fo,Ea as fe,Eb as Yr,F as po,Fa as nr,Fb as Gr,G as go,Ga as ir,Gb as Jr,H as ho,Ha as ar,Hb as Zr,I as yo,Ia as sr,Ib as jr,J as vo,Ja as lr,Jb as sn,K as xo,Ka as cr,Kb as xe,L as So,La as mr,Lb as ln,M as bo,Ma as ur,Mb as Se,N as Io,Na as fr,Nb as E,O as Co,Oa as dr,Ob as cn,P as Ro,Pa as pr,Pb as gn,Q as Po,Qa as gr,Qb as hn,R as wo,Ra as hr,Rb as yn,S as qo,Sa as de,Sb as Ie,T as To,Ta as pe,Tb as Ce,U as ae,Ua as yr,Ub as Re,V as No,Va as vr,W as Eo,Wa as xr,X as Ao,Xa as Sr,Y as O,Ya as ge,Z as se,Za as he,_ as le,_a as br,a as _t,aa as Mo,ab as Cr,b as z,ba as Ho,bb as Rr,c as N,ca as ce,cb as Pr,d as oe,da as me,db as wr,e as Qt,ea as zo,eb as qr,f as Ut,fa as Lo,fb as Tr,g as R,ga as P,gb as Nr,h as L,ha as Bo,hb as Er,i as Xt,ia as Oo,ib as T,j as re,ja as Fo,jb as ye,k as Yt,ka as ue,kb as Ar,l as B,la as Wo,lb as kr,m as ne,ma as Do,mb as X,n as Gt,na as Vo,nb as Mr,o as Jt,oa as $o,ob as Hr,p as Zt,pa as w,pb as zr,q as jt,qa as Ko,qb as Lr,r as eo,ra as _o,rb as Br,s as to,sa as Qo,sb as Or,t as oo,ta as Uo,tb as Fr,u as ro,ua as Xo,ub as Wr,v as no,va as Yo,vb as Dr,w as ie,wa as Go,wb as Vr,x as io,xa as Jo,xb as ve,y as ao,ya as Zo,yb as $r,z as so,za as jo,zb as Kr}from"./chunk-SNWQWQTN.js";import"./chunk-UNH7HXGJ.js";import{a as en,b as tn,c as on,d as rn,e as nn,f as an,g as mn,h as un,i as fn,j as dn,k as pn,l as be}from"./chunk-223VJXTE.js";export*from"@iiif/helpers/annotation-targets";import{useEffect as Xe}from"react";import{useCallback as Pe,useEffect as Qe,useRef as Ue,useState as F}from"react";import{useStore as A}from"zustand";function we(e){let[t,o]=F(0),r=P(),n=A(r,y=>y.tool.enabled),i=A(r,y=>y.tool.requestId),a=A(r,y=>y.getRequestId),s=A(r,y=>y.requestAnnotation),f=A(r,y=>y.completeRequest),m=A(r,y=>y.cancelRequest),l=Ue(e?.onSuccess);l.current=e?.onSuccess;let[p,v]=F(!1),[b,S]=F(null),[c,u]=F(null),d=n&&i!==c,g=n&&i===c,h=Pe(async(y,_e)=>{if(c){let te=l.current;v(!0);let H=await s(y,{..._e,requestId:c});if(H)return te?.(H),o(U=>U+1),v(!1),S(H),H;let Q={id:c,cancelled:!0,...me(y)};return te?.(Q),S(Q),o(U=>U+1),v(!1),Q}return null},[s,c]),x=Pe(()=>{S(null),v(!1)},[]);return Qe(()=>{let y=a();return u(y.requestId),()=>{y.clear()}},[t]),{id:t,busy:d,isPending:p,isActive:g,requestId:c,requestAnnotation:h,cancelRequest:()=>c?m(c):void 0,completeRequest:()=>c?f(c):void 0,reset:x,data:b}}var Pn=[{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 qe(e){let{id:t,data:o,requestAnnotation:r,cancelRequest:n,isPending:i}=we({onSuccess:a=>{e.updateShape(a.polygon)}});return Xe(()=>(r({type:"polygon",open:e.shape?.open,points:e.shape?.points}),()=>{n()}),[]),null}import{createContext as Ye,useCallback as Te,useContext as Ee,useEffect as Ne,useMemo as Y,useState as Ge}from"react";import Ae from"mitt";import{jsx as Je}from"react/jsx-runtime";var W=Ye(Ae());W.displayName="SelectorHelper";function kn({children:e}){return Je(W.Provider,{value:Y(()=>Ae(),[]),children:e})}function Mn(){return Ee(W)}function ke(e){let t=Me(),[o,r]=Ge(!1);Ne(()=>t.withSelector(e).on("highlight",()=>{r(!0)}),[t,e]),Ne(()=>t.withSelector(e).on("clear-highlight",()=>{r(!1)}),[t,e]);let n=Te(a=>{t.emit("click",{selectorId:e,event:a})},[e,t]),i=Te(a=>{t.emit("hover",{selectorId:e,event:a})},[e,t]);return{controller:t,onClick:n,onHover:i,isHighlighted:o}}function Me(){let e=Ee(W);return Y(()=>({withSelector(t){return{on(o,r){let n=i=>{i&&i.selectorId===t&&r(i)};return e.on(o,n),()=>{e.off(o,n)}},emit(o,r){e.emit(o,{...r,selectorId:t})}}},on(t,o){return e.on(t,o),()=>{e.off(t,o)}},emit(t,o){e.emit(t,o)}}),[e])}function Hn(){let e=Me();return Y(()=>({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,r){return e.emit("event-listener",{selectorId:t,name:o,callback:r}),()=>{e.emit("remove-event-listener",{selectorId:t,name:o,callback:r})}},getImagePreview(){return new Promise((o,r)=>{e.emit("image-preview-request",{selectorId:t,resolve:o,reject:r})})},on(o,r){return e.withSelector(t).on(o,r)}}},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,r){return e.emit("event-listener",{selectorId:t,name:o,callback:r}),()=>{e.emit("remove-event-listener",{selectorId:t,name:o,callback:r})}},getImagePreview(t){return new Promise((o,r)=>{e.emit("image-preview-request",{selectorId:t,resolve:o,reject:r})})},on(t,o){return e.on(t,o)}}),[e])}import{jsx as He}from"react/jsx-runtime";function $n(e){let t=w(),o=e.annotationBucket,r=e.readOnly,n=e.id,{onClick:i,isHighlighted:a}=ke(e.id),s=ue(),f=a?s.highlighted:s[o||"hidden"]||s.hidden;if(!t)return null;if(r){let m="shape",l=e.polygon,p=l.open;return l?He(m,{id:`shape-${n}`,points:l.points,open:p,onClick:i,relativeStyle:!0,target:{x:0,y:0,width:t.width,height:t.height},style:f}):null}return He(qe,{image:t,shape:e.polygon||{id:e.id,open:!0,points:[]},updateShape:e.updatePolygon,theme:e.theme,controlsHtmlId:e.controlsHtmlId,renderControls:e.renderControls})}import{useCanvas as Ze}from"@atlas-viewer/atlas";import{forwardRef as je,useImperativeHandle as et}from"react";import{Fragment as tt,jsx as ze}from"react/jsx-runtime";var Jn=je(function({canvasId:t},o){let r=Ze(),n=xe(t||r?.id),i=R();return et(o,()=>n,[t,r]),!r||n.enabledPageIds.length===0?null:ze(tt,{children:n.enabledPageIds.map(a=>ze(Re.RenderAnnotationPage,{page:i.get(a)},a))})});import{useMemo as nt}from"react";import{useMemo as ot}from"react";import{Fragment as rt,jsx as I,jsxs as D}from"react/jsx-runtime";function V({metadata:e=[],config:t,labelWidth:o=16,showEmptyMessage:r=!0,allowHtml:n,emptyFallback:i,classes:a={},emptyMessage:s="No metadata available",emptyValueFallback:f="No value",emptyLabelFallback:m="",separator:l,tableFooter:p,tableHeader:v}){let b=ot(()=>{let c=(t||[]).reduce((d,g)=>[...d,...g.keys],[]),u={};for(let d of e){let g=d&&d.label?Object.values(d.label):[];for(let h of g)if(h&&h.length&&(c.indexOf(`metadata.${h[0]}`)!==-1||c.length===0)&&d){let x=`metadata.${h[0]}`;u[x]=u[x]?u[x]:[],u[x].push(d);break}}return u},[t,e]);return Object.keys(b).length===0&&r?I(rt,{children:i})||I("div",{className:a.empty,children:s}):t&&t.length?D("table",{className:a.container,children:[v,I("tbody",{children:t.map((c,u)=>{let d=[];for(let g of c.keys)for(let h of b[g]||[])d.push(I(T,{enableDangerouslySetInnerHTML:n,defaultText:f,separator:l,children:h.value},u+"__"+g));return d.length===0?null:D("tr",{className:a.row,children:[I("td",{className:a.label,style:o?{minWidth:o}:{},children:I(T,{enableDangerouslySetInnerHTML:n,separator:l,defaultText:m,children:c.label})}),I("td",{className:a.value,children:d})]},u)})}),p]}):D("table",{className:a.container,children:[v,I("tbody",{children:e&&e.length?e.map((c,u)=>c?D("tr",{className:a.row,children:[I("td",{className:a.label,style:o?{minWidth:o}:{},children:I(T,{enableDangerouslySetInnerHTML:n,defaultText:f,separator:l,children:c.label})}),I("td",{className:a.value,children:I(T,{enableDangerouslySetInnerHTML:n,defaultText:f,separator:l,children:c.value})})]},u):null):null}),p]})}import{jsx as it}from"react/jsx-runtime";function mi(e){let t=B(),o=w(),r=ie(),n=nt(()=>{let i=t?.metadata||[],a=o?.metadata||[],s=r?.metadata||[];return[...i,...a,...s]},[t,o,r]);return it(V,{metadata:n,...e})}import{useEffect as ct,useState as mt}from"react";import{createImageServiceRequest as at,imageServiceRequestToString as st}from"@iiif/parser/image-3";import{useMemo as lt}from"react";function G(e,t={},o=[]){return lt(()=>{if(!e)return null;let r=t.quality;e&&e.extraQualities&&t.quality&&(e.extraQualities.includes(t.quality)||(r="default"));let n=at(e);return st({identifier:n.identifier,server:n.server,scheme:n.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:r||"default",prefix:n.prefix,originalPath:n.originalPath})},[...o])}import{jsx as $}from"react/jsx-runtime";function ut(e){let t=typeof e.src=="string"?e.src:e.src.id,o=de(),[r,n]=mt(!1),i;if(t){let s=o.loadServiceSync({id:t});s&&(i=s)}!i&&!r&&o.loadService({id:t}).then(()=>{n(!0)});let a=G(i,{size:e.size,selector:e.region,rotation:e.rotation,format:e.format,region:e.region,quality:e.quality},[r,e.src,e.size,e.region,e.rotation,e.format,e.region,e.quality]);return ct(()=>()=>{n(!1)},[t]),a?$("img",{src:a,alt:e.alt,className:e.className,style:e.style}):$(ft,{...e,fetchImageService:!1})}function ft(e){if(e.fetchImageService)return $(ut,{...e});let t=typeof e.src=="string"?{id:e.src,profile:"level0"}:e.src,o=G(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{useMemo as dt,useState as pt}from"react";import{ErrorBoundary as gt}from"react-error-boundary";import{jsx as k,jsxs as yt}from"react/jsx-runtime";function Ai({src:e,errorFallback:t,interactive:o,skipSizes:r,children:n,renderViewerControls:i,viewControlsDeps:a,fluid:s,x:f,y:m,...l}){let[p,v]=pt(),b=t||Ie,[S,c]=Se(),u=dt(()=>{let g=c[e]?.status,h=S({id:e},{});return h?.height&&h.width&&g!=="loading"?{id:e,width:h.width,height:h.height,service:h,type:"Image",selector:{type:"BoxSelector",spatial:{x:0,y:0,width:h.width,height:h.height}},target:{type:"BoxSelector",spatial:{x:0,y:0,width:h.width,height:h.height}}}:null},[S,e,c]);if(!u||!u.height||!u.width)return null;let d=s?void 0:l.homePosition?l.homePosition.width/l.homePosition.height:u.width/u.height;return k(gt,{resetKeys:[],fallbackRender:g=>k(b,{...l,...g}),children:k(Ce,{...l,aspectRatio:d,containerProps:{style:{position:"relative"},...l.containerProps||{}},onCreated:g=>{v(g),l.onCreated&&l.onCreated(g)},children:yt(X.Provider,{value:p,children:[k(ye,{image:u,id:u.id,isStatic:!o,x:f,y:m},u.id),k(ht,{viewerPreset:p,renderViewerControls:i,image:u,src:e,viewControlsDeps:a}),n]})})})}function ht({viewerPreset:e,renderViewerControls:t,image:o,src:r,viewControlsDeps:n}){return fe(e&&t?"overlay":"none",`canvas-portal-controls-${r}`,X.Provider,t&&o?{value:e||null,children:t({image:o,images:[o],type:"images"})}:{},[r,e,...n||[]]),null}import{jsx as vt}from"react/jsx-runtime";function Bi(e){let t=B();return vt(V,{metadata:t?.metadata||[],...e})}import{useLayoutEffect as Ct,useRef as Rt}from"react";import*as J from"react-lazy-load-image-component";import{getValue as xt}from"@iiif/helpers/i18n";import{Fragment as Le,jsx as q,jsxs as It}from"react/jsx-runtime";var{LazyLoadComponent:St}=J||J.default;function Be(e){let{size:t,visible:o,classes:r,canvasId:n,figure:i}=e,a=t?.width||128,s=t?.height||t?.width||128,f=q(bt,{...e}),m=q(St,{threshold:300,style:{height:s,width:a},visibleByDefault:o,children:n?q(oe,{canvas:n,children:f}):f});return i?q("figure",{className:r?.figure,children:m}):m}function bt({fallback:e,size:t,classes:o,showLabel:r,alt:n,dereference:i=!1}){let a=w(),s=t?.width||128,f=t?.height||t?.width||128,m=n||xt(a?.label)||"",l=pe({width:s,height:f,allowUnsafe:!0},i);return!l||l.type!=="fixed"?q(Le,{children:e}):It(Le,{children:[q("div",{className:o?.imageWrapper,children:q("img",{className:o?.img,src:l.id,alt:m})}),r?q(T,{as:"figcaption",className:o?.label,children:a?.label}):null]})}import{jsx as M}from"react/jsx-runtime";function Gi({scrollBehaviour:e,dereference:t,flat:o,size:r,classes:n={},showLabel:i,figure:a,fallback:s}){let f=Rt(null),{items:m,sequence:l,currentSequenceIndex:p,setSequenceIndex:v}=ae(),b={row:n.selected?.row||n.row,item:n.selected?.item||n.item,figure:n.selected?.figure||n.figure,img:n.selected?.img||n.img,label:n.selected?.label||n.label,imageWrapper:n.selected?.imageWrapper||n.imageWrapper};Ct(()=>{if(!f.current)return;let c=f.current.querySelector("[data-selected=true]");c&&c.scrollIntoView({behavior:e||"instant",block:"nearest",inline:"center"})},[p]);let S=[];for(let c of l){let u=[],d=l[p]===c;for(let g of c){let h=m[g];u.push(M("div",{className:d?b.item:n.item,children:M(Be,{classes:d?b:n,canvasId:h.id,size:r,dereference:t,showLabel:i,figure:a,placeholder:M("div",{style:{height:128,width:128}}),fallback:s})},g))}if(o){S.push(u);continue}S.push(M("div",{onClick:g=>{v(l.indexOf(c))},"data-selected":d,className:d?b.row:n.row,children:u},c.join("-")))}return M("div",{ref:f,className:n.container,children:S})}import{useStore as K}from"zustand";function Oe(){let e=P(),t=K(e,i=>i.completeRequest),o=K(e,i=>i.polygonState.currentTool),r=K(e,i=>i.polygonState.selectedStamp),n=K(e,i=>i.switchTool);return{completeRequest:t,currentTool:o,selectedStamp:r,switchTool:n}}import{Fragment as Fe,jsx as C,jsxs as We}from"react/jsx-runtime";var Pt={draw:!0,polygon:!0,line:!0,lineBox:!0,box:!0,triangle:!0,hexagon:!0,circle:!0,delete:!0,pen:!0};function ra({showShapes:e=!0,enabled:t=Pt,classNames:o={},icons:r={}}){let{currentTool:n,switchTool:i,selectedStamp:a}=Oe();return We(Fe,{children:[n,C("button",{className:o.button,onClick:i.pointer,"data-active":n==="pointer",children:r.PointerIcon||"Pointer"}),C("button",{className:o.button,onClick:i.hand,"data-active":n==="hand",children:r.HandIcon||"Hand"}),e?We(Fe,{children:[t.box&&C("button",{className:o.button,onClick:i.box,"data-active":n==="box",children:r.BoxIcon||"Box"}),t.pen&&C("button",{className:o.button,onClick:i.pen,"data-active":n==="pen",children:r.PenIcon||"Pen"}),t.draw&&C("button",{className:o.button,onClick:i.draw,"data-active":n==="pencil",children:r.DrawIcon||"Draw"}),t.line&&C("button",{className:o.button,onClick:i.line,"data-active":n==="line",children:r.LineIcon||"Line"}),t.lineBox&&C("button",{className:o.button,onClick:i.lineBox,"data-active":n==="lineBox",children:r.LineBoxIcon||"LineBox"}),t.triangle&&C("button",{className:o.button,onClick:i.triangle,"data-active":n==="stamp"&&a?.id==="triangle",children:r.TriangleIcon||"Triangle"}),t.hexagon&&C("button",{className:o.button,onClick:i.hexagon,"data-active":n==="stamp"&&a?.id==="hexagon",children:r.HexagonIcon||"Hexagon"}),t.circle&&C("button",{className:o.button,"data-active":n==="stamp"&&a?.id==="circle",onClick:i.circle,children:r.CircleIcon||"Circle"})]}):null,t.delete&&C("button",{className:o.button,onClick:i.remove,children:r.DeleteForeverIcon||"Delete"})]})}import{jsx as wt}from"react/jsx-runtime";function sa({annotation:e,children:t}){return wt(N,{value:{annotation:e},children:t})}import{jsx as qt}from"react/jsx-runtime";function ua({annotationPage:e,children:t}){return qt(N,{value:{annotationPage:e},children:t})}import{jsx as Tt}from"react/jsx-runtime";function ga({collection:e,children:t}){return Tt(N,{value:{collection:e},children:t})}function xa(e,t={}){return E(t)}import{useCanvas as Nt}from"@atlas-viewer/atlas";import{useEffect as Et,useMemo as Z,useState as At}from"react";function Pa({canvasId:e}={}){let t=Nt(),o=re(),r=Z(()=>e?[e]:t?[t.id]:o.map(m=>m.id),[e,t,o]),[n,i]=At({}),a=ve();Et(()=>{let m=l=>{let p=l.partOf.canvasId;p&&i(v=>({...v,[p]:l.choice}))};return a.on("choice-change",m),()=>{a.off("choice-change",m)}},[]);let s=Z(()=>{let m=[];for(let l of r){let p=n[l];p&&m.push({canvasId:l,choice:p})}return m},[r,n]),f=Z(()=>({makeChoice:(m,l)=>{a.emit("make-choice",{choiceId:m,...l})}}),[a]);return{choices:s,actions:f}}function qa(e,t=!1){}function Aa(e){let o=z().manifest,r=e?e.map(n=>typeof n=="string"?n:n?.id):[];return L(n=>{let i=o?n.iiif.entities.Manifest[o]:void 0,a=i?.items||[];if(typeof e>"u")return a;let s=[];for(let f of i?.items||[])r.indexOf(f.id)!==-1&&s.push(f);return s},[r.join("/")])}import{useMemo as kt}from"react";function La(e,t=[]){let{id:o,selector:r}=e,n=z(),i=o||n.collection,a=L(s=>i?s.iiif.entities.Collection[i]:void 0,[i]);return kt(()=>{if(a)return r?r(a):a},[a,r,...t])}import{startTransition as Mt,useMemo as Ht}from"react";import{useStore as De}from"zustand";function Da(){let e=P(),t=De(e,r=>r.completeRequest),o=De(e,r=>r.cancelRequest);return Ht(()=>({saveAnnotation:()=>{Mt(()=>{t()})},cancelRequest:o}),[t,o])}import{useCallback as zt}from"react";import{useStore as j}from"zustand";function Qa({requestId:e}={}){let t=P(),o=j(t,s=>s.metadata),r=j(t,s=>s.tool.requestId),n=e||r,i=j(t,s=>s.setMetadata),a=zt(s=>i(s,n||void 0),[i,n]);return[n?o[n]||{}:{},a]}import{useStore as Lt}from"zustand";function Ja(e){let t=P(),o=Lt(t,r=>r.tool.requestId);O("polygons.start-transition",r=>{e.requestId&&o!==e.requestId||e?.onStart?.(r.transitionIntent)},[o,e.requestId]),O("polygons.end-transition",r=>{e.requestId&&o!==e.requestId||e?.onEnd?.(r.transitionIntent,r.response)},[o,e.requestId]),O("polygons.transition",r=>{e.requestId&&o!==e.requestId||e?.onTransition?.(r.transitionIntent)},[o,e.requestId])}import{useEffect as Bt,useMemo as Ot}from"react";import{createEventsHelper as Ft}from"@iiif/helpers/events";function os(e,t,o,r,n=[]){let i=R(),a=Ot(()=>Ft(i),[i]);Bt(()=>{let s=e;return s?(a.addEventListener(s,t,o,r),()=>{a.removeEventListener(s,t,o)}):()=>{}},[a,e,t,...n])}function as(e,t){let{id:o,isLoaded:r,error:n,resource:i,requestId:a,cached:s}=ne(e,t);return{id:o,isLoaded:r,error:n,manifest:i,requestId:a,cached:s}}import{getImageServices as Ve}from"@iiif/parser/image-3";import{useEffect as Wt,useMemo as $e,useState as _}from"react";function Ke({cacheKey:e}={}){let t=w(),o=E(),r=R(),n=ge(),i=he(),[a,s]=_(void 0),[f,m]=_(!1),[l,p]=_("idle"),[v,b]=_(void 0),S=t?t.id:"undefined",c=$e(()=>{try{if(t&&o.length){let d=o[0],g=r.get(d.body[0]),x=Ve(g)[0];return x&&n(x,{width:x.width||t.width,height:x.height||t.height},!0)||void 0}}catch(d){console.error(d)}},[S,e,t]),u=l==="success"&&a?a:c;return Wt(()=>{(async()=>{try{if(t&&o.length){let d=o[0],g=r.get(d.body[0]),x=Ve(g)[0];if(!x)return;m(!0),p("loading");try{let y=await i(x,{width:x.width||t.width,height:x.height||t.height})||void 0;s(y),p("success"),m(!1)}catch(y){p("error"),b(y)}}}catch(d){p("error"),b(d)}})()},[S,e]),$e(()=>({data:u,isFetching:f,status:l,error:v}),[u,f,l,v])}function hs(){let e=Ke();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{useMemo as ee}from"react";import{createPaintingAnnotationsHelper as Dt}from"@iiif/helpers";function Rs({supports:e=["empty","images","media","3d-model","textual-content","complex-timeline"]}={}){let t=R(),o=w(),r=E(),n=ee(()=>Dt(t),[t]),i=ee(()=>n.getPaintables(r),[n,r]);return ee(()=>be({canvas:o,loadImageService:a=>a,paintables:i,supports:e}),[o,i,e])}import{createStylesHelper as Vt}from"@iiif/helpers/styles";import{useMemo as $t}from"react";function Ns(){let e=R();return $t(()=>Vt(e),[e])}function As(e,t){let{x:o,y:r,width:n,height:i}=e,{x:a,y:s}=t,{width:f,height:m}=t;return o+n>a&&o<a+f&&r+i>s&&r<s+m}import Kt from"tiny-invariant";function Bs(e,t){let o=e.boundingBox||le(e.polygon);if(e.polygon&&!se(e.polygon.points)){let r=e.target||ce(e.polygon,t);return Kt(r?.type==="SvgSelector"),{type:"SvgSelector",points:e.polygon.points,spatial:{unit:"pixel",...o||{}},svgShape:e.polygon.open?"polyline":"polygon",svg:r.value}}return{type:"BoxSelector",spatial:o}}export{sa as AnnotationContext,ua as AnnotationPageContext,Wo as AnnotationStyleProvider,Oo as AtlasStoreProvider,Lo as AtlasStoreReactContext,Ro as Auth,ho as AuthProvider,fo as AuthRContext,po as AuthReactContext,go as AuthReactContextActions,Jn as CanvasAnnotations,oe as CanvasContext,Re as CanvasPanel,hn as CanvasStrategyProvider,yn as CanvasWorldObject,ga as CollectionContext,mi as CombinedMetadata,xr as ComplexTimelineProvider,Xr as ContextBridge,sr as ControlsReactContext,qe as CreateCustomShape,_r as CustomContextBridge,Qr as CustomContextBridgeProvider,jr as DefaultEditingTools,Eo as EventEmitterProvider,$r as EventsProvider,ft as Image,Ai as ImageService,hr as ImageServiceLoaderContext,qo as InnerViewerProvider,Ir as LanguageProvider,qr as LanguageString,T as LocaleString,Jt as ManifestContext,Bi as ManifestMetadata,er as MediaPlayerProvider,V as Metadata,$n as PolygonSelector,Zt as RangeContext,No as ReactEmitterContext,Vr as ReactEventContext,Qt as ReactVaultContext,Uo as RegionHighlight,ar as Render3DModelStrategy,cr as RenderAccompanyingCanvas,Xo as RenderAnnotation,Zr as RenderAnnotationEditing,Go as RenderAnnotationPage,pr as RenderAnnotationStrategy,vr as RenderAudioStrategy,Ar as RenderComplexTimelineStrategy,kr as RenderEmptyStrategy,Hr as RenderImageStrategy,ra as RenderSvgEditorControls,zr as RenderTextualContentStrategy,Lr as RenderVideoStrategy,Br as RenderYouTubeStrategy,Qo as ResizeWorldItem,N as ResourceProvider,_t as ResourceReactContext,kn as SelectorControllerProvider,Gi as SequenceThumbnails,To as SimpleViewerProvider,wo as SimpleViewerReactContext,Be as SingleCanvasThumbnail,nr as StrategyReactContext,yr as ThumbnailFallbackImage,br as TranslationProvider,Cr as TransliterationProvider,Ut as VaultProvider,X as ViewerPresetContext,dr as VirtualAnnotationProvider,Xt as VisibleCanvasReactContext,Bs as annotationResponseToSelector,co as authDetailsForResource,zo as createAtlasStore,so as createAuthStateStore,lo as createProbe,Dr as defaultEmitter,Fr as defaultSvgTheme,on as emptyActions,an as emptyStrategy,eo as findAllCanvasesInRange,jt as findFirstCanvasFromRange,to as findManifestSelectedRange,oo as findSelectedRange,sn as flattenAnnotationPageIds,or as formatTime,mn as get3dStrategy,Bo as getAtlasStoreByName,pn as getComplexTimelineStrategy,Fo as getDefaultAnnotationStyles,un as getImageStrategy,no as getManifestSequence,tn as getParsedTargetSelector,be as getRenderingStrategy,fn as getTextualContentStrategy,dn as getVideoStrategy,ro as getVisibleCanvasesFromCanvasId,ao as hasAuth,Mo as isBoxSelector,se as isRectangle,ko as isSvgSelector,uo as makeAccessServiceRequest,mo as makeAccessTokenRequest,en as parseSpecificResource,ce as polygonToTarget,me as requestToAnnotationResponse,Ho as seraliseSupportedSelector,Pn as svgThemes,As as targetIntersects,rn as unknownResponse,nn as unsupportedStrategy,$o as useAnnotation,Yo as useAnnotationPage,xe as useAnnotationPageManager,ue as useAnnotationStyles,xa as useAnnotationsAtTime,Gr as useAtlasContextMenu,P as useAtlasStore,xo as useAuthActions,bo as useAuthService,vo as useAuthStore,Co as useAuthToken,Io as useAuthTokens,w as useCanvas,Pa as useCanvasChoices,qa as useCanvasClock,io as useCanvasSequence,tr as useCanvasStartTime,Aa as useCanvasSubset,Tr as useClosestLanguage,La as useCollection,Sr as useComplexTimeline,Ur as useContextBridge,Yr as useContextMenuStore,Er as useCreateLocaleString,Da as useCurrentAnnotationActions,Qa as useCurrentAnnotationMetadata,Jr as useCurrentAnnotationRequest,Ja as useCurrentAnnotationTransition,So as useCurrentAuth,Kr as useCustomContextBridge,mr as useDispatch,Ao as useEmitter,O as useEvent,ve as useEventEmitter,os as useEventListener,Yt as useExistingVault,as as useExternalCollection,Gt as useExternalManifest,ne as useExternalResource,Pr as useIIIFLanguage,G as useImage,Ke as useImageService,de as useImageServiceLoader,hs as useImageTile,yo as useIsAuthEnabled,Se as useLoadImageService,Nr as useLocaleString,B as useManifest,Zo as useMediaActions,jo as useMediaElements,Jo as useMediaState,cn as usePaintables,E as usePaintingAnnotations,Or as usePolygonHelper,ie as useRange,Vo as useRemoteStylesheet,lr as useRenderControls,gn as useRenderingStrategy,we as useRequestAnnotation,z as useResourceContext,Ko as useResourceEvents,ln as useResources,Po as useSearchService,Me as useSelectorController,Mn as useSelectorEmitter,ke as useSelectorEvents,Hn as useSelectorHelper,rr as useSimpleMediaPlayer,ae as useSimpleViewer,Rs as useStaticRenderingStrategy,ir as useStrategy,Ns as useStyleHelper,_o as useStyles,Do as useStylesheetStore,Wr as useSvgEditor,Oe as useSvgEditorControls,pe as useThumbnail,wr as useTranslations,Rr as useTransliteration,R as useVault,gr as useVaultEffect,L as useVaultSelector,Mr as useViewerPreset,ur as useVirtualAnnotationPage,fr as useVirtualAnnotationPageContext,re as useVisibleCanvases};
|
|
@@ -18,6 +18,7 @@ type ImageWithOptionalService = {
|
|
|
18
18
|
}>;
|
|
19
19
|
target: BoxSelector | TemporalBoxSelector;
|
|
20
20
|
selector?: BoxSelector;
|
|
21
|
+
annotationPages?: AnnotationPageNormalized[];
|
|
21
22
|
};
|
|
22
23
|
type SingleAudio = {
|
|
23
24
|
type: 'Sound';
|
|
@@ -127,11 +128,12 @@ type ComplexTimelineStrategy = {
|
|
|
127
128
|
duration: number;
|
|
128
129
|
choice?: ChoiceDescription;
|
|
129
130
|
annotations?: AnnotationPageDescription;
|
|
131
|
+
highlights: Array<any>;
|
|
130
132
|
};
|
|
131
133
|
interface TimelineKeyframe {
|
|
132
134
|
id: string;
|
|
133
135
|
type: 'enter' | 'exit' | 'change';
|
|
134
|
-
resourceType: 'image' | 'audio' | 'video' | 'text';
|
|
136
|
+
resourceType: 'image' | 'audio' | 'video' | 'text' | 'highlight';
|
|
135
137
|
timeDelta?: number;
|
|
136
138
|
isPrime?: boolean;
|
|
137
139
|
time: number;
|
|
@@ -18,6 +18,7 @@ type ImageWithOptionalService = {
|
|
|
18
18
|
}>;
|
|
19
19
|
target: BoxSelector | TemporalBoxSelector;
|
|
20
20
|
selector?: BoxSelector;
|
|
21
|
+
annotationPages?: AnnotationPageNormalized[];
|
|
21
22
|
};
|
|
22
23
|
type SingleAudio = {
|
|
23
24
|
type: 'Sound';
|
|
@@ -127,11 +128,12 @@ type ComplexTimelineStrategy = {
|
|
|
127
128
|
duration: number;
|
|
128
129
|
choice?: ChoiceDescription;
|
|
129
130
|
annotations?: AnnotationPageDescription;
|
|
131
|
+
highlights: Array<any>;
|
|
130
132
|
};
|
|
131
133
|
interface TimelineKeyframe {
|
|
132
134
|
id: string;
|
|
133
135
|
type: 'enter' | 'exit' | 'change';
|
|
134
|
-
resourceType: 'image' | 'audio' | 'video' | 'text';
|
|
136
|
+
resourceType: 'image' | 'audio' | 'video' | 'text' | 'highlight';
|
|
135
137
|
timeDelta?: number;
|
|
136
138
|
isPrime?: boolean;
|
|
137
139
|
time: number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { R as RenderingStrategy, d as ImageServiceLoaderType, m as UseRenderingStrategy, U as UnknownStrategy } from './useRenderingStrategy-
|
|
1
|
+
import { R as RenderingStrategy, d as ImageServiceLoaderType, m as UseRenderingStrategy, U as UnknownStrategy } from './useRenderingStrategy-CHg8UC3-.js';
|
|
2
2
|
import { CanvasNormalized } from '@iiif/presentation-3-normalized';
|
|
3
3
|
import { Paintables } from '@iiif/helpers/painting-annotations';
|
|
4
4
|
import * as _iiif_helpers_vault from '@iiif/helpers/vault';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { R as RenderingStrategy, d as ImageServiceLoaderType, m as UseRenderingStrategy, U as UnknownStrategy } from './useRenderingStrategy-
|
|
1
|
+
import { R as RenderingStrategy, d as ImageServiceLoaderType, m as UseRenderingStrategy, U as UnknownStrategy } from './useRenderingStrategy-CHg8UC3-.cjs';
|
|
2
2
|
import { CanvasNormalized } from '@iiif/presentation-3-normalized';
|
|
3
3
|
import { Paintables } from '@iiif/helpers/painting-annotations';
|
|
4
4
|
import * as _iiif_helpers_vault from '@iiif/helpers/vault';
|
package/dist/utils.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var v=Object.defineProperty;var L=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames;var Y=Object.prototype.hasOwnProperty;var F=(e,o)=>{for(var r in o)v(e,r,{get:o[r],enumerable:!0})},q=(e,o,r,i)=>{if(o&&typeof o=="object"||typeof o=="function")for(let t of E(o))!Y.call(e,t)&&t!==r&&v(e,t,{get:()=>o[t],enumerable:!(i=L(o,t))||i.enumerable});return e};var G=e=>q(v({},"__esModule",{value:!0}),e);var J={};F(J,{emptyActions:()=>j,emptyStrategy:()=>R,getParsedTargetSelector:()=>S,getRenderingStrategy:()=>H,parseSpecificResource:()=>_,unknownResponse:()=>x,unsupportedStrategy:()=>p});module.exports=G(J);var k=require("@iiif/helpers");function _(e){return e.type==="SpecificResource"?[e.source,{selector:e.selector}]:[e,{selector:null}]}function S(e,o){let{selector:r,source:i}=(0,k.expandTarget)(o);if(i.id!==e.id)return[null,i];let t={type:"BoxSelector",spatial:{x:0,y:0,width:Number(e.width),height:Number(e.height)}};return[r?r.type==="TemporalSelector"?{type:"TemporalBoxSelector",temporal:r.temporal,spatial:t.spatial}:r:null,i]}var j={makeChoice:()=>{}},x={type:"unknown"},p=e=>({type:"unknown",reason:e,annotations:{pages:[]}}),R=(e,o)=>({type:"empty",width:e,height:o,annotations:{pages:[]},image:null,images:[]});var Q=["model/gltf-binary"];function z(e,o){let r=o.items[0],i=r.resource;return i.format?Q.indexOf(i.format)===-1?p(`3D format: ${i.format} is unsupported`):{type:"3d-model",model:i,annotationId:r.annotationId,annotation:r.annotation}:p("Unknown format")}function A(e,o){let r=o.items,i=r[0];if(r.length===0||!i)return p("No audio");if(!e.duration)return p("No duration on canvas");if(r.length>1)return p("Only one audio source supported");let t=i.resource;return t?("format"in t||(t.format="audio/mpeg"),{type:"media",media:{annotationId:i.annotationId,annotation:i.annotation,duration:e.duration,url:t.id,type:"Sound",target:{type:"TemporalSelector",temporal:{startTime:0,endTime:e.duration}},format:t.format,selector:{type:"TemporalSelector",temporal:{startTime:0,endTime:e.duration}}},annotations:{pages:[]}}):p("Unknown audio")}var B=require("@iiif/parser/image-3");var N=require("@iiif/helpers/annotation-targets");function C(e,o,r){let i=[];for(let t of o.items){let s=t.resource&&t.resource.type==="SpecificResource"?t.resource.source:t.resource;if(!s.id)return p("No resource Identifier");let m;if(s.service){let g=(0,B.getImageServices)(s);g[0]&&(m=r(g[0],e))}let y={type:"BoxSelector",spatial:{x:0,y:0,width:Number(e.width),height:Number(e.height)}},[d,a]=S(e,t.target),n=e.id?.split("?")[0]||"";if(!(a.id===e.id||decodeURIComponent(a.id||"")===(e.id||"")||a.id===n||decodeURIComponent(a.id||"")===n))continue;let l=t.resource.width&&t.resource.height?{type:"BoxSelector",spatial:{x:0,y:0,width:t.resource.width,height:t.resource.height}}:void 0,c=t.resource.type==="SpecificResource"?(0,N.expandTarget)(t.resource):null;if(t.selector){let g=(0,N.expandTarget)({type:"SpecificResource",source:t.resource,selector:t.selector});g&&(c=g)}let u=c&&c.selector&&(c.selector.type==="BoxSelector"||c.selector.type==="TemporalBoxSelector")?{type:"BoxSelector",spatial:{x:c.selector.spatial.x,y:c.selector.spatial.y,width:c.selector.spatial.width,height:c.selector.spatial.height}}:void 0;m&&!m.id&&(m.id=m["@id"]);let f={id:s.id,type:"Image",annotationId:t.annotationId,annotation:t.annotation,width:Number(d||u?s.width:e.width),height:Number(d||u?s.height:e.height),service:m,sizes:m&&m.sizes?m.sizes:s.width&&s.height?[{width:s.width,height:s.height}]:[],target:d&&d.type!=="PointSelector"?d:y,selector:u||{type:"BoxSelector",spatial:{x:0,y:0,width:Number(e.width),height:Number(e.height)}}};i.push(f)}return{type:"images",image:i[0],images:i,choice:o.choice}}function D(e,o={},r){let i=e.language||r||"none";switch(e.type){case"TextualBody":{typeof e.value<"u"&&(o[i]=[e.value]);break}case"List":case"Composite":case"Choice":e.items&&e.items.forEach(t=>D(t,o,i))}return o}function I(e,o){let r=[];return o.items.forEach(i=>{if(i.resource){let[t]=S(e,i.target);r.push({type:"Text",annotationId:i.annotationId,annotation:i.annotation,text:D(i.resource),target:t})}}),{type:"textual-content",items:r}}var b=require("@iiif/helpers"),$=/^.*(?:(?:youtu\.be\/|v\/|vi\/|u\/\w\/|embed\/|shorts\/)|(?:(?:watch)?\?vi?=|&vi?=))([^#&?]*).*/;function V(e,o,r){let i=o.items.filter(u=>u.type==="video"),t=i[0],s=!1;if(e.duration||(s=!0),i.length>1||!t)return p("Only one video source supported");let m=i[0]?.resource,y=!!(m.service||[]).find(u=>(u.profile||"").includes("youtube.com"));if(!y&&s)return p("Video does not have duration");if(!m)return p("Unknown video");if((!m.format||m.format==="text/html")&&!y)return p("Video does not have format");let d=[],a=r.get(e.annotations||[]);for(let u of a){let f=r.get(u.items||[]);for(let g of f)if((g.motivation?Array.isArray(g.motivation||"")?g.motivation:[g.motivation]:[]).includes("supplementing")){let O=r.get(g.body||[]);for(let U of O){let h=U;if(h.type==="Choice")for(let W of h.items){let T=r.get(W);T.format==="text/vtt"&&d.push({id:T.id,type:"Text",format:"text/vtt",label:T.label,language:T.language})}else h.format==="text/vtt"&&d.push({id:h.id,type:"Text",format:"text/vtt",label:h.label,language:h.language})}}}let n={annotationId:t.annotationId,annotation:t.annotation,duration:e.duration,url:m.id,type:"Video",target:{type:"TemporalSelector",temporal:{startTime:0,endTime:e.duration}},format:m.format,selector:{type:"TemporalSelector",temporal:{startTime:0,endTime:e.duration}}},l=(0,b.expandTarget)(t.target);l.selector&&l.selector.type==="TemporalBoxSelector"&&(n.target=l.selector);let{selector:c}=(0,b.parseSelector)(t.selector);if(c===null){let u=n.target.temporal.startTime,g=(n.target.temporal.endTime||e.duration)-u;n.selector={type:"TemporalSelector",temporal:{startTime:0,endTime:g}}}else c.type==="TemporalSelector"&&(n.selector=c);if(y){n.type="VideoYouTube";let u=m.id.match($);if(!u[1])return p("Video is not known youtube video");n.youTubeId=u[1]}return{type:"media",media:n,annotations:{pages:[]},captions:d}}function M(e,o,r,i){let t={type:"complex-timeline",items:[],keyframes:[],duration:e.duration||0},s={type:"complex-choice",items:[]};function m(a){a.choice&&(a.choice.type==="complex-choice"?s.items.push(...a.choice.items):s.items.push(a.choice))}for(let a of o.items){if(a.type==="image"){let n=C(e,{choice:null,allChoices:null,types:["image"],items:[a]},r);if(n.type==="images"){m(n),t.items.push(n.image);let l={id:n.image.annotationId,type:"enter",resourceType:"image",time:n.image.target?.temporal?.startTime||0};t.keyframes.push(l);let c={id:n.image.annotationId,type:"exit",resourceType:"image",time:n.image.target?.temporal?.endTime||e.duration||0};t.keyframes.push(c)}}if(a.type==="textualbody"){let n=I(e,{choice:null,allChoices:null,types:["textualbody"],items:[a]});if(n.type==="textual-content"){m(n);let l=n.items[0];t.items.push(l);let c=l.target,u={id:l.annotationId,type:"enter",resourceType:"text",time:c.temporal?.startTime||0};t.keyframes.push(u);let f={id:l.annotationId,type:"exit",resourceType:"text",time:c.temporal?.endTime||e.duration||0};t.keyframes.push(f)}}if(a.type==="video"){let n=V(e,{choice:null,allChoices:null,types:["video"],items:[a]},i);if(n.type==="media"){m(n);let l=n.media;t.items.push(l);let c={id:l.annotationId,type:"enter",resourceType:"video",time:l.target?.temporal?.startTime||0};t.keyframes.push(c);let u={id:l.annotationId,type:"exit",resourceType:"video",time:l.target?.temporal?.endTime||e.duration||0};t.keyframes.push(u)}}}t.keyframes.sort((a,n)=>a.time-n.time);let y=[],d=[];for(let a of t.keyframes){if(a.resourceType==="image"||a.resourceType==="text"){d.push(a);continue}if(a.type==="enter"){y.length===0&&(a.isPrime=!0),y.push(a),d.push(a);continue}if(a.type==="exit"&&(d.push(a),y=y.filter(n=>n.id!==a.id),y.length!==0)){let n=y[0],l={id:n.id,type:"change",isPrime:!0,resourceType:n.resourceType,time:a.time};d.push(l)}}return t.keyframes=d,s.items.length&&(t.choice=s),t}var w={},P={get(e){return e},setMetaValue([e,o,r],i){let t=P.getResourceMeta(e,o),s=t?t[r]:void 0,m=typeof i=="function"?i(s):i;w[e]={...w[e]||{},[o]:{...(w[e]||{})[o]||{},[r]:m}}},getResourceMeta:(e,o)=>{let r=w[e];if(r)return o?r[o]:r},async load(e){let o=typeof e=="string"?e:e.id;return fetch(o).then(r=>r.json())},requestStatus(e){}};function H({canvas:e,paintables:o,supports:r,loadImageService:i,vault:t=P}){if(!e)return x;if(o.types.length===0)return r.indexOf("empty")!==-1?R(e.width,e.height):x;if(o.types.length!==1)if(o.types.length===2&&o.types.indexOf("text")!==-1)o.types=o.types.filter(m=>m!=="text");else return r.indexOf("complex-timeline")===-1?p("Complex timeline not supported"):M(e,o,i,t);let s=o.types[0];return s==="image"?r.indexOf("images")===-1?p("Image not supported"):C(e,o,i):s==="Model"||s==="model"?r.indexOf("3d-model")===-1?p("3D not supported"):z(e,o):s==="textualbody"?r.indexOf("textual-content")===-1?p("Textual content not supported"):I(e,o):s==="sound"||s==="audio"?r.indexOf("media")===-1?p("Media not supported"):A(e,o):s==="video"?r.indexOf("media")===-1?p("Media not supported"):V(e,o,t):x}
|
|
1
|
+
"use strict";var N=Object.defineProperty;var Y=Object.getOwnPropertyDescriptor;var F=Object.getOwnPropertyNames;var q=Object.prototype.hasOwnProperty;var G=(e,t)=>{for(var i in t)N(e,i,{get:t[i],enumerable:!0})},_=(e,t,i,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of F(t))!q.call(e,o)&&o!==i&&N(e,o,{get:()=>t[o],enumerable:!(r=Y(t,o))||r.enumerable});return e};var j=e=>_(N({},"__esModule",{value:!0}),e);var X={};G(X,{emptyActions:()=>$,emptyStrategy:()=>R,getParsedTargetSelector:()=>x,getRenderingStrategy:()=>K,parseSpecificResource:()=>Q,unknownResponse:()=>T,unsupportedStrategy:()=>l});module.exports=j(X);var A=require("@iiif/helpers");function Q(e){return e.type==="SpecificResource"?[e.source,{selector:e.selector}]:[e,{selector:null}]}function x(e,t){let{selector:i,source:r}=(0,A.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 $={makeChoice:()=>{}},T={type:"unknown"},l=e=>({type:"unknown",reason:e,annotations:{pages:[]}}),R=(e,t)=>({type:"empty",width:e,height:t,annotations:{pages:[]},image:null,images:[]});var H=["model/gltf-binary"];function B(e,t){let i=t.items[0],r=i.resource;return r.format?H.indexOf(r.format)===-1?l(`3D format: ${r.format} is unsupported`):{type:"3d-model",model:r,annotationId:i.annotationId,annotation:i.annotation}:l("Unknown format")}function I(e,t){let i=t.items,r=i[0];if(i.length===0||!r)return l("No audio");if(!e.duration)return l("No duration on canvas");if(i.length>1)return l("Only one audio source supported");let o=r.resource;return o?("format"in o||(o.format="audio/mpeg"),{type:"media",media:{annotationId:r.annotationId,annotation:r.annotation,duration:e.duration,url:o.id,type:"Sound",target:{type:"TemporalSelector",temporal:{startTime:0,endTime:e.duration}},format:o.format,selector:{type:"TemporalSelector",temporal:{startTime:0,endTime:e.duration}}},annotations:{pages:[]}}):l("Unknown audio")}var v=require("@iiif/helpers/annotation-targets"),D=require("@iiif/parser/image-3");function b(e,t,i){let r=[],o=[];for(let a of t.items){let c=a.resource&&a.resource.type==="SpecificResource"?a.resource.source:a.resource;if(!c.id)return l("No resource Identifier");let u;if(c.service){let h=(0,D.getImageServices)(c);h[0]&&(u=i(h[0],e))}let f={type:"BoxSelector",spatial:{x:0,y:0,width:Number(e.width),height:Number(e.height)}},[g,n]=x(e,a.target),s=e.id?.split("?")[0]||"";if(!(n.id===e.id||decodeURIComponent(n.id||"")===(e.id||"")||n.id===s||decodeURIComponent(n.id||"")===s))continue;let p=a.resource.width&&a.resource.height?{type:"BoxSelector",spatial:{x:0,y:0,width:a.resource.width,height:a.resource.height}}:void 0,m=a.resource.type==="SpecificResource"?(0,v.expandTarget)(a.resource):null;if(a.selector){let h=(0,v.expandTarget)({type:"SpecificResource",source:a.resource,selector:a.selector});h&&(m=h)}let d=m&&m.selector&&(m.selector.type==="BoxSelector"||m.selector.type==="TemporalBoxSelector")?{type:"BoxSelector",spatial:{x:m.selector.spatial.x,y:m.selector.spatial.y,width:m.selector.spatial.width,height:m.selector.spatial.height}}:void 0;u&&!u.id&&(u.id=u["@id"]);let y={id:c.id,type:"Image",annotationId:a.annotationId,annotation:a.annotation,width:Number(g||d?c.width:e.width),height:Number(g||d?c.height:e.height),service:u,sizes:u&&u.sizes?u.sizes:c.width&&c.height?[{width:c.width,height:c.height}]:[],target:g&&g.type!=="PointSelector"?g:f,selector:d||{type:"BoxSelector",spatial:{x:0,y:0,width:Number(e.width),height:Number(e.height)}},annotationPages:a.resource.annotations||[]};r.push(y)}return{type:"images",image:r[0],images:r,choice:t.choice}}function M(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=>M(o,t,r))}return t}function V(e,t){let i=[];return t.items.forEach(r=>{if(r.resource){let[o]=x(e,r.target);i.push({type:"Text",annotationId:r.annotationId,annotation:r.annotation,text:M(r.resource),target:o})}}),{type:"textual-content",items:i}}var w=require("@iiif/helpers"),J=/^.*(?:(?:youtu\.be\/|v\/|vi\/|u\/\w\/|embed\/|shorts\/)|(?:(?:watch)?\?vi?=|&vi?=))([^#&?]*).*/;function P(e,t,i){let r=t.items.filter(m=>m.type==="video"),o=r[0],a=!1;if(e.duration||(a=!0),r.length>1||!o)return l("Only one video source supported");let c=r[0]?.resource,u=!!(c.service||[]).find(m=>(m.profile||"").includes("youtube.com"));if(!u&&a)return l("Video does not have duration");if(!c)return l("Unknown video");if((!c.format||c.format==="text/html")&&!u)return l("Video does not have format");let f=[],g=i.get(e.annotations||[]);for(let m of g){let d=i.get(m.items||[]);for(let y of d)if((y.motivation?Array.isArray(y.motivation||"")?y.motivation:[y.motivation]:[]).includes("supplementing")){let L=i.get(y.body||[]);for(let W of L){let S=W;if(S.type==="Choice")for(let E of S.items){let C=i.get(E);C.format==="text/vtt"&&f.push({id:C.id,type:"Text",format:"text/vtt",label:C.label,language:C.language})}else S.format==="text/vtt"&&f.push({id:S.id,type:"Text",format:"text/vtt",label:S.label,language:S.language})}}}let n={annotationId:o.annotationId,annotation:o.annotation,duration:e.duration,url:c.id,type:"Video",target:{type:"TemporalSelector",temporal:{startTime:0,endTime:e.duration}},format:c.format,selector:{type:"TemporalSelector",temporal:{startTime:0,endTime:e.duration}}},s=(0,w.expandTarget)(o.target);s.selector&&s.selector.type==="TemporalBoxSelector"&&(n.target=s.selector);let{selector:p}=(0,w.parseSelector)(o.selector);if(p===null){let m=n.target.temporal.startTime,y=(n.target.temporal.endTime||e.duration)-m;n.selector={type:"TemporalSelector",temporal:{startTime:0,endTime:y}}}else p.type==="TemporalSelector"&&(n.selector=p);if(u){n.type="VideoYouTube";let m=c.id.match(J);if(!m[1])return l("Video is not known youtube video");n.youTubeId=m[1]}return{type:"media",media:n,annotations:{pages:[]},captions:f}}var O=require("@iiif/helpers");function U(e,t,i,r){let o={type:"complex-timeline",items:[],keyframes:[],highlights:[],duration:e.duration||0},a={type:"complex-choice",items:[]},c=r.get(e.annotations);function u(n){n.choice&&(n.choice.type==="complex-choice"?a.items.push(...n.choice.items):a.items.push(n.choice))}for(let n of t.items){if(n.type==="image"){let s=b(e,{choice:null,allChoices:null,types:["image"],items:[n]},i);if(s.type==="images"){u(s),o.items.push(s.image);let p={id:s.image.annotationId,type:"enter",resourceType:"image",time:s.image.target?.temporal?.startTime||0};o.keyframes.push(p);let m={id:s.image.annotationId,type:"exit",resourceType:"image",time:s.image.target?.temporal?.endTime||e.duration||0};o.keyframes.push(m)}}if(n.type==="textualbody"){let s=V(e,{choice:null,allChoices:null,types:["textualbody"],items:[n]});if(s.type==="textual-content"){u(s);let p=s.items[0];o.items.push(p);let m=p.target,d={id:p.annotationId,type:"enter",resourceType:"text",time:m.temporal?.startTime||0};o.keyframes.push(d);let y={id:p.annotationId,type:"exit",resourceType:"text",time:m.temporal?.endTime||e.duration||0};o.keyframes.push(y)}}if(n.type==="video"){let s=P(e,{choice:null,allChoices:null,types:["video"],items:[n]},r);if(s.type==="media"){u(s);let p=s.media;o.items.push(p);let m={id:p.annotationId,type:"enter",resourceType:"video",time:p.target?.temporal?.startTime||0};o.keyframes.push(m);let d={id:p.annotationId,type:"exit",resourceType:"video",time:p.target?.temporal?.endTime||e.duration||0};o.keyframes.push(d)}}if(n.type==="audio"||n.type==="sound"){let s=I(e,{choice:null,allChoices:null,types:["audio"],items:[n]});if(s.type==="media"){u(s);let p=s.media;o.items.push(p);let m={id:p.annotationId,type:"enter",resourceType:"audio",time:p.target?.temporal?.startTime||0};o.keyframes.push(m);let d={id:p.annotationId,type:"exit",resourceType:"audio",time:p.target?.temporal?.endTime||e.duration||0};o.keyframes.push(d)}}}for(let n of c)for(let s of n.items){let p=r.get(s),m=(0,O.expandTarget)(p.target,{typeMap:r.getState?.().iiif.mapping});if(m.selector?.temporal){let d={id:p.id,type:"enter",resourceType:"highlight",time:m.selector.temporal.startTime||0};o.keyframes.push(d);let y={id:p.id,type:"exit",resourceType:"highlight",time:m.selector.temporal.endTime||e.duration||0};o.keyframes.push(y)}o.highlights.push({annotation:p,target:m})}o.keyframes.sort((n,s)=>n.time-s.time);let f=[],g=[];for(let n of o.keyframes){if(n.resourceType==="image"||n.resourceType==="text"||n.resourceType==="highlight"){g.push(n);continue}if(n.type==="enter"){f.length===0&&(n.isPrime=!0),f.push(n),g.push(n);continue}if(n.type==="exit"&&(g.push(n),f=f.filter(s=>s.id!==n.id),f.length!==0)){let s=f[0],p={id:s.id,type:"change",isPrime:!0,resourceType:s.resourceType,time:n.time};g.push(p)}}return o.keyframes=g,a.items.length&&(o.choice=a),o}var k={},z={get(e){return e},setMetaValue([e,t,i],r){let o=z.getResourceMeta(e,t),a=o?o[i]:void 0,c=typeof r=="function"?r(a):r;k[e]={...k[e]||{},[t]:{...(k[e]||{})[t]||{},[i]:c}}},getResourceMeta:(e,t)=>{let i=k[e];if(i)return t?i[t]:i},async load(e){let t=typeof e=="string"?e:e.id;return fetch(t).then(i=>i.json())},requestStatus(e){}};function K({canvas:e,paintables:t,supports:i,loadImageService:r,vault:o=z}){if(!e)return T;if(t.types.length===0)return i.indexOf("empty")!==-1?R(e.width,e.height):T;if(t.types.length!==1)if(t.types.length===2&&t.types.indexOf("text")!==-1)t.types=t.types.filter(c=>c!=="text");else return i.indexOf("complex-timeline")===-1?l("Complex timeline not supported"):U(e,t,r,o);let a=t.types[0];return a==="image"?i.indexOf("images")===-1?l("Image not supported"):b(e,t,r):a==="Model"||a==="model"?i.indexOf("3d-model")===-1?l("3D not supported"):B(e,t):a==="textualbody"?i.indexOf("textual-content")===-1?l("Textual content not supported"):V(e,t):a==="sound"||a==="audio"?i.indexOf("media")===-1?l("Media not supported"):I(e,t):a==="video"?i.indexOf("media")===-1?l("Media not supported"):P(e,t,o):T}
|
package/dist/utils.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { e as emptyActions, c as emptyStrategy, a as getParsedTargetSelector, g as getRenderingStrategy, p as parseSpecificResource, u as unknownResponse, b as unsupportedStrategy } from './utils-
|
|
2
|
-
import './useRenderingStrategy-
|
|
1
|
+
export { e as emptyActions, c as emptyStrategy, a as getParsedTargetSelector, g as getRenderingStrategy, p as parseSpecificResource, u as unknownResponse, b as unsupportedStrategy } from './utils-C0dpk-mp.cjs';
|
|
2
|
+
import './useRenderingStrategy-CHg8UC3-.cjs';
|
|
3
3
|
import '@iiif/helpers';
|
|
4
4
|
import '@iiif/presentation-3';
|
|
5
5
|
import '@iiif/presentation-3-normalized';
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { e as emptyActions, c as emptyStrategy, a as getParsedTargetSelector, g as getRenderingStrategy, p as parseSpecificResource, u as unknownResponse, b as unsupportedStrategy } from './utils-
|
|
2
|
-
import './useRenderingStrategy-
|
|
1
|
+
export { e as emptyActions, c as emptyStrategy, a as getParsedTargetSelector, g as getRenderingStrategy, p as parseSpecificResource, u as unknownResponse, b as unsupportedStrategy } from './utils-B4O1xptf.js';
|
|
2
|
+
import './useRenderingStrategy-CHg8UC3-.js';
|
|
3
3
|
import '@iiif/helpers';
|
|
4
4
|
import '@iiif/presentation-3';
|
|
5
5
|
import '@iiif/presentation-3-normalized';
|
package/dist/utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a
|
|
1
|
+
import"./chunk-UNH7HXGJ.js";import{a,b,c,d,e,f,l as g}from"./chunk-223VJXTE.js";export{c as emptyActions,f as emptyStrategy,b as getParsedTargetSelector,g as getRenderingStrategy,a as parseSpecificResource,d as unknownResponse,e as unsupportedStrategy};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-iiif-vault",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -55,13 +55,14 @@
|
|
|
55
55
|
},
|
|
56
56
|
"license": "MIT",
|
|
57
57
|
"resolutions": {
|
|
58
|
-
"react
|
|
58
|
+
"react": "^19.2.0",
|
|
59
|
+
"react-dom": "^19.2.0",
|
|
60
|
+
"react-reconciler": "^0.33.0"
|
|
59
61
|
},
|
|
60
62
|
"dependencies": {
|
|
61
|
-
"@atlas-viewer/atlas": "^2.3.7",
|
|
62
63
|
"@floating-ui/react": "^0.27.13",
|
|
63
|
-
"@iiif/helpers": "^1.5.
|
|
64
|
-
"@iiif/parser": "^2.2.
|
|
64
|
+
"@iiif/helpers": "^1.5.4",
|
|
65
|
+
"@iiif/parser": "^2.2.5",
|
|
65
66
|
"@iiif/presentation-2": "^1.0.4",
|
|
66
67
|
"@iiif/presentation-3": "^2.2.3",
|
|
67
68
|
"@iiif/presentation-3-normalized": "^0.9.7",
|
|
@@ -74,10 +75,13 @@
|
|
|
74
75
|
"zustand": "^4.5.2"
|
|
75
76
|
},
|
|
76
77
|
"peerDependencies": {
|
|
77
|
-
"
|
|
78
|
-
"react
|
|
78
|
+
"@atlas-viewer/atlas": "^3.0.2",
|
|
79
|
+
"react": "^18.2.0 || ^19.2.0",
|
|
80
|
+
"react-dom": "^18.2.0 || ^19.2.0"
|
|
79
81
|
},
|
|
80
82
|
"devDependencies": {
|
|
83
|
+
"react": "^19.2.0",
|
|
84
|
+
"react-dom": "^19.2.0",
|
|
81
85
|
"@testing-library/react": "^15.0.2",
|
|
82
86
|
"@types/react": "^18.2.75",
|
|
83
87
|
"@types/react-dom": "^18.2.24",
|