react-iiif-vault 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle.d.ts +335 -3
- package/dist/bundle.global.js +26 -25
- package/dist/canvas-panel.cjs +5 -5
- package/dist/canvas-panel.js +1 -1
- package/dist/chunk-DXFXJCXN.js +1 -0
- package/dist/chunk-K3CE2M2P.js +48 -0
- package/dist/index.cjs +7 -6
- package/dist/index.d.cts +336 -4
- package/dist/index.d.ts +336 -4
- package/dist/index.js +1 -1
- package/dist/utils.cjs +1 -1
- package/dist/utils.js +1 -1
- package/package.json +5 -3
- package/dist/chunk-HEVA2EDS.js +0 -47
- package/dist/chunk-YSH2CIKG.js +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -5,6 +5,9 @@ import React__default, { ReactNode, FunctionComponent, RefObject } from 'react';
|
|
|
5
5
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
6
6
|
import { InternationalString, ImageService, ImageSize, AuthProbeService2, Auth2LocationResource, Auth2SubstituteResource, AuthAccessService2, AuthAccessTokenService2, AuthAccessToken2, SearchServiceQueryParams, SearchServiceSearchResponse, SearchService as SearchService$1, SearchServiceAutocomplete, Reference, Annotation } from '@iiif/presentation-3';
|
|
7
7
|
import { RegionParameter, RotationParameter, SizeParameter, ImageServiceLoader, ImageCandidateRequest, ImageCandidate } from '@atlas-viewer/iiif-image-api';
|
|
8
|
+
import * as polygon_editor from 'polygon-editor';
|
|
9
|
+
import { RenderState, InputShape, SlowState } from 'polygon-editor';
|
|
10
|
+
import { BoxStyle, Preset } from '@atlas-viewer/atlas';
|
|
8
11
|
import * as zustand_vanilla from 'zustand/vanilla';
|
|
9
12
|
import { StoreApi } from 'zustand/vanilla';
|
|
10
13
|
import { Vault, VaultOptions, NormalizedEntity, IIIFStore } from '@iiif/helpers/vault';
|
|
@@ -12,7 +15,8 @@ import * as zustand from 'zustand';
|
|
|
12
15
|
import * as _iiif_helpers from '@iiif/helpers';
|
|
13
16
|
import { Paintables } from '@iiif/helpers';
|
|
14
17
|
import { CanvasNormalized, AnnotationNormalized, AnnotationPageNormalized, CollectionNormalized, ManifestNormalized, RangeNormalized } from '@iiif/presentation-3-normalized';
|
|
15
|
-
import
|
|
18
|
+
import * as mitt from 'mitt';
|
|
19
|
+
import { Handler } from 'mitt';
|
|
16
20
|
import { R as RenderingStrategy } from './useRenderingStrategy-Xj9yQm4y.js';
|
|
17
21
|
export { e as AnnotationPageDescription, A as AudioSequence, C as ComplexTimelineStrategy, E as EmptyStrategy, j as ImageServiceLoaderType, I as ImageWithOptionalService, M as MediaStrategy, h as Single3DModelStrategy, b as SingleAudio, a as SingleImageStrategy, c as SingleVideo, d as SingleYouTubeVideo, S as StrategyActions, T as TextualContentStrategy, U as UnknownStrategy, k as UseRenderingStrategy, l as UseRenderingStrategyOptions, V as VideoSequence, i as get3dStrategy, g as getImageStrategy, f as getTextualContentStrategy, u as useLoadImageService, m as useRenderingStrategy } from './useRenderingStrategy-Xj9yQm4y.js';
|
|
18
22
|
export { emptyActions, emptyStrategy, getParsedTargetSelector, getRenderingStrategy, parseSpecificResource, unknownResponse, unsupportedStrategy } from './utils.js';
|
|
@@ -138,6 +142,177 @@ interface SingleCanvasThumbnailProps {
|
|
|
138
142
|
}
|
|
139
143
|
declare function SingleCanvasThumbnail(props: SingleCanvasThumbnailProps): react_jsx_runtime.JSX.Element;
|
|
140
144
|
|
|
145
|
+
interface SvgEditorOptions {
|
|
146
|
+
image: {
|
|
147
|
+
height: number;
|
|
148
|
+
width: number;
|
|
149
|
+
};
|
|
150
|
+
currentShape: InputShape | null;
|
|
151
|
+
onChange: (e: InputShape) => void;
|
|
152
|
+
hideShapeLines?: boolean;
|
|
153
|
+
}
|
|
154
|
+
declare function useSvgEditor(options: SvgEditorOptions, deps: any[]): {
|
|
155
|
+
helper: {
|
|
156
|
+
draw: {
|
|
157
|
+
enable(): void;
|
|
158
|
+
disable(): void;
|
|
159
|
+
toggle(): void;
|
|
160
|
+
};
|
|
161
|
+
state: RenderState;
|
|
162
|
+
modifiers: {
|
|
163
|
+
reset(): void;
|
|
164
|
+
getForType(type: string | null): Record<string, string>;
|
|
165
|
+
set(modifier: string): void;
|
|
166
|
+
unset(modifier: string): void;
|
|
167
|
+
};
|
|
168
|
+
stamps: {
|
|
169
|
+
set(selectedStamp: InputShape | null): void;
|
|
170
|
+
clear(): void;
|
|
171
|
+
square(): void;
|
|
172
|
+
triangle(): void;
|
|
173
|
+
pentagon(): void;
|
|
174
|
+
hexagon(): void;
|
|
175
|
+
};
|
|
176
|
+
key: {
|
|
177
|
+
down(key: string): true | undefined;
|
|
178
|
+
up(key: string): void;
|
|
179
|
+
};
|
|
180
|
+
setScale: (scale: number) => void;
|
|
181
|
+
clock: {
|
|
182
|
+
set: (renderFunc: polygon_editor.RenderFunc) => void;
|
|
183
|
+
start: (renderFunc?: polygon_editor.RenderFunc | undefined, setStateFunc?: polygon_editor.SetState | undefined) => void;
|
|
184
|
+
stop: () => void;
|
|
185
|
+
step: (deltaTime?: number | undefined) => void;
|
|
186
|
+
};
|
|
187
|
+
pointer: (pointers: ([number, number] | [number, number, number, number, number, number])[]) => void;
|
|
188
|
+
blur: () => void;
|
|
189
|
+
pointerDown: () => void;
|
|
190
|
+
pointerUp: () => void;
|
|
191
|
+
setShape: (shape: InputShape | null) => void;
|
|
192
|
+
modes: {
|
|
193
|
+
toggleLineBoxMode: () => void;
|
|
194
|
+
toggleLineMode: () => void;
|
|
195
|
+
enableLineMode(): void;
|
|
196
|
+
disableLineMode(): void;
|
|
197
|
+
enableLineBoxMode(): void;
|
|
198
|
+
disableLineBoxMode(): void;
|
|
199
|
+
};
|
|
200
|
+
label: (type: string | null) => string;
|
|
201
|
+
};
|
|
202
|
+
state: SlowState;
|
|
203
|
+
isAddingPoint: boolean;
|
|
204
|
+
isSplitting: boolean;
|
|
205
|
+
isStamping: boolean | null;
|
|
206
|
+
isHoveringPoint: boolean;
|
|
207
|
+
transitionDirection: string | null;
|
|
208
|
+
transitionRotate: boolean;
|
|
209
|
+
defs: react_jsx_runtime.JSX.Element;
|
|
210
|
+
editor: react_jsx_runtime.JSX.Element | null;
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
type HelperType$1 = ReturnType<typeof useSvgEditor>['helper'];
|
|
214
|
+
type StateType$1 = ReturnType<typeof useSvgEditor>['state'];
|
|
215
|
+
interface RenderSvgEditorControlsProps {
|
|
216
|
+
helper: HelperType$1;
|
|
217
|
+
state: StateType$1;
|
|
218
|
+
showShapes: boolean;
|
|
219
|
+
classNames?: Partial<{
|
|
220
|
+
button: string;
|
|
221
|
+
}>;
|
|
222
|
+
enabled?: {
|
|
223
|
+
draw?: boolean;
|
|
224
|
+
polygon?: boolean;
|
|
225
|
+
line?: boolean;
|
|
226
|
+
lineBox?: boolean;
|
|
227
|
+
square?: boolean;
|
|
228
|
+
triangle?: boolean;
|
|
229
|
+
hexagon?: boolean;
|
|
230
|
+
circle?: boolean;
|
|
231
|
+
delete?: boolean;
|
|
232
|
+
};
|
|
233
|
+
icons?: Partial<{
|
|
234
|
+
DrawIcon: ReactNode;
|
|
235
|
+
PolygonIcon: ReactNode;
|
|
236
|
+
LineIcon: ReactNode;
|
|
237
|
+
LineBoxIcon: ReactNode;
|
|
238
|
+
ShapesIcon: ReactNode;
|
|
239
|
+
SquareIcon: ReactNode;
|
|
240
|
+
TriangleIcon: ReactNode;
|
|
241
|
+
HexagonIcon: ReactNode;
|
|
242
|
+
CircleIcon: ReactNode;
|
|
243
|
+
DeleteForeverIcon: ReactNode;
|
|
244
|
+
}>;
|
|
245
|
+
}
|
|
246
|
+
declare function RenderSvgEditorControls({ helper, showShapes, state, enabled, classNames, icons, }: RenderSvgEditorControlsProps): react_jsx_runtime.JSX.Element;
|
|
247
|
+
|
|
248
|
+
declare const svgThemes: ({
|
|
249
|
+
name: string;
|
|
250
|
+
outer: {
|
|
251
|
+
borderWidth: number;
|
|
252
|
+
borderColor: string;
|
|
253
|
+
};
|
|
254
|
+
inner: {
|
|
255
|
+
borderWidth: number;
|
|
256
|
+
borderColor: string;
|
|
257
|
+
};
|
|
258
|
+
} | {
|
|
259
|
+
name: string;
|
|
260
|
+
outer: {
|
|
261
|
+
borderWidth: string;
|
|
262
|
+
borderColor: string;
|
|
263
|
+
};
|
|
264
|
+
inner: {
|
|
265
|
+
borderWidth: string;
|
|
266
|
+
borderColor: string;
|
|
267
|
+
};
|
|
268
|
+
} | {
|
|
269
|
+
name: string;
|
|
270
|
+
outer: {
|
|
271
|
+
borderWidth: string;
|
|
272
|
+
borderColor: string;
|
|
273
|
+
};
|
|
274
|
+
inner: {
|
|
275
|
+
borderWidth?: undefined;
|
|
276
|
+
borderColor?: undefined;
|
|
277
|
+
};
|
|
278
|
+
})[];
|
|
279
|
+
type HelperType = ReturnType<typeof useSvgEditor>['helper'];
|
|
280
|
+
type StateType = ReturnType<typeof useSvgEditor>['state'];
|
|
281
|
+
type SvgTheme = {
|
|
282
|
+
name?: string;
|
|
283
|
+
outer: BoxStyle;
|
|
284
|
+
inner: BoxStyle;
|
|
285
|
+
};
|
|
286
|
+
interface CreateCustomShapeProps {
|
|
287
|
+
image: {
|
|
288
|
+
width: number;
|
|
289
|
+
height: number;
|
|
290
|
+
};
|
|
291
|
+
shape?: any;
|
|
292
|
+
updateShape: any;
|
|
293
|
+
theme?: {
|
|
294
|
+
name?: string;
|
|
295
|
+
outer: BoxStyle;
|
|
296
|
+
inner: BoxStyle;
|
|
297
|
+
};
|
|
298
|
+
controlsHtmlId?: string;
|
|
299
|
+
renderControls?: (helper: HelperType, state: StateType, showShapes: boolean) => any;
|
|
300
|
+
}
|
|
301
|
+
declare function CreateCustomShape(props: CreateCustomShapeProps): react_jsx_runtime.JSX.Element;
|
|
302
|
+
|
|
303
|
+
interface PolygonSelectorProps {
|
|
304
|
+
id: string;
|
|
305
|
+
polygon: InputShape;
|
|
306
|
+
annotationBucket?: string;
|
|
307
|
+
isHighlighted?: boolean;
|
|
308
|
+
updatePolygon?: (shape: InputShape) => void;
|
|
309
|
+
readOnly?: boolean;
|
|
310
|
+
theme?: SvgTheme;
|
|
311
|
+
controlsHtmlId?: string;
|
|
312
|
+
renderControls?: CreateCustomShapeProps['renderControls'];
|
|
313
|
+
}
|
|
314
|
+
declare function PolygonSelector(props: PolygonSelectorProps): react_jsx_runtime.JSX.Element | null;
|
|
315
|
+
|
|
141
316
|
declare function AnnotationContext({ annotation, children }: {
|
|
142
317
|
annotation: string;
|
|
143
318
|
children: ReactNode;
|
|
@@ -232,6 +407,7 @@ declare function AuthProvider({ children }: {
|
|
|
232
407
|
declare function AuthProvider_Old({ children }: {
|
|
233
408
|
children: ReactNode;
|
|
234
409
|
}): react_jsx_runtime.JSX.Element;
|
|
410
|
+
declare function useIsAuthEnabled(): boolean;
|
|
235
411
|
declare function useAuthStore(): StoreApi<AuthContextState & AuthContextCurrentActions & AuthContextActions>;
|
|
236
412
|
declare function useAuthActions(): {
|
|
237
413
|
login: () => void;
|
|
@@ -408,6 +584,106 @@ declare function useViewerPreset(): Preset | null | undefined;
|
|
|
408
584
|
declare const ImageServiceLoaderContext: React__default.Context<ImageServiceLoader>;
|
|
409
585
|
declare function useImageServiceLoader(): ImageServiceLoader;
|
|
410
586
|
|
|
587
|
+
type SelectorHelperEventTypes = 'click' | 'hover' | 'selector-updated' | 'highlight' | 'clear-highlight' | 'zoom-to' | 'event-listener' | 'remove-event-listener' | 'image-preview-request';
|
|
588
|
+
declare function SelectorControllerProvider({ children }: {
|
|
589
|
+
children: ReactNode;
|
|
590
|
+
}): react_jsx_runtime.JSX.Element;
|
|
591
|
+
declare function useSelectorEmitter(): mitt.Emitter<Record<mitt.EventType, unknown>>;
|
|
592
|
+
declare function useSelectorEvents(id: string): {
|
|
593
|
+
controller: {
|
|
594
|
+
withSelector(selectorId: string): {
|
|
595
|
+
on<T extends {
|
|
596
|
+
selectorId: string;
|
|
597
|
+
} = any>(type: SelectorHelperEventTypes, handler: Handler<T>): () => void;
|
|
598
|
+
emit<T_1 = any>(type: SelectorHelperEventTypes, event: T_1): void;
|
|
599
|
+
};
|
|
600
|
+
on<T_2 extends {
|
|
601
|
+
selectorId: string;
|
|
602
|
+
} = any>(type: SelectorHelperEventTypes, handler: Handler<T_2>): () => void;
|
|
603
|
+
emit<T_3 extends {
|
|
604
|
+
selectorId: string;
|
|
605
|
+
} = any>(type: SelectorHelperEventTypes, event: T_3): void;
|
|
606
|
+
};
|
|
607
|
+
onClick: (e?: {
|
|
608
|
+
x: number;
|
|
609
|
+
y: number;
|
|
610
|
+
width: number;
|
|
611
|
+
height: number;
|
|
612
|
+
}) => void;
|
|
613
|
+
onHover: (e?: {
|
|
614
|
+
x: number;
|
|
615
|
+
y: number;
|
|
616
|
+
width: number;
|
|
617
|
+
height: number;
|
|
618
|
+
}) => void;
|
|
619
|
+
isHighlighted: boolean;
|
|
620
|
+
};
|
|
621
|
+
declare function useSelectorController(): {
|
|
622
|
+
withSelector(selectorId: string): {
|
|
623
|
+
on<T extends {
|
|
624
|
+
selectorId: string;
|
|
625
|
+
} = any>(type: SelectorHelperEventTypes, handler: Handler<T>): () => void;
|
|
626
|
+
emit<T_1 = any>(type: SelectorHelperEventTypes, event: T_1): void;
|
|
627
|
+
};
|
|
628
|
+
on<T_2 extends {
|
|
629
|
+
selectorId: string;
|
|
630
|
+
} = any>(type: SelectorHelperEventTypes, handler: Handler<T_2>): () => void;
|
|
631
|
+
emit<T_3 extends {
|
|
632
|
+
selectorId: string;
|
|
633
|
+
} = any>(type: SelectorHelperEventTypes, event: T_3): void;
|
|
634
|
+
};
|
|
635
|
+
declare function useSelectorHelper(): {
|
|
636
|
+
withSelector(selectorId: string): {
|
|
637
|
+
highlight(): void;
|
|
638
|
+
clearHighlight(): void;
|
|
639
|
+
zoomTo(): void;
|
|
640
|
+
addEventListener(name: string, callback: () => void): () => void;
|
|
641
|
+
getImagePreview(): Promise<any>;
|
|
642
|
+
on<T extends {
|
|
643
|
+
selectorId: string;
|
|
644
|
+
} = any>(type: SelectorHelperEventTypes, handler: Handler<T>): () => void;
|
|
645
|
+
};
|
|
646
|
+
highlight(selectorId: string): void;
|
|
647
|
+
clearHighlight(selectorId: string): void;
|
|
648
|
+
zoomTo(selectorId: string): void;
|
|
649
|
+
addEventListener(selectorId: string, name: string, callback: () => void): () => void;
|
|
650
|
+
getImagePreview(selectorId: string): Promise<any>;
|
|
651
|
+
on<T_1 extends {
|
|
652
|
+
selectorId: string;
|
|
653
|
+
} = any>(type: SelectorHelperEventTypes, handler: Handler<T_1>): () => void;
|
|
654
|
+
};
|
|
655
|
+
|
|
656
|
+
interface AnnotationStyles {
|
|
657
|
+
id: number;
|
|
658
|
+
name: string;
|
|
659
|
+
creator?: {
|
|
660
|
+
id: number;
|
|
661
|
+
name: string;
|
|
662
|
+
};
|
|
663
|
+
createdAt: Date;
|
|
664
|
+
theme: {
|
|
665
|
+
default: AnnotationThemeDefinition;
|
|
666
|
+
hidden: AnnotationThemeDefinition;
|
|
667
|
+
highlighted: AnnotationThemeDefinition;
|
|
668
|
+
} & Record<string, AnnotationThemeDefinition>;
|
|
669
|
+
}
|
|
670
|
+
type AnnotationThemeDefinition = BoxStyle & {
|
|
671
|
+
hidden?: boolean;
|
|
672
|
+
interactive?: boolean;
|
|
673
|
+
hotspot?: boolean;
|
|
674
|
+
hotspotSize?: 'lg' | 'md' | 'sm';
|
|
675
|
+
};
|
|
676
|
+
declare function getDefaultAnnotationStyles(): AnnotationStyles['theme'];
|
|
677
|
+
declare function useAnnotationStyles(): {
|
|
678
|
+
default: AnnotationThemeDefinition;
|
|
679
|
+
hidden: AnnotationThemeDefinition;
|
|
680
|
+
highlighted: AnnotationThemeDefinition;
|
|
681
|
+
} & Record<string, AnnotationThemeDefinition>;
|
|
682
|
+
declare function AnnotationStyleProvider({ theme, children, }: {
|
|
683
|
+
theme?: AnnotationStyles['theme'];
|
|
684
|
+
children: React.ReactNode;
|
|
685
|
+
}): react_jsx_runtime.JSX.Element;
|
|
686
|
+
|
|
411
687
|
declare function getVideoStrategy(canvas: CanvasNormalized, paintables: Paintables): RenderingStrategy;
|
|
412
688
|
|
|
413
689
|
declare function useAnnotation(options?: {
|
|
@@ -616,6 +892,57 @@ declare function VirtualAnnotationProvider({ children }: {
|
|
|
616
892
|
children: any;
|
|
617
893
|
}): react_jsx_runtime.JSX.Element;
|
|
618
894
|
|
|
895
|
+
declare function usePolygonHelper(data: any, render: (t: any, s: any) => void, commitShape: (shape: InputShape) => void): {
|
|
896
|
+
state: SlowState;
|
|
897
|
+
helper: {
|
|
898
|
+
draw: {
|
|
899
|
+
enable(): void;
|
|
900
|
+
disable(): void;
|
|
901
|
+
toggle(): void;
|
|
902
|
+
};
|
|
903
|
+
state: polygon_editor.RenderState;
|
|
904
|
+
modifiers: {
|
|
905
|
+
reset(): void;
|
|
906
|
+
getForType(type: string | null): Record<string, string>;
|
|
907
|
+
set(modifier: string): void;
|
|
908
|
+
unset(modifier: string): void;
|
|
909
|
+
};
|
|
910
|
+
stamps: {
|
|
911
|
+
set(selectedStamp: InputShape | null): void;
|
|
912
|
+
clear(): void;
|
|
913
|
+
square(): void;
|
|
914
|
+
triangle(): void;
|
|
915
|
+
pentagon(): void;
|
|
916
|
+
hexagon(): void;
|
|
917
|
+
};
|
|
918
|
+
key: {
|
|
919
|
+
down(key: string): true | undefined;
|
|
920
|
+
up(key: string): void;
|
|
921
|
+
};
|
|
922
|
+
setScale: (scale: number) => void;
|
|
923
|
+
clock: {
|
|
924
|
+
set: (renderFunc: polygon_editor.RenderFunc) => void;
|
|
925
|
+
start: (renderFunc?: polygon_editor.RenderFunc | undefined, setStateFunc?: polygon_editor.SetState | undefined) => void;
|
|
926
|
+
stop: () => void;
|
|
927
|
+
step: (deltaTime?: number | undefined) => void;
|
|
928
|
+
};
|
|
929
|
+
pointer: (pointers: ([number, number] | [number, number, number, number, number, number])[]) => void;
|
|
930
|
+
blur: () => void;
|
|
931
|
+
pointerDown: () => void;
|
|
932
|
+
pointerUp: () => void;
|
|
933
|
+
setShape: (shape: InputShape | null) => void;
|
|
934
|
+
modes: {
|
|
935
|
+
toggleLineBoxMode: () => void;
|
|
936
|
+
toggleLineMode: () => void;
|
|
937
|
+
enableLineMode(): void;
|
|
938
|
+
disableLineMode(): void;
|
|
939
|
+
enableLineBoxMode(): void;
|
|
940
|
+
disableLineBoxMode(): void;
|
|
941
|
+
};
|
|
942
|
+
label: (type: string | null) => string;
|
|
943
|
+
};
|
|
944
|
+
};
|
|
945
|
+
|
|
619
946
|
declare function flattenAnnotationPageIds({ canvas, manifest, all, canvases, }: {
|
|
620
947
|
manifest?: ManifestNormalized;
|
|
621
948
|
canvas?: CanvasNormalized;
|
|
@@ -623,11 +950,16 @@ declare function flattenAnnotationPageIds({ canvas, manifest, all, canvases, }:
|
|
|
623
950
|
all?: boolean;
|
|
624
951
|
}): string[];
|
|
625
952
|
|
|
953
|
+
declare function TranslationProvider(props: {
|
|
954
|
+
translations: Record<string, string>;
|
|
955
|
+
children: ReactNode;
|
|
956
|
+
}): react_jsx_runtime.JSX.Element;
|
|
626
957
|
declare function LanguageProvider(props: {
|
|
627
958
|
language: string;
|
|
628
959
|
children: ReactNode;
|
|
629
960
|
}): react_jsx_runtime.JSX.Element;
|
|
630
961
|
declare function useIIIFLanguage(): string;
|
|
962
|
+
declare function useTranslations(): Record<string, string>;
|
|
631
963
|
type LanguageStringProps = {
|
|
632
964
|
[key: string]: any;
|
|
633
965
|
} & {
|
|
@@ -637,8 +969,8 @@ type LanguageStringProps = {
|
|
|
637
969
|
};
|
|
638
970
|
declare function LanguageString({ as: Component, language, children, viewingDirection, ...props }: LanguageStringProps): react_jsx_runtime.JSX.Element;
|
|
639
971
|
declare const useClosestLanguage: (getLanguages: () => string[], deps?: any[]) => string | undefined;
|
|
640
|
-
declare function useLocaleString(inputText: InternationalString | string | null | undefined, defaultText?: string, separator?: string): readonly [string, string | undefined];
|
|
641
|
-
declare function useCreateLocaleString(): (inputText: InternationalString | string | null | undefined, defaultText?: string, separator?: string) => string;
|
|
972
|
+
declare function useLocaleString(inputText: InternationalString | string | null | undefined, defaultText?: string, separator?: string, translations?: Record<string, string>): readonly [string, string | undefined];
|
|
973
|
+
declare function useCreateLocaleString(): (inputText: InternationalString | string | null | undefined, defaultText?: string, separator?: string, translations?: Record<string, string>) => string;
|
|
642
974
|
type LocaleStringProps = {
|
|
643
975
|
as?: string | React__default.FC<any>;
|
|
644
976
|
defaultText?: string;
|
|
@@ -718,4 +1050,4 @@ declare function findAllCanvasesInRange(vault: Vault, range: RangeNormalized): A
|
|
|
718
1050
|
declare function findManifestSelectedRange(vault: Vault, manifest: ManifestNormalized, canvasId: string): null | RangeNormalized;
|
|
719
1051
|
declare function findSelectedRange(vault: Vault, range: RangeNormalized, canvasId: string): null | RangeNormalized;
|
|
720
1052
|
|
|
721
|
-
export { AnnotationContext, AnnotationPageContext, Auth, type AuthAccessState, type AuthContextActions, type AuthContextCurrentActions, type AuthContextState, AuthProvider, AuthProvider_Old, AuthRContext, AuthReactContext, AuthReactContextActions, type AuthState, CanvasAnnotations, CanvasContext, CollectionContext, CombinedMetadata, ContextBridge, Image, type ImageProps, ImageServiceLoaderContext, type ImageServiceRequestOptions, InnerViewerProvider, LanguageProvider, LanguageString, LocaleString, ManifestContext, ManifestMetadata, type MediaPlayerActions, MediaPlayerProvider, type MediaPlayerState, Metadata, type MetadataProps, type ProbeStore, RangeContext, ReactVaultContext, RenderingStrategy, type ResourceContextType, ResourceProvider, ResourceReactContext, type ResourceRequestOptions, SequenceThumbnails, SimpleViewerContext, SimpleViewerProps, SimpleViewerProvider, SimpleViewerReactContext, SingleCanvasThumbnail, type VaultActivatedAnnotation, VaultProvider, ViewerPresetContext, VirtualAnnotationProvider, VisibleCanvasReactContext, authDetailsForResource, createAuthStateStore, createProbe, findAllCanvasesInRange, findFirstCanvasFromRange, findManifestSelectedRange, findSelectedRange, flattenAnnotationPageIds, formatTime, getManifestSequence, getVideoStrategy, getVisibleCanvasesFromCanvasId, hasAuth, makeAccessServiceRequest, makeAccessTokenRequest, useAnnotation, useAnnotationPage, useAnnotationPageManager, useAnnotationsAtTime, useAuthActions, useAuthActions_old, useAuthService, useAuthService_old, useAuthStore, useAuthToken, useAuthToken_old, useAuthTokens, useAuthTokens_old, useCanvas, useCanvasClock, useCanvasSequence, useCanvasSubset, useClosestLanguage, useCollection, useContextBridge, useCreateLocaleString, useCurrentAuth, useCurrentAuth_old, useDispatch, useEventListener, useExistingVault, useExternalCollection, useExternalManifest, useExternalResource, useIIIFLanguage, useImage, useImageService, useImageServiceLoader, useImageTile, useLocaleString, useManifest, useMediaActions, useMediaElements, useMediaState, usePaintables, usePaintingAnnotations, useRange, useResourceContext, useResourceEvents, useResources, useSearchService, useSimpleMediaPlayer, useSimpleViewer, useStyleHelper, useStyles, useThumbnail, useVault, useVaultEffect, useVaultSelector, useViewerPreset, useVirtualAnnotationPage, useVirtualAnnotationPageContext, useVisibleCanvases };
|
|
1053
|
+
export { AnnotationContext, AnnotationPageContext, AnnotationStyleProvider, type AnnotationStyles, type AnnotationThemeDefinition, Auth, type AuthAccessState, type AuthContextActions, type AuthContextCurrentActions, type AuthContextState, AuthProvider, AuthProvider_Old, AuthRContext, AuthReactContext, AuthReactContextActions, type AuthState, CanvasAnnotations, CanvasContext, CollectionContext, CombinedMetadata, ContextBridge, CreateCustomShape, type CreateCustomShapeProps, Image, type ImageProps, ImageServiceLoaderContext, type ImageServiceRequestOptions, InnerViewerProvider, LanguageProvider, LanguageString, LocaleString, ManifestContext, ManifestMetadata, type MediaPlayerActions, MediaPlayerProvider, type MediaPlayerState, Metadata, type MetadataProps, PolygonSelector, type PolygonSelectorProps, type ProbeStore, RangeContext, ReactVaultContext, RenderSvgEditorControls, RenderingStrategy, type ResourceContextType, ResourceProvider, ResourceReactContext, type ResourceRequestOptions, SelectorControllerProvider, type SelectorHelperEventTypes, SequenceThumbnails, SimpleViewerContext, SimpleViewerProps, SimpleViewerProvider, SimpleViewerReactContext, SingleCanvasThumbnail, type SvgTheme, TranslationProvider, type VaultActivatedAnnotation, VaultProvider, ViewerPresetContext, VirtualAnnotationProvider, VisibleCanvasReactContext, authDetailsForResource, createAuthStateStore, createProbe, findAllCanvasesInRange, findFirstCanvasFromRange, findManifestSelectedRange, findSelectedRange, flattenAnnotationPageIds, formatTime, getDefaultAnnotationStyles, getManifestSequence, getVideoStrategy, getVisibleCanvasesFromCanvasId, hasAuth, makeAccessServiceRequest, makeAccessTokenRequest, svgThemes, useAnnotation, useAnnotationPage, useAnnotationPageManager, useAnnotationStyles, useAnnotationsAtTime, useAuthActions, useAuthActions_old, useAuthService, useAuthService_old, useAuthStore, useAuthToken, useAuthToken_old, useAuthTokens, useAuthTokens_old, useCanvas, useCanvasClock, useCanvasSequence, useCanvasSubset, useClosestLanguage, useCollection, useContextBridge, useCreateLocaleString, useCurrentAuth, useCurrentAuth_old, useDispatch, useEventListener, useExistingVault, useExternalCollection, useExternalManifest, useExternalResource, useIIIFLanguage, useImage, useImageService, useImageServiceLoader, useImageTile, useIsAuthEnabled, useLocaleString, useManifest, useMediaActions, useMediaElements, useMediaState, usePaintables, usePaintingAnnotations, usePolygonHelper, useRange, useResourceContext, useResourceEvents, useResources, useSearchService, useSelectorController, useSelectorEmitter, useSelectorEvents, useSelectorHelper, useSimpleMediaPlayer, useSimpleViewer, useStyleHelper, useStyles, useSvgEditor, useThumbnail, useTranslations, useVault, useVaultEffect, useVaultSelector, useViewerPreset, useVirtualAnnotationPage, useVirtualAnnotationPageContext, useVisibleCanvases };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{$ as St,A as Je,Aa as jt,B as Ue,Ba as er,C as Xe,Ca as K,D as Ye,Da as tr,E as Ze,Ea as rr,F as je,Fa as or,G as et,Ga as nr,H as tt,Ha as ir,I as rt,Ia as ar,J as ot,Ja as $,K as nt,L as it,M as at,N as st,O as mt,P as lt,Q as ct,R as ft,S as ut,T as dt,U as gt,V as pt,W as vt,X as xt,Y as yt,Z as Q,_ as ht,a as qe,aa as bt,b as w,ba as It,c as P,ca as Rt,d as Le,da as Ct,e as Te,ea as Pt,f as ke,fa as Nt,g as D,ga as N,h as Ee,ha as Mt,i as Ae,ia as wt,j as W,ja as zt,k as b,ka as qt,l as z,la as Lt,m as Fe,ma as Tt,n as Ve,na as kt,o as q,oa as Et,p as Oe,pa as At,q as De,qa as Ft,r as We,ra as R,s as He,sa as _t,t as Qe,ta as _,u as _e,ua as Kt,v as Ke,va as $t,w as H,wa as L,x as $e,xa as Bt,y as Be,ya as T,z as Ge,za as Gt}from"./chunk-HEVA2EDS.js";import{a as Vt,b as Ot,c as Dt,d as Wt,e as Ht,f as Qt,g as Jt,h as Ut,i as Xt,j as Yt,k as Zt}from"./chunk-YSH2CIKG.js";import{useCanvas as Z}from"@atlas-viewer/atlas";import{forwardRef as j,useImperativeHandle as ee}from"react";import{Fragment as te,jsx as B}from"react/jsx-runtime";var ur=j(function({canvasId:t},r){let i=Z(),o=_(t||i?.id),a=b();return ee(r,()=>o,[t,i]),!i||o.enabledPageIds.length===0?null:B(te,{children:o.enabledPageIds.map(n=>B($.RenderAnnotationPage,{page:a.get(n)},n))})});import{useMemo as ne}from"react";import{useMemo as re}from"react";import{Fragment as oe,jsx as v,jsxs as k}from"react/jsx-runtime";function E({metadata:e=[],config:t,labelWidth:r=16,showEmptyMessage:i=!0,allowHtml:o,emptyFallback:a,classes:n={},emptyMessage:s="No metadata available",emptyValueFallback:l="No value",emptyLabelFallback:g="",separator:d,tableFooter:x,tableHeader:y}){let p=re(()=>{let f=(t||[]).reduce((u,h)=>[...u,...h.keys],[]),m={};for(let u of e){let h=u&&u.label?Object.values(u.label):[];for(let c of h)if(c&&c.length&&(f.indexOf(`metadata.${c[0]}`)!==-1||f.length===0)&&u){let S=`metadata.${c[0]}`;m[S]=m[S]?m[S]:[],m[S].push(u);break}}return m},[t,e]);return Object.keys(p).length===0&&i?v(oe,{children:a})||v("div",{className:n.empty,children:s}):t&&t.length?k("table",{className:n.container,children:[y,v("tbody",{children:t.map((f,m)=>{let u=[];for(let h of f.keys)for(let c of p[h]||[])u.push(v(R,{enableDangerouslySetInnerHTML:o,defaultText:l,separator:d,children:c.value},m+"__"+h));return u.length===0?null:k("tr",{className:n.row,children:[v("td",{className:n.label,style:r?{minWidth:r}:{},children:v(R,{enableDangerouslySetInnerHTML:o,separator:d,defaultText:g,children:f.label})}),v("td",{className:n.value,children:u})]},m)})}),x]}):k("table",{className:n.container,children:[y,v("tbody",{children:e&&e.length?e.map((f,m)=>f?k("tr",{className:n.row,children:[v("td",{className:n.label,style:r?{minWidth:r}:{},children:v(R,{enableDangerouslySetInnerHTML:o,defaultText:l,separator:d,children:f.label})}),v("td",{className:n.value,children:v(R,{enableDangerouslySetInnerHTML:o,defaultText:l,separator:d,children:f.value})})]},m):null):null}),x]})}import{jsx as ie}from"react/jsx-runtime";function Pr(e){let t=q(),r=N(),i=H(),o=ne(()=>{let a=t?.metadata||[],n=r?.metadata||[],s=i?.metadata||[];return[...a,...n,...s]},[t,r,i]);return ie(E,{metadata:o,...e})}import{useEffect as le,useState as ce}from"react";import{createImageServiceRequest as ae,imageServiceRequestToString as se}from"@atlas-viewer/iiif-image-api";import{useMemo as me}from"react";function V(e,t={},r=[]){return me(()=>{if(!e)return null;let i=t.quality;e&&e.extraQualities&&t.quality&&(e.extraQualities.includes(t.quality)||(console.log("Invalid quality",t.quality,e.extraQualities),i="default"));let o=ae(e);return se({identifier:o.identifier,server:o.server,scheme:o.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:i||"default",prefix:o.prefix,originalPath:o.originalPath})},[...r])}import{jsx as A}from"react/jsx-runtime";function fe(e){let t=typeof e.src=="string"?e.src:e.src.id,r=L(),[i,o]=ce(!1),a;if(t){let s=r.loadServiceSync({id:t});s&&(a=s)}!a&&!i&&r.loadService({id:t}).then(()=>{o(!0)});let n=V(a,{size:e.size,selector:e.region,rotation:e.rotation,format:e.format,region:e.region,quality:e.quality},[i,e.src,e.size,e.region,e.rotation,e.format,e.region,e.quality]);return le(()=>()=>{o(!1)},[t]),n?A("img",{src:n,alt:e.alt,className:e.className,style:e.style}):A(ue,{...e,fetchImageService:!1})}function ue(e){if(e.fetchImageService)return A(fe,{...e});let t=typeof e.src=="string"?{id:e.src,profile:"level0"}:e.src,r=V(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 r?A("img",{src:r,alt:e.alt,className:e.className,style:e.style}):null}import{jsx as de}from"react/jsx-runtime";function Hr(e){let t=q();return de(E,{metadata:t?.metadata||[],...e})}import{useLayoutEffect as ye,useRef as he}from"react";import*as O from"react-lazy-load-image-component";import{getValue as ge}from"@iiif/helpers/i18n";import{Fragment as G,jsx as I,jsxs as xe}from"react/jsx-runtime";var{LazyLoadComponent:pe}=O||O.default;function J(e){let{size:t,visible:r,classes:i,canvasId:o,figure:a}=e,n=t?.width||128,s=t?.height||t?.width||128,l=I(ve,{...e}),g=I(pe,{threshold:300,style:{height:s,width:n},visibleByDefault:r,children:o?I(W,{canvas:o,children:l}):l});return a?I("figure",{className:i?.figure,children:g}):g}function ve({fallback:e,size:t,classes:r,showLabel:i,alt:o,dereference:a=!1}){let n=N(),s=t?.width||128,l=t?.height||t?.width||128,g=o||ge(n?.label)||"",d=K({width:s,height:l},a);return!d||d.type!=="fixed"?I(G,{children:e}):xe(G,{children:[I("div",{className:r?.imageWrapper,children:I("img",{className:r?.img,src:d.id,alt:g})}),i?I(R,{as:"figcaption",className:r?.label,children:n?.label}):null]})}import{jsx as M}from"react/jsx-runtime";function eo({flat:e,size:t,classes:r={},showLabel:i,figure:o,fallback:a}){let n=he(null),{items:s,sequence:l,currentSequenceIndex:g,setSequenceIndex:d}=Q(),x={row:r.selected?.row||r.row,item:r.selected?.item||r.item,figure:r.selected?.figure||r.figure,img:r.selected?.img||r.img,label:r.selected?.label||r.label,imageWrapper:r.selected?.imageWrapper||r.imageWrapper};ye(()=>{if(!n.current)return;let p=n.current.querySelector("[data-selected=true]");p&&p.scrollIntoView({behavior:"smooth",block:"nearest",inline:"center"})},[g]);let y=[];for(let p of l){let C=[],f=l[g]===p;for(let m of p){let u=s[m];C.push(M("div",{className:f?x.item:r.item,children:M(J,{classes:f?x:r,canvasId:u.id,size:t,showLabel:i,figure:o,placeholder:M("div",{style:{height:128,width:128}}),fallback:a})},m))}if(e){y.push(C);continue}y.push(M("div",{onClick:m=>{d(l.indexOf(p))},"data-selected":f,className:f?x.row:r.row,children:C}))}return M("div",{ref:n,className:r.container,children:y})}import{jsx as Se}from"react/jsx-runtime";function no({annotation:e,children:t}){return Se(P,{value:{annotation:e},children:t})}import{jsx as be}from"react/jsx-runtime";function mo({annotationPage:e,children:t}){return be(P,{value:{annotationPage:e},children:t})}import{jsx as Ie}from"react/jsx-runtime";function uo({collection:e,children:t}){return Ie(P,{value:{collection:e},children:t})}function xo(e,t={}){return T(t)}function ho(e,t=!1){}function Ro(e){let r=w().manifest,i=e?e.map(o=>typeof o=="string"?o:o?.id):[];return z(o=>{let a=r?o.iiif.entities.Manifest[r]:void 0,n=a?.items||[];if(typeof e>"u")return n;let s=[];for(let l of a?.items||[])i.indexOf(l.id)!==-1&&s.push(l);return s},[i.join("/")])}import{useMemo as Re}from"react";function wo(e,t=[]){let{id:r,selector:i}=e,o=w(),a=r||o.collection,n=z(s=>a?s.iiif.entities.Collection[a]:void 0,[a]);return Re(()=>{if(n)return i?i(n):n},[n,i,...t])}import{useEffect as Ce,useMemo as Pe}from"react";import{createEventsHelper as Ne}from"@iiif/helpers/events";function ko(e,t,r,i,o=[]){let a=b(),n=Pe(()=>Ne(a),[a]);Ce(()=>{let s=e;return s?(n.addEventListener(s,t,r,i),()=>{n.removeEventListener(s,t,r)}):()=>{}},[n,e,t,...o])}function Vo(e,t){let{id:r,isLoaded:i,error:o,resource:a,requestId:n,cached:s}=D(e,t);return{id:r,isLoaded:i,error:o,manifest:a,requestId:n,cached:s}}import{getImageServices as U}from"@atlas-viewer/iiif-image-api";import{useEffect as Me,useMemo as X,useState as F}from"react";function Y({cacheKey:e}={}){let t=N(),r=T(),i=b(),o=L(),[a,n]=F(void 0),[s,l]=F(!1),[g,d]=F("idle"),[x,y]=F(void 0),p=t?t.id:"undefined",C=X(()=>{try{if(t&&r.length){let m=r[0],u=i.get(m.body[0]),c=U(u)[0];return c&&o.loadServiceSync({id:c.id||c["@id"],width:c.width||t.width,height:c.height||t.height})||void 0}}catch(m){console.error(m)}},[p,e,t]),f=g==="success"&&a?a:C;return Me(()=>{(async()=>{try{if(t&&r.length){let m=r[0],u=i.get(m.body[0]),c=U(u)[0];if(!c)return;l(!0),d("loading");try{let S=await o.loadService({id:c.id||c["@id"],width:c.width||t.width,height:c.height||t.height})||void 0;n(S),d("success"),l(!1)}catch(S){d("error"),y(S)}}}catch(m){d("error"),y(m)}})()},[p,e]),X(()=>({data:f,isFetching:s,status:g,error:x}),[f,s,g,x])}function Go(){let e=Y();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 we}from"@iiif/helpers/styles";import{useMemo as ze}from"react";function Zo(){let e=b();return ze(()=>we(e),[e])}export*from"@iiif/helpers/annotation-targets";export{no as AnnotationContext,mo as AnnotationPageContext,gt as Auth,tt as AuthProvider,rt as AuthProvider_Old,Ze as AuthRContext,je as AuthReactContext,et as AuthReactContextActions,ur as CanvasAnnotations,W as CanvasContext,$ as CanvasPanel,uo as CollectionContext,Pr as CombinedMetadata,St as ContextBridge,ue as Image,$t as ImageServiceLoaderContext,xt as InnerViewerProvider,Lt as LanguageProvider,kt as LanguageString,R as LocaleString,Ae as ManifestContext,Hr as ManifestMetadata,ar as MediaPlayerProvider,E as Metadata,Oe as RangeContext,Le as ReactVaultContext,P as ResourceProvider,qe as ResourceReactContext,eo as SequenceThumbnails,yt as SimpleViewerProvider,vt as SimpleViewerReactContext,J as SingleCanvasThumbnail,Te as VaultProvider,Pt as ViewerPresetContext,Ct as VirtualAnnotationProvider,Fe as VisibleCanvasReactContext,Ue as authDetailsForResource,Ge as createAuthStateStore,Je as createProbe,Dt as emptyActions,Qt as emptyStrategy,We as findAllCanvasesInRange,De as findFirstCanvasFromRange,He as findManifestSelectedRange,Qe as findSelectedRange,_t as flattenAnnotationPageIds,tr as formatTime,Jt as get3dStrategy,Ut as getImageStrategy,Ke as getManifestSequence,Ot as getParsedTargetSelector,Zt as getRenderingStrategy,Xt as getTextualContentStrategy,Yt as getVideoStrategy,_e as getVisibleCanvasesFromCanvasId,Be as hasAuth,Ye as makeAccessServiceRequest,Xe as makeAccessTokenRequest,Vt as parseSpecificResource,Wt as unknownResponse,Ht as unsupportedStrategy,zt as useAnnotation,qt as useAnnotationPage,_ as useAnnotationPageManager,xo as useAnnotationsAtTime,nt as useAuthActions,dt as useAuthActions_old,at as useAuthService,ct as useAuthService_old,ot as useAuthStore,mt as useAuthToken,ut as useAuthToken_old,st as useAuthTokens,ft as useAuthTokens_old,N as useCanvas,ho as useCanvasClock,$e as useCanvasSequence,Ro as useCanvasSubset,Et as useClosestLanguage,wo as useCollection,ht as useContextBridge,Ft as useCreateLocaleString,it as useCurrentAuth,lt as useCurrentAuth_old,bt as useDispatch,ko as useEventListener,ke as useExistingVault,Vo as useExternalCollection,Ee as useExternalManifest,D as useExternalResource,Tt as useIIIFLanguage,V as useImage,Y as useImageService,L as useImageServiceLoader,Go as useImageTile,Bt as useLoadImageService,At as useLocaleString,q as useManifest,nr as useMediaActions,ir as useMediaElements,or as useMediaState,Gt as usePaintables,T as usePaintingAnnotations,H as useRange,jt as useRenderingStrategy,w as useResourceContext,Mt as useResourceEvents,Kt as useResources,pt as useSearchService,rr as useSimpleMediaPlayer,Q as useSimpleViewer,Zo as useStyleHelper,wt as useStyles,K as useThumbnail,b as useVault,er as useVaultEffect,z as useVaultSelector,Nt as useViewerPreset,It as useVirtualAnnotationPage,Rt as useVirtualAnnotationPageContext,Ve as useVisibleCanvases};
|
|
1
|
+
import{$ as Co,A as Gt,Aa as Zo,B as Jt,Ba as D,C as Zt,Ca as jo,D as jt,Da as an,E as eo,Ea as sn,F as to,Fa as ie,G as oo,Ga as ln,H as no,Ha as cn,I as ro,Ia as mn,J as io,Ja as un,K as ao,Ka as dn,L as so,La as fn,M as lo,Ma as ae,N as co,O as mo,P as uo,Q as fo,R as go,S as po,T as ho,U as yo,V as vo,W as So,X as xo,Y as bo,Z as Io,_ as ne,a as Bt,aa as ko,b as z,ba as Po,c as B,ca as To,d as Lt,da as wo,e as Ht,ea as Ro,f as zt,fa as Eo,g as ee,ga as Mo,h as At,ha as T,i as qt,ia as No,j as te,ja as Bo,k as P,ka as Lo,l as A,la as Ho,m as Wt,ma as zo,n as Dt,na as Ao,o as q,oa as qo,p as Ft,pa as Wo,q as Ot,qa as Do,r as $t,ra as Fo,s as Vt,sa as Oo,t as Xt,ta as $o,u as Yt,ua as N,v as _t,va as Uo,w as oe,wa as re,x as Kt,xa as Go,y as Qt,ya as Jo,z as Ut,za as W}from"./chunk-K3CE2M2P.js";import{a as Vo,b as Xo,c as Yo,d as _o,e as Ko,f as Qo,g as en,h as tn,i as on,j as nn,k as rn}from"./chunk-DXFXJCXN.js";import{useCanvas as ze}from"@atlas-viewer/atlas";import{forwardRef as Ae,useImperativeHandle as qe}from"react";import{Fragment as We,jsx as se}from"react/jsx-runtime";var Sn=Ae(function({canvasId:t},o){let n=ze(),i=re(t||n?.id),a=P();return qe(o,()=>i,[t,n]),!n||i.enabledPageIds.length===0?null:se(We,{children:i.enabledPageIds.map(s=>se(ae.RenderAnnotationPage,{page:a.get(s)},s))})});import{useMemo as Oe}from"react";import{useMemo as De}from"react";import{Fragment as Fe,jsx as I,jsxs as F}from"react/jsx-runtime";function O({metadata:e=[],config:t,labelWidth:o=16,showEmptyMessage:n=!0,allowHtml:i,emptyFallback:a,classes:s={},emptyMessage:l="No metadata available",emptyValueFallback:c="No value",emptyLabelFallback:f="",separator:u,tableFooter:v,tableHeader:S}){let h=De(()=>{let g=(t||[]).reduce((d,x)=>[...d,...x.keys],[]),m={};for(let d of e){let x=d&&d.label?Object.values(d.label):[];for(let r of x)if(r&&r.length&&(g.indexOf(`metadata.${r[0]}`)!==-1||g.length===0)&&d){let b=`metadata.${r[0]}`;m[b]=m[b]?m[b]:[],m[b].push(d);break}}return m},[t,e]);return Object.keys(h).length===0&&n?I(Fe,{children:a})||I("div",{className:s.empty,children:l}):t&&t.length?F("table",{className:s.container,children:[S,I("tbody",{children:t.map((g,m)=>{let d=[];for(let x of g.keys)for(let r of h[x]||[])d.push(I(N,{enableDangerouslySetInnerHTML:i,defaultText:c,separator:u,children:r.value},m+"__"+x));return d.length===0?null:F("tr",{className:s.row,children:[I("td",{className:s.label,style:o?{minWidth:o}:{},children:I(N,{enableDangerouslySetInnerHTML:i,separator:u,defaultText:f,children:g.label})}),I("td",{className:s.value,children:d})]},m)})}),v]}):F("table",{className:s.container,children:[S,I("tbody",{children:e&&e.length?e.map((g,m)=>g?F("tr",{className:s.row,children:[I("td",{className:s.label,style:o?{minWidth:o}:{},children:I(N,{enableDangerouslySetInnerHTML:i,defaultText:c,separator:u,children:g.label})}),I("td",{className:s.value,children:I(N,{enableDangerouslySetInnerHTML:i,defaultText:c,separator:u,children:g.value})})]},m):null):null}),v]})}import{jsx as $e}from"react/jsx-runtime";function Bn(e){let t=q(),o=T(),n=oe(),i=Oe(()=>{let a=t?.metadata||[],s=o?.metadata||[],l=n?.metadata||[];return[...a,...s,...l]},[t,o,n]);return $e(O,{metadata:i,...e})}import{useEffect as _e,useState as Ke}from"react";import{createImageServiceRequest as Ve,imageServiceRequestToString as Xe}from"@atlas-viewer/iiif-image-api";import{useMemo as Ye}from"react";function Q(e,t={},o=[]){return Ye(()=>{if(!e)return null;let n=t.quality;e&&e.extraQualities&&t.quality&&(e.extraQualities.includes(t.quality)||(n="default"));let i=Ve(e);return Xe({identifier:i.identifier,server:i.server,scheme:i.scheme,type:"image",size:{max:!t.size?.width&&!t.size?.height,confined:!1,upscaled:!1,...t.size||{}},format:t.format||"jpg",region:t.region||{full:!0},rotation:t?.rotation?Number.isInteger(t.rotation)?{angle:t.rotation}:t.rotation:{angle:0},quality:n||"default",prefix:i.prefix,originalPath:i.originalPath})},[...o])}import{jsx as $}from"react/jsx-runtime";function Qe(e){let t=typeof e.src=="string"?e.src:e.src.id,o=W(),[n,i]=Ke(!1),a;if(t){let l=o.loadServiceSync({id:t});l&&(a=l)}!a&&!n&&o.loadService({id:t}).then(()=>{i(!0)});let s=Q(a,{size:e.size,selector:e.region,rotation:e.rotation,format:e.format,region:e.region,quality:e.quality},[n,e.src,e.size,e.region,e.rotation,e.format,e.region,e.quality]);return _e(()=>()=>{i(!1)},[t]),s?$("img",{src:s,alt:e.alt,className:e.className,style:e.style}):$(Ue,{...e,fetchImageService:!1})}function Ue(e){if(e.fetchImageService)return $(Qe,{...e});let t=typeof e.src=="string"?{id:e.src,profile:"level0"}:e.src,o=Q(t,{size:e.size,selector:e.region,rotation:e.rotation,format:e.format,region:e.region,quality:e.quality},[e.src,e.size,e.region,e.rotation,e.format,e.region,e.quality]);return o?$("img",{src:o,alt:e.alt,className:e.className,style:e.style}):null}import{jsx as Ge}from"react/jsx-runtime";function Qn(e){let t=q();return Ge(O,{metadata:t?.metadata||[],...e})}import{useLayoutEffect as tt,useRef as ot}from"react";import*as U from"react-lazy-load-image-component";import{getValue as Je}from"@iiif/helpers/i18n";import{Fragment as le,jsx as w,jsxs as et}from"react/jsx-runtime";var{LazyLoadComponent:Ze}=U||U.default;function ce(e){let{size:t,visible:o,classes:n,canvasId:i,figure:a}=e,s=t?.width||128,l=t?.height||t?.width||128,c=w(je,{...e}),f=w(Ze,{threshold:300,style:{height:l,width:s},visibleByDefault:o,children:i?w(te,{canvas:i,children:c}):c});return a?w("figure",{className:n?.figure,children:f}):f}function je({fallback:e,size:t,classes:o,showLabel:n,alt:i,dereference:a=!1}){let s=T(),l=t?.width||128,c=t?.height||t?.width||128,f=i||Je(s?.label)||"",u=ie({width:l,height:c},a);return!u||u.type!=="fixed"?w(le,{children:e}):et(le,{children:[w("div",{className:o?.imageWrapper,children:w("img",{className:o?.img,src:u.id,alt:f})}),n?w(N,{as:"figcaption",className:o?.label,children:s?.label}):null]})}import{jsx as L}from"react/jsx-runtime";function sr({flat:e,size:t,classes:o={},showLabel:n,figure:i,fallback:a}){let s=ot(null),{items:l,sequence:c,currentSequenceIndex:f,setSequenceIndex:u}=ne(),v={row:o.selected?.row||o.row,item:o.selected?.item||o.item,figure:o.selected?.figure||o.figure,img:o.selected?.img||o.img,label:o.selected?.label||o.label,imageWrapper:o.selected?.imageWrapper||o.imageWrapper};tt(()=>{if(!s.current)return;let h=s.current.querySelector("[data-selected=true]");h&&h.scrollIntoView({behavior:"smooth",block:"nearest",inline:"center"})},[f]);let S=[];for(let h of c){let C=[],g=c[f]===h;for(let m of h){let d=l[m];C.push(L("div",{className:g?v.item:o.item,children:L(ce,{classes:g?v:o,canvasId:d.id,size:t,showLabel:n,figure:i,placeholder:L("div",{style:{height:128,width:128}}),fallback:a})},m))}if(e){S.push(C);continue}S.push(L("div",{onClick:m=>{u(c.indexOf(h))},"data-selected":g,className:g?v.row:o.row,children:C}))}return L("div",{ref:s,className:o.container,children:S})}import{Fragment as me,jsx as R,jsxs as ue}from"react/jsx-runtime";var nt={draw:!0,polygon:!0,line:!0,lineBox:!0,square:!0,triangle:!0,hexagon:!0,circle:!0,delete:!0};function mr({helper:e,showShapes:t,state:o,enabled:n=nt,classNames:i={},icons:a={}}){return ue(me,{children:[t?ue(me,{children:[n.draw&&R("button",{className:i.button,onClick:()=>{e.stamps.clear(),e.draw.enable()},"data-active":!o.lineMode&&!o.selectedStamp&&t&&o.drawMode,children:a.DrawIcon||"Draw"}),n.polygon&&R("button",{className:i.button,"data-active":!o.lineMode&&!o.selectedStamp&&t&&!o.drawMode,onClick:()=>{e.stamps.clear(),e.draw.disable(),e.modes.disableLineBoxMode(),e.modes.disableLineMode()},children:a.PolygonIcon||"Polygon"}),n.line&&R("button",{className:i.button,"data-active":o.lineMode&&!o.lineBoxMode,onClick:()=>{e.modes.enableLineMode()},children:a.LineIcon||"Line"}),n.lineBox&&R("button",{className:i.button,"data-active":o.lineBoxMode,onClick:()=>{e.modes.enableLineBoxMode()},children:a.LineBoxIcon||"LineBox"}),n.square&&R("button",{className:i.button,"data-active":o.selectedStamp?.id==="square",onClick:()=>{e.stamps.square()},children:a.SquareIcon||"Square"}),n.triangle&&R("button",{className:i.button,"data-active":o.selectedStamp?.id==="triangle",onClick:()=>{e.stamps.triangle()},children:a.TriangleIcon||"Triangle"}),n.hexagon&&R("button",{className:i.button,"data-active":o.selectedStamp?.id==="hexagon",onClick:()=>{e.stamps.hexagon()},children:a.HexagonIcon||"Hexagon"})]}):null,o.showBoundingBox&&n.delete&&R("button",{className:i.button,onClick:()=>e.key.down("Backspace"),children:a.DeleteForeverIcon||"Delete"})]})}import{createContext as rt,useCallback as de,useContext as ge,useEffect as fe,useMemo as G,useState as it}from"react";import pe from"mitt";import{jsx as at}from"react/jsx-runtime";var V=rt(pe());V.displayName="SelectorHelper";function vr({children:e}){return at(V.Provider,{value:G(()=>pe(),[]),children:e})}function Sr(){return ge(V)}function he(e){let t=ye(),[o,n]=it(!1);fe(()=>t.withSelector(e).on("highlight",()=>{n(!0)}),[t,e]),fe(()=>t.withSelector(e).on("clear-highlight",()=>{n(!1)}),[t,e]);let i=de(s=>{t.emit("click",{selectorId:e,event:s})},[e,t]),a=de(s=>{t.emit("hover",{selectorId:e,event:s})},[e,t]);return{controller:t,onClick:i,onHover:a,isHighlighted:o}}function ye(){let e=ge(V);return G(()=>({withSelector(t){return{on(o,n){let i=a=>{a&&a.selectorId===t&&n(a)};return e.on(o,i),()=>{e.off(o,i)}},emit(o,n){e.emit(o,{...n,selectorId:t})}}},on(t,o){return e.on(t,o),()=>{e.off(t,o)}},emit(t,o){e.emit(t,o)}}),[e])}function xr(){let e=ye();return G(()=>({withSelector(t){return{highlight(){e.emit("highlight",{selectorId:t})},clearHighlight(){e.emit("clear-highlight",{selectorId:t})},zoomTo(){e.emit("zoom-to",{selectorId:t})},addEventListener(o,n){return e.emit("event-listener",{selectorId:t,name:o,callback:n}),()=>{e.emit("remove-event-listener",{selectorId:t,name:o,callback:n})}},getImagePreview(){return new Promise((o,n)=>{e.emit("image-preview-request",{selectorId:t,resolve:o,reject:n})})},on(o,n){return e.withSelector(t).on(o,n)}}},highlight(t){e.emit("highlight",{selectorId:t})},clearHighlight(t){e.emit("clear-highlight",{selectorId:t})},zoomTo(t){e.emit("zoom-to",{selectorId:t})},addEventListener(t,o,n){return e.emit("event-listener",{selectorId:t,name:o,callback:n}),()=>{e.emit("remove-event-listener",{selectorId:t,name:o,callback:n})}},getImagePreview(t){return new Promise((o,n)=>{e.emit("image-preview-request",{selectorId:t,resolve:o,reject:n})})},on(t,o){return e.on(t,o)}}),[e])}import{createContext as st,useContext as lt,useMemo as ct}from"react";import{jsx as mt}from"react/jsx-runtime";function ve(){return{default:{backgroundColor:"rgba(0,0,0,0)",borderWidth:"2px",borderColor:"rgba(252,0,98, .5)"},highlighted:{backgroundColor:"rgba(75, 103, 225, 0.4)",borderWidth:"1px",borderColor:"rgba(75,103,225,0.99)"},hidden:{borderWidth:"0px",borderColor:"rgba(0,0,0,0)",backgroundColor:"rgba(0,0,0,0)",hidden:!0}}}var J=st(ve());J.displayName="AnnotationStyle";function Se(){return lt(J)}function kr({theme:e,children:t}){let o=ct(()=>e||ve(),[e]);return mt(J.Provider,{value:o,children:t})}import{HTMLPortal as ht,useAtlas as yt}from"@atlas-viewer/atlas";import{useEffect as be,useRef as E,useState as Ie}from"react";import{useEffect as ut,useMemo as dt,useState as ft}from"react";import{createHelper as gt}from"polygon-editor";function xe(e,t,o){let[n,i]=ft({}),a=dt(()=>gt(e,o),[]);return ut(()=>(a.clock.start(t,i),()=>{a.clock.stop()}),[]),{state:n,helper:a}}import{createSvgHelpers as pt}from"polygon-editor";import{Fragment as Ce,jsx as y,jsxs as ke}from"react/jsx-runtime";var M=pt();function Pe(e,t){let{image:o,currentShape:n,onChange:i,hideShapeLines:a}=e,s=E(),l=E(),c=E(),f=E(),u=E(),v=E(),S=E(),h=E(),[C,g]=Ie(null),[m,d]=Ie(!1),{helper:x,state:r}=xe(n,(p,k)=>{M.updateTransitionBoundingBox(l.current,p,k),M.updateBoundingBoxPolygon(s.current,p,k),M.updateTransitionShape(v.current,p,k),M.updateClosestLinePointTransform(f.current,p,k),M.updateSelectBox(c.current,p,k),M.updatePointLine(S.current,p,k),M.updateDrawPreview(u.current,p,k,3),M.updateLineBox(h.current,p),g(p.transitionDirection),d(p.transitionRotate)},i);be(()=>{x.setShape(n||null)},t),be(()=>{let p=()=>{x.modifiers.reset()};return document.addEventListener("mouseleave",p),()=>{document.removeEventListener("mouseleave",p)}},[]);let b=ke(Ce,{children:[y("marker",{id:"dot",viewBox:"0 0 10 10",refX:"5",refY:"5",markerWidth:"5",markerHeight:"5",children:y("circle",{cx:"5",cy:"5",r:"4",className:"marker"})}),y("marker",{id:"selected",viewBox:"0 0 10 10",refX:"5",refY:"5",markerWidth:"5",markerHeight:"5",children:y("circle",{cx:"5",cy:"5",r:"4",fill:"#FAFF00"})}),y("marker",{id:"resizer",viewBox:"0 0 10 10",refX:"5",refY:"5",markerWidth:"5",markerHeight:"5",children:y("rect",{width:"10",height:"10",stroke:"#FF0DCB",fill:"#fff",strokeWidth:2})})]}),_=n?n.open?"polyline":"polygon":null,j=!r.showBoundingBox&&r.closestPoint!==null&&r.actionIntentType==="select-point",Be=r.actionIntentType==="add-open-point",Le=r.transitionIntentType==="split-line",K=r.transitioning&&r.selectedStamp&&r.transitionIntentType==="stamp-shape",He=n&&_?ke(Ce,{children:[y(_,{fill:!r.transitioning&&r.showBoundingBox?"rgba(255, 0, 0, .5)":"none",strokeWidth:K?0:2,stroke:a?"transparent":"#000",points:n.points.map(p=>p.join(",")).join(" "),vectorEffect:"non-scaling-stroke",markerStart:r.showBoundingBox?void 0:"url(#dot)",markerMid:r.showBoundingBox?void 0:"url(#dot)",markerEnd:r.showBoundingBox?void 0:"url(#dot)",style:{pointerEvents:"none"}}),r.lineBoxMode&&r.actionIntentType==="close-line-box"?y("polygon",{fill:"rgba(255, 0, 0, .4)",ref:h,stroke:"#000",strokeWidth:2,vectorEffect:"non-scaling-stroke"}):null,r.transitionIntentType==="draw-shape"&&r.transitioning?y("polyline",{ref:u,fill:"none",stroke:"rgba(255, 0, 0, .5)",strokeWidth:2,vectorEffect:"non-scaling-stroke"}):null,!r.showBoundingBox&&r.selectedPoints&&r.selectedPoints.length?y("polyline",{strokeWidth:2,vectorEffect:"non-scaling-stroke",stroke:"transparent",markerStart:"url(#selected)",markerMid:"url(#selected)",markerEnd:"url(#selected)",fill:"transparent",points:n.points.filter((p,k)=>r.selectedPoints?.includes(k)).map(p=>p.join(",")).join(" ")}):null,j&&r.closestPoint!==null&&n.points[r.closestPoint]?y("polyline",{strokeWidth:2,vectorEffect:"non-scaling-stroke",stroke:"transparent",markerStart:"url(#selected)",markerMid:"url(#selected)",markerEnd:"url(#selected)",fill:"transparent",points:`${n.points[r.closestPoint][0]},${n.points[r.closestPoint][1]}`}):null,!r.transitioning&&(r.actionIntentType==="add-open-point"||r.actionIntentType==="close-shape"||r.actionIntentType==="close-shape-line")?y("polyline",{stroke:"#000",ref:S,strokeWidth:r.actionIntentType==="close-shape"?2:1,vectorEffect:"non-scaling-stroke"}):null,r.hasClosestLine&&(!r.transitionIntentType||r.transitionIntentType==="split-line")?y("g",{ref:f,children:y("polyline",{style:{opacity:.5},markerStart:"url(#dot)",points:"0,0 10,10",vectorEffect:"non-scaling-stroke",fill:"transparent",strokeWidth:2})}):null,r.transitioning?y(_,{ref:v,fill:n.open?"none":"rgba(255, 0, 0, .5)",stroke:"rgba(255, 0, 0, .5)",strokeWidth:n.open?2:0}):null,r.transitioning&&r.transitionIntentType==="select-multiple-points"?y("rect",{ref:c,fill:"rgba(255, 255, 255, .3)",strokeWidth:1,stroke:"rgba(0,0,0,.2)",vectorEffect:"non-scaling-stroke"}):null,r.showBoundingBox?null:y("g",{name:"controls",children:!1}),r.showBoundingBox&&!K?y("polygon",{ref:s,strokeWidth:2,stroke:"#FF0DCB",fill:"none",markerStart:"url(#resizer)",markerMid:"url(#resizer)",markerEnd:"url(#resizer)",vectorEffect:"non-scaling-stroke"}):null]}):null;return{helper:x,state:r,isAddingPoint:Be,isSplitting:Le,isStamping:K,isHoveringPoint:j,transitionDirection:C,transitionRotate:m,defs:b,editor:He}}import{useEffect as Z}from"react";import{createPortal as vt}from"react-dom";import{Fragment as Te,jsx as H,jsxs as X}from"react/jsx-runtime";var St=[{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 we(e){let t=e.theme||St[0],o=yt(),{image:n}=e,{helper:i,defs:a,editor:s,state:l,transitionDirection:c,isSplitting:f,transitionRotate:u,isHoveringPoint:v,isAddingPoint:S,isStamping:h}=Pe({currentShape:e.shape||null,onChange:e.updateShape,image:e.image,hideShapeLines:!0},[]),C=r=>{i.pointer([[~~r.atlas.x,~~r.atlas.y]])};Z(()=>{let r=b=>{i.key.up(b.key)};return document.addEventListener("keyup",r),()=>{document.removeEventListener("keyup",r)}},[]),Z(()=>{let r=b=>{i.key.down(b.key)};return document.addEventListener("keydown",r),()=>{document.removeEventListener("keydown",r)}},[]),Z(()=>{let r=[];return c&&r.push(`atlas-cursor-${c}`),l.actionIntentType==="cut-line"&&l.modifiers?.Shift&&r.push("atlas-cursor-cut"),(v||l.transitionIntentType==="move-shape"||l.transitionIntentType==="move-point")&&r.push("atlas-cursor-move"),S&&r.push("atlas-cursor-crosshair"),f&&r.push("atlas-cursor-copy"),u&&r.push("atlas-cursor-rotate"),l.transitionIntentType==="draw-shape"&&r.push("atlas-cursor-draw"),o?.canvas&&o.canvas.classList.add(...r),()=>{o?.canvas&&o.canvas.classList.remove(...r)}},[o?.canvas,S,v,f,l.modifiers?.Shift,l.actionIntentType,l.transitionIntentType,c,u]);let g=e.shape&&e.shape?.points.length===0,m=e.renderControls?e.renderControls(i,l,g):null,d=document.getElementById(e.controlsHtmlId||"atlas-controls"),x="shape";return H(Te,{children:X("world-object",{height:n.height,width:n.width,onMouseMove:C,onMouseDown:i.pointerDown,onMouseUp:i.pointerUp,onMouseLeave:i.blur,children:[e.shape?X(Te,{children:[H(x,{open:e.shape.open,points:e.shape.points,relativeStyle:!0,style:h?{}:t.outer}),H(x,{open:e.shape.open,points:e.shape.points,relativeStyle:!0,style:h?{}:t.inner})]}):null,X(ht,{relative:!0,interactive:!1,children:[H("div",{style:{position:"absolute",top:0,right:0,left:0,bottom:0},children:X("svg",{width:"100%",height:"100%",viewBox:`0 0 ${n.width} ${n.height}`,tabIndex:-1,children:[H("defs",{children:a}),s]})}),d?vt(m,d,"controls"):null]})]})})}import{jsx as Re}from"react/jsx-runtime";function jr(e){let t=T(),o=e.annotationBucket,n=e.readOnly,i=e.id,{onClick:a,isHighlighted:s}=he(e.id),l=Se(),c=s?l.highlighted:l[o||"hidden"]||l.hidden;if(!t)return null;if(n){let f="shape",u=e.polygon,v=u.open;return u?Re(f,{id:`shape-${i}`,points:u.points,open:v,onClick:a,relativeStyle:!0,target:{x:0,y:0,width:t.width,height:t.height},style:c}):null}return Re(we,{image:t,shape:e.polygon||{id:e.id,open:!0,points:[]},updateShape:e.updatePolygon,theme:e.theme,controlsHtmlId:e.controlsHtmlId,renderControls:e.renderControls})}import{jsx as xt}from"react/jsx-runtime";function ni({annotation:e,children:t}){return xt(B,{value:{annotation:e},children:t})}import{jsx as bt}from"react/jsx-runtime";function si({annotationPage:e,children:t}){return bt(B,{value:{annotationPage:e},children:t})}import{jsx as It}from"react/jsx-runtime";function ui({collection:e,children:t}){return It(B,{value:{collection:e},children:t})}function pi(e,t={}){return D(t)}function yi(e,t=!1){}function bi(e){let o=z().manifest,n=e?e.map(i=>typeof i=="string"?i:i?.id):[];return A(i=>{let a=o?i.iiif.entities.Manifest[o]:void 0,s=a?.items||[];if(typeof e>"u")return s;let l=[];for(let c of a?.items||[])n.indexOf(c.id)!==-1&&l.push(c);return l},[n.join("/")])}import{useMemo as Ct}from"react";function Ti(e,t=[]){let{id:o,selector:n}=e,i=z(),a=o||i.collection,s=A(l=>a?l.iiif.entities.Collection[a]:void 0,[a]);return Ct(()=>{if(s)return n?n(s):s},[s,n,...t])}import{useEffect as kt,useMemo as Pt}from"react";import{createEventsHelper as Tt}from"@iiif/helpers/events";function Ni(e,t,o,n,i=[]){let a=P(),s=Pt(()=>Tt(a),[a]);kt(()=>{let l=e;return l?(s.addEventListener(l,t,o,n),()=>{s.removeEventListener(l,t,o)}):()=>{}},[s,e,t,...i])}function zi(e,t){let{id:o,isLoaded:n,error:i,resource:a,requestId:s,cached:l}=ee(e,t);return{id:o,isLoaded:n,error:i,manifest:a,requestId:s,cached:l}}import{getImageServices as Ee}from"@atlas-viewer/iiif-image-api";import{useEffect as wt,useMemo as Me,useState as Y}from"react";function Ne({cacheKey:e}={}){let t=T(),o=D(),n=P(),i=W(),[a,s]=Y(void 0),[l,c]=Y(!1),[f,u]=Y("idle"),[v,S]=Y(void 0),h=t?t.id:"undefined",C=Me(()=>{try{if(t&&o.length){let m=o[0],d=n.get(m.body[0]),r=Ee(d)[0];return r&&i.loadServiceSync({id:r.id||r["@id"],width:r.width||t.width,height:r.height||t.height})||void 0}}catch(m){console.error(m)}},[h,e,t]),g=f==="success"&&a?a:C;return wt(()=>{(async()=>{try{if(t&&o.length){let m=o[0],d=n.get(m.body[0]),r=Ee(d)[0];if(!r)return;c(!0),u("loading");try{let b=await i.loadService({id:r.id||r["@id"],width:r.width||t.width,height:r.height||t.height})||void 0;s(b),u("success"),c(!1)}catch(b){u("error"),S(b)}}}catch(m){u("error"),S(m)}})()},[h,e]),Me(()=>({data:g,isFetching:l,status:f,error:v}),[g,l,f,v])}function Yi(){let e=Ne();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 Rt}from"@iiif/helpers/styles";import{useMemo as Et}from"react";function Gi(){let e=P();return Et(()=>Rt(e),[e])}export*from"@iiif/helpers/annotation-targets";export{ni as AnnotationContext,si as AnnotationPageContext,kr as AnnotationStyleProvider,vo as Auth,no as AuthProvider,ro as AuthProvider_Old,eo as AuthRContext,to as AuthReactContext,oo as AuthReactContextActions,Sn as CanvasAnnotations,te as CanvasContext,ae as CanvasPanel,ui as CollectionContext,Bn as CombinedMetadata,ko as ContextBridge,we as CreateCustomShape,Ue as Image,Jo as ImageServiceLoaderContext,bo as InnerViewerProvider,Ao as LanguageProvider,Do as LanguageString,N as LocaleString,qt as ManifestContext,Qn as ManifestMetadata,fn as MediaPlayerProvider,O as Metadata,jr as PolygonSelector,Ft as RangeContext,Lt as ReactVaultContext,mr as RenderSvgEditorControls,B as ResourceProvider,Bt as ResourceReactContext,vr as SelectorControllerProvider,sr as SequenceThumbnails,Io as SimpleViewerProvider,xo as SimpleViewerReactContext,ce as SingleCanvasThumbnail,zo as TranslationProvider,Ht as VaultProvider,Eo as ViewerPresetContext,Ro as VirtualAnnotationProvider,Wt as VisibleCanvasReactContext,Jt as authDetailsForResource,Ut as createAuthStateStore,Gt as createProbe,Yo as emptyActions,Qo as emptyStrategy,$t as findAllCanvasesInRange,Ot as findFirstCanvasFromRange,Vt as findManifestSelectedRange,Xt as findSelectedRange,Uo as flattenAnnotationPageIds,ln as formatTime,en as get3dStrategy,ve as getDefaultAnnotationStyles,tn as getImageStrategy,_t as getManifestSequence,Xo as getParsedTargetSelector,rn as getRenderingStrategy,on as getTextualContentStrategy,nn as getVideoStrategy,Yt as getVisibleCanvasesFromCanvasId,Qt as hasAuth,jt as makeAccessServiceRequest,Zt as makeAccessTokenRequest,Vo as parseSpecificResource,St as svgThemes,_o as unknownResponse,Ko as unsupportedStrategy,Lo as useAnnotation,Ho as useAnnotationPage,re as useAnnotationPageManager,Se as useAnnotationStyles,pi as useAnnotationsAtTime,so as useAuthActions,yo as useAuthActions_old,co as useAuthService,go as useAuthService_old,ao as useAuthStore,uo as useAuthToken,ho as useAuthToken_old,mo as useAuthTokens,po as useAuthTokens_old,T as useCanvas,yi as useCanvasClock,Kt as useCanvasSequence,bi as useCanvasSubset,Fo as useClosestLanguage,Ti as useCollection,Co as useContextBridge,$o as useCreateLocaleString,lo as useCurrentAuth,fo as useCurrentAuth_old,Po as useDispatch,Ni as useEventListener,zt as useExistingVault,zi as useExternalCollection,At as useExternalManifest,ee as useExternalResource,qo as useIIIFLanguage,Q as useImage,Ne as useImageService,W as useImageServiceLoader,Yi as useImageTile,io as useIsAuthEnabled,Zo as useLoadImageService,Oo as useLocaleString,q as useManifest,un as useMediaActions,dn as useMediaElements,mn as useMediaState,jo as usePaintables,D as usePaintingAnnotations,xe as usePolygonHelper,oe as useRange,an as useRenderingStrategy,z as useResourceContext,No as useResourceEvents,Go as useResources,So as useSearchService,ye as useSelectorController,Sr as useSelectorEmitter,he as useSelectorEvents,xr as useSelectorHelper,cn as useSimpleMediaPlayer,ne as useSimpleViewer,Gi as useStyleHelper,Bo as useStyles,Pe as useSvgEditor,ie as useThumbnail,Wo as useTranslations,P as useVault,sn as useVaultEffect,A as useVaultSelector,Mo as useViewerPreset,To as useVirtualAnnotationPage,wo as useVirtualAnnotationPageContext,Dt as useVisibleCanvases};
|
package/dist/utils.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var f=Object.defineProperty;var
|
|
1
|
+
"use strict";var f=Object.defineProperty;var N=Object.getOwnPropertyDescriptor;var z=Object.getOwnPropertyNames;var O=Object.prototype.hasOwnProperty;var B=(e,t)=>{for(var o in t)f(e,o,{get:t[o],enumerable:!0})},D=(e,t,o,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of z(t))!O.call(e,r)&&r!==o&&f(e,r,{get:()=>t[r],enumerable:!(i=N(t,r))||i.enumerable});return e};var A=e=>D(f({},"__esModule",{value:!0}),e);var V={};B(V,{emptyActions:()=>k,emptyStrategy:()=>y,getParsedTargetSelector:()=>c,getRenderingStrategy:()=>M,parseSpecificResource:()=>W,unknownResponse:()=>l,unsupportedStrategy:()=>n});module.exports=A(V);var x=require("@iiif/helpers");function W(e){return e.type==="SpecificResource"?[e.source,{selector:e.selector}]:[e,{selector:null}]}function c(e,t){let{selector:o,source:i}=(0,x.expandTarget)(t);if(i.id!==e.id)return[null,i];let r={type:"BoxSelector",spatial:{x:0,y:0,width:Number(e.width),height:Number(e.height)}};return[o?o.type==="TemporalSelector"?{type:"TemporalBoxSelector",temporal:o.temporal,spatial:r.spatial}:o:null,i]}var k={makeChoice:()=>{}},l={type:"unknown"},n=e=>({type:"unknown",reason:e,annotations:{pages:[]}}),y=(e,t)=>({type:"empty",width:e,height:t,annotations:{pages:[]},image:null,images:[]});var U=["model/gltf-binary"];function T(e,t){let i=t.items[0].resource;return i.format?U.indexOf(i.format)===-1?n(`3D format: ${i.format} is unsupported`):{type:"3d-model",model:i}:n("Unknown format")}function I(e,t){if(!e.duration)return n("No duration on canvas");if(t.items.length>1)return n("Only one audio source supported");let o=t.items[0]?.resource;return o?o.format?{type:"media",media:{annotationId:t.items[0].annotationId,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:[]}}:n("Audio does not have format"):n("Unknown audio")}var C=require("@atlas-viewer/iiif-image-api");var S=require("@iiif/helpers/annotation-targets");function R(e,t,o){let i=[];for(let r of t.items){let a=r.resource&&r.resource.type==="SpecificResource"?r.resource.source:r.resource;if(!a.id)return n("No resource Identifier");let s;if(a.service){let u=(0,C.getImageServices)(a);u[0]&&(s=o(u[0],e))}let p={type:"BoxSelector",spatial:{x:0,y:0,width:Number(e.width),height:Number(e.height)}},[d,h]=c(e,r.target);if(!(h.id===e.id||decodeURIComponent(h.id||"")===(e.id||"")))continue;let L=r.resource.width&&r.resource.height?{type:"BoxSelector",spatial:{x:0,y:0,width:r.resource.width,height:r.resource.height}}:void 0,m=r.resource.type==="SpecificResource"?(0,S.expandTarget)(r.resource):null;if(r.selector){let u=(0,S.expandTarget)({type:"SpecificResource",source:r.resource,selector:r.selector});u&&(m=u)}let g=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;s&&!s.id&&(s.id=s["@id"]);let b={id:a.id,type:"Image",annotationId:r.annotationId,width:Number(d||g?a.width:e.width),height:Number(d||g?a.height:e.height),service:s,sizes:s&&s.sizes?s.sizes:a.width&&a.height?[{width:a.width,height:a.height}]:[],target:d&&d.type!=="PointSelector"?d:p,selector:g};i.push(b)}return{type:"images",image:i[0],images:i,choice:t.choice}}function v(e,t={},o){let i=e.language||o||"none";switch(e.type){case"TextualBody":{typeof e.value<"u"&&(t[i]=e.value);break}case"List":case"Composite":case"Choice":e.items&&e.items.forEach(r=>v(r,t,i))}return t}function w(e,t){let o=[];return t.items.forEach(i=>{if(i.resource){let[r]=c(e,i.target);o.push({annotationId:i.annotationId,text:v(i.resource),target:r})}}),{type:"textual-content",items:o}}var E=/^.*(?:(?:youtu\.be\/|v\/|vi\/|u\/\w\/|embed\/|shorts\/)|(?:(?:watch)?\?vi?=|&vi?=))([^#&?]*).*/;function P(e,t){let o=t.items.filter(p=>p.type==="video"),i=!1;if(e.duration||(i=!0),o.length>1)return n("Only one video source supported");let r=o[0]?.resource,a=!!(r.service||[]).find(p=>(p.profile||"").includes("youtube.com"));if(!a&&i)return n("Video does not have duration");if(!r)return n("Unknown video");if((!r.format||r.format==="text/html")&&!a)return n("Video does not have format");let s={annotationId:t.items[0].annotationId,duration:e.duration,url:r.id,type:"Video",items:[],target:{type:"TemporalSelector",temporal:{startTime:0,endTime:e.duration}},format:r.format,selector:{type:"TemporalSelector",temporal:{startTime:0,endTime:e.duration}}};if(a){s.type="VideoYouTube";let p=r.id.match(E);if(!p[1])return n("Video is not known youtube video");s.youTubeId=p[1]}return{type:"media",media:s,annotations:{pages:[]}}}function M({canvas:e,paintables:t,supports:o,loadImageService:i}){if(!e)return l;if(t.types.length===0)return o.indexOf("empty")!==-1?y(e.width,e.height):l;if(t.types.length!==1)if(t.types.length===2&&t.types.indexOf("text")!==-1)t.types=t.types.filter(a=>a!=="text");else return o.indexOf("complex-timeline")===-1?n("Complex timeline not supported"):n("ComplexTimelineStrategy not yet supported");let r=t.types[0];return r==="image"?o.indexOf("images")===-1?n("Image not supported"):R(e,t,i):r==="Model"||r==="model"?o.indexOf("3d-model")===-1?n("3D not supported"):T(e,t):r==="textualbody"?o.indexOf("textual-content")===-1?n("Textual content not supported"):w(e,t):r==="sound"||r==="audio"?o.indexOf("media")===-1?n("Media not supported"):I(e,t):r==="video"?o.indexOf("media")===-1?n("Media not supported"):P(e,t):l}
|
package/dist/utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as o,b as r,c as e,d as f,e as m,f as p,k as t}from"./chunk-
|
|
1
|
+
import{a as o,b as r,c as e,d as f,e as m,f as p,k as t}from"./chunk-DXFXJCXN.js";export{e as emptyActions,p as emptyStrategy,r as getParsedTargetSelector,t as getRenderingStrategy,o as parseSpecificResource,f as unknownResponse,m as unsupportedStrategy};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-iiif-vault",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -65,6 +65,8 @@
|
|
|
65
65
|
"@iiif/presentation-2": "^1.0.4",
|
|
66
66
|
"@iiif/presentation-3": "^2.2.2",
|
|
67
67
|
"@iiif/presentation-3-normalized": "^0.9.7",
|
|
68
|
+
"mitt": "^3.0.1",
|
|
69
|
+
"polygon-editor": "^0.0.4",
|
|
68
70
|
"react-error-boundary": "^4.0.13",
|
|
69
71
|
"react-lazy-load-image-component": "^1.6.0",
|
|
70
72
|
"react-reconciler": "~0.29.0",
|
|
@@ -75,7 +77,7 @@
|
|
|
75
77
|
"react-dom": "^18.2.0"
|
|
76
78
|
},
|
|
77
79
|
"devDependencies": {
|
|
78
|
-
"@testing-library/react": "^
|
|
80
|
+
"@testing-library/react": "^15.0.2",
|
|
79
81
|
"@types/react": "^18.2.75",
|
|
80
82
|
"@types/react-dom": "^18.2.24",
|
|
81
83
|
"@types/react-lazy-load-image-component": "^1.6.3",
|
|
@@ -88,7 +90,7 @@
|
|
|
88
90
|
"query-string": "^9.0.0",
|
|
89
91
|
"tslib": "^2.6.2",
|
|
90
92
|
"tsup": "^8.0.2",
|
|
91
|
-
"typescript": "^5.4.
|
|
93
|
+
"typescript": "^5.4.5",
|
|
92
94
|
"vite": "^5.2.8",
|
|
93
95
|
"vitest": "^1.4.0"
|
|
94
96
|
},
|