react-iiif-vault 2.0.5 → 2.0.6
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 +2 -1
- package/dist/bundle.global.js +24 -24
- package/dist/canvas-panel.cjs +6 -6
- 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-FBET7GLW.js +1 -0
- package/dist/{chunk-SNWQWQTN.js → chunk-MUASBCAU.js} +1 -1
- package/dist/{index-Btmqi4an.d.cts → index-Bxw5USbW.d.cts} +1 -1
- package/dist/{index-Cxmpcndt.d.ts → index-kvJxjxZG.d.ts} +1 -1
- package/dist/index.cjs +8 -8
- package/dist/index.d.cts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +1 -1
- package/dist/{useRenderingStrategy-CHg8UC3-.d.cts → useRenderingStrategy-Bg8-k9-n.d.cts} +1 -0
- package/dist/{useRenderingStrategy-CHg8UC3-.d.ts → useRenderingStrategy-Bg8-k9-n.d.ts} +1 -0
- package/dist/{utils-B4O1xptf.d.ts → utils-CHozUicY.d.ts} +1 -1
- package/dist/{utils-C0dpk-mp.d.cts → utils-CMAqRpk_.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 +1 -1
- package/dist/chunk-223VJXTE.js +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
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-Bxw5USbW.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-Bxw5USbW.cjs';
|
|
4
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
5
|
import { BoxStyle, AtlasProps, Preset } from '@atlas-viewer/atlas';
|
|
6
6
|
import * as React$1 from 'react';
|
|
7
7
|
import React__default, { ReactNode, FunctionComponent, RefObject, Context } from 'react';
|
|
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-
|
|
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-
|
|
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-Bg8-k9-n.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-Bg8-k9-n.cjs';
|
|
10
10
|
import * as _iiif_helpers from '@iiif/helpers';
|
|
11
11
|
import { ChoiceDescription, Paintables, ComplexChoice, SupportedSelector, SvgSelector, BoxSelector } from '@iiif/helpers';
|
|
12
12
|
import * as polygon_editor from 'polygon-editor';
|
|
@@ -22,8 +22,8 @@ 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-CMAqRpk_.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-CMAqRpk_.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';
|
|
@@ -837,7 +837,7 @@ declare function useVisibleCanvases(): CanvasNormalized[];
|
|
|
837
837
|
|
|
838
838
|
declare function getComplexTimelineStrategy(canvas: CanvasNormalized, paintables: Paintables, loadImageService: ImageServiceLoaderType, vault: CompatVault): ComplexTimelineStrategy;
|
|
839
839
|
|
|
840
|
-
declare function getVideoStrategy(canvas: CanvasNormalized, paintables: Paintables, vault: CompatVault): UnknownStrategy | MediaStrategy;
|
|
840
|
+
declare function getVideoStrategy(canvas: CanvasNormalized, paintables: Paintables, vault: CompatVault, enforceSpatial?: boolean): UnknownStrategy | MediaStrategy;
|
|
841
841
|
|
|
842
842
|
declare function useAnnotation(options?: {
|
|
843
843
|
id: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
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-kvJxjxZG.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-kvJxjxZG.js';
|
|
4
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
5
|
import { BoxStyle, AtlasProps, Preset } from '@atlas-viewer/atlas';
|
|
6
6
|
import * as React$1 from 'react';
|
|
7
7
|
import React__default, { ReactNode, FunctionComponent, RefObject, Context } from 'react';
|
|
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-
|
|
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-
|
|
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-Bg8-k9-n.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-Bg8-k9-n.js';
|
|
10
10
|
import * as _iiif_helpers from '@iiif/helpers';
|
|
11
11
|
import { ChoiceDescription, Paintables, ComplexChoice, SupportedSelector, SvgSelector, BoxSelector } from '@iiif/helpers';
|
|
12
12
|
import * as polygon_editor from 'polygon-editor';
|
|
@@ -22,8 +22,8 @@ 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-CHozUicY.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-CHozUicY.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';
|
|
@@ -837,7 +837,7 @@ declare function useVisibleCanvases(): CanvasNormalized[];
|
|
|
837
837
|
|
|
838
838
|
declare function getComplexTimelineStrategy(canvas: CanvasNormalized, paintables: Paintables, loadImageService: ImageServiceLoaderType, vault: CompatVault): ComplexTimelineStrategy;
|
|
839
839
|
|
|
840
|
-
declare function getVideoStrategy(canvas: CanvasNormalized, paintables: Paintables, vault: CompatVault): UnknownStrategy | MediaStrategy;
|
|
840
|
+
declare function getVideoStrategy(canvas: CanvasNormalized, paintables: Paintables, vault: CompatVault, enforceSpatial?: boolean): UnknownStrategy | MediaStrategy;
|
|
841
841
|
|
|
842
842
|
declare function useAnnotation(options?: {
|
|
843
843
|
id: string;
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
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 de,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 Se,L as So,La as mr,Lb as ln,M as bo,Ma as ur,Mb as be,N as Io,Na as fr,Nb as A,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 pe,Sb as Ce,T as To,Ta as ge,Tb as Re,U as se,Ua as yr,Ub as Pe,V as No,Va as vr,W as Eo,Wa as xr,X as Ao,Xa as Sr,Y as W,Ya as he,Z as le,Za as ye,_ as ce,_a as br,a as _t,aa as Mo,ab as Cr,b as B,ba as Ho,bb as Rr,c as E,ca as me,cb as Pr,d as re,da as ue,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 O,ha as Bo,hb as Er,i as Xt,ia as Oo,ib as N,j as ne,ja as Fo,jb as ve,k as Yt,ka as fe,kb as Ar,l as F,la as Wo,lb as kr,m as ie,ma as Do,mb as G,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 ae,wa as Go,wb as Vr,x as io,xa as Jo,xb as xe,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 Ie}from"./chunk-223VJXTE.js";export*from"@iiif/helpers/annotation-targets";import{useEffect as Xe}from"react";import{useCallback as we,useEffect as Qe,useRef as Ue,useState as D}from"react";import{useStore as k}from"zustand";function qe(e){let[t,o]=D(0),r=P(),n=k(r,d=>d.tool.enabled),i=k(r,d=>d.tool.requestId),a=k(r,d=>d.getRequestId),s=k(r,d=>d.requestAnnotation),f=k(r,d=>d.completeRequest),m=k(r,d=>d.cancelRequest),l=Ue(e?.onSuccess);l.current=e?.onSuccess;let[h,S]=D(!1),[b,x]=D(null),[p,v]=D(null),u=n&&i!==p,g=n&&i===p,c=we(async(d,q)=>{if(p){let M=l.current;S(!0);let L=await s(d,{...q,requestId:p});if(L)return M?.(L),o(Y=>Y+1),S(!1),x(L),L;let X={id:p,cancelled:!0,...ue(d)};return M?.(X),x(X),o(Y=>Y+1),S(!1),X}return null},[s,p]),y=we(()=>{x(null),S(!1)},[]);return Qe(()=>{let d=a();return v(d.requestId),()=>{d.clear()}},[t]),{id:t,busy:u,isPending:h,isActive:g,requestId:p,requestAnnotation:c,cancelRequest:()=>p?m(p):void 0,completeRequest:()=>p?f(p):void 0,reset:y,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 Te(e){let{id:t,data:o,requestAnnotation:r,cancelRequest:n,isPending:i}=qe({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 Ne,useContext as Ae,useEffect as Ee,useMemo as J,useState as Ge}from"react";import ke from"mitt";import{jsx as Je}from"react/jsx-runtime";var V=Ye(ke());V.displayName="SelectorHelper";function kn({children:e}){return Je(V.Provider,{value:J(()=>ke(),[]),children:e})}function Mn(){return Ae(V)}function Me(e){let t=He(),[o,r]=Ge(!1);Ee(()=>t.withSelector(e).on("highlight",()=>{r(!0)}),[t,e]),Ee(()=>t.withSelector(e).on("clear-highlight",()=>{r(!1)}),[t,e]);let n=Ne(a=>{t.emit("click",{selectorId:e,event:a})},[e,t]),i=Ne(a=>{t.emit("hover",{selectorId:e,event:a})},[e,t]);return{controller:t,onClick:n,onHover:i,isHighlighted:o}}function He(){let e=Ae(V);return J(()=>({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=He();return J(()=>({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 ze}from"react/jsx-runtime";function $n(e){let t=w(),o=e.annotationBucket,r=e.readOnly,n=e.id,{onClick:i,isHighlighted:a}=Me(e.id),s=fe(),f=a?s.highlighted:s[o||"hidden"]||s.hidden;if(!t)return null;if(r){let m="shape",l=e.polygon,h=l.open;return l?ze(m,{id:`shape-${n}`,points:l.points,open:h,onClick:i,relativeStyle:!0,target:{x:0,y:0,width:t.width,height:t.height},style:f}):null}return ze(Te,{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 Le}from"react/jsx-runtime";var Jn=je(function({canvasId:t},o){let r=Ze(),n=Se(t||r?.id),i=R();return et(o,()=>n,[t,r]),!r||n.enabledPageIds.length===0?null:Le(tt,{children:n.enabledPageIds.map(a=>Le(Pe.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 $}from"react/jsx-runtime";function K({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:h,tableHeader:S,customLabelRender:b,customValueRender:x}){let p=ot(()=>{let u=(t||[]).reduce((c,y)=>[...c,...y.keys],[]),g={};for(let c of e){let y=c?.label?Object.values(c.label):[];for(let d of y)if(d?.length&&(u.indexOf(`metadata.${d[0]}`)!==-1||u.length===0)&&c){let q=`metadata.${d[0]}`;g[q]=g[q]?g[q]:[],g[q].push(c);break}}return g},[t,e]);return Object.keys(p).length===0&&r?I(rt,{children:i})||I("div",{className:a.empty,children:s}):t?.length?$("table",{className:a.container,children:[S,I("tbody",{children:t.map((u,g)=>{let c=[];for(let d of u.keys)for(let q of p[d]||[]){let M=I(N,{enableDangerouslySetInnerHTML:n,defaultText:f,separator:l,children:q.value},g+"__"+d);x?c.push(x(q,M)):c.push(M)}if(c.length===0)return null;let y=I(N,{enableDangerouslySetInnerHTML:n,separator:l,defaultText:m,children:u.label});return $("tr",{className:a.row,children:[I("td",{className:a.label,style:o?{minWidth:o}:{},children:b?b(u.label,y):y}),I("td",{className:a.value,children:c})]},g)})}),h]}):$("table",{className:a.container,children:[S,I("tbody",{children:e?.length?e.map((u,g)=>{if(!u)return null;let c=I(N,{enableDangerouslySetInnerHTML:n,defaultText:f,separator:l,children:u.label}),y=I(N,{enableDangerouslySetInnerHTML:n,defaultText:f,separator:l,children:u.value});return $("tr",{className:a.row,children:[I("td",{className:a.label,style:o?{minWidth:o}:{},children:b?b(u.label,c):c}),I("td",{className:a.value,children:x?x(u,y):y})]},g)}):null}),h]})}import{jsx as it}from"react/jsx-runtime";function mi(e){let t=F(),o=w(),r=ae(),n=nt(()=>{let i=t?.metadata||[],a=o?.metadata||[],s=r?.metadata||[];return[...i,...a,...s]},[t,o,r]);return it(K,{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 Z(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=pe(),[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=Z(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=Z(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 H,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[h,S]=pt(),b=t||Ce,[x,p]=be(),v=dt(()=>{let g=p[e]?.status,c=x({id:e},{});return c?.height&&c.width&&g!=="loading"?{id:e,width:c.width,height:c.height,service:c,type:"Image",selector:{type:"BoxSelector",spatial:{x:0,y:0,width:c.width,height:c.height}},target:{type:"BoxSelector",spatial:{x:0,y:0,width:c.width,height:c.height}}}:null},[x,e,p]);if(!v||!v.height||!v.width)return null;let u=s?void 0:l.homePosition?l.homePosition.width/l.homePosition.height:v.width/v.height;return H(gt,{resetKeys:[],fallbackRender:g=>H(b,{...l,...g}),children:H(Re,{...l,aspectRatio:u,containerProps:{style:{position:"relative"},...l.containerProps||{}},onCreated:g=>{S(g),l.onCreated&&l.onCreated(g)},children:yt(G.Provider,{value:h,children:[H(ve,{image:v,id:v.id,isStatic:!o,x:f,y:m},v.id),H(ht,{viewerPreset:h,renderViewerControls:i,image:v,src:e,viewControlsDeps:a}),n]})})})}function ht({viewerPreset:e,renderViewerControls:t,image:o,src:r,viewControlsDeps:n}){return de(e&&t?"overlay":"none",`canvas-portal-controls-${r}`,G.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=F();return vt(K,{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 Be,jsx as T,jsxs as It}from"react/jsx-runtime";var{LazyLoadComponent:St}=j||j.default;function Oe(e){let{size:t,visible:o,classes:r,canvasId:n,figure:i}=e,a=t?.width||128,s=t?.height||t?.width||128,f=T(bt,{...e}),m=T(St,{threshold:300,style:{height:s,width:a},visibleByDefault:o,children:n?T(re,{canvas:n,children:f}):f});return i?T("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=ge({width:s,height:f,allowUnsafe:!0},i);return!l||l.type!=="fixed"?T(Be,{children:e}):It(Be,{children:[T("div",{className:o?.imageWrapper,children:T("img",{className:o?.img,src:l.id,alt:m})}),r?T(N,{as:"figcaption",className:o?.label,children:a?.label}):null]})}import{jsx as z}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:h,setSequenceIndex:S}=se(),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 p=f.current.querySelector("[data-selected=true]");p&&p.scrollIntoView({behavior:e||"instant",block:"nearest",inline:"center"})},[h]);let x=[];for(let p of l){let v=[],u=l[h]===p;for(let g of p){let c=m[g];v.push(z("div",{className:u?b.item:n.item,children:z(Oe,{classes:u?b:n,canvasId:c.id,size:r,dereference:t,showLabel:i,figure:a,placeholder:z("div",{style:{height:128,width:128}}),fallback:s})},g))}if(o){x.push(v);continue}x.push(z("div",{onClick:g=>{S(l.indexOf(p))},"data-selected":u,className:u?b.row:n.row,children:v},p.join("-")))}return z("div",{ref:f,className:n.container,children:x})}import{useStore as Q}from"zustand";function Fe(){let e=P(),t=Q(e,i=>i.completeRequest),o=Q(e,i=>i.polygonState.currentTool),r=Q(e,i=>i.polygonState.selectedStamp),n=Q(e,i=>i.switchTool);return{completeRequest:t,currentTool:o,selectedStamp:r,switchTool:n}}import{Fragment as We,jsx as C,jsxs as De}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}=Fe();return De(We,{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?De(We,{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(E,{value:{annotation:e},children:t})}import{jsx as qt}from"react/jsx-runtime";function ua({annotationPage:e,children:t}){return qt(E,{value:{annotationPage:e},children:t})}import{jsx as Tt}from"react/jsx-runtime";function ga({collection:e,children:t}){return Tt(E,{value:{collection:e},children:t})}function xa(e,t={}){return A(t)}import{useCanvas as Nt}from"@atlas-viewer/atlas";import{useEffect as Et,useMemo as ee,useState as At}from"react";function Pa({canvasId:e}={}){let t=Nt(),o=ne(),r=ee(()=>e?[e]:t?[t.id]:o.map(m=>m.id),[e,t,o]),[n,i]=At({}),a=xe();Et(()=>{let m=l=>{let h=l.partOf.canvasId;h&&i(S=>({...S,[h]:l.choice}))};return a.on("choice-change",m),()=>{a.off("choice-change",m)}},[]);let s=ee(()=>{let m=[];for(let l of r){let h=n[l];h&&m.push({canvasId:l,choice:h})}return m},[r,n]),f=ee(()=>({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=B().manifest,r=e?e.map(n=>typeof n=="string"?n:n?.id):[];return O(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=B(),i=o||n.collection,a=O(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 Ve}from"zustand";function Da(){let e=P(),t=Ve(e,r=>r.completeRequest),o=Ve(e,r=>r.cancelRequest);return Ht(()=>({saveAnnotation:()=>{Mt(()=>{t()})},cancelRequest:o}),[t,o])}import{useCallback as zt}from"react";import{useStore as te}from"zustand";function Qa({requestId:e}={}){let t=P(),o=te(t,s=>s.metadata),r=te(t,s=>s.tool.requestId),n=e||r,i=te(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);W("polygons.start-transition",r=>{e.requestId&&o!==e.requestId||e?.onStart?.(r.transitionIntent)},[o,e.requestId]),W("polygons.end-transition",r=>{e.requestId&&o!==e.requestId||e?.onEnd?.(r.transitionIntent,r.response)},[o,e.requestId]),W("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}=ie(e,t);return{id:o,isLoaded:r,error:n,manifest:i,requestId:a,cached:s}}import{getImageServices as $e}from"@iiif/parser/image-3";import{useEffect as Wt,useMemo as Ke,useState as U}from"react";function _e({cacheKey:e}={}){let t=w(),o=A(),r=R(),n=he(),i=ye(),[a,s]=U(void 0),[f,m]=U(!1),[l,h]=U("idle"),[S,b]=U(void 0),x=t?t.id:"undefined",p=Ke(()=>{try{if(t&&o.length){let u=o[0],g=r.get(u.body[0]),y=$e(g)[0];return y&&n(y,{width:y.width||t.width,height:y.height||t.height},!0)||void 0}}catch(u){console.error(u)}},[x,e,t]),v=l==="success"&&a?a:p;return Wt(()=>{(async()=>{try{if(t&&o.length){let u=o[0],g=r.get(u.body[0]),y=$e(g)[0];if(!y)return;m(!0),h("loading");try{let d=await i(y,{width:y.width||t.width,height:y.height||t.height})||void 0;s(d),h("success"),m(!1)}catch(d){h("error"),b(d)}}}catch(u){h("error"),b(u)}})()},[x,e]),Ke(()=>({data:v,isFetching:f,status:l,error:S}),[v,f,l,S])}function hs(){let e=_e();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 oe}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=A(),n=oe(()=>Dt(t),[t]),i=oe(()=>n.getPaintables(r),[n,r]);return oe(()=>Ie({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||ce(e.polygon);if(e.polygon&&!le(e.polygon.points)){let r=e.target||me(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,re as CanvasContext,Pe as CanvasPanel,hn as CanvasStrategyProvider,yn as CanvasWorldObject,ga as CollectionContext,mi as CombinedMetadata,xr as ComplexTimelineProvider,Xr as ContextBridge,sr as ControlsReactContext,Te 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,N as LocaleString,Jt as ManifestContext,Bi as ManifestMetadata,er as MediaPlayerProvider,K 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,E as ResourceProvider,_t as ResourceReactContext,kn as SelectorControllerProvider,Gi as SequenceThumbnails,To as SimpleViewerProvider,wo as SimpleViewerReactContext,Oe as SingleCanvasThumbnail,nr as StrategyReactContext,yr as ThumbnailFallbackImage,br as TranslationProvider,Cr as TransliterationProvider,Ut as VaultProvider,G 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,Ie as getRenderingStrategy,fn as getTextualContentStrategy,dn as getVideoStrategy,ro as getVisibleCanvasesFromCanvasId,ao as hasAuth,Mo as isBoxSelector,le as isRectangle,ko as isSvgSelector,uo as makeAccessServiceRequest,mo as makeAccessTokenRequest,en as parseSpecificResource,me as polygonToTarget,ue as requestToAnnotationResponse,Ho as seraliseSupportedSelector,Pn as svgThemes,As as targetIntersects,rn as unknownResponse,nn as unsupportedStrategy,$o as useAnnotation,Yo as useAnnotationPage,Se as useAnnotationPageManager,fe 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,W as useEvent,xe as useEventEmitter,os as useEventListener,Yt as useExistingVault,as as useExternalCollection,Gt as useExternalManifest,ie as useExternalResource,Pr as useIIIFLanguage,Z as useImage,_e as useImageService,pe as useImageServiceLoader,hs as useImageTile,yo as useIsAuthEnabled,be as useLoadImageService,Nr as useLocaleString,F as useManifest,Zo as useMediaActions,jo as useMediaElements,Jo as useMediaState,cn as usePaintables,A as usePaintingAnnotations,Or as usePolygonHelper,ae as useRange,Vo as useRemoteStylesheet,lr as useRenderControls,gn as useRenderingStrategy,qe as useRequestAnnotation,B as useResourceContext,Ko as useResourceEvents,ln as useResources,Po as useSearchService,He as useSelectorController,Mn as useSelectorEmitter,Me as useSelectorEvents,Hn as useSelectorHelper,rr as useSimpleMediaPlayer,se as useSimpleViewer,Rs as useStaticRenderingStrategy,ir as useStrategy,Ns as useStyleHelper,_o as useStyles,Do as useStylesheetStore,Wr as useSvgEditor,Fe as useSvgEditorControls,ge as useThumbnail,wr as useTranslations,Rr as useTransliteration,R as useVault,gr as useVaultEffect,O as useVaultSelector,Mr as useViewerPreset,ur as useVirtualAnnotationPage,fr as useVirtualAnnotationPageContext,ne 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 de,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 Se,L as So,La as mr,Lb as ln,M as bo,Ma as ur,Mb as be,N as Io,Na as fr,Nb as A,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 pe,Sb as Ce,T as To,Ta as ge,Tb as Re,U as se,Ua as yr,Ub as Pe,V as No,Va as vr,W as Eo,Wa as xr,X as Ao,Xa as Sr,Y as W,Ya as he,Z as le,Za as ye,_ as ce,_a as br,a as _t,aa as Mo,ab as Cr,b as B,ba as Ho,bb as Rr,c as E,ca as me,cb as Pr,d as re,da as ue,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 O,ha as Bo,hb as Er,i as Xt,ia as Oo,ib as N,j as ne,ja as Fo,jb as ve,k as Yt,ka as fe,kb as Ar,l as F,la as Wo,lb as kr,m as ie,ma as Do,mb as G,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 ae,wa as Go,wb as Vr,x as io,xa as Jo,xb as xe,y as ao,ya as Zo,yb as $r,z as so,za as jo,zb as Kr}from"./chunk-MUASBCAU.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 Ie}from"./chunk-FBET7GLW.js";export*from"@iiif/helpers/annotation-targets";import{useEffect as Xe}from"react";import{useCallback as we,useEffect as Qe,useRef as Ue,useState as D}from"react";import{useStore as k}from"zustand";function qe(e){let[t,o]=D(0),r=P(),n=k(r,d=>d.tool.enabled),i=k(r,d=>d.tool.requestId),a=k(r,d=>d.getRequestId),s=k(r,d=>d.requestAnnotation),f=k(r,d=>d.completeRequest),m=k(r,d=>d.cancelRequest),l=Ue(e?.onSuccess);l.current=e?.onSuccess;let[h,S]=D(!1),[b,x]=D(null),[p,v]=D(null),u=n&&i!==p,g=n&&i===p,c=we(async(d,q)=>{if(p){let M=l.current;S(!0);let L=await s(d,{...q,requestId:p});if(L)return M?.(L),o(Y=>Y+1),S(!1),x(L),L;let X={id:p,cancelled:!0,...ue(d)};return M?.(X),x(X),o(Y=>Y+1),S(!1),X}return null},[s,p]),y=we(()=>{x(null),S(!1)},[]);return Qe(()=>{let d=a();return v(d.requestId),()=>{d.clear()}},[t]),{id:t,busy:u,isPending:h,isActive:g,requestId:p,requestAnnotation:c,cancelRequest:()=>p?m(p):void 0,completeRequest:()=>p?f(p):void 0,reset:y,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 Te(e){let{id:t,data:o,requestAnnotation:r,cancelRequest:n,isPending:i}=qe({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 Ne,useContext as Ae,useEffect as Ee,useMemo as J,useState as Ge}from"react";import ke from"mitt";import{jsx as Je}from"react/jsx-runtime";var V=Ye(ke());V.displayName="SelectorHelper";function kn({children:e}){return Je(V.Provider,{value:J(()=>ke(),[]),children:e})}function Mn(){return Ae(V)}function Me(e){let t=He(),[o,r]=Ge(!1);Ee(()=>t.withSelector(e).on("highlight",()=>{r(!0)}),[t,e]),Ee(()=>t.withSelector(e).on("clear-highlight",()=>{r(!1)}),[t,e]);let n=Ne(a=>{t.emit("click",{selectorId:e,event:a})},[e,t]),i=Ne(a=>{t.emit("hover",{selectorId:e,event:a})},[e,t]);return{controller:t,onClick:n,onHover:i,isHighlighted:o}}function He(){let e=Ae(V);return J(()=>({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=He();return J(()=>({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 ze}from"react/jsx-runtime";function $n(e){let t=w(),o=e.annotationBucket,r=e.readOnly,n=e.id,{onClick:i,isHighlighted:a}=Me(e.id),s=fe(),f=a?s.highlighted:s[o||"hidden"]||s.hidden;if(!t)return null;if(r){let m="shape",l=e.polygon,h=l.open;return l?ze(m,{id:`shape-${n}`,points:l.points,open:h,onClick:i,relativeStyle:!0,target:{x:0,y:0,width:t.width,height:t.height},style:f}):null}return ze(Te,{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 Le}from"react/jsx-runtime";var Jn=je(function({canvasId:t},o){let r=Ze(),n=Se(t||r?.id),i=R();return et(o,()=>n,[t,r]),!r||n.enabledPageIds.length===0?null:Le(tt,{children:n.enabledPageIds.map(a=>Le(Pe.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 $}from"react/jsx-runtime";function K({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:h,tableHeader:S,customLabelRender:b,customValueRender:x}){let p=ot(()=>{let u=(t||[]).reduce((c,y)=>[...c,...y.keys],[]),g={};for(let c of e){let y=c?.label?Object.values(c.label):[];for(let d of y)if(d?.length&&(u.indexOf(`metadata.${d[0]}`)!==-1||u.length===0)&&c){let q=`metadata.${d[0]}`;g[q]=g[q]?g[q]:[],g[q].push(c);break}}return g},[t,e]);return Object.keys(p).length===0&&r?I(rt,{children:i})||I("div",{className:a.empty,children:s}):t?.length?$("table",{className:a.container,children:[S,I("tbody",{children:t.map((u,g)=>{let c=[];for(let d of u.keys)for(let q of p[d]||[]){let M=I(N,{enableDangerouslySetInnerHTML:n,defaultText:f,separator:l,children:q.value},g+"__"+d);x?c.push(x(q,M)):c.push(M)}if(c.length===0)return null;let y=I(N,{enableDangerouslySetInnerHTML:n,separator:l,defaultText:m,children:u.label});return $("tr",{className:a.row,children:[I("td",{className:a.label,style:o?{minWidth:o}:{},children:b?b(u.label,y):y}),I("td",{className:a.value,children:c})]},g)})}),h]}):$("table",{className:a.container,children:[S,I("tbody",{children:e?.length?e.map((u,g)=>{if(!u)return null;let c=I(N,{enableDangerouslySetInnerHTML:n,defaultText:f,separator:l,children:u.label}),y=I(N,{enableDangerouslySetInnerHTML:n,defaultText:f,separator:l,children:u.value});return $("tr",{className:a.row,children:[I("td",{className:a.label,style:o?{minWidth:o}:{},children:b?b(u.label,c):c}),I("td",{className:a.value,children:x?x(u,y):y})]},g)}):null}),h]})}import{jsx as it}from"react/jsx-runtime";function mi(e){let t=F(),o=w(),r=ae(),n=nt(()=>{let i=t?.metadata||[],a=o?.metadata||[],s=r?.metadata||[];return[...i,...a,...s]},[t,o,r]);return it(K,{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 Z(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=pe(),[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=Z(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=Z(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 H,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[h,S]=pt(),b=t||Ce,[x,p]=be(),v=dt(()=>{let g=p[e]?.status,c=x({id:e},{});return c?.height&&c.width&&g!=="loading"?{id:e,width:c.width,height:c.height,service:c,type:"Image",selector:{type:"BoxSelector",spatial:{x:0,y:0,width:c.width,height:c.height}},target:{type:"BoxSelector",spatial:{x:0,y:0,width:c.width,height:c.height}}}:null},[x,e,p]);if(!v||!v.height||!v.width)return null;let u=s?void 0:l.homePosition?l.homePosition.width/l.homePosition.height:v.width/v.height;return H(gt,{resetKeys:[],fallbackRender:g=>H(b,{...l,...g}),children:H(Re,{...l,aspectRatio:u,containerProps:{style:{position:"relative"},...l.containerProps||{}},onCreated:g=>{S(g),l.onCreated&&l.onCreated(g)},children:yt(G.Provider,{value:h,children:[H(ve,{image:v,id:v.id,isStatic:!o,x:f,y:m},v.id),H(ht,{viewerPreset:h,renderViewerControls:i,image:v,src:e,viewControlsDeps:a}),n]})})})}function ht({viewerPreset:e,renderViewerControls:t,image:o,src:r,viewControlsDeps:n}){return de(e&&t?"overlay":"none",`canvas-portal-controls-${r}`,G.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=F();return vt(K,{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 Be,jsx as T,jsxs as It}from"react/jsx-runtime";var{LazyLoadComponent:St}=j||j.default;function Oe(e){let{size:t,visible:o,classes:r,canvasId:n,figure:i}=e,a=t?.width||128,s=t?.height||t?.width||128,f=T(bt,{...e}),m=T(St,{threshold:300,style:{height:s,width:a},visibleByDefault:o,children:n?T(re,{canvas:n,children:f}):f});return i?T("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=ge({width:s,height:f,allowUnsafe:!0},i);return!l||l.type!=="fixed"?T(Be,{children:e}):It(Be,{children:[T("div",{className:o?.imageWrapper,children:T("img",{className:o?.img,src:l.id,alt:m})}),r?T(N,{as:"figcaption",className:o?.label,children:a?.label}):null]})}import{jsx as z}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:h,setSequenceIndex:S}=se(),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 p=f.current.querySelector("[data-selected=true]");p&&p.scrollIntoView({behavior:e||"instant",block:"nearest",inline:"center"})},[h]);let x=[];for(let p of l){let v=[],u=l[h]===p;for(let g of p){let c=m[g];v.push(z("div",{className:u?b.item:n.item,children:z(Oe,{classes:u?b:n,canvasId:c.id,size:r,dereference:t,showLabel:i,figure:a,placeholder:z("div",{style:{height:128,width:128}}),fallback:s})},g))}if(o){x.push(v);continue}x.push(z("div",{onClick:g=>{S(l.indexOf(p))},"data-selected":u,className:u?b.row:n.row,children:v},p.join("-")))}return z("div",{ref:f,className:n.container,children:x})}import{useStore as Q}from"zustand";function Fe(){let e=P(),t=Q(e,i=>i.completeRequest),o=Q(e,i=>i.polygonState.currentTool),r=Q(e,i=>i.polygonState.selectedStamp),n=Q(e,i=>i.switchTool);return{completeRequest:t,currentTool:o,selectedStamp:r,switchTool:n}}import{Fragment as We,jsx as C,jsxs as De}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}=Fe();return De(We,{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?De(We,{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(E,{value:{annotation:e},children:t})}import{jsx as qt}from"react/jsx-runtime";function ua({annotationPage:e,children:t}){return qt(E,{value:{annotationPage:e},children:t})}import{jsx as Tt}from"react/jsx-runtime";function ga({collection:e,children:t}){return Tt(E,{value:{collection:e},children:t})}function xa(e,t={}){return A(t)}import{useCanvas as Nt}from"@atlas-viewer/atlas";import{useEffect as Et,useMemo as ee,useState as At}from"react";function Pa({canvasId:e}={}){let t=Nt(),o=ne(),r=ee(()=>e?[e]:t?[t.id]:o.map(m=>m.id),[e,t,o]),[n,i]=At({}),a=xe();Et(()=>{let m=l=>{let h=l.partOf.canvasId;h&&i(S=>({...S,[h]:l.choice}))};return a.on("choice-change",m),()=>{a.off("choice-change",m)}},[]);let s=ee(()=>{let m=[];for(let l of r){let h=n[l];h&&m.push({canvasId:l,choice:h})}return m},[r,n]),f=ee(()=>({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=B().manifest,r=e?e.map(n=>typeof n=="string"?n:n?.id):[];return O(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=B(),i=o||n.collection,a=O(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 Ve}from"zustand";function Da(){let e=P(),t=Ve(e,r=>r.completeRequest),o=Ve(e,r=>r.cancelRequest);return Ht(()=>({saveAnnotation:()=>{Mt(()=>{t()})},cancelRequest:o}),[t,o])}import{useCallback as zt}from"react";import{useStore as te}from"zustand";function Qa({requestId:e}={}){let t=P(),o=te(t,s=>s.metadata),r=te(t,s=>s.tool.requestId),n=e||r,i=te(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);W("polygons.start-transition",r=>{e.requestId&&o!==e.requestId||e?.onStart?.(r.transitionIntent)},[o,e.requestId]),W("polygons.end-transition",r=>{e.requestId&&o!==e.requestId||e?.onEnd?.(r.transitionIntent,r.response)},[o,e.requestId]),W("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}=ie(e,t);return{id:o,isLoaded:r,error:n,manifest:i,requestId:a,cached:s}}import{getImageServices as $e}from"@iiif/parser/image-3";import{useEffect as Wt,useMemo as Ke,useState as U}from"react";function _e({cacheKey:e}={}){let t=w(),o=A(),r=R(),n=he(),i=ye(),[a,s]=U(void 0),[f,m]=U(!1),[l,h]=U("idle"),[S,b]=U(void 0),x=t?t.id:"undefined",p=Ke(()=>{try{if(t&&o.length){let u=o[0],g=r.get(u.body[0]),y=$e(g)[0];return y&&n(y,{width:y.width||t.width,height:y.height||t.height},!0)||void 0}}catch(u){console.error(u)}},[x,e,t]),v=l==="success"&&a?a:p;return Wt(()=>{(async()=>{try{if(t&&o.length){let u=o[0],g=r.get(u.body[0]),y=$e(g)[0];if(!y)return;m(!0),h("loading");try{let d=await i(y,{width:y.width||t.width,height:y.height||t.height})||void 0;s(d),h("success"),m(!1)}catch(d){h("error"),b(d)}}}catch(u){h("error"),b(u)}})()},[x,e]),Ke(()=>({data:v,isFetching:f,status:l,error:S}),[v,f,l,S])}function hs(){let e=_e();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 oe}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=A(),n=oe(()=>Dt(t),[t]),i=oe(()=>n.getPaintables(r),[n,r]);return oe(()=>Ie({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||ce(e.polygon);if(e.polygon&&!le(e.polygon.points)){let r=e.target||me(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,re as CanvasContext,Pe as CanvasPanel,hn as CanvasStrategyProvider,yn as CanvasWorldObject,ga as CollectionContext,mi as CombinedMetadata,xr as ComplexTimelineProvider,Xr as ContextBridge,sr as ControlsReactContext,Te 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,N as LocaleString,Jt as ManifestContext,Bi as ManifestMetadata,er as MediaPlayerProvider,K 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,E as ResourceProvider,_t as ResourceReactContext,kn as SelectorControllerProvider,Gi as SequenceThumbnails,To as SimpleViewerProvider,wo as SimpleViewerReactContext,Oe as SingleCanvasThumbnail,nr as StrategyReactContext,yr as ThumbnailFallbackImage,br as TranslationProvider,Cr as TransliterationProvider,Ut as VaultProvider,G 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,Ie as getRenderingStrategy,fn as getTextualContentStrategy,dn as getVideoStrategy,ro as getVisibleCanvasesFromCanvasId,ao as hasAuth,Mo as isBoxSelector,le as isRectangle,ko as isSvgSelector,uo as makeAccessServiceRequest,mo as makeAccessTokenRequest,en as parseSpecificResource,me as polygonToTarget,ue as requestToAnnotationResponse,Ho as seraliseSupportedSelector,Pn as svgThemes,As as targetIntersects,rn as unknownResponse,nn as unsupportedStrategy,$o as useAnnotation,Yo as useAnnotationPage,Se as useAnnotationPageManager,fe 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,W as useEvent,xe as useEventEmitter,os as useEventListener,Yt as useExistingVault,as as useExternalCollection,Gt as useExternalManifest,ie as useExternalResource,Pr as useIIIFLanguage,Z as useImage,_e as useImageService,pe as useImageServiceLoader,hs as useImageTile,yo as useIsAuthEnabled,be as useLoadImageService,Nr as useLocaleString,F as useManifest,Zo as useMediaActions,jo as useMediaElements,Jo as useMediaState,cn as usePaintables,A as usePaintingAnnotations,Or as usePolygonHelper,ae as useRange,Vo as useRemoteStylesheet,lr as useRenderControls,gn as useRenderingStrategy,qe as useRequestAnnotation,B as useResourceContext,Ko as useResourceEvents,ln as useResources,Po as useSearchService,He as useSelectorController,Mn as useSelectorEmitter,Me as useSelectorEvents,Hn as useSelectorHelper,rr as useSimpleMediaPlayer,se as useSimpleViewer,Rs as useStaticRenderingStrategy,ir as useStrategy,Ns as useStyleHelper,_o as useStyles,Do as useStylesheetStore,Wr as useSvgEditor,Fe as useSvgEditorControls,ge as useThumbnail,wr as useTranslations,Rr as useTransliteration,R as useVault,gr as useVaultEffect,O as useVaultSelector,Mr as useViewerPreset,ur as useVirtualAnnotationPage,fr as useVirtualAnnotationPageContext,ne as useVisibleCanvases};
|
|
@@ -113,6 +113,7 @@ type MediaStrategy = {
|
|
|
113
113
|
media: SingleAudio | SingleVideo | AudioSequence | VideoSequence | SingleYouTubeVideo;
|
|
114
114
|
choice?: ChoiceDescription;
|
|
115
115
|
annotations?: AnnotationPageDescription;
|
|
116
|
+
noSpatial?: boolean;
|
|
116
117
|
captions?: Array<{
|
|
117
118
|
id: string;
|
|
118
119
|
type: string;
|
|
@@ -113,6 +113,7 @@ type MediaStrategy = {
|
|
|
113
113
|
media: SingleAudio | SingleVideo | AudioSequence | VideoSequence | SingleYouTubeVideo;
|
|
114
114
|
choice?: ChoiceDescription;
|
|
115
115
|
annotations?: AnnotationPageDescription;
|
|
116
|
+
noSpatial?: boolean;
|
|
116
117
|
captions?: Array<{
|
|
117
118
|
id: string;
|
|
118
119
|
type: string;
|
|
@@ -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-Bg8-k9-n.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-Bg8-k9-n.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 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}
|
|
1
|
+
"use strict";var z=Object.defineProperty;var q=Object.getOwnPropertyDescriptor;var G=Object.getOwnPropertyNames;var H=Object.prototype.hasOwnProperty;var _=(e,t)=>{for(var i in t)z(e,i,{get:t[i],enumerable:!0})},j=(e,t,i,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of G(t))!H.call(e,o)&&o!==i&&z(e,o,{get:()=>t[o],enumerable:!(r=q(t,o))||r.enumerable});return e};var Q=e=>j(z({},"__esModule",{value:!0}),e);var ee={};_(ee,{emptyActions:()=>J,emptyStrategy:()=>v,getParsedTargetSelector:()=>C,getRenderingStrategy:()=>Z,parseSpecificResource:()=>$,unknownResponse:()=>I,unsupportedStrategy:()=>c});module.exports=Q(ee);var D=require("@iiif/helpers");function $(e){return e.type==="SpecificResource"?[e.source,{selector:e.selector}]:[e,{selector:null}]}function C(e,t){let{selector:i,source:r}=(0,D.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 J={makeChoice:()=>{}},I={type:"unknown"},c=e=>({type:"unknown",reason:e,annotations:{pages:[]}}),v=(e,t)=>({type:"empty",width:e,height:t,annotations:{pages:[]},image:null,images:[]});var K=["model/gltf-binary"];function M(e,t){let i=t.items[0],r=i.resource;return r.format?K.indexOf(r.format)===-1?c(`3D format: ${r.format} is unsupported`):{type:"3d-model",model:r,annotationId:i.annotationId,annotation:i.annotation}:c("Unknown format")}function w(e,t){let i=t.items,r=i[0];if(i.length===0||!r)return c("No audio");if(!e.duration)return c("No duration on canvas");if(i.length>1)return c("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:[]}}):c("Unknown audio")}var A=require("@iiif/helpers/annotation-targets"),O=require("@iiif/parser/image-3");function h(e){return e.replace(/^http:/,"https:")}function V(e,t,i){let r=[],o=[];for(let a of t.items){let l=a.resource&&a.resource.type==="SpecificResource"?a.resource.source:a.resource;if(!l.id)return c("No resource Identifier");let u;if(l.service){let S=(0,O.getImageServices)(l);S[0]&&(u=i(S[0],e))}let d={type:"BoxSelector",spatial:{x:0,y:0,width:Number(e.width),height:Number(e.height)}},[y,n]=C(e,a.target),m=e.id?.split("?")[0]||"";if(!(h(n.id||"")===h(e.id)||h(decodeURIComponent(n.id||""))===h(e.id||"")||h(n.id||"")===h(m)||h(decodeURIComponent(n.id||""))===h(m)))continue;let s=a.resource.width&&a.resource.height?{type:"BoxSelector",spatial:{x:0,y:0,width:a.resource.width,height:a.resource.height}}:void 0,p=a.resource.type==="SpecificResource"?(0,A.expandTarget)(a.resource):null;if(a.selector){let S=(0,A.expandTarget)({type:"SpecificResource",source:a.resource,selector:a.selector});S&&(p=S)}let f=p&&p.selector&&(p.selector.type==="BoxSelector"||p.selector.type==="TemporalBoxSelector")?{type:"BoxSelector",spatial:{x:p.selector.spatial.x,y:p.selector.spatial.y,width:p.selector.spatial.width,height:p.selector.spatial.height}}:void 0;u&&!u.id&&(u.id=u["@id"]);let g={id:l.id,type:"Image",annotationId:a.annotationId,annotation:a.annotation,width:Number(y||f?l.width:e.width),height:Number(y||f?l.height:e.height),service:u,sizes:u&&u.sizes?u.sizes:l.width&&l.height?[{width:l.width,height:l.height}]:[],target:y&&y.type!=="PointSelector"?y:d,selector:f||{type:"BoxSelector",spatial:{x:0,y:0,width:Number(e.width),height:Number(e.height)}},annotationPages:a.resource.annotations||[]};r.push(g)}return{type:"images",image:r[0],images:r,choice:t.choice}}function U(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=>U(o,t,r))}return t}function k(e,t){let i=[];return t.items.forEach(r=>{if(r.resource){let[o]=C(e,r.target);i.push({type:"Text",annotationId:r.annotationId,annotation:r.annotation,text:U(r.resource),target:o})}}),{type:"textual-content",items:i}}var P=require("@iiif/helpers");var X=/^.*(?:(?:youtu\.be\/|v\/|vi\/|u\/\w\/|embed\/|shorts\/)|(?:(?:watch)?\?vi?=|&vi?=))([^#&?]*).*/;function N(e,t,i,r=!1){let o=t.items.filter(g=>g.type==="video"),a=o[0],l=!1,u=!1;if(e.duration||(u=!0),o.length>1||!a)return c("Only one video source supported");let d=o[0]?.resource,y=!!(d.service||[]).find(g=>(g.profile||"").includes("youtube.com"));if(!y&&u)return c("Video does not have duration");if(!d)return c("Unknown video");if((!d.format||d.format==="text/html")&&!y)return c("Video does not have format");let n=[],m=i.get(e.annotations||[]);for(let g of m){let S=i.get(g.items||[]);for(let x of S)if((x.motivation?Array.isArray(x.motivation||"")?x.motivation:[x.motivation]:[]).includes("supplementing")){let E=i.get(x.body||[]);for(let Y of E){let T=Y;if(T.type==="Choice")for(let F of T.items){let b=i.get(F);b.format==="text/vtt"&&n.push({id:b.id,type:"Text",format:"text/vtt",label:b.label,language:b.language})}else T.format==="text/vtt"&&n.push({id:T.id,type:"Text",format:"text/vtt",label:T.label,language:T.language})}}}let s={annotationId:a.annotationId,annotation:a.annotation,duration:e.duration,url:d.id,type:"Video",target:{type:"TemporalSelector",temporal:{startTime:0,endTime:e.duration}},format:d.format,selector:{type:"TemporalSelector",temporal:{startTime:0,endTime:e.duration}}},p=(0,P.expandTarget)(a.target);p.selector&&p.selector.type==="TemporalBoxSelector"&&(s.target=p.selector);let{selector:f}=(0,P.parseSelector)(a.selector);if(f===null){let g=s.target.temporal.startTime,x=(s.target.temporal.endTime||e.duration)-g;s.selector={type:"TemporalSelector",temporal:{startTime:0,endTime:x}}}else f.type==="TemporalSelector"&&(s.selector=f);if(r&&!s.target.spatial&&(l=!0,s.target={type:"TemporalBoxSelector",temporal:s.target.temporal,spatial:{x:e.width/2,y:e.height/2,width:e.width/2,height:e.height/2}}),y){s.type="VideoYouTube";let g=d.id.match(X);if(!g[1])return c("Video is not known youtube video");s.youTubeId=g[1]}return{type:"media",media:s,annotations:{pages:[]},noSpatial:l,captions:n}}var L=require("@iiif/helpers");function W(e,t,i,r){let o={type:"complex-timeline",items:[],keyframes:[],highlights:[],duration:e.duration||0},a={type:"complex-choice",items:[]},l=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 m=V(e,{choice:null,allChoices:null,types:["image"],items:[n]},i);if(m.type==="images"){if(!m.image)continue;u(m),o.items.push(m.image);let s={id:m.image.annotationId,type:"enter",resourceType:"image",time:m.image.target?.temporal?.startTime||0};o.keyframes.push(s);let p={id:m.image.annotationId,type:"exit",resourceType:"image",time:m.image.target?.temporal?.endTime||e.duration||0};o.keyframes.push(p)}}if(n.type==="textualbody"){let m=k(e,{choice:null,allChoices:null,types:["textualbody"],items:[n]});if(m.type==="textual-content"){u(m);let s=m.items[0];o.items.push(s);let p=s.target,f={id:s.annotationId,type:"enter",resourceType:"text",time:p.temporal?.startTime||0};o.keyframes.push(f);let g={id:s.annotationId,type:"exit",resourceType:"text",time:p.temporal?.endTime||e.duration||0};o.keyframes.push(g)}}if(n.type==="video"){let m=N(e,{choice:null,allChoices:null,types:["video"],items:[n]},r,!0);if(m.type==="media"){u(m);let s=m.media;o.items.push(s);let p={id:s.annotationId,type:"enter",resourceType:"video",time:s.target?.temporal?.startTime||0};o.keyframes.push(p);let f={id:s.annotationId,type:"exit",resourceType:"video",time:s.target?.temporal?.endTime||e.duration||0};o.keyframes.push(f)}}if(n.type==="audio"||n.type==="sound"){let m=w(e,{choice:null,allChoices:null,types:["audio"],items:[n]});if(m.type==="media"){u(m);let s=m.media;o.items.push(s);let p={id:s.annotationId,type:"enter",resourceType:"audio",time:s.target?.temporal?.startTime||0};o.keyframes.push(p);let f={id:s.annotationId,type:"exit",resourceType:"audio",time:s.target?.temporal?.endTime||e.duration||0};o.keyframes.push(f)}}}for(let n of l)for(let m of n.items){let s=r.get(m),p=(0,L.expandTarget)(s.target,{typeMap:r.getState?.().iiif.mapping});if(p.selector?.temporal){let f={id:s.id,type:"enter",resourceType:"highlight",time:p.selector.temporal.startTime||0};o.keyframes.push(f);let g={id:s.id,type:"exit",resourceType:"highlight",time:p.selector.temporal.endTime||e.duration||0};o.keyframes.push(g)}o.highlights.push({annotation:s,target:p})}o.keyframes.sort((n,m)=>n.time-m.time);let d=[],y=[];for(let n of o.keyframes){if(n.resourceType==="image"||n.resourceType==="text"||n.resourceType==="highlight"){y.push(n);continue}if(n.type==="enter"){d.length===0&&(n.isPrime=!0),d.push(n),y.push(n);continue}if(n.type==="exit"&&(y.push(n),d=d.filter(m=>m.id!==n.id),d.length!==0)){let m=d[0],s={id:m.id,type:"change",isPrime:!0,resourceType:m.resourceType,time:n.time};y.push(s)}}return o.keyframes=y,a.items.length&&(o.choice=a),o}var R={},B={get(e){return e},setMetaValue([e,t,i],r){let o=B.getResourceMeta(e,t),a=o?o[i]:void 0,l=typeof r=="function"?r(a):r;R[e]={...R[e]||{},[t]:{...(R[e]||{})[t]||{},[i]:l}}},getResourceMeta:(e,t)=>{let i=R[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 Z({canvas:e,paintables:t,supports:i,loadImageService:r,vault:o=B}){if(!e)return I;if(t.types.length===0)return i.indexOf("empty")!==-1?v(e.width,e.height):I;if(t.types.length!==1)if(t.types.length===2&&t.types.indexOf("text")!==-1)t.types=t.types.filter(l=>l!=="text");else return i.indexOf("complex-timeline")===-1?c("Complex timeline not supported"):W(e,t,r,o);let a=t.types[0];return a==="image"?i.indexOf("images")===-1?c("Image not supported"):V(e,t,r):a==="Model"||a==="model"?i.indexOf("3d-model")===-1?c("3D not supported"):M(e,t):a==="textualbody"?i.indexOf("textual-content")===-1?c("Textual content not supported"):k(e,t):a==="sound"||a==="audio"?i.indexOf("media")===-1?c("Media not supported"):w(e,t):a==="video"?i.indexOf("media")===-1?c("Media not supported"):N(e,t,o):I}
|
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-CMAqRpk_.cjs';
|
|
2
|
+
import './useRenderingStrategy-Bg8-k9-n.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-CHozUicY.js';
|
|
2
|
+
import './useRenderingStrategy-Bg8-k9-n.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"./chunk-UNH7HXGJ.js";import{a,b,c,d,e,f,l as g}from"./chunk-
|
|
1
|
+
import"./chunk-UNH7HXGJ.js";import{a,b,c,d,e,f,l as g}from"./chunk-FBET7GLW.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
package/dist/chunk-223VJXTE.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{expandTarget as O}from"@iiif/helpers";function Q(e){return e.type==="SpecificResource"?[e.source,{selector:e.selector}]:[e,{selector:null}]}function T(e,i){let{selector:r,source:n}=O(i);if(n.id!==e.id)return[null,n];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,n]}var $={makeChoice:()=>{}},C={type:"unknown"},l=e=>({type:"unknown",reason:e,annotations:{pages:[]}}),N=(e,i)=>({type:"empty",width:e,height:i,annotations:{pages:[]},image:null,images:[]});var U=["model/gltf-binary"];function R(e,i){let r=i.items[0],n=r.resource;return n.format?U.indexOf(n.format)===-1?l(`3D format: ${n.format} is unsupported`):{type:"3d-model",model:n,annotationId:r.annotationId,annotation:r.annotation}:l("Unknown format")}import{expandTarget as v}from"@iiif/helpers/annotation-targets";import{getImageServices as L}from"@iiif/parser/image-3";function I(e,i,r){let n=[],t=[];for(let a of i.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=L(c);h[0]&&(u=r(h[0],e))}let f={type:"BoxSelector",spatial:{x:0,y:0,width:Number(e.width),height:Number(e.height)}},[g,o]=T(e,a.target),s=e.id?.split("?")[0]||"";if(!(o.id===e.id||decodeURIComponent(o.id||"")===(e.id||"")||o.id===s||decodeURIComponent(o.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"?v(a.resource):null;if(a.selector){let h=v({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||[]};n.push(y)}return{type:"images",image:n[0],images:n,choice:i.choice}}function z(e,i={},r){let n=e.language||r||"none";switch(e.type){case"TextualBody":{typeof e.value<"u"&&(i[n]=[e.value]);break}case"List":case"Composite":case"Choice":e.items&&e.items.forEach(t=>z(t,i,n))}return i}function b(e,i){let r=[];return i.items.forEach(n=>{if(n.resource){let[t]=T(e,n.target);r.push({type:"Text",annotationId:n.annotationId,annotation:n.annotation,text:z(n.resource),target:t})}}),{type:"textual-content",items:r}}import{expandTarget as W,parseSelector as E}from"@iiif/helpers";var Y=/^.*(?:(?:youtu\.be\/|v\/|vi\/|u\/\w\/|embed\/|shorts\/)|(?:(?:watch)?\?vi?=|&vi?=))([^#&?]*).*/;function V(e,i,r){let n=i.items.filter(m=>m.type==="video"),t=n[0],a=!1;if(e.duration||(a=!0),n.length>1||!t)return l("Only one video source supported");let c=n[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=r.get(e.annotations||[]);for(let m of g){let d=r.get(m.items||[]);for(let y of d)if((y.motivation?Array.isArray(y.motivation||"")?y.motivation:[y.motivation]:[]).includes("supplementing")){let B=r.get(y.body||[]);for(let D of B){let S=D;if(S.type==="Choice")for(let M of S.items){let x=r.get(M);x.format==="text/vtt"&&f.push({id:x.id,type:"Text",format:"text/vtt",label:x.label,language:x.language})}else S.format==="text/vtt"&&f.push({id:S.id,type:"Text",format:"text/vtt",label:S.label,language:S.language})}}}let o={annotationId:t.annotationId,annotation:t.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=W(t.target);s.selector&&s.selector.type==="TemporalBoxSelector"&&(o.target=s.selector);let{selector:p}=E(t.selector);if(p===null){let m=o.target.temporal.startTime,y=(o.target.temporal.endTime||e.duration)-m;o.selector={type:"TemporalSelector",temporal:{startTime:0,endTime:y}}}else p.type==="TemporalSelector"&&(o.selector=p);if(u){o.type="VideoYouTube";let m=c.id.match(Y);if(!m[1])return l("Video is not known youtube video");o.youTubeId=m[1]}return{type:"media",media:o,annotations:{pages:[]},captions:f}}import{expandTarget as F}from"@iiif/helpers";function w(e,i){let r=i.items,n=r[0];if(r.length===0||!n)return l("No audio");if(!e.duration)return l("No duration on canvas");if(r.length>1)return l("Only one audio source supported");let t=n.resource;return t?("format"in t||(t.format="audio/mpeg"),{type:"media",media:{annotationId:n.annotationId,annotation:n.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:[]}}):l("Unknown audio")}function A(e,i,r,n){let t={type:"complex-timeline",items:[],keyframes:[],highlights:[],duration:e.duration||0},a={type:"complex-choice",items:[]},c=n.get(e.annotations);function u(o){o.choice&&(o.choice.type==="complex-choice"?a.items.push(...o.choice.items):a.items.push(o.choice))}for(let o of i.items){if(o.type==="image"){let s=I(e,{choice:null,allChoices:null,types:["image"],items:[o]},r);if(s.type==="images"){u(s),t.items.push(s.image);let p={id:s.image.annotationId,type:"enter",resourceType:"image",time:s.image.target?.temporal?.startTime||0};t.keyframes.push(p);let m={id:s.image.annotationId,type:"exit",resourceType:"image",time:s.image.target?.temporal?.endTime||e.duration||0};t.keyframes.push(m)}}if(o.type==="textualbody"){let s=b(e,{choice:null,allChoices:null,types:["textualbody"],items:[o]});if(s.type==="textual-content"){u(s);let p=s.items[0];t.items.push(p);let m=p.target,d={id:p.annotationId,type:"enter",resourceType:"text",time:m.temporal?.startTime||0};t.keyframes.push(d);let y={id:p.annotationId,type:"exit",resourceType:"text",time:m.temporal?.endTime||e.duration||0};t.keyframes.push(y)}}if(o.type==="video"){let s=V(e,{choice:null,allChoices:null,types:["video"],items:[o]},n);if(s.type==="media"){u(s);let p=s.media;t.items.push(p);let m={id:p.annotationId,type:"enter",resourceType:"video",time:p.target?.temporal?.startTime||0};t.keyframes.push(m);let d={id:p.annotationId,type:"exit",resourceType:"video",time:p.target?.temporal?.endTime||e.duration||0};t.keyframes.push(d)}}if(o.type==="audio"||o.type==="sound"){let s=w(e,{choice:null,allChoices:null,types:["audio"],items:[o]});if(s.type==="media"){u(s);let p=s.media;t.items.push(p);let m={id:p.annotationId,type:"enter",resourceType:"audio",time:p.target?.temporal?.startTime||0};t.keyframes.push(m);let d={id:p.annotationId,type:"exit",resourceType:"audio",time:p.target?.temporal?.endTime||e.duration||0};t.keyframes.push(d)}}}for(let o of c)for(let s of o.items){let p=n.get(s),m=F(p.target,{typeMap:n.getState?.().iiif.mapping});if(m.selector?.temporal){let d={id:p.id,type:"enter",resourceType:"highlight",time:m.selector.temporal.startTime||0};t.keyframes.push(d);let y={id:p.id,type:"exit",resourceType:"highlight",time:m.selector.temporal.endTime||e.duration||0};t.keyframes.push(y)}t.highlights.push({annotation:p,target:m})}t.keyframes.sort((o,s)=>o.time-s.time);let f=[],g=[];for(let o of t.keyframes){if(o.resourceType==="image"||o.resourceType==="text"||o.resourceType==="highlight"){g.push(o);continue}if(o.type==="enter"){f.length===0&&(o.isPrime=!0),f.push(o),g.push(o);continue}if(o.type==="exit"&&(g.push(o),f=f.filter(s=>s.id!==o.id),f.length!==0)){let s=f[0],p={id:s.id,type:"change",isPrime:!0,resourceType:s.resourceType,time:o.time};g.push(p)}}return t.keyframes=g,a.items.length&&(t.choice=a),t}var P={},k={get(e){return e},setMetaValue([e,i,r],n){let t=k.getResourceMeta(e,i),a=t?t[r]:void 0,c=typeof n=="function"?n(a):n;P[e]={...P[e]||{},[i]:{...(P[e]||{})[i]||{},[r]:c}}},getResourceMeta:(e,i)=>{let r=P[e];if(r)return i?r[i]:r},async load(e){let i=typeof e=="string"?e:e.id;return fetch(i).then(r=>r.json())},requestStatus(e){}};function ke({canvas:e,paintables:i,supports:r,loadImageService:n,vault:t=k}){if(!e)return C;if(i.types.length===0)return r.indexOf("empty")!==-1?N(e.width,e.height):C;if(i.types.length!==1)if(i.types.length===2&&i.types.indexOf("text")!==-1)i.types=i.types.filter(c=>c!=="text");else return r.indexOf("complex-timeline")===-1?l("Complex timeline not supported"):A(e,i,n,t);let a=i.types[0];return a==="image"?r.indexOf("images")===-1?l("Image not supported"):I(e,i,n):a==="Model"||a==="model"?r.indexOf("3d-model")===-1?l("3D not supported"):R(e,i):a==="textualbody"?r.indexOf("textual-content")===-1?l("Textual content not supported"):b(e,i):a==="sound"||a==="audio"?r.indexOf("media")===-1?l("Media not supported"):w(e,i):a==="video"?r.indexOf("media")===-1?l("Media not supported"):V(e,i,t):C}export{Q as a,T as b,$ as c,C as d,l as e,N as f,R as g,I as h,b as i,V as j,A as k,ke as l};
|