@manifest-editor/shell 2.0.0 → 2.0.1-next.0.41d9217
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/index.cjs +20 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +31 -31
- package/dist/index.d.cts +50 -49
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +28 -27
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -17
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let c=require(`@manifest-editor/components`),l=require(`react`);l=s(l);let u=require(`react/jsx-runtime`),d=require(`styled-components`);d=s(d);let f=require(`react-accessible-dropdown-menu-hook`);f=s(f);let p=require(`react-iiif-vault`),m=require(`immer`),h=require(`@iiif/helpers`),g=require(`@iiif/helpers/vault`);g=s(g);let _=require(`@iiif/parser`),v=require(`@manifest-editor/creator-api`),y=require(`
|
|
1
|
+
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let c=require(`@manifest-editor/components`),l=require(`react`);l=s(l);let u=require(`react/jsx-runtime`),d=require(`styled-components`);d=s(d);let f=require(`react-accessible-dropdown-menu-hook`);f=s(f);let p=require(`react-iiif-vault`),m=require(`immer`),h=require(`@iiif/helpers`),g=require(`@iiif/helpers/vault`);g=s(g);let _=require(`@iiif/parser`),v=require(`@manifest-editor/creator-api`),y=require(`zustand`),ee=require(`react-error-boundary`),b=require(`@iiif/helpers/vault/actions`),x=require(`@iiif/helpers/vault/utility`),S=require(`@manifest-editor/editor-api`),C=require(`mitt`);C=s(C);let w=require(`tiny-use-debounce`),te=require(`react-transition-group`),T=require(`shallowequal`);T=s(T);let ne=require(`@atlas-viewer/iiif-image-api`);var E=process.env.NODE_ENV===`production`,D=`Invariant failed`;function O(e,t){if(!e){if(E)throw Error(D);var n=typeof t==`function`?t():t,r=n?`${D}: ${n}`:D;throw Error(r)}}const k={previews:[],behaviorPresets:[`auto-advance`,`no-auto-advance`,`repeat`,`no-repeat`,`unordered`,`individuals`,`continuous`,`paged`,`non-paged`,`facing-pages`,`multi-part`,`together`,`sequence`,`thumbnail-nav`,`no-nav`,`hidden`],defaultPreview:null,editorConfig:{},newTemplates:null,i18n:{advancedLanguageMode:!1,availableLanguages:[`en`,`cy`,`nl`,`fr`],defaultLanguage:`en`},editorFeatureFlags:{enableMultiImageCanvases:!0,enableMultiMediaCanvases:!0,annotationPopups:!1,rememberCanvasId:!0,manifestGridOptions:!1,rememberLeftPanelId:!1},uploadBackends:[],export:{baseIdentifier:null,version:3}},A=(0,l.createContext)(k),j=(0,l.createContext)(()=>{});function M(){return(0,l.useContext)(A)}function re(){return(0,l.useContext)(j)}function N({children:e,config:t,saveConfig:n}){let[r,i]=(0,l.useState)(null),a=(0,l.useMemo)(()=>({...k,...t||{},...r||{},editorFeatureFlags:{...k.editorFeatureFlags,...t?.editorFeatureFlags||{},...r?.editorFeatureFlags}}),[t,r]),o=(0,l.useCallback)(e=>{i(e),n&&n(e)},[t]);return(0,u.jsx)(j.Provider,{value:o,children:(0,u.jsx)(A.Provider,{value:a,children:e})})}const ie=(0,l.createContext)(null),ae=(0,l.createContext)(null),oe=(0,l.createContext)({state:null,setState:()=>{}});function se(){let e=(0,l.useContext)(ae);return O(e,`Hook useAppInstance must be used inside <AppProvider />`),e}function P(){let e=(0,l.useContext)(ie);return O(e,`Hook useApp must be used inside <AppProvider />`),e}function ce(){return(0,l.useContext)(oe)}function le(e){let[t,n,r]=(0,c.useLocalStorage)(`app-state/${e.appId}/${e.instanceId}`,e.initialState||{}),i=(0,l.useCallback)(e=>{let t=r.current?JSON.parse(r.current||`{}`):{},i=(typeof e==`function`?e(t):e)||{};n({...t,...i})},[]);(0,l.useEffect)(()=>{e.args&&i(e.args)},[e.appId]);let a=(0,l.useMemo)(()=>({state:t||{},setState:i}),[i,t]);return(0,u.jsx)(oe.Provider,{value:a,children:e.children})}function ue({instanceId:e,appId:t,args:n,definition:r,children:i,initialState:a}){let o=(0,l.useMemo)(()=>({instanceId:e,appId:t,args:n}),[e,t,n]),s=(0,l.useMemo)(()=>a||{},[e]);return(0,u.jsx)(N,{config:r.config||{},children:(0,u.jsx)(ie.Provider,{value:r,children:(0,u.jsx)(ae.Provider,{value:o,children:(0,u.jsx)(le,{instanceId:o.instanceId,appId:o.appId,args:o.args,initialState:s,children:i})})})})}const de=(0,l.createContext)(null);function fe(){let e=(0,l.useContext)(de);return O(e,`Hook useApps must be used inside <MultiAppProvider />`),e}function pe(e,t=!1){let[n,r]=(0,c.useOptionalLocalStorage)(`SelectedApplication`,e||{id:`splash`},!t);return[n,r]}function me({apps:e,initialApp:t,saveCurrentApp:n=!0,instanceId:r,children:i,config:a={}}){let{defaultApp:o=`splash`,collectionApp:s=`collection-editor`,manifestApp:c=`manifest-editor`}=a,[d,f]=pe(t,n),p=e=>{e===`Manifest`&&f({id:c}),e===`Collection`&&f({id:s})},m=(0,l.useMemo)(()=>({currentApp:d||{id:o},initialApp:t||{id:o},apps:e,changeApp:f,changeProjectType:p}),[t,e,d]),h=e[m.currentApp.id];return!d||!h?null:(0,u.jsx)(ue,{appId:d.id,definition:h,instanceId:d.id+r,args:d.args,children:(0,u.jsx)(de.Provider,{value:m,children:i})})}const he=d.default.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
align-items: center;
|
|
4
4
|
height: 3em;
|
|
@@ -60,7 +60,7 @@ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=
|
|
|
60
60
|
color: #666666;
|
|
61
61
|
padding: 0.35em 0.7em;
|
|
62
62
|
letter-spacing: -0.42px;
|
|
63
|
-
`,F=({height:e=16})=>(0,u.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,height:e,viewBox:`0 0 24 24`,width:`24px`,fill:`currentColor`,children:[(0,u.jsx)(`path`,{d:`M0 0h24v24H0z`,fill:`none`}),(0,u.jsx)(`path`,{d:`M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z`})]}),Se=({rotate:e=0,...t})=>(0,u.jsx)(`svg`,{version:`1.2`,xmlns:`http://www.w3.org/2000/svg`,overflow:`visible`,preserveAspectRatio:`none`,viewBox:`0 0 24 24`,width:`1em`,height:`1em`,style:{fill:`rgba(0, 0, 0, 0.6)`,transform:`rotate(${e}deg)`,transition:`transform 0.2s`},...t,children:(0,u.jsx)(`path`,{d:`M8.12 9.29 12 13.17l3.88-3.88a.996.996 0 1 1 1.41 1.41l-4.59 4.59a.996.996 0 0 1-1.41 0L6.7 10.7a.996.996 0 0 1 0-1.41c.39-.38 1.03-.39 1.42 0z`,fill:`currentColor`})}),Ce=(0,l.createContext)(null),we=(0,l.createContext)(null);function Te(){let e=(0,l.useContext)(we),t=(0,l.useContext)(Ce),n=e||t?.id;return
|
|
63
|
+
`,F=({height:e=16})=>(0,u.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,height:e,viewBox:`0 0 24 24`,width:`24px`,fill:`currentColor`,children:[(0,u.jsx)(`path`,{d:`M0 0h24v24H0z`,fill:`none`}),(0,u.jsx)(`path`,{d:`M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z`})]}),Se=({rotate:e=0,...t})=>(0,u.jsx)(`svg`,{version:`1.2`,xmlns:`http://www.w3.org/2000/svg`,overflow:`visible`,preserveAspectRatio:`none`,viewBox:`0 0 24 24`,width:`1em`,height:`1em`,style:{fill:`rgba(0, 0, 0, 0.6)`,transform:`rotate(${e}deg)`,transition:`transform 0.2s`},...t,children:(0,u.jsx)(`path`,{d:`M8.12 9.29 12 13.17l3.88-3.88a.996.996 0 1 1 1.41 1.41l-4.59 4.59a.996.996 0 0 1-1.41 0L6.7 10.7a.996.996 0 0 1 0-1.41c.39-.38 1.03-.39 1.42 0z`,fill:`currentColor`})}),Ce=(0,l.createContext)(null),we=(0,l.createContext)(null);function Te(){let e=(0,l.useContext)(we),t=(0,l.useContext)(Ce),n=e||t?.id;return O(n,`useResourceInstance can only be called from inside <ResourceProvider />`),n}function I(){let e=(0,l.useContext)(Ce);return O(e,`useResource can only be called from inside <ResourceProvider />`),e}function Ee({id:e,children:t}){return e?(0,u.jsx)(we.Provider,{value:e,children:t}):t}function De({resource:e,children:t}){let n=(0,p.useExistingVault)(),r=t;return e&&e.type===`Manifest`&&(r=(0,u.jsx)(p.VaultProvider,{vault:n||void 0,children:(0,u.jsx)(p.ManifestContext,{manifest:e.id||``,children:t})})),e&&e.type===`Collection`&&(r=(0,u.jsx)(p.VaultProvider,{vault:n||void 0,children:(0,u.jsx)(p.CollectionContext,{collection:e.id||``,children:t})})),(0,u.jsx)(Ce.Provider,{value:e,children:r})}function L(e){"@babel/helpers - typeof";return L=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},L(e)}function Oe(e,t){if(L(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(L(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function ke(e){var t=Oe(e,`string`);return L(t)==`symbol`?t:t+``}function R(e,t,n){return(t=ke(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Ae=class{constructor({id:e,config:t,label:n}){R(this,`id`,void 0),R(this,`label`,void 0),R(this,`type`,`external-manifest-preview`),R(this,`focusable`,!0),R(this,`serviceUrl`,void 0),R(this,`windows`,{}),this.id=e,this.label=n,this.serviceUrl=t.url}isPreviewValid(e){let t=this.windows[e];return!!(t&&t.window&&!t.window.closed)}getRequires(){return[`readOnlyManifest`]}getProvides(){return[]}async createPreview(e,t,n,r){let i=`${this.serviceUrl}`.replace(/\{manifestId}/,r.readOnlyManifest).replace(/\{time}/,`${Date.now()}`),a=window.open(i,this.id);return this.windows[e]={location:i,window:a},{id:this.id,type:`external-manifest-preview`,data:{url:i}}}async focus(e){let t=this.windows[e];t&&t.window&&t.window.focus()}async updatePreview(e,t,n,r){let i=this.windows[e];if(i)try{i.window?.close()}catch{}return this.createPreview(e,t,n,r)}async deletePreview(e){let t=this.windows[e];t&&t.window&&(t.window.close(),delete this.windows[e])}},je=class{constructor({id:e,config:t,label:n}){R(this,`id`,void 0),R(this,`label`,void 0),R(this,`type`,`iiif-preview-service`),R(this,`focusable`,!1),R(this,`serviceUrl`,void 0),R(this,`cache`,{}),this.id=e,this.label=n,this.serviceUrl=t.url}getRequires(){return[]}getProvides(){return[`readOnlyManifest`]}async isPreviewValid(e,t){if(this.cache[e])return!0;if(!t||!t.data||!t.data.readOnlyManifest)return!1;let n=t.data.readOnlyManifest;try{return(await fetch(n,{cache:`no-cache`})).ok}catch{return!1}}async createPreview(e,t,n){let r=n.toPresentation3(t),i=await fetch(this.serviceUrl,{method:`POST`,headers:{"Content-Type":`application/json`,Origin:`*`},body:JSON.stringify(r)});O(i.ok,`Unknown error creating preview`);let a=await i.json();return O(a.location,`Missing IIIF location while creating preview`),this.cache[e]={...a,time:Date.now()},{id:this.id,type:`external-manifest-preview`,data:{readOnlyManifest:`${a.location}/${Date.now()}`}}}async focus(){}async updatePreview(e,t,n){let r=this.cache[e];if(!r||Date.now()>r.expirationTtl+r.time||!r.updateLocation)return this.createPreview(e,t,n);let i=r.updateLocation,a=n.toPresentation3(t),o=await fetch(i,{method:`PUT`,headers:{"Content-Type":`application/json`,Origin:`*`},body:JSON.stringify(a)});O(o.ok,`Unknown error updating preview`);let s=await o.json();O(s.location),s.updateLocation&&(r.updateLocation=s.updateLocation);let c=`${s.location}/${Date.now()}`;return await fetch(c,{cache:`no-cache`}),{id:this.id,type:`external-manifest-preview`,data:{readOnlyManifest:`${s.location}/${Date.now()}`}}}async deletePreview(e){let t=this.cache[e];if(t&&t.deleteLocation)try{await fetch(t.deleteLocation,{method:`DELETE`,headers:{"Content-Type":`application/json`,Origin:`*`}})}catch{}}};function Me(e,t,n,r,i){let a=I(),o=Te(),s=(0,p.useVault)(),c=(0,l.useMemo)(()=>({setPreview:e=>{e&&i(t=>[...t.filter(t=>t.id!==e.id),e])},removePreview:e=>{i(t=>t.filter(t=>t.id!==e))}}),[i,o]),[u,d]=(0,l.useMemo)(()=>{let e={},t={};for(let r of n){e[r.id]=r;let n=r.getProvides();if(n.length)for(let e of n)t[e]||(t[e]=r.id)}return[e,t]},[n]);async function f(){let n=e.selected,i=r.find(e=>e.id===n);if(r&&r.length&&i){let e=u[i.id].getRequires(),n={};for(let i of r){let r=u[i.id];if(r){let i=r.getProvides();for(let l of i)if(e.indexOf(l)!==-1){let e=await r.updatePreview(o,a,s,n);e&&(c.setPreview(e),t({type:`activatePreview`,payload:e.id}),Object.assign(n,e.data||{}))}}}let l=u[i.id];if(l){let e=await l.updatePreview(o,a,s,n);e?c.setPreview(e):(c.removePreview(i.id),await l.deletePreview(o))}}}async function m(e){u[e]&&o&&(t({type:`selectPreview`,payload:e}),await v(e))}async function h(){let e=d.readOnlyManifest,t=e?u[e]:null;if(t&&o){let e=r.find(e=>e.type===`iiif-preview-service`);if(!e||!await t.isPreviewValid(o,e)){let e=await t.createPreview(o,a,s,{});if(e)return e.data.readOnlyManifest}}return null}function g(e){let n=u[e];n&&o&&(c.removePreview(e),n.deletePreview(o).then(()=>{t({type:`deletePreview`,payload:e})}))}async function _(e){let n=u[e];u[e]&&o&&n&&(await n.focus(o),t({type:`focusPreview`,payload:e}))}async function v(n){let i=u[n];if(i&&o){let l=r.find(e=>e.id===n);if(!l||!i.isPreviewValid(o,l)){let n={},l=i.getRequires();for(let i of l){let l=d[i],f=l?u[l]:null;O(f,`Missing handler for Preview requirement "${i}"`),r.find(e=>e.id===l),e.active.find(e=>e===l);{let e=await f.createPreview(o,a,s,n);Object.assign(n,e?.data||{}),c.setPreview(e),t({type:`activatePreview`,payload:e.id})}}let f=await i.createPreview(o,a,s,n);f&&(c.setPreview(f),t({type:`activatePreview`,payload:f.id}))}}}return(0,l.useMemo)(()=>({selectPreview:m,deletePreview:g,focusPreview:_,activatePreview:v,updatePreviews:f,getPreviewLink:h}),[u,o,s,e.selected,e.active,r])}function Ne(e){return(0,l.useMemo)(()=>{let t=[];for(let n of e)switch(n.type){case`iiif-preview-service`:t.push(new je(n));break;case`external-manifest-preview`:t.push(new Ae(n));break}return t},[])}const Pe=(0,m.produce)(function(e,t){switch(t.type){case`focusPreview`:break;case`deletePreview`:e.selected===t.payload&&(e.selected=null),e.active=e.active.filter(e=>e!==t.payload);break;case`activatePreview`:e.active.indexOf(t.payload)===-1&&e.active.push(t.payload);break;case`selectPreview`:e.selected=t.payload,e.active.indexOf(t.payload)===-1&&e.active.push(t.payload);break}});function Fe(){return{active:[],selected:null}}const Ie=(0,l.createContext)(null),Le=(0,l.createContext)([]),Re=(0,l.memo)(function({children:e,configs:t=[]}){let n=Te(),r=Ne(t),[i,a]=(0,c.useLocalStorage)(`preview-${n}`,[]),[o,s]=(0,l.useReducer)(Pe,void 0,Fe),d=Me(o,s,r,i,a),f=(0,l.useMemo)(()=>({configs:t,actions:d,handlers:r,...o}),[d,t,r,o]);return(0,l.useEffect)(()=>{for(let e of i)if(!o.active.includes(e.id)){let t=r.find(t=>t.id===e.id);t&&Promise.resolve(t.isPreviewValid(n,e)).then(t=>{t?s({type:`activatePreview`,payload:e.id}):a(t=>t.filter(t=>t.id!==e.id))})}},[n]),(0,u.jsx)(Le.Provider,{value:i,children:(0,u.jsx)(Ie.Provider,{value:f,children:e})})});function ze(){return(0,l.useContext)(Le)}function Be(){let e=(0,l.useContext)(Ie);return O(e,`usePreviewContext() can only be called from inside <PreviewProvider />`),e}const Ve=d.default.button`
|
|
64
64
|
border: none;
|
|
65
65
|
outline: none;
|
|
66
66
|
background-color: transparent;
|
|
@@ -236,10 +236,10 @@ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=
|
|
|
236
236
|
border-radius: 5px;
|
|
237
237
|
user-select: none;
|
|
238
238
|
cursor: not-allowed;
|
|
239
|
-
`;function nt({downloadEnabled:e,fileName:t}){let{active:n,configs:r,actions:i,selected:a}=Be(),o=(0,p.useVault)(),s=M(),l=I(),d=r.filter(e=>e.type===`external-manifest-preview`),{isOpen:m,buttonProps:h,itemProps:g}=(0,f.default)(d.length);return d.length===0?(0,u.jsx)(tt,{children:`Preview not available`}):(0,u.jsxs)(u.Fragment,{children:[e?(0,u.jsx)(`div`,{className:`mr-4`,children:(0,u.jsx)(c.DownloadButton,{fileName:t||`manifest.json`,label:`Download manifest`,getData:()=>s.export&&s.export.version===2?JSON.stringify(o.toPresentation2(l),null,2):JSON.stringify(o.toPresentation3(l),null,2)})}):null,(0,u.jsxs)(Ke,{children:[(0,u.jsx)(qe,{onClick:()=>{if(!a){let e=s.defaultPreview;if(e){let t=r.find(t=>t.id===e);if(t){i.selectPreview(t.id);return}}i.selectPreview(r[0].id)}i.updatePreviews()},children:`Preview`}),(0,u.jsx)(Je,{$open:m,...h,children:(0,u.jsx)(Se,{})}),(0,u.jsx)(Ye,{$open:m,children:d.map((e,t)=>{let r=n.indexOf(e.id)===-1;return(0,u.jsxs)(Xe,{...g[t],children:[(0,u.jsx)(Qe,{$status:r?`available`:e.id===a?`active`:`configured`}),(0,u.jsx)($e,{onClick:()=>{i.selectPreview(e.id)},children:e.label}),r?null:(0,u.jsx)(et,{onClick:()=>i.deletePreview(e.id),children:(0,u.jsx)(F,{})})]},e.id)})})]})]})}const rt=(0,l.memo)(function(e){let[t]=(0,c.useLocalStorage)(`menu-hidden`);return(0,u.jsx)(ge,{children:(0,u.jsxs)(he,{children:[(0,u.jsx)(ye,{onClick:e.onClickLogo,children:(0,u.jsx)(c.ManifestEditorLogo,{})}),(0,u.jsx)(nt,{})]})})}),it=(0,l.createContext)(null);function at(){return(0,l.useContext)(it)||null}function ot(e,t){let n=at();return n?n[e][t]:null}function st({children:e,menu:t}){return(0,u.jsx)(it.Provider,{value:t,children:e})}function ct(){return(0,l.useContext)(p.AtlasStoreReactContext)}function lt(e){if(!e)return null;if(e.points.length>2){let t=Math.min(...e.points.map(e=>e[0])),n=Math.min(...e.points.map(e=>e[1])),r=Math.max(0,...e.points.map(e=>e[0])),i=Math.max(0,...e.points.map(e=>e[1]));return{x:t,y:n,width:r-t,height:i-n}}return null}const ut=async e=>new Promise((t,n)=>{let r=document.createElement(`img`);r.onload=()=>t(r),r.onerror=()=>n(),r.src=e,r.complete&&t(r)}),dt=async e=>new Promise((t,n)=>{let r=document.createElement(`video`);r.onloadedmetadata=()=>t(r),r.onerror=()=>n(),r.preload=`metadata`,r.src=e});async function ft(){}async function pt(e,...t){if(!e)return;if(e.endsWith(`.mp3`)||e.endsWith(`.mp4`)||e.endsWith(`.m4a`)||e.endsWith(`.m4v`))try{let t=await dt(e);if(t){let n=t.videoWidth===0;return{id:e,type:t.videoWidth===0?`Sound`:`Video`,width:t.videoWidth||void 0,height:t.videoHeight||void 0,duration:t.duration,format:n?`audio/mp4`:`video/mp4`}}}catch{}let n=null;try{await fetch(e,{method:`HEAD`}),n=await fetch(e)}catch{return gt(e)}if(!n.ok&&(n=await fetch(e+`/info.json`),!n.ok))return gt(e);let r=n.headers.get(`Content-Type`);if(r?.includes(`image/`))return gt(e,r);let i=null;try{i=await n.json()}catch{return null}return await ht(i,e)}function mt(e){return e.protocol&&e.protocol===`http://iiif.io/api/image`?(e.type||(e.type=`ImageService`),e):null}async function ht(e,t){let n=mt(e);if(n)return n;if(!(e.id||e[`@id`]))return null;let r=await new g.Vault().load(t,e);if(r&&(r&&r?.type===`Manifest`||r?.type===`Collection`))return{id:t,type:r.type,label:(0,h.getValue)(r.label)}}async function gt(e,t){let n=e.split(`/`);if(n.length>=8){let e=n.slice(-4);if(e[3].split(`.`).length===2&&(e[2][0]===`!`||e[2]===e[2])){let e=await _t(n.slice(0,n.length-4).join(`/`)+`/info.json`);if(e&&e?.type&&e?.type?.startsWith(`ImageService`))return e}}try{let n=await ut(e);return{id:e,type:`Image`,width:n.width,height:n.height,format:await vt(e,t)}}catch{}return null}async function _t(e){try{let t=await fetch(e);return t.ok?await ht(await t.json(),e):null}catch(e){return console.log(e),null}}async function vt(e,t){if(t)return t;try{let t=(await fetch(e,{method:`HEAD`,mode:`no-cors`})).headers.get(`Content-type`);if(t)return t}catch{}let n=e.toLowerCase();return n.endsWith(`jpg`)||n.endsWith(`jpeg`)?`image/jpeg`:n.endsWith(`png`)?`image/png`:`image/jpeg`}async function yt(e){try{let t=await ut(e);if(t)return{width:t.naturalWidth||t.width,height:t.naturalHeight||t.height}}catch{return null}return null}
|
|
239
|
+
`;function nt({downloadEnabled:e,fileName:t}){let{active:n,configs:r,actions:i,selected:a}=Be(),o=(0,p.useVault)(),s=M(),l=I(),d=r.filter(e=>e.type===`external-manifest-preview`),{isOpen:m,buttonProps:h,itemProps:g}=(0,f.default)(d.length);return d.length===0?(0,u.jsx)(tt,{children:`Preview not available`}):(0,u.jsxs)(u.Fragment,{children:[e?(0,u.jsx)(`div`,{className:`mr-4`,children:(0,u.jsx)(c.DownloadButton,{fileName:t||`manifest.json`,label:`Download manifest`,getData:()=>s.export&&s.export.version===2?JSON.stringify(o.toPresentation2(l),null,2):JSON.stringify(o.toPresentation3(l),null,2)})}):null,(0,u.jsxs)(Ke,{children:[(0,u.jsx)(qe,{onClick:()=>{if(!a){let e=s.defaultPreview;if(e){let t=r.find(t=>t.id===e);if(t){i.selectPreview(t.id);return}}i.selectPreview(r[0].id)}i.updatePreviews()},children:`Preview`}),(0,u.jsx)(Je,{$open:m,...h,children:(0,u.jsx)(Se,{})}),(0,u.jsx)(Ye,{$open:m,children:d.map((e,t)=>{let r=n.indexOf(e.id)===-1;return(0,u.jsxs)(Xe,{...g[t],children:[(0,u.jsx)(Qe,{$status:r?`available`:e.id===a?`active`:`configured`}),(0,u.jsx)($e,{onClick:()=>{i.selectPreview(e.id)},children:e.label}),r?null:(0,u.jsx)(et,{onClick:()=>i.deletePreview(e.id),children:(0,u.jsx)(F,{})})]},e.id)})})]})]})}const rt=(0,l.memo)(function(e){let[t]=(0,c.useLocalStorage)(`menu-hidden`);return(0,u.jsx)(ge,{children:(0,u.jsxs)(he,{children:[(0,u.jsx)(ye,{onClick:e.onClickLogo,children:(0,u.jsx)(c.ManifestEditorLogo,{})}),(0,u.jsx)(nt,{})]})})}),it=(0,l.createContext)(null);function at(){return(0,l.useContext)(it)||null}function ot(e,t){let n=at();return n?n[e][t]:null}function st({children:e,menu:t}){return(0,u.jsx)(it.Provider,{value:t,children:e})}function ct(){return(0,l.useContext)(p.AtlasStoreReactContext)}function lt(e){if(!e)return null;if(e.points.length>2){let t=Math.min(...e.points.map(e=>e[0])),n=Math.min(...e.points.map(e=>e[1])),r=Math.max(0,...e.points.map(e=>e[0])),i=Math.max(0,...e.points.map(e=>e[1]));return{x:t,y:n,width:r-t,height:i-n}}return null}const ut=async e=>new Promise((t,n)=>{let r=document.createElement(`img`);r.onload=()=>t(r),r.onerror=()=>n(),r.src=e,r.complete&&t(r)}),dt=async e=>new Promise((t,n)=>{let r=document.createElement(`video`);r.onloadedmetadata=()=>t(r),r.onerror=()=>n(),r.preload=`metadata`,r.src=e});async function ft(){}async function pt(e,...t){if(!e)return;if(e.endsWith(`.mp3`)||e.endsWith(`.mp4`)||e.endsWith(`.m4a`)||e.endsWith(`.m4v`))try{let t=await dt(e);if(t){let n=t.videoWidth===0;return{id:e,type:t.videoWidth===0?`Sound`:`Video`,width:t.videoWidth||void 0,height:t.videoHeight||void 0,duration:t.duration,format:n?`audio/mp4`:`video/mp4`}}}catch{}let n=null;try{await fetch(e,{method:`HEAD`}),n=await fetch(e)}catch{return gt(e)}if(!n.ok&&(n=await fetch(e+`/info.json`),!n.ok))return gt(e);let r=n.headers.get(`Content-Type`);if(r?.includes(`image/`))return gt(e,r);let i=null;try{i=await n.json()}catch{return null}return await ht(i,e)}function mt(e){return e.protocol&&e.protocol===`http://iiif.io/api/image`?(e.type||(e.type=`ImageService`),e):null}async function ht(e,t){let n=mt(e);if(n)return n;if(!(e.id||e[`@id`]))return null;let r=await new g.Vault().load(t,e);if(r&&(r&&r?.type===`Manifest`||r?.type===`Collection`))return{id:t,type:r.type,label:(0,h.getValue)(r.label)}}async function gt(e,t){let n=e.split(`/`);if(n.length>=8){let e=n.slice(-4);if(e[3].split(`.`).length===2&&(e[2][0]===`!`||e[2]===e[2])){let e=await _t(n.slice(0,n.length-4).join(`/`)+`/info.json`);if(e&&e?.type&&e?.type?.startsWith(`ImageService`))return e}}try{let n=await ut(e);return{id:e,type:`Image`,width:n.width,height:n.height,format:await vt(e,t)}}catch{}return null}async function _t(e){try{let t=await fetch(e);return t.ok?await ht(await t.json(),e):null}catch(e){return console.log(e),null}}async function vt(e,t){if(t)return t;try{let t=(await fetch(e,{method:`HEAD`,mode:`no-cors`})).headers.get(`Content-type`);if(t)return t}catch{}let n=e.toLowerCase();return n.endsWith(`jpg`)||n.endsWith(`jpeg`)?`image/jpeg`:n.endsWith(`png`)?`image/png`:`image/jpeg`}async function yt(e){try{let t=await ut(e);if(t)return{width:t.naturalWidth||t.width,height:t.naturalHeight||t.height}}catch{return null}return null}async function bt(e){let t;try{await fetch(e).then(e=>e.json().catch(e=>{console.error(`'${e}' happened!`)})).then(e=>{t={...e}})}catch(e){console.log(e)}return t}function xt(e,t,n){return`create_${e}_${t}_${(0,_.toRef)(n)?.type||`unknown`}`}function B(e,t,n=`text/json`){let r=e instanceof Blob?e:new Blob([e],{type:n}),i=document.createElement(`a`);i.download=t,i.href=window.URL.createObjectURL(r);let a=new MouseEvent(`click`,{view:window,bubbles:!0,cancelable:!0});i.dispatchEvent(a),i.remove()}async function St(e){return navigator.clipboard.writeText(typeof e==`string`?e:JSON.stringify(e,null,2))}function Ct(){return`${Math.random().toString(36).substr(2)}-${Date.now().toString(36)}`}function wt(e,t){let{default:n,config:r,...i}=e,a={metadata:n,layout:{leftPanels:[],rightPanels:[],centerPanels:[],...i},config:r};return t?t(a):a}function Tt(e,t,n){return{...e,metadata:t,config:{...e.config||{},...n.config||{}},layout:{...e.layout,leftPanels:[...(e.layout.leftPanels||[]).filter(e=>n?.leftPanelIds?n.leftPanelIds.includes(e.id):!0),...n?.leftPanels||[]],annotations:[...n?.annotations||[],...e.layout.annotations||[]],canvasEditors:[...n?.canvasEditors||[],...e.layout.canvasEditors||[]],creators:[...n?.creators||[],...e.layout.creators||[]],background:[...e.layout?.background||[],...n?.background||[]],editors:[...n?.editors||[],...e.layout.editors||[]],rightPanels:[...e.layout.rightPanels||[],...n?.rightPanels||[]],centerPanels:[...e.layout.centerPanels||[],...n?.centerPanels||[]],modals:[...e.layout.modals||[],...n?.modalPanels||[]]}}}const V=(0,y.create)(e=>({regions:{},resources:[],setRegion:(t,n)=>{e(e=>({...e.regions,regions:{[t]:n||null}}))},setHighlight:t=>{e({resources:Array.isArray(t)?t:[t]})},highlight:t=>{e(e=>e.resources.indexOf(t)===-1?{resources:[...e.resources,t]}:e)},clearHighlight:t=>{e(e=>({resources:e.resources.filter(e=>e!==t)}))}}));function Et(e){let t=(0,l.useMemo)(()=>Ct(),[]),n=V(e=>e.regions[t]),r=V(e=>e.setRegion);(0,l.useEffect)(()=>{n&&e?n!==e&&(n.x!==e.x||n.y!==e.y||n.width!==e.width||n.height!==e.height)&&r(t,e||null):r(t,e||null)},[n]),(0,l.useEffect)(()=>()=>r(t,null),[])}function Dt(e){let t=V(e=>e.highlight),n=V(e=>e.clearHighlight);return(0,l.useEffect)(()=>()=>{e&&n(e)},[n,e]),(0,l.useMemo)(()=>({onMouseEnter(){e&&t(e)},onMouseLeave(){e&&n(e)}}),[e,t,n])}const Ot=e=>(0,u.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,height:`1em`,width:`1em`,viewBox:`0 0 24 24`,...e,children:[(0,u.jsx)(`path`,{d:`M0 0h24v24H0z`,fill:`none`}),(0,u.jsx)(`path`,{d:`M0 0h24v24H0z`,fill:`none`}),(0,u.jsx)(`path`,{d:`M12 17.27 18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z`,fill:`currentColor`})]}),kt=({style:e})=>(0,u.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,height:`1rem`,viewBox:`0 0 24 24`,width:`1rem`,fill:`#000000`,style:e,children:[(0,u.jsx)(`path`,{d:`M0 0h24v24H0z`,fill:`none`}),(0,u.jsx)(`path`,{d:`M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z`})]}),At=(0,l.createContext)(null),jt=(0,l.createContext)(null);function Mt(){return(0,l.useContext)(jt)}function H(){return(0,l.useContext)(At)}function Nt(){return P().layout}function Pt(){let e=P(),t=e.layout,n=(0,l.useContext)(At),r=(0,l.useContext)(jt);return(0,l.useMemo)(()=>({actions:n,state:r,...t}),[e,r])}function Ft(e){let t=e.error.toString(),[n,r]=(0,l.useState)(!1);return(0,u.jsxs)(c.PaddedSidebarContainer,{children:[(0,u.jsx)(c.ErrorMessage,{className:`mb-2`,children:t}),(0,u.jsx)(We,{onClick:e.resetErrorBoundary,children:`Try again`})]})}function It(e){return e&&e.pinnable}function Lt({initial:e,fallback:t,options:n={}}){return Math.max(n.minWidth||0,Math.min(n.maxWidth||1/0,e||t))}function Rt(e){return typeof e==`string`?(0,l.createElement)(`div`,{dangerouslySetInnerHTML:{__html:e}}):e}const zt=d.default.div`
|
|
240
240
|
position: relative;
|
|
241
241
|
display: inline-block;
|
|
242
|
-
`,
|
|
242
|
+
`,Bt=d.default.div`
|
|
243
243
|
display: flex;
|
|
244
244
|
flex-direction: column;
|
|
245
245
|
position: absolute;
|
|
@@ -254,7 +254,7 @@ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=
|
|
|
254
254
|
background-color: ${e=>e.theme.color.lightgrey||`lightgrey`};
|
|
255
255
|
}
|
|
256
256
|
}
|
|
257
|
-
`,
|
|
257
|
+
`,Vt=d.default.button`
|
|
258
258
|
padding: 0 ${e=>e.theme.padding.small||`0.5rem`};
|
|
259
259
|
color: ${e=>e.theme.color.main||`none`};
|
|
260
260
|
background-color: ${e=>e.theme.color.white||`white`};
|
|
@@ -281,7 +281,7 @@ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=
|
|
|
281
281
|
color: #fff;
|
|
282
282
|
}
|
|
283
283
|
`}
|
|
284
|
-
`,
|
|
284
|
+
`,Ht=d.default.div`
|
|
285
285
|
display: none;
|
|
286
286
|
flex-direction: column;
|
|
287
287
|
position: absolute;
|
|
@@ -308,17 +308,17 @@ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=
|
|
|
308
308
|
${e=>e.$open&&d.css`
|
|
309
309
|
display: flex;
|
|
310
310
|
`}
|
|
311
|
-
`,
|
|
311
|
+
`,Ut=d.default.div`
|
|
312
312
|
color: #999;
|
|
313
313
|
text-transform: uppercase;
|
|
314
314
|
font-weight: 600;
|
|
315
315
|
padding: 0.7em;
|
|
316
316
|
font-size: 0.875em;
|
|
317
|
-
`,
|
|
317
|
+
`,Wt=d.default.div`
|
|
318
318
|
height: 1px;
|
|
319
319
|
margin: 0 0.5em;
|
|
320
320
|
background: #eee;
|
|
321
|
-
`,
|
|
321
|
+
`,Gt=`OverrideScrollbar`,Kt=(0,l.createContext)(null);function qt(){return(0,l.useContext)(Kt)}const Jt=d.default.div`
|
|
322
322
|
display: flex;
|
|
323
323
|
flex-direction: column;
|
|
324
324
|
position: relative;
|
|
@@ -370,7 +370,7 @@ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=
|
|
|
370
370
|
&[data-state="unmounted"] {
|
|
371
371
|
transform: translateX(100%);
|
|
372
372
|
}
|
|
373
|
-
`,
|
|
373
|
+
`,Yt=d.default.div`
|
|
374
374
|
background: #fff;
|
|
375
375
|
display: flex;
|
|
376
376
|
height: 2.8em;
|
|
@@ -392,7 +392,7 @@ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=
|
|
|
392
392
|
background: #ffc2d2;
|
|
393
393
|
box-shadow: inset 0 -5px 10px 0 rgba(255, 255, 255, 0.5);
|
|
394
394
|
}
|
|
395
|
-
`,
|
|
395
|
+
`,U=d.default.button`
|
|
396
396
|
border: none;
|
|
397
397
|
background: transparent;
|
|
398
398
|
padding: 0 0.4em;
|
|
@@ -404,15 +404,15 @@ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=
|
|
|
404
404
|
svg {
|
|
405
405
|
font-size: 1.2em;
|
|
406
406
|
}
|
|
407
|
-
`,
|
|
407
|
+
`,Xt=d.default.div`
|
|
408
408
|
flex: 1 1 0px;
|
|
409
|
-
`,
|
|
409
|
+
`,Zt=d.default.div`
|
|
410
410
|
font-size: 0.875em;
|
|
411
411
|
flex: 1 1 0px;
|
|
412
412
|
padding-left: 1em;
|
|
413
413
|
text-align: center;
|
|
414
414
|
align-self: center;
|
|
415
|
-
`,
|
|
415
|
+
`,Qt=d.default.div`
|
|
416
416
|
flex: 1 1 0px;
|
|
417
417
|
display: flex;
|
|
418
418
|
|
|
@@ -423,7 +423,7 @@ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=
|
|
|
423
423
|
> * {
|
|
424
424
|
min-width: 0;
|
|
425
425
|
}
|
|
426
|
-
`;function Gt({panel:e,state:t,actions:n,isLeft:r,pinActions:i=n,transition:a,close:o,available:s=[],style:c,noHeader:d}){let m=(0,l.useContext)(p.ReactVaultContext)||null,[h,g]=(0,l.useState)(!1),_=ce(),v=wt(),{tabs:b,pinnable:x,hideHeader:S}=e?.options||{},C=[_.state.canvasId,e?.id],w=(0,l.useMemo)(()=>(s||[]).filter(e=>!e.requiresState),[s]),{itemProps:T,isOpen:ee,setIsOpen:E}=(0,f.default)(w.length),[te,D]=(0,l.useState)(``),O=(0,l.useRef)();(0,l.useEffect)(()=>g(!1),C),(0,l.useEffect)(()=>D(``),[e]),(0,l.useEffect)(()=>(O.current=D,()=>{O.current=void 0}),[]);let k=(0,l.useCallback)(e=>{O.current&&O.current(e)},[]),A=(0,l.useCallback)(r=>{let i=e?t.stack.length?n.popStack:e.backAction?()=>e&&e.backAction&&e.backAction(t,{...v,current:n},_):null:null;r&&(!i||r.metaKey)&&w.length?(r.preventDefault(),E(!0)):i&&i()},[n,_,v,e,E,t,w.length]),ne=r=>{n.change({id:r.id,state:r.defaultState,stacked:!!(t.stack.length||e?.backAction)})};if(!e||!t.current)return null;let j=e.backAction||t.stack.length?(0,u.jsx)(V,{onClick:A,children:(0,u.jsx)(Et,{})}):null,M=(0,u.jsx)(V,{onClick:o||n.close,children:(0,u.jsx)(F,{})});return(0,u.jsx)(Rt.Provider,{value:k,children:(0,u.jsxs)(Bt,{"data-state":a,"data-flipped":r,style:c,"data-header":!d,children:[d?null:(0,u.jsxs)(Vt,{"data-tabs":!!b,"data-error":h,children:[(0,u.jsxs)(jt,{style:{display:`flex`,height:`100%`},children:[e.renderBackAction?e.renderBackAction({backAction:A,fallback:j}):j,w.length?(0,u.jsxs)(Pt,{$open:ee,style:{left:`0.5em`},children:[(0,u.jsx)(Ft,{children:`All panels`}),(0,u.jsx)(It,{}),w.map((t,n)=>(0,u.jsx)(Nt,{...T[n],onClick:()=>ne(t),$active:e.id===t.id,children:t.label},n))]}):null]}),te?(0,u.jsx)(Ut,{children:te}):S?(0,u.jsx)(Ht,{}):(0,u.jsx)(Ut,{children:e.label}),x?t.pinned?(0,u.jsx)(V,{onClick:i.unpin,children:(0,u.jsx)(Tt,{fill:`orange`})}):(0,u.jsx)(V,{onClick:()=>i.pin({id:e.id,state:t.state}),children:(0,u.jsx)(Tt,{fill:`#ddd`})}):null,e.renderCloseAction?e.renderCloseAction({closeAction:o||n.close,fallback:M}):M]}),(0,u.jsx)(Wt,{className:`OverrideScrollbar`,children:(0,u.jsx)(y.ErrorBoundary,{onError:()=>g(!0),FallbackComponent:Dt,resetKeys:C,onReset:()=>g(!1),children:At(e.render(t.state||e.defaultState||{},{...v,current:n,vault:m,transition:a},_))})})]})})}async function Kt(e){let t;try{await fetch(e).then(e=>e.json().catch(e=>{console.error(`'${e}' happened!`)})).then(e=>{t={...e}})}catch(e){console.log(e)}return t}function qt(e,t,n){return`create_${e}_${t}_${(0,_.toRef)(n)?.type||`unknown`}`}function H(e,t,n=`text/json`){let r=e instanceof Blob?e:new Blob([e],{type:n}),i=document.createElement(`a`);i.download=t,i.href=window.URL.createObjectURL(r);let a=new MouseEvent(`click`,{view:window,bubbles:!0,cancelable:!0});i.dispatchEvent(a),i.remove()}async function Jt(e){return navigator.clipboard.writeText(typeof e==`string`?e:JSON.stringify(e,null,2))}function Yt(){return`${Math.random().toString(36).substr(2)}-${Date.now().toString(36)}`}function Xt(e,t){let{default:n,config:r,...i}=e,a={metadata:n,layout:{leftPanels:[],rightPanels:[],centerPanels:[],...i},config:r};return t?t(a):a}function Zt(e,t,n){return{...e,metadata:t,config:{...e.config||{},...n.config||{}},layout:{...e.layout,leftPanels:[...(e.layout.leftPanels||[]).filter(e=>n?.leftPanelIds?n.leftPanelIds.includes(e.id):!0),...n?.leftPanels||[]],annotations:[...n?.annotations||[],...e.layout.annotations||[]],canvasEditors:[...n?.canvasEditors||[],...e.layout.canvasEditors||[]],creators:[...n?.creators||[],...e.layout.creators||[]],background:[...e.layout?.background||[],...n?.background||[]],editors:[...n?.editors||[],...e.layout.editors||[]],rightPanels:[...e.layout.rightPanels||[],...n?.rightPanels||[]],centerPanels:[...e.layout.centerPanels||[],...n?.centerPanels||[]],modals:[...e.layout.modals||[],...n?.modalPanels||[]]}}}const U=(0,b.create)(e=>({regions:{},resources:[],setRegion:(t,n)=>{e(e=>({...e.regions,regions:{[t]:n||null}}))},setHighlight:t=>{e({resources:Array.isArray(t)?t:[t]})},highlight:t=>{e(e=>e.resources.indexOf(t)===-1?{resources:[...e.resources,t]}:e)},clearHighlight:t=>{e(e=>({resources:e.resources.filter(e=>e!==t)}))}}));function Qt(e){let t=(0,l.useMemo)(()=>Yt(),[]),n=U(e=>e.regions[t]),r=U(e=>e.setRegion);(0,l.useEffect)(()=>{n&&e?n!==e&&(n.x!==e.x||n.y!==e.y||n.width!==e.width||n.height!==e.height)&&r(t,e||null):r(t,e||null)},[n]),(0,l.useEffect)(()=>()=>r(t,null),[])}function $t(e){let t=U(e=>e.highlight),n=U(e=>e.clearHighlight);return(0,l.useEffect)(()=>()=>{e&&n(e)},[n,e]),(0,l.useMemo)(()=>({onMouseEnter(){e&&t(e)},onMouseLeave(){e&&n(e)}}),[e,t,n])}function en(e=`vault://homepage-collection.json`){let t=new g.Vault,n=window.localStorage.getItem(`preview-vault-collection`),r=!1;if(n)try{let i=JSON.parse(n);if(i.id&&i.id===e){t.dispatch((0,x.requestResource)({id:i.id}));let e=(0,S.actionListFromResource)(i.id,i);t.dispatch((0,x.batchActions)({actions:e})),r=!0}}catch{}if(!r){let n=(0,S.actionListFromResource)(e,{"@context":`http://iiif.io/api/presentation/3/context.json`,id:e,type:`Collection`,label:{en:[`Recent items`]},items:[]});t.dispatch((0,x.requestResource)({id:e})),t.dispatch((0,x.batchActions)({actions:n}))}return t.on(`after:@iiif/REMOVE_REFERENCE`,n=>{n.action.payload.id===e&&window.localStorage.setItem(`preview-vault-collection`,JSON.stringify(t.toPresentation3({id:e,type:`Collection`})))}),{vault:t,unsubscribe:()=>{},addHistory:(n,r)=>{let i=t.getState();if(n&&r&&(r===`Collection`||r===`Manifest`)){let a=i.iiif.entities.Collection[e];if(a){let i=a.items.findIndex(e=>e.id===n);i===-1?t.dispatch((0,x.addReference)({id:e,type:`Collection`,reference:{id:n,type:r},key:`items`,index:0})):t.dispatch((0,x.reorderEntityField)({id:e,type:`Collection`,key:`items`,startIndex:i,endIndex:0})),window.localStorage.setItem(`preview-vault-collection`,JSON.stringify(t.toPresentation3({id:e,type:`Collection`})))}}},clearHistory:()=>{t.dispatch((0,x.modifyEntityField)({id:e,type:`Collection`,key:`items`,value:[]})),window.localStorage.setItem(`preview-vault-collection`,JSON.stringify(t.toPresentation3({id:e,type:`Collection`})))}}}function tn(){return(0,l.useContext)(nn)}const nn=(0,l.createContext)(new g.Vault),rn=(0,l.createContext)({addHistory:(e,t)=>{},clearHistory:()=>{}}),an=`manifest-editor://homepage-collection.json`;function on(){return(0,l.useContext)(rn)}function sn(e){let{vault:t,unsubscribe:n,addHistory:r,clearHistory:i}=(0,l.useMemo)(()=>en(an),[]);return(0,l.useEffect)(()=>n,[]),(0,u.jsx)(rn.Provider,{value:{addHistory:r,clearHistory:i},children:(0,u.jsx)(nn.Provider,{value:t,children:e.children})})}function cn({children:e}){return(0,u.jsx)(p.VaultProvider,{vault:tn(),children:e})}function ln(e,t,n,r,i){let a=(0,p.useVault)(),o=P(),{create:s,edit:c}=B(),u=(0,l.useMemo)(()=>(0,v.matchBasedOnResource)({type:n,parent:e,index:0,property:t},o.layout.creators||[],{vault:a}),[e,t,o.layout.creators,n,a]),d=e&&u.length!==0,f=(0,l.useCallback)((a,o)=>{e&&s({type:n,parent:(0,_.toRef)(e),property:t,index:a,target:r,initialData:o,...i||{}})},[s,e,t,n,i,r]),m=(0,l.useCallback)((a,o,c)=>{e&&s({type:n,filter:a,parent:(0,_.toRef)(e),property:t,index:o,target:r,initialData:c,...i||{}})},[s,e,t,n,i,r]);return[d,{create:f,edit:(0,l.useCallback)((n,r)=>{c(n,e?{parent:(0,_.toRef)(e),property:t,index:r}:void 0)},[c,e,t]),createFiltered:m,creator:(0,l.useCallback)((a,o)=>{e&&s({type:n,initialCreator:a,parent:(0,_.toRef)(e),property:t,target:r,initialData:o,...i||{}})},[n,t,e,r,s,i]),buttonProps:(0,l.useMemo)(()=>({"data-action-id":qt(n,t,e)}),[n,t,e])}]}function un(){let e=(0,p.useVault)(),t=tn(),n=P();return(0,l.useMemo)(()=>new v.Creator(e,n.layout.creators||[],t),[n.layout.creators,e])}const dn=(0,l.memo)(function(e){let t=(0,p.useVault)(),{edit:n,modal:r}=B(),[i,a]=(0,l.useState)(!1),[o,s]=(0,l.useState)(null),d=un(),f=(0,l.useRef)(!1),m=e.resource.initialData?.selector;Qt(m);let h={targetType:e.resource.type,parent:e.resource.parent?{property:e.resource.property,atIndex:e.resource.index,resource:e.resource.parent}:void 0,target:e.resource.target,initialData:e.resource.initialData},g=t=>{try{if(i||f.current)return;a(!0),f.current=!0,d.create(e.creator.id,t,h).catch(e=>(s(e?.message||`Unknown error`),null)).then(async t=>{if(e.onCreate?.(),e.skipEditingOnCreate||!t)return;let i=Array.isArray(t)?t[0]:t;a(!1),r.popStack(),r.close(),i&&n(i,{parent:(0,_.toRef)(e.resource.parent),property:e.resource.property,index:e.resource.index})})}catch(e){s(e?.message||`Unknown error`)}},v=async()=>!0;if((0,l.useEffect)(()=>{e.resource.initialData?.showEmptyForm||!e.creator.render&&!i&&g({})},[e.creator]),o)return(0,u.jsx)(`div`,{className:`flex flex-col items-center p-4`,children:(0,u.jsx)(c.ErrorMessage,{children:o})});let y=(0,u.jsx)(`div`,{className:`flex flex-col items-center py-8`,children:(0,u.jsxs)(`div`,{className:`flex gap-2 items-center`,children:[(0,u.jsx)(c.Spinner,{}),` `,(0,u.jsx)(`span`,{children:`Loading`})]})});return i?y:e.creator.render?(0,u.jsx)(u.Fragment,{children:(0,u.jsx)(l.Suspense,{fallback:y,children:e.creator.render({vault:t,runCreate:g,validate:v,options:h})})}):(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(c.EmptyState,{children:`No options available`}),(0,u.jsx)(c.ActionButton,{primary:!0,onPress:()=>g({}),children:e.creator.actionButton||`Create`})]})});function fn(e){let t=P(),n=(0,p.useVault)(),[r,i]=(0,l.useState)(e.resource.initialCreator||``),a=zt(),o=(0,l.useMemo)(()=>(0,v.matchBasedOnResource)(e.resource,t.layout.creators||[],{vault:n}),[e.resource,t.layout.creators,n]);o.length===1&&!r&&i(o[0].id);let s=o.find(e=>e.id===r);if((0,l.useEffect)(()=>{s&&a?.(s.label)}),o.length===0)return(0,u.jsx)(`div`,{children:`Not currently supported`});let d=(0,u.jsx)(c.ModalBackSlot,{children:(0,u.jsx)(c.IconButton,{root:document.getElementById(`headlessui-portal-root`)||void 0,label:`Back to Add content options`,className:`group`,placement:`right`,onPress:()=>i(``),children:(0,u.jsx)(c.GridIcon,{className:`text-2xl opacity-50 group-hover:opacity-70`})})});return s?s.hiddenModal?(0,u.jsxs)(u.Fragment,{children:[d,(0,u.jsx)(dn,{creator:s,resource:e.resource})]}):(0,u.jsxs)(`div`,{children:[d,(0,u.jsx)(`div`,{className:`p-2 py-6`,children:(0,u.jsx)(dn,{creator:s,resource:e.resource})})]}):(0,u.jsx)(c.CreatorGrid,{label:`Select a type`,items:o.map(e=>({id:e.id,title:e.label,description:e.summary||``,icon:e.icon,onClick:()=>i(e.id)}))})}const pn={id:`@manifest-editor/creator`,label:`Add content`,options:{hideHeader:!0,tabs:!1},render(e){return(0,u.jsx)(fn,{resource:e})}};function mn(e,t){switch(t.type){case`setStack`:return{...e,stack:t.payload.resources,current:t.payload.resources[0]||null};case`edit`:{let n=t.payload.reset;return(t.payload.resource?.resource.source?.type===`Manifest`||t.payload.resource?.resource.source?.type===`Canvas`)&&(n=!0),e.current?.resource.source.id===t.payload.resource?.resource.source.id?{...e,current:t.payload.resource}:{...e,current:t.payload.resource,stack:n?[]:e.current?[e.current,...e.stack]:e.stack}}case`syncRemoval`:{let n=(0,_.toRef)(t.payload.resource.resource);if(!n||!e.stack.find(e=>(0,_.toRef)(e.resource)?.id===n.id))return e;let r=e.current?.resource.id===n.id?null:e.current,i=hn(e.stack.filter(e=>(0,_.toRef)(e.resource)?.id!==n.id),r);return{...e,stack:i,current:r}}case`updateCurrent`:return{...e,current:t.payload.resource};case`back`:{let t=e.stack[0];return{...e,stack:e.stack.slice(1),current:t||null}}case`close`:return{...e,stack:[],current:null};case`create`:return t.payload.resource===null?{...e,create:null}:{...e,create:t.payload}}return e}function hn(e,t){let n=[],r=null;for(let t of e)r?.resource.id!==t.resource.id&&(n.push(t),r=t);return r&&r.resource.id===t?.resource.id?n.slice(0,n.length-1):n}const gn={stack:[],current:null,create:null},W=(0,l.createContext)(gn),_n=(0,l.createContext)({edit(){},close(){},back(){},setStack(){},updateCurrent(){},create(){return()=>{}}});function vn(){return(0,l.useContext)(_n)}function yn(){return(0,l.useContext)(W).current}function bn(){return(0,l.useContext)(W).stack}function xn(){return(0,l.useContext)(W).create}function Sn(){let{manifest:e}=(0,p.useResourceContext)(),t=(0,p.useVault)(),[n,r]=(0,l.useReducer)(e=>e+1,0);k(e,`Manifest not found`);let i=(0,l.useMemo)(()=>new C.EditorInstance({reference:{id:e,type:`Manifest`},vault:t}),[e,t]);return(0,l.useEffect)(()=>i.observe.start(r),[i]),i.observe.key=`${n}`,i.observe.reset(),i}function Cn(){let{collection:e}=(0,p.useResourceContext)(),t=(0,p.useVault)(),[n,r]=(0,l.useReducer)(e=>e+1,0);k(e,`Collection not found`);let i=(0,l.useMemo)(()=>new C.EditorInstance({reference:{id:e,type:`Collection`},vault:t}),[e,t]);return(0,l.useEffect)(()=>i.observe.start(r),[i]),i.observe.key=`${n}`,i.observe.reset(),i}function wn(e,t={}){let n=(0,p.useVault)(),[r,i]=(0,l.useReducer)(e=>e+1,0);!t.allowNull&&k(e,`Resource not found`);let a=(0,l.useMemo)(()=>t.allowNull&&!e?null:new C.EditorInstance({reference:(0,_.toRef)(e),vault:n,context:{resource:e,parent:t.parent,index:t.index,parentProperty:t.parentProperty}}),[e,n]);return(0,l.useEffect)(()=>a?.observe.start(i),[a]),a&&(a.observe.key=`${r}`,a.observe.reset()),a}function Tn(){let{annotationPage:e}=(0,p.useResourceContext)();return k(e,`Annotation page not found`),wn({id:e,type:`AnnotationPage`})}function En(){let e=yn(),t=(0,p.useVault)(),[n,r]=(0,l.useReducer)(e=>e+1,0);k(e,`No resource selected`);let i=(0,l.useMemo)(()=>new C.EditorInstance({reference:e.resource.source||e.resource,vault:t}),[e,t]);return(0,l.useEffect)(()=>i.observe.start(r),[i]),i.observe.key=`${n}`,i.observe.reset(),i}function Dn(e){let t=(0,p.useVault)(),[n,r]=(0,l.useReducer)(mn,e),i=(0,l.useCallback)(e=>{r(e)},[]);(0,l.useEffect)(()=>t.on(`@iiif/REMOVE_REFERENCE`,e=>{let t=e.action,n={id:t.payload.id,type:t.payload.type},i=t.payload.reference;r({type:`syncRemoval`,payload:{resource:{parent:n,resource:i}}})}),[t]);let a=(0,l.useCallback)((e,t=!1)=>i({type:`edit`,payload:{resource:e,reset:t}}),[]),o=(0,l.useCallback)(e=>i({type:`setStack`,payload:{resources:e}}),[]),s=(0,l.useCallback)(e=>i({type:`updateCurrent`,payload:{resource:e}}),[]),c=(0,l.useCallback)(()=>i({type:`close`}),[]),u=(0,l.useCallback)(()=>i({type:`back`}),[]),d=(0,l.useCallback)((e,t)=>(i({type:`create`,payload:{resource:e,options:t}}),()=>{i({type:`create`,payload:{resource:null}})}),[]);return[n,(0,l.useMemo)(()=>({edit:a,updateCurrent:s,close:c,back:u,create:d,setStack:o}),[])]}function On(e){let{instanceId:t}=se(),[n,r]=Dn(e.initialState||gn);return(0,u.jsx)(_n.Provider,{value:r,children:(0,u.jsx)(W.Provider,{value:n,children:e.children})},t)}function kn({resource:e,children:t}){let{instanceId:n}=se(),[r,i]=Dn((0,l.useMemo)(()=>({create:null,stack:[],current:{resource:{type:`SpecificResource`,source:{id:e.id,type:e.type}}}}),[]));return(0,u.jsx)(_n.Provider,{value:i,children:(0,u.jsx)(W.Provider,{value:r,children:t})},n)}function An({fallback:e,backAction:t}){let n=bn(),{back:r}=vn();return n.length?(0,u.jsx)(V,{onClick:r,children:(0,u.jsx)(Et,{})}):e}function jn({closeAction:e,fallback:t}){let n=bn();return yn()||n.length?(0,u.jsx)(V,{onClick:()=>{e()},children:(0,u.jsx)(F,{})}):t}function Mn(e,t,n,r){let i=t.filter(t=>t.resourceType===e.resource.source.type);if(i.length===0)return null;for(let t of i){let i=[],a={},o=(t.editors||[]).filter(t=>{if(r.hideTabs&&r.hideTabs.includes(t.id)||r.onlyTabs&&!r.onlyTabs.includes(t.id))return!1;if(t.supports.sortKey){if(i.includes(t.supports.sortKey))return!1;t.supports.sortFallback&&(a[t.supports.sortKey]=t)}return n.edit&&!t.supports.edit||t.supports.custom&&t.supports.custom(e,n.vault)===!1?!1:(t.supports.sortKey&&i.push(t.supports.sortKey),!0)}),s=Object.keys(a);for(let e of s)!i.includes(e)&&a[e]&&!o.includes(a[e])&&o.push(a[e]);if(o.length)return{...t,editors:o}}return null}function Nn({currentTab:e=void 0}){let t=yn(),n=(0,l.useContext)(p.ResourceReactContext),r=P(),i=I(),a=(0,p.useVault)(),{change:o}=B(),s=zt(),{editorConfig:d}=M(),f=t?.resource.source?.id,m=t?.resource.source?.type,h=f!==i.id;f&&h&&i.type===`Collection`&&m===`Collection`&&(m=`EmbeddedCollection`);let g=(m?d[m]:d.All)||{},_=(0,l.useMemo)(()=>{let e={...n},r=t?.resource.source.id,i=t?.resource.source.type,a={Collection:`collection`,Manifest:`manifest`,Range:`range`,Canvas:`canvas`,Annotation:`annotation`,AnnotationPage:`annotationPage`};return i&&a[i]&&(e[a[i]]=r),e},[t,n]);function v(e){return t?(0,u.jsx)(p.ResourceReactContext.Provider,{value:_,children:e}):e}let y=(0,l.useMemo)(()=>{if(!t)return null;let e=r.layout.editors||[];return Mn(t,(r.layout.resources||[]).map(t=>typeof t==`string`?{id:`@default/`+t,label:t,resourceType:t,auto:!0,editors:e.filter(e=>e.supports.resourceTypes.includes(t))}:t),{edit:!0,vault:a},g)},[t,r]);if((0,l.useEffect)(()=>{s(y?.label||``)},[y]),(0,l.useEffect)(()=>{let t=y?.editors.map(e=>e.id)||[];t.find(t=>t===e)||o(`@manifest-editor/editor`,{currentTab:t[0]})},[y?.editors,e,o]),!t||!y)return null;if(g.singleTab){let e=(y?.editors||[]).find(e=>e.id===g.singleTab);if(e)return v((0,u.jsx)(`div`,{className:`w-full`,children:e.component(g)},t.resource.source?.id))}return v((0,u.jsx)(c.SidebarTabs,{isNested:h,rootResource:i,menuId:t.resource.source.id,menu:(y?.editors||[]).map((e,t)=>({id:e.id,label:e.label,renderComponent:()=>e.component(g)})),selectedKey:e,onSelectionChange:e=>{o(`@manifest-editor/editor`,{currentTab:e})}},t.resource.source?.id))}const Pn={id:`@manifest-editor/editor`,label:`Editor`,options:{hideHeader:!0,tabs:!0,minWidth:400},renderBackAction:({backAction:e,fallback:t})=>(0,u.jsx)(An,{backAction:e,fallback:t}),renderCloseAction:({closeAction:e,fallback:t})=>(0,u.jsx)(jn,{closeAction:e,fallback:t}),render({currentTab:e}){return(0,u.jsx)(Nn,{currentTab:e})}},Fn={color:{main:`#B84C74`,mainHover:`#4a89ff`,logoPink:`#E94581`,white:`white`,grey:`grey`,black:`black`,lightgrey:`#F8F9FA`,mediumgrey:`#dddddd`,danger:`#a90e21`,warning:`#e38627`,lightdanger:`#ffeaea`,lightsuccess:`#c5e8c5`,success:`#6ccd55`,greyOverlay:`rgba(0, 0, 0, 0.2)`,highlight:`#faeed7`},iiifColor:{manifest:`rgba(0, 0, 0, 0.2)`,canvas:`rgba(255, 222, 219, 0.8)`,service:`rgba(13, 110, 253, 0.8)`,annotation:`rgba(247, 226, 173, 0.8)`,contentResource:`rgba(207, 247, 255, 0.8)`,ranges:`rgba(144, 213, 157, 0.8)`},padding:{xs:`0.25rem`,small:`0.5rem`,medium:`1rem`,large:`2rem`},device:{mobile:`375px`,tablet:`768px`,laptop:`992px`,desktop:`1200px`},shadows:{standard:`rgba(0, 0, 0, 0.1) 0px 1px 3px 0px, rgba(0, 0, 0, 0.05) 0px 5px 15px 0px`,bottom:`rgba(0, 0, 0, 0.1) 0px 4px 2px -2px`}};function In(e){let{}=e,t=(0,p.useVault)(),n=P(),r=(0,l.useMemo)(()=>(0,v.matchBasedOnResource)(e.resource,n.layout.creators||[],{vault:t}),[e.resource,n.layout.creators,t]);return r.length===0?(0,u.jsx)(`div`,{children:`No supported creators found`}):(0,u.jsx)(`div`,{children:(0,u.jsxs)(c.Tabs,{className:`w-full flex-1 overflow-hidden flex flex-col`,children:[(0,u.jsx)(c.TabList,{className:`flex-1 overflow-hidden w-full flex text-sm whitespace-nowrap`,items:r,children:e=>(0,u.jsx)(c.Tab,{id:e.id,children:e.label})}),r.map(t=>(0,u.jsx)(c.TabPanel,{id:t.id,className:`p-2`,children:(0,u.jsx)(d.ThemeProvider,{theme:Fn,children:(0,u.jsx)(dn,{creator:t,resource:e.resource,onCreate:e.onCreate,skipEditingOnCreate:!0})})},t.id))]})})}function Ln(e){let[t,n]=(0,l.useState)(!1),r=(0,l.useRef)(),i=(0,l.useRef)(0);function a(t){i.current--,!(t&&i.current!==0)&&(r.current&&(clearTimeout(r.current),r.current=0),r.current=setTimeout(()=>{n(!1)},e))}function o(){i.current++,r.current&&clearTimeout(r.current),n(!0)}return(0,l.useMemo)(()=>[t,{set:o,clear:a}],[t])}function Rn(){let e=Be(),t=I(),n=M(),r=re(),[i,a]=Ln(2e3);function o(e){e.preventDefault();let t=new FormData(e.target);r({defaultPreview:t.get(`defaultPreview`),i18n:{...n.i18n||{},advancedLanguageMode:t.get(`advancedLanguageMode`)===`on`,availableLanguages:(t.get(`availableLanguages`)||``).split(`,`).map(e=>e.trim()),defaultLanguage:t.get(`defaultLanguage`)},export:{...n.export||{},version:t.get(`isVersion2`)===`on`?2:3,baseIdentifier:t.get(`base`)||null},editorFeatureFlags:{...n.editorFeatureFlags||{},rememberCanvasId:t.get(`rememberCanvasId`)===`on`,rememberLeftPanelId:t.get(`rememberLeftPanelId`)===`on`,annotationPopups:t.get(`annotationPopups`)===`on`,manifestGridOptions:t.get(`manifestGridOptions`)===`on`,enableMultiImageCanvases:t.get(`enableMultiImageCanvases`)===`on`,enableMultiMediaCanvases:t.get(`enableMultiMediaCanvases`)===`on`}}),a.set(),a.clear()}return(0,u.jsxs)(c.Sidebar,{children:[(0,u.jsx)(c.SidebarHeader,{title:`Workspace configuration`}),i?(0,u.jsx)(`div`,{className:`bg-me-primary-500 text-white p-3 text-sm`,children:`Changes saved`}):null,(0,u.jsx)(c.SidebarContent,{className:`p-4`,children:(0,u.jsxs)(c.Form.Form,{onSubmit:o,className:`flex flex-col gap-3`,children:[(0,u.jsxs)(c.Form.InputContainer,{children:[(0,u.jsx)(c.Form.Label,{htmlFor:`defaultLanguage`,children:`Default Language`}),(0,u.jsx)(c.Form.Input,{type:`text`,name:`defaultLanguage`,id:`defaultLanguage`,defaultValue:n.i18n?.defaultLanguage||``})]}),(0,u.jsxs)(c.Form.InputContainer,{children:[(0,u.jsx)(c.Form.Label,{htmlFor:`availableLanguages`,children:`Available Languages`}),(0,u.jsx)(c.Form.Input,{type:`text`,name:`availableLanguages`,id:`availableLanguages`,defaultValue:(n.i18n?.availableLanguages||[]).join(`, `)})]}),(0,u.jsxs)(c.Form.InputContainer,{horizontal:!0,className:`my-3`,children:[(0,u.jsx)(c.Form.Input,{type:`checkbox`,name:`advancedLanguageMode`,id:`advancedLanguageMode`,defaultChecked:n.i18n?.advancedLanguageMode||!1}),(0,u.jsx)(c.Form.Label,{htmlFor:`advancedLanguageMode`,children:`Advanced Language Mode`})]}),(0,u.jsxs)(c.Form.InputContainer,{horizontal:!0,className:`my-3`,children:[(0,u.jsx)(c.Form.Input,{type:`checkbox`,name:`textGranularityEnabled`,id:`textGranularityEnabled`,defaultChecked:n.i18n?.textGranularityEnabled||!1}),(0,u.jsx)(c.Form.Label,{htmlFor:`textGranularityEnabled`,children:`Enable text granularity`})]}),(0,u.jsxs)(c.Form.InputContainer,{horizontal:!0,className:`my-3`,children:[(0,u.jsx)(c.Form.Input,{type:`checkbox`,name:`rememberCanvasId`,id:`rememberCanvasId`,defaultChecked:n.editorFeatureFlags?.rememberCanvasId||!1}),(0,u.jsx)(c.Form.Label,{htmlFor:`rememberCanvasId`,children:`Remember Canvas ID`})]}),(0,u.jsxs)(c.Form.InputContainer,{horizontal:!0,className:`my-3`,children:[(0,u.jsx)(c.Form.Input,{type:`checkbox`,name:`rememberLeftPanelId`,id:`rememberLeftPanelId`,defaultChecked:n.editorFeatureFlags?.rememberLeftPanelId||!1}),(0,u.jsx)(c.Form.Label,{htmlFor:`rememberLeftPanelId`,children:`Remember Left panel`})]}),(0,u.jsxs)(c.Form.InputContainer,{horizontal:!0,className:`my-3`,children:[(0,u.jsx)(c.Form.Input,{type:`checkbox`,name:`manifestGridOptions`,id:`manifestGridOptions`,defaultChecked:n.editorFeatureFlags?.manifestGridOptions||!1}),(0,u.jsx)(c.Form.Label,{htmlFor:`manifestGridOptions`,children:`Manifest Grid Options`})]}),(0,u.jsxs)(c.Form.InputContainer,{horizontal:!0,className:`my-3`,children:[(0,u.jsx)(c.Form.Input,{type:`checkbox`,name:`isVersion2`,id:`isVersion2`,defaultChecked:n.export?.version===2}),(0,u.jsxs)(c.Form.Label,{htmlFor:`isVersion2`,children:[`Export Presentation 2 `,t.type,`s`]})]}),(0,u.jsxs)(c.Form.InputContainer,{children:[(0,u.jsx)(c.Form.Label,{htmlFor:`defaultPreview`,children:`Default preview`}),(0,u.jsx)(`div`,{children:e.configs.map((e,t)=>e.type===`iiif-preview-service`?null:(0,u.jsxs)(c.Form.InputContainer,{horizontal:!0,children:[(0,u.jsx)(c.Form.Input,{type:`radio`,id:e.id,name:`defaultPreview`,value:e.id,defaultChecked:n.defaultPreview?n.defaultPreview===e.id:t===0}),(0,u.jsx)(`label`,{htmlFor:e.id,children:e.label})]},e.id))})]}),t.type===`Manifest`?(0,u.jsx)(`a`,{className:`text-sm text-me-primary-500 hover:underline hover:text-me-primary-600`,href:window.location.pathname.includes(`/exhibition`)?window.location.pathname.replace(`/exhibition`,``)||`/`:`${window.location.pathname}/exhibition`,children:window.location.pathname.includes(`/exhibition`)?`Return to Manifest Editor`:`Go to Exhibition Editor`}):null,(0,u.jsx)(`div`,{className:`mt-5`,children:(0,u.jsx)(c.ActionButton,{type:`submit`,children:`Save changes`})})]})})]})}function zn(){return(0,b.createStore)((e,t)=>({specificMenus:{},resourceMenus:{},hookMenuItem(t){let n=Yt(),r=t.resource?.id||``,i=t.resource?.type;return i?r?(e(e=>({specificMenus:{...e.specificMenus,[r]:{...e.specificMenus[r]||{},menus:{...e.specificMenus[r]?.menus||{},[n]:{sectionTitle:t.sectionTitle,items:t.items}}}}})),()=>{e(e=>({specificMenus:{...e.specificMenus,[r]:{...e.specificMenus[r]||{},menus:{...e.specificMenus[r]?.menus||{},[n]:void 0}}}}))}):(e(e=>({resourceMenus:{...e.resourceMenus,[i]:{...e.resourceMenus[i]||{},menus:{...e.resourceMenus[i]?.menus||{},[n]:{sectionTitle:t.sectionTitle,items:t.items}}}}})),()=>{e(e=>({resourceMenus:{...e.resourceMenus,[i]:{...e.resourceMenus[i]||{},menus:{...e.resourceMenus[i]?.menus||{},[n]:void 0}}}}))}):()=>{}}}))}const Bn=(0,l.createContext)(null);function Vn({children:e}){let t=(0,l.useMemo)(()=>zn(),[]);return(0,u.jsx)(Bn.Provider,{value:t,children:e})}function Hn(){let e=(0,l.useContext)(Bn);if(!e)throw Error(`useContextMenuStore must be used within a ContextMenuProvider`);return e}function Un(e){let t=Hn(),n=(0,b.useStore)(t,e=>e.resourceMenus),r=(0,b.useStore)(t,e=>e.specificMenus);return(0,l.useMemo)(()=>{let t=r[e.id||``]?.menus||{},i=n[e.type]?.menus||{},a=Object.values(t).flat(),o=[...Object.values(i).flat(),...a].filter(e=>e!==void 0),s=[],c=[];for(let e of o){let t=[];for(let n of e.items||[])n.id&&s.includes(n.id)||(s.push(n.id),t.push(n));t.length&&c.push({...e,items:t})}return Wn(c)},[r,n,e.id,e.type])}function Wn(e){let t={},n=[];e.forEach(e=>{if(!e)return;let r=e.sectionTitle;if(!r){n.push(...e.items||[]);return}t[r]||(t[r]=[]),t[r].push(...e.items)});let r=Object.entries(t).map(([e,t])=>({sectionTitle:e,items:t}));return n.length&&r.push({items:n}),r}function Gn(e,t=[]){let n=(0,b.useStore)(Hn(),e=>e.hookMenuItem);(0,l.useEffect)(()=>n(e),[n,e.resource?.id,e.resource?.type,...t])}var Kn={};function qn(e){return(0,u.jsxs)(`div`,{className:Kn.CenterPanelContainer,children:[e.title||e.close?(0,u.jsxs)(`div`,{className:Kn.CenterPanelHeader,children:[e.title?(0,u.jsx)(`h2`,{className:Kn.CenterPanelTitle,children:e.title}):null,e.close?(0,u.jsx)(z,{className:Kn.CenterPanelClose,onClick:e.close,children:(0,u.jsx)(F,{})}):null]}):null,e.children]})}const Jn=d.default.div`
|
|
426
|
+
`;function $t({panel:e,state:t,actions:n,isLeft:r,pinActions:i=n,transition:a,close:o,available:s=[],style:c,noHeader:d}){let m=(0,l.useContext)(p.ReactVaultContext)||null,[h,g]=(0,l.useState)(!1),_=ce(),v=Pt(),{tabs:y,pinnable:b,hideHeader:x}=e?.options||{},S=[_.state.canvasId,e?.id],C=(0,l.useMemo)(()=>(s||[]).filter(e=>!e.requiresState),[s]),{itemProps:w,isOpen:te,setIsOpen:T}=(0,f.default)(C.length),[ne,E]=(0,l.useState)(``),D=(0,l.useRef)();(0,l.useEffect)(()=>g(!1),S),(0,l.useEffect)(()=>E(``),[e]),(0,l.useEffect)(()=>(D.current=E,()=>{D.current=void 0}),[]);let O=(0,l.useCallback)(e=>{D.current&&D.current(e)},[]),k=(0,l.useCallback)(r=>{let i=e?t.stack.length?n.popStack:e.backAction?()=>e&&e.backAction&&e.backAction(t,{...v,current:n},_):null:null;r&&(!i||r.metaKey)&&C.length?(r.preventDefault(),T(!0)):i&&i()},[n,_,v,e,T,t,C.length]),A=r=>{n.change({id:r.id,state:r.defaultState,stacked:!!(t.stack.length||e?.backAction)})};if(!e||!t.current)return null;let j=e.backAction||t.stack.length?(0,u.jsx)(U,{onClick:k,children:(0,u.jsx)(kt,{})}):null,M=(0,u.jsx)(U,{onClick:o||n.close,children:(0,u.jsx)(F,{})});return(0,u.jsx)(Kt.Provider,{value:O,children:(0,u.jsxs)(Jt,{"data-state":a,"data-flipped":r,style:c,"data-header":!d,children:[d?null:(0,u.jsxs)(Yt,{"data-tabs":!!y,"data-error":h,children:[(0,u.jsxs)(zt,{style:{display:`flex`,height:`100%`},children:[e.renderBackAction?e.renderBackAction({backAction:k,fallback:j}):j,C.length?(0,u.jsxs)(Ht,{$open:te,style:{left:`0.5em`},children:[(0,u.jsx)(Ut,{children:`All panels`}),(0,u.jsx)(Wt,{}),C.map((t,n)=>(0,u.jsx)(Vt,{...w[n],onClick:()=>A(t),$active:e.id===t.id,children:t.label},n))]}):null]}),ne?(0,u.jsx)(Zt,{children:ne}):x?(0,u.jsx)(Xt,{}):(0,u.jsx)(Zt,{children:e.label}),b?t.pinned?(0,u.jsx)(U,{onClick:i.unpin,children:(0,u.jsx)(Ot,{fill:`orange`})}):(0,u.jsx)(U,{onClick:()=>i.pin({id:e.id,state:t.state}),children:(0,u.jsx)(Ot,{fill:`#ddd`})}):null,e.renderCloseAction?e.renderCloseAction({closeAction:o||n.close,fallback:M}):M]}),(0,u.jsx)(Qt,{className:`OverrideScrollbar`,children:(0,u.jsx)(ee.ErrorBoundary,{onError:()=>g(!0),FallbackComponent:Ft,resetKeys:S,onReset:()=>g(!1),children:Rt(e.render(t.state||e.defaultState||{},{...v,current:n,vault:m,transition:a},_))})})]})})}function en(e=`vault://homepage-collection.json`){let t=new g.Vault,n=window.localStorage.getItem(`preview-vault-collection`),r=!1;if(n)try{let i=JSON.parse(n);if(i.id&&i.id===e){t.dispatch((0,b.requestResource)({id:i.id}));let e=(0,x.actionListFromResource)(i.id,i);t.dispatch((0,b.batchActions)({actions:e})),r=!0}}catch{}if(!r){let n=(0,x.actionListFromResource)(e,{"@context":`http://iiif.io/api/presentation/3/context.json`,id:e,type:`Collection`,label:{en:[`Recent items`]},items:[]});t.dispatch((0,b.requestResource)({id:e})),t.dispatch((0,b.batchActions)({actions:n}))}return t.on(`after:@iiif/REMOVE_REFERENCE`,n=>{n.action.payload.id===e&&window.localStorage.setItem(`preview-vault-collection`,JSON.stringify(t.toPresentation3({id:e,type:`Collection`})))}),{vault:t,unsubscribe:()=>{},addHistory:(n,r)=>{let i=t.getState();if(n&&r&&(r===`Collection`||r===`Manifest`)){let a=i.iiif.entities.Collection[e];if(a){let i=a.items.findIndex(e=>e.id===n);i===-1?t.dispatch((0,b.addReference)({id:e,type:`Collection`,reference:{id:n,type:r},key:`items`,index:0})):t.dispatch((0,b.reorderEntityField)({id:e,type:`Collection`,key:`items`,startIndex:i,endIndex:0})),window.localStorage.setItem(`preview-vault-collection`,JSON.stringify(t.toPresentation3({id:e,type:`Collection`})))}}},clearHistory:()=>{t.dispatch((0,b.modifyEntityField)({id:e,type:`Collection`,key:`items`,value:[]})),window.localStorage.setItem(`preview-vault-collection`,JSON.stringify(t.toPresentation3({id:e,type:`Collection`})))}}}function tn(){return(0,l.useContext)(nn)}const nn=(0,l.createContext)(new g.Vault),rn=(0,l.createContext)({addHistory:(e,t)=>{},clearHistory:()=>{}}),an=`manifest-editor://homepage-collection.json`;function on(){return(0,l.useContext)(rn)}function sn(e){let{vault:t,unsubscribe:n,addHistory:r,clearHistory:i}=(0,l.useMemo)(()=>en(an),[]);return(0,l.useEffect)(()=>n,[]),(0,u.jsx)(rn.Provider,{value:{addHistory:r,clearHistory:i},children:(0,u.jsx)(nn.Provider,{value:t,children:e.children})})}function cn({children:e}){return(0,u.jsx)(p.VaultProvider,{vault:tn(),children:e})}function ln(e,t,n,r,i){let a=(0,p.useVault)(),o=P(),{create:s,edit:c}=H(),u=(0,l.useMemo)(()=>(0,v.matchBasedOnResource)({type:n,parent:e,index:0,property:t},o.layout.creators||[],{vault:a}),[e,t,o.layout.creators,n,a]),d=e&&u.length!==0,f=(0,l.useCallback)((a,o)=>{if(e)return s({type:n,parent:(0,_.toRef)(e),property:t,index:a,target:r,initialData:o,...i||{}})},[s,e,t,n,i,r]),m=(0,l.useCallback)((a,o,c)=>{if(e)return s({type:n,filter:a,parent:(0,_.toRef)(e),property:t,index:o,target:r,initialData:c,...i||{}})},[s,e,t,n,i,r]);return[d,{create:f,edit:(0,l.useCallback)((n,r)=>{c(n,e?{parent:(0,_.toRef)(e),property:t,index:r}:void 0)},[c,e,t]),createFiltered:m,creator:(0,l.useCallback)((a,o)=>{if(e)return s({type:n,initialCreator:a,parent:(0,_.toRef)(e),property:t,target:r,initialData:o,...i||{}})},[n,t,e,r,s,i]),buttonProps:(0,l.useMemo)(()=>({"data-action-id":xt(n,t,e)}),[n,t,e])}]}function un(){let e=(0,p.useVault)(),t=tn(),n=P();return(0,l.useMemo)(()=>new v.Creator(e,n.layout.creators||[],t),[n.layout.creators,e])}const dn=(0,l.memo)(function(e){let t=(0,p.useVault)(),{edit:n,modal:r}=H(),[i,a]=(0,l.useState)(!1),[o,s]=(0,l.useState)(null),d=un(),f=(0,l.useRef)(!1),m=e.resource.initialData?.selector;Et(m);let h={targetType:e.resource.type,parent:e.resource.parent?{property:e.resource.property,atIndex:e.resource.index,resource:e.resource.parent}:void 0,target:e.resource.target,initialData:e.resource.initialData},g=t=>{try{if(i||f.current)return;a(!0),f.current=!0,d.create(e.creator.id,t,h).catch(e=>(s(e?.message||`Unknown error`),null)).then(async t=>{if(e.onCreate?.(),e.skipEditingOnCreate||!t)return;let i=Array.isArray(t)?t[0]:t;a(!1),r.popStack(),r.close(),i&&n(i,{parent:(0,_.toRef)(e.resource.parent),property:e.resource.property,index:e.resource.index})})}catch(e){s(e?.message||`Unknown error`)}},v=async()=>!0;if((0,l.useEffect)(()=>{e.resource.initialData?.showEmptyForm||!e.creator.render&&!i&&g({})},[e.creator]),o)return(0,u.jsx)(`div`,{className:`flex flex-col items-center p-4`,children:(0,u.jsx)(c.ErrorMessage,{children:o})});let y=(0,u.jsx)(`div`,{className:`flex flex-col items-center py-8`,children:(0,u.jsxs)(`div`,{className:`flex gap-2 items-center`,children:[(0,u.jsx)(c.Spinner,{}),` `,(0,u.jsx)(`span`,{children:`Loading`})]})});return i?y:e.creator.render?(0,u.jsx)(u.Fragment,{children:(0,u.jsx)(l.Suspense,{fallback:y,children:e.creator.render({vault:t,runCreate:g,validate:v,options:h})})}):(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(c.EmptyState,{children:`No options available`}),(0,u.jsx)(c.ActionButton,{primary:!0,onPress:()=>g({}),children:e.creator.actionButton||`Create`})]})});function fn(e){let t=P(),n=(0,p.useVault)(),[r,i]=(0,l.useState)(e.resource.initialCreator||``),a=qt(),o=(0,l.useMemo)(()=>(0,v.matchBasedOnResource)(e.resource,t.layout.creators||[],{vault:n}),[e.resource,t.layout.creators,n]);o.length===1&&!r&&i(o[0].id);let s=o.find(e=>e.id===r);if((0,l.useEffect)(()=>{s&&a?.(s.label)}),o.length===0)return(0,u.jsx)(c.EmptyState,{children:`Not currently supported`});let d=(0,u.jsx)(c.ModalBackSlot,{children:(0,u.jsx)(c.IconButton,{root:document.getElementById(`headlessui-portal-root`)||void 0,label:`Back to Add content options`,className:`group`,placement:`right`,onPress:()=>i(``),children:(0,u.jsx)(c.GridIcon,{className:`text-2xl opacity-50 group-hover:opacity-70`})})});return s?s.hiddenModal?(0,u.jsxs)(u.Fragment,{children:[d,(0,u.jsx)(dn,{creator:s,resource:e.resource})]}):(0,u.jsxs)(`div`,{children:[d,(0,u.jsx)(`div`,{className:`p-2 py-6`,children:(0,u.jsx)(dn,{creator:s,resource:e.resource})})]}):(0,u.jsx)(c.CreatorGrid,{label:`Select a type`,items:o.map(e=>({id:e.id,title:e.label,description:e.summary||``,icon:e.icon,onClick:()=>i(e.id)}))})}const pn={id:`@manifest-editor/creator`,label:`Add content`,options:{hideHeader:!0,tabs:!1},render(e){return(0,u.jsx)(fn,{resource:e})}};function mn(e,t){switch(t.type){case`setStack`:return{...e,stack:t.payload.resources,current:t.payload.resources[0]||null};case`edit`:{let n=t.payload.reset;return(t.payload.resource?.resource.source?.type===`Manifest`||t.payload.resource?.resource.source?.type===`Canvas`)&&(n=!0),e.current?.resource.source.id===t.payload.resource?.resource.source.id?{...e,current:t.payload.resource}:{...e,current:t.payload.resource,stack:n?[]:e.current?[e.current,...e.stack]:e.stack}}case`syncRemoval`:{let n=(0,_.toRef)(t.payload.resource.resource);if(!n||!e.stack.find(e=>(0,_.toRef)(e.resource)?.id===n.id))return e;let r=e.current?.resource.id===n.id?null:e.current,i=hn(e.stack.filter(e=>(0,_.toRef)(e.resource)?.id!==n.id),r);return{...e,stack:i,current:r}}case`updateCurrent`:return{...e,current:t.payload.resource};case`back`:{let t=e.stack[0];return{...e,stack:e.stack.slice(1),current:t||null}}case`close`:return{...e,stack:[],current:null};case`create`:return t.payload.resource===null?{...e,create:null}:{...e,create:t.payload}}return e}function hn(e,t){let n=[],r=null;for(let t of e)r?.resource.id!==t.resource.id&&(n.push(t),r=t);return r&&r.resource.id===t?.resource.id?n.slice(0,n.length-1):n}const gn={stack:[],current:null,create:null},W=(0,l.createContext)(gn),_n=(0,l.createContext)({edit(){},close(){},back(){},setStack(){},updateCurrent(){},create(){return()=>{}}});function vn(){return(0,l.useContext)(_n)}function yn(){return(0,l.useContext)(W).current}function bn(){return(0,l.useContext)(W).stack}function xn(){return(0,l.useContext)(W).create}function Sn(){let{manifest:e}=(0,p.useResourceContext)(),t=(0,p.useVault)(),[n,r]=(0,l.useReducer)(e=>e+1,0);O(e,`Manifest not found`);let i=(0,l.useMemo)(()=>new S.EditorInstance({reference:{id:e,type:`Manifest`},vault:t}),[e,t]);return(0,l.useEffect)(()=>i.observe.start(r),[i]),i.observe.key=`${n}`,i.observe.reset(),i}function Cn(){let{collection:e}=(0,p.useResourceContext)(),t=(0,p.useVault)(),[n,r]=(0,l.useReducer)(e=>e+1,0);O(e,`Collection not found`);let i=(0,l.useMemo)(()=>new S.EditorInstance({reference:{id:e,type:`Collection`},vault:t}),[e,t]);return(0,l.useEffect)(()=>i.observe.start(r),[i]),i.observe.key=`${n}`,i.observe.reset(),i}function wn(e,t={}){let n=(0,p.useVault)(),[r,i]=(0,l.useReducer)(e=>e+1,0);!t.allowNull&&O(e,`Resource not found`);let a=(0,l.useMemo)(()=>t.allowNull&&!e?null:new S.EditorInstance({reference:(0,_.toRef)(e),vault:n,context:{resource:e,parent:t.parent,index:t.index,parentProperty:t.parentProperty}}),[e,n]);return(0,l.useEffect)(()=>a?.observe.start(i),[a]),a&&(a.observe.key=`${r}`,a.observe.reset()),a}function Tn(){let{annotationPage:e}=(0,p.useResourceContext)();return O(e,`Annotation page not found`),wn({id:e,type:`AnnotationPage`})}function En(){let e=yn(),t=(0,p.useVault)(),[n,r]=(0,l.useReducer)(e=>e+1,0);O(e,`No resource selected`);let i=(0,l.useMemo)(()=>new S.EditorInstance({reference:e.resource.source||e.resource,vault:t}),[e,t]);return(0,l.useEffect)(()=>i.observe.start(r),[i]),i.observe.key=`${n}`,i.observe.reset(),i}function Dn(e){let t=(0,p.useVault)(),[n,r]=(0,l.useReducer)(mn,e),i=(0,l.useCallback)(e=>{r(e)},[]);(0,l.useEffect)(()=>t.on(`@iiif/REMOVE_REFERENCE`,e=>{let t=e.action,n={id:t.payload.id,type:t.payload.type},i=t.payload.reference;r({type:`syncRemoval`,payload:{resource:{parent:n,resource:i}}})}),[t]);let a=(0,l.useCallback)((e,t=!1)=>i({type:`edit`,payload:{resource:e,reset:t}}),[]),o=(0,l.useCallback)(e=>i({type:`setStack`,payload:{resources:e}}),[]),s=(0,l.useCallback)(e=>i({type:`updateCurrent`,payload:{resource:e}}),[]),c=(0,l.useCallback)(()=>i({type:`close`}),[]),u=(0,l.useCallback)(()=>i({type:`back`}),[]),d=(0,l.useCallback)((e,t)=>(i({type:`create`,payload:{resource:e,options:t}}),()=>{i({type:`create`,payload:{resource:null}})}),[]);return[n,(0,l.useMemo)(()=>({edit:a,updateCurrent:s,close:c,back:u,create:d,setStack:o}),[])]}function On(e){let{instanceId:t}=se(),[n,r]=Dn(e.initialState||gn);return(0,u.jsx)(_n.Provider,{value:r,children:(0,u.jsx)(W.Provider,{value:n,children:e.children})},t)}function kn({resource:e,children:t}){let{instanceId:n}=se(),[r,i]=Dn((0,l.useMemo)(()=>({create:null,stack:[],current:{resource:{type:`SpecificResource`,source:{id:e.id,type:e.type}}}}),[]));return(0,u.jsx)(_n.Provider,{value:i,children:(0,u.jsx)(W.Provider,{value:r,children:t})},n)}function An({fallback:e,backAction:t}){let n=bn(),{back:r}=vn();return n.length?(0,u.jsx)(U,{onClick:r,children:(0,u.jsx)(kt,{})}):e}function jn({closeAction:e,fallback:t}){let n=bn();return yn()||n.length?(0,u.jsx)(U,{onClick:()=>{e()},children:(0,u.jsx)(F,{})}):t}function Mn(e,t,n,r){let i=t.filter(t=>t.resourceType===e.resource.source.type);if(i.length===0)return null;for(let t of i){let i=[],a={},o=(t.editors||[]).filter(t=>{if(r.hideTabs&&r.hideTabs.includes(t.id)||r.onlyTabs&&!r.onlyTabs.includes(t.id))return!1;if(t.supports.sortKey){if(i.includes(t.supports.sortKey))return!1;t.supports.sortFallback&&(a[t.supports.sortKey]=t)}return n.edit&&!t.supports.edit||t.supports.custom&&t.supports.custom(e,n.vault)===!1?!1:(t.supports.sortKey&&i.push(t.supports.sortKey),!0)}),s=Object.keys(a);for(let e of s)!i.includes(e)&&a[e]&&!o.includes(a[e])&&o.push(a[e]);if(o.length)return{...t,editors:o}}return null}function Nn({currentTab:e=void 0}){let t=yn(),n=(0,l.useContext)(p.ResourceReactContext),r=P(),i=I(),a=(0,p.useVault)(),{change:o}=H(),s=qt(),{editorConfig:d}=M(),f=t?.resource.source?.id,m=t?.resource.source?.type,h=f!==i.id;f&&h&&i.type===`Collection`&&m===`Collection`&&(m=`EmbeddedCollection`);let g=(m?d[m]:d.All)||{},_=(0,l.useMemo)(()=>{let e={...n},r=t?.resource.source.id,i=t?.resource.source.type,a={Collection:`collection`,Manifest:`manifest`,Range:`range`,Canvas:`canvas`,Annotation:`annotation`,AnnotationPage:`annotationPage`};return i&&a[i]&&(e[a[i]]=r),e},[t,n]);function v(e){return t?(0,u.jsx)(p.ResourceReactContext.Provider,{value:_,children:e}):e}let y=(0,l.useMemo)(()=>{if(!t)return null;let e=r.layout.editors||[];return Mn(t,(r.layout.resources||[]).map(t=>typeof t==`string`?{id:`@default/`+t,label:t,resourceType:t,auto:!0,editors:e.filter(e=>e.supports.resourceTypes.includes(t))}:t),{edit:!0,vault:a},g)},[t,r]);if((0,l.useEffect)(()=>{s(y?.label||``)},[y]),(0,l.useEffect)(()=>{let t=y?.editors.map(e=>e.id)||[];t.find(t=>t===e)||o(`@manifest-editor/editor`,{currentTab:t[0]})},[y?.editors,e,o]),!t||!y)return null;if(g.singleTab){let e=(y?.editors||[]).find(e=>e.id===g.singleTab);if(e)return v((0,u.jsx)(`div`,{className:`w-full`,children:e.component(g)},t.resource.source?.id))}return v((0,u.jsx)(c.SidebarTabs,{isNested:h,rootResource:i,menuId:t.resource.source.id,menu:(y?.editors||[]).map((e,t)=>({id:e.id,label:e.label,renderComponent:()=>e.component(g)})),selectedKey:e,onSelectionChange:e=>{o(`@manifest-editor/editor`,{currentTab:e})}},t.resource.source?.id))}const Pn={id:`@manifest-editor/editor`,label:`Editor`,options:{hideHeader:!0,tabs:!0,minWidth:400},renderBackAction:({backAction:e,fallback:t})=>(0,u.jsx)(An,{backAction:e,fallback:t}),renderCloseAction:({closeAction:e,fallback:t})=>(0,u.jsx)(jn,{closeAction:e,fallback:t}),render({currentTab:e}){return(0,u.jsx)(Nn,{currentTab:e})}},Fn={color:{main:`#B84C74`,mainHover:`#4a89ff`,logoPink:`#E94581`,white:`white`,grey:`grey`,black:`black`,lightgrey:`#F8F9FA`,mediumgrey:`#dddddd`,danger:`#a90e21`,warning:`#e38627`,lightdanger:`#ffeaea`,lightsuccess:`#c5e8c5`,success:`#6ccd55`,greyOverlay:`rgba(0, 0, 0, 0.2)`,highlight:`#faeed7`},iiifColor:{manifest:`rgba(0, 0, 0, 0.2)`,canvas:`rgba(255, 222, 219, 0.8)`,service:`rgba(13, 110, 253, 0.8)`,annotation:`rgba(247, 226, 173, 0.8)`,contentResource:`rgba(207, 247, 255, 0.8)`,ranges:`rgba(144, 213, 157, 0.8)`},padding:{xs:`0.25rem`,small:`0.5rem`,medium:`1rem`,large:`2rem`},device:{mobile:`375px`,tablet:`768px`,laptop:`992px`,desktop:`1200px`},shadows:{standard:`rgba(0, 0, 0, 0.1) 0px 1px 3px 0px, rgba(0, 0, 0, 0.05) 0px 5px 15px 0px`,bottom:`rgba(0, 0, 0, 0.1) 0px 4px 2px -2px`}};function In(e){let{}=e,t=(0,p.useVault)(),n=P(),r=(0,l.useMemo)(()=>(0,v.matchBasedOnResource)(e.resource,n.layout.creators||[],{vault:t}),[e.resource,n.layout.creators,t]);return r.length===0?(0,u.jsx)(`div`,{children:`No supported creators found`}):(0,u.jsx)(`div`,{children:(0,u.jsxs)(c.Tabs,{className:`w-full flex-1 overflow-hidden flex flex-col`,children:[(0,u.jsx)(c.TabList,{className:`flex-1 overflow-hidden w-full flex text-sm whitespace-nowrap`,items:r,children:e=>(0,u.jsx)(c.Tab,{id:e.id,children:e.label})}),r.map(t=>(0,u.jsx)(c.TabPanel,{id:t.id,className:`p-2`,children:(0,u.jsx)(d.ThemeProvider,{theme:Fn,children:(0,u.jsx)(dn,{creator:t,resource:e.resource,onCreate:e.onCreate,skipEditingOnCreate:!0})})},t.id))]})})}function Ln(e){let[t,n]=(0,l.useState)(!1),r=(0,l.useRef)(),i=(0,l.useRef)(0);function a(t){i.current--,!(t&&i.current!==0)&&(r.current&&(clearTimeout(r.current),r.current=0),r.current=setTimeout(()=>{n(!1)},e))}function o(){i.current++,r.current&&clearTimeout(r.current),n(!0)}return(0,l.useMemo)(()=>[t,{set:o,clear:a}],[t])}function Rn(){let e=Be(),t=I(),n=M(),r=re(),[i,a]=Ln(2e3);function o(e){e.preventDefault();let t=new FormData(e.target);r({defaultPreview:t.get(`defaultPreview`),i18n:{...n.i18n||{},advancedLanguageMode:t.get(`advancedLanguageMode`)===`on`,availableLanguages:(t.get(`availableLanguages`)||``).split(`,`).map(e=>e.trim()),defaultLanguage:t.get(`defaultLanguage`)},export:{...n.export||{},version:t.get(`isVersion2`)===`on`?2:3,baseIdentifier:t.get(`base`)||null},editorFeatureFlags:{...n.editorFeatureFlags||{},rememberCanvasId:t.get(`rememberCanvasId`)===`on`,rememberLeftPanelId:t.get(`rememberLeftPanelId`)===`on`,annotationPopups:t.get(`annotationPopups`)===`on`,manifestGridOptions:t.get(`manifestGridOptions`)===`on`,enableMultiImageCanvases:t.get(`enableMultiImageCanvases`)===`on`,enableMultiMediaCanvases:t.get(`enableMultiMediaCanvases`)===`on`}}),a.set(),a.clear()}return(0,u.jsxs)(c.Sidebar,{children:[(0,u.jsx)(c.SidebarHeader,{title:`Workspace configuration`}),i?(0,u.jsx)(`div`,{className:`bg-me-primary-500 text-white p-3 text-sm`,children:`Changes saved`}):null,(0,u.jsx)(c.SidebarContent,{className:`p-4`,children:(0,u.jsxs)(c.Form.Form,{onSubmit:o,className:`flex flex-col gap-3`,children:[(0,u.jsxs)(c.Form.InputContainer,{children:[(0,u.jsx)(c.Form.Label,{htmlFor:`defaultLanguage`,children:`Default Language`}),(0,u.jsx)(c.Form.Input,{type:`text`,name:`defaultLanguage`,id:`defaultLanguage`,defaultValue:n.i18n?.defaultLanguage||``})]}),(0,u.jsxs)(c.Form.InputContainer,{children:[(0,u.jsx)(c.Form.Label,{htmlFor:`availableLanguages`,children:`Available Languages`}),(0,u.jsx)(c.Form.Input,{type:`text`,name:`availableLanguages`,id:`availableLanguages`,defaultValue:(n.i18n?.availableLanguages||[]).join(`, `)})]}),(0,u.jsxs)(c.Form.InputContainer,{horizontal:!0,className:`my-3`,children:[(0,u.jsx)(c.Form.Input,{type:`checkbox`,name:`advancedLanguageMode`,id:`advancedLanguageMode`,defaultChecked:n.i18n?.advancedLanguageMode||!1}),(0,u.jsx)(c.Form.Label,{htmlFor:`advancedLanguageMode`,children:`Advanced Language Mode`})]}),(0,u.jsxs)(c.Form.InputContainer,{horizontal:!0,className:`my-3`,children:[(0,u.jsx)(c.Form.Input,{type:`checkbox`,name:`textGranularityEnabled`,id:`textGranularityEnabled`,defaultChecked:n.i18n?.textGranularityEnabled||!1}),(0,u.jsx)(c.Form.Label,{htmlFor:`textGranularityEnabled`,children:`Enable text granularity`})]}),(0,u.jsxs)(c.Form.InputContainer,{horizontal:!0,className:`my-3`,children:[(0,u.jsx)(c.Form.Input,{type:`checkbox`,name:`rememberCanvasId`,id:`rememberCanvasId`,defaultChecked:n.editorFeatureFlags?.rememberCanvasId||!1}),(0,u.jsx)(c.Form.Label,{htmlFor:`rememberCanvasId`,children:`Remember Canvas ID`})]}),(0,u.jsxs)(c.Form.InputContainer,{horizontal:!0,className:`my-3`,children:[(0,u.jsx)(c.Form.Input,{type:`checkbox`,name:`rememberLeftPanelId`,id:`rememberLeftPanelId`,defaultChecked:n.editorFeatureFlags?.rememberLeftPanelId||!1}),(0,u.jsx)(c.Form.Label,{htmlFor:`rememberLeftPanelId`,children:`Remember Left panel`})]}),(0,u.jsxs)(c.Form.InputContainer,{horizontal:!0,className:`my-3`,children:[(0,u.jsx)(c.Form.Input,{type:`checkbox`,name:`manifestGridOptions`,id:`manifestGridOptions`,defaultChecked:n.editorFeatureFlags?.manifestGridOptions||!1}),(0,u.jsx)(c.Form.Label,{htmlFor:`manifestGridOptions`,children:`Manifest Grid Options`})]}),(0,u.jsxs)(c.Form.InputContainer,{horizontal:!0,className:`my-3`,children:[(0,u.jsx)(c.Form.Input,{type:`checkbox`,name:`isVersion2`,id:`isVersion2`,defaultChecked:n.export?.version===2}),(0,u.jsxs)(c.Form.Label,{htmlFor:`isVersion2`,children:[`Export Presentation 2 `,t.type,`s`]})]}),(0,u.jsxs)(c.Form.InputContainer,{children:[(0,u.jsx)(c.Form.Label,{htmlFor:`defaultPreview`,children:`Default preview`}),(0,u.jsx)(`div`,{children:e.configs.map((e,t)=>e.type===`iiif-preview-service`?null:(0,u.jsxs)(c.Form.InputContainer,{horizontal:!0,children:[(0,u.jsx)(c.Form.Input,{type:`radio`,id:e.id,name:`defaultPreview`,value:e.id,defaultChecked:n.defaultPreview?n.defaultPreview===e.id:t===0}),(0,u.jsx)(`label`,{htmlFor:e.id,children:e.label})]},e.id))})]}),t.type===`Manifest`?(0,u.jsx)(`a`,{className:`text-sm text-me-primary-500 hover:underline hover:text-me-primary-600`,href:window.location.pathname.includes(`/exhibition`)?window.location.pathname.replace(`/exhibition`,``)||`/`:`${window.location.pathname}/exhibition`,children:window.location.pathname.includes(`/exhibition`)?`Return to Manifest Editor`:`Go to Exhibition Editor`}):null,(0,u.jsx)(`div`,{className:`mt-5`,children:(0,u.jsx)(c.ActionButton,{type:`submit`,children:`Save changes`})})]})})]})}function zn(){return(0,y.createStore)((e,t)=>({specificMenus:{},resourceMenus:{},hookMenuItem(t){let n=Ct(),r=t.resource?.id||``,i=t.resource?.type;return i?r?(e(e=>({specificMenus:{...e.specificMenus,[r]:{...e.specificMenus[r]||{},menus:{...e.specificMenus[r]?.menus||{},[n]:{sectionTitle:t.sectionTitle,items:t.items}}}}})),()=>{e(e=>({specificMenus:{...e.specificMenus,[r]:{...e.specificMenus[r]||{},menus:{...e.specificMenus[r]?.menus||{},[n]:void 0}}}}))}):(e(e=>({resourceMenus:{...e.resourceMenus,[i]:{...e.resourceMenus[i]||{},menus:{...e.resourceMenus[i]?.menus||{},[n]:{sectionTitle:t.sectionTitle,items:t.items}}}}})),()=>{e(e=>({resourceMenus:{...e.resourceMenus,[i]:{...e.resourceMenus[i]||{},menus:{...e.resourceMenus[i]?.menus||{},[n]:void 0}}}}))}):()=>{}}}))}const Bn=(0,l.createContext)(null);function Vn({children:e}){let t=(0,l.useMemo)(()=>zn(),[]);return(0,u.jsx)(Bn.Provider,{value:t,children:e})}function Hn(){let e=(0,l.useContext)(Bn);if(!e)throw Error(`useContextMenuStore must be used within a ContextMenuProvider`);return e}function Un(e){let t=Hn(),n=(0,y.useStore)(t,e=>e.resourceMenus),r=(0,y.useStore)(t,e=>e.specificMenus);return(0,l.useMemo)(()=>{let t=r[e.id||``]?.menus||{},i=n[e.type]?.menus||{},a=Object.values(t).flat(),o=[...Object.values(i).flat(),...a].filter(e=>e!==void 0),s=[],c=[];for(let e of o){let t=[];for(let n of e.items||[])n.id&&s.includes(n.id)||(s.push(n.id),t.push(n));t.length&&c.push({...e,items:t})}return Wn(c)},[r,n,e.id,e.type])}function Wn(e){let t={},n=[];e.forEach(e=>{if(!e)return;let r=e.sectionTitle;if(!r){n.push(...e.items||[]);return}t[r]||(t[r]=[]),t[r].push(...e.items)});let r=Object.entries(t).map(([e,t])=>({sectionTitle:e,items:t}));return n.length&&r.push({items:n}),r}function Gn(e,t=[]){let n=(0,y.useStore)(Hn(),e=>e.hookMenuItem);(0,l.useEffect)(()=>n(e),[n,e.resource?.id,e.resource?.type,...t])}var Kn={};function qn(e){return(0,u.jsxs)(`div`,{className:Kn.CenterPanelContainer,children:[e.title||e.close?(0,u.jsxs)(`div`,{className:Kn.CenterPanelHeader,children:[e.title?(0,u.jsx)(`h2`,{className:Kn.CenterPanelTitle,children:e.title}):null,e.close?(0,u.jsx)(z,{className:Kn.CenterPanelClose,onClick:e.close,children:(0,u.jsx)(F,{})}):null]}):null,e.children]})}const Jn=d.default.div`
|
|
427
427
|
flex: 1;
|
|
428
428
|
display: flex;
|
|
429
429
|
width: 100%;
|
|
@@ -618,7 +618,7 @@ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=
|
|
|
618
618
|
position: sticky;
|
|
619
619
|
bottom: 0;
|
|
620
620
|
}
|
|
621
|
-
`;function fr(e){let t=(0,p.useManifest)(),n=(0,p.useVault)(),r=
|
|
621
|
+
`;function fr(e){let t=(0,p.useManifest)(),n=(0,p.useVault)(),r=H(),i=(0,l.useMemo)(()=>JSON.stringify(n.toPresentation3(t),null,2),[t,n]),a=(0,l.useMemo)(()=>JSON.stringify(n.toPresentation2(t),null,2),[t,n]);return(0,u.jsx)(qn,{title:`Export manifest`,close:r.centerPanel.popStack,children:(0,u.jsx)(`div`,{style:{flex:1,overflowY:`auto`},children:(0,u.jsx)(lr,{items:[{label:`Presentation 3`,description:`Download this version by clicking the "Download" button.`,maxHeight:400,large:!0,initialOpen:!0,overflow:!0,icon:(0,u.jsx)(z,{onClick:()=>B(i,`manifest.json`),children:(0,u.jsx)(ur,{})}),children:(0,u.jsxs)(`div`,{style:{maxWidth:`100%`},children:[(0,u.jsx)(`pre`,{style:{whiteSpace:`pre-wrap`},children:JSON.stringify(n.toPresentation3(t),null,2)}),(0,u.jsxs)(dr,{"data-sticky":`true`,children:[(0,u.jsx)(z,{onClick:()=>St(i),children:`Copy to clipboard`}),(0,u.jsx)(z,{onClick:()=>B(i,`manifest.json`),children:`Download`})]})]})},{label:`Presentation 2`,description:`Download this version by clicking the "Download" button.`,maxHeight:400,large:!0,icon:(0,u.jsx)(z,{onClick:()=>B(a,`manifest.json`),children:(0,u.jsx)(ur,{})}),children:(0,u.jsxs)(`div`,{style:{maxWidth:`100%`},children:[(0,u.jsx)(`pre`,{style:{whiteSpace:`pre-wrap`},children:JSON.stringify(n.toPresentation2(t),null,2)}),(0,u.jsxs)(dr,{"data-sticky":`true`,children:[(0,u.jsx)(z,{onClick:()=>St(a),children:`Copy to clipboard`}),(0,u.jsx)(z,{onClick:()=>B(a,`manifest.json`),children:`Download`})]})]})}]})})})}const pr=(0,C.default)(),mr=(0,l.createContext)(pr);function hr({children:e,emitter:t}){return(0,u.jsx)(mr.Provider,{value:t,children:e})}function gr(){return(0,l.useContext)(mr)}function _r(e,t,n=[]){let r=(0,l.useContext)(mr);(0,l.useEffect)(()=>{let n=e=>{t(e)};return r.on(e,n),()=>{r.off(e,n)}},[r,e,...n])}function vr(e,t=[]){let n=t.length?t:Array(e.length).fill(!1);if(typeof window>`u`)return n;let r=e.map(e=>window.matchMedia(e)),i=()=>r.map(e=>e.matches),[a,o]=(0,l.useState)(i);return(0,l.useLayoutEffect)(()=>{let e=()=>o(i);return r.forEach(t=>t.addListener(e)),()=>r.forEach(t=>t.removeListener(e))},[]),a}function yr(e,t,n,r=!0){let i=(0,w.useDebounce)(t,n);(0,l.useEffect)(()=>typeof window>`u`?()=>void 0:(window.addEventListener(`beforeunload`,t,!1),()=>{t(),window.removeEventListener(`beforeunload`,t)}),[t]),(0,l.useEffect)(()=>{if(e&&r)return e.subscribe(i,!0)},[i,e,r])}function br(){let e=(0,p.useAtlasStore)(),t=(0,y.useStore)(e,e=>e.switchTool),n=(0,y.useStore)(e,e=>e.polygonState.currentTool),r=(0,y.useStore)(e,e=>e.polygonState.selectedStamp),i=(0,y.useStore)(e,e=>e.polygonState.showBoundingBox);return(0,l.useMemo)(()=>({currentTool:n,selectedStamp:r,draw:{active:n===`pencil`,enable:t.draw},polygon:{active:n===`pen`,enable:t.pen},line:{active:n===`line`,enable:t.line},lineBox:{active:n===`lineBox`,enable:t.lineBox},square:{active:n===`box`,enable:t.box},triangle:{active:r?.id===`triangle`,enable:t.triangle},hexagon:{active:r?.id===`hexagon`,enable:t.hexagon},circle:{active:r?.id===`circle`,enable:t.circle},remove:{active:i,enable:t.remove}}),[i,r,n,t])}function xr({key:e,initialValue:t,requestId:n,getInitialValue:r}){let[i,a]=(0,p.useCurrentAnnotationMetadata)({requestId:n}),[o,s]=(0,l.useState)(r&&r(i)||i[e]||t);return[o,(0,l.useCallback)(t=>{a({[e]:t}),s(t)},[])]}const Sr=d.default.div`
|
|
622
622
|
position: relative;
|
|
623
623
|
width: 1px;
|
|
624
624
|
background: rgba(0, 0, 0, 0.2);
|
|
@@ -713,7 +713,7 @@ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=
|
|
|
713
713
|
top: 0;
|
|
714
714
|
bottom: 0;
|
|
715
715
|
z-index: 51; // This will always be quite high.
|
|
716
|
-
`,Dr=(0,l.forwardRef)(function({dir:e,open:t,actions:n,reset:r},i){let[a,o]=(0,l.useState)(!0),s=`mt-[calc(50vh+8px)]`,d=e===`left`?`${s} ml-[13px]`:`${s} ml-[3px]`;return(0,u.jsxs)(Sr,{onClick:()=>n.open(),children:[(0,u.jsx)(Er,{$open:t,$dir:e,className:`group`,children:t?null:(0,u.jsxs)(c.Tooltip,{placement:e===`left`?`right`:`left`,children:[(0,u.jsx)(c.TooltipTrigger,{as:wr,$dir:e,onClick:e=>n.open(),children:(0,u.jsx)(Se,{className:`text-2xl`,rotate:e===`right`?90:270})}),(0,u.jsx)(c.DefaultTooltipContent,{children:`Open`})]})}),(0,u.jsxs)(c.Tooltip,{placement:e===`left`?`right`:`left`,children:[(0,u.jsx)(c.TooltipTrigger,{"aria-label":`Resize panel`,asChild:!0,children:(0,u.jsx)(`div`,{children:(0,u.jsxs)(Tr,{ref:i,$open:t,$dir:e,className:`group`,children:[t?(0,u.jsxs)(c.Tooltip,{placement:e===`left`?`right`:`left`,children:[(0,u.jsx)(c.TooltipTrigger,{as:c.IconHandle,onPress:()=>n.close(),children:(0,u.jsx)(`div`,{onMouseOut:()=>{o(!0)},onMouseOver:()=>{o(!1)},children:(0,u.jsx)(F,{})})}),(0,u.jsx)(c.DefaultTooltipContent,{children:`Close`})]}):null,r&&t?(0,u.jsxs)(c.Tooltip,{placement:e===`left`?`right`:`left`,children:[(0,u.jsx)(c.TooltipTrigger,{as:c.IconHandle,onPress:()=>r(),children:(0,u.jsx)(`div`,{onMouseOut:()=>{o(!0)},onMouseOver:()=>{o(!1)},children:(0,u.jsx)(c.ResetIcon,{})})}),(0,u.jsx)(c.DefaultTooltipContent,{children:`Reset`})]}):null,t?(0,u.jsxs)(c.Tooltip,{placement:e===`left`?`right`:`left`,children:[(0,u.jsx)(c.TooltipTrigger,{asChild:!0,"aria-label":`Resize panel`,children:(0,u.jsx)(`div`,{onMouseOut:()=>{o(!0)},onMouseOver:()=>{o(!1)},children:(0,u.jsx)(c.ResizeHandle,{"aria-label":`Resize panel`})})}),(0,u.jsx)(c.DefaultTooltipContent,{children:`Resize panel`})]}):null]})})}),a&&(0,u.jsx)(c.DefaultTooltipContent,{className:d,children:`Resize panel`})]})]})});function Or(e){return(0,u.jsx)(`svg`,{width:`1em`,height:`1em`,viewBox:`0 0 42 42`,xmlns:`http://www.w3.org/2000/svg`,stroke:`currentColor`,...e,children:(0,u.jsxs)(`g`,{transform:`translate(2 2)`,strokeWidth:5,fill:`none`,fillRule:`evenodd`,children:[(0,u.jsx)(`circle`,{strokeOpacity:.5,cx:18,cy:18,r:18}),(0,u.jsx)(`path`,{d:`M36 18c0-9.94-8.06-18-18-18`,children:(0,u.jsx)(`animateTransform`,{attributeName:`transform`,type:`rotate`,from:`0 18 18`,to:`360 18 18`,dur:`1s`,repeatCount:`indefinite`})})]})})}var G={};function kr(){return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(`div`,{"data-header":`true`,className:G.ghostLoadingBlock}),(0,u.jsxs)(`div`,{className:G.ghostBlockList,children:[(0,u.jsx)(`div`,{className:G.ghostLoadingBlock}),(0,u.jsx)(`div`,{className:G.ghostLoadingBlock}),(0,u.jsx)(`div`,{className:G.ghostLoadingBlock}),(0,u.jsx)(`div`,{className:G.ghostLoadingBlock})]})]})}function Ar(e,t,n,r=[]){(0,l.useLayoutEffect)(()=>{let r=e.current;if(r)return r.addEventListener(t,n),()=>{r.removeEventListener(t,n)}},[t,...r])}function jr(e,t,n,r){return Math.sqrt(Math.abs(n-e)**2+Math.abs(r-t)**2)}function Mr(e,t,n,r){return n||(r?r/e:t)}function Nr(e,t={}){let n=(0,l.useRef)(null),r=(0,l.useRef)(null),i=(0,l.useRef)(null),a=(0,l.useRef)(null),o=(0,l.useRef)(.5),[s,u]=(0,l.useState)(!1),d=(0,l.useRef)(!1),f=(0,l.useRef)(0),p=(0,l.useRef)({x:0,y:0}),[{widthA:m,widthB:h},g]=(0,c.useLocalStorage)(`resize-layout/${e}`,{widthA:`auto`,widthB:`${
|
|
716
|
+
`,Dr=(0,l.forwardRef)(function({dir:e,open:t,actions:n,reset:r},i){let[a,o]=(0,l.useState)(!0),s=`mt-[calc(50vh+8px)]`,d=e===`left`?`${s} ml-[13px]`:`${s} ml-[3px]`;return(0,u.jsxs)(Sr,{onClick:()=>n.open(),children:[(0,u.jsx)(Er,{$open:t,$dir:e,className:`group`,children:t?null:(0,u.jsxs)(c.Tooltip,{placement:e===`left`?`right`:`left`,children:[(0,u.jsx)(c.TooltipTrigger,{as:wr,$dir:e,onClick:e=>n.open(),children:(0,u.jsx)(Se,{className:`text-2xl`,rotate:e===`right`?90:270})}),(0,u.jsx)(c.DefaultTooltipContent,{children:`Open`})]})}),(0,u.jsxs)(c.Tooltip,{placement:e===`left`?`right`:`left`,children:[(0,u.jsx)(c.TooltipTrigger,{"aria-label":`Resize panel`,asChild:!0,children:(0,u.jsx)(`div`,{children:(0,u.jsxs)(Tr,{ref:i,$open:t,$dir:e,className:`group`,children:[t?(0,u.jsxs)(c.Tooltip,{placement:e===`left`?`right`:`left`,children:[(0,u.jsx)(c.TooltipTrigger,{as:c.IconHandle,onPress:()=>n.close(),children:(0,u.jsx)(`div`,{onMouseOut:()=>{o(!0)},onMouseOver:()=>{o(!1)},children:(0,u.jsx)(F,{})})}),(0,u.jsx)(c.DefaultTooltipContent,{children:`Close`})]}):null,r&&t?(0,u.jsxs)(c.Tooltip,{placement:e===`left`?`right`:`left`,children:[(0,u.jsx)(c.TooltipTrigger,{as:c.IconHandle,onPress:()=>r(),children:(0,u.jsx)(`div`,{onMouseOut:()=>{o(!0)},onMouseOver:()=>{o(!1)},children:(0,u.jsx)(c.ResetIcon,{})})}),(0,u.jsx)(c.DefaultTooltipContent,{children:`Reset`})]}):null,t?(0,u.jsxs)(c.Tooltip,{placement:e===`left`?`right`:`left`,children:[(0,u.jsx)(c.TooltipTrigger,{asChild:!0,"aria-label":`Resize panel`,children:(0,u.jsx)(`div`,{onMouseOut:()=>{o(!0)},onMouseOver:()=>{o(!1)},children:(0,u.jsx)(c.ResizeHandle,{"aria-label":`Resize panel`})})}),(0,u.jsx)(c.DefaultTooltipContent,{children:`Resize panel`})]}):null]})})}),a&&(0,u.jsx)(c.DefaultTooltipContent,{className:d,children:`Resize panel`})]})]})});function Or(e){return(0,u.jsx)(`svg`,{width:`1em`,height:`1em`,viewBox:`0 0 42 42`,xmlns:`http://www.w3.org/2000/svg`,stroke:`currentColor`,...e,children:(0,u.jsxs)(`g`,{transform:`translate(2 2)`,strokeWidth:5,fill:`none`,fillRule:`evenodd`,children:[(0,u.jsx)(`circle`,{strokeOpacity:.5,cx:18,cy:18,r:18}),(0,u.jsx)(`path`,{d:`M36 18c0-9.94-8.06-18-18-18`,children:(0,u.jsx)(`animateTransform`,{attributeName:`transform`,type:`rotate`,from:`0 18 18`,to:`360 18 18`,dur:`1s`,repeatCount:`indefinite`})})]})})}var G={};function kr(){return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(`div`,{"data-header":`true`,className:G.ghostLoadingBlock}),(0,u.jsxs)(`div`,{className:G.ghostBlockList,children:[(0,u.jsx)(`div`,{className:G.ghostLoadingBlock}),(0,u.jsx)(`div`,{className:G.ghostLoadingBlock}),(0,u.jsx)(`div`,{className:G.ghostLoadingBlock}),(0,u.jsx)(`div`,{className:G.ghostLoadingBlock})]})]})}function Ar(e,t,n,r=[]){(0,l.useLayoutEffect)(()=>{let r=e.current;if(r)return r.addEventListener(t,n),()=>{r.removeEventListener(t,n)}},[t,...r])}function jr(e,t,n,r){return Math.sqrt(Math.abs(n-e)**2+Math.abs(r-t)**2)}function Mr(e,t,n,r){return n||(r?r/e:t)}function Nr(e,t={}){let n=(0,l.useRef)(null),r=(0,l.useRef)(null),i=(0,l.useRef)(null),a=(0,l.useRef)(null),o=(0,l.useRef)(.5),[s,u]=(0,l.useState)(!1),d=(0,l.useRef)(!1),f=(0,l.useRef)(0),p=(0,l.useRef)({x:0,y:0}),[{widthA:m,widthB:h},g]=(0,c.useLocalStorage)(`resize-layout/${e}`,{widthA:`auto`,widthB:`${Lt({initial:t.widthA,fallback:320,options:{minWidth:t.minWidthPx,maxWidth:t.maxWidthPx}})}px`}),{loading:_=!1}=t;return Ar(a,`mousedown`,e=>{p.current.x=e.pageX,p.current.y=e.pageY,f.current&&(clearTimeout(f.current),f.current=0),f.current=setTimeout(()=>{u(!0),d.current=!0},350)},[_]),Ar({current:typeof window<`u`?window:void 0},`mouseup`,()=>{let e=n.current;if(e&&d.current){let{x:n,width:r}=e.getBoundingClientRect(),i=t.marginLeft||0,a=Mr(r,.8,t.maxWidthPct,t.maxWidthPx)*r,s=Mr(r,.2,t.minWidthPct,t.minWidthPx)*r;if(t.left){let e=o.current*r-i;g({widthA:`${(1-o.current)*r-i}`,widthB:`${e>a?a:e<s?s:e}px`})}else{let e=1-o.current*r-i;g({widthA:`${e>a?a:e<s?s:e}px`,widthB:`${o.current*r-i}px`})}u(!1),d.current=!1,t.onDragEnd&&t.onDragEnd()}clearTimeout(f.current),f.current=0},[_]),Ar(n,`mousemove`,e=>{if(!d.current&&f.current&&jr(p.current.x,p.current.y,e.pageX,e.pageY)>20&&(u(!0),d.current=!0,clearTimeout(f.current),f.current=0),d.current&&r.current){let i=n.current;if(i){let{x:n,width:a}=i.getBoundingClientRect(),s=t.marginLeft||0,c=t.left||!1,l=Mr(a,.8,t.maxWidthPct,t.maxWidthPx),u=Mr(a,.2,t.minWidthPct,t.minWidthPx);o.current=(a+n-e.pageX-5)/a,c&&(o.current=1-o.current),o.current=o.current<u?u:o.current,o.current=o.current>l?l:o.current,r.current.style.width=`${o.current*a-s}px`}}},[s,_]),{refs:{container:n,resizer:a,resizableDiv:r,otherDiv:i},setWidths:g,isDragging:s,widthA:m,widthB:h}}const Pr=d.default.div`
|
|
717
717
|
position: relative;
|
|
718
718
|
display: flex;
|
|
719
719
|
flex: 1;
|
|
@@ -796,7 +796,7 @@ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=
|
|
|
796
796
|
transform: translateY(0);
|
|
797
797
|
`}
|
|
798
798
|
|
|
799
|
-
${
|
|
799
|
+
${Yt} {
|
|
800
800
|
box-shadow: none;
|
|
801
801
|
padding-left: 0.5em;
|
|
802
802
|
padding-right: 0.5em;
|
|
@@ -984,6 +984,6 @@ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=
|
|
|
984
984
|
flex: 1;
|
|
985
985
|
min-width: 0;
|
|
986
986
|
overflow: hidden;
|
|
987
|
-
`,ei=(0,l.memo)(function(e){let t=ce(),n=wt(),{vault:r}=(0,l.useContext)(p.ReactVaultContext),i=r||void 0,a=(0,l.useRef)(null),o=(0,l.useRef)(null),{loading:s,state:d,leftPanels:f,centerPanels:m,rightPanels:h,modals:g=[],actions:_}=n,v=f.find(e=>e.id===d.leftPanel.current),b=h.find(e=>e.id===d.rightPanel.current),x=m.find(e=>e.id===d.centerPanel.current),S=g.find(e=>e.id===d.modal.current),C=d.pinnedRightPanel.pinned?h.find(e=>e.id===d.pinnedRightPanel.current):void 0,[w]=vr([`(max-width: 1020px)`]),T=e.isLoading||!1,te=(0,l.useMemo)(()=>(n.background||[]).map((e,t)=>(0,u.jsx)(l.Fragment,{children:e.render()},t)),[n.background]),D=Nr(`left-panel/${v?.id}`,{left:!0,marginLeft:60,minWidthPx:v?.options?.minWidth||200,maxWidthPx:v?.options?.maxWidth||720,loading:s}),O=Nr(`right-panel/${b?.id}`,{left:!1,minWidthPx:b?.options?.minWidth||320,maxWidthPx:b?.options?.maxWidth||720,loading:s}),k=b&&(C?.id!==b.id||!(0,E.default)(d.pinnedRightPanel.state,d.rightPanel.state)),A=D.widthB===`auto`?void 0:()=>D.setWidths({widthA:`auto`,widthB:kt({options:v?.options,fallback:320})}),ne=O.widthB===`auto`?void 0:()=>O.setWidths({widthA:`auto`,widthB:kt({options:b?.options,fallback:320})});if((0,l.useLayoutEffect)(()=>{w&&d.leftPanel.open&&d.rightPanel.open&&(_.leftPanel.close(),_.rightPanel.close())},[w]),(0,l.useLayoutEffect)(()=>{if(x&&x.onMount)return x.onMount(d.centerPanel.state||x.defaultState||{},{...n,current:_.centerPanel,vault:i},t)},[d.centerPanel.current]),(0,l.useLayoutEffect)(()=>{h.length&&_.rightPanel.change({id:h[0].id}),f.length&&_.leftPanel.change({id:f[0].id}),m.length&&_.centerPanel.change({id:m[0].id})},[]),s)return null;let j=t=>(0,u.jsx)(Zr,{$menu:e.leftPanelMenuPosition||`bottom`,ref:D.refs.resizableDiv,className:t?`transition transition-${t}`:``,style:{width:d.leftPanel.open||t!==`exited`?D.widthB:void 0,minWidth:v?.options?.minWidth},children:T?(0,u.jsx)(q,{children:(0,u.jsx)(kr,{})}):(0,u.jsxs)(u.Fragment,{children:[e.leftPanelMenu?(0,u.jsx)(K,{$open:d.leftPanel.open&&t!==`exited`,$position:e.leftPanelMenuPosition||`bottom`,children:e.leftPanelMenu}):null,(0,u.jsx)(q,{children:d.leftPanel.open||t!==`exited`?(0,u.jsx)(u.Fragment,{children:v?(0,u.jsx)(Gt,{isLeft:!0,noHeader:!0,transition:t,panel:v,state:d.leftPanel,actions:_.leftPanel}):null}):null})]})}),M=()=>!S||d.modal.open===!1?null:(0,u.jsx)(c.Modal,{title:S.label,onClose:()=>_.modal.close(),children:At(S.render(d.modal.state||S.defaultState||{},{...n,current:_.modal,vault:i},t))}),re=()=>(0,u.jsxs)(Zr,{$menu:e.centerPanelMenuPosition||`top`,children:[e.centerPanelMenu?(0,u.jsx)(K,{$open:d.centerPanel.open,$position:e.centerPanelMenuPosition||`top`,children:e.centerPanelMenu}):null,(0,u.jsx)(q,{children:(0,u.jsx)(y.ErrorBoundary,{resetKeys:[x?.id],FallbackComponent:Dt,children:T?(0,u.jsx)(`div`,{style:{display:`flex`,flex:1,justifyContent:`center`,alignItems:`center`},children:(0,u.jsx)(Or,{stroke:`rgba(0,0,0,.3)`,fontSize:`2em`})}):d.centerPanel.open&&x?At(x.render(d.centerPanel.state||x.defaultState||{},{...n,current:_.centerPanel,vault:i},t)):null})})]}),N=t=>(0,u.jsx)(Zr,{$menu:e.rightPanelMenuPosition||`bottom`,ref:O.refs.resizableDiv,className:t?`transition transition-${t}`:``,style:{width:d.rightPanel.open||t!==`exited`?O.widthB:void 0,minWidth:b?.options?.minWidth},children:T?(0,u.jsx)(q,{children:(0,u.jsx)(kr,{})}):(0,u.jsxs)(u.Fragment,{children:[e.rightPanelMenu?(0,u.jsx)(K,{$open:d.rightPanel.open,$position:e.rightPanelMenuPosition||`bottom`,children:e.rightPanelMenu}):null,(0,u.jsx)(q,{children:d.rightPanel.open||t!==`exited`?(0,u.jsxs)(u.Fragment,{children:[k?(0,u.jsx)(Gt,{panel:b,state:d.rightPanel,actions:_.rightPanel,pinActions:_.pinnedRightPanel,available:h}):null,C?(0,u.jsx)(Gt,{panel:C,state:d.pinnedRightPanel,actions:_.pinnedRightPanel,close:_.rightPanel.close}):null]}):null})]})});return w?(0,u.jsxs)(Wr,{children:[e.hideHeader?null:(0,u.jsxs)(Gr,{children:[e.header||null,e.menu?(0,u.jsx)(`menu`,{children:e.menu}):null]}),(0,u.jsx)(qr,{children:(0,u.jsxs)(Pr,{children:[(0,u.jsx)(Fr,{children:re()}),(0,u.jsxs)(Ir,{children:[f.length>0?(0,u.jsx)(Lr,{onClick:_.leftPanel.toggle,children:v?.label}):null,h.length>0?(0,u.jsx)(zr,{children:(0,u.jsxs)(Br,{onClick:_.rightPanel.toggle,children:[(0,u.jsx)(Se,{rotate:180}),b?.label]})}):null,(0,u.jsx)(Rr,{children:`Preview`})]}),h.length>0?(0,u.jsx)(Vr,{$open:d.rightPanel.open,children:N()}):null,f.length>0?(0,u.jsx)(Hr,{$open:d.leftPanel.open,children:j()}):null,f.length>0||h.length>0?(0,u.jsx)(Ur,{$open:d.leftPanel.open||d.rightPanel.open,onClick:()=>{_.leftPanel.close(),_.rightPanel.close()}}):null]})})]}):(0,u.jsxs)(Wr,{className:`manifest-editor ${e.className}`,children:[e.hideHeader?null:(0,u.jsxs)(Gr,{children:[e.header||null,e.menu?(0,u.jsx)(`menu`,{children:e.menu}):null]}),(0,u.jsxs)(qr,{ref:e=>{D.refs.container.current=e,O.refs.container.current=e},children:[f.length>0?(0,u.jsx)(c.PanelSideMenu,{current:d.leftPanel.current,items:f.map(e=>({id:e.id,label:e.label,icon:e.icon,divide:e.divide,onClick:()=>{d.leftPanel.current===e.id?_.leftPanel.toggle():_.leftPanel.change({id:e.id})}})),open:d.leftPanel.open}):null,f.length>0?(0,u.jsx)(ee.Transition,{nodeRef:a,in:d.leftPanel.open,timeout:400,unmountOnExit:!1,children:e=>(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(Jr,{ref:a,$width:D.widthB,$state:e,$motion:!0,children:j(e)}),(0,u.jsx)(Dr,{ref:D.refs.resizer,reset:A,dir:`left`,transition:e,open:d.leftPanel.open||e!==`exited`,actions:_.leftPanel})]})}):null,(0,u.jsx)(Yr,{children:re()}),h.length>0?(0,u.jsx)(ee.Transition,{nodeRef:o,in:d.rightPanel.open,timeout:400,unmountOnExit:!1,children:e=>(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(Dr,{ref:O.refs.resizer,dir:`right`,reset:ne,open:d.rightPanel.open,actions:_.rightPanel}),(0,u.jsx)(Xr,{ref:o,$width:O.widthB,$state:e,$motion:!0,children:N(e)})]})}):null]}),(0,u.jsx)(Kr,{children:e.footer||null}),(0,u.jsx)(`div`,{className:`hidden`,children:te}),(0,u.jsx)(u.Fragment,{children:M()})]})});function J(e,t){function n(){t({type:`popStack`,panel:e,payload:void 0})}function r(n){t({type:`change`,panel:e,payload:n})}function i(n){t({type:`open`,panel:e,payload:n})}function a(){t({type:`close`,panel:e,payload:void 0})}function o(){t({type:`toggle`,panel:e,payload:void 0})}function s(){t({type:`minimise`,panel:e,payload:void 0})}function c(n){t({type:`maximise`,panel:e,payload:n})}function u(n){t({type:`setCustomWidth`,panel:e,payload:n})}function d(){t({type:`resetSize`,panel:e,payload:void 0})}function f(n){t({type:`pin`,panel:e,payload:n})}function p(){t({type:`unpin`,panel:e,payload:void 0})}return(0,l.useMemo)(()=>({popStack:n,change:r,open:i,close:a,toggle:o,minimise:s,maximise:c,setCustomWidth:u,resetSize:d,pin:f,unpin:p}),[])}function ti(e,t){if(t.payload&&t.payload.stacked){if(e.current){let n=e.stack[e.stack.length-1];if(n&&n.id===e.current)return;t.payload.unique&&(e.stack=e.stack.filter(t=>t.id!==e.current)),e.stack.push({id:e.current,state:e.state?{...(0,m.original)(e.state)}:{}})}}else e.stack=[]}function Y(e,t){switch(t.type){case`popStack`:if(e.stack.length){let t=e.stack[e.stack.length-1];t&&(e.current=t.id,e.state=t.state),e.stack=e.stack.slice(0,-1)}break;case`change`:t.payload.id!==e.current&&ti(e,t),e.state=t.payload.state,e.current=t.payload.id;break;case`close`:e.open=!1;break;case`open`:e.open=!0,t.payload&&(t.payload.id!==e.current&&ti(e,t),e.state=t.payload.state,e.current=t.payload.id);break;case`toggle`:e.open=!e.open;break;case`maximise`:e.minimised=!1,t.payload&&(e.state=t.payload.state,e.current=t.payload.id);break;case`minimise`:e.minimised=!0;break;case`setCustomWidth`:e.customWidth=t.payload;break;case`resetSize`:e.customWidth=void 0}if(Ot(e))switch(t.type){case`pin`:e.pinned=!0,e.state=t.payload.state,e.current=t.payload.id;break;case`unpin`:e.pinned=!1,e.state=void 0;break}}const ni=(0,m.produce)((e,t)=>{switch(t.panel){case`centerPanel`:Y(e.centerPanel,t);break;case`leftPanel`:Y(e.leftPanel,t);break;case`rightPanel`:Y(e.rightPanel,t);break;case`modal`:Y(e.modal,t);break;case`pinnedRightPanel`:Y(e.pinnedRightPanel,t);break}});function X(){return{customWidth:void 0,minimised:!1,open:!0,current:null,state:null,stack:[]}}function ri(){return{leftPanel:X(),centerPanel:X(),rightPanel:X(),modal:X(),pinnedRightPanel:{...X(),pinnable:!0,pinned:!1}}}const ii=(0,l.createContext)({resource:null});function ai(){return(0,l.useContext)(ii)}function oi(){let e=(0,p.useVault)(),{resource:t}=ai();k(t,`Nothing selected`);let{id:n,type:r}=t;return(0,p.useVaultSelector)(()=>e.get({id:n,type:r}),[n,r])}function si(){let{resource:e}=ai();return e}function ci({resource:e,children:t}){let{id:n,type:r}=e||{};return(0,u.jsx)(ii.Provider,{value:(0,l.useMemo)(()=>({resource:n&&r?{id:n,type:r}:null}),[n,r]),children:t})}var li=class extends l.Component{constructor(...e){super(...e),R(this,`state`,{hasError:!1})}static getDerivedStateFromError(e){return console.error(e),{hasError:!0}}componentDidCatch(e,t){console.error(`Uncaught error:`,e,t)}render(){return this.state.hasError?(0,u.jsx)(`h1`,{children:`Sorry.. there was an error`}):this.props.children}};function Z(e,t){return typeof e==`string`?{id:e,state:t}:e}const ui=(0,l.memo)(function(e){let t=P(),n=gr(),r=t.layout,[i,a]=(0,l.useReducer)(ni,void 0,ri),o={centerPanel:J(`centerPanel`,a),leftPanel:J(`leftPanel`,a),rightPanel:J(`rightPanel`,a),pinnedRightPanel:J(`pinnedRightPanel`,a),modal:J(`modal`,a),editingStack:vn()};function s(e){let t=r.rightPanels.find(t=>t.id===e);if(t)return[t,o.rightPanel,o.pinnedRightPanel];let n=r.centerPanels.find(t=>t.id===e);if(n)return[n,o.centerPanel];let i=r.leftPanels.find(t=>t.id===e);if(i)return[i,o.leftPanel];k(!1,`Was not able to find panel with id "${e}"`)}function c(e,t){let{id:r,state:i,stacked:a}=Z(e,t),[o,c,l]=s(r);if(l&&o.options?.openPinned)l.pin({id:r,state:{...o.defaultState||{},...i||{}}});else{let e={id:r,state:{...o.defaultState||{},...i||{}},stacked:a};n.emit(`layout.open`,e),c.open(e)}}function d(e,t){let{id:r,state:i}=Z(e,t),[a,o]=s(r),c={id:r,state:{...a.defaultState||{},...i||{}},stacked:!0};n.emit(`layout.open`,c),o.open(c)}function f(e,t){let{id:r,state:i,stacked:a}=Z(e,t),[o,c]=s(r),l={id:r,state:{...o.defaultState||{},...i||{}},stacked:a};n.emit(`layout.change`,l),c.change(l)}function p(e,t){let{id:r}=Z(e,t),[,i]=s(r);n.emit(`layout.close`,{id:r}),i.close()}function m(e,t){let{id:r}=Z(e,t),[,i]=s(r);n.emit(`layout.toggle`,{id:r}),i.toggle()}function h(e,t={},{reset:i,property:a,stacked:s,forceOpen:c}={}){let l={resource:(0,_.isSpecificResource)(e)?e:{type:`SpecificResource`,source:e},...t};n.emit(`layout.edit`,l),o.editingStack.edit(l,i),r.rightPanels.find(e=>e.id===`@manifest-editor/editor`)&&(c?o.rightPanel.open({id:`@manifest-editor/editor`,stacked:s!==!1,state:{property:a},unique:!0}):o.rightPanel.change({id:`@manifest-editor/editor`,stacked:s!==!1,state:{property:a},unique:!0}))}function g(e){o.editingStack.create(e,{}),n.emit(`layout.create`,e),r.modals?.find(e=>e.id===`@manifest-editor/creator`)?o.modal.open({id:`@manifest-editor/creator`,stacked:!0,unique:!0,state:e}):r.rightPanels.find(e=>e.id===`@manifest-editor/creator`)&&o.rightPanel.open({id:`@manifest-editor/creator`,stacked:!0,unique:!0,state:e})}let v={open:c,change:f,close:p,toggle:m,stack:d,edit:h,create:g};return(0,u.jsx)(bt.Provider,{value:(0,l.useMemo)(()=>({...o,...v}),[r]),children:(0,u.jsx)(xt.Provider,{value:i,children:e.children})})}),di=[{id:`universal-viewer`,config:{url:`https://universalviewer.dev/#?iiifManifestId={manifestId}`},type:`external-manifest-preview`,label:`Universal viewer`},{id:`mirador-3`,type:`external-manifest-preview`,label:`Mirador 3`,config:{url:`https://tomcrane.github.io/scratch/mirador3/?iiif-content={manifestId}`}},{id:`annona`,type:`external-manifest-preview`,label:`Annona`,config:{url:`https://ncsu-libraries.github.io/annona/tools/#/display?url={manifestId}&viewtype=iiif-storyboard&settings=%7B%22fullpage%22%3Atrue%7D`}},{id:`iiif-preview`,config:{url:`https://iiif-preview.digirati.services/store`},type:`iiif-preview-service`,label:`IIIF Preview`}],fi=new te.ImageServiceLoader({approximateServices:!0,verificationsRequired:8,enableFetching:!0});function pi({config:e,saveConfig:t,children:n,theme:r,previews:i,resource:a,editing:o}){let s=M(),c=(0,l.useMemo)(()=>({...s,...e,previews:e?.previews||s.previews||di}),[s,e]);return(0,u.jsx)(li,{children:(0,u.jsx)(p.ImageServiceLoaderContext.Provider,{value:fi,children:(0,u.jsx)(De,{resource:a,children:(0,u.jsx)(sn,{children:(0,u.jsx)(d.ThemeProvider,{theme:r||Fn,children:(0,u.jsx)(N,{config:c,saveConfig:t,children:(0,u.jsx)(On,{children:(0,u.jsx)(ui,{children:(0,u.jsx)(Vn,{children:(0,u.jsx)(Re,{previews:i||[],configs:c.previews,children:(0,u.jsx)(p.AtlasStoreProvider,{children:n})})})})})})})})})})})}const Q={},mi=(0,l.createContext)(`global`);function hi(){return(0,l.useContext)(mi)}function gi(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function _i(e){let t=hi(),[,n]=(0,l.useReducer)(e=>e+1,0),r=(0,l.useMemo)(()=>(Q[t]||(Q[t]={}),Q[t][e]||(Q[t][e]={name:e,emitter:(0,w.default)(),status:`idle`,promise:Promise.resolve(),abort:new AbortController,reject:()=>void 0,resolve:()=>void 0}),Q[t][e]),[t,e]);return $(r,`abort`,n),$(r,`error`,n),$(r,`complete`,n),$(r,`running`,n),r}function $(e,t,n){let r=(0,l.useCallback)(()=>n(e),[n]);(0,l.useEffect)(()=>{let n=e.emitter;return n.on(t,r),()=>n.off(t,r)},[t,r,e.emitter])}const vi=()=>void 0;function yi(e,t){let n=_i(e);return $(n,`complete`,t||vi),[e=>{n.status===`running`&&(n.abort.abort(),n.emitter.emit(`abort`)),n.error&&(n.error=``);let t=gi();t.promise.then(()=>n.emitter.emit(`complete`)).catch(()=>n.emitter.emit(`error`)),n.status=`running`,n.request=e,n.promise=t.promise,n.resolve=t.resolve,n.reject=t.reject,n.emitter.emit(`running`)},n]}function bi(e,t){let n=_i(e);return $(n,`running`,t),[e=>{n.status===`running`&&(n.response=e,n.status=`complete`,n.resolve())},n,(e,t)=>{n.status===`running`&&(n.error=t||e,n.status=`error`,n.reject(e))}]}function xi({children:e}){return(0,u.jsx)(mi.Provider,{value:(0,l.useMemo)(()=>`id-${Date.now()}`,[]),children:e})}function Si(e){return!1}function Ci({as:e,reference:t,onReference:n,onLink:r,onAnalysis:i,onDropReference:a,onDropLink:o,onDropAnalysis:s,onPasteReference:c,onPasteLink:d,onPasteAnalysis:f,...p}){let m=e||`div`,h=a||n,g=c||n,_=d||r,v=f||i,y=(0,l.useMemo)(()=>t,[t?.id,t?.type]),b=(0,l.useCallback)(function(e){e.defaultPrevented||(e.preventDefault(),e.clipboardData&&y&&y.id&&y.type&&e.clipboardData.setData(`application/json+vault`,JSON.stringify({id:y.id,type:y.type})))},[y]),x=(0,l.useCallback)(async function(e){if(!e.defaultPrevented&&(e.preventDefault(),e.clipboardData)){if(p.onLoading&&p.onLoading(),g){let t=e.clipboardData.getData(`application/json+vault`);if(t)try{let e=JSON.parse(t);e&&e.id&&e.type&&g(e)}catch{}}if(_||v){let t=e.clipboardData.getData(`text`);if(t.startsWith(`http`)){let e=t.split(`
|
|
988
|
-
`);for(let t of e){if(v)try{let e=await Si(t);if(e){v(e);continue}}catch{}_&&_(t)}}}p.onComplete&&p.onComplete()}},[]),
|
|
987
|
+
`,ei=(0,l.memo)(function(e){let t=ce(),n=Pt(),{vault:r}=(0,l.useContext)(p.ReactVaultContext),i=r||void 0,a=(0,l.useRef)(null),o=(0,l.useRef)(null),{loading:s,state:d,leftPanels:f,centerPanels:m,rightPanels:h,modals:g=[],actions:_}=n,v=f.find(e=>e.id===d.leftPanel.current),y=h.find(e=>e.id===d.rightPanel.current),b=m.find(e=>e.id===d.centerPanel.current),x=g.find(e=>e.id===d.modal.current),S=d.pinnedRightPanel.pinned?h.find(e=>e.id===d.pinnedRightPanel.current):void 0,[C]=vr([`(max-width: 1020px)`]),w=e.isLoading||!1,ne=(0,l.useMemo)(()=>(n.background||[]).map((e,t)=>(0,u.jsx)(l.Fragment,{children:e.render()},t)),[n.background]),E=Nr(`left-panel/${v?.id}`,{left:!0,marginLeft:60,minWidthPx:v?.options?.minWidth||200,maxWidthPx:v?.options?.maxWidth||720,loading:s}),D=Nr(`right-panel/${y?.id}`,{left:!1,minWidthPx:y?.options?.minWidth||320,maxWidthPx:y?.options?.maxWidth||720,loading:s}),O=y&&(S?.id!==y.id||!(0,T.default)(d.pinnedRightPanel.state,d.rightPanel.state)),k=E.widthB===`auto`?void 0:()=>E.setWidths({widthA:`auto`,widthB:Lt({options:v?.options,fallback:320})}),A=D.widthB===`auto`?void 0:()=>D.setWidths({widthA:`auto`,widthB:Lt({options:y?.options,fallback:320})});if((0,l.useLayoutEffect)(()=>{C&&d.leftPanel.open&&d.rightPanel.open&&(_.leftPanel.close(),_.rightPanel.close())},[C]),(0,l.useLayoutEffect)(()=>{if(b&&b.onMount)return b.onMount(d.centerPanel.state||b.defaultState||{},{...n,current:_.centerPanel,vault:i},t)},[d.centerPanel.current]),(0,l.useLayoutEffect)(()=>{h.length&&_.rightPanel.change({id:h[0].id}),f.length&&_.leftPanel.change({id:f[0].id}),m.length&&_.centerPanel.change({id:m[0].id})},[]),s)return null;let j=t=>(0,u.jsx)(Zr,{$menu:e.leftPanelMenuPosition||`bottom`,ref:E.refs.resizableDiv,className:[`manifest-editor`,t?`transition transition-${t}`:``].join(` `),style:{width:d.leftPanel.open||t!==`exited`?E.widthB:void 0,minWidth:v?.options?.minWidth},children:w?(0,u.jsx)(q,{children:(0,u.jsx)(kr,{})}):(0,u.jsxs)(u.Fragment,{children:[e.leftPanelMenu?(0,u.jsx)(K,{$open:d.leftPanel.open&&t!==`exited`,$position:e.leftPanelMenuPosition||`bottom`,children:e.leftPanelMenu}):null,(0,u.jsx)(q,{children:d.leftPanel.open||t!==`exited`?(0,u.jsx)(u.Fragment,{children:v?(0,u.jsx)($t,{isLeft:!0,noHeader:!0,transition:t,panel:v,state:d.leftPanel,actions:_.leftPanel}):null}):null})]})}),M=()=>!x||d.modal.open===!1?null:(0,u.jsx)(c.Modal,{title:x.label,onClose:()=>_.modal.close(),children:Rt(x.render(d.modal.state||x.defaultState||{},{...n,current:_.modal,vault:i},t))}),re=()=>(0,u.jsxs)(Zr,{$menu:e.centerPanelMenuPosition||`top`,children:[e.centerPanelMenu?(0,u.jsx)(K,{$open:d.centerPanel.open,$position:e.centerPanelMenuPosition||`top`,children:e.centerPanelMenu}):null,(0,u.jsx)(q,{children:(0,u.jsx)(ee.ErrorBoundary,{resetKeys:[b?.id],FallbackComponent:Ft,children:w?(0,u.jsx)(`div`,{style:{display:`flex`,flex:1,justifyContent:`center`,alignItems:`center`},children:(0,u.jsx)(Or,{stroke:`rgba(0,0,0,.3)`,fontSize:`2em`})}):d.centerPanel.open&&b?Rt(b.render(d.centerPanel.state||b.defaultState||{},{...n,current:_.centerPanel,vault:i},t)):null})})]}),N=t=>(0,u.jsx)(Zr,{$menu:e.rightPanelMenuPosition||`bottom`,ref:D.refs.resizableDiv,className:t?`transition transition-${t}`:``,style:{width:d.rightPanel.open||t!==`exited`?D.widthB:void 0,minWidth:y?.options?.minWidth},children:w?(0,u.jsx)(q,{children:(0,u.jsx)(kr,{})}):(0,u.jsxs)(u.Fragment,{children:[e.rightPanelMenu?(0,u.jsx)(K,{$open:d.rightPanel.open,$position:e.rightPanelMenuPosition||`bottom`,children:e.rightPanelMenu}):null,(0,u.jsx)(q,{children:d.rightPanel.open||t!==`exited`?(0,u.jsxs)(u.Fragment,{children:[O?(0,u.jsx)($t,{panel:y,state:d.rightPanel,actions:_.rightPanel,pinActions:_.pinnedRightPanel,available:h}):null,S?(0,u.jsx)($t,{panel:S,state:d.pinnedRightPanel,actions:_.pinnedRightPanel,close:_.rightPanel.close}):null]}):null})]})});return C?(0,u.jsxs)(Wr,{children:[e.hideHeader?null:(0,u.jsxs)(Gr,{children:[e.header||null,e.menu?(0,u.jsx)(`menu`,{children:e.menu}):null]}),(0,u.jsx)(qr,{children:(0,u.jsxs)(Pr,{children:[(0,u.jsx)(Fr,{children:re()}),(0,u.jsxs)(Ir,{children:[f.length>0?(0,u.jsx)(Lr,{onClick:_.leftPanel.toggle,children:v?.label}):null,h.length>0?(0,u.jsx)(zr,{children:(0,u.jsxs)(Br,{onClick:_.rightPanel.toggle,children:[(0,u.jsx)(Se,{rotate:180}),y?.label]})}):null,(0,u.jsx)(Rr,{children:`Preview`})]}),h.length>0?(0,u.jsx)(Vr,{$open:d.rightPanel.open,children:N()}):null,f.length>0?(0,u.jsx)(Hr,{$open:d.leftPanel.open,children:j()}):null,f.length>0||h.length>0?(0,u.jsx)(Ur,{$open:d.leftPanel.open||d.rightPanel.open,onClick:()=>{_.leftPanel.close(),_.rightPanel.close()}}):null]})})]}):(0,u.jsxs)(Wr,{id:e.htmlId||`manifest-editor-container`,className:`manifest-editor ${e.className||``}`,children:[e.hideHeader?null:(0,u.jsxs)(Gr,{children:[e.header||null,e.menu?(0,u.jsx)(`menu`,{children:e.menu}):null]}),(0,u.jsxs)(qr,{ref:e=>{E.refs.container.current=e,D.refs.container.current=e},children:[f.length>0?(0,u.jsx)(c.PanelSideMenu,{current:d.leftPanel.current,items:f.map(e=>({id:e.id,label:e.label,icon:e.icon,divide:e.divide,onClick:()=>{d.leftPanel.current===e.id?_.leftPanel.toggle():_.leftPanel.change({id:e.id})}})),open:d.leftPanel.open}):null,f.length>0?(0,u.jsx)(te.Transition,{nodeRef:a,in:d.leftPanel.open,timeout:400,unmountOnExit:!1,children:e=>(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(Jr,{ref:a,$width:E.widthB,$state:e,$motion:!0,children:j(e)}),(0,u.jsx)(Dr,{ref:E.refs.resizer,reset:k,dir:`left`,transition:e,open:d.leftPanel.open||e!==`exited`,actions:_.leftPanel})]})}):null,(0,u.jsx)(Yr,{children:re()}),h.length>0?(0,u.jsx)(te.Transition,{nodeRef:o,in:d.rightPanel.open,timeout:400,unmountOnExit:!1,children:e=>(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(Dr,{ref:D.refs.resizer,dir:`right`,reset:A,open:d.rightPanel.open,actions:_.rightPanel}),(0,u.jsx)(Xr,{ref:o,$width:D.widthB,$state:e,$motion:!0,children:N(e)})]})}):null]}),(0,u.jsx)(Kr,{children:e.footer||null}),(0,u.jsx)(`div`,{className:`hidden`,children:ne}),(0,u.jsx)(u.Fragment,{children:M()})]})});function J(e,t){function n(){t({type:`popStack`,panel:e,payload:void 0})}function r(n){t({type:`change`,panel:e,payload:n})}function i(n){t({type:`open`,panel:e,payload:n})}function a(){t({type:`close`,panel:e,payload:void 0})}function o(){t({type:`toggle`,panel:e,payload:void 0})}function s(){t({type:`minimise`,panel:e,payload:void 0})}function c(n){t({type:`maximise`,panel:e,payload:n})}function u(n){t({type:`setCustomWidth`,panel:e,payload:n})}function d(){t({type:`resetSize`,panel:e,payload:void 0})}function f(n){t({type:`pin`,panel:e,payload:n})}function p(){t({type:`unpin`,panel:e,payload:void 0})}return(0,l.useMemo)(()=>({popStack:n,change:r,open:i,close:a,toggle:o,minimise:s,maximise:c,setCustomWidth:u,resetSize:d,pin:f,unpin:p}),[])}function ti(e,t){if(t.payload&&t.payload.stacked){if(e.current){let n=e.stack[e.stack.length-1];if(n&&n.id===e.current)return;t.payload.unique&&(e.stack=e.stack.filter(t=>t.id!==e.current)),e.stack.push({id:e.current,state:e.state?{...(0,m.original)(e.state)}:{}})}}else e.stack=[]}function Y(e,t){switch(t.type){case`popStack`:if(e.stack.length){let t=e.stack[e.stack.length-1];t&&(e.current=t.id,e.state=t.state),e.stack=e.stack.slice(0,-1)}break;case`change`:t.payload.id!==e.current&&ti(e,t),e.state=t.payload.state,e.current=t.payload.id;break;case`close`:e.open=!1;break;case`open`:e.open=!0,t.payload&&(t.payload.id!==e.current&&ti(e,t),e.state=t.payload.state,e.current=t.payload.id);break;case`toggle`:e.open=!e.open;break;case`maximise`:e.minimised=!1,t.payload&&(e.state=t.payload.state,e.current=t.payload.id);break;case`minimise`:e.minimised=!0;break;case`setCustomWidth`:e.customWidth=t.payload;break;case`resetSize`:e.customWidth=void 0}if(It(e))switch(t.type){case`pin`:e.pinned=!0,e.state=t.payload.state,e.current=t.payload.id;break;case`unpin`:e.pinned=!1,e.state=void 0;break}}const ni=(0,m.produce)((e,t)=>{switch(t.panel){case`centerPanel`:Y(e.centerPanel,t);break;case`leftPanel`:Y(e.leftPanel,t);break;case`rightPanel`:Y(e.rightPanel,t);break;case`modal`:Y(e.modal,t);break;case`pinnedRightPanel`:Y(e.pinnedRightPanel,t);break}});function X(){return{customWidth:void 0,minimised:!1,open:!0,current:null,state:null,stack:[]}}function ri(){return{leftPanel:X(),centerPanel:X(),rightPanel:X(),modal:X(),pinnedRightPanel:{...X(),pinnable:!0,pinned:!1}}}const ii=(0,l.createContext)({resource:null});function ai(){return(0,l.useContext)(ii)}function oi(){let e=(0,p.useVault)(),{resource:t}=ai();O(t,`Nothing selected`);let{id:n,type:r}=t;return(0,p.useVaultSelector)(()=>e.get({id:n,type:r}),[n,r])}function si(){let{resource:e}=ai();return e}function ci({resource:e,children:t}){let{id:n,type:r}=e||{};return(0,u.jsx)(ii.Provider,{value:(0,l.useMemo)(()=>({resource:n&&r?{id:n,type:r}:null}),[n,r]),children:t})}var li=class extends l.Component{constructor(...e){super(...e),R(this,`state`,{hasError:!1})}static getDerivedStateFromError(e){return console.error(e),{hasError:!0}}componentDidCatch(e,t){console.error(`Uncaught error:`,e,t)}render(){return this.state.hasError?(0,u.jsx)(`h1`,{children:`Sorry.. there was an error`}):this.props.children}};function Z(e,t){return typeof e==`string`?{id:e,state:t}:e}const ui=(0,l.memo)(function(e){let t=P(),n=gr(),r=t.layout,[i,a]=(0,l.useReducer)(ni,void 0,ri),o={centerPanel:J(`centerPanel`,a),leftPanel:J(`leftPanel`,a),rightPanel:J(`rightPanel`,a),pinnedRightPanel:J(`pinnedRightPanel`,a),modal:J(`modal`,a),editingStack:vn()};function s(e){let t=r.rightPanels.find(t=>t.id===e);if(t)return[t,o.rightPanel,o.pinnedRightPanel];let n=r.centerPanels.find(t=>t.id===e);if(n)return[n,o.centerPanel];let i=r.leftPanels.find(t=>t.id===e);if(i)return[i,o.leftPanel];O(!1,`Was not able to find panel with id "${e}"`)}function c(e,t){let{id:r,state:i,stacked:a}=Z(e,t),[o,c,l]=s(r);if(l&&o.options?.openPinned)l.pin({id:r,state:{...o.defaultState||{},...i||{}}});else{let e={id:r,state:{...o.defaultState||{},...i||{}},stacked:a};n.emit(`layout.open`,e),c.open(e)}}function d(e,t){let{id:r,state:i}=Z(e,t),[a,o]=s(r),c={id:r,state:{...a.defaultState||{},...i||{}},stacked:!0};n.emit(`layout.open`,c),o.open(c)}function f(e,t){let{id:r,state:i,stacked:a}=Z(e,t),[o,c]=s(r),l={id:r,state:{...o.defaultState||{},...i||{}},stacked:a};n.emit(`layout.change`,l),c.change(l)}function p(e,t){let{id:r}=Z(e,t),[,i]=s(r);n.emit(`layout.close`,{id:r}),i.close()}function m(e,t){let{id:r}=Z(e,t),[,i]=s(r);n.emit(`layout.toggle`,{id:r}),i.toggle()}function h(e,t={},{reset:i,property:a,stacked:s,forceOpen:c}={}){let l={resource:(0,_.isSpecificResource)(e)?e:{type:`SpecificResource`,source:e},...t};n.emit(`layout.edit`,l),o.editingStack.edit(l,i),r.rightPanels.find(e=>e.id===`@manifest-editor/editor`)&&(c?o.rightPanel.open({id:`@manifest-editor/editor`,stacked:s!==!1,state:{property:a},unique:!0}):o.rightPanel.change({id:`@manifest-editor/editor`,stacked:s!==!1,state:{property:a},unique:!0}))}function g(e){o.editingStack.create(e,{}),n.emit(`layout.create`,e),r.modals?.find(e=>e.id===`@manifest-editor/creator`)?o.modal.open({id:`@manifest-editor/creator`,stacked:!0,unique:!0,state:e}):r.rightPanels.find(e=>e.id===`@manifest-editor/creator`)&&o.rightPanel.open({id:`@manifest-editor/creator`,stacked:!0,unique:!0,state:e})}let v={open:c,change:f,close:p,toggle:m,stack:d,edit:h,create:g};return(0,u.jsx)(At.Provider,{value:(0,l.useMemo)(()=>({...o,...v}),[r]),children:(0,u.jsx)(jt.Provider,{value:i,children:e.children})})}),di=[{id:`universal-viewer`,config:{url:`https://universalviewer.dev/#?iiifManifestId={manifestId}`},type:`external-manifest-preview`,label:`Universal viewer`},{id:`mirador-3`,type:`external-manifest-preview`,label:`Mirador 3`,config:{url:`https://tomcrane.github.io/scratch/mirador3/?iiif-content={manifestId}`}},{id:`annona`,type:`external-manifest-preview`,label:`Annona`,config:{url:`https://ncsu-libraries.github.io/annona/tools/#/display?url={manifestId}&viewtype=iiif-storyboard&settings=%7B%22fullpage%22%3Atrue%7D`}},{id:`iiif-preview`,config:{url:`https://iiif-preview.digirati.services/store`},type:`iiif-preview-service`,label:`IIIF Preview`}],fi=new ne.ImageServiceLoader({approximateServices:!0,verificationsRequired:8,enableFetching:!0});function pi({config:e,saveConfig:t,children:n,theme:r,previews:i,resource:a,editing:o}){let s=M(),c=(0,l.useMemo)(()=>({...s,...e,previews:e?.previews||s.previews||di}),[s,e]);return(0,u.jsx)(li,{children:(0,u.jsx)(p.ImageServiceLoaderContext.Provider,{value:fi,children:(0,u.jsx)(De,{resource:a,children:(0,u.jsx)(sn,{children:(0,u.jsx)(d.ThemeProvider,{theme:r||Fn,children:(0,u.jsx)(N,{config:c,saveConfig:t,children:(0,u.jsx)(On,{children:(0,u.jsx)(ui,{children:(0,u.jsx)(Vn,{children:(0,u.jsx)(Re,{previews:i||[],configs:c.previews,children:(0,u.jsx)(p.AtlasStoreProvider,{children:n})})})})})})})})})})})}const Q={},mi=(0,l.createContext)(`global`);function hi(){return(0,l.useContext)(mi)}function gi(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function _i(e){let t=hi(),[,n]=(0,l.useReducer)(e=>e+1,0),r=(0,l.useMemo)(()=>(Q[t]||(Q[t]={}),Q[t][e]||(Q[t][e]={name:e,emitter:(0,C.default)(),status:`idle`,promise:Promise.resolve(),abort:new AbortController,reject:()=>void 0,resolve:()=>void 0}),Q[t][e]),[t,e]);return $(r,`abort`,n),$(r,`error`,n),$(r,`complete`,n),$(r,`running`,n),r}function $(e,t,n){let r=(0,l.useCallback)(()=>n(e),[n]);(0,l.useEffect)(()=>{let n=e.emitter;return n.on(t,r),()=>n.off(t,r)},[t,r,e.emitter])}const vi=()=>void 0;function yi(e,t){let n=_i(e);return $(n,`complete`,t||vi),[e=>{n.status===`running`&&(n.abort.abort(),n.emitter.emit(`abort`)),n.error&&(n.error=``);let t=gi();t.promise.then(()=>n.emitter.emit(`complete`)).catch(()=>n.emitter.emit(`error`)),n.status=`running`,n.request=e,n.promise=t.promise,n.resolve=t.resolve,n.reject=t.reject,n.emitter.emit(`running`)},n]}function bi(e,t){let n=_i(e);return $(n,`running`,t),[e=>{n.status===`running`&&(n.response=e,n.status=`complete`,n.resolve())},n,(e,t)=>{n.status===`running`&&(n.error=t||e,n.status=`error`,n.reject(e))}]}function xi({children:e}){return(0,u.jsx)(mi.Provider,{value:(0,l.useMemo)(()=>`id-${Date.now()}`,[]),children:e})}function Si(e){return!1}function Ci({as:e,reference:t,onReference:n,onLink:r,onAnalysis:i,onDropReference:a,onDropLink:o,onDropAnalysis:s,onPasteReference:c,onPasteLink:d,onPasteAnalysis:f,...p}){let m=e||`div`,h=a||n,g=c||n,_=d||r,v=f||i,y=(0,l.useMemo)(()=>t,[t?.id,t?.type]),ee=(0,l.useCallback)(function(e){e.defaultPrevented||(e.preventDefault(),e.clipboardData&&y&&y.id&&y.type&&e.clipboardData.setData(`application/json+vault`,JSON.stringify({id:y.id,type:y.type})))},[y]),b=(0,l.useCallback)(async function(e){if(!e.defaultPrevented&&(e.preventDefault(),e.clipboardData)){if(p.onLoading&&p.onLoading(),g){let t=e.clipboardData.getData(`application/json+vault`);if(t)try{let e=JSON.parse(t);e&&e.id&&e.type&&g(e)}catch{}}if(_||v){let t=e.clipboardData.getData(`text`);if(t.startsWith(`http`)){let e=t.split(`
|
|
988
|
+
`);for(let t of e){if(v)try{let e=await Si(t);if(e){v(e);continue}}catch{}_&&_(t)}}}p.onComplete&&p.onComplete()}},[]),x=(0,l.useCallback)(function(e){e.defaultPrevented||(e.preventDefault(),e.dataTransfer&&p.draggable&&(e.dataTransfer.effectAllowed=`all`,y&&y.id&&y.type&&e.dataTransfer.setData(`application/json+vault`,JSON.stringify({id:y.id,type:y.type}))))},[]);return(0,u.jsx)(m,{onCopy:ee,onPaste:b,onDrop:(0,l.useCallback)(async function(e){if(e.preventDefault(),e.dataTransfer){if(h){let t=e.dataTransfer.getData(`application/json+vault`);if(t)try{let n=JSON.parse(t);n&&n.id&&n.type&&h(n,e)}catch{return}}let t=e.dataTransfer.getData(`application/json`);if(t){JSON.parse(t);return}if(e.dataTransfer.getData(`text/plain`))return}},[]),onDragOver:(0,l.useCallback)(e=>{e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=`copy`)},[]),onDragStart:x,tabIndex:-1,...p})}exports.AppHeader=rt,exports.AppMenuProvider=st,exports.AppProvider=ue,exports.AppReactContext=ae,exports.AppResourceInstanceProvider=Ee,exports.AppResourceProvider=De,exports.AppStateReactContext=oe,exports.AtlasStoreProvider=p.AtlasStoreProvider,exports.AtlasStoreReactContext=p.AtlasStoreReactContext,exports.BaseAnnotationCreator=In,exports.BaseEditor=Nn,exports.BaseEditorBackButton=An,exports.BaseEditorCloseButton=jn,exports.ConfigEditor=Rn,exports.ConfigProvider=N,exports.ConfigReactContext=A,exports.ContextMenuProvider=Vn,exports.ContextMenuReactContext=Bn,exports.EditingStack=On,exports.EditingStackContext=W,exports.EventEmitterProvider=hr,exports.ExportPanel=fr,exports.HOMEPAGE_COLLECTION=an,exports.HandleContainer=Sr,exports.HandleControls=Dr,exports.InlineEditingStack=kn,exports.Layout=ei,exports.LayoutActionsReactContext=At,exports.LayoutStateReactContext=jt,exports.ModularPanel=$t,exports.ModularPanelHeader=Yt,exports.ModulePanelButton=U,exports.MultiAppProvider=me,exports.PanelError=Ft,exports.PreviewButton=nt,exports.PreviewProvider=Re,exports.PreviewVaultBoundary=cn,exports.PreviewVaultContext=sn,exports.PrimeAppReactContext=ie,exports.ReactEmitterContext=mr,exports.ResourceEditingProvider=ci,exports.ResourceEditingReactContext=ii,exports.SaveConfigReactContext=j,exports.ShellProvider=pi,exports.TaskBridge=xi,exports.UniversalCopyTarget=Ci,exports.analyse=pt,exports.analyseJson=ht,exports.baseCreator=pn,exports.baseEditor=Pn,exports.copyToClipboard=St,exports.createActionIdentity=xt,exports.createDownload=B,exports.createPreviewVault=en,exports.detectMedia=ft,exports.editBasedOnResource=Mn,exports.extendApp=Tt,exports.getDefaultLayoutState=ri,exports.getDefaultPanelState=X,exports.getFormat=vt,exports.getImageDimensions=yt,exports.getManifestNomalized=bt,exports.isPinnableState=It,exports.layoutReducer=ni,exports.mapApp=wt,exports.panelSizing=Lt,exports.polygonToBoundingBox=lt,exports.randomId=Ct,exports.renderHelper=Rt,exports.useAnnotationCreatorState=xr,exports.useAnnotationPageEditor=Tn,exports.useApp=P,exports.useAppInstance=se,exports.useAppMenu=at,exports.useAppMenuItem=ot,exports.useAppResource=I,exports.useAppResourceInstance=Te,exports.useAppState=ce,exports.useApps=fe,exports.useAtlasStore=ct,exports.useAvailableLayouts=Nt,exports.useCollectionEditor=Cn,exports.useConfig=M,exports.useCreatingResource=xn,exports.useCreator=ln,exports.useCustomContextMenu=Gn,exports.useDecayState=Ln,exports.useEditingContext=ai,exports.useEditingResource=yn,exports.useEditingResourceStack=bn,exports.useEditingStack=vn,exports.useEditor=En,exports.useEmitter=gr,exports.useEvent=_r,exports.useGenericEditor=wn,exports.useHighlightedImageResource=V,exports.useHoverHighlightImageResource=Dt,exports.useInlineCreator=un,exports.useLayoutActions=H,exports.useLayoutProvider=Pt,exports.useLayoutState=Mt,exports.useLocalStorage=c.useLocalStorage,exports.useManifestEditor=Sn,exports.useMatchMedia=vr,exports.useOptionalLocalStorage=c.useOptionalLocalStorage,exports.useOptionalResource=si,exports.usePanelActions=J,exports.usePreviewContext=Be,exports.usePreviewHistory=on,exports.usePreviewVault=tn,exports.usePreviews=ze,exports.useResource=oi,exports.useResourceContextMenuItems=Un,exports.useSaveConfig=re,exports.useSaveVault=yr,exports.useSetCustomTitle=qt,exports.useSvgTools=br,exports.useTask=_i,exports.useTaskDispatch=yi,exports.useTaskEvent=$,exports.useTaskRunner=bi,exports.useTemporaryHighlight=Et;
|
|
989
989
|
//# sourceMappingURL=index.cjs.map
|