react-iiif-vault 1.5.3 → 1.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/canvas-panel.cjs
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
justify-content: center;
|
|
13
13
|
pointer-events: visible;
|
|
14
14
|
}
|
|
15
|
-
`}),(0,se.jsx)("div",{className:"model-container",children:(0,se.jsx)("model-viewer",{"interaction-prompt":"none",style:{width:"100%",height:"100%"},"camera-controls":"","ar-status":"not-presenting",src:e.id})})]})}function kt({model:e,name:n}){return L("overlay",`model-${n}`,un,{model:e},[e]),null}var ko=require("react/jsx-runtime");function Eo(){let{strategy:e}=M();return e.type!=="3d-model"?null:(0,ko.jsx)(kt,{model:e.model})}var fe=require("react/jsx-runtime");function No({children:e}){let{strategy:n}=M(),[t]=cr();return n.type!=="images"?null:(0,fe.jsxs)(fe.Fragment,{children:[t?(0,fe.jsx)(Be,{page:t}):null,n.annotations&&n.annotations.pages?n.annotations.pages.map(r=>(0,fe.jsx)(Be,{page:r},r.id)):null,e]})}var _e=require("react"),Nt=require("react/jsx-runtime"),ki=(0,_e.createContext)(null),Ni=(0,_e.createContext)(null),Li=(0,_e.createContext)(null);function Lt({actions:e,state:n,children:t,currentTime:r,progress:o,element:a}){return(0,Nt.jsx)(Li.Provider,{value:{currentTime:r,progress:o,element:a},children:(0,Nt.jsx)(Ni.Provider,{value:e,children:(0,Nt.jsx)(ki.Provider,{value:n,children:t})})})}var Lo=require("react");var zo=require("@iiif/helpers");function zt(){let e=k(),n=b();return(0,Lo.useMemo)(()=>{if(!e||!n||!e.start)return null;let t=(0,zo.expandTarget)(e.start);return!t||t.source.id!==n.id||!t||!t.selector||t.selector.type!=="TemporalSelector"?null:t.selector.temporal},[e,n])}var Dt=require("react/jsx-runtime");function cn({media:e,startTime:n,children:t}){let[{element:r,currentTime:o,progress:a},i,s]=we({duration:e.duration}),u=n?`${e.url}#t=${n}`:e.url;return(0,Dt.jsxs)(Lt,{state:i,actions:s,currentTime:o,progress:a,element:r,children:[(0,Dt.jsx)("audio",{ref:r,src:u}),t]})}function Ot({media:e,mediaControlsDeps:n,audioCopmonent:t=cn,children:r}){let o=zt();return L("portal","audio",t,{media:e,startTime:o?o.startTime:null,children:r},[e,o,...n||[]]),null}var ln=require("react/jsx-runtime");function Ne({x:e=0,y:n=0}){let t=b(),r=Ee({maxWidth:256,maxHeight:256});return!t||!r||r.type!=="fixed"?null:(0,ln.jsx)("world-object",{height:t.height,width:t.width,x:e,y:n,children:(0,ln.jsx)("world-image",{uri:r.id,target:{x:0,y:0,width:t.width,height:t.height},display:r.width&&r.height?{width:r.width,height:r.height}:void 0,crop:void 0})})}var pe=require("react/jsx-runtime");function Oo({as:e}){let{strategy:n}=M(),{renderMediaControls:t,mediaControlsDeps:r}=F();return n.type!=="media"||n.media.type!=="Sound"?null:(0,pe.jsx)(pe.Fragment,{children:(0,pe.jsxs)(Ot,{media:n.media,mediaControlsDeps:r,audioCopmonent:e,children:[(0,pe.jsx)(Ne,{}),t?t(n):null]},n.media.url)})}var te=require("react/jsx-runtime");function Do(){let{strategy:e}=M(),{renderViewerControls:n,viewControlsDeps:t}=F(),r=b(),o=r?.accompanyingCanvas,a=r?.placeholderCanvas;return(0,te.jsxs)(te.Fragment,{children:[e.type==="media"&&e.media.type==="Sound"&&o?(0,te.jsx)(G,{canvas:o.id,children:(0,te.jsx)(ge,{renderViewerControls:n,viewControlsDeps:t})}):null,e.type==="media"&&e.media.type==="Sound"&&a&&!o?(0,te.jsx)(G,{canvas:a.id,children:(0,te.jsx)(ge,{renderViewerControls:n,viewControlsDeps:t})}):null]})}var Ye=require("react/jsx-runtime");function mn({element:e,media:n,startTime:t,playPause:r,poster:o}){let a="div",i=t?`${n.url}#t=${t}`:n.url;return(0,Ye.jsxs)(a,{className:"video-container",part:"video-container",onClick:r,children:[(0,Ye.jsx)("style",{children:`
|
|
15
|
+
`}),(0,se.jsx)("div",{className:"model-container",children:(0,se.jsx)("model-viewer",{"interaction-prompt":"none",style:{width:"100%",height:"100%"},"camera-controls":"","ar-status":"not-presenting",src:e.id})})]})}function kt({model:e,name:n}){return L("overlay",`model-${n}`,un,{model:e},[e]),null}var ko=require("react/jsx-runtime");function Eo(){let{strategy:e}=M();return e.type!=="3d-model"?null:(0,ko.jsx)(kt,{model:e.model})}var fe=require("react/jsx-runtime");function No({children:e}){let{strategy:n}=M(),[t]=cr();return n.type!=="images"?null:(0,fe.jsxs)(fe.Fragment,{children:[t?(0,fe.jsx)(Be,{page:t}):null,n.annotations&&n.annotations.pages?n.annotations.pages.map(r=>(0,fe.jsx)(Be,{page:r},r.id)):null,e]})}var _e=require("react"),Nt=require("react/jsx-runtime"),ki=(0,_e.createContext)(null),Ni=(0,_e.createContext)(null),Li=(0,_e.createContext)(null);function Lt({actions:e,state:n,children:t,currentTime:r,progress:o,element:a}){return console.log(n.duration),(0,Nt.jsx)(Li.Provider,{value:{currentTime:r,progress:o,element:a},children:(0,Nt.jsx)(Ni.Provider,{value:e,children:(0,Nt.jsx)(ki.Provider,{value:n,children:t})})})}var Lo=require("react");var zo=require("@iiif/helpers");function zt(){let e=k(),n=b();return(0,Lo.useMemo)(()=>{if(!e||!n||!e.start)return null;let t=(0,zo.expandTarget)(e.start);return!t||t.source.id!==n.id||!t||!t.selector||t.selector.type!=="TemporalSelector"?null:t.selector.temporal},[e,n])}var Dt=require("react/jsx-runtime");function cn({media:e,startTime:n,children:t}){let[{element:r,currentTime:o,progress:a},i,s]=we({duration:e.duration}),u=n?`${e.url}#t=${n}`:e.url;return(0,Dt.jsxs)(Lt,{state:i,actions:s,currentTime:o,progress:a,element:r,children:[(0,Dt.jsx)("audio",{ref:r,src:u}),t]},e.url)}function Ot({media:e,mediaControlsDeps:n,audioCopmonent:t=cn,children:r}){let o=zt();return L("portal","audio",t,{media:e,startTime:o?o.startTime:null,children:r},[e,o,...n||[]]),null}var ln=require("react/jsx-runtime");function Ne({x:e=0,y:n=0}){let t=b(),r=Ee({maxWidth:256,maxHeight:256});return!t||!r||r.type!=="fixed"?null:(0,ln.jsx)("world-object",{height:t.height,width:t.width,x:e,y:n,children:(0,ln.jsx)("world-image",{uri:r.id,target:{x:0,y:0,width:t.width,height:t.height},display:r.width&&r.height?{width:r.width,height:r.height}:void 0,crop:void 0})})}var pe=require("react/jsx-runtime");function Oo({as:e}){let{strategy:n}=M(),{renderMediaControls:t,mediaControlsDeps:r}=F();return n.type!=="media"||n.media.type!=="Sound"?null:(0,pe.jsx)(pe.Fragment,{children:(0,pe.jsxs)(Ot,{media:n.media,mediaControlsDeps:r,audioCopmonent:e,children:[(0,pe.jsx)(Ne,{}),t?t(n):null]},n.media.url)})}var te=require("react/jsx-runtime");function Do(){let{strategy:e}=M(),{renderViewerControls:n,viewControlsDeps:t}=F(),r=b(),o=r?.accompanyingCanvas,a=r?.placeholderCanvas;return(0,te.jsxs)(te.Fragment,{children:[e.type==="media"&&e.media.type==="Sound"&&o?(0,te.jsx)(G,{canvas:o.id,children:(0,te.jsx)(ge,{renderViewerControls:n,viewControlsDeps:t})}):null,e.type==="media"&&e.media.type==="Sound"&&a&&!o?(0,te.jsx)(G,{canvas:a.id,children:(0,te.jsx)(ge,{renderViewerControls:n,viewControlsDeps:t})}):null]})}var Ye=require("react/jsx-runtime");function mn({element:e,media:n,startTime:t,playPause:r,poster:o}){let a="div",i=t?`${n.url}#t=${t}`:n.url;return(0,Ye.jsxs)(a,{className:"video-container",part:"video-container",onClick:r,children:[(0,Ye.jsx)("style",{children:`
|
|
16
16
|
.video-container {
|
|
17
17
|
position: absolute;
|
|
18
18
|
top: 0;
|
package/dist/canvas-panel.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{nb as a}from"./chunk-
|
|
1
|
+
import{nb as a}from"./chunk-YF4SEMKW.js";import"./chunk-XNDN34SQ.js";export{a as CanvasPanel};
|
|
@@ -14,7 +14,7 @@ import{c as Ct,l as xt}from"./chunk-XNDN34SQ.js";import{forwardRef as Ar,useImpe
|
|
|
14
14
|
justify-content: center;
|
|
15
15
|
pointer-events: visible;
|
|
16
16
|
}
|
|
17
|
-
`}),mt("div",{className:"model-container",children:mt("model-viewer",{"interaction-prompt":"none",style:{width:"100%",height:"100%"},"camera-controls":"","ar-status":"not-presenting",src:e.id})})]})}function Fe({model:e,name:n}){return E("overlay",`model-${n}`,ft,{model:e},[e]),null}import{jsx as ga}from"react/jsx-runtime";function ir(){let{strategy:e}=M();return e.type!=="3d-model"?null:ga(Fe,{model:e.model})}import{Fragment as va,jsx as ar,jsxs as ha}from"react/jsx-runtime";function sr({children:e}){let{strategy:n}=M(),[t]=an();return n.type!=="images"?null:ha(va,{children:[t?ar(pe,{page:t}):null,n.annotations&&n.annotations.pages?n.annotations.pages.map(r=>ar(pe,{page:r},r.id)):null,e]})}import{createContext as gt,useContext as vt}from"react";import{jsx as pt}from"react/jsx-runtime";var ur=gt(null),cr=gt(null),lr=gt(null);function
|
|
17
|
+
`}),mt("div",{className:"model-container",children:mt("model-viewer",{"interaction-prompt":"none",style:{width:"100%",height:"100%"},"camera-controls":"","ar-status":"not-presenting",src:e.id})})]})}function Fe({model:e,name:n}){return E("overlay",`model-${n}`,ft,{model:e},[e]),null}import{jsx as ga}from"react/jsx-runtime";function ir(){let{strategy:e}=M();return e.type!=="3d-model"?null:ga(Fe,{model:e.model})}import{Fragment as va,jsx as ar,jsxs as ha}from"react/jsx-runtime";function sr({children:e}){let{strategy:n}=M(),[t]=an();return n.type!=="images"?null:ha(va,{children:[t?ar(pe,{page:t}):null,n.annotations&&n.annotations.pages?n.annotations.pages.map(r=>ar(pe,{page:r},r.id)):null,e]})}import{createContext as gt,useContext as vt}from"react";import{jsx as pt}from"react/jsx-runtime";var ur=gt(null),cr=gt(null),lr=gt(null);function vp(){let e=vt(ur);if(!e)throw new Error("Ctx not found");return e}function hp(){let e=vt(cr);if(!e)throw new Error("Ctx not found");return e}function yp(){let e=vt(lr);if(!e)throw new Error("Ctx not found");return e}function De({actions:e,state:n,children:t,currentTime:r,progress:o,element:s}){return console.log(n.duration),pt(lr.Provider,{value:{currentTime:r,progress:o,element:s},children:pt(cr.Provider,{value:e,children:pt(ur.Provider,{value:n,children:t})})})}import{useMemo as ya}from"react";import{expandTarget as Sa}from"@iiif/helpers";function $e(){let e=w(),n=A();return ya(()=>{if(!e||!n||!e.start)return null;let t=Sa(e.start);return!t||t.source.id!==n.id||!t||!t.selector||t.selector.type!=="TemporalSelector"?null:t.selector.temporal},[e,n])}import{jsx as Ca,jsxs as xa}from"react/jsx-runtime";function ht({media:e,startTime:n,children:t}){let[{element:r,currentTime:o,progress:s},i,a]=ie({duration:e.duration}),u=n?`${e.url}#t=${n}`:e.url;return xa(De,{state:i,actions:a,currentTime:o,progress:s,element:r,children:[Ca("audio",{ref:r,src:u}),t]},e.url)}function Ue({media:e,mediaControlsDeps:n,audioCopmonent:t=ht,children:r}){let o=$e();return E("portal","audio",t,{media:e,startTime:o?o.startTime:null,children:r},[e,o,...n||[]]),null}import{jsx as dr}from"react/jsx-runtime";function ce({x:e=0,y:n=0}){let t=A(),r=ue({maxWidth:256,maxHeight:256});return!t||!r||r.type!=="fixed"?null:dr("world-object",{height:t.height,width:t.width,x:e,y:n,children:dr("world-image",{uri:r.id,target:{x:0,y:0,width:t.width,height:t.height},display:r.width&&r.height?{width:r.width,height:r.height}:void 0,crop:void 0})})}import{Fragment as Aa,jsx as mr,jsxs as Ra}from"react/jsx-runtime";function fr({as:e}){let{strategy:n}=M(),{renderMediaControls:t,mediaControlsDeps:r}=L();return n.type!=="media"||n.media.type!=="Sound"?null:mr(Aa,{children:Ra(Ue,{media:n.media,mediaControlsDeps:r,audioCopmonent:e,children:[mr(ce,{}),t?t(n):null]},n.media.url)})}import{Fragment as Pa,jsx as Be,jsxs as ba}from"react/jsx-runtime";function pr(){let{strategy:e}=M(),{renderViewerControls:n,viewControlsDeps:t}=L(),r=A(),o=r?.accompanyingCanvas,s=r?.placeholderCanvas;return ba(Pa,{children:[e.type==="media"&&e.media.type==="Sound"&&o?Be(_,{canvas:o.id,children:Be(Z,{renderViewerControls:n,viewControlsDeps:t})}):null,e.type==="media"&&e.media.type==="Sound"&&s&&!o?Be(_,{canvas:s.id,children:Be(Z,{renderViewerControls:n,viewControlsDeps:t})}):null]})}import{jsx as gr,jsxs as Ta}from"react/jsx-runtime";function yt({element:e,media:n,startTime:t,playPause:r,poster:o}){let s="div",i=t?`${n.url}#t=${t}`:n.url;return Ta(s,{className:"video-container",part:"video-container",onClick:r,children:[gr("style",{children:`
|
|
18
18
|
.video-container {
|
|
19
19
|
position: absolute;
|
|
20
20
|
top: 0;
|
|
@@ -45,4 +45,4 @@ import{c as Ct,l as xt}from"./chunk-XNDN34SQ.js";import{forwardRef as Ar,useImpe
|
|
|
45
45
|
width: 100%;
|
|
46
46
|
object-fit: contain;
|
|
47
47
|
}
|
|
48
|
-
`}),hr("iframe",{className:"video-yt",ref:r,src:`https://www.youtube.com/embed/${n.youTubeId}?enablejsapi=1&origin=${window.location.host}`,referrerPolicy:"no-referrer",sandbox:"allow-scripts allow-same-origin allow-presentation"})]}):null}function yr({media:e,mediaControlsDeps:n,children:t}){let[{element:r,currentTime:o,progress:s},i,a]=ie({duration:e.duration});return E("overlay","video-element",Ea,{element:r,media:e,playPause:a.playPause}),null}import{jsx as ka,jsxs as Na}from"react/jsx-runtime";function Sr(){let{strategy:e}=M(),{renderMediaControls:n,mediaControlsDeps:t}=L();return e.type!=="media"||e.media.type!=="VideoYouTube"?null:Na(yr,{media:e.media,mediaControlsDeps:t,children:[ka(ce,{}),n?n(e):null]})}import{jsx as B,jsxs as Cr}from"react/jsx-runtime";function Z({x:e,y:n,onChoiceChange:t,registerActions:r,defaultChoices:o,isStatic:s,renderViewerControls:i,renderMediaControls:a,renderComplexTimelineControls:u,complexTimelineControlsDeps:c,viewControlsDeps:l,mediaControlsDeps:d,strategies:h,throwOnUnknown:g,backgroundStyle:v,alwaysShowBackground:m,keepCanvasScale:C=!1,enableSizes:p=!1,enableYouTube:S=!0,onClickPaintingAnnotation:f,components:y={},children:T}){return Cr(Nn,{throwOnUnknown:g,onChoiceChange:t,registerActions:r,strategies:h,defaultChoices:o,mediaControlsDeps:d,renderMediaControls:a,renderViewerControls:i,renderComplexTimelineControls:u,complexTimelineControlsDeps:c,viewControlsDeps:l,children:[Cr(Ln,{keepCanvasScale:C,x:e,y:n,children:[B(zn,{alwaysShowBackground:m,backgroundStyle:v}),B(er,{}),B(tr,{}),B(or,{isStatic:s,enableSizes:p,onClickPaintingAnnotation:f}),B(sr,{}),B(ir,{}),B(fr,{as:y.Audio}),B(vr,{as:y.Video}),S?B(Sr,{}):null,T]}),B(pr,{})]})}import{jsx as xr}from"react/jsx-runtime";function Rr(e){let n=A();return!n||!n.placeholderCanvas?null:xr(_,{canvas:n.placeholderCanvas.id,children:xr(Z,{renderViewerControls:e.renderViewerControls})})}import{Fragment as Oa,jsx as q,jsxs as Ha}from"react/jsx-runtime";var za=Ar(function(n,t){let r=w(),o=xe(),s=Qt(),{ViewerControls:i,MediaControls:a,ComplexTimelineControls:u}=n.components||{};if(La(t,()=>s,[s]),!r)return q("div",{});let c=0;return Ha(Oa,{children:[n.header,q(k.Viewer,{height:n.height,mode:n.mode,renderPreset:n.renderPreset,runtimeOptions:n.runtimeOptions,children:o.map((l,d)=>{let h=c;return c+=l.width+(n.spacing||0),q(_,{canvas:l.id,children:q(k.RenderCanvas,{strategies:["3d-model","media","images","empty","textual-content","complex-timeline"],renderViewerControls:d===0&&i?()=>q(i,{}):void 0,renderMediaControls:d===0&&a?()=>q(a,{}):void 0,renderComplexTimelineControls:d===0&&u?()=>q(u,{}):void 0,x:h,...n.canvasProps||{},children:n.annotations},l.id)},l.id)})},n.reuseAtlas?"":s.currentSequenceIndex),n.children]})}),k=Ar(function({children:n,height:t,annotations:r,canvasProps:o,spacing:s,header:i,components:a,mode:u,reuseAtlas:c,renderPreset:l,runtimeOptions:d,...h},g){let v=X();return q(J,{vault:v,children:q(jt,{...h,children:q(za,{ref:g,height:t,components:a,spacing:s,canvasProps:o,annotations:r,header:i,mode:u,reuseAtlas:c,renderPreset:l,runtimeOptions:d,children:n})})})});k.RenderImage=se;k.RenderCanvas=Z;k.RenderAnnotationPage=pe;k.RenderAnnotation=Me;k.Viewer=fn;k.CanvasBackground=Le;k.Audio=Ue;k.Video=qe;k.Model=Fe;k.AudioHTML=ht;k.VideoHTML=yt;k.ModelHTML=ft;k.PlaceholderCanvas=Rr;export{Ce as a,O as b,Y as c,j as d,J as e,X as f,Pt as g,bt as h,Tt as i,_ as j,P as k,b as l,ee as m,xe as n,w as o,It as p,Yr as q,Ke as r,Ns as s,Mt as t,Os as u,We as v,wt as w,Et as x,Qs as y,Nt as z,Lt as A,zt as B,Ye as C,Vt as D,te as E,to as F,no as G,Bt as H,qt as I,de as J,ro as K,fu as L,oo as M,$t as N,pu as O,_t as P,Wt as Q,fe as R,vo as S,jt as T,Qt as U,xo as V,re as W,Gt as X,ic as Y,Zt as Z,bo as _,Sc as $,Jt as aa,Xt as ba,en as ca,rn as da,an as ea,sn as fa,un as ga,Q as ha,Pe as ia,E as ja,A as ka,fn as la,Te as ma,oe as na,Ie as oa,gn as pa,yn as qa,Cn as ra,xn as sa,Ve as ta,pd as ua,bn as va,Tn as wa,Mn as xa,Vn as ya,ke as za,M as Aa,Ne as Ba,L as Ca,Nn as Da,Ln as Ea,zn as Fa,st as Ga,ie as Ha,Nm as Ia,Lm as Ja,zm as Ka,qn as La,ct as Ma,_n as Na,ki as Oa,Ni as Pa,Li as Qa,Om as Ra,ge as Sa,se as Ta,Gn as Ua,rf as Va,er as Wa,tr as Xa,nr as Ya,oa as Za,rr as _a,ue as $a,or as ab,ir as bb,sr as cb,
|
|
48
|
+
`}),hr("iframe",{className:"video-yt",ref:r,src:`https://www.youtube.com/embed/${n.youTubeId}?enablejsapi=1&origin=${window.location.host}`,referrerPolicy:"no-referrer",sandbox:"allow-scripts allow-same-origin allow-presentation"})]}):null}function yr({media:e,mediaControlsDeps:n,children:t}){let[{element:r,currentTime:o,progress:s},i,a]=ie({duration:e.duration});return E("overlay","video-element",Ea,{element:r,media:e,playPause:a.playPause}),null}import{jsx as ka,jsxs as Na}from"react/jsx-runtime";function Sr(){let{strategy:e}=M(),{renderMediaControls:n,mediaControlsDeps:t}=L();return e.type!=="media"||e.media.type!=="VideoYouTube"?null:Na(yr,{media:e.media,mediaControlsDeps:t,children:[ka(ce,{}),n?n(e):null]})}import{jsx as B,jsxs as Cr}from"react/jsx-runtime";function Z({x:e,y:n,onChoiceChange:t,registerActions:r,defaultChoices:o,isStatic:s,renderViewerControls:i,renderMediaControls:a,renderComplexTimelineControls:u,complexTimelineControlsDeps:c,viewControlsDeps:l,mediaControlsDeps:d,strategies:h,throwOnUnknown:g,backgroundStyle:v,alwaysShowBackground:m,keepCanvasScale:C=!1,enableSizes:p=!1,enableYouTube:S=!0,onClickPaintingAnnotation:f,components:y={},children:T}){return Cr(Nn,{throwOnUnknown:g,onChoiceChange:t,registerActions:r,strategies:h,defaultChoices:o,mediaControlsDeps:d,renderMediaControls:a,renderViewerControls:i,renderComplexTimelineControls:u,complexTimelineControlsDeps:c,viewControlsDeps:l,children:[Cr(Ln,{keepCanvasScale:C,x:e,y:n,children:[B(zn,{alwaysShowBackground:m,backgroundStyle:v}),B(er,{}),B(tr,{}),B(or,{isStatic:s,enableSizes:p,onClickPaintingAnnotation:f}),B(sr,{}),B(ir,{}),B(fr,{as:y.Audio}),B(vr,{as:y.Video}),S?B(Sr,{}):null,T]}),B(pr,{})]})}import{jsx as xr}from"react/jsx-runtime";function Rr(e){let n=A();return!n||!n.placeholderCanvas?null:xr(_,{canvas:n.placeholderCanvas.id,children:xr(Z,{renderViewerControls:e.renderViewerControls})})}import{Fragment as Oa,jsx as q,jsxs as Ha}from"react/jsx-runtime";var za=Ar(function(n,t){let r=w(),o=xe(),s=Qt(),{ViewerControls:i,MediaControls:a,ComplexTimelineControls:u}=n.components||{};if(La(t,()=>s,[s]),!r)return q("div",{});let c=0;return Ha(Oa,{children:[n.header,q(k.Viewer,{height:n.height,mode:n.mode,renderPreset:n.renderPreset,runtimeOptions:n.runtimeOptions,children:o.map((l,d)=>{let h=c;return c+=l.width+(n.spacing||0),q(_,{canvas:l.id,children:q(k.RenderCanvas,{strategies:["3d-model","media","images","empty","textual-content","complex-timeline"],renderViewerControls:d===0&&i?()=>q(i,{}):void 0,renderMediaControls:d===0&&a?()=>q(a,{}):void 0,renderComplexTimelineControls:d===0&&u?()=>q(u,{}):void 0,x:h,...n.canvasProps||{},children:n.annotations},l.id)},l.id)})},n.reuseAtlas?"":s.currentSequenceIndex),n.children]})}),k=Ar(function({children:n,height:t,annotations:r,canvasProps:o,spacing:s,header:i,components:a,mode:u,reuseAtlas:c,renderPreset:l,runtimeOptions:d,...h},g){let v=X();return q(J,{vault:v,children:q(jt,{...h,children:q(za,{ref:g,height:t,components:a,spacing:s,canvasProps:o,annotations:r,header:i,mode:u,reuseAtlas:c,renderPreset:l,runtimeOptions:d,children:n})})})});k.RenderImage=se;k.RenderCanvas=Z;k.RenderAnnotationPage=pe;k.RenderAnnotation=Me;k.Viewer=fn;k.CanvasBackground=Le;k.Audio=Ue;k.Video=qe;k.Model=Fe;k.AudioHTML=ht;k.VideoHTML=yt;k.ModelHTML=ft;k.PlaceholderCanvas=Rr;export{Ce as a,O as b,Y as c,j as d,J as e,X as f,Pt as g,bt as h,Tt as i,_ as j,P as k,b as l,ee as m,xe as n,w as o,It as p,Yr as q,Ke as r,Ns as s,Mt as t,Os as u,We as v,wt as w,Et as x,Qs as y,Nt as z,Lt as A,zt as B,Ye as C,Vt as D,te as E,to as F,no as G,Bt as H,qt as I,de as J,ro as K,fu as L,oo as M,$t as N,pu as O,_t as P,Wt as Q,fe as R,vo as S,jt as T,Qt as U,xo as V,re as W,Gt as X,ic as Y,Zt as Z,bo as _,Sc as $,Jt as aa,Xt as ba,en as ca,rn as da,an as ea,sn as fa,un as ga,Q as ha,Pe as ia,E as ja,A as ka,fn as la,Te as ma,oe as na,Ie as oa,gn as pa,yn as qa,Cn as ra,xn as sa,Ve as ta,pd as ua,bn as va,Tn as wa,Mn as xa,Vn as ya,ke as za,M as Aa,Ne as Ba,L as Ca,Nn as Da,Ln as Ea,zn as Fa,st as Ga,ie as Ha,Nm as Ia,Lm as Ja,zm as Ka,qn as La,ct as Ma,_n as Na,ki as Oa,Ni as Pa,Li as Qa,Om as Ra,ge as Sa,se as Ta,Gn as Ua,rf as Va,er as Wa,tr as Xa,nr as Ya,oa as Za,rr as _a,ue as $a,or as ab,ir as bb,sr as cb,vp as db,hp as eb,yp as fb,De as gb,$e as hb,ce as ib,fr as jb,pr as kb,vr as lb,Sr as mb,k as nb};
|
package/dist/index.cjs
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
justify-content: center;
|
|
15
15
|
pointer-events: visible;
|
|
16
16
|
}
|
|
17
|
-
`}),(0,Re.jsx)("div",{className:"model-container",children:(0,Re.jsx)("model-viewer",{"interaction-prompt":"none",style:{width:"100%",height:"100%"},"camera-controls":"","ar-status":"not-presenting",src:e.id})})]})}function bn({model:e,name:t}){return D("overlay",`model-${t}`,Wo,{model:e},[e]),null}var Xi=require("react/jsx-runtime");function $o(){let{strategy:e}=V();return e.type!=="3d-model"?null:(0,Xi.jsx)(bn,{model:e.model})}var qe=require("react/jsx-runtime");function Uo({children:e}){let{strategy:t}=V(),[n]=lo();return t.type!=="images"?null:(0,qe.jsxs)(qe.Fragment,{children:[n?(0,qe.jsx)(Ct,{page:n}):null,t.annotations&&t.annotations.pages?t.annotations.pages.map(o=>(0,qe.jsx)(Ct,{page:o},o.id)):null,e]})}var Pe=require("react"),Rn=require("react/jsx-runtime"),Zi=(0,Pe.createContext)(null),Ji=(0,Pe.createContext)(null),ea=(0,Pe.createContext)(null);function ls(){let e=(0,Pe.useContext)(Zi);if(!e)throw new Error("Ctx not found");return e}function us(){let e=(0,Pe.useContext)(Ji);if(!e)throw new Error("Ctx not found");return e}function ms(){let e=(0,Pe.useContext)(ea);if(!e)throw new Error("Ctx not found");return e}function Ot({actions:e,state:t,children:n,currentTime:o,progress:r,element:a}){return(0,Rn.jsx)(ea.Provider,{value:{currentTime:o,progress:r,element:a},children:(0,Rn.jsx)(Ji.Provider,{value:e,children:(0,Rn.jsx)(Zi.Provider,{value:t,children:n})})})}var ta=require("react");var na=require("@iiif/helpers");function Ht(){let e=z(),t=P();return(0,ta.useMemo)(()=>{if(!e||!t||!e.start)return null;let n=(0,na.expandTarget)(e.start);return!n||n.source.id!==t.id||!n||!n.selector||n.selector.type!=="TemporalSelector"?null:n.selector.temporal},[e,t])}var An=require("react/jsx-runtime");function _o({media:e,startTime:t,children:n}){let[{element:o,currentTime:r,progress:a},i,s]=Be({duration:e.duration}),l=t?`${e.url}#t=${t}`:e.url;return(0,An.jsxs)(Ot,{state:i,actions:s,currentTime:r,progress:a,element:o,children:[(0,An.jsx)("audio",{ref:o,src:l}),n]})}function Pn({media:e,mediaControlsDeps:t,audioCopmonent:n=_o,children:o}){let r=Ht();return D("portal","audio",n,{media:e,startTime:r?r.startTime:null,children:o},[e,r,...t||[]]),null}var Yo=require("react/jsx-runtime");function We({x:e=0,y:t=0}){let n=P(),o=he({maxWidth:256,maxHeight:256});return!n||!o||o.type!=="fixed"?null:(0,Yo.jsx)("world-object",{height:n.height,width:n.width,x:e,y:t,children:(0,Yo.jsx)("world-image",{uri:o.id,target:{x:0,y:0,width:n.width,height:n.height},display:o.width&&o.height?{width:o.width,height:o.height}:void 0,crop:void 0})})}var $e=require("react/jsx-runtime");function Ko({as:e}){let{strategy:t}=V(),{renderMediaControls:n,mediaControlsDeps:o}=_();return t.type!=="media"||t.media.type!=="Sound"?null:(0,$e.jsx)($e.Fragment,{children:(0,$e.jsxs)(Pn,{media:t.media,mediaControlsDeps:o,audioCopmonent:e,children:[(0,$e.jsx)(We,{}),n?n(t):null]},t.media.url)})}var ye=require("react/jsx-runtime");function Qo(){let{strategy:e}=V(),{renderViewerControls:t,viewControlsDeps:n}=_(),o=P(),r=o?.accompanyingCanvas,a=o?.placeholderCanvas;return(0,ye.jsxs)(ye.Fragment,{children:[e.type==="media"&&e.media.type==="Sound"&&r?(0,ye.jsx)(oe,{canvas:r.id,children:(0,ye.jsx)(Ue,{renderViewerControls:t,viewControlsDeps:n})}):null,e.type==="media"&&e.media.type==="Sound"&&a&&!r?(0,ye.jsx)(oe,{canvas:a.id,children:(0,ye.jsx)(Ue,{renderViewerControls:t,viewControlsDeps:n})}):null]})}var Bt=require("react/jsx-runtime");function jo({element:e,media:t,startTime:n,playPause:o,poster:r}){let a="div",i=n?`${t.url}#t=${n}`:t.url;return(0,Bt.jsxs)(a,{className:"video-container",part:"video-container",onClick:o,children:[(0,Bt.jsx)("style",{children:`
|
|
17
|
+
`}),(0,Re.jsx)("div",{className:"model-container",children:(0,Re.jsx)("model-viewer",{"interaction-prompt":"none",style:{width:"100%",height:"100%"},"camera-controls":"","ar-status":"not-presenting",src:e.id})})]})}function bn({model:e,name:t}){return D("overlay",`model-${t}`,Wo,{model:e},[e]),null}var Xi=require("react/jsx-runtime");function $o(){let{strategy:e}=V();return e.type!=="3d-model"?null:(0,Xi.jsx)(bn,{model:e.model})}var qe=require("react/jsx-runtime");function Uo({children:e}){let{strategy:t}=V(),[n]=lo();return t.type!=="images"?null:(0,qe.jsxs)(qe.Fragment,{children:[n?(0,qe.jsx)(Ct,{page:n}):null,t.annotations&&t.annotations.pages?t.annotations.pages.map(o=>(0,qe.jsx)(Ct,{page:o},o.id)):null,e]})}var Pe=require("react"),Rn=require("react/jsx-runtime"),Zi=(0,Pe.createContext)(null),Ji=(0,Pe.createContext)(null),ea=(0,Pe.createContext)(null);function ls(){let e=(0,Pe.useContext)(Zi);if(!e)throw new Error("Ctx not found");return e}function us(){let e=(0,Pe.useContext)(Ji);if(!e)throw new Error("Ctx not found");return e}function ms(){let e=(0,Pe.useContext)(ea);if(!e)throw new Error("Ctx not found");return e}function Ot({actions:e,state:t,children:n,currentTime:o,progress:r,element:a}){return console.log(t.duration),(0,Rn.jsx)(ea.Provider,{value:{currentTime:o,progress:r,element:a},children:(0,Rn.jsx)(Ji.Provider,{value:e,children:(0,Rn.jsx)(Zi.Provider,{value:t,children:n})})})}var ta=require("react");var na=require("@iiif/helpers");function Ht(){let e=z(),t=P();return(0,ta.useMemo)(()=>{if(!e||!t||!e.start)return null;let n=(0,na.expandTarget)(e.start);return!n||n.source.id!==t.id||!n||!n.selector||n.selector.type!=="TemporalSelector"?null:n.selector.temporal},[e,t])}var An=require("react/jsx-runtime");function _o({media:e,startTime:t,children:n}){let[{element:o,currentTime:r,progress:a},i,s]=Be({duration:e.duration}),l=t?`${e.url}#t=${t}`:e.url;return(0,An.jsxs)(Ot,{state:i,actions:s,currentTime:r,progress:a,element:o,children:[(0,An.jsx)("audio",{ref:o,src:l}),n]},e.url)}function Pn({media:e,mediaControlsDeps:t,audioCopmonent:n=_o,children:o}){let r=Ht();return D("portal","audio",n,{media:e,startTime:r?r.startTime:null,children:o},[e,r,...t||[]]),null}var Yo=require("react/jsx-runtime");function We({x:e=0,y:t=0}){let n=P(),o=he({maxWidth:256,maxHeight:256});return!n||!o||o.type!=="fixed"?null:(0,Yo.jsx)("world-object",{height:n.height,width:n.width,x:e,y:t,children:(0,Yo.jsx)("world-image",{uri:o.id,target:{x:0,y:0,width:n.width,height:n.height},display:o.width&&o.height?{width:o.width,height:o.height}:void 0,crop:void 0})})}var $e=require("react/jsx-runtime");function Ko({as:e}){let{strategy:t}=V(),{renderMediaControls:n,mediaControlsDeps:o}=_();return t.type!=="media"||t.media.type!=="Sound"?null:(0,$e.jsx)($e.Fragment,{children:(0,$e.jsxs)(Pn,{media:t.media,mediaControlsDeps:o,audioCopmonent:e,children:[(0,$e.jsx)(We,{}),n?n(t):null]},t.media.url)})}var ye=require("react/jsx-runtime");function Qo(){let{strategy:e}=V(),{renderViewerControls:t,viewControlsDeps:n}=_(),o=P(),r=o?.accompanyingCanvas,a=o?.placeholderCanvas;return(0,ye.jsxs)(ye.Fragment,{children:[e.type==="media"&&e.media.type==="Sound"&&r?(0,ye.jsx)(oe,{canvas:r.id,children:(0,ye.jsx)(Ue,{renderViewerControls:t,viewControlsDeps:n})}):null,e.type==="media"&&e.media.type==="Sound"&&a&&!r?(0,ye.jsx)(oe,{canvas:a.id,children:(0,ye.jsx)(Ue,{renderViewerControls:t,viewControlsDeps:n})}):null]})}var Bt=require("react/jsx-runtime");function jo({element:e,media:t,startTime:n,playPause:o,poster:r}){let a="div",i=n?`${t.url}#t=${n}`:t.url;return(0,Bt.jsxs)(a,{className:"video-container",part:"video-container",onClick:o,children:[(0,Bt.jsx)("style",{children:`
|
|
18
18
|
.video-container {
|
|
19
19
|
position: absolute;
|
|
20
20
|
top: 0;
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{$ as Oo,$a as ye,A as ho,Aa as hr,B as yo,Ba as yr,C as vo,Ca as vr,D as xo,Da as xr,E as So,Ea as Sr,F as bo,Fa as br,G as Co,Ga as Cr,H as Io,Ha as Ir,I as ko,Ia as kr,J as Po,Ja as Pr,K as wo,Ka as wr,L as Ro,La as Rr,M as To,Ma as Tr,N as Eo,Na as Er,O as No,Oa as Nr,P as Bo,Pa as Br,Q as Mo,Qa as Mr,R as Lo,Ra as Lr,S as Ho,Sa as M,T as Ao,Ta as ge,U as se,Ua as Hr,V as zo,Va as Ar,W as qo,Wa as zr,X as le,Xa as qr,Y as Wo,Ya as Wr,Z as Do,Za as Dr,_ as Fo,_a as he,a as Zt,aa as $o,ab as Fr,b as q,ba as Vo,bb as Or,c as L,ca as Ko,cb as $r,d as jt,da as Uo,db as Vr,e as eo,ea as Xo,eb as Kr,f as to,fa as Yo,fb as Ur,g as re,ga as ce,gb as Xr,h as oo,ha as F,hb as Yr,i as ro,ia as _o,ib as _r,j as ne,ja as Q,jb as Qr,k as P,ka as w,kb as Gr,l as W,la as me,lb as Jr,m as no,ma as Qo,mb as Zr,n as ie,na as Go,nb as ve,o as D,oa as Jo,p as io,pa as Zo,q as ao,qa as ir,r as so,ra as ue,s as lo,sa as ar,t as co,ta as de,u as mo,ua as fe,v as uo,va as pe,w as ae,wa as O,x as fo,xa as sr,y as po,ya as pr,z as go,za as gr}from"./chunk-GEULRPL7.js";import{a as jo,b as er,c as tr,d as or,e as rr,f as nr,g as lr,h as cr,i as mr,j as ur,k as dr,l as fr}from"./chunk-XNDN34SQ.js";import{useCanvas as Ye}from"@atlas-viewer/atlas";import{forwardRef as _e,useImperativeHandle as Qe}from"react";import{Fragment as Ge,jsx as xe}from"react/jsx-runtime";var nn=_e(function({canvasId:t},o){let r=Ye(),n=ue(t||r?.id),a=P();return Qe(o,()=>n,[t,r]),!r||n.enabledPageIds.length===0?null:xe(Ge,{children:n.enabledPageIds.map(s=>xe(ve.RenderAnnotationPage,{page:a.get(s)},s))})});import{useMemo as je}from"react";import{useMemo as Je}from"react";import{Fragment as Ze,jsx as I,jsxs as $}from"react/jsx-runtime";function V({metadata:e=[],config:t,labelWidth:o=16,showEmptyMessage:r=!0,allowHtml:n,emptyFallback:a,classes:s={},emptyMessage:l="No metadata available",emptyValueFallback:d="No value",emptyLabelFallback:f="",separator:c,tableFooter:p,tableHeader:S}){let b=Je(()=>{let h=(t||[]).reduce((u,g)=>[...u,...g.keys],[]),m={};for(let u of e){let g=u&&u.label?Object.values(u.label):[];for(let i of g)if(i&&i.length&&(h.indexOf(`metadata.${i[0]}`)!==-1||h.length===0)&&u){let y=`metadata.${i[0]}`;m[y]=m[y]?m[y]:[],m[y].push(u);break}}return m},[t,e]);return Object.keys(b).length===0&&r?I(Ze,{children:a})||I("div",{className:s.empty,children:l}):t&&t.length?$("table",{className:s.container,children:[S,I("tbody",{children:t.map((h,m)=>{let u=[];for(let g of h.keys)for(let i of b[g]||[])u.push(I(M,{enableDangerouslySetInnerHTML:n,defaultText:d,separator:c,children:i.value},m+"__"+g));return u.length===0?null:$("tr",{className:s.row,children:[I("td",{className:s.label,style:o?{minWidth:o}:{},children:I(M,{enableDangerouslySetInnerHTML:n,separator:c,defaultText:f,children:h.label})}),I("td",{className:s.value,children:u})]},m)})}),p]}):$("table",{className:s.container,children:[S,I("tbody",{children:e&&e.length?e.map((h,m)=>h?$("tr",{className:s.row,children:[I("td",{className:s.label,style:o?{minWidth:o}:{},children:I(M,{enableDangerouslySetInnerHTML:n,defaultText:d,separator:c,children:h.label})}),I("td",{className:s.value,children:I(M,{enableDangerouslySetInnerHTML:n,defaultText:d,separator:c,children:h.value})})]},m):null):null}),p]})}import{jsx as et}from"react/jsx-runtime";function vn(e){let t=D(),o=w(),r=ae(),n=je(()=>{let a=t?.metadata||[],s=o?.metadata||[],l=r?.metadata||[];return[...a,...s,...l]},[t,o,r]);return et(V,{metadata:n,...e})}import{useEffect as nt,useState as it}from"react";import{createImageServiceRequest as tt,imageServiceRequestToString as ot}from"@iiif/parser/image-3";import{useMemo as rt}from"react";function G(e,t={},o=[]){return rt(()=>{if(!e)return null;let r=t.quality;e&&e.extraQualities&&t.quality&&(e.extraQualities.includes(t.quality)||(r="default"));let n=tt(e);return ot({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 K}from"react/jsx-runtime";function at(e){let t=typeof e.src=="string"?e.src:e.src.id,o=he(),[r,n]=it(!1),a;if(t){let l=o.loadServiceSync({id:t});l&&(a=l)}!a&&!r&&o.loadService({id:t}).then(()=>{n(!0)});let s=G(a,{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 nt(()=>()=>{n(!1)},[t]),s?K("img",{src:s,alt:e.alt,className:e.className,style:e.style}):K(st,{...e,fetchImageService:!1})}function st(e){if(e.fetchImageService)return K(at,{...e});let t=typeof e.src=="string"?{id:e.src,profile:"level0"}:e.src,o=G(t,{size:e.size,selector:e.region,rotation:e.rotation,format:e.format,region:e.region,quality:e.quality},[e.src,e.size,e.region,e.rotation,e.format,e.region,e.quality]);return o?K("img",{src:o,alt:e.alt,className:e.className,style:e.style}):null}import{jsx as lt}from"react/jsx-runtime";function Hn(e){let t=D();return lt(V,{metadata:t?.metadata||[],...e})}import{useLayoutEffect as ft,useRef as pt}from"react";import*as J from"react-lazy-load-image-component";import{getValue as ct}from"@iiif/helpers/i18n";import{Fragment as Se,jsx as R,jsxs as dt}from"react/jsx-runtime";var{LazyLoadComponent:mt}=J||J.default;function be(e){let{size:t,visible:o,classes:r,canvasId:n,figure:a}=e,s=t?.width||128,l=t?.height||t?.width||128,d=R(ut,{...e}),f=R(mt,{threshold:300,style:{height:l,width:s},visibleByDefault:o,children:n?R(ne,{canvas:n,children:d}):d});return a?R("figure",{className:r?.figure,children:f}):f}function ut({fallback:e,size:t,classes:o,showLabel:r,alt:n,dereference:a=!1}){let s=w(),l=t?.width||128,d=t?.height||t?.width||128,f=n||ct(s?.label)||"",c=ye({width:l,height:d,allowUnsafe:!0},a);return!c||c.type!=="fixed"?R(Se,{children:e}):dt(Se,{children:[R("div",{className:o?.imageWrapper,children:R("img",{className:o?.img,src:c.id,alt:f})}),r?R(M,{as:"figcaption",className:o?.label,children:s?.label}):null]})}import{jsx as H}from"react/jsx-runtime";function Yn({scrollBehaviour:e,dereference:t,flat:o,size:r,classes:n={},showLabel:a,figure:s,fallback:l}){let d=pt(null),{items:f,sequence:c,currentSequenceIndex:p,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};ft(()=>{if(!d.current)return;let h=d.current.querySelector("[data-selected=true]");h&&h.scrollIntoView({behavior:e||"instant",block:"nearest",inline:"center"})},[p]);let C=[];for(let h of c){let m=[],u=c[p]===h;for(let g of h){let i=f[g];m.push(H("div",{className:u?b.item:n.item,children:H(be,{classes:u?b:n,canvasId:i.id,size:r,dereference:t,showLabel:a,figure:s,placeholder:H("div",{style:{height:128,width:128}}),fallback:l})},g))}if(o){C.push(m);continue}C.push(H("div",{onClick:g=>{S(c.indexOf(h))},"data-selected":u,className:u?b.row:n.row,children:m},h.join("-")))}return H("div",{ref:d,className:n.container,children:C})}import{Fragment as Ce,jsx as T,jsxs as Ie}from"react/jsx-runtime";var gt={draw:!0,polygon:!0,line:!0,lineBox:!0,square:!0,triangle:!0,hexagon:!0,circle:!0,delete:!0};function Gn({helper:e,showShapes:t,state:o,enabled:r=gt,classNames:n={},icons:a={}}){return Ie(Ce,{children:[t?Ie(Ce,{children:[r.draw&&T("button",{className:n.button,onClick:()=>{e.stamps.clear(),e.draw.enable()},"data-active":!o.lineMode&&!o.selectedStamp&&t&&o.drawMode,children:a.DrawIcon||"Draw"}),r.polygon&&T("button",{className:n.button,"data-active":!o.lineMode&&!o.selectedStamp&&t&&!o.drawMode,onClick:()=>{e.stamps.clear(),e.draw.disable(),e.modes.disableLineBoxMode(),e.modes.disableLineMode()},children:a.PolygonIcon||"Polygon"}),r.line&&T("button",{className:n.button,"data-active":o.lineMode&&!o.lineBoxMode,onClick:()=>{e.modes.enableLineMode()},children:a.LineIcon||"Line"}),r.lineBox&&T("button",{className:n.button,"data-active":o.lineBoxMode,onClick:()=>{e.modes.enableLineBoxMode()},children:a.LineBoxIcon||"LineBox"}),r.square&&T("button",{className:n.button,"data-active":o.selectedStamp?.id==="square",onClick:()=>{e.stamps.square()},children:a.SquareIcon||"Square"}),r.triangle&&T("button",{className:n.button,"data-active":o.selectedStamp?.id==="triangle",onClick:()=>{e.stamps.triangle()},children:a.TriangleIcon||"Triangle"}),r.hexagon&&T("button",{className:n.button,"data-active":o.selectedStamp?.id==="hexagon",onClick:()=>{e.stamps.hexagon()},children:a.HexagonIcon||"Hexagon"})]}):null,o.showBoundingBox&&r.delete&&T("button",{className:n.button,onClick:()=>e.key.down("Backspace"),children:a.DeleteForeverIcon||"Delete"})]})}import{createContext as ht,useCallback as ke,useContext as we,useEffect as Pe,useMemo as Z,useState as yt}from"react";import Re from"mitt";import{jsx as vt}from"react/jsx-runtime";var U=ht(Re());U.displayName="SelectorHelper";function ni({children:e}){return vt(U.Provider,{value:Z(()=>Re(),[]),children:e})}function ii(){return we(U)}function Te(e){let t=Ee(),[o,r]=yt(!1);Pe(()=>t.withSelector(e).on("highlight",()=>{r(!0)}),[t,e]),Pe(()=>t.withSelector(e).on("clear-highlight",()=>{r(!1)}),[t,e]);let n=ke(s=>{t.emit("click",{selectorId:e,event:s})},[e,t]),a=ke(s=>{t.emit("hover",{selectorId:e,event:s})},[e,t]);return{controller:t,onClick:n,onHover:a,isHighlighted:o}}function Ee(){let e=we(U);return Z(()=>({withSelector(t){return{on(o,r){let n=a=>{a&&a.selectorId===t&&r(a)};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 ai(){let e=Ee();return Z(()=>({withSelector(t){return{highlight(){e.emit("highlight",{selectorId:t})},clearHighlight(){e.emit("clear-highlight",{selectorId:t})},zoomTo(){e.emit("zoom-to",{selectorId:t})},addEventListener(o,r){return e.emit("event-listener",{selectorId:t,name:o,callback:r}),()=>{e.emit("remove-event-listener",{selectorId:t,name:o,callback:r})}},getImagePreview(){return new Promise((o,r)=>{e.emit("image-preview-request",{selectorId:t,resolve:o,reject:r})})},on(o,r){return e.withSelector(t).on(o,r)}}},highlight(t){e.emit("highlight",{selectorId:t})},clearHighlight(t){e.emit("clear-highlight",{selectorId:t})},zoomTo(t){e.emit("zoom-to",{selectorId:t})},addEventListener(t,o,r){return e.emit("event-listener",{selectorId:t,name:o,callback:r}),()=>{e.emit("remove-event-listener",{selectorId:t,name:o,callback:r})}},getImagePreview(t){return new Promise((o,r)=>{e.emit("image-preview-request",{selectorId:t,resolve:o,reject:r})})},on(t,o){return e.on(t,o)}}),[e])}import{createContext as xt,useContext as St,useMemo as bt}from"react";import{jsx as Ct}from"react/jsx-runtime";function Ne(){return{default:{backgroundColor:"rgba(0,0,0,0)",borderWidth:"2px",borderColor:"rgba(252,0,98, .5)"},highlighted:{backgroundColor:"rgba(75, 103, 225, 0.4)",borderWidth:"1px",borderColor:"rgba(75,103,225,0.99)"},hidden:{borderWidth:"0px",borderColor:"rgba(0,0,0,0)",backgroundColor:"rgba(0,0,0,0)",hidden:!0}}}var j=xt(Ne());j.displayName="AnnotationStyle";function Be(){return St(j)}function mi({theme:e,children:t}){let o=bt(()=>e||Ne(),[e]);return Ct(j.Provider,{value:o,children:t})}import{HTMLPortal as Tt,useAtlas as Et}from"@atlas-viewer/atlas";import{useEffect as Le,useRef as E,useState as He}from"react";import{useEffect as It,useMemo as kt,useState as Pt}from"react";import{createHelper as wt}from"polygon-editor";function Me(e,t,o){let[r,n]=Pt({}),a=kt(()=>wt(e,o),[]);return It(()=>(a.clock.start(t,n),()=>{a.clock.stop()}),[]),{state:r,helper:a}}import{createSvgHelpers as Rt}from"polygon-editor";import{Fragment as Ae,jsx as x,jsxs as ze}from"react/jsx-runtime";var N=Rt();function qe(e,t){let{image:o,currentShape:r,onChange:n,hideShapeLines:a}=e,s=E(),l=E(),d=E(),f=E(),c=E(),p=E(),S=E(),b=E(),[C,h]=He(null),[m,u]=He(!1),{helper:g,state:i}=Me(r,(v,k)=>{N.updateTransitionBoundingBox(l.current,v,k),N.updateBoundingBoxPolygon(s.current,v,k),N.updateTransitionShape(p.current,v,k),N.updateClosestLinePointTransform(f.current,v,k),N.updateSelectBox(d.current,v,k),N.updatePointLine(S.current,v,k),N.updateDrawPreview(c.current,v,k,3),N.updateLineBox(b.current,v),h(v.transitionDirection),u(v.transitionRotate)},n);Le(()=>{g.setShape(r||null)},t),Le(()=>{let v=()=>{g.modifiers.reset()};return document.addEventListener("mouseleave",v),()=>{document.removeEventListener("mouseleave",v)}},[]);let y=ze(Ae,{children:[x("marker",{id:"dot",viewBox:"0 0 10 10",refX:"5",refY:"5",markerWidth:"5",markerHeight:"5",children:x("circle",{cx:"5",cy:"5",r:"4",className:"marker"})}),x("marker",{id:"selected",viewBox:"0 0 10 10",refX:"5",refY:"5",markerWidth:"5",markerHeight:"5",children:x("circle",{cx:"5",cy:"5",r:"4",fill:"#FAFF00"})}),x("marker",{id:"resizer",viewBox:"0 0 10 10",refX:"5",refY:"5",markerWidth:"5",markerHeight:"5",children:x("rect",{width:"10",height:"10",stroke:"#FF0DCB",fill:"#fff",strokeWidth:2})})]}),B=r?r.open?"polyline":"polygon":null,oe=!i.showBoundingBox&&i.closestPoint!==null&&i.actionIntentType==="select-point",Ke=i.actionIntentType==="add-open-point",Ue=i.transitionIntentType==="split-line",_=i.transitioning&&i.selectedStamp&&i.transitionIntentType==="stamp-shape",Xe=r&&B?ze(Ae,{children:[x(B,{fill:!i.transitioning&&i.showBoundingBox?"rgba(255, 0, 0, .5)":"none",strokeWidth:_?0:2,stroke:a?"transparent":"#000",points:r.points.map(v=>v.join(",")).join(" "),vectorEffect:"non-scaling-stroke",markerStart:i.showBoundingBox?void 0:"url(#dot)",markerMid:i.showBoundingBox?void 0:"url(#dot)",markerEnd:i.showBoundingBox?void 0:"url(#dot)",style:{pointerEvents:"none"}}),i.lineBoxMode&&i.actionIntentType==="close-line-box"?x("polygon",{fill:"rgba(255, 0, 0, .4)",ref:b,stroke:"#000",strokeWidth:2,vectorEffect:"non-scaling-stroke"}):null,i.transitionIntentType==="draw-shape"&&i.transitioning?x("polyline",{ref:c,fill:"none",stroke:"rgba(255, 0, 0, .5)",strokeWidth:2,vectorEffect:"non-scaling-stroke"}):null,!i.showBoundingBox&&i.selectedPoints&&i.selectedPoints.length?x("polyline",{strokeWidth:2,vectorEffect:"non-scaling-stroke",stroke:"transparent",markerStart:"url(#selected)",markerMid:"url(#selected)",markerEnd:"url(#selected)",fill:"transparent",points:r.points.filter((v,k)=>i.selectedPoints?.includes(k)).map(v=>v.join(",")).join(" ")}):null,oe&&i.closestPoint!==null&&r.points[i.closestPoint]?x("polyline",{strokeWidth:2,vectorEffect:"non-scaling-stroke",stroke:"transparent",markerStart:"url(#selected)",markerMid:"url(#selected)",markerEnd:"url(#selected)",fill:"transparent",points:`${r.points[i.closestPoint][0]},${r.points[i.closestPoint][1]}`}):null,!i.transitioning&&(i.actionIntentType==="add-open-point"||i.actionIntentType==="close-shape"||i.actionIntentType==="close-shape-line")?x("polyline",{stroke:"#000",ref:S,strokeWidth:i.actionIntentType==="close-shape"?2:1,vectorEffect:"non-scaling-stroke"}):null,i.hasClosestLine&&(!i.transitionIntentType||i.transitionIntentType==="split-line")?x("g",{ref:f,children:x("polyline",{style:{opacity:.5},markerStart:"url(#dot)",points:"0,0 10,10",vectorEffect:"non-scaling-stroke",fill:"transparent",strokeWidth:2})}):null,i.transitioning?x(B,{ref:p,fill:r.open?"none":"rgba(255, 0, 0, .5)",stroke:"rgba(255, 0, 0, .5)",strokeWidth:r.open?2:0}):null,i.transitioning&&i.transitionIntentType==="select-multiple-points"?x("rect",{ref:d,fill:"rgba(255, 255, 255, .3)",strokeWidth:1,stroke:"rgba(0,0,0,.2)",vectorEffect:"non-scaling-stroke"}):null,i.showBoundingBox?null:x("g",{name:"controls",children:!1}),i.showBoundingBox&&!_?x("polygon",{ref:s,strokeWidth:2,stroke:"#FF0DCB",fill:"none",markerStart:"url(#resizer)",markerMid:"url(#resizer)",markerEnd:"url(#resizer)",vectorEffect:"non-scaling-stroke"}):null]}):null;return{helper:g,state:i,isAddingPoint:Ke,isSplitting:Ue,isStamping:_,isHoveringPoint:oe,transitionDirection:C,transitionRotate:m,defs:y,editor:Xe}}import{useEffect as ee}from"react";import{createPortal as Nt}from"react-dom";import{Fragment as We,jsx as A,jsxs as X}from"react/jsx-runtime";var Bt=[{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 De(e){let t=e.theme||Bt[0],o=Et(),{image:r}=e,{helper:n,defs:a,editor:s,state:l,transitionDirection:d,isSplitting:f,transitionRotate:c,isHoveringPoint:p,isAddingPoint:S,isStamping:b}=qe({currentShape:e.shape||null,onChange:e.updateShape,image:e.image,hideShapeLines:!0},[]),C=i=>{n.pointer([[~~i.atlas.x,~~i.atlas.y]])};ee(()=>{let i=y=>{n.key.up(y.key)};return document.addEventListener("keyup",i),()=>{document.removeEventListener("keyup",i)}},[]),ee(()=>{let i=y=>{n.key.down(y.key)};return document.addEventListener("keydown",i),()=>{document.removeEventListener("keydown",i)}},[]),ee(()=>{let i=[];return d&&i.push(`atlas-cursor-${d}`),l.actionIntentType==="cut-line"&&l.modifiers?.Shift&&i.push("atlas-cursor-cut"),(p||l.transitionIntentType==="move-shape"||l.transitionIntentType==="move-point")&&i.push("atlas-cursor-move"),S&&i.push("atlas-cursor-crosshair"),f&&i.push("atlas-cursor-copy"),c&&i.push("atlas-cursor-rotate"),l.transitionIntentType==="draw-shape"&&i.push("atlas-cursor-draw"),o?.canvas&&o.canvas.classList.add(...i),()=>{o?.canvas&&o.canvas.classList.remove(...i)}},[o?.canvas,S,p,f,l.modifiers?.Shift,l.actionIntentType,l.transitionIntentType,d,c]);let h=e.shape&&e.shape?.points.length===0,m=e.renderControls?e.renderControls(n,l,h):null,u=document.getElementById(e.controlsHtmlId||"atlas-controls"),g="shape";return A(We,{children:X("world-object",{height:r.height,width:r.width,onMouseMove:C,onMouseDown:n.pointerDown,onMouseUp:n.pointerUp,onMouseLeave:n.blur,children:[e.shape?X(We,{children:[A(g,{open:e.shape.open,points:e.shape.points,relativeStyle:!0,style:b?{}:t.outer}),A(g,{open:e.shape.open,points:e.shape.points,relativeStyle:!0,style:b?{}:t.inner})]}):null,X(Tt,{relative:!0,interactive:!1,children:[A("div",{style:{position:"absolute",top:0,right:0,left:0,bottom:0},children:X("svg",{width:"100%",height:"100%",viewBox:`0 0 ${r.width} ${r.height}`,tabIndex:-1,children:[A("defs",{children:a}),s]})}),u?Nt(m,u,"controls"):null]})]})})}import{jsx as Fe}from"react/jsx-runtime";function Di(e){let t=w(),o=e.annotationBucket,r=e.readOnly,n=e.id,{onClick:a,isHighlighted:s}=Te(e.id),l=Be(),d=s?l.highlighted:l[o||"hidden"]||l.hidden;if(!t)return null;if(r){let f="shape",c=e.polygon,p=c.open;return c?Fe(f,{id:`shape-${n}`,points:c.points,open:p,onClick:a,relativeStyle:!0,target:{x:0,y:0,width:t.width,height:t.height},style:d}):null}return Fe(De,{image:t,shape:e.polygon||{id:e.id,open:!0,points:[]},updateShape:e.updatePolygon,theme:e.theme,controlsHtmlId:e.controlsHtmlId,renderControls:e.renderControls})}import{useMemo as Mt,useState as Lt}from"react";import{ErrorBoundary as Ht}from"react-error-boundary";import{jsx as z,jsxs as zt}from"react/jsx-runtime";function Gi({src:e,errorFallback:t,interactive:o,skipSizes:r,children:n,renderViewerControls:a,viewControlsDeps:s,fluid:l,x:d,y:f,...c}){let[p,S]=Lt(),b=t||ce,[C,h]=pe(),m=Mt(()=>{let g=h[e]?.status,i=C({id:e},{});return i?.height&&i.width&&g!=="loading"?{id:e,width:i.width,height:i.height,service:i,type:"Image",selector:{type:"BoxSelector",spatial:{x:0,y:0,width:i.width,height:i.height}},target:{type:"BoxSelector",spatial:{x:0,y:0,width:i.width,height:i.height}}}:null},[C,e,h]);if(Q(p&&a?"overlay":"none",`canvas-portal-controls-${e}`,F.Provider,a&&m?{value:p||null,children:a({image:m,images:[m],type:"images"})}:{},[e,m,p,...s||[]]),!m||!m.height||!m.width)return null;let u=l?void 0:c.homePosition?c.homePosition.width/c.homePosition.height:m.width/m.height;return console.log("here",u),z(Ht,{resetKeys:[],fallbackRender:g=>z(b,{...c,...g}),children:z(me,{...c,aspectRatio:u,containerProps:{style:{position:"relative"},...c.containerProps||{}},onCreated:g=>{S(g),c.onCreated&&c.onCreated(g)},children:zt(F.Provider,{value:p,children:[z(ge,{image:m,id:m.id,isStatic:!o,x:d,y:f},m.id),z(At,{viewerPreset:p,renderViewerControls:a,image:m,src:e,viewControlsDeps:s}),n]})})})}function At({viewerPreset:e,renderViewerControls:t,image:o,src:r,viewControlsDeps:n}){return Q(e&&t?"overlay":"none",`canvas-portal-controls-${r}`,F.Provider,t&&o?{value:e||null,children:t({image:o,images:[o],type:"images"})}:{},[r,e,...n||[]]),null}import{jsx as qt}from"react/jsx-runtime";function ea({annotation:e,children:t}){return qt(L,{value:{annotation:e},children:t})}import{jsx as Wt}from"react/jsx-runtime";function na({annotationPage:e,children:t}){return Wt(L,{value:{annotationPage:e},children:t})}import{jsx as Dt}from"react/jsx-runtime";function la({collection:e,children:t}){return Dt(L,{value:{collection:e},children:t})}function da(e,t={}){return O(t)}import{useCanvas as Ft}from"@atlas-viewer/atlas";import{useEffect as Ot,useMemo as te,useState as $t}from"react";function va({canvasId:e}={}){let t=Ft(),o=ie(),r=te(()=>e?[e]:t?[t.id]:o.map(f=>f.id),[e,t,o]),[n,a]=$t({}),s=le();Ot(()=>{let f=c=>{let p=c.partOf.canvasId;p&&a(S=>({...S,[p]:c.choice}))};return s.on("choice-change",f),()=>{s.off("choice-change",f)}},[]);let l=te(()=>{let f=[];for(let c of r){let p=n[c];p&&f.push({canvasId:c,choice:p})}return f},[r,n]),d=te(()=>({makeChoice:(f,c)=>{s.emit("make-choice",{choiceId:f,...c})}}),[s]);return{choices:l,actions:d}}function Sa(e,t=!1){}function ka(e){let o=q().manifest,r=e?e.map(n=>typeof n=="string"?n:n?.id):[];return W(n=>{let a=o?n.iiif.entities.Manifest[o]:void 0,s=a?.items||[];if(typeof e>"u")return s;let l=[];for(let d of a?.items||[])r.indexOf(d.id)!==-1&&l.push(d);return l},[r.join("/")])}import{useMemo as Vt}from"react";function Ea(e,t=[]){let{id:o,selector:r}=e,n=q(),a=o||n.collection,s=W(l=>a?l.iiif.entities.Collection[a]:void 0,[a]);return Vt(()=>{if(s)return r?r(s):s},[s,r,...t])}import{useEffect as Kt,useMemo as Ut}from"react";import{createEventsHelper as Xt}from"@iiif/helpers/events";function Ha(e,t,o,r,n=[]){let a=P(),s=Ut(()=>Xt(a),[a]);Kt(()=>{let l=e;return l?(s.addEventListener(l,t,o,r),()=>{s.removeEventListener(l,t,o)}):()=>{}},[s,e,t,...n])}function Wa(e,t){let{id:o,isLoaded:r,error:n,resource:a,requestId:s,cached:l}=re(e,t);return{id:o,isLoaded:r,error:n,manifest:a,requestId:s,cached:l}}import{getImageServices as Oe}from"@iiif/parser/image-3";import{useEffect as Yt,useMemo as $e,useState as Y}from"react";function Ve({cacheKey:e}={}){let t=w(),o=O(),r=P(),n=de(),a=fe(),[s,l]=Y(void 0),[d,f]=Y(!1),[c,p]=Y("idle"),[S,b]=Y(void 0),C=t?t.id:"undefined",h=$e(()=>{try{if(t&&o.length){let u=o[0],g=r.get(u.body[0]),y=Oe(g)[0];return y&&n(y,{width:y.width||t.width,height:y.height||t.height},!0)||void 0}}catch(u){console.error(u)}},[C,e,t]),m=c==="success"&&s?s:h;return Yt(()=>{(async()=>{try{if(t&&o.length){let u=o[0],g=r.get(u.body[0]),y=Oe(g)[0];if(!y)return;f(!0),p("loading");try{let B=await a(y,{width:y.width||t.width,height:y.height||t.height})||void 0;l(B),p("success"),f(!1)}catch(B){p("error"),b(B)}}}catch(u){p("error"),b(u)}})()},[C,e]),$e(()=>({data:m,isFetching:d,status:c,error:S}),[m,d,c,S])}function _a(){let e=Ve();return{isLoading:e.isFetching,tile:e.data?{id:e.data.id||e.data["@id"],width:e.data.width,height:e.data.height,imageService:e.data,thumbnail:void 0}:null}}import{createStylesHelper as _t}from"@iiif/helpers/styles";import{useMemo as Qt}from"react";function ja(){let e=P();return Qt(()=>_t(e),[e])}export*from"@iiif/helpers/annotation-targets";export{ea as AnnotationContext,na as AnnotationPageContext,mi as AnnotationStyleProvider,Bo as Auth,Io as AuthProvider,So as AuthRContext,bo as AuthReactContext,Co as AuthReactContextActions,nn as CanvasAnnotations,ne as CanvasContext,ve as CanvasPanel,xr as CanvasStrategyProvider,Sr as CanvasWorldObject,la as CollectionContext,vn as CombinedMetadata,Hr as ComplexTimelineProvider,Vo as ContextBridge,yr as ControlsReactContext,De as CreateCustomShape,Fo as CustomContextBridge,Oo as CustomContextBridgeProvider,Wo as EventsProvider,st as Image,Gi as ImageService,Dr as ImageServiceLoaderContext,Ho as InnerViewerProvider,Pr as LanguageProvider,Nr as LanguageString,M as LocaleString,ro as ManifestContext,Hn as ManifestMetadata,Xr as MediaPlayerProvider,V as Metadata,Di as PolygonSelector,io as RangeContext,qo as ReactEventContext,jt as ReactVaultContext,Or as Render3DModelStrategy,Gr as RenderAccompanyingCanvas,$r as RenderAnnotationStrategy,Qr as RenderAudioStrategy,zr as RenderComplexTimelineStrategy,br as RenderEmptyStrategy,Fr as RenderImageStrategy,Gn as RenderSvgEditorControls,qr as RenderTextualContentStrategy,Jr as RenderVideoStrategy,Zr as RenderYouTubeStrategy,L as ResourceProvider,Zt as ResourceReactContext,ni as SelectorControllerProvider,Yn as SequenceThumbnails,Ao as SimpleViewerProvider,Lo as SimpleViewerReactContext,be as SingleCanvasThumbnail,gr as StrategyReactContext,_r as ThumbnailFallbackImage,kr as TranslationProvider,wr as TransliterationProvider,eo as VaultProvider,F as ViewerPresetContext,Yo as VirtualAnnotationProvider,no as VisibleCanvasReactContext,yo as authDetailsForResource,go as createAuthStateStore,ho as createProbe,zo as defaultEmitter,tr as emptyActions,nr as emptyStrategy,so as findAllCanvasesInRange,ao as findFirstCanvasFromRange,lo as findManifestSelectedRange,co as findSelectedRange,ir as flattenAnnotationPageIds,Cr as formatTime,lr as get3dStrategy,dr as getComplexTimelineStrategy,Ne as getDefaultAnnotationStyles,cr as getImageStrategy,uo as getManifestSequence,er as getParsedTargetSelector,fr as getRenderingStrategy,mr as getTextualContentStrategy,ur as getVideoStrategy,mo as getVisibleCanvasesFromCanvasId,po as hasAuth,xo as makeAccessServiceRequest,vo as makeAccessTokenRequest,jo as parseSpecificResource,Bt as svgThemes,or as unknownResponse,rr as unsupportedStrategy,Jo as useAnnotation,Zo as useAnnotationPage,ue as useAnnotationPageManager,Be as useAnnotationStyles,da as useAnnotationsAtTime,wo as useAuthActions,To as useAuthService,Po as useAuthStore,No as useAuthToken,Eo as useAuthTokens,w as useCanvas,va as useCanvasChoices,Sa as useCanvasClock,fo as useCanvasSequence,Yr as useCanvasStartTime,ka as useCanvasSubset,Br as useClosestLanguage,Ea as useCollection,Ar as useComplexTimeline,$o as useContextBridge,Lr as useCreateLocaleString,Ro as useCurrentAuth,Do as useCustomContextBridge,Ko as useDispatch,le as useEventEmitter,Ha as useEventListener,to as useExistingVault,Wa as useExternalCollection,oo as useExternalManifest,re as useExternalResource,Tr as useIIIFLanguage,G as useImage,Ve as useImageService,he as useImageServiceLoader,_a as useImageTile,ko as useIsAuthEnabled,pe as useLoadImageService,Mr as useLocaleString,D as useManifest,Kr as useMediaActions,Ur as useMediaElements,Vr as useMediaState,sr as usePaintables,O as usePaintingAnnotations,Me as usePolygonHelper,ae as useRange,vr as useRenderControls,pr as useRenderingStrategy,q as useResourceContext,Qo as useResourceEvents,ar as useResources,Mo as useSearchService,Ee as useSelectorController,ii as useSelectorEmitter,Te as useSelectorEvents,ai as useSelectorHelper,Ir as useSimpleMediaPlayer,se as useSimpleViewer,hr as useStrategy,ja as useStyleHelper,Go as useStyles,qe as useSvgEditor,ye as useThumbnail,Er as useTranslations,Rr as useTransliteration,P as useVault,Wr as useVaultEffect,W as useVaultSelector,_o as useViewerPreset,Uo as useVirtualAnnotationPage,Xo as useVirtualAnnotationPageContext,ie as useVisibleCanvases};
|
|
1
|
+
import{$ as Oo,$a as ye,A as ho,Aa as hr,B as yo,Ba as yr,C as vo,Ca as vr,D as xo,Da as xr,E as So,Ea as Sr,F as bo,Fa as br,G as Co,Ga as Cr,H as Io,Ha as Ir,I as ko,Ia as kr,J as Po,Ja as Pr,K as wo,Ka as wr,L as Ro,La as Rr,M as To,Ma as Tr,N as Eo,Na as Er,O as No,Oa as Nr,P as Bo,Pa as Br,Q as Mo,Qa as Mr,R as Lo,Ra as Lr,S as Ho,Sa as M,T as Ao,Ta as ge,U as se,Ua as Hr,V as zo,Va as Ar,W as qo,Wa as zr,X as le,Xa as qr,Y as Wo,Ya as Wr,Z as Do,Za as Dr,_ as Fo,_a as he,a as Zt,aa as $o,ab as Fr,b as q,ba as Vo,bb as Or,c as L,ca as Ko,cb as $r,d as jt,da as Uo,db as Vr,e as eo,ea as Xo,eb as Kr,f as to,fa as Yo,fb as Ur,g as re,ga as ce,gb as Xr,h as oo,ha as F,hb as Yr,i as ro,ia as _o,ib as _r,j as ne,ja as Q,jb as Qr,k as P,ka as w,kb as Gr,l as W,la as me,lb as Jr,m as no,ma as Qo,mb as Zr,n as ie,na as Go,nb as ve,o as D,oa as Jo,p as io,pa as Zo,q as ao,qa as ir,r as so,ra as ue,s as lo,sa as ar,t as co,ta as de,u as mo,ua as fe,v as uo,va as pe,w as ae,wa as O,x as fo,xa as sr,y as po,ya as pr,z as go,za as gr}from"./chunk-YF4SEMKW.js";import{a as jo,b as er,c as tr,d as or,e as rr,f as nr,g as lr,h as cr,i as mr,j as ur,k as dr,l as fr}from"./chunk-XNDN34SQ.js";import{useCanvas as Ye}from"@atlas-viewer/atlas";import{forwardRef as _e,useImperativeHandle as Qe}from"react";import{Fragment as Ge,jsx as xe}from"react/jsx-runtime";var nn=_e(function({canvasId:t},o){let r=Ye(),n=ue(t||r?.id),a=P();return Qe(o,()=>n,[t,r]),!r||n.enabledPageIds.length===0?null:xe(Ge,{children:n.enabledPageIds.map(s=>xe(ve.RenderAnnotationPage,{page:a.get(s)},s))})});import{useMemo as je}from"react";import{useMemo as Je}from"react";import{Fragment as Ze,jsx as I,jsxs as $}from"react/jsx-runtime";function V({metadata:e=[],config:t,labelWidth:o=16,showEmptyMessage:r=!0,allowHtml:n,emptyFallback:a,classes:s={},emptyMessage:l="No metadata available",emptyValueFallback:d="No value",emptyLabelFallback:f="",separator:c,tableFooter:p,tableHeader:S}){let b=Je(()=>{let h=(t||[]).reduce((u,g)=>[...u,...g.keys],[]),m={};for(let u of e){let g=u&&u.label?Object.values(u.label):[];for(let i of g)if(i&&i.length&&(h.indexOf(`metadata.${i[0]}`)!==-1||h.length===0)&&u){let y=`metadata.${i[0]}`;m[y]=m[y]?m[y]:[],m[y].push(u);break}}return m},[t,e]);return Object.keys(b).length===0&&r?I(Ze,{children:a})||I("div",{className:s.empty,children:l}):t&&t.length?$("table",{className:s.container,children:[S,I("tbody",{children:t.map((h,m)=>{let u=[];for(let g of h.keys)for(let i of b[g]||[])u.push(I(M,{enableDangerouslySetInnerHTML:n,defaultText:d,separator:c,children:i.value},m+"__"+g));return u.length===0?null:$("tr",{className:s.row,children:[I("td",{className:s.label,style:o?{minWidth:o}:{},children:I(M,{enableDangerouslySetInnerHTML:n,separator:c,defaultText:f,children:h.label})}),I("td",{className:s.value,children:u})]},m)})}),p]}):$("table",{className:s.container,children:[S,I("tbody",{children:e&&e.length?e.map((h,m)=>h?$("tr",{className:s.row,children:[I("td",{className:s.label,style:o?{minWidth:o}:{},children:I(M,{enableDangerouslySetInnerHTML:n,defaultText:d,separator:c,children:h.label})}),I("td",{className:s.value,children:I(M,{enableDangerouslySetInnerHTML:n,defaultText:d,separator:c,children:h.value})})]},m):null):null}),p]})}import{jsx as et}from"react/jsx-runtime";function vn(e){let t=D(),o=w(),r=ae(),n=je(()=>{let a=t?.metadata||[],s=o?.metadata||[],l=r?.metadata||[];return[...a,...s,...l]},[t,o,r]);return et(V,{metadata:n,...e})}import{useEffect as nt,useState as it}from"react";import{createImageServiceRequest as tt,imageServiceRequestToString as ot}from"@iiif/parser/image-3";import{useMemo as rt}from"react";function G(e,t={},o=[]){return rt(()=>{if(!e)return null;let r=t.quality;e&&e.extraQualities&&t.quality&&(e.extraQualities.includes(t.quality)||(r="default"));let n=tt(e);return ot({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 K}from"react/jsx-runtime";function at(e){let t=typeof e.src=="string"?e.src:e.src.id,o=he(),[r,n]=it(!1),a;if(t){let l=o.loadServiceSync({id:t});l&&(a=l)}!a&&!r&&o.loadService({id:t}).then(()=>{n(!0)});let s=G(a,{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 nt(()=>()=>{n(!1)},[t]),s?K("img",{src:s,alt:e.alt,className:e.className,style:e.style}):K(st,{...e,fetchImageService:!1})}function st(e){if(e.fetchImageService)return K(at,{...e});let t=typeof e.src=="string"?{id:e.src,profile:"level0"}:e.src,o=G(t,{size:e.size,selector:e.region,rotation:e.rotation,format:e.format,region:e.region,quality:e.quality},[e.src,e.size,e.region,e.rotation,e.format,e.region,e.quality]);return o?K("img",{src:o,alt:e.alt,className:e.className,style:e.style}):null}import{jsx as lt}from"react/jsx-runtime";function Hn(e){let t=D();return lt(V,{metadata:t?.metadata||[],...e})}import{useLayoutEffect as ft,useRef as pt}from"react";import*as J from"react-lazy-load-image-component";import{getValue as ct}from"@iiif/helpers/i18n";import{Fragment as Se,jsx as R,jsxs as dt}from"react/jsx-runtime";var{LazyLoadComponent:mt}=J||J.default;function be(e){let{size:t,visible:o,classes:r,canvasId:n,figure:a}=e,s=t?.width||128,l=t?.height||t?.width||128,d=R(ut,{...e}),f=R(mt,{threshold:300,style:{height:l,width:s},visibleByDefault:o,children:n?R(ne,{canvas:n,children:d}):d});return a?R("figure",{className:r?.figure,children:f}):f}function ut({fallback:e,size:t,classes:o,showLabel:r,alt:n,dereference:a=!1}){let s=w(),l=t?.width||128,d=t?.height||t?.width||128,f=n||ct(s?.label)||"",c=ye({width:l,height:d,allowUnsafe:!0},a);return!c||c.type!=="fixed"?R(Se,{children:e}):dt(Se,{children:[R("div",{className:o?.imageWrapper,children:R("img",{className:o?.img,src:c.id,alt:f})}),r?R(M,{as:"figcaption",className:o?.label,children:s?.label}):null]})}import{jsx as H}from"react/jsx-runtime";function Yn({scrollBehaviour:e,dereference:t,flat:o,size:r,classes:n={},showLabel:a,figure:s,fallback:l}){let d=pt(null),{items:f,sequence:c,currentSequenceIndex:p,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};ft(()=>{if(!d.current)return;let h=d.current.querySelector("[data-selected=true]");h&&h.scrollIntoView({behavior:e||"instant",block:"nearest",inline:"center"})},[p]);let C=[];for(let h of c){let m=[],u=c[p]===h;for(let g of h){let i=f[g];m.push(H("div",{className:u?b.item:n.item,children:H(be,{classes:u?b:n,canvasId:i.id,size:r,dereference:t,showLabel:a,figure:s,placeholder:H("div",{style:{height:128,width:128}}),fallback:l})},g))}if(o){C.push(m);continue}C.push(H("div",{onClick:g=>{S(c.indexOf(h))},"data-selected":u,className:u?b.row:n.row,children:m},h.join("-")))}return H("div",{ref:d,className:n.container,children:C})}import{Fragment as Ce,jsx as T,jsxs as Ie}from"react/jsx-runtime";var gt={draw:!0,polygon:!0,line:!0,lineBox:!0,square:!0,triangle:!0,hexagon:!0,circle:!0,delete:!0};function Gn({helper:e,showShapes:t,state:o,enabled:r=gt,classNames:n={},icons:a={}}){return Ie(Ce,{children:[t?Ie(Ce,{children:[r.draw&&T("button",{className:n.button,onClick:()=>{e.stamps.clear(),e.draw.enable()},"data-active":!o.lineMode&&!o.selectedStamp&&t&&o.drawMode,children:a.DrawIcon||"Draw"}),r.polygon&&T("button",{className:n.button,"data-active":!o.lineMode&&!o.selectedStamp&&t&&!o.drawMode,onClick:()=>{e.stamps.clear(),e.draw.disable(),e.modes.disableLineBoxMode(),e.modes.disableLineMode()},children:a.PolygonIcon||"Polygon"}),r.line&&T("button",{className:n.button,"data-active":o.lineMode&&!o.lineBoxMode,onClick:()=>{e.modes.enableLineMode()},children:a.LineIcon||"Line"}),r.lineBox&&T("button",{className:n.button,"data-active":o.lineBoxMode,onClick:()=>{e.modes.enableLineBoxMode()},children:a.LineBoxIcon||"LineBox"}),r.square&&T("button",{className:n.button,"data-active":o.selectedStamp?.id==="square",onClick:()=>{e.stamps.square()},children:a.SquareIcon||"Square"}),r.triangle&&T("button",{className:n.button,"data-active":o.selectedStamp?.id==="triangle",onClick:()=>{e.stamps.triangle()},children:a.TriangleIcon||"Triangle"}),r.hexagon&&T("button",{className:n.button,"data-active":o.selectedStamp?.id==="hexagon",onClick:()=>{e.stamps.hexagon()},children:a.HexagonIcon||"Hexagon"})]}):null,o.showBoundingBox&&r.delete&&T("button",{className:n.button,onClick:()=>e.key.down("Backspace"),children:a.DeleteForeverIcon||"Delete"})]})}import{createContext as ht,useCallback as ke,useContext as we,useEffect as Pe,useMemo as Z,useState as yt}from"react";import Re from"mitt";import{jsx as vt}from"react/jsx-runtime";var U=ht(Re());U.displayName="SelectorHelper";function ni({children:e}){return vt(U.Provider,{value:Z(()=>Re(),[]),children:e})}function ii(){return we(U)}function Te(e){let t=Ee(),[o,r]=yt(!1);Pe(()=>t.withSelector(e).on("highlight",()=>{r(!0)}),[t,e]),Pe(()=>t.withSelector(e).on("clear-highlight",()=>{r(!1)}),[t,e]);let n=ke(s=>{t.emit("click",{selectorId:e,event:s})},[e,t]),a=ke(s=>{t.emit("hover",{selectorId:e,event:s})},[e,t]);return{controller:t,onClick:n,onHover:a,isHighlighted:o}}function Ee(){let e=we(U);return Z(()=>({withSelector(t){return{on(o,r){let n=a=>{a&&a.selectorId===t&&r(a)};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 ai(){let e=Ee();return Z(()=>({withSelector(t){return{highlight(){e.emit("highlight",{selectorId:t})},clearHighlight(){e.emit("clear-highlight",{selectorId:t})},zoomTo(){e.emit("zoom-to",{selectorId:t})},addEventListener(o,r){return e.emit("event-listener",{selectorId:t,name:o,callback:r}),()=>{e.emit("remove-event-listener",{selectorId:t,name:o,callback:r})}},getImagePreview(){return new Promise((o,r)=>{e.emit("image-preview-request",{selectorId:t,resolve:o,reject:r})})},on(o,r){return e.withSelector(t).on(o,r)}}},highlight(t){e.emit("highlight",{selectorId:t})},clearHighlight(t){e.emit("clear-highlight",{selectorId:t})},zoomTo(t){e.emit("zoom-to",{selectorId:t})},addEventListener(t,o,r){return e.emit("event-listener",{selectorId:t,name:o,callback:r}),()=>{e.emit("remove-event-listener",{selectorId:t,name:o,callback:r})}},getImagePreview(t){return new Promise((o,r)=>{e.emit("image-preview-request",{selectorId:t,resolve:o,reject:r})})},on(t,o){return e.on(t,o)}}),[e])}import{createContext as xt,useContext as St,useMemo as bt}from"react";import{jsx as Ct}from"react/jsx-runtime";function Ne(){return{default:{backgroundColor:"rgba(0,0,0,0)",borderWidth:"2px",borderColor:"rgba(252,0,98, .5)"},highlighted:{backgroundColor:"rgba(75, 103, 225, 0.4)",borderWidth:"1px",borderColor:"rgba(75,103,225,0.99)"},hidden:{borderWidth:"0px",borderColor:"rgba(0,0,0,0)",backgroundColor:"rgba(0,0,0,0)",hidden:!0}}}var j=xt(Ne());j.displayName="AnnotationStyle";function Be(){return St(j)}function mi({theme:e,children:t}){let o=bt(()=>e||Ne(),[e]);return Ct(j.Provider,{value:o,children:t})}import{HTMLPortal as Tt,useAtlas as Et}from"@atlas-viewer/atlas";import{useEffect as Le,useRef as E,useState as He}from"react";import{useEffect as It,useMemo as kt,useState as Pt}from"react";import{createHelper as wt}from"polygon-editor";function Me(e,t,o){let[r,n]=Pt({}),a=kt(()=>wt(e,o),[]);return It(()=>(a.clock.start(t,n),()=>{a.clock.stop()}),[]),{state:r,helper:a}}import{createSvgHelpers as Rt}from"polygon-editor";import{Fragment as Ae,jsx as x,jsxs as ze}from"react/jsx-runtime";var N=Rt();function qe(e,t){let{image:o,currentShape:r,onChange:n,hideShapeLines:a}=e,s=E(),l=E(),d=E(),f=E(),c=E(),p=E(),S=E(),b=E(),[C,h]=He(null),[m,u]=He(!1),{helper:g,state:i}=Me(r,(v,k)=>{N.updateTransitionBoundingBox(l.current,v,k),N.updateBoundingBoxPolygon(s.current,v,k),N.updateTransitionShape(p.current,v,k),N.updateClosestLinePointTransform(f.current,v,k),N.updateSelectBox(d.current,v,k),N.updatePointLine(S.current,v,k),N.updateDrawPreview(c.current,v,k,3),N.updateLineBox(b.current,v),h(v.transitionDirection),u(v.transitionRotate)},n);Le(()=>{g.setShape(r||null)},t),Le(()=>{let v=()=>{g.modifiers.reset()};return document.addEventListener("mouseleave",v),()=>{document.removeEventListener("mouseleave",v)}},[]);let y=ze(Ae,{children:[x("marker",{id:"dot",viewBox:"0 0 10 10",refX:"5",refY:"5",markerWidth:"5",markerHeight:"5",children:x("circle",{cx:"5",cy:"5",r:"4",className:"marker"})}),x("marker",{id:"selected",viewBox:"0 0 10 10",refX:"5",refY:"5",markerWidth:"5",markerHeight:"5",children:x("circle",{cx:"5",cy:"5",r:"4",fill:"#FAFF00"})}),x("marker",{id:"resizer",viewBox:"0 0 10 10",refX:"5",refY:"5",markerWidth:"5",markerHeight:"5",children:x("rect",{width:"10",height:"10",stroke:"#FF0DCB",fill:"#fff",strokeWidth:2})})]}),B=r?r.open?"polyline":"polygon":null,oe=!i.showBoundingBox&&i.closestPoint!==null&&i.actionIntentType==="select-point",Ke=i.actionIntentType==="add-open-point",Ue=i.transitionIntentType==="split-line",_=i.transitioning&&i.selectedStamp&&i.transitionIntentType==="stamp-shape",Xe=r&&B?ze(Ae,{children:[x(B,{fill:!i.transitioning&&i.showBoundingBox?"rgba(255, 0, 0, .5)":"none",strokeWidth:_?0:2,stroke:a?"transparent":"#000",points:r.points.map(v=>v.join(",")).join(" "),vectorEffect:"non-scaling-stroke",markerStart:i.showBoundingBox?void 0:"url(#dot)",markerMid:i.showBoundingBox?void 0:"url(#dot)",markerEnd:i.showBoundingBox?void 0:"url(#dot)",style:{pointerEvents:"none"}}),i.lineBoxMode&&i.actionIntentType==="close-line-box"?x("polygon",{fill:"rgba(255, 0, 0, .4)",ref:b,stroke:"#000",strokeWidth:2,vectorEffect:"non-scaling-stroke"}):null,i.transitionIntentType==="draw-shape"&&i.transitioning?x("polyline",{ref:c,fill:"none",stroke:"rgba(255, 0, 0, .5)",strokeWidth:2,vectorEffect:"non-scaling-stroke"}):null,!i.showBoundingBox&&i.selectedPoints&&i.selectedPoints.length?x("polyline",{strokeWidth:2,vectorEffect:"non-scaling-stroke",stroke:"transparent",markerStart:"url(#selected)",markerMid:"url(#selected)",markerEnd:"url(#selected)",fill:"transparent",points:r.points.filter((v,k)=>i.selectedPoints?.includes(k)).map(v=>v.join(",")).join(" ")}):null,oe&&i.closestPoint!==null&&r.points[i.closestPoint]?x("polyline",{strokeWidth:2,vectorEffect:"non-scaling-stroke",stroke:"transparent",markerStart:"url(#selected)",markerMid:"url(#selected)",markerEnd:"url(#selected)",fill:"transparent",points:`${r.points[i.closestPoint][0]},${r.points[i.closestPoint][1]}`}):null,!i.transitioning&&(i.actionIntentType==="add-open-point"||i.actionIntentType==="close-shape"||i.actionIntentType==="close-shape-line")?x("polyline",{stroke:"#000",ref:S,strokeWidth:i.actionIntentType==="close-shape"?2:1,vectorEffect:"non-scaling-stroke"}):null,i.hasClosestLine&&(!i.transitionIntentType||i.transitionIntentType==="split-line")?x("g",{ref:f,children:x("polyline",{style:{opacity:.5},markerStart:"url(#dot)",points:"0,0 10,10",vectorEffect:"non-scaling-stroke",fill:"transparent",strokeWidth:2})}):null,i.transitioning?x(B,{ref:p,fill:r.open?"none":"rgba(255, 0, 0, .5)",stroke:"rgba(255, 0, 0, .5)",strokeWidth:r.open?2:0}):null,i.transitioning&&i.transitionIntentType==="select-multiple-points"?x("rect",{ref:d,fill:"rgba(255, 255, 255, .3)",strokeWidth:1,stroke:"rgba(0,0,0,.2)",vectorEffect:"non-scaling-stroke"}):null,i.showBoundingBox?null:x("g",{name:"controls",children:!1}),i.showBoundingBox&&!_?x("polygon",{ref:s,strokeWidth:2,stroke:"#FF0DCB",fill:"none",markerStart:"url(#resizer)",markerMid:"url(#resizer)",markerEnd:"url(#resizer)",vectorEffect:"non-scaling-stroke"}):null]}):null;return{helper:g,state:i,isAddingPoint:Ke,isSplitting:Ue,isStamping:_,isHoveringPoint:oe,transitionDirection:C,transitionRotate:m,defs:y,editor:Xe}}import{useEffect as ee}from"react";import{createPortal as Nt}from"react-dom";import{Fragment as We,jsx as A,jsxs as X}from"react/jsx-runtime";var Bt=[{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 De(e){let t=e.theme||Bt[0],o=Et(),{image:r}=e,{helper:n,defs:a,editor:s,state:l,transitionDirection:d,isSplitting:f,transitionRotate:c,isHoveringPoint:p,isAddingPoint:S,isStamping:b}=qe({currentShape:e.shape||null,onChange:e.updateShape,image:e.image,hideShapeLines:!0},[]),C=i=>{n.pointer([[~~i.atlas.x,~~i.atlas.y]])};ee(()=>{let i=y=>{n.key.up(y.key)};return document.addEventListener("keyup",i),()=>{document.removeEventListener("keyup",i)}},[]),ee(()=>{let i=y=>{n.key.down(y.key)};return document.addEventListener("keydown",i),()=>{document.removeEventListener("keydown",i)}},[]),ee(()=>{let i=[];return d&&i.push(`atlas-cursor-${d}`),l.actionIntentType==="cut-line"&&l.modifiers?.Shift&&i.push("atlas-cursor-cut"),(p||l.transitionIntentType==="move-shape"||l.transitionIntentType==="move-point")&&i.push("atlas-cursor-move"),S&&i.push("atlas-cursor-crosshair"),f&&i.push("atlas-cursor-copy"),c&&i.push("atlas-cursor-rotate"),l.transitionIntentType==="draw-shape"&&i.push("atlas-cursor-draw"),o?.canvas&&o.canvas.classList.add(...i),()=>{o?.canvas&&o.canvas.classList.remove(...i)}},[o?.canvas,S,p,f,l.modifiers?.Shift,l.actionIntentType,l.transitionIntentType,d,c]);let h=e.shape&&e.shape?.points.length===0,m=e.renderControls?e.renderControls(n,l,h):null,u=document.getElementById(e.controlsHtmlId||"atlas-controls"),g="shape";return A(We,{children:X("world-object",{height:r.height,width:r.width,onMouseMove:C,onMouseDown:n.pointerDown,onMouseUp:n.pointerUp,onMouseLeave:n.blur,children:[e.shape?X(We,{children:[A(g,{open:e.shape.open,points:e.shape.points,relativeStyle:!0,style:b?{}:t.outer}),A(g,{open:e.shape.open,points:e.shape.points,relativeStyle:!0,style:b?{}:t.inner})]}):null,X(Tt,{relative:!0,interactive:!1,children:[A("div",{style:{position:"absolute",top:0,right:0,left:0,bottom:0},children:X("svg",{width:"100%",height:"100%",viewBox:`0 0 ${r.width} ${r.height}`,tabIndex:-1,children:[A("defs",{children:a}),s]})}),u?Nt(m,u,"controls"):null]})]})})}import{jsx as Fe}from"react/jsx-runtime";function Di(e){let t=w(),o=e.annotationBucket,r=e.readOnly,n=e.id,{onClick:a,isHighlighted:s}=Te(e.id),l=Be(),d=s?l.highlighted:l[o||"hidden"]||l.hidden;if(!t)return null;if(r){let f="shape",c=e.polygon,p=c.open;return c?Fe(f,{id:`shape-${n}`,points:c.points,open:p,onClick:a,relativeStyle:!0,target:{x:0,y:0,width:t.width,height:t.height},style:d}):null}return Fe(De,{image:t,shape:e.polygon||{id:e.id,open:!0,points:[]},updateShape:e.updatePolygon,theme:e.theme,controlsHtmlId:e.controlsHtmlId,renderControls:e.renderControls})}import{useMemo as Mt,useState as Lt}from"react";import{ErrorBoundary as Ht}from"react-error-boundary";import{jsx as z,jsxs as zt}from"react/jsx-runtime";function Gi({src:e,errorFallback:t,interactive:o,skipSizes:r,children:n,renderViewerControls:a,viewControlsDeps:s,fluid:l,x:d,y:f,...c}){let[p,S]=Lt(),b=t||ce,[C,h]=pe(),m=Mt(()=>{let g=h[e]?.status,i=C({id:e},{});return i?.height&&i.width&&g!=="loading"?{id:e,width:i.width,height:i.height,service:i,type:"Image",selector:{type:"BoxSelector",spatial:{x:0,y:0,width:i.width,height:i.height}},target:{type:"BoxSelector",spatial:{x:0,y:0,width:i.width,height:i.height}}}:null},[C,e,h]);if(Q(p&&a?"overlay":"none",`canvas-portal-controls-${e}`,F.Provider,a&&m?{value:p||null,children:a({image:m,images:[m],type:"images"})}:{},[e,m,p,...s||[]]),!m||!m.height||!m.width)return null;let u=l?void 0:c.homePosition?c.homePosition.width/c.homePosition.height:m.width/m.height;return console.log("here",u),z(Ht,{resetKeys:[],fallbackRender:g=>z(b,{...c,...g}),children:z(me,{...c,aspectRatio:u,containerProps:{style:{position:"relative"},...c.containerProps||{}},onCreated:g=>{S(g),c.onCreated&&c.onCreated(g)},children:zt(F.Provider,{value:p,children:[z(ge,{image:m,id:m.id,isStatic:!o,x:d,y:f},m.id),z(At,{viewerPreset:p,renderViewerControls:a,image:m,src:e,viewControlsDeps:s}),n]})})})}function At({viewerPreset:e,renderViewerControls:t,image:o,src:r,viewControlsDeps:n}){return Q(e&&t?"overlay":"none",`canvas-portal-controls-${r}`,F.Provider,t&&o?{value:e||null,children:t({image:o,images:[o],type:"images"})}:{},[r,e,...n||[]]),null}import{jsx as qt}from"react/jsx-runtime";function ea({annotation:e,children:t}){return qt(L,{value:{annotation:e},children:t})}import{jsx as Wt}from"react/jsx-runtime";function na({annotationPage:e,children:t}){return Wt(L,{value:{annotationPage:e},children:t})}import{jsx as Dt}from"react/jsx-runtime";function la({collection:e,children:t}){return Dt(L,{value:{collection:e},children:t})}function da(e,t={}){return O(t)}import{useCanvas as Ft}from"@atlas-viewer/atlas";import{useEffect as Ot,useMemo as te,useState as $t}from"react";function va({canvasId:e}={}){let t=Ft(),o=ie(),r=te(()=>e?[e]:t?[t.id]:o.map(f=>f.id),[e,t,o]),[n,a]=$t({}),s=le();Ot(()=>{let f=c=>{let p=c.partOf.canvasId;p&&a(S=>({...S,[p]:c.choice}))};return s.on("choice-change",f),()=>{s.off("choice-change",f)}},[]);let l=te(()=>{let f=[];for(let c of r){let p=n[c];p&&f.push({canvasId:c,choice:p})}return f},[r,n]),d=te(()=>({makeChoice:(f,c)=>{s.emit("make-choice",{choiceId:f,...c})}}),[s]);return{choices:l,actions:d}}function Sa(e,t=!1){}function ka(e){let o=q().manifest,r=e?e.map(n=>typeof n=="string"?n:n?.id):[];return W(n=>{let a=o?n.iiif.entities.Manifest[o]:void 0,s=a?.items||[];if(typeof e>"u")return s;let l=[];for(let d of a?.items||[])r.indexOf(d.id)!==-1&&l.push(d);return l},[r.join("/")])}import{useMemo as Vt}from"react";function Ea(e,t=[]){let{id:o,selector:r}=e,n=q(),a=o||n.collection,s=W(l=>a?l.iiif.entities.Collection[a]:void 0,[a]);return Vt(()=>{if(s)return r?r(s):s},[s,r,...t])}import{useEffect as Kt,useMemo as Ut}from"react";import{createEventsHelper as Xt}from"@iiif/helpers/events";function Ha(e,t,o,r,n=[]){let a=P(),s=Ut(()=>Xt(a),[a]);Kt(()=>{let l=e;return l?(s.addEventListener(l,t,o,r),()=>{s.removeEventListener(l,t,o)}):()=>{}},[s,e,t,...n])}function Wa(e,t){let{id:o,isLoaded:r,error:n,resource:a,requestId:s,cached:l}=re(e,t);return{id:o,isLoaded:r,error:n,manifest:a,requestId:s,cached:l}}import{getImageServices as Oe}from"@iiif/parser/image-3";import{useEffect as Yt,useMemo as $e,useState as Y}from"react";function Ve({cacheKey:e}={}){let t=w(),o=O(),r=P(),n=de(),a=fe(),[s,l]=Y(void 0),[d,f]=Y(!1),[c,p]=Y("idle"),[S,b]=Y(void 0),C=t?t.id:"undefined",h=$e(()=>{try{if(t&&o.length){let u=o[0],g=r.get(u.body[0]),y=Oe(g)[0];return y&&n(y,{width:y.width||t.width,height:y.height||t.height},!0)||void 0}}catch(u){console.error(u)}},[C,e,t]),m=c==="success"&&s?s:h;return Yt(()=>{(async()=>{try{if(t&&o.length){let u=o[0],g=r.get(u.body[0]),y=Oe(g)[0];if(!y)return;f(!0),p("loading");try{let B=await a(y,{width:y.width||t.width,height:y.height||t.height})||void 0;l(B),p("success"),f(!1)}catch(B){p("error"),b(B)}}}catch(u){p("error"),b(u)}})()},[C,e]),$e(()=>({data:m,isFetching:d,status:c,error:S}),[m,d,c,S])}function _a(){let e=Ve();return{isLoading:e.isFetching,tile:e.data?{id:e.data.id||e.data["@id"],width:e.data.width,height:e.data.height,imageService:e.data,thumbnail:void 0}:null}}import{createStylesHelper as _t}from"@iiif/helpers/styles";import{useMemo as Qt}from"react";function ja(){let e=P();return Qt(()=>_t(e),[e])}export*from"@iiif/helpers/annotation-targets";export{ea as AnnotationContext,na as AnnotationPageContext,mi as AnnotationStyleProvider,Bo as Auth,Io as AuthProvider,So as AuthRContext,bo as AuthReactContext,Co as AuthReactContextActions,nn as CanvasAnnotations,ne as CanvasContext,ve as CanvasPanel,xr as CanvasStrategyProvider,Sr as CanvasWorldObject,la as CollectionContext,vn as CombinedMetadata,Hr as ComplexTimelineProvider,Vo as ContextBridge,yr as ControlsReactContext,De as CreateCustomShape,Fo as CustomContextBridge,Oo as CustomContextBridgeProvider,Wo as EventsProvider,st as Image,Gi as ImageService,Dr as ImageServiceLoaderContext,Ho as InnerViewerProvider,Pr as LanguageProvider,Nr as LanguageString,M as LocaleString,ro as ManifestContext,Hn as ManifestMetadata,Xr as MediaPlayerProvider,V as Metadata,Di as PolygonSelector,io as RangeContext,qo as ReactEventContext,jt as ReactVaultContext,Or as Render3DModelStrategy,Gr as RenderAccompanyingCanvas,$r as RenderAnnotationStrategy,Qr as RenderAudioStrategy,zr as RenderComplexTimelineStrategy,br as RenderEmptyStrategy,Fr as RenderImageStrategy,Gn as RenderSvgEditorControls,qr as RenderTextualContentStrategy,Jr as RenderVideoStrategy,Zr as RenderYouTubeStrategy,L as ResourceProvider,Zt as ResourceReactContext,ni as SelectorControllerProvider,Yn as SequenceThumbnails,Ao as SimpleViewerProvider,Lo as SimpleViewerReactContext,be as SingleCanvasThumbnail,gr as StrategyReactContext,_r as ThumbnailFallbackImage,kr as TranslationProvider,wr as TransliterationProvider,eo as VaultProvider,F as ViewerPresetContext,Yo as VirtualAnnotationProvider,no as VisibleCanvasReactContext,yo as authDetailsForResource,go as createAuthStateStore,ho as createProbe,zo as defaultEmitter,tr as emptyActions,nr as emptyStrategy,so as findAllCanvasesInRange,ao as findFirstCanvasFromRange,lo as findManifestSelectedRange,co as findSelectedRange,ir as flattenAnnotationPageIds,Cr as formatTime,lr as get3dStrategy,dr as getComplexTimelineStrategy,Ne as getDefaultAnnotationStyles,cr as getImageStrategy,uo as getManifestSequence,er as getParsedTargetSelector,fr as getRenderingStrategy,mr as getTextualContentStrategy,ur as getVideoStrategy,mo as getVisibleCanvasesFromCanvasId,po as hasAuth,xo as makeAccessServiceRequest,vo as makeAccessTokenRequest,jo as parseSpecificResource,Bt as svgThemes,or as unknownResponse,rr as unsupportedStrategy,Jo as useAnnotation,Zo as useAnnotationPage,ue as useAnnotationPageManager,Be as useAnnotationStyles,da as useAnnotationsAtTime,wo as useAuthActions,To as useAuthService,Po as useAuthStore,No as useAuthToken,Eo as useAuthTokens,w as useCanvas,va as useCanvasChoices,Sa as useCanvasClock,fo as useCanvasSequence,Yr as useCanvasStartTime,ka as useCanvasSubset,Br as useClosestLanguage,Ea as useCollection,Ar as useComplexTimeline,$o as useContextBridge,Lr as useCreateLocaleString,Ro as useCurrentAuth,Do as useCustomContextBridge,Ko as useDispatch,le as useEventEmitter,Ha as useEventListener,to as useExistingVault,Wa as useExternalCollection,oo as useExternalManifest,re as useExternalResource,Tr as useIIIFLanguage,G as useImage,Ve as useImageService,he as useImageServiceLoader,_a as useImageTile,ko as useIsAuthEnabled,pe as useLoadImageService,Mr as useLocaleString,D as useManifest,Kr as useMediaActions,Ur as useMediaElements,Vr as useMediaState,sr as usePaintables,O as usePaintingAnnotations,Me as usePolygonHelper,ae as useRange,vr as useRenderControls,pr as useRenderingStrategy,q as useResourceContext,Qo as useResourceEvents,ar as useResources,Mo as useSearchService,Ee as useSelectorController,ii as useSelectorEmitter,Te as useSelectorEvents,ai as useSelectorHelper,Ir as useSimpleMediaPlayer,se as useSimpleViewer,hr as useStrategy,ja as useStyleHelper,Go as useStyles,qe as useSvgEditor,ye as useThumbnail,Er as useTranslations,Rr as useTransliteration,P as useVault,Wr as useVaultEffect,W as useVaultSelector,_o as useViewerPreset,Uo as useVirtualAnnotationPage,Xo as useVirtualAnnotationPageContext,ie as useVisibleCanvases};
|