react-iiif-vault 1.0.11 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle.d.ts +1059 -0
- package/dist/bundle.global.js +227 -0
- package/dist/canvas-panel.cjs +46 -0
- package/dist/canvas-panel.d.cts +11 -0
- package/dist/canvas-panel.d.ts +11 -0
- package/dist/canvas-panel.js +1 -0
- package/dist/chunk-DXFXJCXN.js +1 -0
- package/dist/chunk-VPKD2BBH.js +47 -0
- package/dist/index-BZirmhnp.d.cts +188 -0
- package/dist/index-Cxs6aAuK.d.ts +188 -0
- package/dist/index.cjs +47 -0
- package/dist/index.d.cts +722 -0
- package/dist/index.d.ts +722 -0
- package/dist/index.js +1 -0
- package/dist/useRenderingStrategy-Xj9yQm4y.d.cts +145 -0
- package/dist/useRenderingStrategy-Xj9yQm4y.d.ts +145 -0
- package/dist/utils.cjs +1 -0
- package/dist/utils.d.cts +32 -0
- package/dist/utils.d.ts +32 -0
- package/dist/utils.js +1 -0
- package/package.json +67 -70
- package/.build/types/canvas-panel/Viewer.d.ts +0 -14
- package/.build/types/canvas-panel/context/overlays.d.ts +0 -3
- package/.build/types/canvas-panel/context/world-size.d.ts +0 -2
- package/.build/types/canvas-panel/index.d.ts +0 -46
- package/.build/types/canvas-panel/render/Annotation.d.ts +0 -8
- package/.build/types/canvas-panel/render/AnnotationPage.d.ts +0 -7
- package/.build/types/canvas-panel/render/Audio.d.ts +0 -11
- package/.build/types/canvas-panel/render/Canvas.d.ts +0 -34
- package/.build/types/canvas-panel/render/CanvasBackground.d.ts +0 -4
- package/.build/types/canvas-panel/render/DefaultCanvasFallback.d.ts +0 -6
- package/.build/types/canvas-panel/render/Image.d.ts +0 -16
- package/.build/types/canvas-panel/render/Model.d.ts +0 -7
- package/.build/types/canvas-panel/render/Video.d.ts +0 -12
- package/.build/types/canvas-panel/render/VideoYouTube.d.ts +0 -12
- package/.build/types/components/CanvasAnnotations.d.ts +0 -10
- package/.build/types/components/CombinedMetadata.d.ts +0 -4
- package/.build/types/components/Image.d.ts +0 -15
- package/.build/types/components/ManifestMetadata.d.ts +0 -4
- package/.build/types/components/Metadata.d.ts +0 -39
- package/.build/types/components/SequenceThumbnails.d.ts +0 -29
- package/.build/types/components/SingleCanvasThumbnail.d.ts +0 -20
- package/.build/types/context/AnnotationContext.d.ts +0 -5
- package/.build/types/context/AnnotationPageContext.d.ts +0 -5
- package/.build/types/context/CanvasContext.d.ts +0 -5
- package/.build/types/context/CollectionContext.d.ts +0 -5
- package/.build/types/context/ContextBridge.d.ts +0 -14
- package/.build/types/context/ImageServiceLoaderContext.d.ts +0 -4
- package/.build/types/context/ManifestContext.d.ts +0 -5
- package/.build/types/context/MediaContext.d.ts +0 -17
- package/.build/types/context/RangeContext.d.ts +0 -5
- package/.build/types/context/ResourceContext.d.ts +0 -15
- package/.build/types/context/VaultContext.d.ts +0 -14
- package/.build/types/context/ViewerPresetContext.d.ts +0 -3
- package/.build/types/context/VisibleCanvasContext.d.ts +0 -4
- package/.build/types/demo/demo.d.ts +0 -1
- package/.build/types/demo/media-controls.d.ts +0 -1
- package/.build/types/demo/viewer-controls.d.ts +0 -1
- package/.build/types/features/rendering-strategy/3d-strategy.d.ts +0 -12
- package/.build/types/features/rendering-strategy/audio-strategy.d.ts +0 -3
- package/.build/types/features/rendering-strategy/get-rendering-strategy.d.ts +0 -11
- package/.build/types/features/rendering-strategy/image-strategy.d.ts +0 -12
- package/.build/types/features/rendering-strategy/rendering-utils.d.ts +0 -12
- package/.build/types/features/rendering-strategy/resource-types.d.ts +0 -55
- package/.build/types/features/rendering-strategy/strategies.d.ts +0 -31
- package/.build/types/features/rendering-strategy/textual-content-strategy.d.ts +0 -16
- package/.build/types/features/rendering-strategy/video-strategy.d.ts +0 -3
- package/.build/types/future-helpers/ranges.d.ts +0 -7
- package/.build/types/future-helpers/sequences.d.ts +0 -8
- package/.build/types/hooks/useAnnotation.d.ts +0 -8
- package/.build/types/hooks/useAnnotationPage.d.ts +0 -8
- package/.build/types/hooks/useAnnotationPageManager.d.ts +0 -10
- package/.build/types/hooks/useAnnotationsAtTime.d.ts +0 -4
- package/.build/types/hooks/useCanvas.d.ts +0 -8
- package/.build/types/hooks/useCanvasClock.d.ts +0 -1
- package/.build/types/hooks/useCanvasSelector.d.ts +0 -0
- package/.build/types/hooks/useCanvasSubset.d.ts +0 -2
- package/.build/types/hooks/useCanvasTimeline.d.ts +0 -0
- package/.build/types/hooks/useCollection.d.ts +0 -8
- package/.build/types/hooks/useDispatch.d.ts +0 -2
- package/.build/types/hooks/useEnabledAnnotationPageIds.d.ts +0 -1
- package/.build/types/hooks/useEventListener.d.ts +0 -4
- package/.build/types/hooks/useExistingVault.d.ts +0 -2
- package/.build/types/hooks/useExternalCollection.d.ts +0 -13
- package/.build/types/hooks/useExternalManifest.d.ts +0 -13
- package/.build/types/hooks/useExternalResource.d.ts +0 -16
- package/.build/types/hooks/useImage.d.ts +0 -10
- package/.build/types/hooks/useImageService.d.ts +0 -9
- package/.build/types/hooks/useImageTile.d.ts +0 -11
- package/.build/types/hooks/useLoadImageService.d.ts +0 -6
- package/.build/types/hooks/useManifest.d.ts +0 -8
- package/.build/types/hooks/usePaintables.d.ts +0 -9
- package/.build/types/hooks/usePaintingAnnotations.d.ts +0 -5
- package/.build/types/hooks/useRange.d.ts +0 -8
- package/.build/types/hooks/useRenderingStrategy.d.ts +0 -15
- package/.build/types/hooks/useResourceEvents.d.ts +0 -3
- package/.build/types/hooks/useResources.d.ts +0 -1
- package/.build/types/hooks/useSearchService.d.ts +0 -2
- package/.build/types/hooks/useSimpleMediaPlayer.d.ts +0 -32
- package/.build/types/hooks/useStyleHelper.d.ts +0 -1
- package/.build/types/hooks/useStyles.d.ts +0 -3
- package/.build/types/hooks/useThumbnail.d.ts +0 -5
- package/.build/types/hooks/useVault.d.ts +0 -2
- package/.build/types/hooks/useVaultEffect.d.ts +0 -2
- package/.build/types/hooks/useVaultSelector.d.ts +0 -2
- package/.build/types/hooks/useVirtualAnnotationPage.d.ts +0 -14
- package/.build/types/hooks/useVirtualAnnotationPageContext.d.ts +0 -671
- package/.build/types/hooks/useVirtualCanvas.d.ts +0 -0
- package/.build/types/index.d.ts +0 -72
- package/.build/types/utility/flatten-annotation-page-ids.d.ts +0 -7
- package/.build/types/utility/i18n-utils.d.ts +0 -30
- package/.build/types/utils.d.ts +0 -2
- package/.build/types/viewers/SimpleViewerContext.d.ts +0 -6
- package/.build/types/viewers/SimpleViewerContext.hooks.d.ts +0 -19
- package/.build/types/viewers/SimpleViewerContext.types.d.ts +0 -46
- package/.build/types/viewers/SingleCanvasContext.d.ts +0 -1
- package/dist/bundle/cjs/index.js +0 -49
- package/dist/bundle/cjs/index.js.map +0 -1
- package/dist/bundle/esm/index.mjs +0 -3319
- package/dist/bundle/esm/index.mjs.map +0 -1
- package/dist/canvas-panel/cjs/canvas-panel.js +0 -47
- package/dist/canvas-panel/cjs/canvas-panel.js.map +0 -1
- package/dist/canvas-panel/esm/canvas-panel.mjs +0 -1858
- package/dist/canvas-panel/esm/canvas-panel.mjs.map +0 -1
- package/dist/index.umd.js +0 -393
- package/dist/index.umd.js.map +0 -1
- package/dist/react17/cjs/index.js +0 -49
- package/dist/react17/cjs/index.js.map +0 -1
- package/dist/react17/esm/index.mjs +0 -3319
- package/dist/react17/esm/index.mjs.map +0 -1
- package/dist/utils/cjs/utils.js +0 -2
- package/dist/utils/cjs/utils.js.map +0 -1
- package/dist/utils/esm/utils.mjs +0 -238
- package/dist/utils/esm/utils.mjs.map +0 -1
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
"use strict";var ReactIIIFVault=(()=>{var bS=Object.create;var Ga=Object.defineProperty;var ES=Object.getOwnPropertyDescriptor;var CS=Object.getOwnPropertyNames;var PS=Object.getPrototypeOf,RS=Object.prototype.hasOwnProperty;var dt=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),TS=(e,t)=>{for(var r in t)Ga(e,r,{get:t[r],enumerable:!0})},nm=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of CS(t))!RS.call(e,o)&&o!==r&&Ga(e,o,{get:()=>t[o],enumerable:!(n=ES(t,o))||n.enumerable});return e};var T=(e,t,r)=>(r=e!=null?bS(PS(e)):{},nm(t||!e||!e.__esModule?Ga(r,"default",{value:e,enumerable:!0}):r,e)),IS=e=>nm(Ga({},"__esModule",{value:!0}),e);var q=dt((UE,sm)=>{"use strict";sm.exports=React});var ym=dt((qE,vm)=>{"use strict";var dm=!1,pn,rh,ih,Za,Ka,fm,Ja,nh,sh,oh,pm,ah,lh,mm,gm;function Kt(){if(!dm){dm=!0;var e=navigator.userAgent,t=/(?:MSIE.(\d+\.\d+))|(?:(?:Firefox|GranParadiso|Iceweasel).(\d+\.\d+))|(?:Opera(?:.+Version.|.)(\d+\.\d+))|(?:AppleWebKit.(\d+(?:\.\d+)?))|(?:Trident\/\d+\.\d+.*rv:(\d+\.\d+))/.exec(e),r=/(Mac OS X)|(Windows)|(Linux)/.exec(e);if(ah=/\b(iPhone|iP[ao]d)/.exec(e),lh=/\b(iP[ao]d)/.exec(e),oh=/Android/i.exec(e),mm=/FBAN\/\w+;/i.exec(e),gm=/Mobile/i.exec(e),pm=!!/Win64/.exec(e),t){pn=t[1]?parseFloat(t[1]):t[5]?parseFloat(t[5]):NaN,pn&&document&&document.documentMode&&(pn=document.documentMode);var n=/(?:Trident\/(\d+.\d+))/.exec(e);fm=n?parseFloat(n[1])+4:pn,rh=t[2]?parseFloat(t[2]):NaN,ih=t[3]?parseFloat(t[3]):NaN,Za=t[4]?parseFloat(t[4]):NaN,Za?(t=/(?:Chrome\/(\d+\.\d+))/.exec(e),Ka=t&&t[1]?parseFloat(t[1]):NaN):Ka=NaN}else pn=rh=ih=Ka=Za=NaN;if(r){if(r[1]){var o=/(?:Mac OS X (\d+(?:[._]\d+)?))/.exec(e);Ja=o?parseFloat(o[1].replace("_",".")):!0}else Ja=!1;nh=!!r[2],sh=!!r[3]}else Ja=nh=sh=!1}}var uh={ie:function(){return Kt()||pn},ieCompatibilityMode:function(){return Kt()||fm>pn},ie64:function(){return uh.ie()&&pm},firefox:function(){return Kt()||rh},opera:function(){return Kt()||ih},webkit:function(){return Kt()||Za},safari:function(){return uh.webkit()},chrome:function(){return Kt()||Ka},windows:function(){return Kt()||nh},osx:function(){return Kt()||Ja},linux:function(){return Kt()||sh},iphone:function(){return Kt()||ah},mobile:function(){return Kt()||ah||lh||oh||gm},nativeApp:function(){return Kt()||mm},android:function(){return Kt()||oh},ipad:function(){return Kt()||lh}};vm.exports=uh});var Sm=dt((QE,xm)=>{"use strict";var el=!!(typeof window<"u"&&window.document&&window.document.createElement),LS={canUseDOM:el,canUseWorkers:typeof Worker<"u",canUseEventListeners:el&&!!(window.addEventListener||window.attachEvent),canUseViewport:el&&!!window.screen,isInWorker:!el};xm.exports=LS});var Em=dt((YE,bm)=>{"use strict";var wm=Sm(),Am;wm.canUseDOM&&(Am=document.implementation&&document.implementation.hasFeature&&document.implementation.hasFeature("","")!==!0);function zS(e,t){if(!wm.canUseDOM||t&&!("addEventListener"in document))return!1;var r="on"+e,n=r in document;if(!n){var o=document.createElement("div");o.setAttribute(r,"return;"),n=typeof o[r]=="function"}return!n&&Am&&e==="wheel"&&(n=document.implementation.hasFeature("Events.wheel","3.0")),n}bm.exports=zS});var _m=dt((GE,Im)=>{"use strict";var NS=ym(),FS=Em(),Cm=10,Pm=40,Rm=800;function Tm(e){var t=0,r=0,n=0,o=0;return"detail"in e&&(r=e.detail),"wheelDelta"in e&&(r=-e.wheelDelta/120),"wheelDeltaY"in e&&(r=-e.wheelDeltaY/120),"wheelDeltaX"in e&&(t=-e.wheelDeltaX/120),"axis"in e&&e.axis===e.HORIZONTAL_AXIS&&(t=r,r=0),n=t*Cm,o=r*Cm,"deltaY"in e&&(o=e.deltaY),"deltaX"in e&&(n=e.deltaX),(n||o)&&e.deltaMode&&(e.deltaMode==1?(n*=Pm,o*=Pm):(n*=Rm,o*=Rm)),n&&!t&&(t=n<1?-1:1),o&&!r&&(r=o<1?-1:1),{spinX:t,spinY:r,pixelX:n,pixelY:o}}Tm.getEventType=function(){return NS.firefox()?"DOMMouseScroll":FS("wheel")?"wheel":"mousewheel"};Im.exports=Tm});var Mm=dt((XE,Om)=>{"use strict";Om.exports=_m()});var Lm=dt(tl=>{"use strict";var DS=q(),jS=Symbol.for("react.element"),US=Symbol.for("react.fragment"),BS=Object.prototype.hasOwnProperty,VS=DS.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,WS={key:!0,ref:!0,__self:!0,__source:!0};function km(e,t,r){var n,o={},a=null,u=null;r!==void 0&&(a=""+r),t.key!==void 0&&(a=""+t.key),t.ref!==void 0&&(u=t.ref);for(n in t)BS.call(t,n)&&!WS.hasOwnProperty(n)&&(o[n]=t[n]);if(e&&e.defaultProps)for(n in t=e.defaultProps,t)o[n]===void 0&&(o[n]=t[n]);return{$$typeof:jS,type:e,key:a,ref:u,props:o,_owner:VS.current}}tl.Fragment=US;tl.jsx=km;tl.jsxs=km});var G=dt((ZE,zm)=>{"use strict";zm.exports=Lm()});var Fm=dt((KE,Nm)=>{"use strict";function ch(e,t,r){var n,o,a,u,h;t==null&&(t=100);function f(){var p=Date.now()-u;p<t&&p>=0?n=setTimeout(f,t-p):(n=null,r||(h=e.apply(a,o),a=o=null))}var g=function(){a=this,o=arguments,u=Date.now();var p=r&&!n;return n||(n=setTimeout(f,t)),p&&(h=e.apply(a,o),a=o=null),h};return g.clear=function(){n&&(clearTimeout(n),n=null)},g.flush=function(){n&&(h=e.apply(a,o),a=o=null,clearTimeout(n),n=null)},g}ch.debounce=ch;Nm.exports=ch});var Gm=dt(Ue=>{"use strict";function mh(e,t){var r=e.length;e.push(t);e:for(;0<r;){var n=r-1>>>1,o=e[n];if(0<il(o,t))e[n]=t,e[r]=o,r=n;else break e}}function zr(e){return e.length===0?null:e[0]}function sl(e){if(e.length===0)return null;var t=e[0],r=e.pop();if(r!==t){e[0]=r;e:for(var n=0,o=e.length,a=o>>>1;n<a;){var u=2*(n+1)-1,h=e[u],f=u+1,g=e[f];if(0>il(h,r))f<o&&0>il(g,h)?(e[n]=g,e[f]=r,n=f):(e[n]=h,e[u]=r,n=u);else if(f<o&&0>il(g,r))e[n]=g,e[f]=r,n=f;else break e}}return t}function il(e,t){var r=e.sortIndex-t.sortIndex;return r!==0?r:e.id-t.id}typeof performance=="object"&&typeof performance.now=="function"?(jm=performance,Ue.unstable_now=function(){return jm.now()}):(dh=Date,Um=dh.now(),Ue.unstable_now=function(){return dh.now()-Um});var jm,dh,Um,Jr=[],Di=[],GS=1,Ar=null,Nt=3,ol=!1,mn=!1,uo=!1,Wm=typeof setTimeout=="function"?setTimeout:null,Hm=typeof clearTimeout=="function"?clearTimeout:null,Bm=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function gh(e){for(var t=zr(Di);t!==null;){if(t.callback===null)sl(Di);else if(t.startTime<=e)sl(Di),t.sortIndex=t.expirationTime,mh(Jr,t);else break;t=zr(Di)}}function vh(e){if(uo=!1,gh(e),!mn)if(zr(Jr)!==null)mn=!0,xh(yh);else{var t=zr(Di);t!==null&&Sh(vh,t.startTime-e)}}function yh(e,t){mn=!1,uo&&(uo=!1,Hm(co),co=-1),ol=!0;var r=Nt;try{for(gh(t),Ar=zr(Jr);Ar!==null&&(!(Ar.expirationTime>t)||e&&!Ym());){var n=Ar.callback;if(typeof n=="function"){Ar.callback=null,Nt=Ar.priorityLevel;var o=n(Ar.expirationTime<=t);t=Ue.unstable_now(),typeof o=="function"?Ar.callback=o:Ar===zr(Jr)&&sl(Jr),gh(t)}else sl(Jr);Ar=zr(Jr)}if(Ar!==null)var a=!0;else{var u=zr(Di);u!==null&&Sh(vh,u.startTime-t),a=!1}return a}finally{Ar=null,Nt=r,ol=!1}}var al=!1,nl=null,co=-1,qm=5,Qm=-1;function Ym(){return!(Ue.unstable_now()-Qm<qm)}function fh(){if(nl!==null){var e=Ue.unstable_now();Qm=e;var t=!0;try{t=nl(!0,e)}finally{t?lo():(al=!1,nl=null)}}else al=!1}var lo;typeof Bm=="function"?lo=function(){Bm(fh)}:typeof MessageChannel<"u"?(ph=new MessageChannel,Vm=ph.port2,ph.port1.onmessage=fh,lo=function(){Vm.postMessage(null)}):lo=function(){Wm(fh,0)};var ph,Vm;function xh(e){nl=e,al||(al=!0,lo())}function Sh(e,t){co=Wm(function(){e(Ue.unstable_now())},t)}Ue.unstable_IdlePriority=5;Ue.unstable_ImmediatePriority=1;Ue.unstable_LowPriority=4;Ue.unstable_NormalPriority=3;Ue.unstable_Profiling=null;Ue.unstable_UserBlockingPriority=2;Ue.unstable_cancelCallback=function(e){e.callback=null};Ue.unstable_continueExecution=function(){mn||ol||(mn=!0,xh(yh))};Ue.unstable_forceFrameRate=function(e){0>e||125<e?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):qm=0<e?Math.floor(1e3/e):5};Ue.unstable_getCurrentPriorityLevel=function(){return Nt};Ue.unstable_getFirstCallbackNode=function(){return zr(Jr)};Ue.unstable_next=function(e){switch(Nt){case 1:case 2:case 3:var t=3;break;default:t=Nt}var r=Nt;Nt=t;try{return e()}finally{Nt=r}};Ue.unstable_pauseExecution=function(){};Ue.unstable_requestPaint=function(){};Ue.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var r=Nt;Nt=e;try{return t()}finally{Nt=r}};Ue.unstable_scheduleCallback=function(e,t,r){var n=Ue.unstable_now();switch(typeof r=="object"&&r!==null?(r=r.delay,r=typeof r=="number"&&0<r?n+r:n):r=n,e){case 1:var o=-1;break;case 2:o=250;break;case 5:o=1073741823;break;case 4:o=1e4;break;default:o=5e3}return o=r+o,e={id:GS++,callback:t,priorityLevel:e,startTime:r,expirationTime:o,sortIndex:-1},r>n?(e.sortIndex=r,mh(Di,e),zr(Jr)===null&&e===zr(Di)&&(uo?(Hm(co),co=-1):uo=!0,Sh(vh,r-n))):(e.sortIndex=o,mh(Jr,e),mn||ol||(mn=!0,xh(yh))),e};Ue.unstable_shouldYield=Ym;Ue.unstable_wrapCallback=function(e){var t=Nt;return function(){var r=Nt;Nt=t;try{return e.apply(this,arguments)}finally{Nt=r}}}});var $m=dt((rC,Xm)=>{"use strict";Xm.exports=Gm()});var Km=dt((iC,Zm)=>{"use strict";Zm.exports=function(t){var r={},n=q(),o=$m(),a=Object.assign;function u(i){for(var s="https://reactjs.org/docs/error-decoder.html?invariant="+i,l=1;l<arguments.length;l++)s+="&args[]="+encodeURIComponent(arguments[l]);return"Minified React error #"+i+"; visit "+s+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var h=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,f=Symbol.for("react.element"),g=Symbol.for("react.portal"),p=Symbol.for("react.fragment"),v=Symbol.for("react.strict_mode"),x=Symbol.for("react.profiler"),b=Symbol.for("react.provider"),w=Symbol.for("react.context"),A=Symbol.for("react.forward_ref"),E=Symbol.for("react.suspense"),P=Symbol.for("react.suspense_list"),I=Symbol.for("react.memo"),F=Symbol.for("react.lazy");Symbol.for("react.scope"),Symbol.for("react.debug_trace_mode");var X=Symbol.for("react.offscreen");Symbol.for("react.legacy_hidden"),Symbol.for("react.cache"),Symbol.for("react.tracing_marker");var W=Symbol.iterator;function L(i){return i===null||typeof i!="object"?null:(i=W&&i[W]||i["@@iterator"],typeof i=="function"?i:null)}function N(i){if(i==null)return null;if(typeof i=="function")return i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case p:return"Fragment";case g:return"Portal";case x:return"Profiler";case v:return"StrictMode";case E:return"Suspense";case P:return"SuspenseList"}if(typeof i=="object")switch(i.$$typeof){case w:return(i.displayName||"Context")+".Consumer";case b:return(i._context.displayName||"Context")+".Provider";case A:var s=i.render;return i=i.displayName,i||(i=s.displayName||s.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case I:return s=i.displayName||null,s!==null?s:N(i.type)||"Memo";case F:s=i._payload,i=i._init;try{return N(i(s))}catch{}}return null}function D(i){var s=i.type;switch(i.tag){case 24:return"Cache";case 9:return(s.displayName||"Context")+".Consumer";case 10:return(s._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return i=s.render,i=i.displayName||i.name||"",s.displayName||(i!==""?"ForwardRef("+i+")":"ForwardRef");case 7:return"Fragment";case 5:return s;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return N(s);case 8:return s===v?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof s=="function")return s.displayName||s.name||null;if(typeof s=="string")return s}return null}function j(i){var s=i,l=i;if(i.alternate)for(;s.return;)s=s.return;else{i=s;do s=i,s.flags&4098&&(l=s.return),i=s.return;while(i)}return s.tag===3?l:null}function se(i){if(j(i)!==i)throw Error(u(188))}function ee(i){var s=i.alternate;if(!s){if(s=j(i),s===null)throw Error(u(188));return s!==i?null:i}for(var l=i,c=s;;){var d=l.return;if(d===null)break;var m=d.alternate;if(m===null){if(c=d.return,c!==null){l=c;continue}break}if(d.child===m.child){for(m=d.child;m;){if(m===l)return se(d),i;if(m===c)return se(d),s;m=m.sibling}throw Error(u(188))}if(l.return!==c.return)l=d,c=m;else{for(var y=!1,C=d.child;C;){if(C===l){y=!0,l=d,c=m;break}if(C===c){y=!0,c=d,l=m;break}C=C.sibling}if(!y){for(C=m.child;C;){if(C===l){y=!0,l=m,c=d;break}if(C===c){y=!0,c=m,l=d;break}C=C.sibling}if(!y)throw Error(u(189))}}if(l.alternate!==c)throw Error(u(190))}if(l.tag!==3)throw Error(u(188));return l.stateNode.current===l?i:s}function he(i){return i=ee(i),i!==null?Ae(i):null}function Ae(i){if(i.tag===5||i.tag===6)return i;for(i=i.child;i!==null;){var s=Ae(i);if(s!==null)return s;i=i.sibling}return null}function Re(i){if(i.tag===5||i.tag===6)return i;for(i=i.child;i!==null;){if(i.tag!==4){var s=Re(i);if(s!==null)return s}i=i.sibling}return null}var Te=Array.isArray,ge=t.getPublicInstance,lt=t.getRootHostContext,ce=t.getChildHostContext,st=t.prepareForCommit,Pe=t.resetAfterCommit,V=t.createInstance,fe=t.appendInitialChild,De=t.finalizeInitialChildren,Xe=t.prepareUpdate,$e=t.shouldSetTextContent,Pr=t.createTextInstance,Br=t.scheduleTimeout,Dt=t.cancelTimeout,li=t.noTimeout,nr=t.isPrimaryRenderer,Ie=t.supportsMutation,Ze=t.supportsPersistence,$=t.supportsHydration,Ee=t.getInstanceFromNode,Ce=t.preparePortalMount,ui=t.getCurrentEventPriority,Vr=t.detachDeletedInstance,sr=t.supportsMicrotasks,Rr=t.scheduleMicrotask,Wr=t.supportsTestSelectors,Nu=t.findFiberRoot,ea=t.getBoundingRect,js=t.getTextContent,Hr=t.isHiddenSubtree,Us=t.matchAccessibilityRole,Fu=t.setFocusIfFocusable,B=t.setupIntersectionObserver,_=t.appendChild,H=t.appendChildToContainer,Q=t.commitTextUpdate,ve=t.commitMount,xe=t.commitUpdate,Le=t.insertBefore,z=t.insertInContainerBefore,U=t.removeChild,oe=t.removeChildFromContainer,te=t.resetTextContent,re=t.hideInstance,Se=t.hideTextInstance,Be=t.unhideInstance,Ve=t.unhideTextInstance,Ne=t.clearContainer,yt=t.cloneInstance,Ke=t.createContainerChildSet,xt=t.appendChildToContainerChildSet,Ci=t.finalizeContainerChildren,Tr=t.replaceContainerChildren,rn=t.cloneHiddenInstance,Bs=t.cloneHiddenTextInstance,ta=t.canHydrateInstance,fx=t.canHydrateTextInstance,px=t.canHydrateSuspenseInstance,wf=t.isSuspenseInstancePending,Du=t.isSuspenseInstanceFallback,mx=t.getSuspenseInstanceFallbackErrorDetails,gx=t.registerSuspenseInstanceRetry,ra=t.getNextHydratableSibling,vx=t.getFirstHydratableChild,yx=t.getFirstHydratableChildWithinContainer,xx=t.getFirstHydratableChildWithinSuspenseInstance,Sx=t.hydrateInstance,wx=t.hydrateTextInstance,Ax=t.hydrateSuspenseInstance,bx=t.getNextHydratableInstanceAfterSuspenseInstance,Ex=t.commitHydratedContainer,Cx=t.commitHydratedSuspenseInstance,Px=t.clearSuspenseBoundary,Rx=t.clearSuspenseBoundaryFromContainer,Tx=t.shouldDeleteUnhydratedTailInstances,Ix=t.didNotMatchHydratedContainerTextInstance,_x=t.didNotMatchHydratedTextInstance,ju;function Vs(i){if(ju===void 0)try{throw Error()}catch(l){var s=l.stack.trim().match(/\n( *(at )?)/);ju=s&&s[1]||""}return`
|
|
2
|
+
`+ju+i}var Uu=!1;function Bu(i,s){if(!i||Uu)return"";Uu=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(s)if(s=function(){throw Error()},Object.defineProperty(s.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(s,[])}catch(Y){var c=Y}Reflect.construct(i,[],s)}else{try{s.call()}catch(Y){c=Y}i.call(s.prototype)}else{try{throw Error()}catch(Y){c=Y}i()}}catch(Y){if(Y&&c&&typeof Y.stack=="string"){for(var d=Y.stack.split(`
|
|
3
|
+
`),m=c.stack.split(`
|
|
4
|
+
`),y=d.length-1,C=m.length-1;1<=y&&0<=C&&d[y]!==m[C];)C--;for(;1<=y&&0<=C;y--,C--)if(d[y]!==m[C]){if(y!==1||C!==1)do if(y--,C--,0>C||d[y]!==m[C]){var M=`
|
|
5
|
+
`+d[y].replace(" at new "," at ");return i.displayName&&M.includes("<anonymous>")&&(M=M.replace("<anonymous>",i.displayName)),M}while(1<=y&&0<=C);break}}}finally{Uu=!1,Error.prepareStackTrace=l}return(i=i?i.displayName||i.name:"")?Vs(i):""}var Ox=Object.prototype.hasOwnProperty,Vu=[],qn=-1;function Pi(i){return{current:i}}function We(i){0>qn||(i.current=Vu[qn],Vu[qn]=null,qn--)}function je(i,s){qn++,Vu[qn]=i.current,i.current=s}var Ri={},Ot=Pi(Ri),qt=Pi(!1),nn=Ri;function Qn(i,s){var l=i.type.contextTypes;if(!l)return Ri;var c=i.stateNode;if(c&&c.__reactInternalMemoizedUnmaskedChildContext===s)return c.__reactInternalMemoizedMaskedChildContext;var d={},m;for(m in l)d[m]=s[m];return c&&(i=i.stateNode,i.__reactInternalMemoizedUnmaskedChildContext=s,i.__reactInternalMemoizedMaskedChildContext=d),d}function Qt(i){return i=i.childContextTypes,i!=null}function ia(){We(qt),We(Ot)}function Af(i,s,l){if(Ot.current!==Ri)throw Error(u(168));je(Ot,s),je(qt,l)}function bf(i,s,l){var c=i.stateNode;if(s=s.childContextTypes,typeof c.getChildContext!="function")return l;c=c.getChildContext();for(var d in c)if(!(d in s))throw Error(u(108,D(i)||"Unknown",d));return a({},l,c)}function na(i){return i=(i=i.stateNode)&&i.__reactInternalMemoizedMergedChildContext||Ri,nn=Ot.current,je(Ot,i),je(qt,qt.current),!0}function Ef(i,s,l){var c=i.stateNode;if(!c)throw Error(u(169));l?(i=bf(i,s,nn),c.__reactInternalMemoizedMergedChildContext=i,We(qt),We(Ot),je(Ot,i)):We(qt),je(qt,l)}var Ir=Math.clz32?Math.clz32:Lx,Mx=Math.log,kx=Math.LN2;function Lx(i){return i>>>=0,i===0?32:31-(Mx(i)/kx|0)|0}var sa=64,oa=4194304;function Ws(i){switch(i&-i){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return i&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return i&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return i}}function aa(i,s){var l=i.pendingLanes;if(l===0)return 0;var c=0,d=i.suspendedLanes,m=i.pingedLanes,y=l&268435455;if(y!==0){var C=y&~d;C!==0?c=Ws(C):(m&=y,m!==0&&(c=Ws(m)))}else y=l&~d,y!==0?c=Ws(y):m!==0&&(c=Ws(m));if(c===0)return 0;if(s!==0&&s!==c&&!(s&d)&&(d=c&-c,m=s&-s,d>=m||d===16&&(m&4194240)!==0))return s;if(c&4&&(c|=l&16),s=i.entangledLanes,s!==0)for(i=i.entanglements,s&=c;0<s;)l=31-Ir(s),d=1<<l,c|=i[l],s&=~d;return c}function zx(i,s){switch(i){case 1:case 2:case 4:return s+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return s+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Nx(i,s){for(var l=i.suspendedLanes,c=i.pingedLanes,d=i.expirationTimes,m=i.pendingLanes;0<m;){var y=31-Ir(m),C=1<<y,M=d[y];M===-1?(!(C&l)||C&c)&&(d[y]=zx(C,s)):M<=s&&(i.expiredLanes|=C),m&=~C}}function Wu(i){return i=i.pendingLanes&-1073741825,i!==0?i:i&1073741824?1073741824:0}function Cf(){var i=sa;return sa<<=1,!(sa&4194240)&&(sa=64),i}function Hu(i){for(var s=[],l=0;31>l;l++)s.push(i);return s}function Hs(i,s,l){i.pendingLanes|=s,s!==536870912&&(i.suspendedLanes=0,i.pingedLanes=0),i=i.eventTimes,s=31-Ir(s),i[s]=l}function Fx(i,s){var l=i.pendingLanes&~s;i.pendingLanes=s,i.suspendedLanes=0,i.pingedLanes=0,i.expiredLanes&=s,i.mutableReadLanes&=s,i.entangledLanes&=s,s=i.entanglements;var c=i.eventTimes;for(i=i.expirationTimes;0<l;){var d=31-Ir(l),m=1<<d;s[d]=0,c[d]=-1,i[d]=-1,l&=~m}}function qu(i,s){var l=i.entangledLanes|=s;for(i=i.entanglements;l;){var c=31-Ir(l),d=1<<c;d&s|i[c]&s&&(i[c]|=s),l&=~d}}var _e=0;function Pf(i){return i&=-i,1<i?4<i?i&268435455?16:536870912:4:1}var Qu=o.unstable_scheduleCallback,Rf=o.unstable_cancelCallback,Dx=o.unstable_shouldYield,jx=o.unstable_requestPaint,Et=o.unstable_now,Yu=o.unstable_ImmediatePriority,Ux=o.unstable_UserBlockingPriority,Gu=o.unstable_NormalPriority,Bx=o.unstable_IdlePriority,la=null,qr=null;function Vx(i){if(qr&&typeof qr.onCommitFiberRoot=="function")try{qr.onCommitFiberRoot(la,i,void 0,(i.current.flags&128)===128)}catch{}}function Wx(i,s){return i===s&&(i!==0||1/i===1/s)||i!==i&&s!==s}var _r=typeof Object.is=="function"?Object.is:Wx,ci=null,ua=!1,Xu=!1;function Tf(i){ci===null?ci=[i]:ci.push(i)}function Hx(i){ua=!0,Tf(i)}function Qr(){if(!Xu&&ci!==null){Xu=!0;var i=0,s=_e;try{var l=ci;for(_e=1;i<l.length;i++){var c=l[i];do c=c(!0);while(c!==null)}ci=null,ua=!1}catch(d){throw ci!==null&&(ci=ci.slice(i+1)),Qu(Yu,Qr),d}finally{_e=s,Xu=!1}}return null}var Yn=[],Gn=0,ca=null,ha=0,pr=[],mr=0,sn=null,hi=1,di="";function on(i,s){Yn[Gn++]=ha,Yn[Gn++]=ca,ca=i,ha=s}function If(i,s,l){pr[mr++]=hi,pr[mr++]=di,pr[mr++]=sn,sn=i;var c=hi;i=di;var d=32-Ir(c)-1;c&=~(1<<d),l+=1;var m=32-Ir(s)+d;if(30<m){var y=d-d%5;m=(c&(1<<y)-1).toString(32),c>>=y,d-=y,hi=1<<32-Ir(s)+d|l<<d|c,di=m+i}else hi=1<<m|l<<d|c,di=i}function $u(i){i.return!==null&&(on(i,1),If(i,1,0))}function Zu(i){for(;i===ca;)ca=Yn[--Gn],Yn[Gn]=null,ha=Yn[--Gn],Yn[Gn]=null;for(;i===sn;)sn=pr[--mr],pr[mr]=null,di=pr[--mr],pr[mr]=null,hi=pr[--mr],pr[mr]=null}var or=null,gr=null,Qe=!1,qs=!1,Or=null;function _f(i,s){var l=wr(5,null,null,0);l.elementType="DELETED",l.stateNode=s,l.return=i,s=i.deletions,s===null?(i.deletions=[l],i.flags|=16):s.push(l)}function Of(i,s){switch(i.tag){case 5:return s=ta(s,i.type,i.pendingProps),s!==null?(i.stateNode=s,or=i,gr=vx(s),!0):!1;case 6:return s=fx(s,i.pendingProps),s!==null?(i.stateNode=s,or=i,gr=null,!0):!1;case 13:if(s=px(s),s!==null){var l=sn!==null?{id:hi,overflow:di}:null;return i.memoizedState={dehydrated:s,treeContext:l,retryLane:1073741824},l=wr(18,null,null,0),l.stateNode=s,l.return=i,i.child=l,or=i,gr=null,!0}return!1;default:return!1}}function Ku(i){return(i.mode&1)!==0&&(i.flags&128)===0}function Ju(i){if(Qe){var s=gr;if(s){var l=s;if(!Of(i,s)){if(Ku(i))throw Error(u(418));s=ra(l);var c=or;s&&Of(i,s)?_f(c,l):(i.flags=i.flags&-4097|2,Qe=!1,or=i)}}else{if(Ku(i))throw Error(u(418));i.flags=i.flags&-4097|2,Qe=!1,or=i}}}function Mf(i){for(i=i.return;i!==null&&i.tag!==5&&i.tag!==3&&i.tag!==13;)i=i.return;or=i}function da(i){if(!$||i!==or)return!1;if(!Qe)return Mf(i),Qe=!0,!1;if(i.tag!==3&&(i.tag!==5||Tx(i.type)&&!$e(i.type,i.memoizedProps))){var s=gr;if(s){if(Ku(i))throw kf(),Error(u(418));for(;s;)_f(i,s),s=ra(s)}}if(Mf(i),i.tag===13){if(!$)throw Error(u(316));if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(u(317));gr=bx(i)}else gr=or?ra(i.stateNode):null;return!0}function kf(){for(var i=gr;i;)i=ra(i)}function Xn(){$&&(gr=or=null,qs=Qe=!1)}function ec(i){Or===null?Or=[i]:Or.push(i)}var qx=h.ReactCurrentBatchConfig;function fa(i,s){if(_r(i,s))return!0;if(typeof i!="object"||i===null||typeof s!="object"||s===null)return!1;var l=Object.keys(i),c=Object.keys(s);if(l.length!==c.length)return!1;for(c=0;c<l.length;c++){var d=l[c];if(!Ox.call(s,d)||!_r(i[d],s[d]))return!1}return!0}function Qx(i){switch(i.tag){case 5:return Vs(i.type);case 16:return Vs("Lazy");case 13:return Vs("Suspense");case 19:return Vs("SuspenseList");case 0:case 2:case 15:return i=Bu(i.type,!1),i;case 11:return i=Bu(i.type.render,!1),i;case 1:return i=Bu(i.type,!0),i;default:return""}}function Mr(i,s){if(i&&i.defaultProps){s=a({},s),i=i.defaultProps;for(var l in i)s[l]===void 0&&(s[l]=i[l]);return s}return s}var pa=Pi(null),ma=null,$n=null,tc=null;function rc(){tc=$n=ma=null}function Lf(i,s,l){nr?(je(pa,s._currentValue),s._currentValue=l):(je(pa,s._currentValue2),s._currentValue2=l)}function ic(i){var s=pa.current;We(pa),nr?i._currentValue=s:i._currentValue2=s}function nc(i,s,l){for(;i!==null;){var c=i.alternate;if((i.childLanes&s)!==s?(i.childLanes|=s,c!==null&&(c.childLanes|=s)):c!==null&&(c.childLanes&s)!==s&&(c.childLanes|=s),i===l)break;i=i.return}}function Zn(i,s){ma=i,tc=$n=null,i=i.dependencies,i!==null&&i.firstContext!==null&&(i.lanes&s&&(Yt=!0),i.firstContext=null)}function vr(i){var s=nr?i._currentValue:i._currentValue2;if(tc!==i)if(i={context:i,memoizedValue:s,next:null},$n===null){if(ma===null)throw Error(u(308));$n=i,ma.dependencies={lanes:0,firstContext:i}}else $n=$n.next=i;return s}var an=null;function sc(i){an===null?an=[i]:an.push(i)}function zf(i,s,l,c){var d=s.interleaved;return d===null?(l.next=l,sc(s)):(l.next=d.next,d.next=l),s.interleaved=l,Yr(i,c)}function Yr(i,s){i.lanes|=s;var l=i.alternate;for(l!==null&&(l.lanes|=s),l=i,i=i.return;i!==null;)i.childLanes|=s,l=i.alternate,l!==null&&(l.childLanes|=s),l=i,i=i.return;return l.tag===3?l.stateNode:null}var Ti=!1;function oc(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Nf(i,s){i=i.updateQueue,s.updateQueue===i&&(s.updateQueue={baseState:i.baseState,firstBaseUpdate:i.firstBaseUpdate,lastBaseUpdate:i.lastBaseUpdate,shared:i.shared,effects:i.effects})}function fi(i,s){return{eventTime:i,lane:s,tag:0,payload:null,callback:null,next:null}}function Ii(i,s,l){var c=i.updateQueue;if(c===null)return null;if(c=c.shared,we&2){var d=c.pending;return d===null?s.next=s:(s.next=d.next,d.next=s),c.pending=s,Yr(i,l)}return d=c.interleaved,d===null?(s.next=s,sc(c)):(s.next=d.next,d.next=s),c.interleaved=s,Yr(i,l)}function ga(i,s,l){if(s=s.updateQueue,s!==null&&(s=s.shared,(l&4194240)!==0)){var c=s.lanes;c&=i.pendingLanes,l|=c,s.lanes=l,qu(i,l)}}function Ff(i,s){var l=i.updateQueue,c=i.alternate;if(c!==null&&(c=c.updateQueue,l===c)){var d=null,m=null;if(l=l.firstBaseUpdate,l!==null){do{var y={eventTime:l.eventTime,lane:l.lane,tag:l.tag,payload:l.payload,callback:l.callback,next:null};m===null?d=m=y:m=m.next=y,l=l.next}while(l!==null);m===null?d=m=s:m=m.next=s}else d=m=s;l={baseState:c.baseState,firstBaseUpdate:d,lastBaseUpdate:m,shared:c.shared,effects:c.effects},i.updateQueue=l;return}i=l.lastBaseUpdate,i===null?l.firstBaseUpdate=s:i.next=s,l.lastBaseUpdate=s}function va(i,s,l,c){var d=i.updateQueue;Ti=!1;var m=d.firstBaseUpdate,y=d.lastBaseUpdate,C=d.shared.pending;if(C!==null){d.shared.pending=null;var M=C,Y=M.next;M.next=null,y===null?m=Y:y.next=Y,y=M;var ne=i.alternate;ne!==null&&(ne=ne.updateQueue,C=ne.lastBaseUpdate,C!==y&&(C===null?ne.firstBaseUpdate=Y:C.next=Y,ne.lastBaseUpdate=M))}if(m!==null){var pe=d.baseState;y=0,ne=Y=M=null,C=m;do{var Z=C.lane,He=C.eventTime;if((c&Z)===Z){ne!==null&&(ne=ne.next={eventTime:He,lane:0,tag:C.tag,payload:C.payload,callback:C.callback,next:null});e:{var Fe=i,$t=C;switch(Z=s,He=l,$t.tag){case 1:if(Fe=$t.payload,typeof Fe=="function"){pe=Fe.call(He,pe,Z);break e}pe=Fe;break e;case 3:Fe.flags=Fe.flags&-65537|128;case 0:if(Fe=$t.payload,Z=typeof Fe=="function"?Fe.call(He,pe,Z):Fe,Z==null)break e;pe=a({},pe,Z);break e;case 2:Ti=!0}}C.callback!==null&&C.lane!==0&&(i.flags|=64,Z=d.effects,Z===null?d.effects=[C]:Z.push(C))}else He={eventTime:He,lane:Z,tag:C.tag,payload:C.payload,callback:C.callback,next:null},ne===null?(Y=ne=He,M=pe):ne=ne.next=He,y|=Z;if(C=C.next,C===null){if(C=d.shared.pending,C===null)break;Z=C,C=Z.next,Z.next=null,d.lastBaseUpdate=Z,d.shared.pending=null}}while(!0);if(ne===null&&(M=pe),d.baseState=M,d.firstBaseUpdate=Y,d.lastBaseUpdate=ne,s=d.shared.interleaved,s!==null){d=s;do y|=d.lane,d=d.next;while(d!==s)}else m===null&&(d.shared.lanes=0);un|=y,i.lanes=y,i.memoizedState=pe}}function Df(i,s,l){if(i=s.effects,s.effects=null,i!==null)for(s=0;s<i.length;s++){var c=i[s],d=c.callback;if(d!==null){if(c.callback=null,c=l,typeof d!="function")throw Error(u(191,d));d.call(c)}}}var jf=new n.Component().refs;function ac(i,s,l,c){s=i.memoizedState,l=l(c,s),l=l==null?s:a({},s,l),i.memoizedState=l,i.lanes===0&&(i.updateQueue.baseState=l)}var ya={isMounted:function(i){return(i=i._reactInternals)?j(i)===i:!1},enqueueSetState:function(i,s,l){i=i._reactInternals;var c=zt(),d=Mi(i),m=fi(c,d);m.payload=s,l!=null&&(m.callback=l),s=Ii(i,m,d),s!==null&&(Sr(s,i,d,c),ga(s,i,d))},enqueueReplaceState:function(i,s,l){i=i._reactInternals;var c=zt(),d=Mi(i),m=fi(c,d);m.tag=1,m.payload=s,l!=null&&(m.callback=l),s=Ii(i,m,d),s!==null&&(Sr(s,i,d,c),ga(s,i,d))},enqueueForceUpdate:function(i,s){i=i._reactInternals;var l=zt(),c=Mi(i),d=fi(l,c);d.tag=2,s!=null&&(d.callback=s),s=Ii(i,d,c),s!==null&&(Sr(s,i,c,l),ga(s,i,c))}};function Uf(i,s,l,c,d,m,y){return i=i.stateNode,typeof i.shouldComponentUpdate=="function"?i.shouldComponentUpdate(c,m,y):s.prototype&&s.prototype.isPureReactComponent?!fa(l,c)||!fa(d,m):!0}function Bf(i,s,l){var c=!1,d=Ri,m=s.contextType;return typeof m=="object"&&m!==null?m=vr(m):(d=Qt(s)?nn:Ot.current,c=s.contextTypes,m=(c=c!=null)?Qn(i,d):Ri),s=new s(l,m),i.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,s.updater=ya,i.stateNode=s,s._reactInternals=i,c&&(i=i.stateNode,i.__reactInternalMemoizedUnmaskedChildContext=d,i.__reactInternalMemoizedMaskedChildContext=m),s}function Vf(i,s,l,c){i=s.state,typeof s.componentWillReceiveProps=="function"&&s.componentWillReceiveProps(l,c),typeof s.UNSAFE_componentWillReceiveProps=="function"&&s.UNSAFE_componentWillReceiveProps(l,c),s.state!==i&&ya.enqueueReplaceState(s,s.state,null)}function lc(i,s,l,c){var d=i.stateNode;d.props=l,d.state=i.memoizedState,d.refs=jf,oc(i);var m=s.contextType;typeof m=="object"&&m!==null?d.context=vr(m):(m=Qt(s)?nn:Ot.current,d.context=Qn(i,m)),d.state=i.memoizedState,m=s.getDerivedStateFromProps,typeof m=="function"&&(ac(i,s,m,l),d.state=i.memoizedState),typeof s.getDerivedStateFromProps=="function"||typeof d.getSnapshotBeforeUpdate=="function"||typeof d.UNSAFE_componentWillMount!="function"&&typeof d.componentWillMount!="function"||(s=d.state,typeof d.componentWillMount=="function"&&d.componentWillMount(),typeof d.UNSAFE_componentWillMount=="function"&&d.UNSAFE_componentWillMount(),s!==d.state&&ya.enqueueReplaceState(d,d.state,null),va(i,l,d,c),d.state=i.memoizedState),typeof d.componentDidMount=="function"&&(i.flags|=4194308)}function Qs(i,s,l){if(i=l.ref,i!==null&&typeof i!="function"&&typeof i!="object"){if(l._owner){if(l=l._owner,l){if(l.tag!==1)throw Error(u(309));var c=l.stateNode}if(!c)throw Error(u(147,i));var d=c,m=""+i;return s!==null&&s.ref!==null&&typeof s.ref=="function"&&s.ref._stringRef===m?s.ref:(s=function(y){var C=d.refs;C===jf&&(C=d.refs={}),y===null?delete C[m]:C[m]=y},s._stringRef=m,s)}if(typeof i!="string")throw Error(u(284));if(!l._owner)throw Error(u(290,i))}return i}function xa(i,s){throw i=Object.prototype.toString.call(s),Error(u(31,i==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":i))}function Wf(i){var s=i._init;return s(i._payload)}function Hf(i){function s(O,R){if(i){var k=O.deletions;k===null?(O.deletions=[R],O.flags|=16):k.push(R)}}function l(O,R){if(!i)return null;for(;R!==null;)s(O,R),R=R.sibling;return null}function c(O,R){for(O=new Map;R!==null;)R.key!==null?O.set(R.key,R):O.set(R.index,R),R=R.sibling;return O}function d(O,R){return O=Li(O,R),O.index=0,O.sibling=null,O}function m(O,R,k){return O.index=k,i?(k=O.alternate,k!==null?(k=k.index,k<R?(O.flags|=2,R):k):(O.flags|=2,R)):(O.flags|=1048576,R)}function y(O){return i&&O.alternate===null&&(O.flags|=2),O}function C(O,R,k,K){return R===null||R.tag!==6?(R=Xc(k,O.mode,K),R.return=O,R):(R=d(R,k),R.return=O,R)}function M(O,R,k,K){var ue=k.type;return ue===p?ne(O,R,k.props.children,K,k.key):R!==null&&(R.elementType===ue||typeof ue=="object"&&ue!==null&&ue.$$typeof===F&&Wf(ue)===R.type)?(K=d(R,k.props),K.ref=Qs(O,R,k),K.return=O,K):(K=qa(k.type,k.key,k.props,null,O.mode,K),K.ref=Qs(O,R,k),K.return=O,K)}function Y(O,R,k,K){return R===null||R.tag!==4||R.stateNode.containerInfo!==k.containerInfo||R.stateNode.implementation!==k.implementation?(R=$c(k,O.mode,K),R.return=O,R):(R=d(R,k.children||[]),R.return=O,R)}function ne(O,R,k,K,ue){return R===null||R.tag!==7?(R=fn(k,O.mode,K,ue),R.return=O,R):(R=d(R,k),R.return=O,R)}function pe(O,R,k){if(typeof R=="string"&&R!==""||typeof R=="number")return R=Xc(""+R,O.mode,k),R.return=O,R;if(typeof R=="object"&&R!==null){switch(R.$$typeof){case f:return k=qa(R.type,R.key,R.props,null,O.mode,k),k.ref=Qs(O,null,R),k.return=O,k;case g:return R=$c(R,O.mode,k),R.return=O,R;case F:var K=R._init;return pe(O,K(R._payload),k)}if(Te(R)||L(R))return R=fn(R,O.mode,k,null),R.return=O,R;xa(O,R)}return null}function Z(O,R,k,K){var ue=R!==null?R.key:null;if(typeof k=="string"&&k!==""||typeof k=="number")return ue!==null?null:C(O,R,""+k,K);if(typeof k=="object"&&k!==null){switch(k.$$typeof){case f:return k.key===ue?M(O,R,k,K):null;case g:return k.key===ue?Y(O,R,k,K):null;case F:return ue=k._init,Z(O,R,ue(k._payload),K)}if(Te(k)||L(k))return ue!==null?null:ne(O,R,k,K,null);xa(O,k)}return null}function He(O,R,k,K,ue){if(typeof K=="string"&&K!==""||typeof K=="number")return O=O.get(k)||null,C(R,O,""+K,ue);if(typeof K=="object"&&K!==null){switch(K.$$typeof){case f:return O=O.get(K.key===null?k:K.key)||null,M(R,O,K,ue);case g:return O=O.get(K.key===null?k:K.key)||null,Y(R,O,K,ue);case F:var ye=K._init;return He(O,R,k,ye(K._payload),ue)}if(Te(K)||L(K))return O=O.get(k)||null,ne(R,O,K,ue,null);xa(R,K)}return null}function Fe(O,R,k,K){for(var ue=null,ye=null,me=R,Oe=R=0,Rt=null;me!==null&&Oe<k.length;Oe++){me.index>Oe?(Rt=me,me=null):Rt=me.sibling;var Me=Z(O,me,k[Oe],K);if(Me===null){me===null&&(me=Rt);break}i&&me&&Me.alternate===null&&s(O,me),R=m(Me,R,Oe),ye===null?ue=Me:ye.sibling=Me,ye=Me,me=Rt}if(Oe===k.length)return l(O,me),Qe&&on(O,Oe),ue;if(me===null){for(;Oe<k.length;Oe++)me=pe(O,k[Oe],K),me!==null&&(R=m(me,R,Oe),ye===null?ue=me:ye.sibling=me,ye=me);return Qe&&on(O,Oe),ue}for(me=c(O,me);Oe<k.length;Oe++)Rt=He(me,O,Oe,k[Oe],K),Rt!==null&&(i&&Rt.alternate!==null&&me.delete(Rt.key===null?Oe:Rt.key),R=m(Rt,R,Oe),ye===null?ue=Rt:ye.sibling=Rt,ye=Rt);return i&&me.forEach(function(zi){return s(O,zi)}),Qe&&on(O,Oe),ue}function $t(O,R,k,K){var ue=L(k);if(typeof ue!="function")throw Error(u(150));if(k=ue.call(k),k==null)throw Error(u(151));for(var ye=ue=null,me=R,Oe=R=0,Rt=null,Me=k.next();me!==null&&!Me.done;Oe++,Me=k.next()){me.index>Oe?(Rt=me,me=null):Rt=me.sibling;var zi=Z(O,me,Me.value,K);if(zi===null){me===null&&(me=Rt);break}i&&me&&zi.alternate===null&&s(O,me),R=m(zi,R,Oe),ye===null?ue=zi:ye.sibling=zi,ye=zi,me=Rt}if(Me.done)return l(O,me),Qe&&on(O,Oe),ue;if(me===null){for(;!Me.done;Oe++,Me=k.next())Me=pe(O,Me.value,K),Me!==null&&(R=m(Me,R,Oe),ye===null?ue=Me:ye.sibling=Me,ye=Me);return Qe&&on(O,Oe),ue}for(me=c(O,me);!Me.done;Oe++,Me=k.next())Me=He(me,O,Oe,Me.value,K),Me!==null&&(i&&Me.alternate!==null&&me.delete(Me.key===null?Oe:Me.key),R=m(Me,R,Oe),ye===null?ue=Me:ye.sibling=Me,ye=Me);return i&&me.forEach(function(AS){return s(O,AS)}),Qe&&on(O,Oe),ue}function gi(O,R,k,K){if(typeof k=="object"&&k!==null&&k.type===p&&k.key===null&&(k=k.props.children),typeof k=="object"&&k!==null){switch(k.$$typeof){case f:e:{for(var ue=k.key,ye=R;ye!==null;){if(ye.key===ue){if(ue=k.type,ue===p){if(ye.tag===7){l(O,ye.sibling),R=d(ye,k.props.children),R.return=O,O=R;break e}}else if(ye.elementType===ue||typeof ue=="object"&&ue!==null&&ue.$$typeof===F&&Wf(ue)===ye.type){l(O,ye.sibling),R=d(ye,k.props),R.ref=Qs(O,ye,k),R.return=O,O=R;break e}l(O,ye);break}else s(O,ye);ye=ye.sibling}k.type===p?(R=fn(k.props.children,O.mode,K,k.key),R.return=O,O=R):(K=qa(k.type,k.key,k.props,null,O.mode,K),K.ref=Qs(O,R,k),K.return=O,O=K)}return y(O);case g:e:{for(ye=k.key;R!==null;){if(R.key===ye)if(R.tag===4&&R.stateNode.containerInfo===k.containerInfo&&R.stateNode.implementation===k.implementation){l(O,R.sibling),R=d(R,k.children||[]),R.return=O,O=R;break e}else{l(O,R);break}else s(O,R);R=R.sibling}R=$c(k,O.mode,K),R.return=O,O=R}return y(O);case F:return ye=k._init,gi(O,R,ye(k._payload),K)}if(Te(k))return Fe(O,R,k,K);if(L(k))return $t(O,R,k,K);xa(O,k)}return typeof k=="string"&&k!==""||typeof k=="number"?(k=""+k,R!==null&&R.tag===6?(l(O,R.sibling),R=d(R,k),R.return=O,O=R):(l(O,R),R=Xc(k,O.mode,K),R.return=O,O=R),y(O)):l(O,R)}return gi}var Kn=Hf(!0),qf=Hf(!1),Ys={},yr=Pi(Ys),Gs=Pi(Ys),Jn=Pi(Ys);function Gr(i){if(i===Ys)throw Error(u(174));return i}function uc(i,s){je(Jn,s),je(Gs,i),je(yr,Ys),i=lt(s),We(yr),je(yr,i)}function es(){We(yr),We(Gs),We(Jn)}function Qf(i){var s=Gr(Jn.current),l=Gr(yr.current);s=ce(l,i.type,s),l!==s&&(je(Gs,i),je(yr,s))}function cc(i){Gs.current===i&&(We(yr),We(Gs))}var Je=Pi(0);function Sa(i){for(var s=i;s!==null;){if(s.tag===13){var l=s.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||wf(l)||Du(l)))return s}else if(s.tag===19&&s.memoizedProps.revealOrder!==void 0){if(s.flags&128)return s}else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===i)break;for(;s.sibling===null;){if(s.return===null||s.return===i)return null;s=s.return}s.sibling.return=s.return,s=s.sibling}return null}var hc=[];function dc(){for(var i=0;i<hc.length;i++){var s=hc[i];nr?s._workInProgressVersionPrimary=null:s._workInProgressVersionSecondary=null}hc.length=0}var wa=h.ReactCurrentDispatcher,fc=h.ReactCurrentBatchConfig,ln=0,et=null,St=null,Ct=null,Aa=!1,Xs=!1,$s=0,Yx=0;function Mt(){throw Error(u(321))}function pc(i,s){if(s===null)return!1;for(var l=0;l<s.length&&l<i.length;l++)if(!_r(i[l],s[l]))return!1;return!0}function mc(i,s,l,c,d,m){if(ln=m,et=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,wa.current=i===null||i.memoizedState===null?Zx:Kx,i=l(c,d),Xs){m=0;do{if(Xs=!1,$s=0,25<=m)throw Error(u(301));m+=1,Ct=St=null,s.updateQueue=null,wa.current=Jx,i=l(c,d)}while(Xs)}if(wa.current=Ca,s=St!==null&&St.next!==null,ln=0,Ct=St=et=null,Aa=!1,s)throw Error(u(300));return i}function gc(){var i=$s!==0;return $s=0,i}function Xr(){var i={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ct===null?et.memoizedState=Ct=i:Ct=Ct.next=i,Ct}function xr(){if(St===null){var i=et.alternate;i=i!==null?i.memoizedState:null}else i=St.next;var s=Ct===null?et.memoizedState:Ct.next;if(s!==null)Ct=s,St=i;else{if(i===null)throw Error(u(310));St=i,i={memoizedState:St.memoizedState,baseState:St.baseState,baseQueue:St.baseQueue,queue:St.queue,next:null},Ct===null?et.memoizedState=Ct=i:Ct=Ct.next=i}return Ct}function Zs(i,s){return typeof s=="function"?s(i):s}function vc(i){var s=xr(),l=s.queue;if(l===null)throw Error(u(311));l.lastRenderedReducer=i;var c=St,d=c.baseQueue,m=l.pending;if(m!==null){if(d!==null){var y=d.next;d.next=m.next,m.next=y}c.baseQueue=d=m,l.pending=null}if(d!==null){m=d.next,c=c.baseState;var C=y=null,M=null,Y=m;do{var ne=Y.lane;if((ln&ne)===ne)M!==null&&(M=M.next={lane:0,action:Y.action,hasEagerState:Y.hasEagerState,eagerState:Y.eagerState,next:null}),c=Y.hasEagerState?Y.eagerState:i(c,Y.action);else{var pe={lane:ne,action:Y.action,hasEagerState:Y.hasEagerState,eagerState:Y.eagerState,next:null};M===null?(C=M=pe,y=c):M=M.next=pe,et.lanes|=ne,un|=ne}Y=Y.next}while(Y!==null&&Y!==m);M===null?y=c:M.next=C,_r(c,s.memoizedState)||(Yt=!0),s.memoizedState=c,s.baseState=y,s.baseQueue=M,l.lastRenderedState=c}if(i=l.interleaved,i!==null){d=i;do m=d.lane,et.lanes|=m,un|=m,d=d.next;while(d!==i)}else d===null&&(l.lanes=0);return[s.memoizedState,l.dispatch]}function yc(i){var s=xr(),l=s.queue;if(l===null)throw Error(u(311));l.lastRenderedReducer=i;var c=l.dispatch,d=l.pending,m=s.memoizedState;if(d!==null){l.pending=null;var y=d=d.next;do m=i(m,y.action),y=y.next;while(y!==d);_r(m,s.memoizedState)||(Yt=!0),s.memoizedState=m,s.baseQueue===null&&(s.baseState=m),l.lastRenderedState=m}return[m,c]}function Yf(){}function Gf(i,s){var l=et,c=xr(),d=s(),m=!_r(c.memoizedState,d);if(m&&(c.memoizedState=d,Yt=!0),c=c.queue,xc(Zf.bind(null,l,c,i),[i]),c.getSnapshot!==s||m||Ct!==null&&Ct.memoizedState.tag&1){if(l.flags|=2048,Ks(9,$f.bind(null,l,c,d,s),void 0,null),Pt===null)throw Error(u(349));ln&30||Xf(l,s,d)}return d}function Xf(i,s,l){i.flags|=16384,i={getSnapshot:s,value:l},s=et.updateQueue,s===null?(s={lastEffect:null,stores:null},et.updateQueue=s,s.stores=[i]):(l=s.stores,l===null?s.stores=[i]:l.push(i))}function $f(i,s,l,c){s.value=l,s.getSnapshot=c,Kf(s)&&Jf(i)}function Zf(i,s,l){return l(function(){Kf(s)&&Jf(i)})}function Kf(i){var s=i.getSnapshot;i=i.value;try{var l=s();return!_r(i,l)}catch{return!0}}function Jf(i){var s=Yr(i,1);s!==null&&Sr(s,i,1,-1)}function ep(i){var s=Xr();return typeof i=="function"&&(i=i()),s.memoizedState=s.baseState=i,i={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Zs,lastRenderedState:i},s.queue=i,i=i.dispatch=$x.bind(null,et,i),[s.memoizedState,i]}function Ks(i,s,l,c){return i={tag:i,create:s,destroy:l,deps:c,next:null},s=et.updateQueue,s===null?(s={lastEffect:null,stores:null},et.updateQueue=s,s.lastEffect=i.next=i):(l=s.lastEffect,l===null?s.lastEffect=i.next=i:(c=l.next,l.next=i,i.next=c,s.lastEffect=i)),i}function tp(){return xr().memoizedState}function ba(i,s,l,c){var d=Xr();et.flags|=i,d.memoizedState=Ks(1|s,l,void 0,c===void 0?null:c)}function Ea(i,s,l,c){var d=xr();c=c===void 0?null:c;var m=void 0;if(St!==null){var y=St.memoizedState;if(m=y.destroy,c!==null&&pc(c,y.deps)){d.memoizedState=Ks(s,l,m,c);return}}et.flags|=i,d.memoizedState=Ks(1|s,l,m,c)}function rp(i,s){return ba(8390656,8,i,s)}function xc(i,s){return Ea(2048,8,i,s)}function ip(i,s){return Ea(4,2,i,s)}function np(i,s){return Ea(4,4,i,s)}function sp(i,s){if(typeof s=="function")return i=i(),s(i),function(){s(null)};if(s!=null)return i=i(),s.current=i,function(){s.current=null}}function op(i,s,l){return l=l!=null?l.concat([i]):null,Ea(4,4,sp.bind(null,s,i),l)}function Sc(){}function ap(i,s){var l=xr();s=s===void 0?null:s;var c=l.memoizedState;return c!==null&&s!==null&&pc(s,c[1])?c[0]:(l.memoizedState=[i,s],i)}function lp(i,s){var l=xr();s=s===void 0?null:s;var c=l.memoizedState;return c!==null&&s!==null&&pc(s,c[1])?c[0]:(i=i(),l.memoizedState=[i,s],i)}function up(i,s,l){return ln&21?(_r(l,s)||(l=Cf(),et.lanes|=l,un|=l,i.baseState=!0),s):(i.baseState&&(i.baseState=!1,Yt=!0),i.memoizedState=l)}function Gx(i,s){var l=_e;_e=l!==0&&4>l?l:4,i(!0);var c=fc.transition;fc.transition={};try{i(!1),s()}finally{_e=l,fc.transition=c}}function cp(){return xr().memoizedState}function Xx(i,s,l){var c=Mi(i);if(l={lane:c,action:l,hasEagerState:!1,eagerState:null,next:null},hp(i))dp(s,l);else if(l=zf(i,s,l,c),l!==null){var d=zt();Sr(l,i,c,d),fp(l,s,c)}}function $x(i,s,l){var c=Mi(i),d={lane:c,action:l,hasEagerState:!1,eagerState:null,next:null};if(hp(i))dp(s,d);else{var m=i.alternate;if(i.lanes===0&&(m===null||m.lanes===0)&&(m=s.lastRenderedReducer,m!==null))try{var y=s.lastRenderedState,C=m(y,l);if(d.hasEagerState=!0,d.eagerState=C,_r(C,y)){var M=s.interleaved;M===null?(d.next=d,sc(s)):(d.next=M.next,M.next=d),s.interleaved=d;return}}catch{}finally{}l=zf(i,s,d,c),l!==null&&(d=zt(),Sr(l,i,c,d),fp(l,s,c))}}function hp(i){var s=i.alternate;return i===et||s!==null&&s===et}function dp(i,s){Xs=Aa=!0;var l=i.pending;l===null?s.next=s:(s.next=l.next,l.next=s),i.pending=s}function fp(i,s,l){if(l&4194240){var c=s.lanes;c&=i.pendingLanes,l|=c,s.lanes=l,qu(i,l)}}var Ca={readContext:vr,useCallback:Mt,useContext:Mt,useEffect:Mt,useImperativeHandle:Mt,useInsertionEffect:Mt,useLayoutEffect:Mt,useMemo:Mt,useReducer:Mt,useRef:Mt,useState:Mt,useDebugValue:Mt,useDeferredValue:Mt,useTransition:Mt,useMutableSource:Mt,useSyncExternalStore:Mt,useId:Mt,unstable_isNewReconciler:!1},Zx={readContext:vr,useCallback:function(i,s){return Xr().memoizedState=[i,s===void 0?null:s],i},useContext:vr,useEffect:rp,useImperativeHandle:function(i,s,l){return l=l!=null?l.concat([i]):null,ba(4194308,4,sp.bind(null,s,i),l)},useLayoutEffect:function(i,s){return ba(4194308,4,i,s)},useInsertionEffect:function(i,s){return ba(4,2,i,s)},useMemo:function(i,s){var l=Xr();return s=s===void 0?null:s,i=i(),l.memoizedState=[i,s],i},useReducer:function(i,s,l){var c=Xr();return s=l!==void 0?l(s):s,c.memoizedState=c.baseState=s,i={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:s},c.queue=i,i=i.dispatch=Xx.bind(null,et,i),[c.memoizedState,i]},useRef:function(i){var s=Xr();return i={current:i},s.memoizedState=i},useState:ep,useDebugValue:Sc,useDeferredValue:function(i){return Xr().memoizedState=i},useTransition:function(){var i=ep(!1),s=i[0];return i=Gx.bind(null,i[1]),Xr().memoizedState=i,[s,i]},useMutableSource:function(){},useSyncExternalStore:function(i,s,l){var c=et,d=Xr();if(Qe){if(l===void 0)throw Error(u(407));l=l()}else{if(l=s(),Pt===null)throw Error(u(349));ln&30||Xf(c,s,l)}d.memoizedState=l;var m={value:l,getSnapshot:s};return d.queue=m,rp(Zf.bind(null,c,m,i),[i]),c.flags|=2048,Ks(9,$f.bind(null,c,m,l,s),void 0,null),l},useId:function(){var i=Xr(),s=Pt.identifierPrefix;if(Qe){var l=di,c=hi;l=(c&~(1<<32-Ir(c)-1)).toString(32)+l,s=":"+s+"R"+l,l=$s++,0<l&&(s+="H"+l.toString(32)),s+=":"}else l=Yx++,s=":"+s+"r"+l.toString(32)+":";return i.memoizedState=s},unstable_isNewReconciler:!1},Kx={readContext:vr,useCallback:ap,useContext:vr,useEffect:xc,useImperativeHandle:op,useInsertionEffect:ip,useLayoutEffect:np,useMemo:lp,useReducer:vc,useRef:tp,useState:function(){return vc(Zs)},useDebugValue:Sc,useDeferredValue:function(i){var s=xr();return up(s,St.memoizedState,i)},useTransition:function(){var i=vc(Zs)[0],s=xr().memoizedState;return[i,s]},useMutableSource:Yf,useSyncExternalStore:Gf,useId:cp,unstable_isNewReconciler:!1},Jx={readContext:vr,useCallback:ap,useContext:vr,useEffect:xc,useImperativeHandle:op,useInsertionEffect:ip,useLayoutEffect:np,useMemo:lp,useReducer:yc,useRef:tp,useState:function(){return yc(Zs)},useDebugValue:Sc,useDeferredValue:function(i){var s=xr();return St===null?s.memoizedState=i:up(s,St.memoizedState,i)},useTransition:function(){var i=yc(Zs)[0],s=xr().memoizedState;return[i,s]},useMutableSource:Yf,useSyncExternalStore:Gf,useId:cp,unstable_isNewReconciler:!1};function ts(i,s){try{var l="",c=s;do l+=Qx(c),c=c.return;while(c);var d=l}catch(m){d=`
|
|
6
|
+
Error generating stack: `+m.message+`
|
|
7
|
+
`+m.stack}return{value:i,source:s,stack:d,digest:null}}function wc(i,s,l){return{value:i,source:null,stack:l??null,digest:s??null}}function Ac(i,s){try{console.error(s.value)}catch(l){setTimeout(function(){throw l})}}var eS=typeof WeakMap=="function"?WeakMap:Map;function pp(i,s,l){l=fi(-1,l),l.tag=3,l.payload={element:null};var c=s.value;return l.callback=function(){ja||(ja=!0,Vc=c),Ac(i,s)},l}function mp(i,s,l){l=fi(-1,l),l.tag=3;var c=i.type.getDerivedStateFromError;if(typeof c=="function"){var d=s.value;l.payload=function(){return c(d)},l.callback=function(){Ac(i,s)}}var m=i.stateNode;return m!==null&&typeof m.componentDidCatch=="function"&&(l.callback=function(){Ac(i,s),typeof c!="function"&&(_i===null?_i=new Set([this]):_i.add(this));var y=s.stack;this.componentDidCatch(s.value,{componentStack:y!==null?y:""})}),l}function gp(i,s,l){var c=i.pingCache;if(c===null){c=i.pingCache=new eS;var d=new Set;c.set(s,d)}else d=c.get(s),d===void 0&&(d=new Set,c.set(s,d));d.has(l)||(d.add(l),i=pS.bind(null,i,s,l),s.then(i,i))}function vp(i){do{var s;if((s=i.tag===13)&&(s=i.memoizedState,s=s!==null?s.dehydrated!==null:!0),s)return i;i=i.return}while(i!==null);return null}function yp(i,s,l,c,d){return i.mode&1?(i.flags|=65536,i.lanes=d,i):(i===s?i.flags|=65536:(i.flags|=128,l.flags|=131072,l.flags&=-52805,l.tag===1&&(l.alternate===null?l.tag=17:(s=fi(-1,1),s.tag=2,Ii(l,s,1))),l.lanes|=1),i)}var tS=h.ReactCurrentOwner,Yt=!1;function jt(i,s,l,c){s.child=i===null?qf(s,null,l,c):Kn(s,i.child,l,c)}function xp(i,s,l,c,d){l=l.render;var m=s.ref;return Zn(s,d),c=mc(i,s,l,c,m,d),l=gc(),i!==null&&!Yt?(s.updateQueue=i.updateQueue,s.flags&=-2053,i.lanes&=~d,pi(i,s,d)):(Qe&&l&&$u(s),s.flags|=1,jt(i,s,c,d),s.child)}function Sp(i,s,l,c,d){if(i===null){var m=l.type;return typeof m=="function"&&!Gc(m)&&m.defaultProps===void 0&&l.compare===null&&l.defaultProps===void 0?(s.tag=15,s.type=m,wp(i,s,m,c,d)):(i=qa(l.type,null,c,s,s.mode,d),i.ref=s.ref,i.return=s,s.child=i)}if(m=i.child,!(i.lanes&d)){var y=m.memoizedProps;if(l=l.compare,l=l!==null?l:fa,l(y,c)&&i.ref===s.ref)return pi(i,s,d)}return s.flags|=1,i=Li(m,c),i.ref=s.ref,i.return=s,s.child=i}function wp(i,s,l,c,d){if(i!==null){var m=i.memoizedProps;if(fa(m,c)&&i.ref===s.ref)if(Yt=!1,s.pendingProps=c=m,(i.lanes&d)!==0)i.flags&131072&&(Yt=!0);else return s.lanes=i.lanes,pi(i,s,d)}return bc(i,s,l,c,d)}function Ap(i,s,l){var c=s.pendingProps,d=c.children,m=i!==null?i.memoizedState:null;if(c.mode==="hidden")if(!(s.mode&1))s.memoizedState={baseLanes:0,cachePool:null,transitions:null},je(is,ar),ar|=l;else{if(!(l&1073741824))return i=m!==null?m.baseLanes|l:l,s.lanes=s.childLanes=1073741824,s.memoizedState={baseLanes:i,cachePool:null,transitions:null},s.updateQueue=null,je(is,ar),ar|=i,null;s.memoizedState={baseLanes:0,cachePool:null,transitions:null},c=m!==null?m.baseLanes:l,je(is,ar),ar|=c}else m!==null?(c=m.baseLanes|l,s.memoizedState=null):c=l,je(is,ar),ar|=c;return jt(i,s,d,l),s.child}function bp(i,s){var l=s.ref;(i===null&&l!==null||i!==null&&i.ref!==l)&&(s.flags|=512,s.flags|=2097152)}function bc(i,s,l,c,d){var m=Qt(l)?nn:Ot.current;return m=Qn(s,m),Zn(s,d),l=mc(i,s,l,c,m,d),c=gc(),i!==null&&!Yt?(s.updateQueue=i.updateQueue,s.flags&=-2053,i.lanes&=~d,pi(i,s,d)):(Qe&&c&&$u(s),s.flags|=1,jt(i,s,l,d),s.child)}function Ep(i,s,l,c,d){if(Qt(l)){var m=!0;na(s)}else m=!1;if(Zn(s,d),s.stateNode===null)Ra(i,s),Bf(s,l,c),lc(s,l,c,d),c=!0;else if(i===null){var y=s.stateNode,C=s.memoizedProps;y.props=C;var M=y.context,Y=l.contextType;typeof Y=="object"&&Y!==null?Y=vr(Y):(Y=Qt(l)?nn:Ot.current,Y=Qn(s,Y));var ne=l.getDerivedStateFromProps,pe=typeof ne=="function"||typeof y.getSnapshotBeforeUpdate=="function";pe||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(C!==c||M!==Y)&&Vf(s,y,c,Y),Ti=!1;var Z=s.memoizedState;y.state=Z,va(s,c,y,d),M=s.memoizedState,C!==c||Z!==M||qt.current||Ti?(typeof ne=="function"&&(ac(s,l,ne,c),M=s.memoizedState),(C=Ti||Uf(s,l,C,c,Z,M,Y))?(pe||typeof y.UNSAFE_componentWillMount!="function"&&typeof y.componentWillMount!="function"||(typeof y.componentWillMount=="function"&&y.componentWillMount(),typeof y.UNSAFE_componentWillMount=="function"&&y.UNSAFE_componentWillMount()),typeof y.componentDidMount=="function"&&(s.flags|=4194308)):(typeof y.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=c,s.memoizedState=M),y.props=c,y.state=M,y.context=Y,c=C):(typeof y.componentDidMount=="function"&&(s.flags|=4194308),c=!1)}else{y=s.stateNode,Nf(i,s),C=s.memoizedProps,Y=s.type===s.elementType?C:Mr(s.type,C),y.props=Y,pe=s.pendingProps,Z=y.context,M=l.contextType,typeof M=="object"&&M!==null?M=vr(M):(M=Qt(l)?nn:Ot.current,M=Qn(s,M));var He=l.getDerivedStateFromProps;(ne=typeof He=="function"||typeof y.getSnapshotBeforeUpdate=="function")||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(C!==pe||Z!==M)&&Vf(s,y,c,M),Ti=!1,Z=s.memoizedState,y.state=Z,va(s,c,y,d);var Fe=s.memoizedState;C!==pe||Z!==Fe||qt.current||Ti?(typeof He=="function"&&(ac(s,l,He,c),Fe=s.memoizedState),(Y=Ti||Uf(s,l,Y,c,Z,Fe,M)||!1)?(ne||typeof y.UNSAFE_componentWillUpdate!="function"&&typeof y.componentWillUpdate!="function"||(typeof y.componentWillUpdate=="function"&&y.componentWillUpdate(c,Fe,M),typeof y.UNSAFE_componentWillUpdate=="function"&&y.UNSAFE_componentWillUpdate(c,Fe,M)),typeof y.componentDidUpdate=="function"&&(s.flags|=4),typeof y.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof y.componentDidUpdate!="function"||C===i.memoizedProps&&Z===i.memoizedState||(s.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||C===i.memoizedProps&&Z===i.memoizedState||(s.flags|=1024),s.memoizedProps=c,s.memoizedState=Fe),y.props=c,y.state=Fe,y.context=M,c=Y):(typeof y.componentDidUpdate!="function"||C===i.memoizedProps&&Z===i.memoizedState||(s.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||C===i.memoizedProps&&Z===i.memoizedState||(s.flags|=1024),c=!1)}return Ec(i,s,l,c,m,d)}function Ec(i,s,l,c,d,m){bp(i,s);var y=(s.flags&128)!==0;if(!c&&!y)return d&&Ef(s,l,!1),pi(i,s,m);c=s.stateNode,tS.current=s;var C=y&&typeof l.getDerivedStateFromError!="function"?null:c.render();return s.flags|=1,i!==null&&y?(s.child=Kn(s,i.child,null,m),s.child=Kn(s,null,C,m)):jt(i,s,C,m),s.memoizedState=c.state,d&&Ef(s,l,!0),s.child}function Cp(i){var s=i.stateNode;s.pendingContext?Af(i,s.pendingContext,s.pendingContext!==s.context):s.context&&Af(i,s.context,!1),uc(i,s.containerInfo)}function Pp(i,s,l,c,d){return Xn(),ec(d),s.flags|=256,jt(i,s,l,c),s.child}var Cc={dehydrated:null,treeContext:null,retryLane:0};function Pc(i){return{baseLanes:i,cachePool:null,transitions:null}}function Rp(i,s,l){var c=s.pendingProps,d=Je.current,m=!1,y=(s.flags&128)!==0,C;if((C=y)||(C=i!==null&&i.memoizedState===null?!1:(d&2)!==0),C?(m=!0,s.flags&=-129):(i===null||i.memoizedState!==null)&&(d|=1),je(Je,d&1),i===null)return Ju(s),i=s.memoizedState,i!==null&&(i=i.dehydrated,i!==null)?(s.mode&1?Du(i)?s.lanes=8:s.lanes=1073741824:s.lanes=1,null):(y=c.children,i=c.fallback,m?(c=s.mode,m=s.child,y={mode:"hidden",children:y},!(c&1)&&m!==null?(m.childLanes=0,m.pendingProps=y):m=Qa(y,c,0,null),i=fn(i,c,l,null),m.return=s,i.return=s,m.sibling=i,s.child=m,s.child.memoizedState=Pc(l),s.memoizedState=Cc,i):Rc(s,y));if(d=i.memoizedState,d!==null&&(C=d.dehydrated,C!==null))return rS(i,s,y,c,C,d,l);if(m){m=c.fallback,y=s.mode,d=i.child,C=d.sibling;var M={mode:"hidden",children:c.children};return!(y&1)&&s.child!==d?(c=s.child,c.childLanes=0,c.pendingProps=M,s.deletions=null):(c=Li(d,M),c.subtreeFlags=d.subtreeFlags&14680064),C!==null?m=Li(C,m):(m=fn(m,y,l,null),m.flags|=2),m.return=s,c.return=s,c.sibling=m,s.child=c,c=m,m=s.child,y=i.child.memoizedState,y=y===null?Pc(l):{baseLanes:y.baseLanes|l,cachePool:null,transitions:y.transitions},m.memoizedState=y,m.childLanes=i.childLanes&~l,s.memoizedState=Cc,c}return m=i.child,i=m.sibling,c=Li(m,{mode:"visible",children:c.children}),!(s.mode&1)&&(c.lanes=l),c.return=s,c.sibling=null,i!==null&&(l=s.deletions,l===null?(s.deletions=[i],s.flags|=16):l.push(i)),s.child=c,s.memoizedState=null,c}function Rc(i,s){return s=Qa({mode:"visible",children:s},i.mode,0,null),s.return=i,i.child=s}function Pa(i,s,l,c){return c!==null&&ec(c),Kn(s,i.child,null,l),i=Rc(s,s.pendingProps.children),i.flags|=2,s.memoizedState=null,i}function rS(i,s,l,c,d,m,y){if(l)return s.flags&256?(s.flags&=-257,c=wc(Error(u(422))),Pa(i,s,y,c)):s.memoizedState!==null?(s.child=i.child,s.flags|=128,null):(m=c.fallback,d=s.mode,c=Qa({mode:"visible",children:c.children},d,0,null),m=fn(m,d,y,null),m.flags|=2,c.return=s,m.return=s,c.sibling=m,s.child=c,s.mode&1&&Kn(s,i.child,null,y),s.child.memoizedState=Pc(y),s.memoizedState=Cc,m);if(!(s.mode&1))return Pa(i,s,y,null);if(Du(d))return c=mx(d).digest,m=Error(u(419)),c=wc(m,c,void 0),Pa(i,s,y,c);if(l=(y&i.childLanes)!==0,Yt||l){if(c=Pt,c!==null){switch(y&-y){case 4:d=2;break;case 16:d=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:d=32;break;case 536870912:d=268435456;break;default:d=0}d=d&(c.suspendedLanes|y)?0:d,d!==0&&d!==m.retryLane&&(m.retryLane=d,Yr(i,d),Sr(c,i,d,-1))}return Yc(),c=wc(Error(u(421))),Pa(i,s,y,c)}return wf(d)?(s.flags|=128,s.child=i.child,s=mS.bind(null,i),gx(d,s),null):(i=m.treeContext,$&&(gr=xx(d),or=s,Qe=!0,Or=null,qs=!1,i!==null&&(pr[mr++]=hi,pr[mr++]=di,pr[mr++]=sn,hi=i.id,di=i.overflow,sn=s)),s=Rc(s,c.children),s.flags|=4096,s)}function Tp(i,s,l){i.lanes|=s;var c=i.alternate;c!==null&&(c.lanes|=s),nc(i.return,s,l)}function Tc(i,s,l,c,d){var m=i.memoizedState;m===null?i.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:c,tail:l,tailMode:d}:(m.isBackwards=s,m.rendering=null,m.renderingStartTime=0,m.last=c,m.tail=l,m.tailMode=d)}function Ip(i,s,l){var c=s.pendingProps,d=c.revealOrder,m=c.tail;if(jt(i,s,c.children,l),c=Je.current,c&2)c=c&1|2,s.flags|=128;else{if(i!==null&&i.flags&128)e:for(i=s.child;i!==null;){if(i.tag===13)i.memoizedState!==null&&Tp(i,l,s);else if(i.tag===19)Tp(i,l,s);else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===s)break e;for(;i.sibling===null;){if(i.return===null||i.return===s)break e;i=i.return}i.sibling.return=i.return,i=i.sibling}c&=1}if(je(Je,c),!(s.mode&1))s.memoizedState=null;else switch(d){case"forwards":for(l=s.child,d=null;l!==null;)i=l.alternate,i!==null&&Sa(i)===null&&(d=l),l=l.sibling;l=d,l===null?(d=s.child,s.child=null):(d=l.sibling,l.sibling=null),Tc(s,!1,d,l,m);break;case"backwards":for(l=null,d=s.child,s.child=null;d!==null;){if(i=d.alternate,i!==null&&Sa(i)===null){s.child=d;break}i=d.sibling,d.sibling=l,l=d,d=i}Tc(s,!0,l,null,m);break;case"together":Tc(s,!1,null,null,void 0);break;default:s.memoizedState=null}return s.child}function Ra(i,s){!(s.mode&1)&&i!==null&&(i.alternate=null,s.alternate=null,s.flags|=2)}function pi(i,s,l){if(i!==null&&(s.dependencies=i.dependencies),un|=s.lanes,!(l&s.childLanes))return null;if(i!==null&&s.child!==i.child)throw Error(u(153));if(s.child!==null){for(i=s.child,l=Li(i,i.pendingProps),s.child=l,l.return=s;i.sibling!==null;)i=i.sibling,l=l.sibling=Li(i,i.pendingProps),l.return=s;l.sibling=null}return s.child}function iS(i,s,l){switch(s.tag){case 3:Cp(s),Xn();break;case 5:Qf(s);break;case 1:Qt(s.type)&&na(s);break;case 4:uc(s,s.stateNode.containerInfo);break;case 10:Lf(s,s.type._context,s.memoizedProps.value);break;case 13:var c=s.memoizedState;if(c!==null)return c.dehydrated!==null?(je(Je,Je.current&1),s.flags|=128,null):l&s.child.childLanes?Rp(i,s,l):(je(Je,Je.current&1),i=pi(i,s,l),i!==null?i.sibling:null);je(Je,Je.current&1);break;case 19:if(c=(l&s.childLanes)!==0,i.flags&128){if(c)return Ip(i,s,l);s.flags|=128}var d=s.memoizedState;if(d!==null&&(d.rendering=null,d.tail=null,d.lastEffect=null),je(Je,Je.current),c)break;return null;case 22:case 23:return s.lanes=0,Ap(i,s,l)}return pi(i,s,l)}function $r(i){i.flags|=4}function _p(i,s){if(i!==null&&i.child===s.child)return!0;if(s.flags&16)return!1;for(i=s.child;i!==null;){if(i.flags&12854||i.subtreeFlags&12854)return!1;i=i.sibling}return!0}var Js,eo,Ta,Ia;if(Ie)Js=function(i,s){for(var l=s.child;l!==null;){if(l.tag===5||l.tag===6)fe(i,l.stateNode);else if(l.tag!==4&&l.child!==null){l.child.return=l,l=l.child;continue}if(l===s)break;for(;l.sibling===null;){if(l.return===null||l.return===s)return;l=l.return}l.sibling.return=l.return,l=l.sibling}},eo=function(){},Ta=function(i,s,l,c,d){if(i=i.memoizedProps,i!==c){var m=s.stateNode,y=Gr(yr.current);l=Xe(m,l,i,c,d,y),(s.updateQueue=l)&&$r(s)}},Ia=function(i,s,l,c){l!==c&&$r(s)};else if(Ze){Js=function(i,s,l,c){for(var d=s.child;d!==null;){if(d.tag===5){var m=d.stateNode;l&&c&&(m=rn(m,d.type,d.memoizedProps,d)),fe(i,m)}else if(d.tag===6)m=d.stateNode,l&&c&&(m=Bs(m,d.memoizedProps,d)),fe(i,m);else if(d.tag!==4){if(d.tag===22&&d.memoizedState!==null)m=d.child,m!==null&&(m.return=d),Js(i,d,!0,!0);else if(d.child!==null){d.child.return=d,d=d.child;continue}}if(d===s)break;for(;d.sibling===null;){if(d.return===null||d.return===s)return;d=d.return}d.sibling.return=d.return,d=d.sibling}};var Op=function(i,s,l,c){for(var d=s.child;d!==null;){if(d.tag===5){var m=d.stateNode;l&&c&&(m=rn(m,d.type,d.memoizedProps,d)),xt(i,m)}else if(d.tag===6)m=d.stateNode,l&&c&&(m=Bs(m,d.memoizedProps,d)),xt(i,m);else if(d.tag!==4){if(d.tag===22&&d.memoizedState!==null)m=d.child,m!==null&&(m.return=d),Op(i,d,!0,!0);else if(d.child!==null){d.child.return=d,d=d.child;continue}}if(d===s)break;for(;d.sibling===null;){if(d.return===null||d.return===s)return;d=d.return}d.sibling.return=d.return,d=d.sibling}};eo=function(i,s){var l=s.stateNode;if(!_p(i,s)){i=l.containerInfo;var c=Ke(i);Op(c,s,!1,!1),l.pendingChildren=c,$r(s),Ci(i,c)}},Ta=function(i,s,l,c,d){var m=i.stateNode,y=i.memoizedProps;if((i=_p(i,s))&&y===c)s.stateNode=m;else{var C=s.stateNode,M=Gr(yr.current),Y=null;y!==c&&(Y=Xe(C,l,y,c,d,M)),i&&Y===null?s.stateNode=m:(m=yt(m,Y,l,y,c,s,i,C),De(m,l,c,d,M)&&$r(s),s.stateNode=m,i?$r(s):Js(m,s,!1,!1))}},Ia=function(i,s,l,c){l!==c?(i=Gr(Jn.current),l=Gr(yr.current),s.stateNode=Pr(c,i,l,s),$r(s)):s.stateNode=i.stateNode}}else eo=function(){},Ta=function(){},Ia=function(){};function to(i,s){if(!Qe)switch(i.tailMode){case"hidden":s=i.tail;for(var l=null;s!==null;)s.alternate!==null&&(l=s),s=s.sibling;l===null?i.tail=null:l.sibling=null;break;case"collapsed":l=i.tail;for(var c=null;l!==null;)l.alternate!==null&&(c=l),l=l.sibling;c===null?s||i.tail===null?i.tail=null:i.tail.sibling=null:c.sibling=null}}function kt(i){var s=i.alternate!==null&&i.alternate.child===i.child,l=0,c=0;if(s)for(var d=i.child;d!==null;)l|=d.lanes|d.childLanes,c|=d.subtreeFlags&14680064,c|=d.flags&14680064,d.return=i,d=d.sibling;else for(d=i.child;d!==null;)l|=d.lanes|d.childLanes,c|=d.subtreeFlags,c|=d.flags,d.return=i,d=d.sibling;return i.subtreeFlags|=c,i.childLanes=l,s}function nS(i,s,l){var c=s.pendingProps;switch(Zu(s),s.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return kt(s),null;case 1:return Qt(s.type)&&ia(),kt(s),null;case 3:return l=s.stateNode,es(),We(qt),We(Ot),dc(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(i===null||i.child===null)&&(da(s)?$r(s):i===null||i.memoizedState.isDehydrated&&!(s.flags&256)||(s.flags|=1024,Or!==null&&(qc(Or),Or=null))),eo(i,s),kt(s),null;case 5:cc(s),l=Gr(Jn.current);var d=s.type;if(i!==null&&s.stateNode!=null)Ta(i,s,d,c,l),i.ref!==s.ref&&(s.flags|=512,s.flags|=2097152);else{if(!c){if(s.stateNode===null)throw Error(u(166));return kt(s),null}if(i=Gr(yr.current),da(s)){if(!$)throw Error(u(175));i=Sx(s.stateNode,s.type,s.memoizedProps,l,i,s,!qs),s.updateQueue=i,i!==null&&$r(s)}else{var m=V(d,c,l,i,s);Js(m,s,!1,!1),s.stateNode=m,De(m,d,c,l,i)&&$r(s)}s.ref!==null&&(s.flags|=512,s.flags|=2097152)}return kt(s),null;case 6:if(i&&s.stateNode!=null)Ia(i,s,i.memoizedProps,c);else{if(typeof c!="string"&&s.stateNode===null)throw Error(u(166));if(i=Gr(Jn.current),l=Gr(yr.current),da(s)){if(!$)throw Error(u(176));if(i=s.stateNode,l=s.memoizedProps,(c=wx(i,l,s,!qs))&&(d=or,d!==null))switch(d.tag){case 3:Ix(d.stateNode.containerInfo,i,l,(d.mode&1)!==0);break;case 5:_x(d.type,d.memoizedProps,d.stateNode,i,l,(d.mode&1)!==0)}c&&$r(s)}else s.stateNode=Pr(c,i,l,s)}return kt(s),null;case 13:if(We(Je),c=s.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(Qe&&gr!==null&&s.mode&1&&!(s.flags&128))kf(),Xn(),s.flags|=98560,d=!1;else if(d=da(s),c!==null&&c.dehydrated!==null){if(i===null){if(!d)throw Error(u(318));if(!$)throw Error(u(344));if(d=s.memoizedState,d=d!==null?d.dehydrated:null,!d)throw Error(u(317));Ax(d,s)}else Xn(),!(s.flags&128)&&(s.memoizedState=null),s.flags|=4;kt(s),d=!1}else Or!==null&&(qc(Or),Or=null),d=!0;if(!d)return s.flags&65536?s:null}return s.flags&128?(s.lanes=l,s):(l=c!==null,l!==(i!==null&&i.memoizedState!==null)&&l&&(s.child.flags|=8192,s.mode&1&&(i===null||Je.current&1?wt===0&&(wt=3):Yc())),s.updateQueue!==null&&(s.flags|=4),kt(s),null);case 4:return es(),eo(i,s),i===null&&Ce(s.stateNode.containerInfo),kt(s),null;case 10:return ic(s.type._context),kt(s),null;case 17:return Qt(s.type)&&ia(),kt(s),null;case 19:if(We(Je),d=s.memoizedState,d===null)return kt(s),null;if(c=(s.flags&128)!==0,m=d.rendering,m===null)if(c)to(d,!1);else{if(wt!==0||i!==null&&i.flags&128)for(i=s.child;i!==null;){if(m=Sa(i),m!==null){for(s.flags|=128,to(d,!1),i=m.updateQueue,i!==null&&(s.updateQueue=i,s.flags|=4),s.subtreeFlags=0,i=l,l=s.child;l!==null;)c=l,d=i,c.flags&=14680066,m=c.alternate,m===null?(c.childLanes=0,c.lanes=d,c.child=null,c.subtreeFlags=0,c.memoizedProps=null,c.memoizedState=null,c.updateQueue=null,c.dependencies=null,c.stateNode=null):(c.childLanes=m.childLanes,c.lanes=m.lanes,c.child=m.child,c.subtreeFlags=0,c.deletions=null,c.memoizedProps=m.memoizedProps,c.memoizedState=m.memoizedState,c.updateQueue=m.updateQueue,c.type=m.type,d=m.dependencies,c.dependencies=d===null?null:{lanes:d.lanes,firstContext:d.firstContext}),l=l.sibling;return je(Je,Je.current&1|2),s.child}i=i.sibling}d.tail!==null&&Et()>Bc&&(s.flags|=128,c=!0,to(d,!1),s.lanes=4194304)}else{if(!c)if(i=Sa(m),i!==null){if(s.flags|=128,c=!0,i=i.updateQueue,i!==null&&(s.updateQueue=i,s.flags|=4),to(d,!0),d.tail===null&&d.tailMode==="hidden"&&!m.alternate&&!Qe)return kt(s),null}else 2*Et()-d.renderingStartTime>Bc&&l!==1073741824&&(s.flags|=128,c=!0,to(d,!1),s.lanes=4194304);d.isBackwards?(m.sibling=s.child,s.child=m):(i=d.last,i!==null?i.sibling=m:s.child=m,d.last=m)}return d.tail!==null?(s=d.tail,d.rendering=s,d.tail=s.sibling,d.renderingStartTime=Et(),s.sibling=null,i=Je.current,je(Je,c?i&1|2:i&1),s):(kt(s),null);case 22:case 23:return Qc(),l=s.memoizedState!==null,i!==null&&i.memoizedState!==null!==l&&(s.flags|=8192),l&&s.mode&1?ar&1073741824&&(kt(s),Ie&&s.subtreeFlags&6&&(s.flags|=8192)):kt(s),null;case 24:return null;case 25:return null}throw Error(u(156,s.tag))}function sS(i,s){switch(Zu(s),s.tag){case 1:return Qt(s.type)&&ia(),i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 3:return es(),We(qt),We(Ot),dc(),i=s.flags,i&65536&&!(i&128)?(s.flags=i&-65537|128,s):null;case 5:return cc(s),null;case 13:if(We(Je),i=s.memoizedState,i!==null&&i.dehydrated!==null){if(s.alternate===null)throw Error(u(340));Xn()}return i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 19:return We(Je),null;case 4:return es(),null;case 10:return ic(s.type._context),null;case 22:case 23:return Qc(),null;case 24:return null;default:return null}}var _a=!1,Lt=!1,oS=typeof WeakSet=="function"?WeakSet:Set,ie=null;function rs(i,s){var l=i.ref;if(l!==null)if(typeof l=="function")try{l(null)}catch(c){Ye(i,s,c)}else l.current=null}function Ic(i,s,l){try{l()}catch(c){Ye(i,s,c)}}var Mp=!1;function aS(i,s){for(st(i.containerInfo),ie=s;ie!==null;)if(i=ie,s=i.child,(i.subtreeFlags&1028)!==0&&s!==null)s.return=i,ie=s;else for(;ie!==null;){i=ie;try{var l=i.alternate;if(i.flags&1024)switch(i.tag){case 0:case 11:case 15:break;case 1:if(l!==null){var c=l.memoizedProps,d=l.memoizedState,m=i.stateNode,y=m.getSnapshotBeforeUpdate(i.elementType===i.type?c:Mr(i.type,c),d);m.__reactInternalSnapshotBeforeUpdate=y}break;case 3:Ie&&Ne(i.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(u(163))}}catch(C){Ye(i,i.return,C)}if(s=i.sibling,s!==null){s.return=i.return,ie=s;break}ie=i.return}return l=Mp,Mp=!1,l}function ro(i,s,l){var c=s.updateQueue;if(c=c!==null?c.lastEffect:null,c!==null){var d=c=c.next;do{if((d.tag&i)===i){var m=d.destroy;d.destroy=void 0,m!==void 0&&Ic(s,l,m)}d=d.next}while(d!==c)}}function Oa(i,s){if(s=s.updateQueue,s=s!==null?s.lastEffect:null,s!==null){var l=s=s.next;do{if((l.tag&i)===i){var c=l.create;l.destroy=c()}l=l.next}while(l!==s)}}function _c(i){var s=i.ref;if(s!==null){var l=i.stateNode;switch(i.tag){case 5:i=ge(l);break;default:i=l}typeof s=="function"?s(i):s.current=i}}function kp(i){var s=i.alternate;s!==null&&(i.alternate=null,kp(s)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(s=i.stateNode,s!==null&&Vr(s)),i.stateNode=null,i.return=null,i.dependencies=null,i.memoizedProps=null,i.memoizedState=null,i.pendingProps=null,i.stateNode=null,i.updateQueue=null}function Lp(i){return i.tag===5||i.tag===3||i.tag===4}function zp(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||Lp(i.return))return null;i=i.return}for(i.sibling.return=i.return,i=i.sibling;i.tag!==5&&i.tag!==6&&i.tag!==18;){if(i.flags&2||i.child===null||i.tag===4)continue e;i.child.return=i,i=i.child}if(!(i.flags&2))return i.stateNode}}function Oc(i,s,l){var c=i.tag;if(c===5||c===6)i=i.stateNode,s?z(l,i,s):H(l,i);else if(c!==4&&(i=i.child,i!==null))for(Oc(i,s,l),i=i.sibling;i!==null;)Oc(i,s,l),i=i.sibling}function Mc(i,s,l){var c=i.tag;if(c===5||c===6)i=i.stateNode,s?Le(l,i,s):_(l,i);else if(c!==4&&(i=i.child,i!==null))for(Mc(i,s,l),i=i.sibling;i!==null;)Mc(i,s,l),i=i.sibling}var Tt=null,kr=!1;function Zr(i,s,l){for(l=l.child;l!==null;)kc(i,s,l),l=l.sibling}function kc(i,s,l){if(qr&&typeof qr.onCommitFiberUnmount=="function")try{qr.onCommitFiberUnmount(la,l)}catch{}switch(l.tag){case 5:Lt||rs(l,s);case 6:if(Ie){var c=Tt,d=kr;Tt=null,Zr(i,s,l),Tt=c,kr=d,Tt!==null&&(kr?oe(Tt,l.stateNode):U(Tt,l.stateNode))}else Zr(i,s,l);break;case 18:Ie&&Tt!==null&&(kr?Rx(Tt,l.stateNode):Px(Tt,l.stateNode));break;case 4:Ie?(c=Tt,d=kr,Tt=l.stateNode.containerInfo,kr=!0,Zr(i,s,l),Tt=c,kr=d):(Ze&&(c=l.stateNode.containerInfo,d=Ke(c),Tr(c,d)),Zr(i,s,l));break;case 0:case 11:case 14:case 15:if(!Lt&&(c=l.updateQueue,c!==null&&(c=c.lastEffect,c!==null))){d=c=c.next;do{var m=d,y=m.destroy;m=m.tag,y!==void 0&&(m&2||m&4)&&Ic(l,s,y),d=d.next}while(d!==c)}Zr(i,s,l);break;case 1:if(!Lt&&(rs(l,s),c=l.stateNode,typeof c.componentWillUnmount=="function"))try{c.props=l.memoizedProps,c.state=l.memoizedState,c.componentWillUnmount()}catch(C){Ye(l,s,C)}Zr(i,s,l);break;case 21:Zr(i,s,l);break;case 22:l.mode&1?(Lt=(c=Lt)||l.memoizedState!==null,Zr(i,s,l),Lt=c):Zr(i,s,l);break;default:Zr(i,s,l)}}function Np(i){var s=i.updateQueue;if(s!==null){i.updateQueue=null;var l=i.stateNode;l===null&&(l=i.stateNode=new oS),s.forEach(function(c){var d=gS.bind(null,i,c);l.has(c)||(l.add(c),c.then(d,d))})}}function Lr(i,s){var l=s.deletions;if(l!==null)for(var c=0;c<l.length;c++){var d=l[c];try{var m=i,y=s;if(Ie){var C=y;e:for(;C!==null;){switch(C.tag){case 5:Tt=C.stateNode,kr=!1;break e;case 3:Tt=C.stateNode.containerInfo,kr=!0;break e;case 4:Tt=C.stateNode.containerInfo,kr=!0;break e}C=C.return}if(Tt===null)throw Error(u(160));kc(m,y,d),Tt=null,kr=!1}else kc(m,y,d);var M=d.alternate;M!==null&&(M.return=null),d.return=null}catch(Y){Ye(d,s,Y)}}if(s.subtreeFlags&12854)for(s=s.child;s!==null;)Fp(s,i),s=s.sibling}function Fp(i,s){var l=i.alternate,c=i.flags;switch(i.tag){case 0:case 11:case 14:case 15:if(Lr(s,i),Kr(i),c&4){try{ro(3,i,i.return),Oa(3,i)}catch(Z){Ye(i,i.return,Z)}try{ro(5,i,i.return)}catch(Z){Ye(i,i.return,Z)}}break;case 1:Lr(s,i),Kr(i),c&512&&l!==null&&rs(l,l.return);break;case 5:if(Lr(s,i),Kr(i),c&512&&l!==null&&rs(l,l.return),Ie){if(i.flags&32){var d=i.stateNode;try{te(d)}catch(Z){Ye(i,i.return,Z)}}if(c&4&&(d=i.stateNode,d!=null)){var m=i.memoizedProps;if(l=l!==null?l.memoizedProps:m,c=i.type,s=i.updateQueue,i.updateQueue=null,s!==null)try{xe(d,s,c,l,m,i)}catch(Z){Ye(i,i.return,Z)}}}break;case 6:if(Lr(s,i),Kr(i),c&4&&Ie){if(i.stateNode===null)throw Error(u(162));d=i.stateNode,m=i.memoizedProps,l=l!==null?l.memoizedProps:m;try{Q(d,l,m)}catch(Z){Ye(i,i.return,Z)}}break;case 3:if(Lr(s,i),Kr(i),c&4){if(Ie&&$&&l!==null&&l.memoizedState.isDehydrated)try{Ex(s.containerInfo)}catch(Z){Ye(i,i.return,Z)}if(Ze){d=s.containerInfo,m=s.pendingChildren;try{Tr(d,m)}catch(Z){Ye(i,i.return,Z)}}}break;case 4:if(Lr(s,i),Kr(i),c&4&&Ze){m=i.stateNode,d=m.containerInfo,m=m.pendingChildren;try{Tr(d,m)}catch(Z){Ye(i,i.return,Z)}}break;case 13:Lr(s,i),Kr(i),d=i.child,d.flags&8192&&(m=d.memoizedState!==null,d.stateNode.isHidden=m,!m||d.alternate!==null&&d.alternate.memoizedState!==null||(Uc=Et())),c&4&&Np(i);break;case 22:var y=l!==null&&l.memoizedState!==null;if(i.mode&1?(Lt=(l=Lt)||y,Lr(s,i),Lt=l):Lr(s,i),Kr(i),c&8192){if(l=i.memoizedState!==null,(i.stateNode.isHidden=l)&&!y&&i.mode&1)for(ie=i,c=i.child;c!==null;){for(s=ie=c;ie!==null;){y=ie;var C=y.child;switch(y.tag){case 0:case 11:case 14:case 15:ro(4,y,y.return);break;case 1:rs(y,y.return);var M=y.stateNode;if(typeof M.componentWillUnmount=="function"){var Y=y,ne=y.return;try{var pe=Y;M.props=pe.memoizedProps,M.state=pe.memoizedState,M.componentWillUnmount()}catch(Z){Ye(Y,ne,Z)}}break;case 5:rs(y,y.return);break;case 22:if(y.memoizedState!==null){Up(s);continue}}C!==null?(C.return=y,ie=C):Up(s)}c=c.sibling}if(Ie){e:if(c=null,Ie)for(s=i;;){if(s.tag===5){if(c===null){c=s;try{d=s.stateNode,l?re(d):Be(s.stateNode,s.memoizedProps)}catch(Z){Ye(i,i.return,Z)}}}else if(s.tag===6){if(c===null)try{m=s.stateNode,l?Se(m):Ve(m,s.memoizedProps)}catch(Z){Ye(i,i.return,Z)}}else if((s.tag!==22&&s.tag!==23||s.memoizedState===null||s===i)&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===i)break e;for(;s.sibling===null;){if(s.return===null||s.return===i)break e;c===s&&(c=null),s=s.return}c===s&&(c=null),s.sibling.return=s.return,s=s.sibling}}}break;case 19:Lr(s,i),Kr(i),c&4&&Np(i);break;case 21:break;default:Lr(s,i),Kr(i)}}function Kr(i){var s=i.flags;if(s&2){try{if(Ie){e:{for(var l=i.return;l!==null;){if(Lp(l)){var c=l;break e}l=l.return}throw Error(u(160))}switch(c.tag){case 5:var d=c.stateNode;c.flags&32&&(te(d),c.flags&=-33);var m=zp(i);Mc(i,m,d);break;case 3:case 4:var y=c.stateNode.containerInfo,C=zp(i);Oc(i,C,y);break;default:throw Error(u(161))}}}catch(M){Ye(i,i.return,M)}i.flags&=-3}s&4096&&(i.flags&=-4097)}function lS(i,s,l){ie=i,Dp(i,s,l)}function Dp(i,s,l){for(var c=(i.mode&1)!==0;ie!==null;){var d=ie,m=d.child;if(d.tag===22&&c){var y=d.memoizedState!==null||_a;if(!y){var C=d.alternate,M=C!==null&&C.memoizedState!==null||Lt;C=_a;var Y=Lt;if(_a=y,(Lt=M)&&!Y)for(ie=d;ie!==null;)y=ie,M=y.child,y.tag===22&&y.memoizedState!==null?Bp(d):M!==null?(M.return=y,ie=M):Bp(d);for(;m!==null;)ie=m,Dp(m,s,l),m=m.sibling;ie=d,_a=C,Lt=Y}jp(i,s,l)}else d.subtreeFlags&8772&&m!==null?(m.return=d,ie=m):jp(i,s,l)}}function jp(i){for(;ie!==null;){var s=ie;if(s.flags&8772){var l=s.alternate;try{if(s.flags&8772)switch(s.tag){case 0:case 11:case 15:Lt||Oa(5,s);break;case 1:var c=s.stateNode;if(s.flags&4&&!Lt)if(l===null)c.componentDidMount();else{var d=s.elementType===s.type?l.memoizedProps:Mr(s.type,l.memoizedProps);c.componentDidUpdate(d,l.memoizedState,c.__reactInternalSnapshotBeforeUpdate)}var m=s.updateQueue;m!==null&&Df(s,m,c);break;case 3:var y=s.updateQueue;if(y!==null){if(l=null,s.child!==null)switch(s.child.tag){case 5:l=ge(s.child.stateNode);break;case 1:l=s.child.stateNode}Df(s,y,l)}break;case 5:var C=s.stateNode;l===null&&s.flags&4&&ve(C,s.type,s.memoizedProps,s);break;case 6:break;case 4:break;case 12:break;case 13:if($&&s.memoizedState===null){var M=s.alternate;if(M!==null){var Y=M.memoizedState;if(Y!==null){var ne=Y.dehydrated;ne!==null&&Cx(ne)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(u(163))}Lt||s.flags&512&&_c(s)}catch(pe){Ye(s,s.return,pe)}}if(s===i){ie=null;break}if(l=s.sibling,l!==null){l.return=s.return,ie=l;break}ie=s.return}}function Up(i){for(;ie!==null;){var s=ie;if(s===i){ie=null;break}var l=s.sibling;if(l!==null){l.return=s.return,ie=l;break}ie=s.return}}function Bp(i){for(;ie!==null;){var s=ie;try{switch(s.tag){case 0:case 11:case 15:var l=s.return;try{Oa(4,s)}catch(M){Ye(s,l,M)}break;case 1:var c=s.stateNode;if(typeof c.componentDidMount=="function"){var d=s.return;try{c.componentDidMount()}catch(M){Ye(s,d,M)}}var m=s.return;try{_c(s)}catch(M){Ye(s,m,M)}break;case 5:var y=s.return;try{_c(s)}catch(M){Ye(s,y,M)}}}catch(M){Ye(s,s.return,M)}if(s===i){ie=null;break}var C=s.sibling;if(C!==null){C.return=s.return,ie=C;break}ie=s.return}}var Ma=0,ka=1,La=2,za=3,Na=4;if(typeof Symbol=="function"&&Symbol.for){var io=Symbol.for;Ma=io("selector.component"),ka=io("selector.has_pseudo_class"),La=io("selector.role"),za=io("selector.test_id"),Na=io("selector.text")}function Lc(i){var s=Ee(i);if(s!=null){if(typeof s.memoizedProps["data-testname"]!="string")throw Error(u(364));return s}if(i=Nu(i),i===null)throw Error(u(362));return i.stateNode.current}function zc(i,s){switch(s.$$typeof){case Ma:if(i.type===s.value)return!0;break;case ka:e:{s=s.value,i=[i,0];for(var l=0;l<i.length;){var c=i[l++],d=i[l++],m=s[d];if(c.tag!==5||!Hr(c)){for(;m!=null&&zc(c,m);)d++,m=s[d];if(d===s.length){s=!0;break e}else for(c=c.child;c!==null;)i.push(c,d),c=c.sibling}}s=!1}return s;case La:if(i.tag===5&&Us(i.stateNode,s.value))return!0;break;case Na:if((i.tag===5||i.tag===6)&&(i=js(i),i!==null&&0<=i.indexOf(s.value)))return!0;break;case za:if(i.tag===5&&(i=i.memoizedProps["data-testname"],typeof i=="string"&&i.toLowerCase()===s.value.toLowerCase()))return!0;break;default:throw Error(u(365))}return!1}function Nc(i){switch(i.$$typeof){case Ma:return"<"+(N(i.value)||"Unknown")+">";case ka:return":has("+(Nc(i)||"")+")";case La:return'[role="'+i.value+'"]';case Na:return'"'+i.value+'"';case za:return'[data-testname="'+i.value+'"]';default:throw Error(u(365))}}function Vp(i,s){var l=[];i=[i,0];for(var c=0;c<i.length;){var d=i[c++],m=i[c++],y=s[m];if(d.tag!==5||!Hr(d)){for(;y!=null&&zc(d,y);)m++,y=s[m];if(m===s.length)l.push(d);else for(d=d.child;d!==null;)i.push(d,m),d=d.sibling}}return l}function Fc(i,s){if(!Wr)throw Error(u(363));i=Lc(i),i=Vp(i,s),s=[],i=Array.from(i);for(var l=0;l<i.length;){var c=i[l++];if(c.tag===5)Hr(c)||s.push(c.stateNode);else for(c=c.child;c!==null;)i.push(c),c=c.sibling}return s}var uS=Math.ceil,Fa=h.ReactCurrentDispatcher,Dc=h.ReactCurrentOwner,ut=h.ReactCurrentBatchConfig,we=0,Pt=null,ht=null,It=0,ar=0,is=Pi(0),wt=0,no=null,un=0,Da=0,jc=0,so=null,Gt=null,Uc=0,Bc=1/0,mi=null;function ns(){Bc=Et()+500}var ja=!1,Vc=null,_i=null,Ua=!1,Oi=null,Ba=0,oo=0,Wc=null,Va=-1,Wa=0;function zt(){return we&6?Et():Va!==-1?Va:Va=Et()}function Mi(i){return i.mode&1?we&2&&It!==0?It&-It:qx.transition!==null?(Wa===0&&(Wa=Cf()),Wa):(i=_e,i!==0?i:ui()):1}function Sr(i,s,l,c){if(50<oo)throw oo=0,Wc=null,Error(u(185));Hs(i,l,c),(!(we&2)||i!==Pt)&&(i===Pt&&(!(we&2)&&(Da|=l),wt===4&&ki(i,It)),Xt(i,c),l===1&&we===0&&!(s.mode&1)&&(ns(),ua&&Qr()))}function Xt(i,s){var l=i.callbackNode;Nx(i,s);var c=aa(i,i===Pt?It:0);if(c===0)l!==null&&Rf(l),i.callbackNode=null,i.callbackPriority=0;else if(s=c&-c,i.callbackPriority!==s){if(l!=null&&Rf(l),s===1)i.tag===0?Hx(Hp.bind(null,i)):Tf(Hp.bind(null,i)),sr?Rr(function(){!(we&6)&&Qr()}):Qu(Yu,Qr),l=null;else{switch(Pf(c)){case 1:l=Yu;break;case 4:l=Ux;break;case 16:l=Gu;break;case 536870912:l=Bx;break;default:l=Gu}l=Jp(l,Wp.bind(null,i))}i.callbackPriority=s,i.callbackNode=l}}function Wp(i,s){if(Va=-1,Wa=0,we&6)throw Error(u(327));var l=i.callbackNode;if(dn()&&i.callbackNode!==l)return null;var c=aa(i,i===Pt?It:0);if(c===0)return null;if(c&30||c&i.expiredLanes||s)s=Ha(i,c);else{s=c;var d=we;we|=2;var m=Yp();(Pt!==i||It!==s)&&(mi=null,ns(),cn(i,s));do try{dS();break}catch(C){Qp(i,C)}while(!0);rc(),Fa.current=m,we=d,ht!==null?s=0:(Pt=null,It=0,s=wt)}if(s!==0){if(s===2&&(d=Wu(i),d!==0&&(c=d,s=Hc(i,d))),s===1)throw l=no,cn(i,0),ki(i,c),Xt(i,Et()),l;if(s===6)ki(i,c);else{if(d=i.current.alternate,!(c&30)&&!cS(d)&&(s=Ha(i,c),s===2&&(m=Wu(i),m!==0&&(c=m,s=Hc(i,m))),s===1))throw l=no,cn(i,0),ki(i,c),Xt(i,Et()),l;switch(i.finishedWork=d,i.finishedLanes=c,s){case 0:case 1:throw Error(u(345));case 2:hn(i,Gt,mi);break;case 3:if(ki(i,c),(c&130023424)===c&&(s=Uc+500-Et(),10<s)){if(aa(i,0)!==0)break;if(d=i.suspendedLanes,(d&c)!==c){zt(),i.pingedLanes|=i.suspendedLanes&d;break}i.timeoutHandle=Br(hn.bind(null,i,Gt,mi),s);break}hn(i,Gt,mi);break;case 4:if(ki(i,c),(c&4194240)===c)break;for(s=i.eventTimes,d=-1;0<c;){var y=31-Ir(c);m=1<<y,y=s[y],y>d&&(d=y),c&=~m}if(c=d,c=Et()-c,c=(120>c?120:480>c?480:1080>c?1080:1920>c?1920:3e3>c?3e3:4320>c?4320:1960*uS(c/1960))-c,10<c){i.timeoutHandle=Br(hn.bind(null,i,Gt,mi),c);break}hn(i,Gt,mi);break;case 5:hn(i,Gt,mi);break;default:throw Error(u(329))}}}return Xt(i,Et()),i.callbackNode===l?Wp.bind(null,i):null}function Hc(i,s){var l=so;return i.current.memoizedState.isDehydrated&&(cn(i,s).flags|=256),i=Ha(i,s),i!==2&&(s=Gt,Gt=l,s!==null&&qc(s)),i}function qc(i){Gt===null?Gt=i:Gt.push.apply(Gt,i)}function cS(i){for(var s=i;;){if(s.flags&16384){var l=s.updateQueue;if(l!==null&&(l=l.stores,l!==null))for(var c=0;c<l.length;c++){var d=l[c],m=d.getSnapshot;d=d.value;try{if(!_r(m(),d))return!1}catch{return!1}}}if(l=s.child,s.subtreeFlags&16384&&l!==null)l.return=s,s=l;else{if(s===i)break;for(;s.sibling===null;){if(s.return===null||s.return===i)return!0;s=s.return}s.sibling.return=s.return,s=s.sibling}}return!0}function ki(i,s){for(s&=~jc,s&=~Da,i.suspendedLanes|=s,i.pingedLanes&=~s,i=i.expirationTimes;0<s;){var l=31-Ir(s),c=1<<l;i[l]=-1,s&=~c}}function Hp(i){if(we&6)throw Error(u(327));dn();var s=aa(i,0);if(!(s&1))return Xt(i,Et()),null;var l=Ha(i,s);if(i.tag!==0&&l===2){var c=Wu(i);c!==0&&(s=c,l=Hc(i,c))}if(l===1)throw l=no,cn(i,0),ki(i,s),Xt(i,Et()),l;if(l===6)throw Error(u(345));return i.finishedWork=i.current.alternate,i.finishedLanes=s,hn(i,Gt,mi),Xt(i,Et()),null}function qp(i){Oi!==null&&Oi.tag===0&&!(we&6)&&dn();var s=we;we|=1;var l=ut.transition,c=_e;try{if(ut.transition=null,_e=1,i)return i()}finally{_e=c,ut.transition=l,we=s,!(we&6)&&Qr()}}function Qc(){ar=is.current,We(is)}function cn(i,s){i.finishedWork=null,i.finishedLanes=0;var l=i.timeoutHandle;if(l!==li&&(i.timeoutHandle=li,Dt(l)),ht!==null)for(l=ht.return;l!==null;){var c=l;switch(Zu(c),c.tag){case 1:c=c.type.childContextTypes,c!=null&&ia();break;case 3:es(),We(qt),We(Ot),dc();break;case 5:cc(c);break;case 4:es();break;case 13:We(Je);break;case 19:We(Je);break;case 10:ic(c.type._context);break;case 22:case 23:Qc()}l=l.return}if(Pt=i,ht=i=Li(i.current,null),It=ar=s,wt=0,no=null,jc=Da=un=0,Gt=so=null,an!==null){for(s=0;s<an.length;s++)if(l=an[s],c=l.interleaved,c!==null){l.interleaved=null;var d=c.next,m=l.pending;if(m!==null){var y=m.next;m.next=d,c.next=y}l.pending=c}an=null}return i}function Qp(i,s){do{var l=ht;try{if(rc(),wa.current=Ca,Aa){for(var c=et.memoizedState;c!==null;){var d=c.queue;d!==null&&(d.pending=null),c=c.next}Aa=!1}if(ln=0,Ct=St=et=null,Xs=!1,$s=0,Dc.current=null,l===null||l.return===null){wt=1,no=s,ht=null;break}e:{var m=i,y=l.return,C=l,M=s;if(s=It,C.flags|=32768,M!==null&&typeof M=="object"&&typeof M.then=="function"){var Y=M,ne=C,pe=ne.tag;if(!(ne.mode&1)&&(pe===0||pe===11||pe===15)){var Z=ne.alternate;Z?(ne.updateQueue=Z.updateQueue,ne.memoizedState=Z.memoizedState,ne.lanes=Z.lanes):(ne.updateQueue=null,ne.memoizedState=null)}var He=vp(y);if(He!==null){He.flags&=-257,yp(He,y,C,m,s),He.mode&1&&gp(m,Y,s),s=He,M=Y;var Fe=s.updateQueue;if(Fe===null){var $t=new Set;$t.add(M),s.updateQueue=$t}else Fe.add(M);break e}else{if(!(s&1)){gp(m,Y,s),Yc();break e}M=Error(u(426))}}else if(Qe&&C.mode&1){var gi=vp(y);if(gi!==null){!(gi.flags&65536)&&(gi.flags|=256),yp(gi,y,C,m,s),ec(ts(M,C));break e}}m=M=ts(M,C),wt!==4&&(wt=2),so===null?so=[m]:so.push(m),m=y;do{switch(m.tag){case 3:m.flags|=65536,s&=-s,m.lanes|=s;var O=pp(m,M,s);Ff(m,O);break e;case 1:C=M;var R=m.type,k=m.stateNode;if(!(m.flags&128)&&(typeof R.getDerivedStateFromError=="function"||k!==null&&typeof k.componentDidCatch=="function"&&(_i===null||!_i.has(k)))){m.flags|=65536,s&=-s,m.lanes|=s;var K=mp(m,C,s);Ff(m,K);break e}}m=m.return}while(m!==null)}Xp(l)}catch(ue){s=ue,ht===l&&l!==null&&(ht=l=l.return);continue}break}while(!0)}function Yp(){var i=Fa.current;return Fa.current=Ca,i===null?Ca:i}function Yc(){(wt===0||wt===3||wt===2)&&(wt=4),Pt===null||!(un&268435455)&&!(Da&268435455)||ki(Pt,It)}function Ha(i,s){var l=we;we|=2;var c=Yp();(Pt!==i||It!==s)&&(mi=null,cn(i,s));do try{hS();break}catch(d){Qp(i,d)}while(!0);if(rc(),we=l,Fa.current=c,ht!==null)throw Error(u(261));return Pt=null,It=0,wt}function hS(){for(;ht!==null;)Gp(ht)}function dS(){for(;ht!==null&&!Dx();)Gp(ht)}function Gp(i){var s=Kp(i.alternate,i,ar);i.memoizedProps=i.pendingProps,s===null?Xp(i):ht=s,Dc.current=null}function Xp(i){var s=i;do{var l=s.alternate;if(i=s.return,s.flags&32768){if(l=sS(l,s),l!==null){l.flags&=32767,ht=l;return}if(i!==null)i.flags|=32768,i.subtreeFlags=0,i.deletions=null;else{wt=6,ht=null;return}}else if(l=nS(l,s,ar),l!==null){ht=l;return}if(s=s.sibling,s!==null){ht=s;return}ht=s=i}while(s!==null);wt===0&&(wt=5)}function hn(i,s,l){var c=_e,d=ut.transition;try{ut.transition=null,_e=1,fS(i,s,l,c)}finally{ut.transition=d,_e=c}return null}function fS(i,s,l,c){do dn();while(Oi!==null);if(we&6)throw Error(u(327));l=i.finishedWork;var d=i.finishedLanes;if(l===null)return null;if(i.finishedWork=null,i.finishedLanes=0,l===i.current)throw Error(u(177));i.callbackNode=null,i.callbackPriority=0;var m=l.lanes|l.childLanes;if(Fx(i,m),i===Pt&&(ht=Pt=null,It=0),!(l.subtreeFlags&2064)&&!(l.flags&2064)||Ua||(Ua=!0,Jp(Gu,function(){return dn(),null})),m=(l.flags&15990)!==0,l.subtreeFlags&15990||m){m=ut.transition,ut.transition=null;var y=_e;_e=1;var C=we;we|=4,Dc.current=null,aS(i,l),Fp(l,i),Pe(i.containerInfo),i.current=l,lS(l,i,d),jx(),we=C,_e=y,ut.transition=m}else i.current=l;if(Ua&&(Ua=!1,Oi=i,Ba=d),m=i.pendingLanes,m===0&&(_i=null),Vx(l.stateNode,c),Xt(i,Et()),s!==null)for(c=i.onRecoverableError,l=0;l<s.length;l++)d=s[l],c(d.value,{componentStack:d.stack,digest:d.digest});if(ja)throw ja=!1,i=Vc,Vc=null,i;return Ba&1&&i.tag!==0&&dn(),m=i.pendingLanes,m&1?i===Wc?oo++:(oo=0,Wc=i):oo=0,Qr(),null}function dn(){if(Oi!==null){var i=Pf(Ba),s=ut.transition,l=_e;try{if(ut.transition=null,_e=16>i?16:i,Oi===null)var c=!1;else{if(i=Oi,Oi=null,Ba=0,we&6)throw Error(u(331));var d=we;for(we|=4,ie=i.current;ie!==null;){var m=ie,y=m.child;if(ie.flags&16){var C=m.deletions;if(C!==null){for(var M=0;M<C.length;M++){var Y=C[M];for(ie=Y;ie!==null;){var ne=ie;switch(ne.tag){case 0:case 11:case 15:ro(8,ne,m)}var pe=ne.child;if(pe!==null)pe.return=ne,ie=pe;else for(;ie!==null;){ne=ie;var Z=ne.sibling,He=ne.return;if(kp(ne),ne===Y){ie=null;break}if(Z!==null){Z.return=He,ie=Z;break}ie=He}}}var Fe=m.alternate;if(Fe!==null){var $t=Fe.child;if($t!==null){Fe.child=null;do{var gi=$t.sibling;$t.sibling=null,$t=gi}while($t!==null)}}ie=m}}if(m.subtreeFlags&2064&&y!==null)y.return=m,ie=y;else e:for(;ie!==null;){if(m=ie,m.flags&2048)switch(m.tag){case 0:case 11:case 15:ro(9,m,m.return)}var O=m.sibling;if(O!==null){O.return=m.return,ie=O;break e}ie=m.return}}var R=i.current;for(ie=R;ie!==null;){y=ie;var k=y.child;if(y.subtreeFlags&2064&&k!==null)k.return=y,ie=k;else e:for(y=R;ie!==null;){if(C=ie,C.flags&2048)try{switch(C.tag){case 0:case 11:case 15:Oa(9,C)}}catch(ue){Ye(C,C.return,ue)}if(C===y){ie=null;break e}var K=C.sibling;if(K!==null){K.return=C.return,ie=K;break e}ie=C.return}}if(we=d,Qr(),qr&&typeof qr.onPostCommitFiberRoot=="function")try{qr.onPostCommitFiberRoot(la,i)}catch{}c=!0}return c}finally{_e=l,ut.transition=s}}return!1}function $p(i,s,l){s=ts(l,s),s=pp(i,s,1),i=Ii(i,s,1),s=zt(),i!==null&&(Hs(i,1,s),Xt(i,s))}function Ye(i,s,l){if(i.tag===3)$p(i,i,l);else for(;s!==null;){if(s.tag===3){$p(s,i,l);break}else if(s.tag===1){var c=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof c.componentDidCatch=="function"&&(_i===null||!_i.has(c))){i=ts(l,i),i=mp(s,i,1),s=Ii(s,i,1),i=zt(),s!==null&&(Hs(s,1,i),Xt(s,i));break}}s=s.return}}function pS(i,s,l){var c=i.pingCache;c!==null&&c.delete(s),s=zt(),i.pingedLanes|=i.suspendedLanes&l,Pt===i&&(It&l)===l&&(wt===4||wt===3&&(It&130023424)===It&&500>Et()-Uc?cn(i,0):jc|=l),Xt(i,s)}function Zp(i,s){s===0&&(i.mode&1?(s=oa,oa<<=1,!(oa&130023424)&&(oa=4194304)):s=1);var l=zt();i=Yr(i,s),i!==null&&(Hs(i,s,l),Xt(i,l))}function mS(i){var s=i.memoizedState,l=0;s!==null&&(l=s.retryLane),Zp(i,l)}function gS(i,s){var l=0;switch(i.tag){case 13:var c=i.stateNode,d=i.memoizedState;d!==null&&(l=d.retryLane);break;case 19:c=i.stateNode;break;default:throw Error(u(314))}c!==null&&c.delete(s),Zp(i,l)}var Kp;Kp=function(i,s,l){if(i!==null)if(i.memoizedProps!==s.pendingProps||qt.current)Yt=!0;else{if(!(i.lanes&l)&&!(s.flags&128))return Yt=!1,iS(i,s,l);Yt=!!(i.flags&131072)}else Yt=!1,Qe&&s.flags&1048576&&If(s,ha,s.index);switch(s.lanes=0,s.tag){case 2:var c=s.type;Ra(i,s),i=s.pendingProps;var d=Qn(s,Ot.current);Zn(s,l),d=mc(null,s,c,i,d,l);var m=gc();return s.flags|=1,typeof d=="object"&&d!==null&&typeof d.render=="function"&&d.$$typeof===void 0?(s.tag=1,s.memoizedState=null,s.updateQueue=null,Qt(c)?(m=!0,na(s)):m=!1,s.memoizedState=d.state!==null&&d.state!==void 0?d.state:null,oc(s),d.updater=ya,s.stateNode=d,d._reactInternals=s,lc(s,c,i,l),s=Ec(null,s,c,!0,m,l)):(s.tag=0,Qe&&m&&$u(s),jt(null,s,d,l),s=s.child),s;case 16:c=s.elementType;e:{switch(Ra(i,s),i=s.pendingProps,d=c._init,c=d(c._payload),s.type=c,d=s.tag=yS(c),i=Mr(c,i),d){case 0:s=bc(null,s,c,i,l);break e;case 1:s=Ep(null,s,c,i,l);break e;case 11:s=xp(null,s,c,i,l);break e;case 14:s=Sp(null,s,c,Mr(c.type,i),l);break e}throw Error(u(306,c,""))}return s;case 0:return c=s.type,d=s.pendingProps,d=s.elementType===c?d:Mr(c,d),bc(i,s,c,d,l);case 1:return c=s.type,d=s.pendingProps,d=s.elementType===c?d:Mr(c,d),Ep(i,s,c,d,l);case 3:e:{if(Cp(s),i===null)throw Error(u(387));c=s.pendingProps,m=s.memoizedState,d=m.element,Nf(i,s),va(s,c,null,l);var y=s.memoizedState;if(c=y.element,$&&m.isDehydrated)if(m={element:c,isDehydrated:!1,cache:y.cache,pendingSuspenseBoundaries:y.pendingSuspenseBoundaries,transitions:y.transitions},s.updateQueue.baseState=m,s.memoizedState=m,s.flags&256){d=ts(Error(u(423)),s),s=Pp(i,s,c,l,d);break e}else if(c!==d){d=ts(Error(u(424)),s),s=Pp(i,s,c,l,d);break e}else for($&&(gr=yx(s.stateNode.containerInfo),or=s,Qe=!0,Or=null,qs=!1),l=qf(s,null,c,l),s.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling;else{if(Xn(),c===d){s=pi(i,s,l);break e}jt(i,s,c,l)}s=s.child}return s;case 5:return Qf(s),i===null&&Ju(s),c=s.type,d=s.pendingProps,m=i!==null?i.memoizedProps:null,y=d.children,$e(c,d)?y=null:m!==null&&$e(c,m)&&(s.flags|=32),bp(i,s),jt(i,s,y,l),s.child;case 6:return i===null&&Ju(s),null;case 13:return Rp(i,s,l);case 4:return uc(s,s.stateNode.containerInfo),c=s.pendingProps,i===null?s.child=Kn(s,null,c,l):jt(i,s,c,l),s.child;case 11:return c=s.type,d=s.pendingProps,d=s.elementType===c?d:Mr(c,d),xp(i,s,c,d,l);case 7:return jt(i,s,s.pendingProps,l),s.child;case 8:return jt(i,s,s.pendingProps.children,l),s.child;case 12:return jt(i,s,s.pendingProps.children,l),s.child;case 10:e:{if(c=s.type._context,d=s.pendingProps,m=s.memoizedProps,y=d.value,Lf(s,c,y),m!==null)if(_r(m.value,y)){if(m.children===d.children&&!qt.current){s=pi(i,s,l);break e}}else for(m=s.child,m!==null&&(m.return=s);m!==null;){var C=m.dependencies;if(C!==null){y=m.child;for(var M=C.firstContext;M!==null;){if(M.context===c){if(m.tag===1){M=fi(-1,l&-l),M.tag=2;var Y=m.updateQueue;if(Y!==null){Y=Y.shared;var ne=Y.pending;ne===null?M.next=M:(M.next=ne.next,ne.next=M),Y.pending=M}}m.lanes|=l,M=m.alternate,M!==null&&(M.lanes|=l),nc(m.return,l,s),C.lanes|=l;break}M=M.next}}else if(m.tag===10)y=m.type===s.type?null:m.child;else if(m.tag===18){if(y=m.return,y===null)throw Error(u(341));y.lanes|=l,C=y.alternate,C!==null&&(C.lanes|=l),nc(y,l,s),y=m.sibling}else y=m.child;if(y!==null)y.return=m;else for(y=m;y!==null;){if(y===s){y=null;break}if(m=y.sibling,m!==null){m.return=y.return,y=m;break}y=y.return}m=y}jt(i,s,d.children,l),s=s.child}return s;case 9:return d=s.type,c=s.pendingProps.children,Zn(s,l),d=vr(d),c=c(d),s.flags|=1,jt(i,s,c,l),s.child;case 14:return c=s.type,d=Mr(c,s.pendingProps),d=Mr(c.type,d),Sp(i,s,c,d,l);case 15:return wp(i,s,s.type,s.pendingProps,l);case 17:return c=s.type,d=s.pendingProps,d=s.elementType===c?d:Mr(c,d),Ra(i,s),s.tag=1,Qt(c)?(i=!0,na(s)):i=!1,Zn(s,l),Bf(s,c,d),lc(s,c,d,l),Ec(null,s,c,!0,i,l);case 19:return Ip(i,s,l);case 22:return Ap(i,s,l)}throw Error(u(156,s.tag))};function Jp(i,s){return Qu(i,s)}function vS(i,s,l,c){this.tag=i,this.key=l,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=s,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=c,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function wr(i,s,l,c){return new vS(i,s,l,c)}function Gc(i){return i=i.prototype,!(!i||!i.isReactComponent)}function yS(i){if(typeof i=="function")return Gc(i)?1:0;if(i!=null){if(i=i.$$typeof,i===A)return 11;if(i===I)return 14}return 2}function Li(i,s){var l=i.alternate;return l===null?(l=wr(i.tag,s,i.key,i.mode),l.elementType=i.elementType,l.type=i.type,l.stateNode=i.stateNode,l.alternate=i,i.alternate=l):(l.pendingProps=s,l.type=i.type,l.flags=0,l.subtreeFlags=0,l.deletions=null),l.flags=i.flags&14680064,l.childLanes=i.childLanes,l.lanes=i.lanes,l.child=i.child,l.memoizedProps=i.memoizedProps,l.memoizedState=i.memoizedState,l.updateQueue=i.updateQueue,s=i.dependencies,l.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},l.sibling=i.sibling,l.index=i.index,l.ref=i.ref,l}function qa(i,s,l,c,d,m){var y=2;if(c=i,typeof i=="function")Gc(i)&&(y=1);else if(typeof i=="string")y=5;else e:switch(i){case p:return fn(l.children,d,m,s);case v:y=8,d|=8;break;case x:return i=wr(12,l,s,d|2),i.elementType=x,i.lanes=m,i;case E:return i=wr(13,l,s,d),i.elementType=E,i.lanes=m,i;case P:return i=wr(19,l,s,d),i.elementType=P,i.lanes=m,i;case X:return Qa(l,d,m,s);default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case b:y=10;break e;case w:y=9;break e;case A:y=11;break e;case I:y=14;break e;case F:y=16,c=null;break e}throw Error(u(130,i==null?i:typeof i,""))}return s=wr(y,l,s,d),s.elementType=i,s.type=c,s.lanes=m,s}function fn(i,s,l,c){return i=wr(7,i,c,s),i.lanes=l,i}function Qa(i,s,l,c){return i=wr(22,i,c,s),i.elementType=X,i.lanes=l,i.stateNode={isHidden:!1},i}function Xc(i,s,l){return i=wr(6,i,null,s),i.lanes=l,i}function $c(i,s,l){return s=wr(4,i.children!==null?i.children:[],i.key,s),s.lanes=l,s.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},s}function xS(i,s,l,c,d){this.tag=s,this.containerInfo=i,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=li,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Hu(0),this.expirationTimes=Hu(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Hu(0),this.identifierPrefix=c,this.onRecoverableError=d,$&&(this.mutableSourceEagerHydrationData=null)}function em(i,s,l,c,d,m,y,C,M){return i=new xS(i,s,l,C,M),s===1?(s=1,m===!0&&(s|=8)):s=0,m=wr(3,null,null,s),i.current=m,m.stateNode=i,m.memoizedState={element:c,isDehydrated:l,cache:null,transitions:null,pendingSuspenseBoundaries:null},oc(m),i}function tm(i){if(!i)return Ri;i=i._reactInternals;e:{if(j(i)!==i||i.tag!==1)throw Error(u(170));var s=i;do{switch(s.tag){case 3:s=s.stateNode.context;break e;case 1:if(Qt(s.type)){s=s.stateNode.__reactInternalMemoizedMergedChildContext;break e}}s=s.return}while(s!==null);throw Error(u(171))}if(i.tag===1){var l=i.type;if(Qt(l))return bf(i,l,s)}return s}function rm(i){var s=i._reactInternals;if(s===void 0)throw typeof i.render=="function"?Error(u(188)):(i=Object.keys(i).join(","),Error(u(268,i)));return i=he(s),i===null?null:i.stateNode}function im(i,s){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var l=i.retryLane;i.retryLane=l!==0&&l<s?l:s}}function Ya(i,s){im(i,s),(i=i.alternate)&&im(i,s)}function SS(i){return i=he(i),i===null?null:i.stateNode}function wS(){return null}return r.attemptContinuousHydration=function(i){if(i.tag===13){var s=Yr(i,134217728);if(s!==null){var l=zt();Sr(s,i,134217728,l)}Ya(i,134217728)}},r.attemptDiscreteHydration=function(i){if(i.tag===13){var s=Yr(i,1);if(s!==null){var l=zt();Sr(s,i,1,l)}Ya(i,1)}},r.attemptHydrationAtCurrentPriority=function(i){if(i.tag===13){var s=Mi(i),l=Yr(i,s);if(l!==null){var c=zt();Sr(l,i,s,c)}Ya(i,s)}},r.attemptSynchronousHydration=function(i){switch(i.tag){case 3:var s=i.stateNode;if(s.current.memoizedState.isDehydrated){var l=Ws(s.pendingLanes);l!==0&&(qu(s,l|1),Xt(s,Et()),!(we&6)&&(ns(),Qr()))}break;case 13:qp(function(){var c=Yr(i,1);if(c!==null){var d=zt();Sr(c,i,1,d)}}),Ya(i,1)}},r.batchedUpdates=function(i,s){var l=we;we|=1;try{return i(s)}finally{we=l,we===0&&(ns(),ua&&Qr())}},r.createComponentSelector=function(i){return{$$typeof:Ma,value:i}},r.createContainer=function(i,s,l,c,d,m,y){return em(i,s,!1,null,l,c,d,m,y)},r.createHasPseudoClassSelector=function(i){return{$$typeof:ka,value:i}},r.createHydrationContainer=function(i,s,l,c,d,m,y,C,M){return i=em(l,c,!0,i,d,m,y,C,M),i.context=tm(null),l=i.current,c=zt(),d=Mi(l),m=fi(c,d),m.callback=s??null,Ii(l,m,d),i.current.lanes=d,Hs(i,d,c),Xt(i,c),i},r.createPortal=function(i,s,l){var c=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:g,key:c==null?null:""+c,children:i,containerInfo:s,implementation:l}},r.createRoleSelector=function(i){return{$$typeof:La,value:i}},r.createTestNameSelector=function(i){return{$$typeof:za,value:i}},r.createTextSelector=function(i){return{$$typeof:Na,value:i}},r.deferredUpdates=function(i){var s=_e,l=ut.transition;try{return ut.transition=null,_e=16,i()}finally{_e=s,ut.transition=l}},r.discreteUpdates=function(i,s,l,c,d){var m=_e,y=ut.transition;try{return ut.transition=null,_e=1,i(s,l,c,d)}finally{_e=m,ut.transition=y,we===0&&ns()}},r.findAllNodes=Fc,r.findBoundingRects=function(i,s){if(!Wr)throw Error(u(363));s=Fc(i,s),i=[];for(var l=0;l<s.length;l++)i.push(ea(s[l]));for(s=i.length-1;0<s;s--){l=i[s];for(var c=l.x,d=c+l.width,m=l.y,y=m+l.height,C=s-1;0<=C;C--)if(s!==C){var M=i[C],Y=M.x,ne=Y+M.width,pe=M.y,Z=pe+M.height;if(c>=Y&&m>=pe&&d<=ne&&y<=Z){i.splice(s,1);break}else if(c!==Y||l.width!==M.width||Z<m||pe>y){if(!(m!==pe||l.height!==M.height||ne<c||Y>d)){Y>c&&(M.width+=Y-c,M.x=c),ne<d&&(M.width=d-Y),i.splice(s,1);break}}else{pe>m&&(M.height+=pe-m,M.y=m),Z<y&&(M.height=y-pe),i.splice(s,1);break}}}return i},r.findHostInstance=rm,r.findHostInstanceWithNoPortals=function(i){return i=ee(i),i=i!==null?Re(i):null,i===null?null:i.stateNode},r.findHostInstanceWithWarning=function(i){return rm(i)},r.flushControlled=function(i){var s=we;we|=1;var l=ut.transition,c=_e;try{ut.transition=null,_e=1,i()}finally{_e=c,ut.transition=l,we=s,we===0&&(ns(),Qr())}},r.flushPassiveEffects=dn,r.flushSync=qp,r.focusWithin=function(i,s){if(!Wr)throw Error(u(363));for(i=Lc(i),s=Vp(i,s),s=Array.from(s),i=0;i<s.length;){var l=s[i++];if(!Hr(l)){if(l.tag===5&&Fu(l.stateNode))return!0;for(l=l.child;l!==null;)s.push(l),l=l.sibling}}return!1},r.getCurrentUpdatePriority=function(){return _e},r.getFindAllNodesFailureDescription=function(i,s){if(!Wr)throw Error(u(363));var l=0,c=[];i=[Lc(i),0];for(var d=0;d<i.length;){var m=i[d++],y=i[d++],C=s[y];if((m.tag!==5||!Hr(m))&&(zc(m,C)&&(c.push(Nc(C)),y++,y>l&&(l=y)),y<s.length))for(m=m.child;m!==null;)i.push(m,y),m=m.sibling}if(l<s.length){for(i=[];l<s.length;l++)i.push(Nc(s[l]));return`findAllNodes was able to match part of the selector:
|
|
8
|
+
`+(c.join(" > ")+`
|
|
9
|
+
|
|
10
|
+
No matching component was found for:
|
|
11
|
+
`)+i.join(" > ")}return null},r.getPublicRootInstance=function(i){if(i=i.current,!i.child)return null;switch(i.child.tag){case 5:return ge(i.child.stateNode);default:return i.child.stateNode}},r.injectIntoDevTools=function(i){if(i={bundleType:i.bundleType,version:i.version,rendererPackageName:i.rendererPackageName,rendererConfig:i.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:h.ReactCurrentDispatcher,findHostInstanceByFiber:SS,findFiberByHostInstance:i.findFiberByHostInstance||wS,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.2.0"},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")i=!1;else{var s=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(s.isDisabled||!s.supportsFiber)i=!0;else{try{la=s.inject(i),qr=s}catch{}i=!!s.checkDCE}}return i},r.isAlreadyRendering=function(){return!1},r.observeVisibleRects=function(i,s,l,c){if(!Wr)throw Error(u(363));i=Fc(i,s);var d=B(i,l,c).disconnect;return{disconnect:function(){d()}}},r.registerMutableSourceForHydration=function(i,s){var l=s._getVersion;l=l(s._source),i.mutableSourceEagerHydrationData==null?i.mutableSourceEagerHydrationData=[s,l]:i.mutableSourceEagerHydrationData.push(s,l)},r.runWithPriority=function(i,s){var l=_e;try{return _e=i,s()}finally{_e=l}},r.shouldError=function(){return null},r.shouldSuspend=function(){return!1},r.updateContainer=function(i,s,l,c){var d=s.current,m=zt(),y=Mi(d);return l=tm(l),s.context===null?s.context=l:s.pendingContext=l,s=fi(m,y),s.payload={element:i},c=c===void 0?null:c,c!==null&&(s.callback=c),i=Ii(d,s,y),i!==null&&(Sr(i,d,y,m),ga(i,d,y)),y},r}});var eg=dt((nC,Jm)=>{"use strict";Jm.exports=Km()});var fl=dt((gC,Ig)=>{"use strict";Ig.exports=ReactDOM});var Og=dt(Ih=>{"use strict";var _g=fl();Ih.createRoot=_g.createRoot,Ih.hydrateRoot=_g.hydrateRoot;var vC});var $y=dt(Xy=>{"use strict";var Rs=q();function ab(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var lb=typeof Object.is=="function"?Object.is:ab,ub=Rs.useState,cb=Rs.useEffect,hb=Rs.useLayoutEffect,db=Rs.useDebugValue;function fb(e,t){var r=t(),n=ub({inst:{value:r,getSnapshot:t}}),o=n[0].inst,a=n[1];return hb(function(){o.value=r,o.getSnapshot=t,Td(o)&&a({inst:o})},[e,r,t]),cb(function(){return Td(o)&&a({inst:o}),e(function(){Td(o)&&a({inst:o})})},[e]),db(r),r}function Td(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!lb(e,r)}catch{return!0}}function pb(e,t){return t()}var mb=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?pb:fb;Xy.useSyncExternalStore=Rs.useSyncExternalStore!==void 0?Rs.useSyncExternalStore:mb});var Ky=dt((jR,Zy)=>{"use strict";Zy.exports=$y()});var e0=dt(Jy=>{"use strict";var pu=q(),gb=Ky();function vb(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var yb=typeof Object.is=="function"?Object.is:vb,xb=gb.useSyncExternalStore,Sb=pu.useRef,wb=pu.useEffect,Ab=pu.useMemo,bb=pu.useDebugValue;Jy.useSyncExternalStoreWithSelector=function(e,t,r,n,o){var a=Sb(null);if(a.current===null){var u={hasValue:!1,value:null};a.current=u}else u=a.current;a=Ab(function(){function f(b){if(!g){if(g=!0,p=b,b=n(b),o!==void 0&&u.hasValue){var w=u.value;if(o(w,b))return v=w}return v=b}if(w=v,yb(p,b))return w;var A=n(b);return o!==void 0&&o(w,A)?w:(p=b,v=A)}var g=!1,p,v,x=r===void 0?null:r;return[function(){return f(t())},x===null?void 0:function(){return f(x())}]},[t,r,n,o]);var h=xb(e,a[0],a[1]);return wb(function(){u.hasValue=!0,u.value=h},[h]),bb(h),h}});var r0=dt((BR,t0)=>{"use strict";t0.exports=e0()});var ax=dt((kM,ox)=>{"use strict";(()=>{var e={296:(o,a,u)=>{var h=/^\s+|\s+$/g,f=/^[-+]0x[0-9a-f]+$/i,g=/^0b[01]+$/i,p=/^0o[0-7]+$/i,v=parseInt,x=typeof u.g=="object"&&u.g&&u.g.Object===Object&&u.g,b=typeof self=="object"&&self&&self.Object===Object&&self,w=x||b||Function("return this")(),A=Object.prototype.toString,E=Math.max,P=Math.min,I=function(){return w.Date.now()};function F(W){var L=typeof W;return!!W&&(L=="object"||L=="function")}function X(W){if(typeof W=="number")return W;if(function(D){return typeof D=="symbol"||function(j){return!!j&&typeof j=="object"}(D)&&A.call(D)=="[object Symbol]"}(W))return NaN;if(F(W)){var L=typeof W.valueOf=="function"?W.valueOf():W;W=F(L)?L+"":L}if(typeof W!="string")return W===0?W:+W;W=W.replace(h,"");var N=g.test(W);return N||p.test(W)?v(W.slice(2),N?2:8):f.test(W)?NaN:+W}o.exports=function(W,L,N){var D,j,se,ee,he,Ae,Re=0,Te=!1,ge=!1,lt=!0;if(typeof W!="function")throw new TypeError("Expected a function");function ce(De){var Xe=D,$e=j;return D=j=void 0,Re=De,ee=W.apply($e,Xe)}function st(De){var Xe=De-Ae;return Ae===void 0||Xe>=L||Xe<0||ge&&De-Re>=se}function Pe(){var De=I();if(st(De))return V(De);he=setTimeout(Pe,function(Xe){var $e=L-(Xe-Ae);return ge?P($e,se-(Xe-Re)):$e}(De))}function V(De){return he=void 0,lt&&D?ce(De):(D=j=void 0,ee)}function fe(){var De=I(),Xe=st(De);if(D=arguments,j=this,Ae=De,Xe){if(he===void 0)return function($e){return Re=$e,he=setTimeout(Pe,L),Te?ce($e):ee}(Ae);if(ge)return he=setTimeout(Pe,L),ce(Ae)}return he===void 0&&(he=setTimeout(Pe,L)),ee}return L=X(L)||0,F(N)&&(Te=!!N.leading,se=(ge="maxWait"in N)?E(X(N.maxWait)||0,L):se,lt="trailing"in N?!!N.trailing:lt),fe.cancel=function(){he!==void 0&&clearTimeout(he),Re=0,D=Ae=j=he=void 0},fe.flush=function(){return he===void 0?ee:V(I())},fe}},96:(o,a,u)=>{var h="Expected a function",f=NaN,g="[object Symbol]",p=/^\s+|\s+$/g,v=/^[-+]0x[0-9a-f]+$/i,x=/^0b[01]+$/i,b=/^0o[0-7]+$/i,w=parseInt,A=typeof u.g=="object"&&u.g&&u.g.Object===Object&&u.g,E=typeof self=="object"&&self&&self.Object===Object&&self,P=A||E||Function("return this")(),I=Object.prototype.toString,F=Math.max,X=Math.min,W=function(){return P.Date.now()};function L(D){var j=typeof D;return!!D&&(j=="object"||j=="function")}function N(D){if(typeof D=="number")return D;if(function(ee){return typeof ee=="symbol"||function(he){return!!he&&typeof he=="object"}(ee)&&I.call(ee)==g}(D))return f;if(L(D)){var j=typeof D.valueOf=="function"?D.valueOf():D;D=L(j)?j+"":j}if(typeof D!="string")return D===0?D:+D;D=D.replace(p,"");var se=x.test(D);return se||b.test(D)?w(D.slice(2),se?2:8):v.test(D)?f:+D}o.exports=function(D,j,se){var ee=!0,he=!0;if(typeof D!="function")throw new TypeError(h);return L(se)&&(ee="leading"in se?!!se.leading:ee,he="trailing"in se?!!se.trailing:he),function(Ae,Re,Te){var ge,lt,ce,st,Pe,V,fe=0,De=!1,Xe=!1,$e=!0;if(typeof Ae!="function")throw new TypeError(h);function Pr(Ie){var Ze=ge,$=lt;return ge=lt=void 0,fe=Ie,st=Ae.apply($,Ze)}function Br(Ie){var Ze=Ie-V;return V===void 0||Ze>=Re||Ze<0||Xe&&Ie-fe>=ce}function Dt(){var Ie=W();if(Br(Ie))return li(Ie);Pe=setTimeout(Dt,function(Ze){var $=Re-(Ze-V);return Xe?X($,ce-(Ze-fe)):$}(Ie))}function li(Ie){return Pe=void 0,$e&&ge?Pr(Ie):(ge=lt=void 0,st)}function nr(){var Ie=W(),Ze=Br(Ie);if(ge=arguments,lt=this,V=Ie,Ze){if(Pe===void 0)return function($){return fe=$,Pe=setTimeout(Dt,Re),De?Pr($):st}(V);if(Xe)return Pe=setTimeout(Dt,Re),Pr(V)}return Pe===void 0&&(Pe=setTimeout(Dt,Re)),st}return Re=N(Re)||0,L(Te)&&(De=!!Te.leading,ce=(Xe="maxWait"in Te)?F(N(Te.maxWait)||0,Re):ce,$e="trailing"in Te?!!Te.trailing:$e),nr.cancel=function(){Pe!==void 0&&clearTimeout(Pe),fe=0,ge=V=lt=Pe=void 0},nr.flush=function(){return Pe===void 0?st:li(W())},nr}(D,j,{leading:ee,maxWait:j,trailing:he})}},703:(o,a,u)=>{"use strict";var h=u(414);function f(){}function g(){}g.resetWarningCache=f,o.exports=function(){function p(b,w,A,E,P,I){if(I!==h){var F=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw F.name="Invariant Violation",F}}function v(){return p}p.isRequired=p;var x={array:p,bigint:p,bool:p,func:p,number:p,object:p,string:p,symbol:p,any:p,arrayOf:v,element:p,elementType:p,instanceOf:v,node:p,objectOf:v,oneOf:v,oneOfType:v,shape:v,exact:v,checkPropTypes:g,resetWarningCache:f};return x.PropTypes=x,x}},697:(o,a,u)=>{o.exports=u(703)()},414:o=>{"use strict";o.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"}},t={};function r(o){var a=t[o];if(a!==void 0)return a.exports;var u=t[o]={exports:{}};return e[o](u,u.exports,r),u.exports}r.n=o=>{var a=o&&o.__esModule?()=>o.default:()=>o;return r.d(a,{a}),a},r.d=(o,a)=>{for(var u in a)r.o(a,u)&&!r.o(o,u)&&Object.defineProperty(o,u,{enumerable:!0,get:a[u]})},r.g=function(){if(typeof globalThis=="object")return globalThis;try{return this||new Function("return this")()}catch{if(typeof window=="object")return window}}(),r.o=(o,a)=>Object.prototype.hasOwnProperty.call(o,a),r.r=o=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(o,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(o,"__esModule",{value:!0})};var n={};(()=>{"use strict";r.r(n),r.d(n,{LazyLoadComponent:()=>Ee,LazyLoadImage:()=>Fu,trackWindowScroll:()=>V});let o=q();var a=r.n(o),u=r(697);let h=fl();var f=r.n(h);function g(){return typeof window<"u"&&"IntersectionObserver"in window&&"isIntersecting"in window.IntersectionObserverEntry.prototype}function p(B){return p=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(_){return typeof _}:function(_){return _&&typeof Symbol=="function"&&_.constructor===Symbol&&_!==Symbol.prototype?"symbol":typeof _},p(B)}function v(B,_){var H=Object.keys(B);if(Object.getOwnPropertySymbols){var Q=Object.getOwnPropertySymbols(B);_&&(Q=Q.filter(function(ve){return Object.getOwnPropertyDescriptor(B,ve).enumerable})),H.push.apply(H,Q)}return H}function x(B,_,H){return(_=w(_))in B?Object.defineProperty(B,_,{value:H,enumerable:!0,configurable:!0,writable:!0}):B[_]=H,B}function b(B,_){for(var H=0;H<_.length;H++){var Q=_[H];Q.enumerable=Q.enumerable||!1,Q.configurable=!0,"value"in Q&&(Q.writable=!0),Object.defineProperty(B,w(Q.key),Q)}}function w(B){var _=function(H,Q){if(p(H)!=="object"||H===null)return H;var ve=H[Symbol.toPrimitive];if(ve!==void 0){var xe=ve.call(H,"string");if(p(xe)!=="object")return xe;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(H)}(B);return p(_)==="symbol"?_:String(_)}function A(B,_){return A=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(H,Q){return H.__proto__=Q,H},A(B,_)}function E(B){return E=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(_){return _.__proto__||Object.getPrototypeOf(_)},E(B)}var P=function(B){B.forEach(function(_){_.isIntersecting&&_.target.onVisible()})},I={},F=function(B){(function(z,U){if(typeof U!="function"&&U!==null)throw new TypeError("Super expression must either be null or a function");z.prototype=Object.create(U&&U.prototype,{constructor:{value:z,writable:!0,configurable:!0}}),Object.defineProperty(z,"prototype",{writable:!1}),U&&A(z,U)})(Le,B);var _,H,Q,ve,xe=(Q=Le,ve=function(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}(),function(){var z,U=E(Q);if(ve){var oe=E(this).constructor;z=Reflect.construct(U,arguments,oe)}else z=U.apply(this,arguments);return function(te,re){if(re&&(p(re)==="object"||typeof re=="function"))return re;if(re!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return function(Se){if(Se===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return Se}(te)}(this,z)});function Le(z){var U;if(function(te,re){if(!(te instanceof re))throw new TypeError("Cannot call a class as a function")}(this,Le),(U=xe.call(this,z)).supportsObserver=!z.scrollPosition&&z.useIntersectionObserver&&g(),U.supportsObserver){var oe=z.threshold;U.observer=function(te){return I[te]=I[te]||new IntersectionObserver(P,{rootMargin:te+"px"}),I[te]}(oe)}return U}return _=Le,H=[{key:"componentDidMount",value:function(){this.placeholder&&this.observer&&(this.placeholder.onVisible=this.props.onVisible,this.observer.observe(this.placeholder)),this.supportsObserver||this.updateVisibility()}},{key:"componentWillUnmount",value:function(){this.observer&&this.placeholder&&this.observer.unobserve(this.placeholder)}},{key:"componentDidUpdate",value:function(){this.supportsObserver||this.updateVisibility()}},{key:"getPlaceholderBoundingBox",value:function(){var z=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.props.scrollPosition,U=this.placeholder.getBoundingClientRect(),oe=f().findDOMNode(this.placeholder).style,te=parseInt(oe.getPropertyValue("margin-left"),10)||0,re=parseInt(oe.getPropertyValue("margin-top"),10)||0;return{bottom:z.y+U.bottom+re,left:z.x+U.left+te,right:z.x+U.right+te,top:z.y+U.top+re}}},{key:"isPlaceholderInViewport",value:function(){if(typeof window>"u"||!this.placeholder)return!1;var z=this.props,U=z.scrollPosition,oe=z.threshold,te=this.getPlaceholderBoundingBox(U),re=U.y+window.innerHeight,Se=U.x,Be=U.x+window.innerWidth,Ve=U.y;return Ve-oe<=te.bottom&&re+oe>=te.top&&Se-oe<=te.right&&Be+oe>=te.left}},{key:"updateVisibility",value:function(){this.isPlaceholderInViewport()&&this.props.onVisible()}},{key:"render",value:function(){var z=this,U=this.props,oe=U.className,te=U.height,re=U.placeholder,Se=U.style,Be=U.width;if(re&&typeof re.type!="function")return a().cloneElement(re,{ref:function(Ne){return z.placeholder=Ne}});var Ve=function(Ne){for(var yt=1;yt<arguments.length;yt++){var Ke=arguments[yt]!=null?arguments[yt]:{};yt%2?v(Object(Ke),!0).forEach(function(xt){x(Ne,xt,Ke[xt])}):Object.getOwnPropertyDescriptors?Object.defineProperties(Ne,Object.getOwnPropertyDescriptors(Ke)):v(Object(Ke)).forEach(function(xt){Object.defineProperty(Ne,xt,Object.getOwnPropertyDescriptor(Ke,xt))})}return Ne}({display:"inline-block"},Se);return Be!==void 0&&(Ve.width=Be),te!==void 0&&(Ve.height=te),a().createElement("span",{className:oe,ref:function(Ne){return z.placeholder=Ne},style:Ve},re)}}],H&&b(_.prototype,H),Object.defineProperty(_,"prototype",{writable:!1}),Le}(a().Component);F.propTypes={onVisible:u.PropTypes.func.isRequired,className:u.PropTypes.string,height:u.PropTypes.oneOfType([u.PropTypes.number,u.PropTypes.string]),placeholder:u.PropTypes.element,threshold:u.PropTypes.number,useIntersectionObserver:u.PropTypes.bool,scrollPosition:u.PropTypes.shape({x:u.PropTypes.number.isRequired,y:u.PropTypes.number.isRequired}),width:u.PropTypes.oneOfType([u.PropTypes.number,u.PropTypes.string])},F.defaultProps={className:"",placeholder:null,threshold:100,useIntersectionObserver:!0};let X=F;var W=r(296),L=r.n(W),N=r(96),D=r.n(N),j=function(B){var _=getComputedStyle(B,null);return _.getPropertyValue("overflow")+_.getPropertyValue("overflow-y")+_.getPropertyValue("overflow-x")};let se=function(B){if(!(B instanceof HTMLElement))return window;for(var _=B;_&&_ instanceof HTMLElement;){if(/(scroll|auto)/.test(j(_)))return _;_=_.parentNode}return window};function ee(B){return ee=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(_){return typeof _}:function(_){return _&&typeof Symbol=="function"&&_.constructor===Symbol&&_!==Symbol.prototype?"symbol":typeof _},ee(B)}var he=["delayMethod","delayTime"];function Ae(){return Ae=Object.assign?Object.assign.bind():function(B){for(var _=1;_<arguments.length;_++){var H=arguments[_];for(var Q in H)Object.prototype.hasOwnProperty.call(H,Q)&&(B[Q]=H[Q])}return B},Ae.apply(this,arguments)}function Re(B,_){for(var H=0;H<_.length;H++){var Q=_[H];Q.enumerable=Q.enumerable||!1,Q.configurable=!0,"value"in Q&&(Q.writable=!0),Object.defineProperty(B,(ve=function(xe,Le){if(ee(xe)!=="object"||xe===null)return xe;var z=xe[Symbol.toPrimitive];if(z!==void 0){var U=z.call(xe,"string");if(ee(U)!=="object")return U;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(xe)}(Q.key),ee(ve)==="symbol"?ve:String(ve)),Q)}var ve}function Te(B,_){return Te=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(H,Q){return H.__proto__=Q,H},Te(B,_)}function ge(B,_){if(_&&(ee(_)==="object"||typeof _=="function"))return _;if(_!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return lt(B)}function lt(B){if(B===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return B}function ce(B){return ce=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(_){return _.__proto__||Object.getPrototypeOf(_)},ce(B)}var st=function(){return typeof window>"u"?0:window.scrollX||window.pageXOffset},Pe=function(){return typeof window>"u"?0:window.scrollY||window.pageYOffset};let V=function(B){var _=function(H){(function(oe,te){if(typeof te!="function"&&te!==null)throw new TypeError("Super expression must either be null or a function");oe.prototype=Object.create(te&&te.prototype,{constructor:{value:oe,writable:!0,configurable:!0}}),Object.defineProperty(oe,"prototype",{writable:!1}),te&&Te(oe,te)})(U,H);var Q,ve,xe,Le,z=(xe=U,Le=function(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}(),function(){var oe,te=ce(xe);if(Le){var re=ce(this).constructor;oe=Reflect.construct(te,arguments,re)}else oe=te.apply(this,arguments);return ge(this,oe)});function U(oe){var te;if(function(Se,Be){if(!(Se instanceof Be))throw new TypeError("Cannot call a class as a function")}(this,U),(te=z.call(this,oe)).useIntersectionObserver=oe.useIntersectionObserver&&g(),te.useIntersectionObserver)return ge(te);var re=te.onChangeScroll.bind(lt(te));return oe.delayMethod==="debounce"?te.delayedScroll=L()(re,oe.delayTime):oe.delayMethod==="throttle"&&(te.delayedScroll=D()(re,oe.delayTime)),te.state={scrollPosition:{x:st(),y:Pe()}},te.baseComponentRef=a().createRef(),te}return Q=U,(ve=[{key:"componentDidMount",value:function(){this.addListeners()}},{key:"componentWillUnmount",value:function(){this.removeListeners()}},{key:"componentDidUpdate",value:function(){typeof window>"u"||this.useIntersectionObserver||se(f().findDOMNode(this.baseComponentRef.current))!==this.scrollElement&&(this.removeListeners(),this.addListeners())}},{key:"addListeners",value:function(){typeof window>"u"||this.useIntersectionObserver||(this.scrollElement=se(f().findDOMNode(this.baseComponentRef.current)),this.scrollElement.addEventListener("scroll",this.delayedScroll,{passive:!0}),window.addEventListener("resize",this.delayedScroll,{passive:!0}),this.scrollElement!==window&&window.addEventListener("scroll",this.delayedScroll,{passive:!0}))}},{key:"removeListeners",value:function(){typeof window>"u"||this.useIntersectionObserver||(this.scrollElement.removeEventListener("scroll",this.delayedScroll),window.removeEventListener("resize",this.delayedScroll),this.scrollElement!==window&&window.removeEventListener("scroll",this.delayedScroll))}},{key:"onChangeScroll",value:function(){this.useIntersectionObserver||this.setState({scrollPosition:{x:st(),y:Pe()}})}},{key:"render",value:function(){var oe=this.props,te=(oe.delayMethod,oe.delayTime,function(Se,Be){if(Se==null)return{};var Ve,Ne,yt=function(xt,Ci){if(xt==null)return{};var Tr,rn,Bs={},ta=Object.keys(xt);for(rn=0;rn<ta.length;rn++)Tr=ta[rn],Ci.indexOf(Tr)>=0||(Bs[Tr]=xt[Tr]);return Bs}(Se,Be);if(Object.getOwnPropertySymbols){var Ke=Object.getOwnPropertySymbols(Se);for(Ne=0;Ne<Ke.length;Ne++)Ve=Ke[Ne],Be.indexOf(Ve)>=0||Object.prototype.propertyIsEnumerable.call(Se,Ve)&&(yt[Ve]=Se[Ve])}return yt}(oe,he)),re=this.useIntersectionObserver?null:this.state.scrollPosition;return a().createElement(B,Ae({forwardRef:this.baseComponentRef,scrollPosition:re},te))}}])&&Re(Q.prototype,ve),Object.defineProperty(Q,"prototype",{writable:!1}),U}(a().Component);return _.propTypes={delayMethod:u.PropTypes.oneOf(["debounce","throttle"]),delayTime:u.PropTypes.number,useIntersectionObserver:u.PropTypes.bool},_.defaultProps={delayMethod:"throttle",delayTime:300,useIntersectionObserver:!0},_};function fe(B){return fe=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(_){return typeof _}:function(_){return _&&typeof Symbol=="function"&&_.constructor===Symbol&&_!==Symbol.prototype?"symbol":typeof _},fe(B)}function De(B,_){for(var H=0;H<_.length;H++){var Q=_[H];Q.enumerable=Q.enumerable||!1,Q.configurable=!0,"value"in Q&&(Q.writable=!0),Object.defineProperty(B,(ve=function(xe,Le){if(fe(xe)!=="object"||xe===null)return xe;var z=xe[Symbol.toPrimitive];if(z!==void 0){var U=z.call(xe,"string");if(fe(U)!=="object")return U;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(xe)}(Q.key),fe(ve)==="symbol"?ve:String(ve)),Q)}var ve}function Xe(B,_){return Xe=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(H,Q){return H.__proto__=Q,H},Xe(B,_)}function $e(B){return $e=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(_){return _.__proto__||Object.getPrototypeOf(_)},$e(B)}var Pr=function(B){(function(z,U){if(typeof U!="function"&&U!==null)throw new TypeError("Super expression must either be null or a function");z.prototype=Object.create(U&&U.prototype,{constructor:{value:z,writable:!0,configurable:!0}}),Object.defineProperty(z,"prototype",{writable:!1}),U&&Xe(z,U)})(Le,B);var _,H,Q,ve,xe=(Q=Le,ve=function(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}(),function(){var z,U=$e(Q);if(ve){var oe=$e(this).constructor;z=Reflect.construct(U,arguments,oe)}else z=U.apply(this,arguments);return function(te,re){if(re&&(fe(re)==="object"||typeof re=="function"))return re;if(re!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return function(Se){if(Se===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return Se}(te)}(this,z)});function Le(z){return function(U,oe){if(!(U instanceof oe))throw new TypeError("Cannot call a class as a function")}(this,Le),xe.call(this,z)}return _=Le,(H=[{key:"render",value:function(){return a().createElement(X,this.props)}}])&&De(_.prototype,H),Object.defineProperty(_,"prototype",{writable:!1}),Le}(a().Component);let Br=V(Pr);function Dt(B){return Dt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(_){return typeof _}:function(_){return _&&typeof Symbol=="function"&&_.constructor===Symbol&&_!==Symbol.prototype?"symbol":typeof _},Dt(B)}function li(B,_){for(var H=0;H<_.length;H++){var Q=_[H];Q.enumerable=Q.enumerable||!1,Q.configurable=!0,"value"in Q&&(Q.writable=!0),Object.defineProperty(B,(ve=function(xe,Le){if(Dt(xe)!=="object"||xe===null)return xe;var z=xe[Symbol.toPrimitive];if(z!==void 0){var U=z.call(xe,"string");if(Dt(U)!=="object")return U;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(xe)}(Q.key),Dt(ve)==="symbol"?ve:String(ve)),Q)}var ve}function nr(B,_){return nr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(H,Q){return H.__proto__=Q,H},nr(B,_)}function Ie(B){if(B===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return B}function Ze(B){return Ze=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(_){return _.__proto__||Object.getPrototypeOf(_)},Ze(B)}var $=function(B){(function(z,U){if(typeof U!="function"&&U!==null)throw new TypeError("Super expression must either be null or a function");z.prototype=Object.create(U&&U.prototype,{constructor:{value:z,writable:!0,configurable:!0}}),Object.defineProperty(z,"prototype",{writable:!1}),U&&nr(z,U)})(Le,B);var _,H,Q,ve,xe=(Q=Le,ve=function(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}(),function(){var z,U=Ze(Q);if(ve){var oe=Ze(this).constructor;z=Reflect.construct(U,arguments,oe)}else z=U.apply(this,arguments);return function(te,re){if(re&&(Dt(re)==="object"||typeof re=="function"))return re;if(re!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Ie(te)}(this,z)});function Le(z){var U;(function(Be,Ve){if(!(Be instanceof Ve))throw new TypeError("Cannot call a class as a function")})(this,Le),U=xe.call(this,z);var oe=z.afterLoad,te=z.beforeLoad,re=z.scrollPosition,Se=z.visibleByDefault;return U.state={visible:Se},Se&&(te(),oe()),U.onVisible=U.onVisible.bind(Ie(U)),U.isScrollTracked=!!(re&&Number.isFinite(re.x)&&re.x>=0&&Number.isFinite(re.y)&&re.y>=0),U}return _=Le,(H=[{key:"componentDidUpdate",value:function(z,U){U.visible!==this.state.visible&&this.props.afterLoad()}},{key:"onVisible",value:function(){this.props.beforeLoad(),this.setState({visible:!0})}},{key:"render",value:function(){if(this.state.visible)return this.props.children;var z=this.props,U=z.className,oe=z.delayMethod,te=z.delayTime,re=z.height,Se=z.placeholder,Be=z.scrollPosition,Ve=z.style,Ne=z.threshold,yt=z.useIntersectionObserver,Ke=z.width;return this.isScrollTracked||yt&&g()?a().createElement(X,{className:U,height:re,onVisible:this.onVisible,placeholder:Se,scrollPosition:Be,style:Ve,threshold:Ne,useIntersectionObserver:yt,width:Ke}):a().createElement(Br,{className:U,delayMethod:oe,delayTime:te,height:re,onVisible:this.onVisible,placeholder:Se,style:Ve,threshold:Ne,width:Ke})}}])&&li(_.prototype,H),Object.defineProperty(_,"prototype",{writable:!1}),Le}(a().Component);$.propTypes={afterLoad:u.PropTypes.func,beforeLoad:u.PropTypes.func,useIntersectionObserver:u.PropTypes.bool,visibleByDefault:u.PropTypes.bool},$.defaultProps={afterLoad:function(){return{}},beforeLoad:function(){return{}},useIntersectionObserver:!0,visibleByDefault:!1};let Ee=$;function Ce(B){return Ce=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(_){return typeof _}:function(_){return _&&typeof Symbol=="function"&&_.constructor===Symbol&&_!==Symbol.prototype?"symbol":typeof _},Ce(B)}var ui=["afterLoad","beforeLoad","delayMethod","delayTime","effect","placeholder","placeholderSrc","scrollPosition","threshold","useIntersectionObserver","visibleByDefault","wrapperClassName","wrapperProps"];function Vr(B,_){var H=Object.keys(B);if(Object.getOwnPropertySymbols){var Q=Object.getOwnPropertySymbols(B);_&&(Q=Q.filter(function(ve){return Object.getOwnPropertyDescriptor(B,ve).enumerable})),H.push.apply(H,Q)}return H}function sr(B){for(var _=1;_<arguments.length;_++){var H=arguments[_]!=null?arguments[_]:{};_%2?Vr(Object(H),!0).forEach(function(Q){Rr(B,Q,H[Q])}):Object.getOwnPropertyDescriptors?Object.defineProperties(B,Object.getOwnPropertyDescriptors(H)):Vr(Object(H)).forEach(function(Q){Object.defineProperty(B,Q,Object.getOwnPropertyDescriptor(H,Q))})}return B}function Rr(B,_,H){return(_=ea(_))in B?Object.defineProperty(B,_,{value:H,enumerable:!0,configurable:!0,writable:!0}):B[_]=H,B}function Wr(){return Wr=Object.assign?Object.assign.bind():function(B){for(var _=1;_<arguments.length;_++){var H=arguments[_];for(var Q in H)Object.prototype.hasOwnProperty.call(H,Q)&&(B[Q]=H[Q])}return B},Wr.apply(this,arguments)}function Nu(B,_){for(var H=0;H<_.length;H++){var Q=_[H];Q.enumerable=Q.enumerable||!1,Q.configurable=!0,"value"in Q&&(Q.writable=!0),Object.defineProperty(B,ea(Q.key),Q)}}function ea(B){var _=function(H,Q){if(Ce(H)!=="object"||H===null)return H;var ve=H[Symbol.toPrimitive];if(ve!==void 0){var xe=ve.call(H,"string");if(Ce(xe)!=="object")return xe;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(H)}(B);return Ce(_)==="symbol"?_:String(_)}function js(B,_){return js=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(H,Q){return H.__proto__=Q,H},js(B,_)}function Hr(B){return Hr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(_){return _.__proto__||Object.getPrototypeOf(_)},Hr(B)}var Us=function(B){(function(z,U){if(typeof U!="function"&&U!==null)throw new TypeError("Super expression must either be null or a function");z.prototype=Object.create(U&&U.prototype,{constructor:{value:z,writable:!0,configurable:!0}}),Object.defineProperty(z,"prototype",{writable:!1}),U&&js(z,U)})(Le,B);var _,H,Q,ve,xe=(Q=Le,ve=function(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}(),function(){var z,U=Hr(Q);if(ve){var oe=Hr(this).constructor;z=Reflect.construct(U,arguments,oe)}else z=U.apply(this,arguments);return function(te,re){if(re&&(Ce(re)==="object"||typeof re=="function"))return re;if(re!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return function(Se){if(Se===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return Se}(te)}(this,z)});function Le(z){var U;return function(oe,te){if(!(oe instanceof te))throw new TypeError("Cannot call a class as a function")}(this,Le),(U=xe.call(this,z)).state={loaded:!1},U}return _=Le,(H=[{key:"onImageLoad",value:function(){var z=this;return this.state.loaded?null:function(U){z.props.onLoad(U),z.props.afterLoad(),z.setState({loaded:!0})}}},{key:"getImg",value:function(){var z=this.props,U=(z.afterLoad,z.beforeLoad,z.delayMethod,z.delayTime,z.effect,z.placeholder,z.placeholderSrc,z.scrollPosition,z.threshold,z.useIntersectionObserver,z.visibleByDefault,z.wrapperClassName,z.wrapperProps,function(oe,te){if(oe==null)return{};var re,Se,Be=function(Ne,yt){if(Ne==null)return{};var Ke,xt,Ci={},Tr=Object.keys(Ne);for(xt=0;xt<Tr.length;xt++)Ke=Tr[xt],yt.indexOf(Ke)>=0||(Ci[Ke]=Ne[Ke]);return Ci}(oe,te);if(Object.getOwnPropertySymbols){var Ve=Object.getOwnPropertySymbols(oe);for(Se=0;Se<Ve.length;Se++)re=Ve[Se],te.indexOf(re)>=0||Object.prototype.propertyIsEnumerable.call(oe,re)&&(Be[re]=oe[re])}return Be}(z,ui));return a().createElement("img",Wr({},U,{onLoad:this.onImageLoad()}))}},{key:"getLazyLoadImage",value:function(){var z=this.props,U=z.beforeLoad,oe=z.className,te=z.delayMethod,re=z.delayTime,Se=z.height,Be=z.placeholder,Ve=z.scrollPosition,Ne=z.style,yt=z.threshold,Ke=z.useIntersectionObserver,xt=z.visibleByDefault,Ci=z.width;return a().createElement(Ee,{beforeLoad:U,className:oe,delayMethod:te,delayTime:re,height:Se,placeholder:Be,scrollPosition:Ve,style:Ne,threshold:yt,useIntersectionObserver:Ke,visibleByDefault:xt,width:Ci},this.getImg())}},{key:"getWrappedLazyLoadImage",value:function(z){var U=this.props,oe=U.effect,te=U.height,re=U.placeholderSrc,Se=U.width,Be=U.wrapperClassName,Ve=U.wrapperProps,Ne=this.state.loaded,yt=Ne?" lazy-load-image-loaded":"",Ke=Ne||!re?{}:{backgroundImage:"url(".concat(re,")"),backgroundSize:"100% 100%"};return a().createElement("span",Wr({className:Be+" lazy-load-image-background "+oe+yt,style:sr(sr({},Ke),{},{color:"transparent",display:"inline-block",height:te,width:Se})},Ve),z)}},{key:"render",value:function(){var z=this.props,U=z.effect,oe=z.placeholderSrc,te=z.visibleByDefault,re=z.wrapperClassName,Se=z.wrapperProps,Be=this.getLazyLoadImage();return(U||oe)&&!te||re||Se?this.getWrappedLazyLoadImage(Be):Be}}])&&Nu(_.prototype,H),Object.defineProperty(_,"prototype",{writable:!1}),Le}(a().Component);Us.propTypes={onLoad:u.PropTypes.func,afterLoad:u.PropTypes.func,beforeLoad:u.PropTypes.func,delayMethod:u.PropTypes.string,delayTime:u.PropTypes.number,effect:u.PropTypes.string,placeholderSrc:u.PropTypes.string,threshold:u.PropTypes.number,useIntersectionObserver:u.PropTypes.bool,visibleByDefault:u.PropTypes.bool,wrapperClassName:u.PropTypes.string,wrapperProps:u.PropTypes.object},Us.defaultProps={onLoad:function(){},afterLoad:function(){return{}},beforeLoad:function(){return{}},delayMethod:"throttle",delayTime:300,effect:"",placeholderSrc:null,threshold:100,useIntersectionObserver:!0,visibleByDefault:!1,wrapperClassName:""};let Fu=Us})(),ox.exports=n})()});var DE={};TS(DE,{AnnotationContext:()=>RE,AnnotationPageContext:()=>TE,Auth:()=>kd,AuthProvider:()=>Od,AuthProvider_Old:()=>Tb,AuthRContext:()=>kn,AuthReactContext:()=>Ln,AuthReactContextActions:()=>mu,CanvasAnnotations:()=>SE,CanvasContext:()=>wi,CanvasPanel:()=>_t,CollectionContext:()=>IE,CombinedMetadata:()=>wE,ContextBridge:()=>Fd,Image:()=>nx,ImageServiceLoaderContext:()=>W0,InnerViewerProvider:()=>f0,LanguageProvider:()=>sE,LanguageString:()=>z0,LocaleString:()=>fr,ManifestContext:()=>wd,ManifestMetadata:()=>bE,MediaPlayerProvider:()=>Yo,Metadata:()=>Ko,RangeContext:()=>Ad,ReactVaultContext:()=>Gi,ResourceProvider:()=>Vt,ResourceReactContext:()=>So,SequenceThumbnails:()=>PE,SimpleViewerProvider:()=>zd,SimpleViewerReactContext:()=>Os,SingleCanvasThumbnail:()=>xf,VaultProvider:()=>Tn,ViewerPresetContext:()=>zs,VirtualAnnotationProvider:()=>Bd,VisibleCanvasReactContext:()=>_n,authDetailsForResource:()=>Rd,createAuthStateStore:()=>Cd,createProbe:()=>Pd,emptyActions:()=>Jd,emptyStrategy:()=>ef,expandTarget:()=>tr,findAllCanvasesInRange:()=>du,findFirstCanvasFromRange:()=>Hy,findManifestSelectedRange:()=>nb,findSelectedRange:()=>bd,flattenAnnotationPageIds:()=>tf,formatTime:()=>Y0,get3dStrategy:()=>of,getImageStrategy:()=>af,getManifestSequence:()=>fu,getParsedTargetSelector:()=>Vo,getRenderingStrategy:()=>cf,getTextualContentStrategy:()=>lf,getVideoStrategy:()=>uf,getVisibleCanvasesFromCanvasId:()=>sb,hasAuth:()=>ob,isImageApiSelector:()=>xu,makeAccessServiceRequest:()=>Ps,makeAccessTokenRequest:()=>$i,parseRotation:()=>Su,parseSelector:()=>jn,parseSpecificResource:()=>lE,unknownResponse:()=>Wo,unsupportedStrategy:()=>qe,useAnnotation:()=>jo,useAnnotationPage:()=>Gd,useAnnotationPageManager:()=>qo,useAnnotationsAtTime:()=>_E,useAuthActions:()=>l0,useAuthActions_old:()=>zb,useAuthService:()=>u0,useAuthService_old:()=>Mb,useAuthStore:()=>Is,useAuthToken:()=>_b,useAuthToken_old:()=>Lb,useAuthTokens:()=>Id,useAuthTokens_old:()=>kb,useCanvas:()=>nt,useCanvasClock:()=>OE,useCanvasSequence:()=>Ed,useCanvasSubset:()=>ME,useClosestLanguage:()=>F0,useCollection:()=>kE,useContextBridge:()=>Nd,useCreateLocaleString:()=>oE,useCurrentAuth:()=>Ib,useCurrentAuth_old:()=>Ob,useDispatch:()=>Dd,useEventListener:()=>LE,useExistingVault:()=>In,useExternalCollection:()=>zE,useExternalManifest:()=>Sd,useExternalResource:()=>To,useIIIFLanguage:()=>Au,useImage:()=>Mu,useImageService:()=>Sf,useImageServiceLoader:()=>Ei,useImageTile:()=>NE,useIsAuthEnabled:()=>Md,useLoadImageService:()=>nf,useLocaleString:()=>D0,useManifest:()=>bt,useMediaActions:()=>gE,useMediaElements:()=>vE,useMediaState:()=>mE,usePaintables:()=>sf,usePaintingAnnotations:()=>Vn,useRange:()=>_o,useRenderingStrategy:()=>df,useResourceContext:()=>Ft,useResourceEvents:()=>No,useResources:()=>rf,useSearchService:()=>Ld,useSimpleMediaPlayer:()=>Hn,useSimpleViewer:()=>Lo,useStyleHelper:()=>FE,useStyles:()=>Dn,useThumbnail:()=>Qo,useVault:()=>be,useVaultEffect:()=>ff,useVaultSelector:()=>ke,useViewerPreset:()=>Vd,useVirtualAnnotationPage:()=>jd,useVirtualAnnotationPageContext:()=>Ud,useVisibleCanvases:()=>Io});var $o=T(q(),1);var Ht=T(q(),1);var Ni=(e,t,r)=>{let n=e.length,o=r||J(n);for(let a=0;a<n;a++)o[a]=a%5===0?e[a+1]<t[3]&&e[a+3]>t[1]&&e[a+2]<t[4]&&e[a+4]>t[2]?1:0:e[a];return o};function J(e,t,r){return new Float32Array(e,t,r)}var om=(e,t,r)=>{let n=e[1]<=t[3]&&e[3]>=t[1]&&e[2]<=t[4]&&e[4]>=t[2],o=r||J(5);return n?(o[0]=1,o[1]=Math.max(e[1],t[1]),o[2]=Math.max(e[2],t[2]),o[3]=Math.min(e[3],t[3]),o[4]=Math.min(e[4],t[4]),o):(o[0]=0,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o)},am=e=>e.length/5;var Zt=(e,t,r)=>{let n=r||J(9);return n[0]=e[0]*t[0]+e[1]*t[3]+e[2]*t[6],n[1]=e[0]*t[1]+e[1]*t[4]+e[2]*t[7],n[2]=e[0]*t[2]+e[1]*t[5]+e[2]*t[8],n[3]=e[3]*t[0]+e[4]*t[3]+e[5]*t[6],n[4]=e[3]*t[1]+e[4]*t[4]+e[5]*t[7],n[5]=e[3]*t[2]+e[4]*t[5]+e[5]*t[8],n[6]=e[6]*t[0]+e[7]*t[3]+e[8]*t[6],n[7]=e[6]*t[1]+e[7]*t[4]+e[8]*t[7],n[8]=e[6]*t[2]+e[7]*t[5]+e[8]*t[8],n},de=class e{constructor(t){this.index=0,this.length=t,this.points=J(this.length)}static grid(t=1,r=1){return new e(5*t*r)}static point(t,r){let n=J(5);return n[0]=1,n[1]=t,n[2]=r,n[3]=t,n[4]=r,n}static positionPair(t){let r=J(5);return r[0]=1,r[1]=t.x1,r[2]=t.y1,r[3]=t.x2,r[4]=t.y2,r}static projection(t){return e.singleBox(t.width,t.height,t.x,t.y)}static singleBox(t,r,n=0,o=0){let a=J(5);return a[0]=1,a[1]=n,a[2]=o,a[3]=t+n,a[4]=r+o,a}row(t){return t(this)}addPoints(t,r,n,o){return this.points[this.index]=1,this.points[1+this.index]=t,this.points[2+this.index]=r,this.points[3+this.index]=n,this.points[4+this.index]=o,this.index+=5,this}addBox(t,r,n,o){return this.addPoints(t,r,t+n,r+o),this}build(){return this.points}};var Ut=(e,t)=>{let r=e.length;for(let n=0;n<r;n++)e[n]=n%5===0?t[6]*e[n+1]+t[7]*e[n+2]+t[8]*e[n]:n%5%2===1?t[0]*e[n]+t[1]*e[n+1]+t[2]:t[3]*e[n-1]+t[4]*e[n]+t[5];return e},lr=e=>{let t=J(9);return t[0]=e,t[4]=e,t[8]=1,t},tt=(e,t)=>{let r=J(9);return r[0]=1,r[2]=e,r[4]=1,r[5]=t,r[8]=1,r},vi=(e,t,r)=>Zt(tt((1-e)*t,(1-e)*r),lr(e)),ur=(e,t,r)=>{let n=e.length,o=r&&r.length>=n?r.slice(0,n):J(n);for(let a=0;a<n;a++)o[a]=a%5===0?t[6]*e[a+1]+t[7]*e[a+2]+t[8]*e[a]:a%5%2===1?t[0]*e[a]+t[1]*e[a+1]+t[2]:t[3]*e[a-1]+t[4]*e[a]+t[5];return o};var ao=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,_S=typeof AbortController=="function",Xa=_S?AbortController:class{constructor(){this.signal=new lm}abort(t=new Error("This operation was aborted")){this.signal.reason=this.signal.reason||t,this.signal.aborted=!0,this.signal.dispatchEvent({type:"abort",target:this.signal})}},OS=typeof AbortSignal=="function",MS=typeof Xa.AbortSignal=="function",lm=OS?AbortSignal:MS?Xa.AbortController:class{constructor(){this.reason=void 0,this.aborted=!1,this._listeners=[]}dispatchEvent(t){t.type==="abort"&&(this.aborted=!0,this.onabort(t),this._listeners.forEach(r=>r(t),this))}onabort(){}addEventListener(t,r){t==="abort"&&this._listeners.push(r)}removeEventListener(t,r){t==="abort"&&(this._listeners=this._listeners.filter(n=>n!==r))}},eh=new Set,Zc=(e,t)=>{let r=`LRU_CACHE_OPTION_${e}`;$a(r)&&th(r,`${e} option`,`options.${t}`,os)},Kc=(e,t)=>{let r=`LRU_CACHE_METHOD_${e}`;if($a(r)){let{prototype:n}=os,{get:o}=Object.getOwnPropertyDescriptor(n,e);th(r,`${e} method`,`cache.${t}()`,o)}},kS=(e,t)=>{let r=`LRU_CACHE_PROPERTY_${e}`;if($a(r)){let{prototype:n}=os,{get:o}=Object.getOwnPropertyDescriptor(n,e);th(r,`${e} property`,`cache.${t}`,o)}},um=(...e)=>{typeof process=="object"&&process&&typeof process.emitWarning=="function"?process.emitWarning(...e):console.error(...e)},$a=e=>!eh.has(e),th=(e,t,r,n)=>{eh.add(e);let o=`The ${t} is deprecated. Please use ${r} instead.`;um(o,"DeprecationWarning",e,n)},Fi=e=>e&&e===Math.floor(e)&&e>0&&isFinite(e),cm=e=>Fi(e)?e<=Math.pow(2,8)?Uint8Array:e<=Math.pow(2,16)?Uint16Array:e<=Math.pow(2,32)?Uint32Array:e<=Number.MAX_SAFE_INTEGER?ss:null:null,ss=class extends Array{constructor(t){super(t),this.fill(0)}},Jc=class{constructor(t){if(t===0)return[];let r=cm(t);this.heap=new r(t),this.length=0}push(t){this.heap[this.length++]=t}pop(){return this.heap[--this.length]}},os=class e{constructor(t={}){let{max:r=0,ttl:n,ttlResolution:o=1,ttlAutopurge:a,updateAgeOnGet:u,updateAgeOnHas:h,allowStale:f,dispose:g,disposeAfter:p,noDisposeOnSet:v,noUpdateTTL:x,maxSize:b=0,maxEntrySize:w=0,sizeCalculation:A,fetchMethod:E,fetchContext:P,noDeleteOnFetchRejection:I,noDeleteOnStaleGet:F,allowStaleOnFetchRejection:X,allowStaleOnFetchAbort:W,ignoreFetchAbort:L}=t,{length:N,maxAge:D,stale:j}=t instanceof e?{}:t;if(r!==0&&!Fi(r))throw new TypeError("max option must be a nonnegative integer");let se=r?cm(r):Array;if(!se)throw new Error("invalid max value: "+r);if(this.max=r,this.maxSize=b,this.maxEntrySize=w||this.maxSize,this.sizeCalculation=A||N,this.sizeCalculation){if(!this.maxSize&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(this.fetchMethod=E||null,this.fetchMethod&&typeof this.fetchMethod!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.fetchContext=P,!this.fetchMethod&&P!==void 0)throw new TypeError("cannot set fetchContext without fetchMethod");if(this.keyMap=new Map,this.keyList=new Array(r).fill(null),this.valList=new Array(r).fill(null),this.next=new se(r),this.prev=new se(r),this.head=0,this.tail=0,this.free=new Jc(r),this.initialFill=1,this.size=0,typeof g=="function"&&(this.dispose=g),typeof p=="function"?(this.disposeAfter=p,this.disposed=[]):(this.disposeAfter=null,this.disposed=null),this.noDisposeOnSet=!!v,this.noUpdateTTL=!!x,this.noDeleteOnFetchRejection=!!I,this.allowStaleOnFetchRejection=!!X,this.allowStaleOnFetchAbort=!!W,this.ignoreFetchAbort=!!L,this.maxEntrySize!==0){if(this.maxSize!==0&&!Fi(this.maxSize))throw new TypeError("maxSize must be a positive integer if specified");if(!Fi(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.initializeSizeTracking()}if(this.allowStale=!!f||!!j,this.noDeleteOnStaleGet=!!F,this.updateAgeOnGet=!!u,this.updateAgeOnHas=!!h,this.ttlResolution=Fi(o)||o===0?o:1,this.ttlAutopurge=!!a,this.ttl=n||D||0,this.ttl){if(!Fi(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.initializeTTLTracking()}if(this.max===0&&this.ttl===0&&this.maxSize===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.max&&!this.maxSize){let ee="LRU_CACHE_UNBOUNDED";$a(ee)&&(eh.add(ee),um("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",ee,e))}j&&Zc("stale","allowStale"),D&&Zc("maxAge","ttl"),N&&Zc("length","sizeCalculation")}getRemainingTTL(t){return this.has(t,{updateAgeOnHas:!1})?1/0:0}initializeTTLTracking(){this.ttls=new ss(this.max),this.starts=new ss(this.max),this.setItemTTL=(n,o,a=ao.now())=>{if(this.starts[n]=o!==0?a:0,this.ttls[n]=o,o!==0&&this.ttlAutopurge){let u=setTimeout(()=>{this.isStale(n)&&this.delete(this.keyList[n])},o+1);u.unref&&u.unref()}},this.updateItemAge=n=>{this.starts[n]=this.ttls[n]!==0?ao.now():0},this.statusTTL=(n,o)=>{n&&(n.ttl=this.ttls[o],n.start=this.starts[o],n.now=t||r(),n.remainingTTL=n.now+n.ttl-n.start)};let t=0,r=()=>{let n=ao.now();if(this.ttlResolution>0){t=n;let o=setTimeout(()=>t=0,this.ttlResolution);o.unref&&o.unref()}return n};this.getRemainingTTL=n=>{let o=this.keyMap.get(n);return o===void 0?0:this.ttls[o]===0||this.starts[o]===0?1/0:this.starts[o]+this.ttls[o]-(t||r())},this.isStale=n=>this.ttls[n]!==0&&this.starts[n]!==0&&(t||r())-this.starts[n]>this.ttls[n]}updateItemAge(t){}statusTTL(t,r){}setItemTTL(t,r,n){}isStale(t){return!1}initializeSizeTracking(){this.calculatedSize=0,this.sizes=new ss(this.max),this.removeItemSize=t=>{this.calculatedSize-=this.sizes[t],this.sizes[t]=0},this.requireSize=(t,r,n,o)=>{if(this.isBackgroundFetch(r))return 0;if(!Fi(n))if(o){if(typeof o!="function")throw new TypeError("sizeCalculation must be a function");if(n=o(r,t),!Fi(n))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return n},this.addItemSize=(t,r,n)=>{if(this.sizes[t]=r,this.maxSize){let o=this.maxSize-this.sizes[t];for(;this.calculatedSize>o;)this.evict(!0)}this.calculatedSize+=this.sizes[t],n&&(n.entrySize=r,n.totalCalculatedSize=this.calculatedSize)}}removeItemSize(t){}addItemSize(t,r){}requireSize(t,r,n,o){if(n||o)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache")}*indexes({allowStale:t=this.allowStale}={}){if(this.size)for(let r=this.tail;!(!this.isValidIndex(r)||((t||!this.isStale(r))&&(yield r),r===this.head));)r=this.prev[r]}*rindexes({allowStale:t=this.allowStale}={}){if(this.size)for(let r=this.head;!(!this.isValidIndex(r)||((t||!this.isStale(r))&&(yield r),r===this.tail));)r=this.next[r]}isValidIndex(t){return t!==void 0&&this.keyMap.get(this.keyList[t])===t}*entries(){for(let t of this.indexes())this.valList[t]!==void 0&&this.keyList[t]!==void 0&&!this.isBackgroundFetch(this.valList[t])&&(yield[this.keyList[t],this.valList[t]])}*rentries(){for(let t of this.rindexes())this.valList[t]!==void 0&&this.keyList[t]!==void 0&&!this.isBackgroundFetch(this.valList[t])&&(yield[this.keyList[t],this.valList[t]])}*keys(){for(let t of this.indexes())this.keyList[t]!==void 0&&!this.isBackgroundFetch(this.valList[t])&&(yield this.keyList[t])}*rkeys(){for(let t of this.rindexes())this.keyList[t]!==void 0&&!this.isBackgroundFetch(this.valList[t])&&(yield this.keyList[t])}*values(){for(let t of this.indexes())this.valList[t]!==void 0&&!this.isBackgroundFetch(this.valList[t])&&(yield this.valList[t])}*rvalues(){for(let t of this.rindexes())this.valList[t]!==void 0&&!this.isBackgroundFetch(this.valList[t])&&(yield this.valList[t])}[Symbol.iterator](){return this.entries()}find(t,r){for(let n of this.indexes()){let o=this.valList[n],a=this.isBackgroundFetch(o)?o.__staleWhileFetching:o;if(a!==void 0&&t(a,this.keyList[n],this))return this.get(this.keyList[n],r)}}forEach(t,r=this){for(let n of this.indexes()){let o=this.valList[n],a=this.isBackgroundFetch(o)?o.__staleWhileFetching:o;a!==void 0&&t.call(r,a,this.keyList[n],this)}}rforEach(t,r=this){for(let n of this.rindexes()){let o=this.valList[n],a=this.isBackgroundFetch(o)?o.__staleWhileFetching:o;a!==void 0&&t.call(r,a,this.keyList[n],this)}}get prune(){return Kc("prune","purgeStale"),this.purgeStale}purgeStale(){let t=!1;for(let r of this.rindexes({allowStale:!0}))this.isStale(r)&&(this.delete(this.keyList[r]),t=!0);return t}dump(){let t=[];for(let r of this.indexes({allowStale:!0})){let n=this.keyList[r],o=this.valList[r],a=this.isBackgroundFetch(o)?o.__staleWhileFetching:o;if(a===void 0)continue;let u={value:a};if(this.ttls){u.ttl=this.ttls[r];let h=ao.now()-this.starts[r];u.start=Math.floor(Date.now()-h)}this.sizes&&(u.size=this.sizes[r]),t.unshift([n,u])}return t}load(t){this.clear();for(let[r,n]of t){if(n.start){let o=Date.now()-n.start;n.start=ao.now()-o}this.set(r,n.value,n)}}dispose(t,r,n){}set(t,r,{ttl:n=this.ttl,start:o,noDisposeOnSet:a=this.noDisposeOnSet,size:u=0,sizeCalculation:h=this.sizeCalculation,noUpdateTTL:f=this.noUpdateTTL,status:g}={}){if(u=this.requireSize(t,r,u,h),this.maxEntrySize&&u>this.maxEntrySize)return g&&(g.set="miss",g.maxEntrySizeExceeded=!0),this.delete(t),this;let p=this.size===0?void 0:this.keyMap.get(t);if(p===void 0)p=this.newIndex(),this.keyList[p]=t,this.valList[p]=r,this.keyMap.set(t,p),this.next[this.tail]=p,this.prev[p]=this.tail,this.tail=p,this.size++,this.addItemSize(p,u,g),g&&(g.set="add"),f=!1;else{this.moveToTail(p);let v=this.valList[p];if(r!==v){if(this.isBackgroundFetch(v)?v.__abortController.abort(new Error("replaced")):a||(this.dispose(v,t,"set"),this.disposeAfter&&this.disposed.push([v,t,"set"])),this.removeItemSize(p),this.valList[p]=r,this.addItemSize(p,u,g),g){g.set="replace";let x=v&&this.isBackgroundFetch(v)?v.__staleWhileFetching:v;x!==void 0&&(g.oldValue=x)}}else g&&(g.set="update")}if(n!==0&&this.ttl===0&&!this.ttls&&this.initializeTTLTracking(),f||this.setItemTTL(p,n,o),this.statusTTL(g,p),this.disposeAfter)for(;this.disposed.length;)this.disposeAfter(...this.disposed.shift());return this}newIndex(){return this.size===0?this.tail:this.size===this.max&&this.max!==0?this.evict(!1):this.free.length!==0?this.free.pop():this.initialFill++}pop(){if(this.size){let t=this.valList[this.head];return this.evict(!0),t}}evict(t){let r=this.head,n=this.keyList[r],o=this.valList[r];return this.isBackgroundFetch(o)?o.__abortController.abort(new Error("evicted")):(this.dispose(o,n,"evict"),this.disposeAfter&&this.disposed.push([o,n,"evict"])),this.removeItemSize(r),t&&(this.keyList[r]=null,this.valList[r]=null,this.free.push(r)),this.head=this.next[r],this.keyMap.delete(n),this.size--,r}has(t,{updateAgeOnHas:r=this.updateAgeOnHas,status:n}={}){let o=this.keyMap.get(t);if(o!==void 0)if(this.isStale(o))n&&(n.has="stale",this.statusTTL(n,o));else return r&&this.updateItemAge(o),n&&(n.has="hit"),this.statusTTL(n,o),!0;else n&&(n.has="miss");return!1}peek(t,{allowStale:r=this.allowStale}={}){let n=this.keyMap.get(t);if(n!==void 0&&(r||!this.isStale(n))){let o=this.valList[n];return this.isBackgroundFetch(o)?o.__staleWhileFetching:o}}backgroundFetch(t,r,n,o){let a=r===void 0?void 0:this.valList[r];if(this.isBackgroundFetch(a))return a;let u=new Xa;n.signal&&n.signal.addEventListener("abort",()=>u.abort(n.signal.reason));let h={signal:u.signal,options:n,context:o},f=(b,w=!1)=>{let{aborted:A}=u.signal,E=n.ignoreFetchAbort&&b!==void 0;return n.status&&(A&&!w?(n.status.fetchAborted=!0,n.status.fetchError=u.signal.reason,E&&(n.status.fetchAbortIgnored=!0)):n.status.fetchResolved=!0),A&&!E&&!w?p(u.signal.reason):(this.valList[r]===x&&(b===void 0?x.__staleWhileFetching?this.valList[r]=x.__staleWhileFetching:this.delete(t):(n.status&&(n.status.fetchUpdated=!0),this.set(t,b,h.options))),b)},g=b=>(n.status&&(n.status.fetchRejected=!0,n.status.fetchError=b),p(b)),p=b=>{let{aborted:w}=u.signal,A=w&&n.allowStaleOnFetchAbort,E=A||n.allowStaleOnFetchRejection,P=E||n.noDeleteOnFetchRejection;if(this.valList[r]===x&&(!P||x.__staleWhileFetching===void 0?this.delete(t):A||(this.valList[r]=x.__staleWhileFetching)),E)return n.status&&x.__staleWhileFetching!==void 0&&(n.status.returnedStale=!0),x.__staleWhileFetching;if(x.__returned===x)throw b},v=(b,w)=>{this.fetchMethod(t,a,h).then(A=>b(A),w),u.signal.addEventListener("abort",()=>{(!n.ignoreFetchAbort||n.allowStaleOnFetchAbort)&&(b(),n.allowStaleOnFetchAbort&&(b=A=>f(A,!0)))})};n.status&&(n.status.fetchDispatched=!0);let x=new Promise(v).then(f,g);return x.__abortController=u,x.__staleWhileFetching=a,x.__returned=null,r===void 0?(this.set(t,x,{...h.options,status:void 0}),r=this.keyMap.get(t)):this.valList[r]=x,x}isBackgroundFetch(t){return t&&typeof t=="object"&&typeof t.then=="function"&&Object.prototype.hasOwnProperty.call(t,"__staleWhileFetching")&&Object.prototype.hasOwnProperty.call(t,"__returned")&&(t.__returned===t||t.__returned===null)}async fetch(t,{allowStale:r=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,ttl:a=this.ttl,noDisposeOnSet:u=this.noDisposeOnSet,size:h=0,sizeCalculation:f=this.sizeCalculation,noUpdateTTL:g=this.noUpdateTTL,noDeleteOnFetchRejection:p=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:v=this.allowStaleOnFetchRejection,ignoreFetchAbort:x=this.ignoreFetchAbort,allowStaleOnFetchAbort:b=this.allowStaleOnFetchAbort,fetchContext:w=this.fetchContext,forceRefresh:A=!1,status:E,signal:P}={}){if(!this.fetchMethod)return E&&(E.fetch="get"),this.get(t,{allowStale:r,updateAgeOnGet:n,noDeleteOnStaleGet:o,status:E});let I={allowStale:r,updateAgeOnGet:n,noDeleteOnStaleGet:o,ttl:a,noDisposeOnSet:u,size:h,sizeCalculation:f,noUpdateTTL:g,noDeleteOnFetchRejection:p,allowStaleOnFetchRejection:v,allowStaleOnFetchAbort:b,ignoreFetchAbort:x,status:E,signal:P},F=this.keyMap.get(t);if(F===void 0){E&&(E.fetch="miss");let X=this.backgroundFetch(t,F,I,w);return X.__returned=X}else{let X=this.valList[F];if(this.isBackgroundFetch(X)){let j=r&&X.__staleWhileFetching!==void 0;return E&&(E.fetch="inflight",j&&(E.returnedStale=!0)),j?X.__staleWhileFetching:X.__returned=X}let W=this.isStale(F);if(!A&&!W)return E&&(E.fetch="hit"),this.moveToTail(F),n&&this.updateItemAge(F),this.statusTTL(E,F),X;let L=this.backgroundFetch(t,F,I,w),N=L.__staleWhileFetching!==void 0,D=N&&r;return E&&(E.fetch=N&&W?"stale":"refresh",D&&W&&(E.returnedStale=!0)),D?L.__staleWhileFetching:L.__returned=L}}get(t,{allowStale:r=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,status:a}={}){let u=this.keyMap.get(t);if(u!==void 0){let h=this.valList[u],f=this.isBackgroundFetch(h);return this.statusTTL(a,u),this.isStale(u)?(a&&(a.get="stale"),f?(a&&(a.returnedStale=r&&h.__staleWhileFetching!==void 0),r?h.__staleWhileFetching:void 0):(o||this.delete(t),a&&(a.returnedStale=r),r?h:void 0)):(a&&(a.get="hit"),f?h.__staleWhileFetching:(this.moveToTail(u),n&&this.updateItemAge(u),h))}else a&&(a.get="miss")}connect(t,r){this.prev[r]=t,this.next[t]=r}moveToTail(t){t!==this.tail&&(t===this.head?this.head=this.next[t]:this.connect(this.prev[t],this.next[t]),this.connect(this.tail,t),this.tail=t)}get del(){return Kc("del","delete"),this.delete}delete(t){let r=!1;if(this.size!==0){let n=this.keyMap.get(t);if(n!==void 0)if(r=!0,this.size===1)this.clear();else{this.removeItemSize(n);let o=this.valList[n];this.isBackgroundFetch(o)?o.__abortController.abort(new Error("deleted")):(this.dispose(o,t,"delete"),this.disposeAfter&&this.disposed.push([o,t,"delete"])),this.keyMap.delete(t),this.keyList[n]=null,this.valList[n]=null,n===this.tail?this.tail=this.prev[n]:n===this.head?this.head=this.next[n]:(this.next[this.prev[n]]=this.next[n],this.prev[this.next[n]]=this.prev[n]),this.size--,this.free.push(n)}}if(this.disposed)for(;this.disposed.length;)this.disposeAfter(...this.disposed.shift());return r}clear(){for(let t of this.rindexes({allowStale:!0})){let r=this.valList[t];if(this.isBackgroundFetch(r))r.__abortController.abort(new Error("deleted"));else{let n=this.keyList[t];this.dispose(r,n,"delete"),this.disposeAfter&&this.disposed.push([r,n,"delete"])}}if(this.keyMap.clear(),this.valList.fill(null),this.keyList.fill(null),this.ttls&&(this.ttls.fill(0),this.starts.fill(0)),this.sizes&&this.sizes.fill(0),this.head=0,this.tail=0,this.initialFill=1,this.free.length=0,this.calculatedSize=0,this.size=0,this.disposed)for(;this.disposed.length;)this.disposeAfter(...this.disposed.shift())}get reset(){return Kc("reset","clear"),this.clear}get length(){return kS("length","size"),this.size}static get AbortController(){return Xa}static get AbortSignal(){return lm}},hm=os;var $g=T(Mm(),1);var Ge=T(q(),1),Ll=T(q(),1),e1=T(G(),1);var cr=T(q()),hh=T(Fm());function rl(e){let{debounce:t,scroll:r,polyfill:n,offsetSize:o}=e===void 0?{debounce:0,scroll:!1,offsetSize:!1}:e,a=n||(typeof window>"u"?class{}:window.ResizeObserver);if(!a)throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");let[u,h]=(0,cr.useState)({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),f=(0,cr.useRef)({element:null,scrollContainers:null,resizeObserver:null,lastBounds:u}),g=t?typeof t=="number"?t:t.scroll:null,p=t?typeof t=="number"?t:t.resize:null,v=(0,cr.useRef)(!1);(0,cr.useEffect)(()=>(v.current=!0,()=>void(v.current=!1)));let[x,b,w]=(0,cr.useMemo)(()=>{let I=()=>{if(!f.current.element)return;let{left:F,top:X,width:W,height:L,bottom:N,right:D,x:j,y:se}=f.current.element.getBoundingClientRect(),ee={left:F,top:X,width:W,height:L,bottom:N,right:D,x:j,y:se};f.current.element instanceof HTMLElement&&o&&(ee.height=f.current.element.offsetHeight,ee.width=f.current.element.offsetWidth),Object.freeze(ee),v.current&&!YS(f.current.lastBounds,ee)&&h(f.current.lastBounds=ee)};return[I,p?(0,hh.default)(I,p):I,g?(0,hh.default)(I,g):I]},[h,o,g,p]);function A(){f.current.scrollContainers&&(f.current.scrollContainers.forEach(I=>I.removeEventListener("scroll",w,!0)),f.current.scrollContainers=null),f.current.resizeObserver&&(f.current.resizeObserver.disconnect(),f.current.resizeObserver=null)}function E(){f.current.element&&(f.current.resizeObserver=new a(w),f.current.resizeObserver.observe(f.current.element),r&&f.current.scrollContainers&&f.current.scrollContainers.forEach(I=>I.addEventListener("scroll",w,{capture:!0,passive:!0})))}let P=I=>{!I||I===f.current.element||(A(),f.current.element=I,f.current.scrollContainers=Dm(I),E())};return qS(w,!!r),HS(b),(0,cr.useEffect)(()=>{A(),E()},[r,w,b]),(0,cr.useEffect)(()=>A,[]),[P,u,x]}function HS(e){(0,cr.useEffect)(()=>{let t=e;return window.addEventListener("resize",t),()=>void window.removeEventListener("resize",t)},[e])}function qS(e,t){(0,cr.useEffect)(()=>{if(t){let r=e;return window.addEventListener("scroll",r,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",r,!0)}},[e,t])}function Dm(e){let t=[];if(!e||e===document.body)return t;let{overflow:r,overflowX:n,overflowY:o}=window.getComputedStyle(e);return[r,n,o].some(a=>a==="auto"||a==="scroll")&&t.push(e),[...t,...Dm(e.parentElement)]}var QS=["x","y","top","bottom","left","right","width","height"],YS=(e,t)=>QS.every(r=>e[r]===t[r]);var Nh=T(q(),1),ri=T(q(),1),Kg=T(eg(),1),Jg=T(q(),1),Fl=T(q(),1),us=T(G(),1),br=T(q(),1),uv=T(q(),1),cv=T(q(),1),hv=T(G(),1),Bt=T(G(),1),Dl=T(q(),1);var yo=T(G(),1),Dh=T(q(),1),fv=T(q(),1),y1=T(q(),1),mv=T(q(),1),yv=T(q(),1),ti=T(q(),1),xv=T(q(),1),kh=T(G(),1),Sv=T(q(),1),ei=T(q(),1),At=T(q(),1),wv=T(q(),1),Ul=T(q(),1),ft=T(G(),1),Lh=T(G(),1),bv=T(q(),1),yn=T(G(),1),Ev=T(q(),1);var XS=Object.defineProperty,$S=(e,t,r)=>t in e?XS(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ll=(e,t,r)=>($S(e,typeof t!="symbol"?t+"":t,r),r);function gn(e){return e.endsWith("info.json")?e:e.endsWith("/")?`${e}info.json`:`${e}/info.json`}var ZS="http://library.stanford.edu/iiif/image-api/compliance.html#level0",ng="http://library.stanford.edu/iiif/image-api/compliance.html#level1",sg="http://library.stanford.edu/iiif/image-api/compliance.html#level2",KS="http://library.stanford.edu/iiif/image-api/conformance.html#level0",og="http://library.stanford.edu/iiif/image-api/conformance.html#level1",ag="http://library.stanford.edu/iiif/image-api/conformance.html#level2",JS="http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level0",lg="http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level1",ug="http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level2",ew="http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level0",cg="http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level1",hg="http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level2",tw="http://iiif.io/api/image/1/level0.json",rw="http://iiif.io/api/image/1/profiles/level0.json",dg="http://iiif.io/api/image/1/level1.json",fg="http://iiif.io/api/image/1/profiles/level1.json",pg="http://iiif.io/api/image/1/level2.json",mg="http://iiif.io/api/image/1/profiles/level2.json",iw="http://iiif.io/api/image/2/level0.json",nw="http://iiif.io/api/image/2/profiles/level0.json",gg="http://iiif.io/api/image/2/level1.json",vg="http://iiif.io/api/image/2/profiles/level1.json",yg="http://iiif.io/api/image/2/level2.json",xg="http://iiif.io/api/image/2/profiles/level2.json",sw="level0",Sg="level1",wg="level2",ow="http://iiif.io/api/image/2/level0",Ag="http://iiif.io/api/image/2/level1",bg="http://iiif.io/api/image/2/level2",Eg=[bg,sg,ag,ug,hg,pg,mg,yg,xg,wg],Cg=[...Eg,Ag,ng,og,lg,cg,dg,fg,gg,vg,Sg],aw=[ow,Ag,bg,ZS,ng,sg,KS,og,ag,JS,lg,ug,ew,cg,hg,tw,rw,dg,fg,pg,mg,iw,nw,gg,vg,yg,xg,sw,Sg,wg];var lw={extraFormats:["jpg"],extraQualities:["default"],extraFeatures:["sizeByWhListed"]},uw={extraFormats:["jpg"],extraQualities:["default"],extraFeatures:["baseUriRedirect","cors","jsonldMediaType","regionByPx","regionSquare","sizeByWhListed","sizeByH","sizeByW","sizeByWh"]},cw={extraFormats:["jpg","png"],extraQualities:["default"],extraFeatures:["baseUriRedirect","cors","jsonldMediaType","regionByPct","regionByPx","regionSquare","rotationBy90s","sizeByWhListed","sizeByConfinedWh","sizeByH","sizeByPct","sizeByW","sizeByWh"]};function hw(e){return Eg.indexOf(e)!==-1?cw:Cg.indexOf(e)!==-1?uw:lw}function dw(e){let t=e?Array.isArray(e.profile)?e.profile:[e.profile]:[],r={extraQualities:[],extraFormats:[],extraFeatures:[]};for(let n of t)if(typeof n=="string"&&(n=hw(n)),!!n){if(n.formats)for(let o of n.formats)r.extraFormats.indexOf(o)===-1&&r.extraFormats.push(o);if(n.qualities)for(let o of n.qualities)r.extraQualities.indexOf(o)===-1&&r.extraQualities.push(o);if(n.supports)for(let o of n.supports)r.extraFeatures.indexOf(o)===-1&&r.extraFeatures.push(o);if(n.maxHeight&&(r.maxHeight=n.maxHeight),n.maxWidth&&(r.maxWidth=n.maxWidth),n.maxArea&&(r.maxArea=n.maxArea),n.extraFormats)for(let o of n.extraFormats)r.extraFormats.indexOf(o)===-1&&r.extraFormats.push(o);if(n.extraQualities)for(let o of n.extraQualities)r.extraQualities.indexOf(o)===-1&&r.extraQualities.push(o);if(n.extraFeatures)for(let o of n.extraFeatures)r.extraFeatures.indexOf(o)===-1&&r.extraFeatures.push(o);n.maxHeight&&(r.maxHeight=n.maxHeight),n.maxWidth&&(r.maxWidth=n.maxWidth),n.maxArea&&(r.maxArea=n.maxArea)}if(e.extraFormats)for(let n of e.extraFormats)r.extraFormats.indexOf(n)===-1&&r.extraFormats.push(n);if(e.extraFeatures)for(let n of e.extraFeatures)r.extraFeatures.indexOf(n)===-1&&r.extraFeatures.push(n);if(e.extraQualities)for(let n of e.extraQualities)r.extraQualities.indexOf(n)===-1&&r.extraQualities.push(n);return r}function fw(e){try{if(e==="full")return{full:!0};if(e==="square")return{square:!0};let t=e.startsWith("pct:"),r=e.substr(t?4:0).split(",").map(n=>parseFloat(n));return{x:r[0],y:r[1],w:r[2],h:r[3],percent:t}}catch{throw new Error("Expected 'full', 'square' or 'x,y,w,h'. Found "+e)}}function pw(e){let t={upscaled:!1,max:!1,confined:!1};if(e[0]==="^"&&(t.upscaled=!0,e=e.slice(1)),e==="max"||e==="full")return t.max=!0,t.serialiseAsFull=e==="full",t;if(e[0]==="!"&&(t.confined=!0,e=e.slice(1)),e[0]==="p")return t.percentScale=parseFloat(e.slice(4)),t;let r=e.split(",").map(n=>n.trim());return r.length&&typeof r[0]<"u"&&(r[0]!==""&&(t.width=parseInt(r[0],10)),typeof r[1]<"u"&&r[1]!==""?(t.height=parseInt(r[1],10),t.version=2):t.version=3),t}function mw(e){let t={angle:0};if(e[0]==="!"&&(t.mirror=!0,e=e.substr(1)),t.angle=parseFloat(e)%360,Number.isNaN(t.angle))throw new Error(`Invalid rotation ${e}`);return t}function gw(e,t=""){let r=e.match(/^(([a-zA-Z]+):\/\/([^/]+))?((.*)+)/);if(!r)throw new Error(`Invalid or unknown input ${e}`);let n=r[2],o=r[3],a=r[4];if(a[0]==="/"&&(a=a.substring(1)),t.length>0){if(t[0]==="/"&&(t=t.substring(1)),t!==a.substring(0,t.length))throw new Error(`Path does not start with prefix (path: ${a}, prefix: ${t})`);a=a.substring(t.length)}return{scheme:n,server:o,path:a,prefix:t}}function vw(e,t=""){let{path:r,scheme:n,server:o,prefix:a}=gw(e,t),u=(r||"").split("/").reverse(),[h,f,g,p,...v]=u,x=v.reverse().filter(Boolean).join("/");if(u.length===1||h==="")return{type:"base",scheme:n,server:o,prefix:a,identifier:x};if(h==="info.json"){let[,...w]=u;return{type:"info",scheme:n,server:o,prefix:a,identifier:w.reverse().filter(Boolean).join("/")}}let b=(h||"").split(".");if(typeof b[1]>"u"||typeof b[0]>"u"||typeof p>"u"||typeof g>"u"||typeof f>"u")throw new Error("Invalid image request");return{type:"image",scheme:n,server:o,prefix:a,identifier:x,originalPath:r,region:fw(p),size:pw(g),rotation:mw(f),quality:b[0],format:b[1]}}function bh(e){let t=vw(gn(e.id));if(t.type!=="info")throw new Error("Invalid service URL");let r=dw(e);return{identifier:t.identifier,originalPath:"",server:t.server,prefix:t.prefix,scheme:t.scheme,type:"image",quality:r.extraQualities.indexOf("default")===-1?r.extraQualities[0]:"default",region:{full:!0},size:{max:!0,upscaled:!1,confined:!1},format:"jpg",rotation:{angle:0}}}function yw(e,t,r){let n=r.length,o=[];for(let a=0;a<n;a++){let u=r[a];if(u){let h=u.width;o.push(e/h)}}return o}function xw(e,t,r){let n=r.length,o=[];for(let a=0;a<n;a++){let u=r[a];u&&o.push({width:Math.floor(e/u),height:Math.floor(t/u)})}return o}function ot(e){if(e["@id"])return e["@id"];if(e.id)return e.id}function cl(e){if(!e||!e.profile||!ot(e))return!1;let t=Array.isArray(e.profile)?e.profile:[e.profile];for(let r of t)if(typeof r=="string"&&aw.indexOf(r)!==-1)return!0;return!1}function Sw(e){if(!cl(e))return!1;let t=Array.isArray(e.profile)?e.profile:[e.profile];for(let r of t)if(typeof r=="string"){if(Cg.indexOf(r)!==-1)return!0}else{let n=[...r.supports||[],...r.extraFeatures||[]];if(n.indexOf("regionByPx")!==-1&&(n.indexOf("sizeByW")!==-1||n.indexOf("sizeByWh")!==-1))return!0}return!1}function ul(e,t){if(t&&t.profile){let r=t.profile;if(r){let n=Array.isArray(r)?r:[r];return n.includes(`level${e}`)||n.includes(`http://iiif.io/api/image/2/level${e}.json`)||n.includes(`http://iiif.io/api/image/1/level${e}.json`)||n.includes(`http://iiif.io/api/image/1/profiles/level${e}.json`)}}return!1}function Ah(e){return cl(e)?ul(0,e)?0:ul(1,e)?1:ul(2,e)?2:null:null}function Pg(e){return(e["@context"]?Array.isArray(e["@context"])?e["@context"]:[e["@context"]]:[]).indexOf("http://iiif.io/api/image/3/context.json")!==-1}function ww(e){if(!Sw(e))return[];let t=[],r=Array.isArray(e.profile)?e.profile:[e.profile],n=r.length;for(let o=0;o<n;o++){let a=r[o];if(a&&typeof a!="string"&&(a.maxHeight||a.maxWidth))return[{id:ot(e),type:"variable",minWidth:0,minHeight:0,maxHeight:a.maxHeight||a.maxWidth,maxWidth:a.maxWidth||a.maxHeight,level:Ah(e),version:e["@context"]==="http://iiif.io/api/image/3/context.json"?3:2}]}if(e.tiles){let o=e.tiles.length;for(let a=0;a<o;a++){let u=e.tiles[a];u&&(u.height||u.width)&&t.push({id:ot(e),type:"variable",minHeight:0,minWidth:0,maxHeight:u.height||u.width,maxWidth:u.width,level:Ah(e),version:Pg(e)?3:2})}}return t}function tg(e){let t=/^.*\/(full)\/(((\d+),(\d+)?)|max)\/(\d+)\/default\.(jpg|png|jpeg)$/,r=e.match(t);if(r&&r[4]&&r[5]){let n=r[1],o=parseInt(r[4],10),a=parseInt(r[5],10),u=r[7];if((n==="max"||n==="full")&&o&&a&&u)return{type:"fixed",id:e,height:a,width:o}}return{type:"unknown",id:e}}function Aw(e){if(e["@type"])return e["@type"];if(e.type)return e.type}function hl(e){if(typeof e=="string")return tg(e);let t=Aw(e);if(t!=="Image"&&t!=="sc:Image")return null;let r=e,n=ot(r);return n?n&&r.width&&r.height?{id:n,type:"fixed",width:r.width,height:r.height,unsafe:!0}:tg(n):null}function bw(e){return cl(e)?(e&&e.sizes?e.sizes:[]).map(t=>({id:ot(e),type:"fixed-service",height:t.height,width:t.width,level:Ah(e),version:Pg(e)?3:2})):[]}function rg(e){let t=[],r=e.length;for(let n=0;n<r;n++){let o=e[n];if(!o)continue;let a=bw(o);a.length&&t.push(...a);let u=ww(o);u.length&&t.push(...u)}return t}function vn(e){let t=e.service?Array.isArray(e.service)?e.service:[e.service]:[],r=t.length,n=[];for(let o=0;o<r;o++)cl(t[o])&&n.push(t[o]);return n}function Ew(e,t=!0,r){let n=[],o=hl(e);if(o===null)return n;let a=e;if(n.push(o),t&&a&&a.width&&a.height){let u=[],h=vn(a);for(let f of h){let g={id:ot(f),width:a.width,height:a.height};if(r.canLoadSync(g)){let p=r.loadServiceSync(g);p&&(p.height||(p.height=a.height),p.width||(p.width=a.width),u.push(...rg([p])))}}if(u.length)return n.push(...u),n}return a.service&&n.push(...rg(a.service)),n}function Cw({x:e=0,y:t=0,w:r,h:n,full:o,square:a,percent:u}){if(o)return"full";if(a)return"square";if(typeof r>"u"||typeof n>"u")throw new Error("RegionParameter: invalid region");let h=`${e},${t},${r},${n}`;return u?`pct:${h}`:h}function Pw({max:e,percentScale:t,upscaled:r,confined:n,width:o,height:a,serialiseAsFull:u,version:h}){let f=[];return r&&f.push("^"),e?(f.push(u?"full":"max"),f.join("")):(n&&f.push("!"),t&&f.push(`pct:${t}`),o&&f.push(`${o}`),f.push(","),a&&h===3&&f.push(`${a}`),f.join(""))}function Rw(e){return`${e.mirror?"!":""}${(e.angle||0)%360}`}function Eh(e,t){let r=e.prefix.startsWith("/")?e.prefix.substr(1):e.prefix,n=`${e.scheme}://${e.server}/${r?`${r}/`:""}${e.identifier}`;if(e.type==="base")return n;if(e.type==="info")return`${n}/info.json`;let{size:o}=e,{region:a,rotation:u,format:h,quality:f}=e;if(t){let g=t["@context"]?Array.isArray(t["@context"])?t["@context"]:[t["@context"]]:[],p=g.indexOf("http://iiif.io/api/image/2/context.json")!==-1,v=g.indexOf("http://iiif.io/api/image/3/context.json")!==-1;if((o.width===t.width&&!o.height||o.height===t.height&&!o.width||o.width===t.width&&o.height===t.height)&&(o={...o,max:!0}),p&&(o.max&&!o.serialiseAsFull&&(o={...o,serialiseAsFull:!0}),!o.max&&o.width&&o.height&&(o={...o,height:void 0}),o={...o,version:2}),v){if(o.max&&o.serialiseAsFull&&(o={...o,serialiseAsFull:!1}),o.width&&!o.height&&t.width&&t.height){let x=t.height/t.width;o={...o,height:Math.ceil(o.width*x)}}o={...o,version:3}}}return[n,Cw(a),Pw(o),Rw(u),`${f}.${h}`].filter(Boolean).join("/")}function wh(e,t,r){let n=bh({"@context":e.version===3?"http://iiif.io/api/image/3/context.json":"http://iiif.io/api/image/2/context.json",id:gn(ot(e)),profile:e.level===null||typeof e.level>"u"?"level0":`level${e.level}`,type:e.version===3?"ImageService3":"ImageService2"});if(n.type!=="image")throw new Error("Invalid service");return n.size.max=!1,n.size.width=t,n.size.height=r,{id:Eh(n),type:"fixed",width:t,height:r||e.height/(e.width||1)*t,unsafe:e.width>t}}function as(e){let t=e.replace(/(https?:\/\/)?(www.)?/i,"");return t.indexOf("/")!==-1?t.split("/")[0]:t}function Tw(e,t,r){let n=e.width?e.width:e.maxWidth;return r.height<=e.maxHeight&&r.width<=e.maxWidth&&r.height>=e.minHeight&&r.width>=e.minWidth&&(!t||Math.abs(r.width-n)<Math.abs(t.width-n))}function Iw(e,t){let r=[],n=Object.assign({unsafeImageService:!1,atAnyCost:!0,fallback:!0,minHeight:64,minWidth:64,maxHeight:1/0,maxWidth:1/0,returnAllOptions:!1,preferFixedSize:!1,allowUnsafe:!1,explain:!1,height:0,width:0},e),o=(p,v=0)=>n.explain?r.push(new Array(v).fill(0).map(x=>" ").join("")+p().trim()):void 0,a=[],u=[],h=null;o(()=>`Using configuration: ${JSON.stringify(n,null,2)}`);let f=(p,v)=>{if(o(()=>"Swapping choice",3),Tw(n,v,p)){if(n.preferFixedSize&&p.unsafe){o(()=>`We found an image that was marked as unsafe, but it was the best size. (${p.id})`,4),u.push(p);return}n.returnAllOptions&&v&&u.push(v),o(()=>`We found a new image that was the best size. (${p.id})`,4),h=p}else n.returnAllOptions&&u.push(p)};o(()=>`The input shows we have ${t.length} list(s) of candidates to choose from.`);let g=t.length;for(let p=0;p<g;p++){let v=t[p]();o(()=>`Candidate group ${p}: ${JSON.stringify(v,null,2)}`,1);let x=v.length;o(()=>`Checking candidate list number ${p} and found ${x} potential ways of creating image(s)`,1);for(let b=0;b<x;b++){let w=v[b];if(o(()=>`-> Checking candidate ${b}`,1),w.type==="unknown"&&n.atAnyCost&&(o(()=>`We've found an unknown image type, adding this to the "last resort" list`,2),a.push(w)),w.type==="fixed"&&(w.unsafe?(o(()=>`We've found an unsafe fixed image type, adding this to the "last resort" list`,2),a.push(w)):(o(()=>"We've found a fixed size image, checking if it matches the request",2),f(w,h))),w.type==="fixed-service")if(n.unsafeImageService){o(()=>"Checking for an image from the tile source, without calculating the right height and width (unsafeImageService)",2);let A=wh(w,n.width,n.height);f(A,h)}else{o(()=>"Checking for an image from the tile source 3",2);let A=wh(w,w.width,w.height);f(A,h)}if(w.type==="variable"&&w.maxWidth){let A=wh({id:w.id,type:"fixed-service",width:w.maxWidth,height:w.maxWidth,level:w.level,version:w.version},w.maxWidth);f(A,h)}}if(h&&!n.returnAllOptions){if(h.unsafe||n.allowUnsafe)continue;o(()=>`We found a match in choice list number ${p}, no searching any more`);break}}return n.atAnyCost&&u.length===0?(o(()=>h?`We found an image! ${h.id} of type ${h.type}`:'We found no images, but "atAnyCost" is set, so returning that'),{best:h||a[0]||null,fallback:a.slice(1),log:r}):n.returnAllOptions?(o(()=>"Returning all options that we have found"),{best:(n.atAnyCost?h||u[0]||a[0]:h||u[0])||null,fallback:[...u,...a],log:r}):(o(()=>"Returning the best image that we found, and a fallback"),{best:h||u[0]||null,fallback:h?u:u.slice(1),log:r})}function _w(e,t,r){let n=e>t?e:t,o=r.length,a=[];for(let u=0;u<o;u++){let h=r[u];if(!h||h.scaleFactors.length===0)continue;let f=h.scaleFactors[0];if(!f)continue;let g=n/f,p=[f];for(;g>=h.width;)f=f*2,p.push(f),g=g/2;a.push({...h,scaleFactors:p})}return a}function Ow(e,t){if(e.length!==t.length)return!1;if(e.length===0&&t.length===0)return!0;let r=e.length,n=!0;for(let a=0;a<r;a++){let u=e[a],h=t[a];if(u.width!==h.width||u.height!==h.height){n=!1;break}}if(n)return!0;let o=0;for(let a=0;a<r;a++)for(let u=0;u<r;u++)if(e[a].width===t[u].width&&e[a].height===t[u].height){o++;break}return o===r}function ig(e){return ul(0,e)}var ls=class{constructor(e={}){ll(this,"config",{verificationsRequired:1,approximateServices:!1,enableFetching:!0,disableThrottling:!1}),ll(this,"fetchingCount",0),ll(this,"imageServices",{}),ll(this,"knownImageServers",{}),this.config=Object.assign(this.config,e)}setConfig(e){Object.assign(this.config,e)}sample(e,t,r=!0){let n=as(ot(e)),o=gn(ot(e)),a=this.knownImageServers[n];return this.imageServices[o]=Object.assign(e,{real:!0}),!a&&e.tiles&&!ig(e)?(this.knownImageServers[n]={verifications:0,malformed:!1,root:n,preLoaded:r,sampledId:ot(e),verified:!1,server:null,result:{context:e["@context"]||[],sampledProfile:e.profile,resourceServiceRatio:t&&e.height?t.height/e.height:1,sampledSizes:e.sizes||[],sizeRatios:yw(e.width,e.height,e.sizes||[]),sampledTiles:e.tiles||[]}},!0):this.verify(e)}preLoad(e,t=!0){this.knownImageServers[e.root]=e,t&&(this.knownImageServers[e.root].malformed=!1,this.knownImageServers[e.root].verifications=this.config.verificationsRequired)}predict(e,t=!1,r=!1){let n=e?.source,o=as(ot(e)),a=this.knownImageServers[o],u=gn(ot(e));return this.imageServices[u]?this.imageServices[u]||null:!this.config.approximateServices||!a||!a.result||!(n?.height||e.height)||!(n?.width||e.width)||!r&&(a.malformed||a.verifications<this.config.verificationsRequired)||ig(e.source)?null:(this.imageServices[u]||(this.imageServices[u]={"@context":a.result.context,"@id":ot(e),id:ot(e),protocol:"http://iiif.io/api/image",tiles:n?.tiles||_w(e.width,e.height,a.result.sampledTiles),sizes:n?.sizes||xw(Math.round(e.width/a.result.resourceServiceRatio),Math.round(e.height/a.result.resourceServiceRatio),a.result.sizeRatios),profile:n?.profile||a.result.sampledProfile,height:n?.height||e.height,width:n?.width||e.width,real:!1}),this.imageServices[u]||null)}async getThumbnailFromResource(e,t,r=!0,n=[]){let o=e?await this.getImageCandidates(e,r):[];return Iw(t,[()=>n,()=>o])}async getImageCandidates(e,t=!0){let r=e;if(t&&r&&r.height&&r.width){let n=vn(r);for(let o of n){let a={id:ot(o),width:o.width?o.width:r.width,height:o.height?o.height:r.height,source:o};await this.loadService(a)}}return Ew(e,t,this)}async verify(e){let t=this.predict(e,!1,!0),r=await this.fetchService(ot(e));if(!t)return!1;let n=t.height===r.height&&t.width===r.width&&t["@context"]===r["@context"]&&Ow(t.sizes||[],r.sizes||[]);if(n){let o=as(ot(e)),a=this.knownImageServers[o];a&&(a.verifications+=1,a.verifications>=this.config.verificationsRequired&&(a.verified=!0))}return n}canLoadSync(e){let t=typeof e=="string"?e:ot(e),r=gn(t);if(this.imageServices[r])return!0;let n=this.knownImageServers[as(t)];return!!(n&&!n.malformed&&n.verifications>=this.config.verificationsRequired)}async markAsMalformed(e){return this.knownImageServers[as(ot(e))].malformed=!0,this.loadService(e,!0)}async fetchService(e,t=!1){let r=gn(e),n=this.imageServices[r];if(n&&(!t||n.real))return n;if(!this.config.enableFetching)throw new Error("Fetching is not enabled");let o=await this.fetch(r).then(a=>a.json());return!o.id&&o["@id"]&&(o.id=o["@id"]),o.id!==e&&(o.id=e,o["@id"]&&(o["@id"]=e)),this.imageServices[r]=Object.assign(o,{real:!0}),this.imageServices[r]}async fetch(e,t){return fetch(e,t)}async loadService(e,t=!1){if(!this.config.disableThrottling){let o=!0;for(;o;)if(this.fetchingCount>=this.config.verificationsRequired)await new Promise(a=>setTimeout(a,500));else{o=!1;break}}let r=this.knownImageServers[as(ot(e))];if(r&&!r.malformed&&!t){await r.result;let o=this.loadServiceSync(e);if(o)return o}this.fetchingCount++;let n=await this.fetchService(ot(e),t);return this.fetchingCount--,n.real&&this.sample(n,e),n}loadServiceSync(e){let t=gn(ot(e));return this.imageServices[t]?this.imageServices[t]:this.config.approximateServices?this.predict(e):null}},sC=new ls;var dl={},yi={get(e){return e},setMetaValue([e,t,r],n){let o=yi.getResourceMeta(e,t),a=o?o[r]:void 0,u=typeof n=="function"?n(a):n;dl[e]={...dl[e]||{},[t]:{...(dl[e]||{})[t]||{},[r]:u}}},getResourceMeta:(e,t)=>{let r=dl[e];if(r)return t?r[t]:r}};var Rg=new ls;function Ch(e=yi,t={}){let r=t.imageServiceLoader||Rg;async function n(o,a,u=!1,h=[],f){let g=()=>r.getThumbnailFromResource(void 0,a,u,h);if(!o)return await r.getThumbnailFromResource(void 0,a,u,h);if(typeof o=="string"){let x=hl(o);return x&&h.push(x),await r.getThumbnailFromResource(void 0,a,u,h)}let p=e.get(o,{skipSelfReturn:!1});if(typeof p=="string")return{best:hl(p),fallback:[],log:[]};if(!p)return await g();switch(await(async x=>{if(x&&x.thumbnail&&x.thumbnail.length){let b=e.get(x.thumbnail[0]),w=await r.getImageCandidates(b,u);w&&w.length&&h.push(...w)}})(p),p.type){case"Annotation":{let x=Array.isArray(p.body)?p.body:[p.body],b=e.get(x[0]);return f&&!b.width&&(b.width=f.width,b.height=f.height),await r.getThumbnailFromResource(b,a,u,h)}case"Canvas":{let x=p;return n(x.items[0],a,u,h,{width:x.width,height:x.height})}case"AnnotationPage":return n(p.items[0],a,u,h,f);case"Choice":{let x=p;return!x.items||x.items[0]?await g():n(x.items[0],a,u,h,f)}case"Collection":{let b=p.items[0];return b?n(b,a,u,h,f):await g()}case"Manifest":{let b=p.items[0];return b?n(b,a,u,h,f):await g()}case"SpecificResource":case"Image":case"Dataset":case"Sound":case"Text":case"TextualBody":case"Video":return f&&!p.width&&(p.width=f.width,p.height=f.height),r.getThumbnailFromResource(p,a,u,h)}return await g()}return{getBestThumbnailAtSize:n}}var Mw=Object.create,Ph=Object.defineProperty,kw=Object.getOwnPropertyDescriptor,Tg=Object.getOwnPropertyNames,Lw=Object.getPrototypeOf,zw=Object.prototype.hasOwnProperty,Nw=(e,t,r)=>t in e?Ph(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Rh=(e,t)=>function(){return t||(0,e[Tg(e)[0]])((t={exports:{}}).exports,t),t.exports},Fw=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Tg(t))!zw.call(e,o)&&o!==r&&Ph(e,o,{get:()=>t[o],enumerable:!(n=kw(t,o))||n.enumerable});return e},Th=(e,t,r)=>(r=e!=null?Mw(Lw(e)):{},Fw(t||!e||!e.__esModule?Ph(r,"default",{value:e,enumerable:!0}):r,e)),Jt=(e,t,r)=>(Nw(e,typeof t!="symbol"?t+"":t,r),r);var E1=T(G(),1),C1=T(q(),1),xo=T(q(),1),P1=T(G(),1),R1=T(q(),1),Cv=T(q(),1),Dw=Object.defineProperty,jw=(e,t,r)=>t in e?Dw(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,S=(e,t,r)=>(jw(e,typeof t!="symbol"?t+"":t,r),r),_l=["onMouseDown","onMouseEnter","onMouseLeave","onMouseMove","onMouseOut","onMouseOver","onMouseUp","onTouchCancel","onTouchEnd","onTouchMove","onTouchStart","onPointerDown","onPointerMove","onPointerUp","onPointerCancel","onPointerEnter","onPointerLeave","onPointerOver","onPointerOut","onScroll","onWheel","onClick","onDragStart","onDragEnd","onDragEnter","onDragExit","onDrag","onDragOver"];function Uw(){return _l.reduce((e,t)=>(e[t]=[],e),{})}var hs=_l.reduce((e,t)=>(e[t.slice(2).toLowerCase()]=t,e[t]=t,e),{}),Bw="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",Ol=(e=21)=>{let t="",r=crypto.getRandomValues(new Uint8Array(e));for(;e--;)t+=Bw[r[e]&63];return t},ii=class{constructor(){S(this,"__id"),S(this,"__revision",0),S(this,"__host"),S(this,"__onCreate"),S(this,"__parent"),S(this,"__owner",{value:void 0}),S(this,"__state",{}),S(this,"eventHandlers"),S(this,"scale",1),S(this,"layers",[]),S(this,"time",[]),S(this,"_crop"),S(this,"cropData"),S(this,"id"),S(this,"addEventListener",(e,t,r)=>{let n=hs[e];if(!this.eventHandlers[n])throw new Error(`Unknown event ${n}`);this.eventHandlers[n].indexOf(t)===-1&&this.eventHandlers[n].push(t)}),S(this,"removeEventListener",(e,t)=>{let r=hs[e];if(!this.eventHandlers[r]){console.warn(`Unknown event ${r}`);return}this.eventHandlers[r].indexOf(t)!==-1&&(this.eventHandlers[r]=this.eventHandlers[r].filter(n=>n!==t))}),this.id=this.__id=Ol(),this.eventHandlers=Uw()}get crop(){return this._crop}set crop(e){this._crop=e}getObjectsAt(e){return[]}getAllPointsAt(e,t,r){return[]}getScheduledUpdates(e,t){return[]}dispatchEvent(e,t){let r=this.eventHandlers[e],n=r?r.length:0,o=!1;if(n)for(let a=0;a<n;a++)try{r[a](t),o=!0}catch(u){console.error(e,u)}return o}get x(){return this.points[1]}get y(){return this.points[2]}get width(){return this.points[3]-this.points[1]}get height(){return this.points[4]-this.points[2]}translate(e,t){Ut(this.points,tt(e,t))}atScale(e){Ut(this.points,vi(e,this.x,this.y)),this.scale*=e}transform(e){Ut(this.points,e)}applyProps(e){this.__revision++}appendChild(e){}removeChild(e){}insertBefore(e,t){}hideInstance(){}},Bi=class _h extends ii{constructor(t){if(super(),S(this,"type","spacial-content"),S(this,"id"),S(this,"uri"),S(this,"display"),S(this,"points"),S(this,"priority"),S(this,"style",{opacity:1}),!t)this.id="",this.uri="",this.display={x:0,y:0,scale:1,width:0,height:0,points:J(5)},this.points=J(5);else{let r=t.scale||1;this.id=t.id||t.uri,this.uri=t.uri,this.points=de.singleBox(t.width,t.height,t.x,t.y),this.display={x:0,y:0,scale:r,width:t.width/r,height:t.height/r,points:de.singleBox(t.width/r,t.height/r),rotation:t?.rotation}}}applyProps(t){let r=t.display?t.display.width:t.target.width,n=t.target.width/r;if(this.id=t.id||t.uri,this.uri=t.uri,this.points.set(de.singleBox(t.target.width,t.target.height,t.target.x,t.target.y)),t.style&&typeof t.style.opacity<"u"&&(this.style.opacity=t.style.opacity),t.crop){this.cropData=t.crop;let o=de.singleBox(t.crop.width,t.crop.height,t.crop.x,t.crop.y);Ut(o,tt(-t.crop.x,-t.crop.y)),this.crop?this.crop.set(o):this.crop=J(o)}t.display?(this.display.scale=n,this.display.width=t.display.width,this.display.height=t.display.height,this.display.rotation=t.display.rotation,this.display.points=de.singleBox(t.display.width,t.display.height)):(this.display.scale=n,this.display.width=t.target.width/n,this.display.height=t.target.height/n,this.display.points=de.singleBox(t.target.width/n,t.target.height/n))}getAllPointsAt(t,r,n){return[[this,this.crop||this.points,r]]}static fromSvg(t,r,n,o){return _h.fromImage("data:image/svg+xml;base64,"+btoa(t),r,n,o)}static fromImage(t,r,n,o){let a=new _h;return a.applyProps({uri:t,id:o,display:n,target:r}),a}getImageUrl(){return this.uri}},Oh=class extends ii{constructor(e){if(super(),S(this,"type","spacial-content"),S(this,"id"),S(this,"uri"),S(this,"display"),S(this,"points"),S(this,"getTexture"),this.getTexture=()=>({source:void 0,hash:-1}),!e)this.id="",this.uri="",this.display={x:0,y:0,scale:1,width:0,height:0,points:J(5)},this.points=J(5);else{let t=e.scale||1;this.id=e.id||e.uri,this.uri=e.uri,this.points=de.singleBox(e.width,e.height),this.display={x:0,y:0,scale:t,width:e.width/t,height:e.height/t,points:t!==1?de.singleBox(e.width/t,e.height/t):this.points}}}applyProps(e){let t=e.display?e.display.width:e.target.width,r=e.target.width/t;this.id=e.id,this.points.set(de.singleBox(e.target.width,e.target.height)),this.display.scale=r,this.display.width=e.target.width/r,this.display.height=e.target.height/r,this.getTexture=e.getTexture,this.display.points=r!==1?de.singleBox(e.target.width/r,e.target.height/r):this.points}getAllPointsAt(e,t,r){return[[this,this.points,t]]}};function Vw(e,t,r=1){let n=t.length;if(n===0)throw new Error("No resources passed in.");let o=0;for(let a=0;a<n&&!(!t[a]||!t[a].display);a++)o=Math.abs(t[a].display.scale-e)*r<Math.abs(t[o].display.scale-e)?a:o;return o}function Mg(e,t){return Math.abs(e-t)}function Pl(e,t){let r=Mg(e.x,t.x),n=Mg(e.y,t.y);return Math.sqrt(Math.pow(r,2)+Math.pow(n,2))}function Ww(e){let t=e.length;return e.indexOf("/info.json")===t-10?e.slice(0,-10):e}function pl(e,t,r){return Math.min(Math.max(e,t),r)}var vo=class qg extends ii{constructor(t){super(),S(this,"id"),S(this,"type","spacial-content"),S(this,"display"),S(this,"tileWidth"),S(this,"style",{opacity:1}),S(this,"points"),S(this,"service"),S(this,"format","jpg"),S(this,"crop2"),S(this,"tileUrl"),this.tileUrl=Ww(t.url),this.id=t.id||`${this.tileUrl}--${t.scaleFactor}`,this.points=t.displayPoints?t.displayPoints:ur(t.points,lr(t.scaleFactor)),this.tileWidth=t.tileWidth,this.display={x:0,y:0,width:t.width/t.scaleFactor,height:t.height/t.scaleFactor,points:t.points,scale:t.scaleFactor},t.format&&(this.format=t.format)}applyProps(t){if(t.style&&typeof t.style.opacity<"u"&&(this.style.opacity=t.style.opacity),t.service!==this.service&&(this.service=t.service),t.format?this.format=t.format:this.format="jpg",t.crop){this.cropData=t.crop;let r=J([...this.points]),n=r.length/5,o=t.crop.x||0,a=t.crop.y||0,u=t.crop.x+t.crop.width,h=t.crop.y+t.crop.height;for(let f=0;f<n;f++){let g=f*5;r[g+1]<u&&r[g+3]>o&&r[g+2]<h&&r[g+4]>a?(r[g+1]=pl(r[g+1],o,u),r[g+3]=pl(r[g+3],o,u),r[g+2]=pl(r[g+2],a,h),r[g+4]=pl(r[g+4],a,h)):r[g]=0}Ut(r,tt(-t.crop.x,-t.crop.y)),this.crop?this.crop.set(r):this.crop=r}}static fromTile(t,r,n,o,a,u){n.height=n.height?n.height:n.width;let h=Math.ceil(r.width/o),f=Math.ceil(r.height/o),g=Math.ceil(h/n.width),p=Math.ceil(f/n.height),v=de.grid(g,p),x=de.grid(g,p);for(let w=0;w<p;w++)for(let A=0;A<g;A++){let E=A*n.width,P=w*n.height;x.addPoints(E*o,P*o,A===g-1?r.width:(E+n.width)*o,w===p-1?r.height:(P+n.height)*o),v.addPoints(E,P,A===g-1?h:E+n.width,w===p-1?f:P+n.height)}let b=new qg({url:t,scaleFactor:o,points:v.build(),displayPoints:x.build(),width:r.width,height:r.height,tileWidth:n.width,format:u});return b.applyProps({service:a}),b}getImageUrl(t){let r=this.points.slice(t*5,t*5+5),n=r[3]-r[1],o=r[4]-r[2],a=Math.ceil(n/this.display.scale);return`${this.tileUrl}/${r[1]},${r[2]},${n},${o}/${a>this.tileWidth?this.tileWidth:a},/0/default.${this.format||"jpg"}`}getAllPointsAt(t,r,n){let o=Ni(this.crop||this.points,t);return[[this,o,r]]}transform(t){Ut(this.points,t)}getScheduledUpdates(t,r){return[]}},Hw=class extends ii{constructor(){super(...arguments),S(this,"type","spacial-content")}getAllPointsAt(e,t,r){return[[this,this.points,t]]}},qw=class extends Hw{constructor(e){super(),S(this,"id"),S(this,"display"),S(this,"points"),S(this,"images",[]),S(this,"allImages",[]),S(this,"scaleFactors",[]),S(this,"aggregateBuffer",J(9)),S(this,"lazyLoader"),S(this,"isFullyLoaded",!1),S(this,"maxScaleFactor",0),S(this,"renderOptions"),S(this,"_scheduleSortByScales",!1),S(this,"_sortByScales",()=>{this._scheduleSortByScales=!1,this.allImages.sort((r,n)=>n.display.width-r.display.width),this.images=[];let t=.1;for(let r of this.allImages)if(!(r.display.width<this.renderOptions.minSize&&r.display.height<this.renderOptions.minSize&&!r.priority||r instanceof Bi&&(r.display.width>this.renderOptions.maxImageSize||r.display.height>this.renderOptions.maxImageSize)&&!r.priority)){if(Math.abs(r.display.scale-t)<.25||r.priority){let n=this.images.pop();n&&(n instanceof Bi||n.priority)?(r.priority&&this.images.push(r),this.images.push(n)):r&&this.images.push(r)}else r&&this.images.push(r);t=r.display.scale}this.images.length===0&&(this.images=[...this.allImages]),this.scaleFactors=this.images.map(r=>r.display.scale),this.maxScaleFactor=Math.max(...this.scaleFactors)}),S(this,"loadFullResource",async()=>{if(!this.isFullyLoaded&&this.lazyLoader){this.isFullyLoaded=!0;let t=await this.lazyLoader();this.addImages(t)}}),S(this,"fallback",[this.loadFullResource]),this.id=e.id,this.points=de.singleBox(e.width,e.height),this.lazyLoader=e.loadFullImages,e.loadFullImages||(this.isFullyLoaded=!0),this.display={x:0,y:0,points:de.singleBox(e.width,e.height),height:e.height,width:e.width,scale:1},this.renderOptions={renderSmallestFallback:!0,renderLayers:2,minSize:255,maxImageSize:1024,quality:1.75,...e.renderOptions||{}},this.addImages(e.images)}applyProps(e){typeof e.renderSmallestFallback<"u"&&e.renderSmallestFallback!==this.renderOptions.renderSmallestFallback&&(this.renderOptions.renderSmallestFallback=e.renderSmallestFallback),typeof e.renderLayers<"u"&&e.renderLayers!==this.renderOptions.renderLayers&&(this.renderOptions.renderLayers=e.renderLayers),typeof e.minSize<"u"&&e.minSize!==this.renderOptions.minSize&&(this.renderOptions.minSize=e.minSize),typeof e.maxImageSize<"u"&&e.maxImageSize!==this.renderOptions.maxImageSize&&(this.renderOptions.maxImageSize=e.maxImageSize),typeof e.quality<"u"&&e.quality!==this.renderOptions.quality&&(this.renderOptions.quality=e.quality)}appendChild(e){this.addImages([e])}removeChild(e){this.images.indexOf(e)!==-1&&(this.images=this.images.filter(t=>t!==e),this.sortByScales())}insertBefore(e,t){this.addImages([e])}hideInstance(){}addImages(e){for(let t of e)t.__parent=this,t.__owner=this.__owner;this.allImages.push(...e.filter(Boolean)),this.sortByScales()}sortByScales(){this._scheduleSortByScales=!0}getScheduledUpdates(e,t){return this._scheduleSortByScales?[this._sortByScales]:this.isFullyLoaded?[]:t>1/this.maxScaleFactor?this.fallback:[]}getAllPointsAt(e,t,r){if(this.images.length===0)return[];let n=Vw(1/(r||1)/(window.devicePixelRatio||1),this.images,this.renderOptions.quality),o=this.images.length,a=t?Zt(t,tt(this.x,this.y)):tt(this.x,this.y);if(n!==this.images.length-1&&this.images[n+1]){let u=[];for(let g=o-1;g>=n;g--)u.push(g);let h=u[0];this.renderOptions.renderLayers&&(u=u.slice(-Math.min(u.length,this.renderOptions.renderLayers))),this.renderOptions.renderSmallestFallback&&u.indexOf(h)===-1&&u.unshift(h);let f=[];for(let g=0;g<u.length;g++)f.push(...this.images[u[g]].getAllPointsAt(e,a,r));return f}return this.images[n].getAllPointsAt(e,a,r)}};function ml(e,t,r,n,o){let a=Math.PI/180*o,u=Math.cos(a),h=Math.sin(a),f=u*(r-e)+h*(n-t)+e,g=u*(n-t)-h*(r-e)+t;return[f,g]}var zh=class Qg extends ii{constructor(t,r){super(),S(this,"id"),S(this,"type","world-object"),S(this,"scale"),S(this,"layers"),S(this,"points"),S(this,"worldPoints"),S(this,"intersectionBuffer",J(5)),S(this,"aggregateBuffer",J(9)),S(this,"invertedBuffer",J(9)),S(this,"rotation",0),S(this,"filteredPointsBuffer"),S(this,"_updatedList",[]),S(this,"geometry");let{x:n=0,y:o=0}=r||{};t?(this.id=t.id||"",this.scale=1,this.layers=t.layers,this.points=J([1,n,o,n+t.width,o+t.height]),this.worldPoints=J([1,n,o,n+t.width,o+t.height]),this.filteredPointsBuffer=J(t.layers.length*5)):(this.id="",this.scale=1,this.layers=[],this.points=J(5),this.worldPoints=J(5),this.filteredPointsBuffer=J(5))}static createWithProps(t){let r=new Qg;return r.applyProps(t),r}applyProps(t){let r=t.x||0,n=t.y||0;this.id=t.id;let o=typeof t.scale<"u"?t.scale:this.scale;this.points[0]=1,this.points[1]=r,this.points[2]=n,this.points[3]=r+t.width,this.points[4]=n+t.height,this.rotation=t.rotation||0,this.worldPoints[3]=this.worldPoints[1]+t.width,this.worldPoints[4]=this.worldPoints[2]+t.height,t.scale&&t.scale!==1&&this.atScale(o),this.scale=o}appendChild(t){t.points[0]===0&&t.points.set(this.points),t.__owner.value=this,this.addLayers([t])}removeChild(t){this.layers=this.layers.filter(r=>r!==t),this.filteredPointsBuffer=J(this.layers.length*5)}insertBefore(t,r){let n=this.layers.indexOf(r);if(n===-1||this.layers.indexOf(t)!==-1)return;let o=this.layers.slice(0,n),a=this.layers.slice(n);this.layers=[...o,t,...a]}hideInstance(){console.warn("hideInstance: not yet implemented")}getObjectsAt(t,r){if(this.rotation&&(t=this.applyRotation(t)),Ni(this.points,t,this.filteredPointsBuffer)[0]===0)return[];let n=this.layers.length,o=[];for(let a=0;a<n;a++){let u=this.layers[a];if(r&&u.isShape){let h=ur(u.points,tt(this.x,this.y));if(!u.intersects([t[1]-h[1],t[2]-h[2]]))continue}if(Ni(ur(u.points,tt(this.x,this.y)),t,this.filteredPointsBuffer)[0]!==0&&o.push(u),r){let h=u;o.push(...h.getObjectsAt(t,r))}}return o}applyRotation(t){if(this.rotation){let r={x:t[1],y:t[2]},n={x:t[1],y:t[4]},o={x:t[3],y:t[2]},a={x:t[3],y:t[4]},u=this.points[1]+(this.points[3]-this.points[1])/2,h=this.points[2]+(this.points[4]-this.points[2])/2,[f,g]=ml(u,h,r.x,r.y,this.rotation),[p,v]=ml(u,h,n.x,n.y,this.rotation),[x,b]=ml(u,h,o.x,o.y,this.rotation),[w,A]=ml(u,h,a.x,a.y,this.rotation),E=Math.min(f,p,x,w),P=Math.max(f,p,x,w),I=Math.min(g,v,b,A),F=Math.max(g,v,b,A);return J([t[0],E,I,P,F])}return t}getAllPointsAt(t,r,n){let o=Zt(tt(this.x,this.y),lr(this.scale),this.aggregateBuffer);this.rotation&&(t=this.applyRotation(t));let a=om(t,this.points,this.intersectionBuffer),u=this.layers.length,h=[],f=ur(a,Zt(lr(1/this.scale),tt(-this.x,-this.y),this.invertedBuffer)),g=r?Zt(r,o,this.aggregateBuffer):o,p=n*this.scale;for(let v=0;v<u;v++)h.push(...this.layers[v].getAllPointsAt(f,g,p));return h}addLayers(t){let r=[];for(let n of t)this.layers.indexOf(n)===-1&&(r.push(n),n.points.length===5&&(n.points[1]<this.worldPoints[1]/this.scale||n.points[2]<this.worldPoints[2]/this.scale||n.points[3]>this.worldPoints[3]/this.scale||n.points[4]>this.worldPoints[4]/this.scale)&&(n.crop=n.crop||J([1,Math.max(this.worldPoints[1]/this.scale,n.points[1]),Math.max(this.worldPoints[2]/this.scale,n.points[2]),Math.min(this.worldPoints[3]/this.scale,n.points[3]),Math.min(this.worldPoints[4]/this.scale,n.points[4])])));this.layers=this.layers.concat(r),this.filteredPointsBuffer=J(this.layers.length*5)}getScheduledUpdates(t,r){let n=this.layers.length;this._updatedList=[];let o=r*this.scale;for(let a=0;a<n;a++){let u=this.layers[a].getScheduledUpdates(t,o);u&&this._updatedList.push(...u)}return this._updatedList}},Ml=class Yg extends ii{constructor(t=0,r=0,n=100,o="left-to-right"){super(),S(this,"id","world"),S(this,"_width"),S(this,"_height"),S(this,"aspectRatio"),S(this,"viewingDirection"),S(this,"aggregateBuffer",J(9)),S(this,"isDirty",!1),S(this,"zones",[]),S(this,"filteredPointsBuffer"),S(this,"selectedZone"),S(this,"triggerQueue",[]),S(this,"activatedEvents",[]),S(this,"_updatedList",[]),S(this,"translationBuffer",J(9)),S(this,"needsRecalculate",!0),S(this,"emptyPaintables",[]),S(this,"renderOrder",[]),S(this,"points"),S(this,"objects",[]),S(this,"subscriptions",[]),S(this,"_propagateEventTargets",[]),S(this,"_alreadyFlushed",[]),this._width=t,this._height=r,this.aspectRatio=Number.isNaN(t/r)?1:t/r,this.viewingDirection=o,this.points=J(n*5),this.filteredPointsBuffer=J(n*5)}get x(){return 0}get y(){return 0}get width(){return this._width}get height(){return this._height}static withProps(t){let r=new Yg;return r.applyProps(t),r}applyProps(t){typeof t.width<"u"&&typeof t.height<"u"&&(t.width!==this._width||t.height!==this._height)&&this.resize(t.width,t.height),t.viewingDirection!==this.viewingDirection&&(this.viewingDirection=t.viewingDirection,this.triggerRepaint())}propagateTouchEvent(t,r,n){let o=[];for(let a of n)if(a.x&&a.y){let u=de.singleBox(1,1,a.x,a.y);o.push(this.getObjectsAt(u,!0).reverse())}return o.map(a=>this.propagateEvent(t,r,a,{bubbles:!0,cancelable:!0}))}propagatePointerEvent(t,r,n,o,a={}){let u=de.singleBox(1,1,n,o),h=this.getObjectsAt(u,!0).reverse();return this.propagateEvent(t,r,h,a)}propagateEvent(t,r,n,{bubbles:o=!1,cancelable:a=!1}={}){r.atlasTarget=this,this._propagateEventTargets.length=1,this._propagateEventTargets[0]=this;let u=!1;r.stopPropagation=()=>{u=!0};let h=n.length;for(let p=h-1;p>=0;p--){this._propagateEventTargets.unshift(n[p][0]);let v=n[p][1].length;if(v)for(let x=0;x<v;x++)this._propagateEventTargets.unshift(n[p][1][x])}let f=this._propagateEventTargets.length,g=!1;for(let p=0;p<f&&(r.atlasTarget=this._propagateEventTargets[p],r.atlasWorld=this,g=this._propagateEventTargets[p].dispatchEvent(t,r)||g,!u);p++);return g&&this.triggerRepaint(),this._propagateEventTargets}appendChild(t){let r=this.appendWorldObject(t);this.renderOrder.push(r/5)}removeChild(t){let r=this.objects.indexOf(t);if(r===-1){for(let n of this.objects)if(n&&n.id===t.id){this.removeChild(n);return}return}this.objects[r]=null,this.renderOrder=this.renderOrder.filter(n=>n!==r),this.points[r*5]=0,this.triggerRepaint(),this.needsRecalculate=!0}insertBefore(t,r){let n=this.objects.indexOf(r);if(n===-1)return;let o=this.appendWorldObject(t);this.renderOrder.splice(n-1,0,o/5)}hideInstance(){}asWorldObject(){return null}addZone(t){this.zones.push(t)}selectZone(t){if(typeof t=="string"){let r=this.zones.length;for(let n=0;n<r;n++)if(this.zones[n].id===t){this.selectedZone=n,this.trigger("zone-changed");return}}else this.zones[t]&&(this.selectedZone=t,this.trigger("zone-changed"))}deselectZone(){this.selectedZone=void 0}getActiveZone(){if(this.selectedZone)return this.zones[this.selectedZone]}hasActiveZone(){return typeof this.selectedZone<"u"}checkResizeInternalBuffer(){if(am(this.points)===this.objects.length){let t=this.points,r=J(this.points.length*2);r.set(t,0),this.points=r}}appendWorldObject(t){this.checkResizeInternalBuffer();let r=this.objects.length*5,n=t.points;return t.points=this.points.subarray(this.objects.length*5,this.objects.length*5+5),t.points[1]=n[1],t.points[2]=n[2],t.points[3]=n[3],t.points[4]=n[4],this.objects.push(t),this.filteredPointsBuffer=J(this.objects.length*5),this.needsRecalculate=!0,this.triggerRepaint(),r}recalculateWorldSize(){let t=!1;if(this.needsRecalculate){let r=new Int32Array(this.objects.length),n=new Int32Array(this.objects.length),o=this.renderOrder.length;for(let h=0;h<o;h++){let f=this.renderOrder[h];this.objects[f]&&(r[h]=this.points[f*5+3],n[h]=this.points[f*5+4])}let a=Math.max(...r);a!==this._width&&(this._width=a,t=!0);let u=Math.max(...n);u!==this._height&&(this._height=u,t=!0),t&&this.trigger("recalculate-world-size",{width:a,height:u}),this.needsRecalculate=!1}return t}addObjectAt(t,r){r.width&&!r.height?r.height=r.width/t.width*t.height:r.height&&!r.width&&(r.width=r.height/t.height*t.width),(!r||!r.width||!r.height)&&(r.width=t.width,r.height=t.height);let{width:n,x:o,y:a}=r,u=n/t.width;this.checkResizeInternalBuffer(),this.points.set(de.singleBox(t.width,t.height,0,0),this.objects.length*5);let h=new zh(t);return h.points=this.points.subarray(this.objects.length*5,this.objects.length*5+5),this.objects.push(h),this.scaleWorldObject(this.objects.length-1,u),this.translateWorldObject(this.objects.length-1,o,a),this.filteredPointsBuffer=J(this.points.length*2),this.triggerRepaint(),this.needsRecalculate=!0,h}scaleWorldObject(t,r){Ut(this.points.subarray(t*5,t*5+5),vi(r,this.points[t*5+1],this.points[t*5+2]));let n=this.objects[t];n&&(n.atScale(r),this.triggerRepaint())}translateWorldObject(t,r,n){Ut(this.points.subarray(t*5,t*5+5),tt(r,n));let o=this.objects[t];o&&(o.translate(r,n),this.triggerRepaint())}resize(t,r){return this._width=t,this._height=r,this.aspectRatio=t/r,this.triggerRepaint(),this}getObjects(){return this.objects}getPoints(){return this.points}getPointsFromViewer(t,r){let n=de.singleBox(t.width,t.height,t.x,t.y);return this.getPointsAt(n,r,t.scale)}addLayoutSubscriber(t){return this.subscriptions.push(t),()=>{this.subscriptions.splice(this.subscriptions.indexOf(t),1)}}getScheduledUpdates(t,r){let n=Ni(this.points,t,this.filteredPointsBuffer),o=this.objects.length;this._updatedList=[];for(let a=0;a<o;a++)if(n[a*5]!==0){if(!this.objects[a])continue;this._updatedList.push(...this.objects[a].getScheduledUpdates(t,r))}return this._updatedList}getObjectsAt(t,r=!1){let n=this.getActiveZone(),o=Ni(this.points,t,this.filteredPointsBuffer),a=this.renderOrder.length,u=[];for(let h=0;h<a;h++){let f=this.renderOrder[h];if(o[f*5]!==0){let g=this.objects[f];if(!g||n&&n.objects.indexOf(g)===-1)continue;if(g.type!=="world-object"){u.push([g,[g]]);continue}r?u.push([g,g.getObjectsAt(t,r)]):u.push([g,this.emptyPaintables])}}return u}getPointsAt(t,r,n=1){let o=this.getObjectsAt(t),a=Zt(lr(n),tt(-t[1],-t[2]),this.translationBuffer),u=r?Zt(r,a,this.aggregateBuffer):a,h=o.length,f=[];for(let g=0;g<h;g++)o[g]&&f.push(...o[g][0].getAllPointsAt(t,u,n));return f}flushSubscriptions(){if(this.triggerQueue.length){this._alreadyFlushed=[];let t=this.triggerQueue.length;for(let r=0;r<t;r++){if(this._alreadyFlushed.indexOf(this.triggerQueue[r][0])!==-1)continue;typeof this.triggerQueue[r][1]>"u"&&this._alreadyFlushed.push(this.triggerQueue[r][0]);let n=this.subscriptions.length;for(let o=0;o<n;o++)this.subscriptions[o].apply(null,this.triggerQueue[r])}this.triggerQueue=[]}}trigger(t,r){this.triggerQueue.push([t,r])}triggerEventActivation(){this.trigger("event-activation")}triggerRepaint(){this.trigger("repaint")}gotoRegion(t){this.trigger("goto-region",t)}goHome(t=!1){this.trigger("go-home",{immediate:t})}zoomTo(t,r,n){this.trigger("zoom-to",{point:r,factor:t,stream:n})}zoomIn(t){this.trigger("zoom-to",{point:t,factor:.5})}zoomOut(t){this.trigger("zoom-to",{point:t,factor:2})}constraintBounds(t){this.trigger("constrain-bounds",{immediate:t})}};var gl=/([0-9]+(px|em)\s+)+(solid)\s+(.*)/g,vl={},Qw=["backgroundColor","opacity","boxShadow","borderColor","borderWidth","borderStyle","outlineColor","outlineWidth","outlineOffset","outlineStyle"],po=class extends ii{constructor(){super(),S(this,"id"),S(this,"type","spacial-content"),S(this,"points"),S(this,"hoverEvents",!1),S(this,"activeEvents",!1),S(this,"display",{x:0,y:0,scale:1,width:-1,height:-1,points:J(5)}),S(this,"_parsed",{border:{id:null,match:[]},outline:{id:null,match:[]}}),S(this,"hovering"),S(this,"pressing"),S(this,"props",{}),S(this,"addHover",()=>{this.hovering=!0,this.__revision++}),S(this,"removeHover",()=>{this.hovering=!1,this.pressing=!1,this.__revision++}),S(this,"addPress",()=>{this.pressing=!0,this.__revision++}),S(this,"removePress",()=>{this.pressing=!1,this.__revision++}),this.id=Ol(12),this.points=J(5)}getAllPointsAt(e,t){return[[this,this.points,t]]}applyProps(e={}){let t=!1;if(e.interactive!==this.props.interactive&&(t=!0,this.props.interactive=e.interactive),e.style){let r=e.border||e.style.border;if(r!==this._parsed.border.id)if(!r)this._parsed.border.id=null,this._parsed.border.match=[];else{let n=vl[r]||gl.exec(r)||gl.exec(r);n&&(this._parsed.border.id=r,this._parsed.border.match=vl[r]=n)}if(this._parsed.border.id&&(e.style.borderWidth=this._parsed.border.match[1],e.style.borderStyle="solid",e.style.borderColor=this._parsed.border.match[4]),e.style.outline!==this._parsed.outline.id)if(!e.style.outline)this._parsed.outline.id=null,this._parsed.outline.match=[];else{let n=vl[e.style.outline]||gl.exec(e.style.outline)||gl.exec(e.style.outline);n&&(this._parsed.outline.id=e.style.outline,this._parsed.outline.match=vl[e.style.outline]=n)}this._parsed.outline.id&&(e.style.outlineWidth=this._parsed.outline.match[1],e.style.outlineStyle="solid",e.style.outlineColor=this._parsed.outline.match[4]),this.props.style=e.style,e.backgroundColor&&!this.props.style.backgroundColor&&(this.props.style.backgroundColor=e.backgroundColor,t=!0),e.style.background&&!this.props.style.backgroundColor&&(this.props.style.backgroundColor=e.style.background,t=!0);for(let n of Qw)if(this.props.style[n]!==e.style[n]){t=!0;break}e.style[":hover"]!==this.props.hoverStyles&&(this.props.hoverStyles=e.style[":hover"],this.hoverEvents||(this.hoverEvents=!0,this.addEventListener("pointerenter",this.addHover),this.addEventListener("pointerleave",this.removeHover)),t=!0),e.style[":active"]!==this.props.pressStyles&&(this.props.pressStyles=e.style[":active"],this.activeEvents||(this.activeEvents=!0,this.addEventListener("mousedown",this.addPress),this.addEventListener("mouseup",this.removePress)),t=!0)}e.href!==this.props.href&&(this.props.href=e.href,t=!0),e.hrefTarget!==this.props.hrefTarget&&(this.props.hrefTarget=e.hrefTarget,t=!0),e.title!==this.props.title&&(this.props.title=e.title,t=!0),e.className!==this.props.className&&(this.props.className=e.className,e.className&&!this.hoverEvents&&(this.hoverEvents=!0,this.addEventListener("pointerenter",this.addHover),this.addEventListener("pointerleave",this.removeHover)),e.className&&!this.activeEvents&&(this.activeEvents=!0,this.addEventListener("mousedown",this.addPress),this.addEventListener("mouseup",this.removePress)),t=!0),e.relativeSize!==this.props.relativeSize&&(this.props.relativeSize=e.relativeSize,t=!0),e.relativeStyle!==this.props.relativeStyle&&(this.props.relativeStyle=e.relativeStyle,t=!0),e.html!==this.props.html&&(this.props.html=e.html,t=!0),e.target&&(e.target.width!==this.display.width||e.target.height!==this.display.height||e.target.x!==this.points[1]||e.target.y!==this.points[2])&&(t=!0,this.points=de.singleBox(e.target.width,e.target.height,e.target.x,e.target.y),this.display.points=de.singleBox(e.target.width,e.target.height,e.target.x,e.target.y),this.display.width=e.target.width,this.display.height=e.target.height),t&&this.__revision++}},El=class extends ii{constructor(){super(),S(this,"type","spacial-content"),S(this,"id"),S(this,"points"),S(this,"color","#000"),S(this,"backgroundColor"),S(this,"hovering"),S(this,"pressing"),S(this,"text",""),S(this,"display",{x:0,y:0,scale:1,width:100,height:100,points:J(5)}),S(this,"className"),S(this,"html"),S(this,"interactive",!1),S(this,"props",{font:"18px Arial, sans-serif",lineHeight:1,textAlign:"left",verticalAlign:"top",paddingX:0,paddingY:0,fitParent:!1,lineBreak:"auto",strokeText:!1,sizeToFill:!1,maxFontSizeToFill:void 0,allowNewLine:!0,justifyLines:!1,renderHDPI:!1,textDecoration:"none",interactive:!1,relativeSize:!1}),this.id="",this.points=J(5)}getAllPointsAt(e,t){return[[this,this.points,t]]}applyProps({id:e,target:t,text:r,color:n,backgroundColor:o,fontSize:a=18,interactive:u,fontFamily:h="Arial, sans-serif",...f}){f.font=`${a}px ${h}`,this.interactive=u||!1,typeof r<"u"&&(this.text=r||""),n&&(this.color=n),o&&(this.backgroundColor=o),e&&(this.id=e),t&&(this.points=de.singleBox(t.width,t.height,t.x,t.y),this.display.points=this.points,this.display.width=t.width,this.display.height=t.height),this.props={...this.props,...f},this.__revision++}},rt=Math.pow,yl=Math.sqrt,ho=Math.sin,kg=Math.cos,mo=Math.PI,Rl=1.70158,xl=Rl*1.525,Lg=Rl+1,zg=2*mo/3,Ng=2*mo/4.5,Sl=function(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},Ui={linear:e=>e,easeInQuad:function(e){return e*e},easeOutQuad:function(e){return 1-(1-e)*(1-e)},easeInOutQuad:function(e){return e<.5?2*e*e:1-rt(-2*e+2,2)/2},easeInCubic:function(e){return e*e*e},easeOutCubic:function(e){return 1-rt(1-e,3)},easeInOutCubic:function(e){return e<.5?4*e*e*e:1-rt(-2*e+2,3)/2},easeInQuart:function(e){return e*e*e*e},easeOutQuart:function(e){return 1-rt(1-e,4)},easeInOutQuart:function(e){return e<.5?8*e*e*e*e:1-rt(-2*e+2,4)/2},easeInQuint:function(e){return e*e*e*e*e},easeOutQuint:function(e){return 1-rt(1-e,5)},easeInOutQuint:function(e){return e<.5?16*e*e*e*e*e:1-rt(-2*e+2,5)/2},easeInSine:function(e){return 1-kg(e*mo/2)},easeOutSine:function(e){return ho(e*mo/2)},easeInOutSine:function(e){return-(kg(mo*e)-1)/2},easeInExpo:function(e){return e===0?0:rt(2,10*e-10)},easeOutExpo:function(e){return e===1?1:1-rt(2,-10*e)},easeInOutExpo:function(e){return e===0?0:e===1?1:e<.5?rt(2,20*e-10)/2:(2-rt(2,-20*e+10))/2},easeInCirc:function(e){return 1-yl(1-rt(e,2))},easeOutCirc:function(e){return yl(1-rt(e-1,2))},easeInOutCirc:function(e){return e<.5?(1-yl(1-rt(2*e,2)))/2:(yl(1-rt(-2*e+2,2))+1)/2},easeInBack:function(e){return Lg*e*e*e-Rl*e*e},easeOutBack:function(e){return 1+Lg*rt(e-1,3)+Rl*rt(e-1,2)},easeInOutBack:function(e){return e<.5?rt(2*e,2)*((xl+1)*2*e-xl)/2:(rt(2*e-2,2)*((xl+1)*(e*2-2)+xl)+2)/2},easeInElastic:function(e){return e===0?0:e===1?1:-rt(2,10*e-10)*ho((e*10-10.75)*zg)},easeOutElastic:function(e){return e===0?0:e===1?1:rt(2,-10*e)*ho((e*10-.75)*zg)+1},easeInOutElastic:function(e){return e===0?0:e===1?1:e<.5?-(rt(2,20*e-10)*ho((20*e-11.125)*Ng))/2:rt(2,-20*e+10)*ho((20*e-11.125)*Ng)/2+1},easeInBounce:function(e){return 1-Sl(1-e)},easeOutBounce:Sl,easeInOutBounce:function(e){return e<.5?(1-Sl(1-2*e))/2:(1+Sl(2*e-1))/2}},Yw=class{constructor(e){S(this,"runtime"),S(this,"pendingTransition"),this.runtime=e,this.pendingTransition={from:J(5),to:J(5),elapsed_time:0,done:!0,total_time:0,timingFunction:Ui.easeInOutQuad,constrain:!1}}hasPending(){return!this.pendingTransition.done}getPendingTransition(){return this.pendingTransition}getPendingFrom(){return this.pendingTransition.from}customTransition(e){e(this.pendingTransition)}stopTransition(){this.pendingTransition.from=J(this.runtime.target),this.pendingTransition.to=J(this.runtime.target),this.pendingTransition.done=!0,this.pendingTransition.elapsed_time=0,this.pendingTransition.total_time=0}runTransition(e,t){if(!this.pendingTransition.done){let r=this.pendingTransition,n=r.total_time===0?0:(r.elapsed_time+t)/r.total_time,o=r.total_time===0?1:n===0?0:r.timingFunction(n);e[1]=r.from[1]+(r.to[1]-r.from[1])*o,e[2]=r.from[2]+(r.to[2]-r.from[2])*o,e[3]=r.from[3]+(r.to[3]-r.from[3])*o,e[4]=r.from[4]+(r.to[4]-r.from[4])*o,this.pendingTransition.elapsed_time+=t,this.pendingTransition.elapsed_time>=this.pendingTransition.total_time&&(this.pendingTransition.done=!0,this.pendingTransition.constrain&&this.constrainBounds({transition:{duration:this.pendingTransition.total_time===0?0:500,easing:Ui.easeOutExpo}}))}}zoomTo(e,{origin:t,stream:r=!1,transition:n}={}){let o=this.runtime.getZoomedPosition(e,{origin:t}),a=Math.abs(1-e);this.applyTransition(o,n,{duration:2e3*a,easing:Ui.easeOutExpo,constrain:!0},{stream:!1})}constrainBounds({transition:e,panPadding:t=0}={}){let[r,n]=this.runtime.constrainBounds(this.runtime.target,{panPadding:t});r&&(this.applyTransition(n,e,{duration:500,easing:Ui.easeOutQuart,constrain:!1}),this.runtime.updateNextFrame())}applyTransition(e,t,r,{stream:n}={}){this.pendingTransition.from=J(this.runtime.target),this.pendingTransition.to=e,n||(this.pendingTransition.elapsed_time=0),this.pendingTransition.done=!1,this.pendingTransition.total_time=typeof t?.duration<"u"?t.duration:typeof r?.duration<"u"?r.duration:1e3,this.pendingTransition.constrain=typeof t?.constrain<"u"?t.constrain:typeof r?.constrain<"u"?r.constrain:!1,this.pendingTransition.timingFunction=t?.easing||r?.easing||Ui.easeInOutSine}goToRegion(e,{transition:t}={}){let r=this.runtime.clampRegion(e);this.applyTransition(de.singleBox(r.width,r.height,r.x,r.y),t,{duration:1e3,easing:Ui.easeOutExpo,constrain:!0}),this.runtime.updateNextFrame()}},OC=Number.MIN_VALUE+1,kl=class{constructor(e,t,r,n=[],o){S(this,"id",Ol()),S(this,"ready",!1),S(this,"renderer"),S(this,"world"),S(this,"target"),S(this,"homePosition"),S(this,"manualHomePosition"),S(this,"manualFocalPosition"),S(this,"focalPosition"),S(this,"transitionManager"),S(this,"aggregate"),S(this,"transformBuffer",J(500)),S(this,"lastTarget",J(5)),S(this,"zoomBuffer",J(5)),S(this,"logNextRender",!1),S(this,"pendingUpdate",!0),S(this,"isCommitting",!1),S(this,"firstRender",!0),S(this,"lastTime"),S(this,"stopId"),S(this,"mode","explore"),S(this,"controllers",[]),S(this,"controllersRunning",!1),S(this,"controllerStopFunctions",[]),S(this,"maxScaleFactor",1),S(this,"_viewerToWorld",{x:0,y:0}),S(this,"_lastGoodScale",1),S(this,"hooks",{useFrame:[],useBeforeFrame:[],useAfterPaint:[],useAfterFrame:[]}),S(this,"fpsLimit"),S(this,"options"),S(this,"hookOptions",{filters:{grayscale:0,contrast:0,brightness:0,saturate:0,sepia:0,invert:0,hueRotate:0,blur:0}}),S(this,"_viewport",{x:0,y:0,width:0,height:0}),S(this,"setViewport",a=>{let u=Math.round(typeof a.x>"u"?this.target[1]:a.x),h=Math.round(typeof a.y>"u"?this.target[2]:a.y);a.width?this.target[3]=u+a.width:this.target[3]=this.target[3]-this.target[1]+u,a.height?this.target[4]=h+a.height:this.target[4]=this.target[4]-this.target[2]+h,Math.abs(this.target[1]-u)>.01&&(this.target[1]=u),Math.abs(this.target[2]-h)>.01&&(this.target[2]=h),this.pendingUpdate=!0}),S(this,"render",a=>{let u=a-this.lastTime;if(this.isCommitting||this.fpsLimit&&u<1e3/this.fpsLimit){this.stopId=window.requestAnimationFrame(this.render);return}this.lastTime=a,this.world.flushSubscriptions(),this.stopId=window.requestAnimationFrame(this.render),this.hook("useFrame",u);let h=this.pendingUpdate,f=this.renderer.pendingUpdate();if(this.transitionManager.hasPending()&&(this.transitionManager.runTransition(this.target,u),this.pendingUpdate=!0,this.updateControllerPosition()),!this.firstRender&&!h&&!f&&this.target[0]===this.lastTarget[0]&&this.target[1]===this.lastTarget[1]&&this.target[2]===this.lastTarget[2]&&this.target[3]===this.lastTarget[3]&&this.target[4]===this.lastTarget[4])return;this.hook("useBeforeFrame",u),this.renderer.beforeFrame(this.world,u,this.target,this.hookOptions);let g=this.getScaleFactor(),p=this.renderer.getPointsAt(this.world,this.target,this.aggregate,g),v=p.length;for(let w=0;w<v;w++){let A=p[w][0],E=p[w][1],P=p[w][2],I=P?ur(E,P,this.transformBuffer):E;this.renderer.prepareLayer(A,A.__parent&&P?ur(A.__parent.crop||A.__parent.points,P):I);let F=I.length/5;for(let X=0;X<F;X++){let W=X*5;I[W]!==0&&(this.renderer.paint(A,X,I[W+1],I[W+2],I[W+3]-I[W+1],I[W+4]-I[W+2]),this.hook("useAfterPaint",A))}this.renderer.finishLayer(A,E)}this.renderer.afterFrame(this.world,u,this.target,this.hookOptions),this.hook("useAfterFrame",u),this.lastTarget[0]=this.target[0],this.lastTarget[1]=this.target[1],this.lastTarget[2]=this.target[2],this.lastTarget[3]=this.target[3],this.lastTarget[4]=this.target[4],this.firstRender=!1,this.pendingUpdate=!1,this.logNextRender=!1,this.renderer.isReady()&&(this.ready=!0,this.world.trigger("ready")),this.world.flushSubscriptions();let x=this.world.getScheduledUpdates(this.target,g),b=x.length;if(b>0)for(let w=0;w<b;w++){let A=x[b-w-1]();A?A.then(()=>{this.pendingUpdate=!0}):this.pendingUpdate=!0}}),this.renderer=e,this.world=t,this.options={maxOverZoom:1,maxUnderZoom:1,visibilityRatio:1.5,...o||{}},this.target=de.projection(r),this.manualHomePosition=!1,this.pendingUpdate=!0,this.homePosition=de.projection(this.world),this.manualFocalPosition=!1,this.focalPosition=this.target,this.updateFocalPosition(),this.transitionManager=new Yw(this),this.aggregate=lr(1),this.world.addLayoutSubscriber(a=>{a==="repaint"&&(this.pendingUpdate=!0),a==="recalculate-world-size"&&(this.manualHomePosition||(this.setHomePosition(),this.goHome()),this.updateFocalPosition())}),this.lastTime=performance.now(),this.controllers=n,this.render(this.lastTime),this.startControllers()}get x(){return this.target[1]}set x(e){this.target[1]=e}get y(){return this.target[2]}set y(e){this.target[2]=e}get x2(){return this.target[3]}set x2(e){this.target[3]=e}get y2(){return this.target[4]}set y2(e){this.target[4]=e}get width(){return this.target[3]-this.target[1]}set width(e){this.target[3]=this.target[1]+e}get height(){return this.target[4]-this.target[2]}set height(e){this.target[4]=this.target[2]=e}setHomePosition(e){this.homePosition.set(de.projection(e||this.world)),this.pendingUpdate=!0}startControllers(){if(!this.controllersRunning){for(let e of this.controllers)this.controllerStopFunctions.push(e.start(this));this.controllersRunning=!0}}stopControllers(){if(this.controllersRunning){for(let e of this.controllerStopFunctions)e();this.controllersRunning=!1,this.controllerStopFunctions=[]}}updateControllerPosition(){for(let e of this.controllers)e.updatePosition(this.x,this.y,this.width,this.height)}triggerResize(){this.renderer.triggerResize&&this.renderer.triggerResize(),this.pendingUpdate=!0}addController(e){this.controllers.push(e),this.controllersRunning&&e.start(this),this.pendingUpdate=!0}cover(){return this.goHome({cover:!0})}getRendererScreenPosition(){return this.renderer.getRendererScreenPosition()}updateRendererScreenPosition(){this.pendingUpdate=!0,this.renderer.resize()}setOptions(e){this.options={...this.options,...e}}goHome(e={}){if(this.world.width<=0||this.world.height<=0)return;let t=this.getScaleFactor(),r=e.position?{x:e.position[1],y:e.position[2],width:e.position[3]-e.position[1],height:e.position[4]-e.position[2]}:{x:this.homePosition[1],y:this.homePosition[2],width:this.homePosition[3]-this.homePosition[1],height:this.homePosition[4]-this.homePosition[2]},n=this.width*t,o=this.height*t,a=r.width/n,u=r.height/o,h=n/o;if(e.cover?a>u:a<u){let f=h*r.height,g=(f-r.width)/2;this.target[1]=Math.round(-g+r.x),this.target[2]=Math.round(r.y),this.target[3]=Math.round(f-g+r.x),this.target[4]=Math.round(r.height+r.y)}else{let f=r.width/h,g=(f-r.height)/2;this.target[1]=Math.round(r.x),this.target[2]=Math.round(r.y-g),this.target[3]=Math.round(r.x+r.width),this.target[4]=Math.round(r.y+f-g)}this.constrainBounds(this.target),this.updateControllerPosition()}resize(e,t,r,n){this.updateFocalPosition(e-t,r-n);let o=t/e,a=n/r;this.target[3]=this.target[1]+(this.target[3]-this.target[1])*o,this.target[4]=this.target[2]+(this.target[4]-this.target[2])*a,this.goHome({position:this.focalPosition}),this.renderer.resize(t,n),this.pendingUpdate=!0}updateFocalPosition(e,t){if(!this.manualFocalPosition){let r=this.width,n=this.height,o=Math.min(r,n),a=0,u=0,h=this.x+a,f=this.y+u;if(r<n){let g=this.height-this.width;this.focalPosition=de.projection({x:h,y:f+g/2,width:o-a*2,height:o-u*2}),this.pendingUpdate=!0}else{let g=this.width-this.height;this.focalPosition=de.projection({x:h+g/2,y:f,width:o-a*2,height:o-u*2}),this.pendingUpdate=!0}}}getViewport(){return this._viewport.x=this.target[1],this._viewport.y=this.target[2],this._viewport.width=this.target[3]-this.target[1],this._viewport.height=this.target[4]-this.target[2],this._viewport}constrainBounds(e,{panPadding:t=0,ref:r=!1}={}){let{minX:n,maxX:o,minY:a,maxY:u}=this.getBounds({target:e,padding:t}),h=!1,f=r?e:J(e),g=Math.round(e[3]-e[1]),p=Math.round(e[4]-e[2]);return n>e[1]&&(h=!0,f[1]=n,f[3]=n+g),a>e[2]&&(h=!0,f[2]=a,f[4]=a+p),o<e[1]&&(h=!0,f[1]=o,f[3]=o+g),u<e[2]&&(h=!0,f[2]=u,f[4]=u+p),[h,f]}getBounds(e){let t=e.target||this.target,r=e.padding,n=this.options.visibilityRatio,o=Math.abs(1-n);if(this.world.hasActiveZone()){let P=this.world.getActiveZone();if(P){let I=t[3]-t[1]<P.points[3]-P.points[1],F=t[4]-t[2]<P.points[4]-P.points[2];return{minX:I?P.points[1]-r:P.points[1]+(P.points[3]-P.points[1])/2-(t[3]-t[1])/2,maxX:F?P.points[2]-r:P.points[2]+(P.points[4]-P.points[2])/2-(t[4]-t[2])/2,minY:I?P.points[3]+r:P.points[1]+(P.points[3]-P.points[1])/2-(t[3]-t[1])/2,maxY:F?P.points[4]+r:P.points[2]+(P.points[4]-P.points[2])/2-(t[4]-t[2])/2}}}let a=t[3]-t[1],u=this.world.width,h=-a*o,f=u-a-h,g=t[4]-t[2],p=this.world.height,v=-g*o,x=p-g-v,b=Math.round(Math.max(h,f)),w=Math.round(Math.min(h,f)),A=Math.round(Math.max(v,x)),E=Math.round(Math.min(v,x));return{minX:w,maxX:b,minY:E,maxY:A}}getScaleFactor(e=!1){let t=this.renderer.getScale(this.target[3]-this.target[1],this.target[4]-this.target[2],e);return t===0?this._lastGoodScale:(this._lastGoodScale=t,t)}getZoomedPosition(e,{origin:t,fromPos:r}){let n=r?{width:r[3]-r[1],height:r[4]-r[2]}:void 0,o=n?this.renderer.getScale(n.width,n.height):this.getScaleFactor(),a=n?n.width:this.width,u=n?n.height:this.height,h=this.getRendererScreenPosition()?.width,f=this.world.width,g=h?h/f:1,p=this.options.maxUnderZoom,v=Math.max(g||1,this.options.maxOverZoom),x=1/e,b=o*x;if(x<1){let A=a*o,E=u*o,P=this.world.width/A,I=this.world.height/E;if(P>I){let F=this.world.width*b,X=~~(a*o)*p;F<X&&(e=this.world.width*o/(a*o*p))}else{let F=this.world.height*b,X=~~(u*o)*p;F<X&&(e=this.world.height*o/(u*o*p))}}else b>v&&(e=o/v);let w=ur(this.target,vi(e,t?t.x:this.target[1]+(this.target[3]-this.target[1])/2,t?t.y:this.target[2]+(this.target[4]-this.target[2])/2),this.zoomBuffer);return this.constrainBounds(w,{ref:!0,panPadding:100}),w}clampRegion({x:e,y:t,width:r,height:n,padding:o=0}){let a=this.width,u=this.height,h=r/a<n/u,f=e-o,g=t-o,p=r+o*2,v=n+o*2;if(h){let b=v/u*a;return{x:f-(b-p)/2,y:g,width:b,height:v}}let x=p/a*u;return{x:f,y:g-(x-v)/2,width:p,height:x}}viewerToWorld(e,t){let r=this.getScaleFactor();return this._viewerToWorld.x=this.target[1]+e/r,this._viewerToWorld.y=this.target[2]+t/r,this._viewerToWorld}worldToViewer(e,t,r,n){let o=de.singleBox(r,n,e,t);return Ut(o,Zt(lr(this.getScaleFactor()),tt(-this.target[1],-this.target[2]))),{x:o[1],y:o[2],width:o[3]-o[1],height:o[4]-o[2],strand:o}}setScale(e,t){Ut(this.target,vi(e,t?t.x:this.target[1]+(this.target[3]-this.target[1])/2,t?t.y:this.target[2]+(this.target[4]-this.target[2])/2)),this.pendingUpdate=!0}syncTo(e){let t=this.target;return this.target=e.target,this.pendingUpdate=!0,()=>{this.target=t}}stop(){return typeof this.stopId<"u"&&(window.cancelAnimationFrame(this.stopId),this.stopId=void 0),()=>{this.render(performance.now())}}reset(){this.renderer.reset()}selectZone(e){this.world.selectZone(e),this.pendingUpdate=!0}deselectZone(){this.world.deselectZone(),this.pendingUpdate=!0}hook(e,t){let r=this.hooks[e].length;if(r!==0)for(let n=0;n<r;n++)this.hooks[e][n](t)}registerHook(e,t){return this.hooks[e].push(t),()=>{this.hooks[e]=this.hooks[e].filter(r=>r!==t)}}updateNextFrame(){this.pendingUpdate=!0}},wl=/([0-9]+(px|em)\s+)+(solid)\s+(.*)/g,Al={},Gw=["backgroundColor","opacity","boxShadow","borderColor","borderWidth","borderStyle","outlineColor","outlineWidth","outlineOffset","outlineStyle"],Gg=class extends ii{constructor(){super(),S(this,"id"),S(this,"type","spacial-content"),S(this,"isShape",!0),S(this,"points"),S(this,"hoverEvents",!1),S(this,"activeEvents",!1),S(this,"display",{x:0,y:0,scale:1,width:-1,height:-1,points:J(5)}),S(this,"boundingBox",null),S(this,"_parsed",{border:{id:null,match:[]},outline:{id:null,match:[]}}),S(this,"hovering"),S(this,"pressing"),S(this,"props",{}),S(this,"shape",{type:"none"}),S(this,"addHover",()=>{this.hovering=!0,this.__revision++}),S(this,"removeHover",()=>{this.hovering=!1,this.pressing=!1,this.__revision++}),S(this,"addPress",()=>{this.pressing=!0,this.__revision++}),S(this,"removePress",()=>{this.pressing=!1,this.__revision++}),this.id=Ol(12),this.points=J(5),this.shape={type:"none"}}updateBoundingBox(){if(this.shape.type==="none")return;let e=this.shape.points;if(this.shape.points.length>2){let t=Math.min(...e.map(a=>a[0])),r=Math.min(...e.map(a=>a[1])),n=Math.max(0,...e.map(a=>a[0])),o=Math.max(0,...e.map(a=>a[1]));this.boundingBox={x:t,y:r,width:n-t,height:o-r};return}this.boundingBox=null}intersects(e){if(!e||this.shape.type==="none")return!1;let[t,r]=e,n=this.shape.points,o=this.boundingBox;if(o||(this.updateBoundingBox(),o=this.boundingBox),!o||t<o.x||t>o.x+o.width||r<o.y||r>o.height+o.y)return!1;let a=!1;for(let u=0,h=n.length-1;u<n.length;h=u++)n[u][1]>r!=n[h][1]>r&&t<(n[h][0]-n[u][0])*(r-n[u][1])/(n[h][1]-n[u][1])+n[u][0]&&(a=!a);return a}getAllPointsAt(e,t){return e[3]-e[1]===1&&e[4]-e[2]===1?this.intersects([e[1],e[2]])?[[this,this.points,t]]:[]:[[this,this.points,t]]}applyProps(e={}){let t=!1;if(e.points)if(this.shape.type!=="polygon"||this.shape.points.length!==e.points.length)this.shape={type:"polygon",points:e.points,open:e.open},this.updateBoundingBox();else{let r=!1,n=e.points.length;for(let o=0;o<n;o++)if(e.points[o][0]!==this.shape.points[o][0]||e.points[o][1]!==this.shape.points[o][1]){r=!0;break}r&&(this.shape={type:"polygon",points:e.points,open:e.open},this.updateBoundingBox())}if(e.interactive!==this.props.interactive&&(t=!0,this.props.interactive=e.interactive),(e.open||e.open===!1)&&(t=!0,this.shape.open=e.open),e.style){let r=e.border||e.style.border;if(r!==this._parsed.border.id)if(!r)this._parsed.border.id=null,this._parsed.border.match=[];else{let n=Al[r]||wl.exec(r)||wl.exec(r);n&&(this._parsed.border.id=r,this._parsed.border.match=Al[r]=n)}if(this._parsed.border.id&&(e.style.borderWidth=this._parsed.border.match[1],e.style.borderStyle="solid",e.style.borderColor=this._parsed.border.match[4]),e.style.outline!==this._parsed.outline.id)if(!e.style.outline)this._parsed.outline.id=null,this._parsed.outline.match=[];else{let n=Al[e.style.outline]||wl.exec(e.style.outline)||wl.exec(e.style.outline);n&&(this._parsed.outline.id=e.style.outline,this._parsed.outline.match=Al[e.style.outline]=n)}this._parsed.outline.id&&(e.style.outlineWidth=this._parsed.outline.match[1],e.style.outlineStyle="solid",e.style.outlineColor=this._parsed.outline.match[4]),this.props.style=e.style,e.backgroundColor&&!this.props.style.backgroundColor&&(this.props.style.backgroundColor=e.backgroundColor,t=!0),e.style.background&&!this.props.style.backgroundColor&&(this.props.style.backgroundColor=e.style.background,t=!0);for(let n of Gw)if(this.props.style[n]!==e.style[n]){t=!0;break}e.style[":hover"]!==this.props.hoverStyles&&(this.props.hoverStyles=e.style[":hover"],this.hoverEvents||(this.hoverEvents=!0,this.addEventListener("pointerenter",this.addHover),this.addEventListener("pointerleave",this.removeHover)),t=!0),e.style[":active"]!==this.props.pressStyles&&(this.props.pressStyles=e.style[":active"],this.activeEvents||(this.activeEvents=!0,this.addEventListener("mousedown",this.addPress),this.addEventListener("mouseup",this.removePress)),t=!0)}e.href!==this.props.href&&(this.props.href=e.href,t=!0),e.hrefTarget!==this.props.hrefTarget&&(this.props.hrefTarget=e.hrefTarget,t=!0),e.title!==this.props.title&&(this.props.title=e.title,t=!0),e.className!==this.props.className&&(this.props.className=e.className,e.className&&!this.hoverEvents&&(this.hoverEvents=!0,this.addEventListener("pointerenter",this.addHover),this.addEventListener("pointerleave",this.removeHover)),e.className&&!this.activeEvents&&(this.activeEvents=!0,this.addEventListener("mousedown",this.addPress),this.addEventListener("mouseup",this.removePress)),t=!0),e.relativeSize!==this.props.relativeSize&&(this.props.relativeSize=e.relativeSize,t=!0),e.relativeStyle!==this.props.relativeStyle&&(this.props.relativeStyle=e.relativeStyle,t=!0),e.html!==this.props.html&&(this.props.html=e.html,t=!0),e.target&&(e.target.width!==this.display.width||e.target.height!==this.display.height||e.target.x!==this.points[1]||e.target.y!==this.points[2])&&(t=!0,this.points=de.singleBox(e.target.width,e.target.height,e.target.x,e.target.y),this.display.points=de.singleBox(e.target.width,e.target.height,e.target.x,e.target.y),this.display.width=e.target.width,this.display.height=e.target.height),t&&this.__revision++}},Fg=/(-?[0-9]+(px|em)\s+|0\s+)(-?[0-9]+(px|em)\s+|0\s+)(-?[0-9]+(px|em)\s+|0\s+)?(-?[0-9]+(px|em)\s+|0\s+)?(.*)/g,Dg={},Xw=typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes("firefox"),bl={},$w=class{constructor(e,t){S(this,"canvas"),S(this,"ctx"),S(this,"options"),S(this,"imagesPending",0),S(this,"imagesLoaded",0),S(this,"frameIsRendering",!1),S(this,"pendingDrawCall",!1),S(this,"firstMeaningfulPaint",!1),S(this,"parallelTasks",8),S(this,"frameTasks",0),S(this,"loadingQueueOrdered",!0),S(this,"loadingQueue",[]),S(this,"currentTask",Promise.resolve()),S(this,"tasksRunning",0),S(this,"stats"),S(this,"averageJobTime",64),S(this,"lastKnownScale",1),S(this,"visible",[]),S(this,"previousVisible",[]),S(this,"rendererPosition"),S(this,"dpi"),S(this,"drawCalls",[]),S(this,"lastPaintedObject"),S(this,"hostCache"),S(this,"invalidated",[]),S(this,"_worker",()=>{if(this.loadingQueue.length){let r=this.loadingQueue.pop();r&&(this.tasksRunning++,this.frameTasks++,this.currentTask=r.task().then(()=>{this.tasksRunning--}).catch(()=>{this.tasksRunning--}))}}),S(this,"_scheduled",0),S(this,"_doWork",()=>{this.loadingQueue.length===0&&this.tasksRunning===0&&this._scheduled&&(clearInterval(this._scheduled),this._scheduled=0);let r=this.parallelTasks||1;!this.firstMeaningfulPaint&&this.loadingQueue.length&&(r=this.loadingQueue.length);for(let n=0;n<=r;n++)this._worker()}),this.canvas=e,this.rendererPosition=e.getBoundingClientRect(),this.ctx=e.getContext("2d",{alpha:!0}),this.ctx.imageSmoothingEnabled=!0,this.options=t||{},this.canvas.style.opacity="0",this.canvas.style.transition="opacity .3s",this.dpi=t?.dpi||1,this.hostCache=t?.lruCache?new hm({maxSize:1024*512*512,dispose:(r,n,o)=>{this.invalidated.push(n),r.width=0,r.height=0},sizeCalculation:(r,n)=>r.width*r.height}):{store:{},get(r){return this.store[r]},set(r,n){this.store[r]=n}}}getCanvasDims(){return{width:this.canvas.width/this.dpi,height:this.canvas.height/this.dpi}}resize(){this.rendererPosition=this.canvas.getBoundingClientRect()}isReady(){return this.firstMeaningfulPaint}afterFrame(e){if(this.clearTransform(),this.lastPaintedObject=void 0,this.frameIsRendering=!1,this.imagesPending=this.imagesPending-this.imagesLoaded,this.imagesLoaded=0,this.loadingQueueOrdered||(this.loadingQueue=this.loadingQueue.sort((t,r)=>t.network&&t.scale===r.scale?r.distance-t.distance:t.scale<r.scale?-1:1),this.loadingQueueOrdered=!0),this.previousVisible=this.visible,this.pendingDrawCall=!!this.drawCalls.length,this.pendingDrawCall)for(let t=0;t<this.drawCalls.length;t++){let r=this.drawCalls.shift();r&&r()}this.doOffscreenWork(),this.options.debug&&this.stats&&this.stats.end()}doOffscreenWork(){this.frameTasks=0,this.loadingQueue.length&&(this._worker(),this.loadingQueue.length&&(this._scheduled||(this._scheduled=setInterval(this._doWork,0))))}getScale(e,t,r){if(Number.isNaN(e)||Number.isNaN(t))return this.lastKnownScale;let n=this.getCanvasDims(),o=n.width/e,a=n.height/t,u=(o<a?a:o)*(r&&this.dpi||1);return Number.isNaN(u)||(this.lastKnownScale=u),this.lastKnownScale}beforeFrame(e,t,r,n){this.options.debug&&this.stats&&this.stats.begin(),this.frameIsRendering=!0,this.visible=[],this.options.beforeFrame&&this.options.beforeFrame(t);let o=this.getCanvasDims();if(this.ctx.globalAlpha=1,this.ctx.fillStyle=this.options.background||"rgb(0, 0, 0)",this.ctx.fillRect(0,0,o.width,o.height),n.enableFilters&&(n.filters.brightness||n.filters.contrast||n.filters.grayscale||n.filters.invert||n.filters.sepia||n.filters.saturate||n.filters.hueRotate||n.filters.blur)){let a="";n.filters.brightness&&(a+=`brightness(${~~(100+n.filters.brightness*100)}%) `),n.filters.contrast&&(a+=`contrast(${~~(100+n.filters.contrast*100)}%) `),n.filters.grayscale&&(a+=`grayscale(${~~(n.filters.grayscale*100)}%) `),n.filters.invert&&(a+=`invert(${~~(n.filters.invert*100)}%) `),n.filters.sepia&&(a+=`sepia(${~~(n.filters.sepia*100)}%) `),n.filters.saturate&&(a+=`saturate(${~~(100+n.filters.saturate*100)}%) `),n.filters.hueRotate&&(a+=`hue-rotate(${n.filters.hueRotate}deg) `),n.filters.blur&&(a+=`blur(${n.filters.blur}px) `),this.ctx.filter=a}else this.ctx.filter="none"}applyTransform(e,t,r,n,o){let a=e.__owner.value;if(a&&a.rotation){this.ctx.save();let u=t+n/2,h=r+o/2;this.ctx.translate(u,h),this.ctx.rotate(a.rotation*Math.PI/180),this.ctx.translate(-u,-h),this.lastPaintedObject=a}}clearTransform(){this.lastPaintedObject&&(this.lastPaintedObject.rotation&&this.ctx.restore(),this.lastPaintedObject=void 0)}paint(e,t,r,n,o,a){let u=this.ctx.globalAlpha;if(e instanceof Bi||e instanceof vo){if(e.display.rotation){this.ctx.save();let g=r+o/2,p=n+a/2;e.crop&&(g-=e.crop[t*5+1],p-=e.crop[t*5+2]),this.ctx.translate(g,p),this.ctx.rotate(e.display.rotation*Math.PI/180),this.ctx.translate(-g,-p)}if(this.visible.push(e),typeof e.style&&e.style.opacity!=="undefined"){if(!e.style.opacity)return;this.ctx.globalAlpha=e.style.opacity}try{let g=e.__host.canvas,p=this.getCanvasDims();if((g.indices.indexOf(t)===-1||this.invalidated.indexOf(g.canvases[t])!==-1)&&this.schedulePaintToCanvas(g,e,t,Pl({x:r+o/2,y:n+o/2},{x:p.width/2,y:p.height/2})),!this.firstMeaningfulPaint)return;let v=this.hostCache.get(g.canvases[t]);if(v)if(e.crop&&e.cropData){if(e.crop[t*5]){let x=[e.crop[t*5+1]/e.display.scale-e.display.points[t*5+1],e.crop[t*5+2]/e.display.scale-e.display.points[t*5+2],1+(e.crop[t*5+3]-e.crop[t*5+1])/e.display.scale,1+(e.crop[t*5+4]-e.crop[t*5+2])/e.display.scale];x[0]+=e.cropData.x/e.display.scale,x[1]+=e.cropData.y/e.display.scale;let b=e.x*this.lastKnownScale,w=e.y*this.lastKnownScale,A=[r+b,n+w,o,a];A[0]+=b,A[1]+=w,this.ctx.drawImage(v,x[0],x[1],x[2],x[3],A[0],A[1],A[2]+1,A[3]+1)}}else Xw?this.ctx.drawImage(v,0,0,e.display.points[t*5+3]-e.display.points[t*5+1],e.display.points[t*5+4]-e.display.points[t*5+2],r,n,o+1,a+1):this.ctx.drawImage(v,0,0,e.display.points[t*5+3]-e.display.points[t*5+1],e.display.points[t*5+4]-e.display.points[t*5+2],r,n,o+Number.MIN_VALUE+.5,a+Number.MIN_VALUE+.5)}catch{}e.display.rotation&&this.ctx.restore()}let h=e instanceof po&&this.options.box,f=e instanceof Gg&&this.options.polygon;if((h||f)&&!e.props.className&&!e.props.html&&!e.props.href){if(this.visible.push(e),e.props.style){let g=Object.assign({},e.props.style||{},e.hovering?e.props.hoverStyles:{},e.pressing?e.props.pressStyles:{}),p=e.props.relativeStyle?1:o/e.width;typeof g.opacity<"u"&&(this.ctx.globalAlpha=g.opacity);let v=0;typeof g.borderWidth<"u"&&(v=parseInt(g.borderWidth,10)*p);let x=0;typeof g.outlineWidth<"u"&&(x=parseInt(g.outlineWidth,10)*p);let b=0;if(typeof g.outlineOffset<"u"&&(b=parseInt(g.outlineOffset,10)*p),g.borderColor&&(this.ctx.strokeStyle=g.borderColor),g.boxShadow){let w=g.boxShadow.split(/,(?![^(]*\))/);for(let A of w){let E=Dg[A]||Fg.exec(A)||Fg.exec(A);Dg[A]=E,E&&(this.ctx.save(),this.ctx.shadowOffsetX=parseInt(E[1])*this.dpi*p,this.ctx.shadowOffsetY=parseInt(E[3])*this.dpi*p,this.ctx.shadowBlur=parseInt(E[5])*this.dpi*p,this.ctx.shadowColor=E[9],this.ctx.fillStyle="rgba(0,0,0,1)",this.ctx.fillRect(r+v,n+v,o,a),this.ctx.restore())}}if(this.ctx.fillStyle=g.backgroundColor||"transparent",this.ctx.lineWidth=v,f){let w=e.shape,A=w.points||[],E=A.length;this.ctx.beginPath();for(let P=0;P<E;P++)this.ctx.lineTo(r+A[P][0]*this.lastKnownScale,n+A[P][1]*this.lastKnownScale);w.open||this.ctx.closePath(),v&&this.ctx.stroke(),w.open||this.ctx.fill()}else v&&this.ctx.strokeRect(r+v/2,n+v/2,o+v,a+v),this.ctx.fillRect(r+v,n+v,o,a);x&&(g.outlineColor&&(this.ctx.strokeStyle=g.outlineColor),this.ctx.lineWidth=x,this.ctx.strokeRect(r-x/2-b,n-x/2-b,o+v*2+x+b*2,a+v*2+x+b*2))}this.ctx.globalAlpha=u}}loadImage(e,t,r,n=!1){if(bl[e]&&bl[e].naturalWidth>0){t(bl[e]);return}try{let o=!1;n||setTimeout(()=>{o||this.loadImage(e,t,r,!0)},3e3);let a=document.createElement("img");a.decoding="auto",a.onload=function(){o=!0,t(a),bl[e]=a,a.onload=null},this.options.crossOrigin&&(a.crossOrigin="anonymous"),a.src=e,a.complete&&a.onload({}),a.width}catch(o){console.log("image error",o),r(o)}}schedulePaintToCanvas(e,t,r,n){this.imagesPending++,e.indices.push(r);let o=`${t.id}--${t.display.scale}-${r}`,a=this.invalidated.indexOf(o);a!==-1&&this.invalidated.splice(a,1),e.canvases[r]=o,t.__host.canvas.loading=!0,this.loadingQueueOrdered=!1,this.loadingQueue.push({id:o,scale:t.display.scale,network:!0,distance:n,task:()=>new Promise(u=>{if(this.visible.indexOf(t)===-1){this.imagesPending--,e.indices.splice(e.indices.indexOf(r),1),u();return}let h=t.getImageUrl(r);this.loadImage(h,f=>{this.loadingQueue.push({id:o,scale:t.display.scale,distance:n,task:()=>new Promise(g=>{this.imagesLoaded++,e.loaded.push(r),e.loaded.length===e.indices.length&&(e.loading=!1);let p=t.display.points.slice(r*5,r*5+5),v=document.createElement("canvas"),x=v.getContext("2d");v.width=p[3]-p[1],v.height=p[4]-p[2],this.hostCache.set(e.canvases[r],v),this.drawCalls.push(()=>{x.drawImage(f,0,0,p[3]-p[1],p[4]-p[2]),g()})})}),u()},f=>{this.imagesPending--,e.indices.splice(e.indices.indexOf(r),1),u()})})})}afterPaintLayer(e,t){}prepareLayer(e,t){if(e.__owner.value)if(e.cropData){let r=this.lastKnownScale*(1/e.display.scale);this.applyTransform(e,t[1],t[2],t[3]-t[1],t[4]-t[2])}else this.applyTransform(e,t[1],t[2],t[3]-t[1],t[4]-t[2]);(!e.__host||!e.__host.canvas)&&(e instanceof Bi||e instanceof vo)&&this.createImageHost(e)}finishLayer(){this.lastPaintedObject&&this.clearTransform()}createImageHost(e){e.__host=e.__host?e.__host:{},e.__host.canvas={canvas:void 0,canvases:[],indices:[],loaded:[],loading:!1}}getPointsAt(e,t,r,n){return e.getPointsAt(t,r,n)}getViewportBounds(e,t,r){let n=e.getActiveZone();if(n){let o=t[3]-t[1]<n.points[3]-n.points[1],a=t[4]-t[2]<n.points[4]-n.points[2];return{x1:o?n.points[1]-r:n.points[1]+(n.points[3]-n.points[1])/2-(t[3]-t[1])/2,y1:a?n.points[2]-r:n.points[2]+(n.points[4]-n.points[2])/2-(t[4]-t[2])/2,x2:o?n.points[3]+r:n.points[1]+(n.points[3]-n.points[1])/2-(t[3]-t[1])/2,y2:a?n.points[4]+r:n.points[2]+(n.points[4]-n.points[2])/2-(t[4]-t[2])/2}}return null}pendingUpdate(){let e=!this.pendingDrawCall&&this.drawCalls.length===0&&this.imagesPending===0&&this.loadingQueue.length===0&&this.tasksRunning===0;return!e&&this.visible.length===0&&setTimeout(()=>{this.canvas.style.opacity="1",this.firstMeaningfulPaint=!0},500),!this.firstMeaningfulPaint&&e&&this.visible.length?(this.canvas.style.opacity="1",this.firstMeaningfulPaint=e,!0):this.options.debug?!0:!e}getRendererScreenPosition(){return this.rendererPosition}reset(){this.loadingQueue=[],this.drawCalls=[]}},Xg=class{constructor(e){S(this,"renderers",[]),S(this,"length");for(let t of e)t&&this.renderers.push(t);this.length=this.renderers.length}afterFrame(e,t,r,n){for(let o=0;o<this.length;o++)this.renderers[o].afterFrame(e,t,r,n)}afterPaintLayer(e,t){for(let r=0;r<this.length;r++)this.renderers[r].afterPaintLayer(e,t)}beforeFrame(e,t,r,n){for(let o=0;o<this.length;o++)this.renderers[o].beforeFrame(e,t,r,n)}triggerResize(){for(let e=0;e<this.length;e++){let t=this.renderers[e];t.triggerResize&&t.triggerResize()}}getPointsAt(e,t,r,n){return this.renderers[0].getPointsAt(e,t,r,n)}getScale(e,t){return this.renderers[0].getScale(e,t)}getViewportBounds(e,t,r){return this.renderers[0].getViewportBounds(e,t,r)}getRendererScreenPosition(){return this.renderers[0].getRendererScreenPosition()}isReady(){for(let e=0;e<this.length;e++)if(!this.renderers[e].isReady())return!1;return!0}paint(e,t,r,n,o,a){for(let u=0;u<this.length;u++)this.renderers[u].paint(e,t,r,n,o,a)}pendingUpdate(){for(let e=0;e<this.length;e++)if(this.renderers[e].pendingUpdate())return!0;return!1}prepareLayer(e,t){for(let r=0;r<this.length;r++)this.renderers[r].prepareLayer(e,t)}finishLayer(e,t){for(let r=0;r<this.length;r++)this.renderers[r].finishLayer(e,t)}resize(e,t){for(let r=0;r<this.length;r++)this.renderers[r].resize(e,t)}reset(){for(let e=0;e<this.length;e++)this.renderers[e].reset()}},Zw=class{constructor(e){S(this,"canvas"),S(this,"context"),S(this,"heightRatio",1),S(this,"widthRatio",1),S(this,"target",new Float32Array(5)),S(this,"initialWidth"),S(this,"initialHeight"),S(this,"bounds"),S(this,"aggregate"),S(this,"delta",0),S(this,"renderNextFrame",!0),this.canvas=e,this.initialWidth=e.width,this.initialHeight=e.height,this.context=e.getContext("2d"),this.context.globalAlpha=.5,this.aggregate=lr(1)}isReady(){return!0}resize(){this.initialWidth=this.canvas.width,this.initialHeight=this.canvas.height,this.renderNextFrame=!0}afterFrame(e,t,r){if(this.renderNextFrame){this.context.clearRect(0,0,this.canvas.width,this.canvas.height);let n=this.initialWidth/e.width,o=this.initialHeight/e.height,a=this.widthRatio>this.heightRatio?n:o;if(this.target=r,this.bounds){let u=e.getPointsAt(this.bounds,this.aggregate,a);for(let[h,f]of u)if(h instanceof Bi&&h.__host.canvas){let g=f.length/5;for(let p=0;p<g;p++)if(h.__host.canvas.canvases[p]){let v={x1:f[p+1]*a,y1:f[p+2]*a,width:(f[p+3]-f[p+1])*a,height:(f[p+4]-f[p+2])*a}}}}e.getPoints().forEach((u,h,f)=>{if(h%5===0&&u){let g={x1:f[h+1]*a,y1:f[h+2]*a,x2:f[h+3]*a,y2:f[h+4]*a,width:(f[h+3]-f[h+1])*a,height:(f[h+4]-f[h+2])*a};this.context.strokeStyle="red",this.context.strokeRect(g.x1,g.y1,g.width,g.height)}}),r&&(this.context.strokeStyle="red",this.context.lineWidth=window.devicePixelRatio||1,this.context.strokeRect(r[1]*a,r[2]*a,(r[3]-r[1])*a,(r[4]-r[2])*a))}}getActiveZone(e){return null}getPointsAt(e,t,r,n){return e.getPointsAt(t,r,n)}getScale(e,t){return 1}beforeFrame(e,t){this.bounds=de.singleBox(e.width,e.height)}drawImage(){}afterPaintLayer(e,t){}paint(e,t,r,n,o,a){this.renderNextFrame=!0}prepareLayer(e){}pendingUpdate(){return!1}hasActiveZone(){return!1}getViewportBounds(e,t,r){return null}getRendererScreenPosition(){return this.canvas.getBoundingClientRect()}finishLayer(){}reset(){}};function Kw(e){return{x:e[1],y:e[2],width:e[3]-e[1],height:e[4]-e[2]}}var Jw={zoomOutFactor:.8,zoomInFactor:1.25,maxZoomFactor:1,minZoomFactor:.05,zoomDuration:300,zoomWheelConstant:20,zoomClamp:.6,panBounceStiffness:120,panBounceDamping:15,panTimeConstant:240,panPower:.1,nudgeDistance:100,panPadding:0,devicePixelRatio:1,enableWheel:!0,enableClickToZoom:!1,onPanInSketchMode:()=>{}},Zg=(e={})=>({start:function(t){let{zoomWheelConstant:r,enableWheel:n,enableClickToZoom:o}={...Jw,...e},a={pointerStart:{x:0,y:0},isPressing:!1,mousemoveBuffer:J(5),multiTouch:{distance:0}};t.world.activatedEvents.push("onMouseUp","onMouseDown","onMouseMove","onTouchStart","onTouchEnd","onTouchMove","onPointerUp","onPointerDown","onPointerMove");let u=[],h=[],f=-1;function g(N){for(let D=0;D<u.length;D++)if(u[D].pointerId==N.pointerId){u.splice(D,1),h.splice(D,1);break}}function p(N){u.push(N),h.push({...N.atlas||{}})}function v(N){for(let D=0;D<u.length;D++)if(N.pointerId==u[D].pointerId){u[D]=N,h[D]={...N.atlas||{}};break}if(u.length==2){let D=Math.abs(u[0].clientX-u[1].clientX),j=h[0].x>h[1].x?h[0].x-h[1].x:h[1].x-h[0].x,se=h[0].y>h[1].y?h[0].y-h[1].y:h[1].y-h[0].y;f>0&&(D>f&&t.world.zoomTo(.95,{x:j/2,y:se/2},!0),D<f&&t.world.zoomTo(1.05,{x:j/2,y:se/2},!0)),f=D}}function x(N){g(N),u.length<2&&(f=-1)}function b(){t.world.constraintBounds(),E=0}function w(N){if(N.which>1){a.isPressing=!1;return}t.mode==="explore"&&(N.preventDefault(),a.pointerStart.x=N.atlas.x,a.pointerStart.y=N.atlas.y,t.transitionManager.stopTransition(),a.isPressing=!0)}function A(){a.isPressing&&(t.mode==="explore"&&t.world.constraintBounds(),a.isPressing=!1)}let E=0;function P(N){if(t.mode==="explore"){if(N.atlasTouches.length===1&&(N.preventDefault(),a.pointerStart.x=N.atlasTouches[0].x,a.pointerStart.y=N.atlasTouches[0].y),N.atlasTouches.length===2){N.preventDefault();let D=N.atlasTouches[0].x,j=N.atlasTouches[1].x;a.pointerStart.x=(D+j)/2;let se=N.atlasTouches[0].y,ee=N.atlasTouches[1].y;a.pointerStart.y=(se+ee)/2,E=Pl({x:N.touches[0].clientX,y:N.touches[0].clientY},{x:N.touches[1].clientX,y:N.touches[1].clientY})}t.transitionManager.stopTransition(),a.isPressing=!0}}function I(N){let D=null,j=null,se=!1,ee=0;if(a.isPressing&&N.touches.length===2){let he=N.touches[0].clientX,Ae=N.touches[1].clientX;D=(he+Ae)/2;let Re=N.touches[0].clientY,Te=N.touches[1].clientY;j=(Re+Te)/2,ee=Pl({x:N.touches[0].clientX,y:N.touches[0].clientY},{x:N.touches[1].clientX,y:N.touches[1].clientY}),se=!0}if(a.isPressing&&N.touches.length===1){let he=N.touches[0];D=he.clientX,j=he.clientY}if(D!==null&&j!==null){let he=t.getRendererScreenPosition();if(he){let{x:Ae,y:Re}=t.viewerToWorld(D-he.x,j-he.y),Te=ee&&E?ee/E:1;t.transitionManager.customTransition(ge=>{ge.from=J(t.target),ge.to=ur(ge.from,Zt(tt(a.pointerStart.x-Ae,a.pointerStart.y-Re),vi(1/Te,Ae,Re)),a.mousemoveBuffer),ge.elapsed_time=0,ge.total_time=0,ge.timingFunction=Ui.easeInOutExpo,ge.done=!1})}E=ee}}function F(N){if(a.isPressing){let D=t.getRendererScreenPosition();if(D){let{x:j,y:se}=t.viewerToWorld(N.clientX-D.x,N.clientY-D.y);t.transitionManager.customTransition(ee=>{ee.from=J(t.target),ee.to=ur(ee.from,tt(a.pointerStart.x-j,a.pointerStart.y-se),a.mousemoveBuffer),ee.elapsed_time=0,ee.total_time=0,ee.timingFunction=Ui.easeInOutExpo,ee.done=!1})}}}function X(N){t.mode==="explore"&&t.world.zoomIn(N.atlas)}function W(N){let D=1+(0,$g.default)(N).spinY/r;t.world.zoomTo(D,N.atlas,!0)}t.world.addEventListener("mouseup",b),t.world.addEventListener("touchend",b),t.world.addEventListener("touchstart",P),t.world.addEventListener("mousedown",w),window.addEventListener("touchend",A),window.addEventListener("mouseup",A),window.addEventListener("mousemove",F),window.addEventListener("touchmove",I),o&&(t.world.activatedEvents.push("onClick"),t.world.addEventListener("click",X)),n&&(t.world.activatedEvents.push("onWheel"),t.world.addEventListener("wheel",W));let L=t.world.addLayoutSubscriber((N,D)=>{if(N==="zone-changed"&&t.transitionManager.constrainBounds({transition:{duration:0}}),N==="zoom-to"&&D&&t.transitionManager.zoomTo(D.factor,{origin:D.point,stream:D.stream}),N==="go-home"){let j=D.immediate?{duration:0}:void 0;t.transitionManager.goToRegion(Kw(t.homePosition),{transition:j})}if(N==="goto-region"&&D){let j=D.immediate?{duration:0}:{};t.transitionManager.goToRegion(D,{transition:j})}N==="constrain-bounds"&&t.transitionManager.constrainBounds({transition:D?.immediate?{duration:0}:void 0})});return()=>{t.world.removeEventListener("mouseup",b),t.world.removeEventListener("touchend",b),t.world.removeEventListener("touchstart",P),t.world.removeEventListener("mousedown",w),window.removeEventListener("touchend",A),window.removeEventListener("mouseup",A),t.world.removeEventListener("mousemove",F),t.world.removeEventListener("touchmove",F),o&&t.world.removeEventListener("click",X),n&&t.world.removeEventListener("wheel",W),L()}},updatePosition(){}}),ds=Ll.default.createContext("explore");ds.displayName="Mode";var t1=()=>(0,Ll.useContext)(ds);var zl=Nh.default.createContext(null);zl.displayName="Atlas";var Nl=Nh.default.createContext(null);Nl.displayName="Bounds";var Tl,r1=typeof performance=="object"&&typeof performance.now=="function";if(r1){let e=performance;Tl=()=>e.now()}else{let e=Date,t=e.now();Tl=()=>e.now()-t}var i1=16;function jg(e,t){e&&e.appendChild&&t&&e.appendChild(t)}function ev(e,t){e&&e.removeChild&&t&&e.removeChild(t)}function n1(e,t){return ev(e.world,t)}function s1(e,t,r){return tv(e.world,t,r)}function tv(e,t,r){e&&e instanceof kl&&(e=e.world),e&&e.insertBefore&&e.insertBefore(t,r)}function rv(e,t,r){if(r&&(e.applyProps&&e.applyProps(r),e instanceof ii))for(let n of _l){let o=n.slice(2).toLowerCase();r[n]!==t[n]&&(t[n]&&e.removeEventListener(o,t[n]),e.addEventListener(o,r[n]))}}function iv(e,t){let r=Object.keys(t),n=!1;for(let o of r)if(_l.indexOf(o)!==-1){let a=hs[o];if(a){if(e.activatedEvents.indexOf(a)!==-1)continue;n=!0,e.activatedEvents.push(a)}}n&&e.triggerEventActivation()}var Il=new Map,Ug={};function o1(e,{args:t=[],...r},n,o,a){if(!(n instanceof kl)&&a){let f=g=>g.return?f(g.return):g.stateNode&&g.stateNode.containerInfo;n=f(a)}let u,h=n.world;switch(e){case"world":u=Ml.withProps({width:r.width,height:r.height,viewingDirection:"left-to-right"}),u.activatedEvents=h.activatedEvents,u.eventHandlers=h.eventHandlers,u.subscriptions=h.subscriptions,u.triggerEventActivation(),h=u;break;case"box":u=new po;break;case"shape":u=new Gg;break;case"worldObject":case"world-object":u=new zh;break;case"worldImage":case"world-image":u=new Bi;break;case"texture":u=new Oh;break;case"compositeImage":case"composite-image":u=new qw({id:r.id,width:r.width,height:r.height,images:[],renderOptions:r.renderOptions});break;case"tiledImage":case"tiled-image":u=vo.fromTile(r.uri,r.display,r.tile,r.scaleFactor,void 0,r.format);break;case"paragraph":u=new El,u.text=r.children;break;default:return}return iv(h,r),rv(u,{},r),u}function a1(e,t){if(t instanceof Ml)e.world=t;else if(t instanceof zh)e.world.appendChild(t);else if(t)throw new Error("Invalid root")}var go=(0,Kg.default)({unstable_now:Tl,now:Tl,createInstance:o1,removeChild:ev,appendChild:jg,appendInitialChild:jg,insertBefore:tv,warnsIfNotActing:!0,supportsMutation:!0,isPrimaryRenderer:!1,scheduleTimeout:typeof setTimeout<"u"?setTimeout:void 0,cancelTimeout:typeof clearTimeout<"u"?clearTimeout:void 0,setTimeout:typeof setTimeout<"u"?setTimeout:void 0,clearTimeout:typeof clearTimeout<"u"?clearTimeout:void 0,noTimeout:-1,appendChildToContainer:a1,removeChildFromContainer:n1,createTextInstance(){},insertInContainerBefore:s1,prepareUpdate(e,t,r,n,o){return iv(o.world,n),n},commitUpdate(e,t,r,n,o,a){e.applyProps&&t&&rv(e,n,t)},finalizeInitialChildren(e){return e?.__handlers},getChildHostContext(){return Ug},getRootHostContext(){return Ug},prepareForCommit(e){return e.isCommitting=!0,null},preparePortalMount(){},hideInstance(e){e&&e.points&&(e.points[0]=0)},unhideInstance(e,t){e&&e.points&&(e.points[0]=1)},getPublicInstance(e){return e},hideTextInstance(){throw new Error("Text is not allowed in the react-three-fibre tree. You may have extraneous whitespace between components.")},resetAfterCommit(e){e.isCommitting=!1,e.pendingUpdate=!0,e.world&&e.world.needsRecalculate&&(e.world.recalculateWorldSize(),e.world.triggerRepaint())},shouldSetTextContent(){return!1},clearContainer(){return!1},supportsHydration:!1,supportsPersistence:!1,detachDeletedInstance(e){},afterActiveInstanceBlur(){},beforeActiveInstanceBlur(){},getCurrentEventPriority(){return console.log("getCurrentEventPriority"),i1},getInstanceFromNode(e){throw console.log("getInstanceFromNode",e),new Error("Not implemented")},getInstanceFromScope(e){throw console.log("getInstanceFromScope",e),new Error("Not implemented")},prepareScopeUpdate(e,t){throw console.log("prepareScopeUpdate",e,t),new Error("Not implemented")},logRecoverableError(){},requestPostPaintCallback(){}});go.injectIntoDevTools({bundleType:0,version:Jg.version,rendererPackageName:"@atlas-viewer/atlas"});function Fh(e,t){let r=Il.get(e);r&&go.updateContainer(null,r,null,()=>{Il.delete(e),t&&t(e)})}var Bg={render(e,t){let r=Il.get(t);if(r)go.updateContainer(e,r,null);else{let n=go.createContainer(t,0,null,!1,null,"",()=>{},null);go.updateContainer(e,n,null),Il.set(t,n)}},unmountComponentAtNode(e,t){Fh(e,t)}},cs=typeof window<"u"&&(window.document?.createElement||window.navigator?.product==="ReactNative")?Fl.useLayoutEffect:Fl.useEffect,l1=ri.default.memo(({children:e,setIsReady:t,onCreated:r,bounds:n,preset:o,mode:a="explore"})=>{let u=(0,ri.useCallback)(function(h){let f=(0,ri.useRef)(!1),g=()=>{t(!0)};return(0,ri.useEffect)(()=>{if(o&&!f.current){o.runtime.goHome();let p=r&&r(o);return void(p&&p.then?p.then(g):g())}return()=>{}},[]),(0,ri.useEffect)(()=>{f.current=!0},[]),h.children},[o]);return cs(()=>{if(o){let h=o.runtime;a!==h.mode&&(h.mode=a),Bg.render((0,us.jsx)(ri.default.StrictMode,{children:(0,us.jsx)(u,{children:(0,us.jsx)(Nl.Provider,{value:n,children:(0,us.jsx)(ds.Provider,{value:a,children:(0,us.jsx)(zl.Provider,{value:o,children:e})})})})}),h)}},[o,a,e]),cs(()=>{if(o){let h=o.runtime;return()=>{Bg.unmountComponentAtNode(h)}}return()=>{}},[o]),null}),u1=class{constructor(e,t){S(this,"canvas"),S(this,"gl"),S(this,"program"),S(this,"fragmentShader"),S(this,"vertexShader"),S(this,"rectBuffer"),S(this,"fragmentShaderSource",`
|
|
12
|
+
precision mediump float;
|
|
13
|
+
|
|
14
|
+
uniform sampler2D u_image;
|
|
15
|
+
varying vec2 v_texCoord;
|
|
16
|
+
|
|
17
|
+
void main() {
|
|
18
|
+
gl_FragColor = texture2D(u_image, v_texCoord);
|
|
19
|
+
}
|
|
20
|
+
`),S(this,"vertexShaderSource",`
|
|
21
|
+
attribute vec2 a_position;
|
|
22
|
+
uniform vec2 u_resolution;
|
|
23
|
+
varying vec4 v_color;
|
|
24
|
+
uniform sampler2D u_texture;
|
|
25
|
+
|
|
26
|
+
attribute vec2 a_texCoord;
|
|
27
|
+
varying vec2 v_texCoord;
|
|
28
|
+
|
|
29
|
+
void main() {
|
|
30
|
+
|
|
31
|
+
// convert the position from pixels to 0.0 to 1.0
|
|
32
|
+
vec2 zeroToOne = a_position / u_resolution;
|
|
33
|
+
|
|
34
|
+
// convert from 0->1 to 0->2
|
|
35
|
+
vec2 zeroToTwo = zeroToOne * 2.0;
|
|
36
|
+
|
|
37
|
+
// convert from 0->2 to -1->+1 (clip space)
|
|
38
|
+
vec2 clipSpace = zeroToTwo - 1.0;
|
|
39
|
+
|
|
40
|
+
gl_Position = vec4(clipSpace * vec2(1, -1), 0, 1);
|
|
41
|
+
|
|
42
|
+
v_texCoord = a_texCoord;
|
|
43
|
+
}
|
|
44
|
+
`),S(this,"attributes"),S(this,"uniforms"),S(this,"buffers"),S(this,"rendererPosition"),S(this,"dpi"),S(this,"lastResize",0),S(this,"lastKnownScale",1),this.canvas=e,this.rendererPosition=e.getBoundingClientRect(),this.gl=e.getContext("webgl2"),this.fragmentShader=this.createShader(this.gl.FRAGMENT_SHADER,this.fragmentShaderSource),this.vertexShader=this.createShader(this.gl.VERTEX_SHADER,this.vertexShaderSource),this.program=this.createProgram(this.vertexShader,this.fragmentShader),this.dpi=t?.dpi||1,this.attributes={position:this.gl.getAttribLocation(this.program,"a_position"),texCoord:this.gl.getAttribLocation(this.program,"a_texCoord")},this.uniforms={resolution:this.gl.getUniformLocation(this.program,"u_resolution"),texture:this.gl.getUniformLocation(this.program,"u_texture")},this.buffers={position:this.createArrayBuffer(),texCoord:this.createArrayBuffer(new Float32Array([0,0,1,0,0,1,0,1,1,0,1,1]))},this.rectBuffer=new Float32Array(12),this.resize(),this.gl.viewport(0,0,this.gl.canvas.width,this.gl.canvas.height),this.gl.clearColor(0,0,0,0),this.gl.clear(this.gl.COLOR_BUFFER_BIT),this.gl.useProgram(this.program),this.gl.enableVertexAttribArray(this.attributes.position)}resize(){this.resizeCanvasToDisplaySize(),this.gl.viewport(0,0,this.gl.canvas.width,this.gl.canvas.height),this.rendererPosition=this.canvas.getBoundingClientRect()}isReady(){return!0}beforeFrame(e,t,r){this.gl.clearColor(0,0,0,0),this.gl.clear(this.gl.COLOR_BUFFER_BIT),this.gl.vertexAttribPointer(this.attributes.position,2,this.gl.FLOAT,!1,0,0),this.gl.uniform2f(this.uniforms.resolution,this.gl.canvas.width,this.gl.canvas.height),this.lastResize>1e3&&(this.lastResize=0,this.resizeCanvasToDisplaySize()),this.lastResize+=t}prepareLayer(e){(!e.__host||!e.__host.webgl)&&((e instanceof Bi||e instanceof vo)&&this.createImageHost(e),e instanceof Oh&&this.createTextureHost(e))}createTextureHost(e){e.__host=e.__host?e.__host:{};let t=this.gl,r=this.gl.createTexture();t.bindTexture(t.TEXTURE_2D,r),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,!1);let n;if(e instanceof Oh){let o=e.getTexture();o.source&&t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,o.source),n=o}t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),e.__host.webgl={height:e.height,width:e.width,texture:r,lastImage:n}}createImageHost(e){let t=[...new Array(e.points.length/5)];e.__host=e.__host?e.__host:{},e.__host.webgl={height:e.height,width:e.width,textures:t,loading:[],loaded:[],lastLevelRendered:-1,onLoad:(r,n)=>{let o=this.gl,a=this.gl.createTexture();o.bindTexture(o.TEXTURE_2D,a),o.pixelStorei(o.UNPACK_FLIP_Y_WEBGL,!1),o.texImage2D(o.TEXTURE_2D,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,n),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,o.LINEAR),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,o.LINEAR),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.bindTexture(o.TEXTURE_2D,null),e.__host.webgl.textures[r]=a,e.__host.webgl.loaded.push(r)}}}paint(e,t,r,n,o,a){if(e.type==="spacial-content"&&e.__host&&e.__host.webgl){if(e.getTexture){let h=e?.getTexture();if(h&&e.__host.webgl.lastImage!==h.hash&&h.source&&!e.__host.webgl.error)try{let f=this.gl.RGBA,g=this.gl.RGBA,p=this.gl.UNSIGNED_BYTE;this.gl.bindTexture(this.gl.TEXTURE_2D,e.__host.webgl.texture),this.gl.texImage2D(this.gl.TEXTURE_2D,0,f,g,p,h.source),e.__host.webgl.lastImage=h.hash}catch(f){e.__host.webgl.error=f}}if(e.__host.webgl.loading&&e.__host.webgl.loading.indexOf(t)===-1&&e.getImageUrl){e.__host.webgl.loading.push(t);let h=document.createElement("img");h.decoding="async",h.crossOrigin="anonymous",h.src=e.getImageUrl(t),h.onload=()=>(h.onload=null,e.__host.webgl.onLoad(t,h))}let u=e.__host.webgl.texture?e.__host.webgl.texture:e.__host.webgl.textures[t];u&&(this.gl.enableVertexAttribArray(this.attributes.texCoord),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.buffers.texCoord),this.gl.enableVertexAttribArray(this.attributes.texCoord),this.gl.vertexAttribPointer(this.attributes.texCoord,2,this.gl.FLOAT,!1,0,0),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.buffers.position),this.gl.enableVertexAttribArray(this.attributes.position),this.gl.vertexAttribPointer(this.attributes.position,2,this.gl.FLOAT,!1,0,0),this.gl.bindTexture(this.gl.TEXTURE_2D,u),this.gl.uniform1i(this.uniforms.texture,0),this.setRectangle(r,n,o,a),this.gl.drawArrays(this.gl.TRIANGLES,0,6))}}afterPaintLayer(e,t){}pendingUpdate(){return!0}getPointsAt(e,t,r,n){return e.getPointsAt(t,r,n)}afterFrame(){}getScale(e,t,r){if(Number.isNaN(e)||Number.isNaN(t))return this.lastKnownScale;let n=this.getCanvasDims(),o=n.width/e,a=n.height/t,u=(o<a?a:o)*(r&&this.dpi||1);return Number.isNaN(u)||(this.lastKnownScale=u),this.lastKnownScale}getCanvasDims(){return{width:this.canvas.width/this.dpi,height:this.canvas.height/this.dpi}}getViewportBounds(e,t,r){return null}createShader(e,t){let r=this.gl.createShader(e);if(r){if(this.gl.shaderSource(r,t),this.gl.compileShader(r),this.gl.getShaderParameter(r,this.gl.COMPILE_STATUS))return r;let n=this.gl.getShaderInfoLog(r);if(this.gl.deleteShader(r),n)throw new Error(n)}throw new Error("Invalid shader")}createProgram(e,t){let r=this.gl.createProgram();if(r){if(this.gl.attachShader(r,e),this.gl.attachShader(r,t),this.gl.linkProgram(r),this.gl.getProgramParameter(r,this.gl.LINK_STATUS))return r;let n=this.gl.getProgramInfoLog(r);if(this.gl.deleteProgram(r),n)throw new Error(n)}throw new Error("Invalid program")}resizeCanvasToDisplaySize(){let e=this.gl.canvas,t=e.clientWidth,r=e.clientHeight,n=e.width!==t||e.height!==r;return n&&(e.width=t,e.height=r),n}createArrayBuffer(e){let t=this.gl.createBuffer();if(this.gl.bindBuffer(this.gl.ARRAY_BUFFER,t),e&&this.gl.bufferData(this.gl.ARRAY_BUFFER,e,this.gl.STATIC_DRAW),!t)throw new Error("Cannot create buffer");return t}setRectangle(e,t,r,n){this.gl.bufferData(this.gl.ARRAY_BUFFER,this.getRectangle(e,t,r,n),this.gl.STATIC_DRAW)}getRectangle(e,t,r,n){let o=e,a=e+r,u=t,h=t+n;return this.rectBuffer.set([o,u,a,u,o,h,o,h,a,u,a,h]),this.rectBuffer}getRendererScreenPosition(){return this.rendererPosition}finishLayer(){}reset(){}};function Mh(e,t){let r=t?e:JSON.stringify(e),n=5381,o=r.length;for(;o;)n=n*33^r.charCodeAt(--o);let a=(n>>>0).toString(16);return a.length%2?"0"+a:a}var nv=class{constructor(e){S(this,"$element"),S(this,"stylesheetClasses"),S(this,"activeStylesheetClasses"),S(this,"sheetsDidUpdate"),S(this,"sheetPrefix"),S(this,"stylesheetEntries"),this.sheetPrefix=e?.sheetPrefix||"a-",this.$element=document.createElement("style"),this.stylesheetClasses=[],this.activeStylesheetClasses=[],this.sheetsDidUpdate=!1,this.stylesheetEntries={}}getElement(){return this.$element}addStylesheet(e){let t=e.replace(/\s\s+/g," ").replace(/: /g,":").replace(/; /g,";").trim(),r=this.sheetPrefix+Mh(t,!0);return this.stylesheetClasses.indexOf(r)!==-1||(this.stylesheetClasses.push(r),this.activeStylesheetClasses.push(r),this.stylesheetEntries[r]=t,this.sheetsDidUpdate=!0),r}removeStylesheet(e){let t=this.sheetPrefix+Mh(e,!0);this.stylesheetClasses.indexOf(t)&&(this.stylesheetClasses=this.stylesheetClasses.filter(r=>r!==t)),this.sheetsDidUpdate=!0}clearClasses(){this.activeStylesheetClasses=[]}didUpdateActive(){if(this.activeStylesheetClasses.length){for(let e of this.activeStylesheetClasses)if(this.stylesheetClasses.indexOf(e)===-1)return!0;for(let e of this.stylesheetClasses)if(this.activeStylesheetClasses.indexOf(e)===-1)return!0}return!1}updateSheet(){(this.sheetsDidUpdate||this.didUpdateActive())&&(this.$element.innerText=this.activeStylesheetClasses.map(e=>`.${e}{${this.stylesheetEntries[e]}}`).join(""),this.sheetsDidUpdate=!1,this.stylesheetClasses=[...this.activeStylesheetClasses])}},sv=class{constructor(e,t){S(this,"htmlContainer"),S(this,"visible",[]),S(this,"previousVisible",[]),S(this,"htmlIds",[]),S(this,"firstMeaningfulPaint",!1),S(this,"rendererPosition"),S(this,"stylesheet"),S(this,"options"),S(this,"paintTx",1),S(this,"zIndex",0),S(this,"classes"),this.htmlContainer=e,this.htmlContainer.innerHTML="",this.rendererPosition=this.htmlContainer.getBoundingClientRect(),this.options={triggerResize:()=>{},box:!1,text:!1,sheetPrefix:"",inlineStyles:!1,background:"",...t||{}},this.stylesheet=new nv({sheetPrefix:this.options.sheetPrefix}),this.options.inlineStyles||this.htmlContainer.appendChild(this.stylesheet.getElement()),this.options.background&&this.htmlContainer.classList.add(this.stylesheet.addStylesheet(`
|
|
45
|
+
background: ${this.options.background};
|
|
46
|
+
`)),this.classes={hostClassName:this.stylesheet.addStylesheet(`
|
|
47
|
+
position: absolute;
|
|
48
|
+
transform-origin: 0px 0px;
|
|
49
|
+
`),interactive:this.stylesheet.addStylesheet("pointer-events: all"),nonInteractive:this.stylesheet.addStylesheet("pointer-events: none")},this.stylesheet.updateSheet()}createHtmlHost(e){if(this.htmlContainer&&(this.options.box||e.props.className||e.props.html||e.props.href)){let t=document.createElement(e.props.href?"a":"div");if(e.props.href){t.style.display="block",t.href=e.props.href;let r=e.props.hrefTarget||"_blank";t.target=r,r!=="_self"&&(t.rel="noopener noreferrer")}t.title=e.props.title||"",this.options.inlineStyles?(t.style.display="block",t.style.position="absolute",t.style.overflow="hidden",t.style.transformOrigin="0px 0px"):t.classList.add(this.classes.hostClassName),e.__host={element:t,revision:null,relative:!1},this.updateHtmlHost(e,e.width,e.height),e.__onCreate&&e.__onCreate()}}triggerResize(){this.options.triggerResize()}updateHtmlHost(e,t,r){if(e.__revision!==e.__host.revision){let n=e.__host.element,o=[this.classes.hostClassName];if(e.props.interactive?this.options.inlineStyles?n.style.pointerEvents="all":o.push(this.classes.interactive):this.options.inlineStyles?n.style.pointerEvents="none":o.push(this.classes.nonInteractive),e.props.href){n.style.display="block",n.href=e.props.href;let u=e.props.hrefTarget||"_blank";n.target=u,u!=="_self"?n.rel="noopener noreferrer":n.rel=""}else n.href&&n.removeAttribute("href");if(e.props.title&&(n.title=e.props.title||""),e.props.className&&(o.push(e.props.className),e.hovering&&o.push(`${e.props.className}--hover`),e.pressing&&o.push(`${e.props.className}--active`)),e.props.relativeStyle?(n.style.width=`${t||e.width}px`,n.style.height=`${r||e.height}px`):(n.style.width=`${e.width}px`,n.style.height=`${e.height}px`),e.props.style){Object.assign(n.style,e.props.style||{},e.hovering?e.props.hoverStyles||{}:{},e.pressing?e.props.pressStyles||{}:{});return}if(this.options.text&&e instanceof El){e.text&&(n.innerText=e.text),e.backgroundColor&&(n.style.backgroundColor=e.backgroundColor),e.color&&(n.style.color=e.color),e.props.font&&(n.style.font=e.props.font),e.props.textAlign&&(n.style.textAlign=e.props.textAlign),e.__host.revision=e.__revision;let u=o.join(" ");n.className=u,n.part=u}e instanceof po&&(this.options.box||e.props.className||e.props.html)&&(e.props.backgroundColor&&(n.style.backgroundColor=e.props.backgroundColor),e.props.border!==n.style.border&&(n.style.border=e.props.border));let a=o.join(" ");n.className=a,n.part=a}}afterFrame(e,t,r){this.stylesheet.updateSheet();for(let n of this.previousVisible)this.visible.indexOf(n)===-1&&this.htmlContainer&&n.__id&&this.htmlIds.indexOf(n.__id)!==-1&&this.htmlContainer.removeChild(n.__host.element);this.previousVisible=this.visible}afterPaintLayer(e,t){}beforeFrame(e,t,r){this.stylesheet.clearClasses(),this.paintTx++,this.zIndex=0,this.visible=[]}getPointsAt(e,t,r,n){return e.getPointsAt(t,r,n)}getScale(e,t){let r=this.rendererPosition.width/e,n=this.rendererPosition.height/t;return r<n?n:r}getViewportBounds(e,t,r){return null}isReady(){return!1}paint(e,t,r,n,o,a){if(this.zIndex++,(this.options.text&&e instanceof El||e instanceof po&&(this.options.box||e.props.className||e.props.html))&&e.__host.tx!==this.paintTx&&(this.visible.push(e),e.__host.tx=this.paintTx,this.htmlContainer)){this.updateHtmlHost(e,o,a);let u=o/e.width,h=e.__host.element;h.style.zIndex=`${this.zIndex}`,e.props.relativeStyle?h.style.transform=`translate(${Math.round(r)}px, ${Math.round(n)}px)`:h.style.transform=`translate(${Math.round(r)}px, ${Math.round(n)}px) scale(${u})`,this.previousVisible.indexOf(e)===-1&&this.htmlContainer.appendChild(h),this.htmlIds.indexOf(e.__id)===-1&&this.htmlIds.push(e.__id)}}pendingUpdate(){return!1}prepareLayer(e){e.__host||(e instanceof El||e instanceof po)&&this.createHtmlHost(e)}resize(e,t){typeof e<"u"&&typeof t<"u"&&(this.htmlContainer.style.width=`${e}px`,this.htmlContainer.style.height=`${t}px`),this.rendererPosition=this.htmlContainer.getBoundingClientRect()}getRendererScreenPosition(){return this.rendererPosition}finishLayer(){}reset(){}},ov=class Cl{constructor(t,r,n){S(this,"element"),S(this,"runtime"),S(this,"unsubscribe"),S(this,"activatedEvents",[]),S(this,"eventHandlers",[]),S(this,"bounds"),S(this,"pointerMoveEvent"),S(this,"pointerEventState",{isClicking:!1,isDragging:!1,isPressed:!1,mousedOver:[],itemsBeingDragged:[],mouseDownStart:{x:0,y:0},lastTouches:[]}),S(this,"options"),S(this,"_realPointerMove",a=>{this.pointerMoveEvent=a}),S(this,"onWheelEvent",a=>{a.preventDefault(),this.onPointerEvent(a)}),S(this,"onTouchEvent",a=>{let u=hs[a.type],h=[],f=a.touches.length;for(let g=0;g<f;g++){let p=a.touches.item(g);if(!p)continue;let{x:v,y:x}=this.runtime.viewerToWorld(p.clientX-this.bounds.left,p.clientY-this.bounds.top),b={id:p.identifier,x:v,y:x};h.push(b)}h.length&&this.assignToEvent(a,h[0].x,h[0].y),u!=="onTouchEnd"?(this.pointerEventState.lastTouches=h,a.atlasTouches=h,this.runtime.world.propagateTouchEvent(u,a,h)):(a.atlasTouches=[],this.runtime.world.propagateTouchEvent(u,a,this.pointerEventState.lastTouches),this.pointerEventState.lastTouches=[])}),S(this,"onPointerEvent",a=>{let u=hs[a.type];if(u&&this.runtime.world.activatedEvents.indexOf(u)!==-1){let{x:h,y:f}=this.runtime.viewerToWorld(a.clientX-this.bounds.left,a.clientY-this.bounds.top);this.assignToEvent(a,h,f),this.runtime.world.propagatePointerEvent(u,a,h,f)}}),S(this,"onPointerDown",a=>{this.pointerEventState.isPressed=!0,this.pointerEventState.isClicking=!0,this.pointerEventState.mouseDownStart.x=a.clientX,this.pointerEventState.mouseDownStart.y=a.clientY,setTimeout(()=>{this.runtime&&(this.pointerEventState.isClicking=!1)},250),setTimeout(()=>{if(this.runtime&&this.pointerEventState.isPressed&&!this.pointerEventState.isDragging){let u=this.runtime.viewerToWorld(this.pointerEventState.mouseDownStart.x-this.bounds.left,this.pointerEventState.mouseDownStart.y-this.bounds.top);this.pointerEventState.isDragging=!0,this.pointerEventState.itemsBeingDragged=this.runtime.world.propagatePointerEvent("onDragStart",a,u.x,u.y)}},800),this.onPointerEvent(a)}),S(this,"onPointerUp",a=>{if(this.pointerEventState.isClicking){let{x:u,y:h}=this.runtime.viewerToWorld(a.clientX-this.bounds.left,a.clientY-this.bounds.top);this.assignToEvent(a,u,h),this.runtime.world.propagatePointerEvent("onClick",a,u,h)}if(this.pointerEventState.isDragging){for(let u of this.pointerEventState.itemsBeingDragged)u.dispatchEvent("onDragEnd",a);this.pointerEventState.isDragging=!1}this.pointerEventState.isClicking=!1,this.pointerEventState.isPressed=!1,this.pointerEventState.itemsBeingDragged=[],this.onPointerEvent(a)}),S(this,"onPointerMove",a=>{this.pointerMoveEvent=void 0;let{x:u,y:h}=this.runtime.viewerToWorld(a.clientX-this.bounds.left,a.clientY-this.bounds.top);if(Number.isNaN(u)||Number.isNaN(h))return;this.assignToEvent(a,u,h),this.runtime.world.propagatePointerEvent("onPointerMove",a,u,h);let f=this.runtime.world.propagatePointerEvent("onMouseMove",a,u,h),g=[],p=[];for(let v of f)g.push(v.id),p.push(v),this.pointerEventState.mousedOver.indexOf(v)===-1&&(v.dispatchEvent("onMouseEnter",a),v.dispatchEvent("onPointerEnter",a),v.dispatchEvent("onMouseOver",a),v.dispatchEvent("onPointerOver",a));for(let v of this.pointerEventState.mousedOver)g.indexOf(v.id)===-1&&(v.dispatchEvent("onMouseLeave",a),v.dispatchEvent("onPointerLeave",a),v.dispatchEvent("onMouseOut",a),v.dispatchEvent("onPointerOut",a));if(this.pointerEventState.isDragging)for(let v of this.pointerEventState.itemsBeingDragged)v.dispatchEvent("onDrag",a);if(this.pointerEventState.isPressed&&!this.pointerEventState.isDragging&&Pl(this.pointerEventState.mouseDownStart,{x:a.clientX,y:a.clientY})>50){let v=this.runtime.viewerToWorld(this.pointerEventState.mouseDownStart.x-this.bounds.left,this.pointerEventState.mouseDownStart.y-this.bounds.top);this.pointerEventState.isDragging=!0,this.pointerEventState.itemsBeingDragged=this.runtime.world.propagatePointerEvent("onDragStart",{...a,atlas:{x:v.x,y:v.y}},v.x,v.y)}this.pointerEventState.mousedOver=p}),this.element=t,this.runtime=r,this.unsubscribe=r.world.addLayoutSubscriber(this.layoutSubscriber.bind(this)),this.bounds=t.getBoundingClientRect(),this.options={simulationRate:0,...n||{}};let o=0;r.registerHook("useFrame",a=>{o+=a,o>this.options.simulationRate&&this.pointerMoveEvent&&(o=0,r.updateNextFrame())}),r.registerHook("useBeforeFrame",()=>{this.pointerMoveEvent&&this.onPointerMove(this.pointerMoveEvent)}),this.activateEvents()}updateBounds(){this.bounds=this.element.getBoundingClientRect(),this.runtime.updateRendererScreenPosition()}layoutSubscriber(t){t==="event-activation"&&this.activateEvents()}assignToEvent(t,r,n){Cl.eventPool.atlas.x=r,Cl.eventPool.atlas.y=n,t.atlas=Cl.eventPool.atlas}activateEvents(){this.element.addEventListener("pointermove",this._realPointerMove),this.element.addEventListener("pointerup",this.onPointerUp),this.element.addEventListener("pointerdown",this.onPointerDown),this.element.addEventListener("mousedown",this.onPointerEvent),this.element.addEventListener("mouseup",this.onPointerEvent),this.element.addEventListener("pointercancel",this.onPointerEvent),this.element.addEventListener("wheel",this.onWheelEvent),this.element.addEventListener("touchstart",this.onTouchEvent),this.element.addEventListener("touchcancel",this.onTouchEvent),this.element.addEventListener("touchend",this.onTouchEvent),this.element.addEventListener("touchmove",this.onTouchEvent)}normalizeEventName(t){return t.startsWith("on")?t.slice(2).toLowerCase():t.toLowerCase()}stop(){this.unsubscribe();for(let[t,r]of this.eventHandlers)this.element.removeEventListener(this.normalizeEventName(t),r)}};S(ov,"eventPool",{atlas:{x:0,y:0}});var av=ov;function lv({interactive:e=!0,viewport:t,forceRefresh:r,canvasElement:n,overlayElement:o,controllerConfig:a,unstable_webglRenderer:u,dpi:h,debug:f,canvasBox:g=!0,polygon:p=!0,navigatorElement:v,background:x,runtimeOptions:b}){if(!n)throw new Error("Invalid container");n.style.userSelect="none";let w=e?Zg({minZoomFactor:.5,maxZoomFactor:3,enableClickToZoom:!1,...a||{}}):void 0,A=new Xg([u?new u1(n,{dpi:h}):new $w(n,{dpi:h,debug:f,box:g,polygon:p,background:x}),o?new sv(o,{box:u||!g,text:!0,triggerResize:r}):void 0,v?new Zw(v):void 0]),E=new kl(A,new Ml(1024,1024),t,w?[w]:[],b),P=new av(n,E);return{name:"default-preset",em:P,runtime:E,renderer:A,controller:w,canvas:n,navigator:v,unmount(){Fh(E),E.stopControllers(),E.stop(),E.reset(),P&&P.stop()}}}var ji=1+Number.MIN_VALUE,c1=class{constructor(e,t){S(this,"container"),S(this,"width"),S(this,"height"),S(this,"pending",!0),S(this,"options"),S(this,"stylesheet"),S(this,"zIndex",0),S(this,"lastKnownScale",1),S(this,"rendererPosition"),S(this,"currentlyVisible",[]),S(this,"previouslyVisible",[]),this.container=e,this.rendererPosition=e.getBoundingClientRect();let{width:r,height:n}=this.rendererPosition;this.width=r,this.height=n,this.options={addPart:!1,setDraggableFalse:!1,imageClass:"",widthStylesheet:!1,sheetPrefix:"position-",background:"#000",...t||{}},this.stylesheet=new nv({sheetPrefix:this.options.sheetPrefix}),this.container.classList.add(this.stylesheet.addStylesheet(`
|
|
50
|
+
background: ${this.options.background};
|
|
51
|
+
`)),this.options.widthStylesheet&&this.container.appendChild(this.stylesheet.getElement())}isReady(){return!0}resize(){this.rendererPosition=this.container.getBoundingClientRect(),this.width=this.rendererPosition.width,this.height=this.rendererPosition.height}getRendererScreenPosition(){return this.rendererPosition}afterFrame(e,t,r){this.stylesheet.updateSheet();for(let n of this.previouslyVisible)this.currentlyVisible.indexOf(n)===-1&&this.container.removeChild(n);for(let n of this.currentlyVisible)this.previouslyVisible.indexOf(n)===-1&&this.container.appendChild(n);this.previouslyVisible=this.currentlyVisible,this.currentlyVisible=[]}afterPaintLayer(e,t){}beforeFrame(e,t,r){this.stylesheet.clearClasses(),this.zIndex=0}getPointsAt(e,t,r,n){return e.getPointsAt(t,r,n)}getScale(e,t){if(Number.isNaN(e)||Number.isNaN(t))return this.lastKnownScale;let r=this.width/e,n=this.height/t,o=r<n?n:r;return Number.isNaN(o)||(this.lastKnownScale=o),this.lastKnownScale}getViewportBounds(e,t,r){return null}createImage(){let e=document.createElement("img");return this.options.imageClass?(e.className=this.options.imageClass,this.options.addPart&&e.setAttribute("part",this.options.imageClass)):(e.style.position="absolute",e.style.pointerEvents="none",e.style.userSelect="none"),this.options.setDraggableFalse&&e.setAttribute("draggable","false"),e}paint(e,t,r,n,o,a){if(this.pending=!1,this.zIndex++,e instanceof Bi){if(!e.__host){let h=this.createImage();h.src=e.uri,e.__host=h,this.container.appendChild(e.__host)}let u=e.__host;this.currentlyVisible.push(u),u.style.zIndex=`${this.zIndex}`,u.style.opacity=`${e.style.opacity}`,this.options.widthStylesheet?u.className=this.options.imageClass+" "+this.stylesheet.addStylesheet(`width:${(o+ji).toFixed(2)}px;height:${(a+ji).toFixed(2)}px;`):(u.style.width=`${o+ji}px`,u.style.height=`${a+ji}px`),u.style.transform=`translate(${r}px, ${n}px)`}if(e instanceof vo){if(e.__host||(e.__host={images:[]}),!e.__host.images[t]){let h=e.getImageUrl(t),f=this.createImage();f.src=h,e.__host.images[t]=f,this.container.appendChild(f)}let u=e.__host.images[t];u.style.zIndex=`${this.zIndex}`,u.style.opacity=`${e.style.opacity}`,this.currentlyVisible.push(u),this.options.widthStylesheet?u.className=this.options.imageClass+" "+this.stylesheet.addStylesheet(`width:${(o+ji).toFixed(2)}px;height:${(a+ji).toFixed(2)}px;`):(u.style.width=`${o+ji}px`,u.style.height=`${a+ji}px`),u.style.transform=`translate(${r}px, ${n}px)`}}pendingUpdate(){return this.pending}prepareLayer(e){}finishLayer(e){}reset(){}};function h1({interactive:e,viewport:t,forceRefresh:r,containerElement:n,overlayElement:o,controllerConfig:a,background:u}){if(!n)throw new Error("Invalid container");n.style.userSelect="none";let h=e?Zg({minZoomFactor:.5,maxZoomFactor:3,enableClickToZoom:!1,...a||{}}):void 0,f=new c1(n,{addPart:!1,setDraggableFalse:!1,imageClass:"atlas-static-image",background:u}),g=o?new Xg([f,new sv(o,{box:!0,text:!0,triggerResize:r})]):f,p=new kl(g,new Ml(1024,1024),t,h?[h]:[]),v=new av(n,p);return{name:"static-preset",em:v,runtime:p,renderer:g,controller:h,container:n,overlay:o,unmount(){Fh(p),p.stopControllers(),p.stop(),v&&v.stop()}}}var d1={"default-preset":lv,"static-preset":h1},f1={};function p1(e,t){let r=(0,br.useRef)(),n=(0,br.useRef)(),o=(0,br.useRef)(),a=(0,br.useRef)(),u=(0,br.useRef)({width:t.width,height:t.height,didUpdate:!0}),[h="default-preset",f=f1]=Array.isArray(e)?e||[]:[e],[g,p]=(0,br.useState)(null);(0,br.useLayoutEffect)(()=>{let x=n.current,b=a.current,w=r.current,A=o.current,E=(d1[h]||lv)({containerElement:b,canvasElement:x,overlayElement:w,navigatorElement:A,viewport:u.current,dpi:window.devicePixelRatio||1,forceRefresh:t.forceRefresh,unstable_webglRenderer:t.unstable_webglRenderer,...f||{}});return p(E),()=>{E&&(E.unmount(),x&&(x.height=0,x.width=0),w&&(w.innerHTML=""),A&&(A.height=0,A.width=0))}},[h,f]);let v=(0,br.useMemo)(()=>({canvas:n,overlay:r,container:a,navigator:o}),[]);return[h,g,u,v]}function m1(e){return(0,uv.useMemo)(()=>Mh(e),e)}var fo=cv.default.forwardRef((e,t)=>(0,hv.jsx)("div",{...e,ref:t,part:e.className})),Vg=["brightness","contrast","grayscale","hueRotate","invert","saturate","sepia","blur"],g1=({htmlChildren:e,renderPreset:t,onCreated:r,mode:n="explore",resetWorldOnChange:o=!0,unstable_webglRenderer:a=!1,unstable_noReconciler:u=!1,hideInlineStyle:h=!1,controllerConfig:f,children:g,overlayStyle:p,containerStyle:v,enableNavigator:x,className:b,containerProps:w={},homePosition:A,homeOnResize:E,homeCover:P,background:I,runtimeOptions:F,debug:X,filters:W,...L})=>{let[N,D]=(0,Ge.useState)(I),[j,se]=(0,Ge.useState)(n),[ee,he]=(0,Ge.useState)(!1),Ae=(0,Ge.useRef)(!1),Re=(0,Ge.useMemo)(()=>(typeof t=="string"&&(t=[t,{}]),N||X?t?[t[0],{debug:X,background:N,...t[1]||{}}]:["default-preset",{background:N,debug:X}]:t||"default-preset"),[t,N,X]),[Te,ge,lt]=rl({scroll:!0}),ce=(0,Ge.useRef)(),st=$=>{ce.current=$,Te($)},[Pe,V,fe,De]=p1(Re,{width:L.width,height:L.height,forceRefresh:lt,unstable_webglRenderer:a}),[Xe,$e]=(0,Ge.useState)("");(0,Ge.useEffect)(()=>{se(n)},[n]),(0,Ge.useEffect)(()=>{V&&V.em&&V.em.updateBounds()},[V,ge]),(0,Ge.useEffect)(()=>{V?.runtime.setOptions(F||{})},[F]),(0,Ge.useEffect)(()=>{V&&V.runtime&&(V.runtime.mode=j),ee&&V&&(V.ready=!0)},[V,ee,j]),(0,Ge.useEffect)(()=>{V&&(P||(V.runtime.manualHomePosition=!!A,V.runtime.setHomePosition(A)))},[V,P,A]),(0,Ge.useEffect)(()=>{if(V){let $=V.runtime;$.resize(fe.current.width,L.width,fe.current.height,L.height),fe.current.width=L.width,fe.current.height=L.height,$.updateNextFrame(),fe.current.didUpdate=!0}},[V,L.width,L.height]),(0,Ge.useEffect)(()=>{if(W&&V){let $=V.runtime,Ee=!1;$.hookOptions.enableFilters=!0;for(let Ce of Vg)W[Ce]?W[Ce]!==V.runtime.hookOptions.filters[Ce]&&($.hookOptions.filters[Ce]=W[Ce],Ee=!0):$.hookOptions.filters[Ce]&&($.hookOptions.filters[Ce]=0,Ee=!0);Ee&&$.updateNextFrame()}else if(V){let $=V.runtime;for(let Ee of Vg)$.hookOptions.filters[Ee]=0;$.hookOptions.enableFilters=!1,$.updateNextFrame()}},[V,W]),cs(()=>{if(V&&(V.overlay&&(V.overlay.style.width=`${ge.width}px`,V.overlay.style.height=`${ge.height}px`),V.container&&(V.container.style.width=`${ge.width}px`,V.container.style.height=`${ge.height}px`),P)){let $=V.runtime.world.width,Ee=V.runtime.world.height,Ce=$/Ee,ui=fe.current.width,Vr=fe.current.height,sr=ui/Vr;if(Ce>sr){sr=Vr/ui,V.runtime.manualHomePosition=!0;let Rr=($-Ee/sr)/2;P==="start"&&(Rr=0),P==="end"&&(Rr=$-Ee/sr),V.runtime.setHomePosition({x:Rr,y:0,width:Ee/sr,height:Ee})}else{let Rr=(Ee-$/sr)/2;P==="start"&&(Rr=0),P==="end"&&(Rr=Ee-$/sr),V.runtime.manualHomePosition=!0,V.runtime.setHomePosition({x:0,y:Rr,width:$,height:$/sr})}E&&V.runtime.goHome({})}},[V,ge.height,ge.width,P]),cs(()=>{let $=()=>{if(V){let Ee=V.runtime;fe.current.width!==L.width&&fe.current.height!==L.height&&(Ee.resize(fe.current.width,L.width,fe.current.height,L.height),fe.current.width=L.width,fe.current.height=L.height,Ee.updateNextFrame(),fe.current.didUpdate=!0)}};return window.addEventListener("resize",$),()=>window.removeEventListener("resize",$)},[V,L.height,L.width]);let Pr={width:120},Br=()=>{if(V&&V.navigator){let $=V.runtime.world.height,Ee=V.runtime.world.width,Ce=window.devicePixelRatio||1,ui=Pr.width,Vr=Pr.width/Ee*$;V.navigator.width=ui*Ce,V.navigator.height=Vr*Ce,V.navigator.style.width=ui+"px",V.navigator.style.height=Vr+"px"}};cs(()=>{if(V){Br();let $=V.runtime;return $.world.addLayoutSubscriber(Ee=>{Ee==="recalculate-world-size"&&(Br(),$.resize(fe.current.width,L.width,fe.current.height,L.height))})}return()=>{}},[V,L.width,L.height]);let Dt=(0,Ge.useCallback)(function($){let Ee=()=>{he(!0)};return(0,Ge.useEffect)(()=>{if(V){V.runtime.goHome();let Ce=r&&r(V);return void(Ce&&Ce.then?Ce.then(Ee):Ee())}else throw new Error("Invalid configuration - no runtime found")},[]),$.children},[V]);(0,Ge.useEffect)(()=>{if(V){let $=V.runtime;if(o)return $.world.addLayoutSubscriber(Ee=>{Ee==="recalculate-world-size"&&$.goHome()})}return()=>{}},[V,o]),(0,Ge.useEffect)(()=>V?V.runtime.registerHook("useBeforeFrame",()=>{if(fe.current.didUpdate&&V.canvas){let $=window.devicePixelRatio||1,Ee=fe.current.width,Ce=fe.current.height;V.canvas.width=Ee*$,V.canvas.height=Ce*$,V.canvas.style.width=Ee+"px",V.canvas.style.height=Ce+"px",V.canvas.getContext("2d")?.scale($,$),V&&V.em&&V.em.updateBounds(),fe.current.didUpdate=!1}}):()=>{},[V,o]),(0,Ge.useEffect)(()=>{let $=()=>{V&&(se("sketch"),$e("mode-sketch")),window.removeEventListener("keyup",$)},Ee=Ce=>{if(Ce.code==="Space"&&V&&V.runtime.mode==="sketch"){if(Ce.target&&Ce.target.tagName&&Ce.target.tagName.toLowerCase()==="input")return;Ce.preventDefault(),se("explore"),$e("mode-explore"),window.addEventListener("keyup",$)}};return window.addEventListener("keydown",Ee),()=>{window.removeEventListener("keydown",Ee),window.removeEventListener("keyup",$)}},[V]),cs(()=>{if(ce.current&&!N){let $=getComputedStyle(ce.current).getPropertyValue("--atlas-background");$&&D($)}},[N]),Ae.current=!0;let{height:li,width:nr,...Ie}=L,Ze=m1([L.width,L.height]);return(0,Bt.jsxs)(fo,{ref:st,className:["atlas",h?"":`atlas-width-${Ze}`,Xe,b,`atlas-${Pe}`].filter(Boolean).join(" ").trim(),style:{...v,...h?{}:{width:L.width,height:L.height}},children:[Pe==="static-preset"?(0,Bt.jsx)(fo,{className:"atlas-static-container",style:V&&V.controller?void 0:{pointerEvents:"none"},ref:De.container,tabIndex:0,...w}):(0,Bt.jsx)("canvas",{className:"atlas-canvas",part:"atlas-canvas",tabIndex:0,...Ie,...w,ref:De.canvas}),(0,Bt.jsx)(fo,{className:"atlas-overlay",style:{...p||{}},ref:De.overlay,children:u?(0,Bt.jsx)(Dt,{children:(0,Bt.jsx)(Nl.Provider,{value:ge,children:(0,Bt.jsx)(ds.Provider,{value:j,children:(0,Bt.jsx)(zl.Provider,{value:V,children:g})})})}):(0,Bt.jsx)(l1,{bounds:ge,preset:V,mode:j,setIsReady:he,onCreated:r,children:g})}),x?(0,Bt.jsx)(fo,{className:"atlas-navigator",children:(0,Bt.jsx)("canvas",{className:"atlas-navigator-canvas",part:"atlas-navigator-canvas",ref:De.navigator})}):null,h?(0,Bt.jsx)("style",{children:`.atlas-width-${Ze} { width: ${L.width}px; height: ${L.height}px; }`}):(0,Bt.jsx)("style",{children:`
|
|
52
|
+
.atlas { position: relative; user-select: none; display: flex; background: var(--atlas-background, #000); z-index: var(--atlas-z-index, 10); touch-action: none; }
|
|
53
|
+
.atlas-width-${Ze} { width: ${L.width}px; height: ${L.height}px; }
|
|
54
|
+
.atlas-canvas { flex: 1 1 0px; }
|
|
55
|
+
.atlas-canvas:focus, .atlas-static-container:focus { outline: none }
|
|
56
|
+
.atlas-canvas:focus-visible, .atlas-canvas-container:focus-visible { outline: var(--atlas-focus, 2px solid darkorange) }
|
|
57
|
+
.atlas-static-preset { touch-action: inherit; }
|
|
58
|
+
.atlas-static-container { position: relative; overflow: hidden; flex: 1 1 0px; }
|
|
59
|
+
.atlas-overlay { position: absolute; top: 0; left: 0; pointer-events: none; overflow: hidden; }
|
|
60
|
+
.atlas-static-image { position: absolute; pointer-events: none; user-select: none; transform-origin: 0px 0px; }
|
|
61
|
+
.atlas-navigator { position: absolute; top: var(--atlas-navigator-top, 10px); right: var(--atlas-navigator-bottom, 10px); left: var(--atlas-navigator-left); bottom: var(--atlas-navigator-bottom); opacity: .8 }
|
|
62
|
+
.atlas-navigator-canvas { width: 100%; }
|
|
63
|
+
`}),e]})};function v1(e){return Number(e)==e?`${e}px`:e}var dv=({resizeHash:e,aspectRatio:t,containerProps:r={},...n})=>{let[o,a,u]=rl(),{height:h,width:f,...g}=n;(0,Dl.useEffect)(()=>{u()},[f,h,e,u]);let p=(0,Dl.useMemo)(()=>t?{width:a.width,height:a.width*(1/t)}:a,[a,t]);return(0,yo.jsxs)(fo,{ref:o,className:"atlas-container",...r,children:[p.width?(0,yo.jsx)(g1,{width:p.width||100,height:p.height||100,...g,children:n.children}):null,n.hideInlineStyle?null:(0,yo.jsx)("style",{children:`
|
|
64
|
+
.atlas-container {
|
|
65
|
+
display: var(--atlas-container-display, block);
|
|
66
|
+
flex: var(--atlas-container-flex, none);
|
|
67
|
+
width: var(--atlas-container-width, ${f?`${f}px`:"100%"});
|
|
68
|
+
height: var(--atlas-container-height, ${v1(h||(t?p.height:512))})
|
|
69
|
+
}
|
|
70
|
+
`}),n.htmlChildren]})},pv=()=>(0,fv.useContext)(zl),jl=()=>{let e=pv();return e?e.runtime:void 0};var gv=(e,t=[])=>{let r=jl();(0,mv.useEffect)(()=>r?r.registerHook("useFrame",e):()=>{},t)},vv=()=>{let e=pv();return e&&e.canvas?e.canvas:void 0};function x1(){return(0,yv.useContext)(Nl)}async function S1(e,t,r){if(xv.version.startsWith("18.")){let n=await Promise.resolve().then(()=>T(Og(),1)),o=n.default?n.default.createRoot:n.createRoot;r.current||(r.current=o(e)),r.current.render(t)}else if(typeof ReactDOM<"u"){let{render:n,unmountComponentAtNode:o}=ReactDOM;n(t,e),r.current={unmount(){o(e)}}}else{let n=await Promise.resolve().then(()=>T(fl(),1)),o=n.default?n.default.render:n.render,a=n.default?n.default.unmountComponentAtNode:n.unmountComponentAtNode;o(t,e),r.current={unmount(){a(e)}}}}var fs=ti.default.forwardRef(({children:e,...t},r)=>{let n=(0,ti.useRef)(),o=jl(),a=(0,ti.useRef)(0),u=(0,ti.useRef)(),h=(0,ti.useRef)();return gv(()=>{if(t.relative){let f=n.current;if(f&&o){let g=o.getScaleFactor();a.current!==g&&(a.current=g,f.style.transformOrigin="0 0",f.style.transform=`scale(${1/a.current})`,f.style.width=`${a.current*100}%`,f.style.height=`${a.current*100}%`,n.current&&u.current?.__owner.value?.rotation&&(f.style.transform=`scale(${1/a.current}) translate(50%, 50%) rotate(${u.current?.__owner.value?.rotation||0}deg) translate(-50%, -50%)`))}}},[t.relative]),(0,ti.useLayoutEffect)(()=>{let f=u.current;r&&f&&(typeof r=="function"?r(f):r.current=f);async function g(){if(f&&f.__host){let p=t.relative?(0,kh.jsx)("div",{ref:n,children:e}):e;await S1(f.__host.element,p,h)}}f&&f.__host?g():f&&(f.__onCreate=g)},[r,e,u,t.relative]),(0,ti.useLayoutEffect)(()=>()=>{h.current&&setTimeout(()=>{h.current.unmount()},0)},[]),(0,kh.jsx)("box",{html:!0,...t,ref:u})});fs.displayName="HTMLPortal";var Wg=(e,t,r=[])=>{let n=jl(),o=n?n.world:void 0;(0,wv.useEffect)(()=>{if(n){let a=t,u=hs[e];n.world.activatedEvents.push(u);let h=u.slice(2).toLowerCase();return n.world.addEventListener(h,a),()=>{n.world.removeEventListener(h,a)}}return()=>{}},[o,e,...r])};function Hg(e,t){if(e===0)return[0,1];if(t===0)return[1,0];let r=Math.abs(e)/Math.abs(t);return[r,1-r]}function w1(){let e=(0,Ul.useRef)({ctrl:!1,shift:!1,alt:!1});return(0,Ul.useLayoutEffect)(()=>{function t(n){n.key==="Shift"&&(e.current.shift=!0),n.key==="Control"&&(e.current.ctrl=!0),n.key==="Alt"&&(e.current.alt=!0)}function r(n){n.key==="Shift"&&(e.current.shift=!1),n.key==="Control"&&(e.current.ctrl=!1),n.key==="Alt"&&(e.current.alt=!1)}return window.addEventListener("keydown",t),window.addEventListener("keyup",r),()=>{window.removeEventListener("keydown",t),window.removeEventListener("keyup",r)}},[]),e}var A1=(e,t)=>{let r=t1(),n=jl(),o=x1(),a=(0,At.useRef)(),u=(0,At.useRef)(null),h=(0,At.useRef)(),[f,g]=(0,At.useState)(!1),p=(0,At.useRef)(!1),v=(0,At.useRef)({north:0,south:0,east:0,west:0}),x=w1(),b=(0,At.useCallback)(I=>F=>{if(p.current=!0,g(!0),o&&n){let{top:X,left:W}=o,L=n.viewerToWorld(F.pageX-W,F.pageY-X);h.current={x:L.x,y:L.y},a.current=I}},[o,n]),w=(0,At.useMemo)(()=>e.width/e.height,[e.width,e.height]),A=(0,At.useCallback)(I=>{if(!Math.abs(I.north-I.south+(I.east-I.west)))return;let F=-I.west+I.east,X=-I.north+I.south,W=e.width+F,L=e.height+X;if(W/L>=w){let N=L*w,D=W-N,[j,se]=Hg(I.east,I.west);I.west=I.west+D*se,I.east=I.east-D*j}else{let N=W/w,D=L-N,[j,se]=Hg(I.north,I.south);I.north=I.north+D*j,I.south=I.south-D*se}},[e.width,e.height,w]);gv(()=>{h&&n&&n.updateNextFrame()}),(0,At.useEffect)(()=>{n&&n.updateNextFrame()},[n,f]);let E=(0,At.useCallback)(I=>{if(!n||!o||n.mode!=="sketch")return;let{top:F,left:X}=o,W=n.viewerToWorld(I.pageX-X,I.pageY-F),L=u.current,N=!e.maintainAspectRatio&&x.current.alt,D=!N&&x.current.shift&&a.current?.indexOf("-")!==-1;if((a.current==="translate"||a.current==="east"||a.current==="north-east"||a.current==="south-east")&&(v.current.east=W.x-(h.current?h.current.x:0),N&&(v.current.west=-v.current.east)),(a.current==="translate"||a.current==="west"||a.current==="north-west"||a.current==="south-west")&&(v.current.west=W.x-(h.current?h.current.x:0),N&&(v.current.east=-v.current.west)),(a.current==="translate"||a.current==="north"||a.current==="north-east"||a.current==="north-west")&&(v.current.north=W.y-(h.current?h.current.y:0),N&&(v.current.south=-v.current.north)),(a.current==="translate"||a.current==="south"||a.current==="south-west"||a.current==="south-east")&&(v.current.south=W.y-(h.current?h.current.y:0),N&&(v.current.north=-v.current.south)),(e.maintainAspectRatio||D)&&A(v.current),L){let j=v.current.west,se=v.current.north,ee=e.width+v.current.east,he=e.height+v.current.south;L.points[1]=Math.min(j,ee),L.points[2]=Math.min(se,he),L.points[3]=Math.max(j,ee),L.points[4]=Math.max(se,he),n.updateNextFrame()}},[n,e.width,e.height,e.maintainAspectRatio,o]);Wg("mousemove",E,[e.width,e.height,o]),Wg("pointermove",E,[e.width,e.height,o]);let P=(0,At.useRef)();return(0,At.useEffect)(()=>{P.current=()=>{if(p.current){let I=v.current.west,F=v.current.north,X=e.width+v.current.east,W=e.height+v.current.south,L=Math.min(I,X),N=Math.min(F,W),D=Math.max(I,X),j=Math.max(F,W),se={x:(e.x||0)+L,y:(e.y||0)+N,width:D-L||1,height:j-N||1};e.maintainAspectRatio,t(se),a.current=void 0,h.current=void 0,v.current.east=0,v.current.west=0,v.current.north=0,v.current.south=0,p.current=!1,g(!1)}}},[t,e.height,e.width,e.x,e.y]),(0,At.useEffect)(()=>{let I=()=>{P.current&&P.current()};return window.addEventListener("pointerup",I),window.addEventListener("touchend",I),()=>{window.removeEventListener("pointerup",I),window.removeEventListener("touchend",I)}},[]),{portalRef:u,mode:r,mouseEvent:b,onPointerMoveCallback:E,isEditing:f}};function b1({handleSize:e,resizable:t,onSave:r,children:n,maintainAspectRatio:o,disableCardinalControls:a,...u}){let h=typeof e>"u"?o?10:8:e,{portalRef:f,mode:g,mouseEvent:p,isEditing:v}=A1({x:u.x||0,y:u.y||0,width:u.width,height:u.height,maintainAspectRatio:o},r),x=(0,ei.useMemo)(()=>p("translate"),[p]),b=(0,ei.useMemo)(()=>p("east"),[p]),w=(0,ei.useMemo)(()=>p("west"),[p]),A=(0,ei.useMemo)(()=>p("south"),[p]),E=(0,ei.useMemo)(()=>p("north"),[p]),P=(0,ei.useMemo)(()=>p("south-east"),[p]),I=(0,ei.useMemo)(()=>p("south-west"),[p]),F=(0,ei.useMemo)(()=>p("north-east"),[p]),X=(0,ei.useMemo)(()=>p("north-west"),[p]),W=g==="sketch",L={zIndex:999,boxShadow:"0px 2px 3px 0 rgba(0,0,0,0.2)",border:"1px solid rgba(155,155,155,.7)",borderRadius:o||a?"50%":2,position:"absolute",background:"#fff",pointerEvents:v?"none":W?"initial":"none"};return(0,ft.jsx)(ft.Fragment,{children:(0,ft.jsxs)("world-object",{...u,children:[n,W&&t?(0,ft.jsx)(fs,{ref:f,target:{x:0,y:0,height:u.height,width:u.width},relative:!0,interactive:!1,children:W&&t?(0,ft.jsxs)(ft.Fragment,{children:[(0,ft.jsx)("div",{onMouseDown:x,onTouchStart:x,style:{display:"block",width:"100%",height:"100%",position:"relative",border:"1px solid rgba(155,155,155, .7)",boxSizing:"border-box",pointerEvents:v?"none":W?"initial":"none"}}),o?null:(0,ft.jsxs)(ft.Fragment,{children:[(0,ft.jsx)("div",{title:"east",onTouchStart:b,onMouseDown:b,style:{...L,cursor:"e-resize",height:h*2,width:h,right:0,top:"50%",opacity:a?0:1,transform:`translate(${h/2}px, -${h}px)`}}),(0,ft.jsx)("div",{title:"west",onMouseDown:w,style:{...L,cursor:"w-resize",position:"absolute",height:h*2,width:h,left:0,top:"50%",opacity:a?0:1,transform:`translate(-${h/2}px, -${h}px)`}}),(0,ft.jsx)("div",{title:"north",onMouseDown:E,style:{...L,cursor:"n-resize",position:"absolute",height:h,width:h*2,left:"50%",top:0,opacity:a?0:1,transform:`translate(-${h}px, -${h/2}px)`}}),(0,ft.jsx)("div",{title:"south",onMouseDown:A,style:{...L,cursor:"s-resize",position:"absolute",height:h,width:h*2,left:"50%",bottom:0,opacity:a?0:1,transform:`translate(-${h}px, ${h/2}px)`}})]}),(0,ft.jsx)("div",{title:"north-east",onMouseDown:F,style:{...L,cursor:"ne-resize",position:"absolute",height:h,width:h,right:0,top:0,transform:`translate(${h/2}px, -${h/2}px)`}}),(0,ft.jsx)("div",{title:"south-east",onMouseDown:P,style:{...L,cursor:"se-resize",position:"absolute",height:h,width:h,bottom:0,right:0,transform:`translate(${h/2}px, ${h/2}px)`}}),(0,ft.jsx)("div",{title:"south-west",onMouseDown:I,style:{...L,cursor:"sw-resize",position:"absolute",height:h,width:h,bottom:0,left:0,transform:`translate(-${h/2}px, ${h/2}px)`}}),(0,ft.jsx)("div",{title:"north-west",onMouseDown:X,style:{...L,cursor:"nw-resize",position:"absolute",height:h,width:h,top:0,left:0,transform:`translate(-${h/2}px, -${h/2}px)`}})]}):null}):null]})})}function Av({interactive:e,region:t,onClick:r,onSave:n,maintainAspectRatio:o,disableCardinalControls:a,isEditing:u,rotation:h,style:f={backgroundColor:"rgba(0,0,0,.5)"}}){let g=(0,Sv.useCallback)(p=>{n({id:t.id,x:t.x,y:t.y,height:t.height,width:t.width,...p})},[n,t.id,t.x,t.y,t.height,t.width]);return(0,Lh.jsx)(b1,{x:t.x,y:t.y,rotation:h,width:t.width,height:t.height,resizable:u,onSave:g,maintainAspectRatio:o,disableCardinalControls:a,children:(0,Lh.jsx)("box",{interactive:e,onClick:p=>{p.preventDefault(),p.stopPropagation(),r(t)},target:{x:0,y:0,width:t.width,height:t.height},style:f})})}var jh=e=>{let t=e.width/(e.crop?.width||e.tiles.width),r=e.tiles.imageService.tiles||[],n=e.tiles.imageService.sizes||[],o=e.enableThumbnail,a=e.enableSizes,u=(0,bv.useMemo)(()=>{let h=e.tiles.imageService.id||e.tiles.imageService["@id"];return h&&h.endsWith("/info.json")?h.slice(0,-1*10):h},[e.tiles.imageService.id]);return(0,yn.jsx)("world-object",{rotation:e.rotation,scale:t,height:e.crop?.height||e.tiles.height,width:e.crop?.width||e.tiles.width,x:e.x,y:e.y,onClick:e.onClick,children:(0,yn.jsxs)("composite-image",{id:e.tiles.imageService.id,width:e.crop?.width||e.tiles.width,height:e.crop?.height||e.tiles.height,crop:e.crop,renderOptions:e.renderOptions,children:[o&&e.tiles.thumbnail?(0,yn.jsx)("world-image",{priority:!0,uri:e.tiles.thumbnail.id,target:{width:e.tiles.width,height:e.tiles.height},display:{width:e.tiles.thumbnail.width,height:e.tiles.thumbnail.height},crop:e.crop}):null,a&&n.map((h,f)=>(0,yn.jsx)("world-image",{uri:`${u}/full/${h.width},${h.height}/0/default.jpg`,target:{width:e.tiles.width,height:e.tiles.height},display:{width:h.width,height:h.height},crop:e.crop},f)),r.map(h=>(h.scaleFactors||[]).map(f=>(0,yn.jsx)("tiled-image",{uri:e.tiles.imageService.id,display:{width:e.tiles.width,height:e.tiles.height},tile:h,scaleFactor:f,crop:e.crop},`${e.tiles.imageService.id}-tile-${f}`)))]},e.tiles.imageService.id)},e.tiles.imageService.id)};function Pv(e,t){return e?t?{...e,...t||{},":hover":e[":hover"]?Object.assign(e[":hover"]||{},t[":hover"]||{}):t[":hover"],":active":e[":active"]?Object.assign(e[":active"]||{},t[":active"]||{}):t[":hover"]}:e:t}var hr=T(q()),T1=(0,hr.createContext)(null),Uh={didCatch:!1,error:null},Bl=class extends hr.Component{constructor(t){super(t),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=Uh}static getDerivedStateFromError(t){return{didCatch:!0,error:t}}resetErrorBoundary(){let{error:t}=this.state;if(t!==null){for(var r,n,o=arguments.length,a=new Array(o),u=0;u<o;u++)a[u]=arguments[u];(r=(n=this.props).onReset)===null||r===void 0||r.call(n,{args:a,reason:"imperative-api"}),this.setState(Uh)}}componentDidCatch(t,r){var n,o;(n=(o=this.props).onError)===null||n===void 0||n.call(o,t,r)}componentDidUpdate(t,r){let{didCatch:n}=this.state,{resetKeys:o}=this.props;if(n&&r.error!==null&&I1(t.resetKeys,o)){var a,u;(a=(u=this.props).onReset)===null||a===void 0||a.call(u,{next:o,prev:t.resetKeys,reason:"keys"}),this.setState(Uh)}}render(){let{children:t,fallbackRender:r,FallbackComponent:n,fallback:o}=this.props,{didCatch:a,error:u}=this.state,h=t;if(a){let f={error:u,resetErrorBoundary:this.resetErrorBoundary};if(typeof r=="function")h=r(f);else if(n)h=(0,hr.createElement)(n,f);else if(o===null||(0,hr.isValidElement)(o))h=o;else throw u}return(0,hr.createElement)(T1.Provider,{value:{didCatch:a,error:u,resetErrorBoundary:this.resetErrorBoundary}},h)}};function I1(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return e.length!==t.length||e.some((r,n)=>!Object.is(r,t[n]))}var zn=T(q(),1);var ps=T(q(),1),Rv=T(G(),1),_1={collection:void 0,manifest:void 0,range:void 0,canvas:void 0,annotation:void 0,annotationPage:void 0},So=ps.default.createContext(_1),Ft=()=>(0,ps.useContext)(So);function Vt({value:e,children:t}){let r=Ft(),n=(0,ps.useMemo)(()=>({...r,...e}),[e,r]);return(0,Rv.jsx)(So.Provider,{value:n,children:t})}var cu=T(q(),1);var it=function(t){return function(){let r={type:t,getType:()=>t,toString:()=>t};return(n,o)=>({...r,...n!==void 0&&{payload:n},...o!==void 0&&{meta:o}})}},Vl="@iiif/IMPORT_ENTITIES",Wl="@iiif/MODIFY_ENTITY_FIELD",Hl="@iiif/REORDER_ENTITY_FIELD",ql="@iiif/ADD_REFERENCE",wo="@iiif/UPDATE_REFERENCE",Ql="@iiif/REMOVE_REFERENCE",Yl="@iiif/ADD_METADATA",Gl="@iiif/REMOVE_METADATA",Ao="@iiif/UPDATE_METADATA",Xl="@iiif/REORDER_METADATA",$l=it(Vl)(),Tv=it(Wl)(),Iv=it(Hl)(),_v=it(ql)(),Ov=it(Ql)(),Mv=it(wo)(),kv=it(Yl)(),Lv=it(Ao)(),zv=it(Gl)(),Nv=it(Xl)(),xn={importEntities:$l,modifyEntityField:Tv,reorderEntityField:Iv,addReference:_v,removeReference:Ov,updateReference:Mv,addMetadata:kv,removeMetadata:zv,updateMetadata:Lv,reorderMetadata:Nv},Zl="@iiif/ADD_MAPPING",Kl="@iiif/ADD_MAPPINGS",Bh=it(Zl)(),Vh=it(Kl)();var ms="RESOURCE_ERROR",bo="RESOURCE_LOADING",gs="RESOURCE_READY",Jl="@iiif/REQUEST_RESOURCE",eu="@iiif/REQUEST_ERROR",tu="@iiif/REQUEST_MISMATCH",ru="@iiif/REQUEST_COMPLETE",iu="@iiif/REQUEST_OFFLINE_RESOURCE",Wh=it(Jl)(),Eo=it(eu)(),Hh=it(tu)(),qh=it(ru)(),O1=it(iu)();var vs="@iiif/BATCH",nu="@iiif/BATCH_IMPORT",ys=it(vs)(),M1=it(nu)();var Qh="@iiif/SET_META_VALUE",Yh="@iiif/SET_META_VALUE_DYNAMIC",Gh="@iiif/UNSET_META_VALUE",k1=it(Qh)(),L1=it(Yh)(),z1=it(Gh)(),Xh={setMetaValue:k1,setMetaValueDynamic:L1,unsetMetaValue:z1};function $h(){return{Collection:{},Manifest:{},Canvas:{},AnnotationPage:{},AnnotationCollection:{},Annotation:{},ContentResource:{},Range:{},Service:{},Selector:{},Agent:{}}}var Vi={},Fv=e=>{let t,r=new Set,n=(p,v)=>{let x=typeof p=="function"?p(t):p;if(!Object.is(x,t)){let b=t;t=v??(typeof x!="object"||x===null)?x:Object.assign({},t,x),r.forEach(w=>w(t,b))}},o=()=>t,f={setState:n,getState:o,getInitialState:()=>g,subscribe:p=>(r.add(p),()=>r.delete(p)),destroy:()=>{(Vi.env?Vi.env.MODE:void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),r.clear()}},g=t=e(n,o,f);return f},N1=e=>e?Fv(e):Fv,F1=(e,t)=>(r,n,o)=>(o.dispatch=a=>(r(u=>e(u,a),!1,a),a),o.dispatchFromDevtools=!0,{dispatch:(...a)=>o.dispatch(...a),...t}),D1=F1,ed=new Map,su=e=>{let t=ed.get(e);return t?Object.fromEntries(Object.entries(t.stores).map(([r,n])=>[r,n.getState()])):{}},j1=(e,t,r)=>{if(e===void 0)return{type:"untracked",connection:t.connect(r)};let n=ed.get(r.name);if(n)return{type:"tracked",store:e,...n};let o={connection:t.connect(r),stores:{}};return ed.set(r.name,o),{type:"tracked",store:e,...o}},U1=(e,t={})=>(r,n,o)=>{let{enabled:a,anonymousActionType:u,store:h,...f}=t,g;try{g=(a??(Vi.env?Vi.env.MODE:void 0)!=="production")&&window.__REDUX_DEVTOOLS_EXTENSION__}catch{}if(!g)return(Vi.env?Vi.env.MODE:void 0)!=="production"&&a&&console.warn("[zustand devtools middleware] Please install/enable Redux devtools extension"),e(r,n,o);let{connection:p,...v}=j1(h,g,f),x=!0;o.setState=(A,E,P)=>{let I=r(A,E);if(!x)return I;let F=P===void 0?{type:u||"anonymous"}:typeof P=="string"?{type:P}:P;return h===void 0?(p?.send(F,n()),I):(p?.send({...F,type:`${h}/${F.type}`},{...su(f.name),[h]:o.getState()}),I)};let b=(...A)=>{let E=x;x=!1,r(...A),x=E},w=e(o.setState,n,o);if(v.type==="untracked"?p?.init(w):(v.stores[v.store]=o,p?.init(Object.fromEntries(Object.entries(v.stores).map(([A,E])=>[A,A===v.store?w:E.getState()])))),o.dispatchFromDevtools&&typeof o.dispatch=="function"){let A=!1,E=o.dispatch;o.dispatch=(...P)=>{(Vi.env?Vi.env.MODE:void 0)!=="production"&&P[0].type==="__setState"&&!A&&(console.warn('[zustand devtools middleware] "__setState" action type is reserved to set state from the devtools. Avoid using it.'),A=!0),E(...P)}}return p.subscribe(A=>{var E;switch(A.type){case"ACTION":if(typeof A.payload!="string"){console.error("[zustand devtools middleware] Unsupported action format");return}return Zh(A.payload,P=>{if(P.type==="__setState"){if(h===void 0){b(P.state);return}Object.keys(P.state).length!==1&&console.error(`
|
|
71
|
+
[zustand devtools middleware] Unsupported __setState action format.
|
|
72
|
+
When using 'store' option in devtools(), the 'state' should have only one key, which is a value of 'store' that was passed in devtools(),
|
|
73
|
+
and value of this only key should be a state object. Example: { "type": "__setState", "state": { "abc123Store": { "foo": "bar" } } }
|
|
74
|
+
`);let I=P.state[h];if(I==null)return;JSON.stringify(o.getState())!==JSON.stringify(I)&&b(I);return}o.dispatchFromDevtools&&typeof o.dispatch=="function"&&o.dispatch(P)});case"DISPATCH":switch(A.payload.type){case"RESET":return b(w),h===void 0?p?.init(o.getState()):p?.init(su(f.name));case"COMMIT":if(h===void 0){p?.init(o.getState());return}return p?.init(su(f.name));case"ROLLBACK":return Zh(A.state,P=>{if(h===void 0){b(P),p?.init(o.getState());return}b(P[h]),p?.init(su(f.name))});case"JUMP_TO_STATE":case"JUMP_TO_ACTION":return Zh(A.state,P=>{if(h===void 0){b(P);return}JSON.stringify(o.getState())!==JSON.stringify(P[h])&&b(P[h])});case"IMPORT_STATE":{let{nextLiftedState:P}=A.payload,I=(E=P.computedStates.slice(-1)[0])==null?void 0:E.state;if(!I)return;b(h===void 0?I:I[h]),p?.send(null,P);return}case"PAUSE_RECORDING":return x=!x}return}}),w},B1=U1,Zh=(e,t)=>{let r;try{r=JSON.parse(e)}catch(n){console.error("[zustand devtools middleware] Could not parse the received json",n)}r!==void 0&&t(r)},V1=e=>(t,r,n)=>{let o=n.subscribe;return n.subscribe=(u,h,f)=>{let g=u;if(h){let p=f?.equalityFn||Object.is,v=u(n.getState());g=x=>{let b=u(x);if(!p(v,b)){let w=v;h(v=b,w)}},f?.fireImmediately&&h(v,v)}return o(g)},e(t,r,n)},W1=V1,H1=(e={},t)=>{switch(t.type){case Zl:return{...e,[t.payload.id]:t.payload.type};case Kl:return{...e,...t.payload.mapping};default:return e}};function Kh(e,t,r,n){return!(!e[r]||!e[r][t]||!e[r][t][n]||!Array.isArray(e[r][t][n]))}function q1(e,t){let r={},n=[];for(let[o,a]of Object.entries(e||{})){n.push(o);let u=(t||{})[o];if(!u||u.length===0){r[o]=a;continue}r[o]=u}for(let[o,a]of Object.entries(t||{}))n.indexOf(o)===-1&&(r[o]=a);return r}function le(e){return e.payload}function Jh(e,t){return typeof e>"u"?t:e}var Q1=(e=$h(),t)=>{let r=(n,o)=>({...e,[le(t).type]:{...e[le(t).type],[le(t).id]:{...n,...o}}});switch(t.type){case Wl:{if(!e[le(t).type]||!e[le(t).type][le(t).id])return e;let n=e[le(t).type][le(t).id];return typeof n=="string"?e:r(n,{[le(t).key]:le(t).value})}case Hl:{if(!Kh(e,le(t).id,le(t).type,le(t).key))return e;let n=e[le(t).type][le(t).id];if(typeof n=="string")return e;let o=Array.from(n[le(t).key]),[a]=o.splice(le(t).startIndex,1);return o.splice(le(t).endIndex,0,a),r(n,{[le(t).key]:o})}case Vl:{let n=Object.keys(le(t).entities),o={...e};for(let a of n){let u=le(t).entities[a],h={...e[a]||{}},f=!1,g=Object.keys(u||{})||[];if(u&&g){for(let p of g)f=!0,h[p]=e[a][p]?q1(e[a][p],u[p]):u[p];f&&(o[a]=h)}}return o}case ql:{if(!Kh(e,le(t).id,le(t).type,le(t).key))return e;let n=e[le(t).type][le(t).id],o=Array.from(n[le(t).key]);return o.splice(Jh(le(t).index,o.length+1),0,le(t).reference),r(n,{[le(t).key]:o})}case wo:case Ql:{if(!Kh(e,le(t).id,le(t).type,le(t).key))return e;let n=e[le(t).type][le(t).id],o=Array.from(n[le(t).key]),a=Jh(le(t).index,o.findIndex(u=>u&&u.id===le(t).reference.id));return a===-1||o[a]?.id!==le(t).reference.id?e:(t.type===wo?o.splice(a,1,le(t).reference):o.splice(a,1),r(n,{[le(t).key]:o}))}case Yl:{let n=e[le(t).type][le(t).id];if(!n)return e;let o=Array.from(n.metadata||[]),a=le(t);return o.splice(Jh(t.payload.beforeIndex,o.length+1),0,{label:a.label,value:a.label}),r(n,{metadata:o})}case Xl:{let n=e[le(t).type][le(t).id];if(typeof n=="string"||!n)return e;let o=Array.from(n.metadata||[]),[a]=o.splice(le(t).startIndex,1);return o.splice(le(t).endIndex,0,a),r(n,{metadata:o})}case Ao:case Gl:{let n=e[le(t).type][le(t).id],o=Array.from(n.metadata||[]),a=le(t).atIndex;return typeof a>"u"||a===-1||!o[a]?e:(t.type===Ao?o.splice(a,1,{label:le(t).label,value:le(t).value}):o.splice(a,1),r(n,{metadata:o}))}default:return e}},Y1=(e={},t)=>{switch(t.type){case Jl:case iu:return{...e,[t.payload.id]:{requestUri:t.payload.id,loadingState:bo,uriMismatch:!1,resourceUri:t.payload.id}};case tu:return{...e,[t.payload.requestId]:{...e[t.payload.requestId]||{},uriMismatch:!0,resourceUri:t.payload.actualId},[t.payload.actualId]:{requestUri:t.payload.requestId,loadingState:e[t.payload.requestId].loadingState,uriMismatch:!0,resourceUri:t.payload.actualId}};case eu:return{...e,[t.payload.id]:{...e[t.payload.id]||{},loadingState:ms,error:t.payload.message}};case ru:return{...e,[t.payload.id]:{...e[t.payload.id]||{},loadingState:gs,error:void 0}}}return e},G1=(e={},t)=>{let{id:r,updateValue:n,value:o,meta:a,key:u}=t&&t.payload||{};switch(t.type){case Qh:return{...e,[r]:{...e[r]||{},[a]:{...e[r]?e[r][a]||{}:{},[u]:o}}};case Yh:return{...e,[r]:{...e[r]||{},[a]:{...e[r]?e[r][a]||{}:{},[u]:e[r]&&e[r][a]?n(e[r][a][u]):n(void 0)}}};case Gh:return e[r]&&e[r][a]&&e[r][a][u]?{...e,[r]:{...e[r]||{},[a]:{...e[r]?e[r][a]||{}:{},[u]:void 0}}}:e;default:return e}};function Dv(e={}){let t=Object.keys(e);return function(n={},o){let a=!1,u={};for(let h=0;h<t.length;h++){let f=t[h];u[f]=e[f](n[f],o),a=a||u[f]!==n[f]}return a?u:n}}function X1(e){return(t,r)=>r&&r.type===vs?r.payload.actions.reduce(e,t):r&&r.type===nu?{...t,iiif:{...t.iiif,...r.payload.state}}:e(t,r)}var $1=Dv({mapping:H1,entities:Q1,requests:Y1,meta:G1});function Z1(){return{iiif:{entities:$h(),meta:{},mapping:{},requests:{}}}}function jv(e={}){let{enableDevtools:t=!1,iiifStoreName:r="iiif",defaultState:n=Z1(),customReducers:o={}}=e,a=X1(Dv({[r]:$1,...o}));return N1(W1(B1(D1(a,n),{enabled:t})))}function ni(e){for(let t in e)(typeof e[t]>"u"||e[t]===null)&&delete e[t];return e}function Wi(e){return Array.isArray(e)?e:e?[e]:[]}var K1=Object.defineProperty,J1=(e,t,r)=>t in e?K1(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,si=(e,t,r)=>(J1(e,typeof t!="symbol"?t+"":t,r),r);var Uv=["sc:Collection","sc:Manifest","sc:Canvas","sc:AnnotationList","oa:Annotation","sc:Range","sc:Layer","sc:Sequence","oa:Choice","Service","ContentResource"];function eA(e){if(typeof e>"u"||e===null)throw new Error("Null or undefined is not a valid entity.");if(Array.isArray(e))throw new Error("Array is not a valid entity");if(typeof e!="object")throw new Error(`${typeof e} is not a valid entity`);if(typeof e["@type"]=="string"){let t=Uv.indexOf(e["@type"]);if(t!==-1)return Uv[t]}if(e.profile)return"Service";if(e.format||e["@type"])return"ContentResource";throw new Error("Resource type is not known")}var tA=class Wv{constructor(t,r={}){si(this,"traversals"),si(this,"options"),this.traversals={collection:[],manifest:[],canvas:[],annotationList:[],sequence:[],annotation:[],contentResource:[],choice:[],range:[],service:[],layer:[],...t},this.options={convertPropsToArray:!0,mergeMemberProperties:!0,allowUndefinedReturn:!1,...r}}static all(t){return new Wv({collection:[t],manifest:[t],canvas:[t],annotationList:[t],sequence:[t],annotation:[t],contentResource:[t],choice:[t],range:[t],service:[t],layer:[t]})}traverseCollection(t){return this.traverseType(this.traverseDescriptive(this.traverseLinking(this.traverseCollectionItems(t))),this.traversals.collection)}traverseCollectionItems(t){if(this.options.mergeMemberProperties){let r=[...(t.manifests||[]).map(n=>typeof n=="string"?{"@id":n,"@type":"sc:Manifest"}:n),...(t.collections||[]).map(n=>typeof n=="string"?{"@id":n,"@type":"sc:Collection"}:n),...t.members||[]];delete t.collections,delete t.manifests,t.members=r}return t.manifests&&(t.manifests=t.manifests.map(r=>this.traverseManifest(typeof r=="string"?{"@id":r,"@type":"sc:Manifest"}:r))),t.collections&&(t.collections=t.collections.map(r=>this.traverseCollection(typeof r=="string"?{"@id":r,"@type":"sc:Collection"}:r))),t.members&&(t.members=t.members.map(r=>typeof r=="string"?r:this.traverseUnknown(r))),t}traverseManifest(t){return this.traverseType(this.traverseDescriptive(this.traverseLinking(this.traverseManifestItems(t))),this.traversals.manifest)}traverseManifestItems(t){return t.sequences&&(t.sequences=t.sequences.map(r=>this.traverseSequence(r))),t.structures&&(t.structures=t.structures.map(r=>this.traverseRange(r))),t}traverseSequence(t){return this.traverseType(this.traverseDescriptive(this.traverseLinking(this.traverseSequenceItems(t))),this.traversals.sequence)}traverseSequenceItems(t){return t.canvases&&(t.canvases=t.canvases.map(r=>this.traverseCanvas(r))),t}traverseCanvas(t){return this.traverseType(this.traverseDescriptive(this.traverseLinking(this.traverseCanvasItems(t))),this.traversals.canvas)}traverseCanvasItems(t){return t.images&&(t.images=t.images.map(r=>this.traverseAnnotation(r))),t.otherContent&&(t.otherContent=t.otherContent.map(r=>this.traverseAnnotationList(r))),t}traverseRange(t){return this.traverseType(this.traverseDescriptive(this.traverseLinking(this.traverseRangeItems(t))),this.traversals.range)}traverseRangeItems(t){if(this.options.mergeMemberProperties){let r=[...(t.ranges||[]).map(n=>typeof n=="string"?{"@id":n,"@type":"sc:Range"}:n),...(t.canvases||[]).map(n=>typeof n=="string"?{"@id":n,"@type":"sc:Canvas"}:n),...t.members||[]];delete t.ranges,delete t.canvases,t.members=r.length?r.map(n=>this.traverseUnknown(n)):void 0}return t}traverseAnnotationList(t){let r=typeof t=="string"?{"@id":t,"@type":"sc:AnnotationList"}:t;return this.traverseType(this.traverseDescriptive(this.traverseAnnotationListItems(r)),this.traversals.annotationList)}traverseAnnotationListItems(t){return t.resources&&(t.resources=t.resources.map(r=>this.traverseAnnotation(r))),t}traverseAnnotation(t){return this.traverseType(this.traverseDescriptive(this.traverseLinking(this.traverseAnnotationItems(t))),this.traversals.annotation)}traverseAnnotationItems(t){return t.resource&&(Array.isArray(t.resource)?t.resource=t.resource.map(r=>this.traverseContentResource(r)):t.resource=this.traverseContentResource(t.resource)),t.on,t}traverseLayer(t){return this.traverseType(this.traverseLinking(this.traverseLayerItems(t)),this.traversals.layer)}traverseLayerItems(t){return t.otherContent&&(t.otherContent=t.otherContent.map(r=>this.traverseAnnotationList(r))),t}traverseChoice(t){return this.traverseType(this.traverseChoiceItems(t),this.traversals.choice)}traverseChoiceItems(t){return t.default&&t.default!=="rdf:nil"&&(t.default=this.traverseContentResource(t.default)),t.item&&t.item!=="rdf:nil"&&(t.item=t.item.map(r=>this.traverseContentResource(r))),t}traverseService(t){return this.traverseType(this.traverseLinking(t),this.traversals.service)}traverseContentResource(t){return t["@type"]==="oa:Choice"?this.traverseChoice(t):this.traverseType(this.traverseDescriptive(this.traverseLinking(t)),this.traversals.contentResource)}traverseUnknown(t){if(!t["@type"]||typeof t=="string")return t;switch(eA(t)){case"sc:Collection":return this.traverseCollection(t);case"sc:Manifest":return this.traverseManifest(t);case"sc:Canvas":return this.traverseCanvas(t);case"sc:Sequence":return this.traverseSequence(t);case"sc:Range":return this.traverseRange(t);case"oa:Annotation":return this.traverseAnnotation(t);case"sc:AnnotationList":return this.traverseAnnotationList(t);case"sc:Layer":return this.traverseLayer(t);case"Service":return this.traverseService(t);case"oa:Choice":return this.traverseChoice(t);case"ContentResource":return this.traverseContentResource(t)}return t.profile?this.traverseService(t):t}traverseImageResource(t){let r=Array.isArray(t),n=Array.isArray(t)?t:[t],o=[];for(let a of n)typeof a=="string"?o.push(this.traverseContentResource({"@id":a,"@type":"dctypes:Image"})):o.push(this.traverseContentResource(a));return!r&&!this.options.convertPropsToArray?o[0]:o}traverseDescriptive(t){return t.thumbnail&&(t.thumbnail=this.traverseImageResource(t.thumbnail)),t.logo&&(t.logo=this.traverseImageResource(t.logo)),t}traverseOneOrMoreServices(t){let r=Array.isArray(t),n=Array.isArray(t)?t:[t],o=[];for(let a of n)o.push(this.traverseService(a));return!r&&!this.options.convertPropsToArray?o[0]:o}traverseLinking(t){return t.related&&(t.related=this.traverseOneOrManyType(t.related,this.traversals.contentResource)),t.rendering&&(t.rendering=this.traverseOneOrManyType(t.rendering,this.traversals.contentResource)),t.service&&(t.service=this.traverseOneOrMoreServices(t.service)),t.seeAlso&&(t.seeAlso=this.traverseOneOrManyType(t.seeAlso,this.traversals.contentResource)),t.within&&(typeof t.within=="string"||(t.within=this.traverseOneOrManyType(t.within,this.traversals.contentResource))),t.startCanvas&&(typeof t.startCanvas=="string"?t.startCanvas=this.traverseType({"@id":t.startCanvas,"@type":"sc:Canvas"},this.traversals.canvas):t.startCanvas&&this.traverseType(t.startCanvas,this.traversals.canvas)),t.contentLayer&&(typeof t.contentLayer=="string"?t.contentLayer=this.traverseLayer({"@id":t.contentLayer,"@type":"sc:Layer"}):t.contentLayer=this.traverseLayer(t.contentLayer)),t}traverseOneOrManyType(t,r){if(!Array.isArray(t))if(this.options.convertPropsToArray)t=[t];else return this.traverseType(t,r);return t.map(n=>this.traverseType(n,r))}traverseType(t,r){return r.reduce((n,o)=>{let a=o(n);return typeof a>"u"&&!this.options.allowUndefinedReturn?n:a},t)}},rA="http://library.stanford.edu/iiif/image-api/compliance.html#level0",Hv="http://library.stanford.edu/iiif/image-api/compliance.html#level1",qv="http://library.stanford.edu/iiif/image-api/compliance.html#level2",iA="http://library.stanford.edu/iiif/image-api/conformance.html#level0",Qv="http://library.stanford.edu/iiif/image-api/conformance.html#level1",Yv="http://library.stanford.edu/iiif/image-api/conformance.html#level2",nA="http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level0",Gv="http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level1",Xv="http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level2",sA="http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level0",$v="http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level1",Zv="http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level2",oA="http://iiif.io/api/image/1/level0.json",aA="http://iiif.io/api/image/1/profiles/level0.json",Kv="http://iiif.io/api/image/1/level1.json",Jv="http://iiif.io/api/image/1/profiles/level1.json",ey="http://iiif.io/api/image/1/level2.json",ty="http://iiif.io/api/image/1/profiles/level2.json",lA="http://iiif.io/api/image/2/level0.json",uA="http://iiif.io/api/image/2/profiles/level0.json",ry="http://iiif.io/api/image/2/level1.json",iy="http://iiif.io/api/image/2/profiles/level1.json",ny="http://iiif.io/api/image/2/level2.json",sy="http://iiif.io/api/image/2/profiles/level2.json",cA="level0",oy="level1",ay="level2",hA="http://iiif.io/api/image/2/level0",ly="http://iiif.io/api/image/2/level1",uy="http://iiif.io/api/image/2/level2",dA=[ly,uy,Hv,qv,Qv,Yv,Gv,Xv,$v,Zv,Kv,Jv,ey,ty,ry,iy,ny,sy,oy,ay],fA=[hA,ly,uy,rA,Hv,qv,iA,Qv,Yv,nA,Gv,Xv,sA,$v,Zv,oA,aA,Kv,Jv,ey,ty,lA,uA,ry,iy,ny,sy,cA,oy,ay],td={attributionLabel:"Attribution",lang:"none",providerId:"http://example.org/provider",providerName:"Unknown"};function pA(e){if(typeof e=="string")return[e];if(!e)return[];let t=Array.isArray(e)?e:[e],r=[];for(let n of t){if(typeof n=="string"){r.push(n);continue}r.push({"@language":n["@language"]||n.language,"@value":n["@value"]||n.value})}return r}function Sn(e,t="none"){if(!e)return{};let r=pA(e),n={};for(let o of r){if(typeof o=="string"){n[t]=n[t]?n[t]:[],n[t].push(o||"");continue}if(!o["@language"]){n[t]=n[t]?n[t]:[],n[t].push(o["@value"]||"");continue}let a=o["@language"];n[a]=n[a]?n[a]:[],n[a].push(o["@value"]||"")}return n}function cy(e){if(Array.isArray(e))return cy(e.find(t=>typeof t=="string"));if(fA.indexOf(e)!==-1)return"level2";if(dA.indexOf(e)!==-1)return"level1";if(typeof e=="string")return e}function mA(e){let t=Array.isArray(e)?e:[e];for(let r of t)switch(r){case"http://iiif.io/api/image/2/context.json":case"http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level2":return"ImageService2";case"http://iiif.io/api/image/1/context.json":case"http://library.stanford.edu/iiif/image-api/1.1/context.json":return"ImageService1";case"http://iiif.io/api/annex/openannotation/context.json":return"ImageApiSelector"}}function gA(e){switch(e){case"http://iiif.io/api/image/2/level0.json":case"http://iiif.io/api/image/2/level1.json":case"http://iiif.io/api/image/2/level2.json":return"ImageService2";case"http://iiif.io/api/auth/1/kiosk":case"http://iiif.io/api/auth/1/login":case"http://iiif.io/api/auth/1/clickthrough":case"http://iiif.io/api/auth/1/external":case"http://iiif.io/api/auth/0/kiosk":case"http://iiif.io/api/auth/0/login":case"http://iiif.io/api/auth/0/clickthrough":case"http://iiif.io/api/auth/0/external":return"AuthCookieService1";case"http://iiif.io/api/auth/1/token":case"http://iiif.io/api/auth/0/token":return"AuthTokenService1";case"http://iiif.io/api/auth/1/logout":case"http://iiif.io/api/auth/0/logout":return"AuthLogoutService1";case"http://iiif.io/api/search/1/search":case"http://iiif.io/api/search/0/search":return"SearchService1";case"http://iiif.io/api/search/1/autocomplete":case"http://iiif.io/api/search/0/autocomplete":return"AutoCompleteService1"}}function Bv(e){for(let t of["sc","oa","dcterms","dctypes","iiif"])if(e.startsWith(`${t}:`))return e.slice(t.length+1);return e}var vA=["Collection","Manifest","Annotation","AnnotationPage","Range","Service"];function nd(e){let t=e["@id"]||e.id,r=e["@type"]||e.type,n=e.profile||void 0,o=e["@context"]||void 0;if(n){let a=gA(n);if(a)return a}if(o){let a=mA(o);if(a)return a}if(r){if(Array.isArray(r)){if(r.indexOf("oa:CssStylesheet")!==-1)return"CssStylesheet";if(r.indexOf("cnt:ContentAsText")!==-1)return"TextualBody";r=r[0]}for(let a of["sc","oa","dcterms","dctypes","iiif"])if(r.startsWith(`${a}:`)){r=r.slice(a.length+1);break}switch(r){case"Layer":return"AnnotationCollection";case"AnnotationList":return"AnnotationPage";case"cnt:ContentAsText":return"TextualBody"}}if(r&&vA.indexOf(r)!==-1)return r;if(e.format){if(e.format.startsWith("image/"))return"Image";if(e.format.startsWith("text/")||e.format==="application/pdf")return"Text";if(e.format.startsWith("application/"))return"Dataset"}return t&&(t.endsWith(".jpg")||t.endsWith(".png")||t.endsWith(".jpeg"))?"Image":r||"unknown"}var yA=/http(s)?:\/\/(creativecommons.org|rightsstatements.org)[^"'\\<\n]+/gm;function xA(e){let t=e.match(yA);return t?t[0]:e}function SA(e,t="Rights/License",r="none"){let n=null,o=[],a=Array.isArray(e)?e:[e];for(let u of a){let h=u?xA(u):void 0;if(h&&(h.indexOf("creativecommons.org")!==-1||h.indexOf("rightsstatements.org")!==-1)){h.startsWith("https://")?n=`http://${h.slice(8)}`:n=h;continue}h&&o.push({label:{[r]:[t]},value:{[r]:[h]}})}return[n,o]}var wA=["http://iiif.io/api/presentation/2/context.json","http://iiif.io/api/image/2/context.json","http://iiif.io/api/image/1/context.json","http://library.stanford.edu/iiif/image-api/1.1/context.json","http://iiif.io/api/search/1/context.json","http://iiif.io/api/search/0/context.json","http://iiif.io/api/auth/1/context.json","http://iiif.io/api/auth/0/context.json","http://iiif.io/api/annex/openannotation/context.json"];function AA(e){if(e){let t=Array.isArray(e)?e:[e],r=[];for(let n of t)n==="http://iiif.io/api/presentation/2/context.json"&&r.push("http://iiif.io/api/presentation/3/context.json"),wA.indexOf(n)===-1&&r.push(n);if(t.length)return r.length===1?r[0]:r}}function bA(e){return e?e.map(t=>({label:Sn(t.label),value:Sn(t.value)})):[]}var Vv=0;function hy(e,t){let r=encodeURI(e.id||e["@id"]||"").trim();return r&&t?`${r}/${t}`:r||(Vv++,`http://example.org/${e["@type"]}${t?`/${t}`:""}/${Vv}`)}function xi(e){let t=[...e.behavior||[]];e.viewingHint&&t.push(e.viewingHint);let r;return Array.isArray(e.motivation)?r=e.motivation.map(Bv):e.motivation&&(r=Bv(e.motivation)),{"@context":e["@context"]?AA(e["@context"]):void 0,id:(e["@id"]||hy(e)).trim(),type:nd(e),behavior:t.length?t:void 0,height:e.height?e.height:void 0,width:e.width?e.width:void 0,motivation:r,viewingDirection:e.viewingDirection,profile:e.profile,format:e.format?e.format:void 0,duration:void 0,timeMode:void 0}}function Si(e){let[t,r]=SA(e.license),n=[...e.metadata?bA(e.metadata):[],...r];return{rights:t,metadata:n.length?n:void 0,label:e.label?Sn(e.label):void 0,requiredStatement:e.attribution?{label:Sn(td.attributionLabel),value:Sn(e.attribution)}:void 0,navDate:e.navDate,summary:e.description?Sn(e.description):void 0,thumbnail:EA(e.thumbnail)}}function EA(e){return e&&(Array.isArray(e)?e:[e]).map(t=>typeof t=="string"?{id:t,type:"Image"}:(t.type==="unknown"&&(t.type="Image"),t))}function CA(e){if(!e.within)return;let t=Array.isArray(e.within)?e.within:[e.within],r=[];for(let n of t)if(typeof n=="string"){if(n)switch(e["@type"]){case"sc:Manifest":r.push({id:n,type:"Collection"});break}}else n["@id"]&&r.push({id:n["@id"],type:nd(n)});return r.length?r:void 0}function Hi(e){let t=e.related?Array.isArray(e.related)?e.related:[e.related]:[],r=e.contentLayer;return{provider:e.logo||t.length?[{id:td.providerId,type:"Agent",homepage:t.length?[t[0]]:void 0,logo:e.logo?Array.isArray(e.logo)?e.logo:[e.logo]:void 0,label:Sn(td.providerName)}]:void 0,partOf:CA(e),rendering:e.rendering,seeAlso:e.seeAlso,start:e.startCanvas,service:e.service?Wi(e.service):void 0,supplementary:r?[r]:void 0}}function PA(e){return{chars:e.chars,format:e.format?e.format:void 0,language:e.language}}function RA(e){return ni({...xi(e),...Si(e),...Hi(e),items:e.members})}function TA(e){let t=[],r=[],n;for(let a of e.sequences||[])a.canvases.length&&t.push(...a.canvases),a.behavior&&r.push(...a.behavior),a.startCanvas&&(n=a.startCanvas);let o=xi(e);return r.length&&(o.behavior?o.behavior.push(...r):o.behavior=r),ni({...o,...Si(e),...Hi(e),start:n,items:t,structures:e.structures})}function IA(e){return ni({...xi(e),...Si(e),...Hi(e),annotations:e.otherContent&&e.otherContent.length?e.otherContent:void 0,items:e.images&&e.images.length?[{id:hy(e,"annotation-page"),type:"AnnotationPage",items:e.images}]:void 0})}function _A(e){return ni({...xi(e),...Si(e),...Hi(e),items:e.resources&&e.resources.length?e.resources:void 0})}function OA(e){return!e.canvases||e.canvases.length===0?{canvases:[],behavior:[]}:{canvases:e.canvases,behavior:e.viewingHint?[e.viewingHint]:[],startCanvas:e.startCanvas}}function MA(e){function t(r){if(Array.isArray(r)){if(r.length>1)return{type:"List",items:r.map(t)};r=r[0]}if(typeof r=="string")return encodeURI(r).trim();if("@type"in r){let n;if(typeof r.full=="string")n=r.full;else if(r.full["@type"]==="dctypes:Image")n={id:r.full["@id"],type:"Image"};else if(r.full["@type"]==="sc:Canvas")n={id:r.full["@id"],type:"Canvas"};else throw new Error(`Unsupported source type on annotation: ${r.full["@type"]}`);return{type:"SpecificResource",source:n,selector:id(r.selector)}}else return encodeURI(r["@id"]).trim()}return ni({...xi(e),...Si(e),...Hi(e),target:t(e.on),body:Array.isArray(e.resource)?e.resource.map(rd):rd(e.resource)})}function rd(e){let t=e;return ni({...xi(t),...Si(t),...Hi(t),...PA(t)})}function kA(e){let t=[];return e.default&&e.default!=="rdf:nil"&&t.push(e.default),e.item&&e.item!=="rdf:nil"&&t.push(...e.item),{...xi(e),...Si(e),items:t}}function LA(e){return ni({...xi(e),...Si(e),...Hi(e),items:e.members})}function zA(e){let{"@id":t,"@type":r,"@context":n,profile:o,...a}=e,u={};return t&&(u["@id"]=t),u["@type"]=nd(e),u["@type"]==="unknown"&&(n&&n.length&&(u["@context"]=n),u["@type"]="Service"),o&&(u.profile=cy(o)),ni({...u,...a})}function NA(e){return ni({...xi(e),...Si(e),...Hi(e)})}var FA=new tA({collection:[RA],manifest:[TA],canvas:[IA],annotationList:[_A],sequence:[OA],annotation:[MA],contentResource:[rd],choice:[kA],range:[LA],service:[zA],layer:[NA]});function dy(e){return e&&e["@context"]&&(e["@context"]==="http://iiif.io/api/presentation/2/context.json"||e["@context"].indexOf("http://iiif.io/api/presentation/2/context.json")!==-1||e["@context"]==="http://www.shared-canvas.org/ns/context.json")||e["@context"]==="http://iiif.io/api/image/2/context.json"?FA.traverseUnknown(e):e}function id(e){if((Array.isArray(e["@type"])&&e["@type"].includes("oa:SvgSelector")||e["@type"]=="oa:SvgSelector")&&("chars"in e||"value"in e))return{type:"SvgSelector",value:"chars"in e?e.chars:e.value};if(e["@type"]==="oa:FragmentSelector")return{type:"FragmentSelector",value:e.value};if(e["@type"]==="oa:Choice")return[id(e.default),...(Array.isArray(e.item)?e.item:[e.item]).map(id)];if(e["@type"]=="iiif:ImageApiSelector")return{type:"ImageApiSelector",region:"region"in e?e.region:void 0,rotation:"rotation"in e?e.rotation:void 0};throw new Error(`Unsupported selector type: ${e["@type"]}`)}function Nr(e){return typeof e=="string"?!1:!!e&&e.type==="SpecificResource"}function ou(...e){return t=>e.reduce((r,n)=>n(r),t)}var sd=["Collection","Manifest","Canvas","AnnotationPage","AnnotationCollection","Annotation","ContentResource","Range","Service","Selector","Agent"];function fy(e,t){if(typeof e>"u"||e===null)throw new Error("Null or undefined is not a valid entity.");if(Array.isArray(e))throw new Error("Array is not a valid entity");if(typeof e!="object"){if(t)return t;throw new Error(`${typeof e} is not a valid entity`)}if(typeof e.type=="string"){let r=sd.indexOf(e.type);if(r!==-1)return sd[r]}if(e.profile)return"Service";throw new Error("Resource type is not known")}var od=class py{constructor(t,r={}){si(this,"traversals"),si(this,"options"),si(this,"_traverseManifest",ou(this.traverseManifestItems.bind(this),this.traverseLinking.bind(this),this.traverseDescriptive.bind(this),this.traverseLinkedCanvases.bind(this),this.traverseManifestStructures.bind(this),this.traverseInlineAnnotationPages.bind(this))),si(this,"_traverseCanvas",ou(this.traverseCanvasItems.bind(this),this.traverseLinking.bind(this),this.traverseDescriptive.bind(this),this.traverseLinkedCanvases.bind(this),this.traverseInlineAnnotationPages.bind(this))),si(this,"_traverseAnnotationPage",ou(this.traverseAnnotationPageItems.bind(this),this.traverseLinking.bind(this),this.traverseDescriptive.bind(this))),si(this,"_traverseRange",ou(this.traverseRangeRanges.bind(this),this.traverseLinking.bind(this),this.traverseDescriptive.bind(this),this.traverseLinkedCanvases.bind(this))),this.traversals={collection:[],manifest:[],canvas:[],annotationCollection:[],annotationPage:[],annotation:[],contentResource:[],choice:[],range:[],service:[],agent:[],specificResource:[],geoJson:[],...t},this.options={allowUndefinedReturn:!1,...r}}static all(t){return new py({collection:[t],manifest:[t],canvas:[t],annotationCollection:[t],annotationPage:[t],annotation:[t],contentResource:[t],choice:[t],range:[t],service:[t],geoJson:[t],specificResource:[t],agent:[t]})}traverseDescriptive(t){return t.thumbnail&&(t.thumbnail=Wi(t.thumbnail).map(r=>this.traverseType(r,{parent:t},this.traversals.contentResource))),t.provider&&(t.provider=t.provider.map(r=>this.traverseAgent(r,t))),t}traverseLinking(t){return t.seeAlso&&(t.seeAlso=t.seeAlso.map(r=>this.traverseType(r,{parent:t},this.traversals.contentResource))),t.service&&(t.service=Wi(t.service).map(r=>this.traverseService(r))),t.services&&(t.services=Wi(t.services).map(r=>this.traverseService(r,t))),t.logo&&(t.logo=t.logo.map(r=>this.traverseType(r,{parent:t},this.traversals.contentResource))),t.homepage&&(t.homepage=t.homepage.map(r=>this.traverseType(r,{parent:t},this.traversals.contentResource))),t.partOf&&(t.partOf=t.partOf.map(r=>typeof r=="string"||!r.type?this.traverseType(r,{parent:t},this.traversals.contentResource):r.type==="Canvas"?this.traverseType(r,{parent:t},this.traversals.canvas):r.type==="AnnotationCollection"?this.traverseType(r,{parent:t},this.traversals.annotationCollection):r.type==="Collection"?this.traverseType(r,{parent:t},this.traversals.collection):this.traverseType(r,{parent:t},this.traversals.contentResource))),t.start&&(Nr(t.start)?t.start=this.traverseSpecificResource(t.start,"Canvas",t):t.start=this.traverseType(t.start,{parent:t},this.traversals.canvas)),t.rendering&&(t.rendering=t.rendering.map(r=>this.traverseType(r,{parent:t},this.traversals.contentResource))),t.supplementary&&(t.supplementary=t.supplementary.map(r=>this.traverseType(r,{parent:t},this.traversals.contentResource))),t}traverseCollectionItems(t){return t.items&&t.items.map(r=>r.type==="Collection"?this.traverseCollection(r):this.traverseManifest(r)),t}traverseCollection(t,r){return this.traverseType(this.traverseDescriptive(this.traverseInlineAnnotationPages(this.traverseLinking(this.traverseLinkedCanvases(this.traverseCollectionItems(t))))),{parent:r},this.traversals.collection)}traverseGeoJson(t,r){return this.traverseType(t,{parent:r},this.traversals.geoJson)}traverseNavPlace(t){return t.navPlace&&(t.navPlace=this.traverseGeoJson(t.navPlace,t)),t}traverseManifestItems(t){return t.items&&(t.items=t.items.map(r=>this.traverseCanvas(r))),t}traverseManifestStructures(t){return t.structures&&(t.structures=t.structures.map(r=>this.traverseRange(r))),t}traverseManifest(t,r){return this.traverseType(this._traverseManifest(t),{parent:r},this.traversals.manifest)}traverseCanvasItems(t){return t.items=(t.items||[]).map(r=>this.traverseAnnotationPage(r,t)),t}traverseInlineAnnotationPages(t){return typeof t=="string"||!t||t.annotations&&(t.annotations=t.annotations.map(r=>this.traverseAnnotationPage(r,t))),t}traverseCanvas(t,r){return this.traverseType(this._traverseCanvas(t),{parent:r},this.traversals.canvas)}traverseAnnotationPageItems(t){return t.items&&(t.items=t.items.map(r=>this.traverseAnnotation(r,t))),t}traverseAnnotationPage(t,r){return this.traverseType(this._traverseAnnotationPage(t),{parent:r},this.traversals.annotationPage)}traverseAnnotationBody(t){return Array.isArray(t.body)?t.body=t.body.map(r=>this.traverseContentResource(r,t)):t.body&&(t.body=this.traverseContentResource(t.body,t)),t}traverseLinkedCanvases(t){return t.placeholderCanvas&&(t.placeholderCanvas=this.traverseCanvas(t.placeholderCanvas)),t.accompanyingCanvas&&(t.accompanyingCanvas=this.traverseCanvas(t.accompanyingCanvas)),t}traverseAnnotation(t,r){return this.traverseType(this.traverseLinking(this.traverseAnnotationBody(this.traverseDescriptive(t))),{parent:r},this.traversals.annotation)}traverseContentResourceLinking(t){return typeof t=="string"||!t||t&&t.service&&(t.service=Wi(t.service||[]).map(r=>this.traverseService(r,t))),t}traverseContentResource(t,r){return t.type==="Choice"&&(t.items=t.items.map(n=>this.traverseContentResource(n,t))),Nr(t)?this.traverseSpecificResource(t,"ContentResource"):this.traverseType(this.traverseInlineAnnotationPages(this.traverseContentResourceLinking(t)),{parent:r},this.traversals.contentResource)}traverseSpecificResource(t,r,n){let o=t.source;return typeof t.source=="string"&&(o={id:t.source,type:r||"unknown"}),this.traverseType({...t,source:r==="Canvas"||o.type==="Canvas"?this.traverseType(o,{parent:n},this.traversals.canvas):r==="ContentResource"?this.traverseContentResource(o,{parent:n}):this.traverseUnknown(o,{parent:n,typeHint:r})},{parent:n},this.traversals.specificResource)}traverseRangeRanges(t){return t.items&&(t.items=t.items.map(r=>typeof r=="string"?this.traverseCanvas({id:r,type:"Canvas"},t):Nr(r)?this.traverseSpecificResource(r,"Canvas",t):r.type==="Manifest"?this.traverseManifest(r,t):this.traverseRange(r,t))),t}traverseRange(t,r){return this.traverseType(this._traverseRange(t),{parent:r},this.traversals.range)}traverseAgent(t,r){return this.traverseType(this.traverseDescriptive(this.traverseLinking(t)),{parent:r},this.traversals.agent)}traverseType(t,r,n){return n.reduce((o,a)=>{let u=a(o,r);return typeof u>"u"&&!this.options.allowUndefinedReturn?o:u},t)}traverseService(t,r){let n=Object.assign({},t);return n&&n.service&&(n.service=Wi(n.service).map(o=>this.traverseService(o))),this.traverseType(n,{parent:r},this.traversals.service)}traverseUnknown(t,{parent:r,typeHint:n}={}){let o=fy(t,n);switch(o){case"Collection":return this.traverseCollection(t,r);case"Manifest":return this.traverseManifest(t,r);case"Canvas":return this.traverseCanvas(t,r);case"AnnotationPage":return this.traverseAnnotationPage(t,r);case"Annotation":return this.traverseAnnotation(t,r);case"ContentResource":return this.traverseContentResource(t,r);case"Range":return this.traverseRange(t,r);case"Service":return this.traverseService(t,r);case"Agent":return this.traverseAgent(t,r);default:throw new Error(`Unknown or unsupported resource type of ${o}`)}}};function ud(e,t){let r=t||"unknown";if(!e)return;if(typeof e=="string")return{id:e,type:r};if(Nr(e))return ud(e.source,t);let n=r&&r!=="unknown"?r:e.type||e["@type"],o=e.id||e["@id"];if(n&&n.indexOf(":")!==-1&&(n=n.split(":").pop()),o&&n)return{id:o,type:n}}var Ss={},at="iiif-parser:hasPart",dr="iiif-parser:partOf",ws="iiif-parser:isExternal",Er="__$UNSET$__",cd="__$UNWRAP$__",ae=[];Object.freeze(ae);Object.freeze(Ss);function gy(e){if(e===Ss||Object.keys(e).length===0)return!0;for(let t in e)return!1;return!0}function bs(e,t){if(t&&t["@explicit"]){let r={},n=Object.keys(t);for(let o of n)o===dr||o==="@explicit"||(gy(t[o])?r[o]=e[o]:r[o]=t[o]);return r}return e}function hd(e,t,r){let n=ud(t);if(!n)return[void 0,void 0];let o=e.requests[n.id],a=n.type||e.mapping[n.id];if(!a||o&&o.resourceUri&&(!e.entities[a]||!e.entities[a][o.resourceUri]))return[void 0,void 0];let u=e.entities[a][o?o.resourceUri:n.id];if(n.type&&!u)return hd(e,{id:n.id},r);if(u&&u[at]){let h=u[at].find(f=>r?f[dr]===r.id:f[dr]===u.id);return[bs(u,h),u]}return[u,u]}var vy={id:"https://iiif-parser/annotation-page",type:"AnnotationPage",behavior:ae,label:null,thumbnail:ae,summary:null,requiredStatement:null,metadata:ae,rights:null,provider:ae,items:ae,seeAlso:ae,homepage:ae,rendering:ae,service:ae},yy={id:"https://iiif-parser/empty-canvas",type:"Canvas",label:null,behavior:ae,thumbnail:ae,accompanyingCanvas:null,placeholderCanvas:null,summary:null,requiredStatement:null,metadata:ae,rights:null,navDate:null,provider:ae,items:ae,annotations:ae,seeAlso:ae,homepage:ae,partOf:ae,rendering:ae,service:ae,duration:0,height:0,width:0},xy={id:"https://iiif-parser/empty-collection",type:"Collection",label:null,viewingDirection:"left-to-right",behavior:ae,thumbnail:ae,accompanyingCanvas:null,placeholderCanvas:null,summary:null,requiredStatement:null,metadata:ae,rights:null,navDate:null,provider:ae,items:ae,annotations:ae,seeAlso:ae,homepage:ae,partOf:ae,rendering:ae,service:ae,services:ae},Sy={id:"https://iiif-parser/empty-manifest",type:"Manifest",annotations:ae,behavior:ae,homepage:ae,items:ae,label:null,metadata:ae,navDate:null,provider:ae,partOf:ae,accompanyingCanvas:null,placeholderCanvas:null,rendering:ae,requiredStatement:null,rights:null,seeAlso:ae,service:ae,services:ae,start:null,structures:ae,summary:null,thumbnail:ae,viewingDirection:"left-to-right"},wy={id:"https://iiif-parser/empty-canvas",type:"Range",label:null,behavior:ae,thumbnail:ae,accompanyingCanvas:null,placeholderCanvas:null,summary:null,requiredStatement:null,metadata:ae,rights:null,navDate:null,provider:ae,items:ae,annotations:ae,seeAlso:ae,homepage:ae,partOf:ae,rendering:ae,service:ae,start:null,supplementary:null,viewingDirection:"left-to-right"},Ay={id:"https://iiif-parser/empty-agent",type:"Agent",label:{},logo:ae,seeAlso:ae,homepage:ae},by={id:"https://iiif-parser/empty-service",type:"UnknownService"};function ld(e,t={}){if(Array.isArray(e))return ld(e[0]);if(typeof e=="string"){let[r,n]=e.split("#");return n?{type:"SpecificResource",source:{id:r,type:t.typeHint||"Unknown"},selector:{type:"FragmentSelector",value:n}}:{type:"SpecificResource",source:{id:r,type:t.typeMap&&t.typeMap[r]||t.typeHint||"Unknown"}}}if(e.type==="Choice"||e.type==="List"||e.type==="Composite"||e.type==="Independents")return ld(e.items[0]);if(e.type==="SpecificResource")return e.source.type==="Canvas"&&e.source.partOf&&typeof e.source.partOf=="string"&&(e.source.partOf=[{id:e.source.partOf,type:"Manifest"}]),e.selector?{type:"SpecificResource",source:e.source,selector:e.selector}:{type:"SpecificResource",source:e.source};if(e.id){e.type==="Canvas"&&e.partOf&&typeof e.partOf=="string"&&(e.partOf=[{id:e.partOf,type:"Manifest"}]);let[r,n]=e.id.split("#");return n?{type:"SpecificResource",source:{...e,id:r},selector:{type:"FragmentSelector",value:n}}:{type:"SpecificResource",source:{...e,id:r}}}return{type:"SpecificResource",source:e}}function Ey(){return{Collection:{},Manifest:{},Canvas:{},AnnotationPage:{},AnnotationCollection:{},Annotation:{},ContentResource:{},Range:{},Service:{},Selector:{},Agent:{}}}function Cy(e,t){if(typeof e=="string")return{id:e,type:t};if(!e.id)throw new Error(`Invalid resource does not have an ID (${JSON.stringify(e)}, ${t})`);return e}function DA(e,t){return(r,n)=>{let o=e[r]?e[r]:{};return(a,u)=>{let h=Cy(a,n||r);return h&&h.id&&r?(o[h.id]=o[h.id]?uu(o[h.id],h,{parent:u.parent,isTopLevel:t.id===h.id}):uu({id:h.id,type:h.type},h,{parent:u.parent,isTopLevel:t.id===h.id}),{id:h.id,type:r==="ContentResource"?r:h.type}):h}}}function lu(e,t,r){if(!t)return e;if(Array.isArray(e)){if(!Array.isArray(t))throw new Error("Cannot merge array with non-array");let n=[...e];for(let o of t)if(o["@id"]&&!o.id&&(o.id=o["@id"]),o["@type"]&&!o.type&&(o.type=o["@type"]),o!=null)if(Array.isArray(o))n.push(o);else if(typeof o=="object"&&o.id&&o.type){let a=n.findIndex(u=>u.id===o.id&&u.type===o.type);a>=0&&(n[a]=lu(n[a],o))}else e.indexOf(o)===-1&&n.push(o);return n}else if(typeof e=="object"){if(Array.isArray(t)||typeof t!="object")throw new Error("Cannot merge object with non-object");let n={...e},o=[],a=[],u=Object.keys(e).filter(g=>g!==at&&g!=="id"&&g!=="type"),h={},f={};for(let[g,p]of Object.entries(t)){if(g===at||g==="id"||g==="type")continue;let v=n[g];v===p?a.push(g):v===ae||!v?(o.push(g),n[g]=p):(v&&p&&(h[g]=v,f[g]=p),n[g]=lu(v,p),n[g]===h[g]&&(a.push(g),delete h[g]))}if(r&&(r.parent&&r.parent.id||r.isTopLevel)){let g=[],p={};if(r.parent?p[dr]=r.parent.id:r.isTopLevel&&(p[dr]=e.id),n[at]&&n[at].length){let v=!(n[at]||[]).find(b=>b["@explicit"]),x=o.length>0||a.length!==u.length;if(v&&x)for(let b of n[at]){let w={...b},A=Object.keys(h);if(w){w["@explicit"]=!0;for(let E of u)E!==at&&(w[E]=Ss);for(let E of A)w[E]=h[E]}g.push(w)}else g.push(...n[at]);if(x){let b=Object.keys(f);p["@explicit"]=!0;for(let w of o)p[w]=Ss;for(let w of a)p[w]=Ss;for(let w of b)p[w]=f[w]}}p.id=n.id,p.type=n.type,g.push(p),n[at]=g}return n}else if(e)return e;return t}function uu(e,t,r){if(typeof e=="string")return e;if(t.id!==e.id||t.type!==e.type){if(t.type==="ImageService3")return t;if(e.type==="ImageService3")return e;throw new Error(`Can only merge entities with identical identifiers and type! ${t.type}(${t.id}) => ${e.type}(${e.id})`)}return lu({...e},t,r)}function jA(e){return(t,r)=>n=>{let{id:o,type:a}=Cy(n,r||t);if(typeof o>"u")throw new Error("Found invalid entity without an ID.");return t==="ContentResource"||t==="Service"?e[o]=t:e[o]=a,n}}function UA(e){let t=Object.assign({},e);if(t["@id"]&&(t.id=t["@id"]),t["@type"]&&(t.type=t["@type"]),t.service){let r=[];t.service=Array.isArray(t.service)?t.service:[t.service];for(let n of t.service)r.push({id:n["@id"]||n.id,type:n["@type"]||n.type});t.service=r}return Object.assign({},by,t)}function BA(e){return t=>{e.Service=e.Service?e.Service:{};let r=t.id||t["@id"],n=UA(t);return n&&n.id&&(e.Service[n.id]?e.Service[r]=uu(e.Service[r],n):e.Service[r]=n),t}}function VA(e){let t=JSON.stringify(e),r=5381,n=t.length;for(;n;)r=r*33^t.charCodeAt(--n);let o=(r>>>0).toString(16);return o.length%2?"0"+o:o}function ad(e){return t=>typeof t=="string"?{id:t,type:e}:t.id?t.type?t:{type:e,...t}:{id:`vault://${VA(t)}`,type:e,...t}}function xs(e){return t=>({...e,...t})}function Co(e){return Array.isArray(e)?e:[e]}function WA(e){return e.body&&(e.body=Co(e.body)),e.seeAlso&&(e.seeAlso=Co(e.seeAlso)),e.audience&&(e.audience=Co(e.audience)),e.accessibility&&(e.accessibility=Co(e.accessibility)),e.motivation&&(e.motivation=Co(e.motivation)),e}function Py(e,{typeHint:t,partOfTypeHint:r}={}){if(typeof e=="string"&&(e={id:e,type:t||"unknown"}),Nr(e))return typeof e.source=="string"&&(e.source={id:e.source,type:t||"unknown"}),e.source.type==="Canvas"&&e.source.partOf&&typeof e.source.partOf=="string"&&(e.source.partOf=[{id:e.source.partOf,type:r||"Manifest"}]),e;let n;if((e.id||"").indexOf("#")!==-1){let[o,a]=(e.id||"").split("#");e.id=o,a&&(n={type:"FragmentSelector",value:a})}return{type:"SpecificResource",source:e,selector:n}}function HA(e){let t=Object.assign({},e);return e&&e.items&&(t.items=e.items.map(r=>typeof r=="string"||r.type==="Canvas"?Py(r):r)),t}function qA(e){let t=Object.assign({},e);return t.start?(t.start=Py(t.start,{typeHint:"Canvas"}),t):e}function QA(e){let t=Object.assign({},e);return t.target?(t.target=ld(t.target,{typeHint:"Canvas"}),t):e}function Ry(e){return e}function au(e){return typeof e.items>"u"&&(e[ws]=!0),e}function dd(e){let t=dy(e),r=Ey(),n={},o=DA(r,t),a=jA(n),u=new od({collection:[au,xs(xy),a("Collection"),o("Collection")],manifest:[au,xs(Sy),qA,a("Manifest"),o("Manifest")],canvas:[xs(yy),a("Canvas"),o("Canvas")],annotationPage:[au,ad("AnnotationPage"),xs(vy),a("AnnotationPage"),o("AnnotationPage")],annotation:[ad("Annotation"),WA,QA,a("Annotation"),o("Annotation")],contentResource:[ad("ContentResource"),a("ContentResource"),o("ContentResource")],range:[xs(wy),HA,a("Range","Canvas"),o("Range","Canvas")],agent:[xs(Ay),a("Agent"),o("Agent")],specificResource:[Ry],service:[BA(r)]}).traverseUnknown(t);return{entities:r,resource:u,mapping:n}}function Ty(e){let t={};for(let[r,n]of e){if(r===cd&&n!==Er)return n;n!==Er&&typeof n<"u"&&n!==null&&(t[r]=n)}return t}function fd(e,t,r){if(!t.type||!t.id)throw new Error("Unknown entity");if(!r[t.type])throw new Error(`Serializer not found for ${t.type}`);function n(o,a,u=0){let h=r[o.type];if(!h)return Er;if(u>20)throw new Error("Circular reference: "+o.id+" "+o.type);let[f,g]=hd(e,o.type?o:o.id,a)||(o.id&&o.type?o:null);if(!f)return Er;let p=h(f,e,{parent:a,isTopLevel:t.id===o.id,fullResource:g}),v=p.next();for(;!v.done;){let x=v.value,b=Er;if(x)if(Array.isArray(x)){let w=[];for(let A of x)w.push(n(A,o,u+1));b=w}else b=n(x,o,u+1);v=p.next(b)}return v.value===Er?Er:Ty(v.value)}return n(t)}function As(e,{allowSourceString:t=!0,allowString:r=!1,allowedStringType:n}={}){let o=a=>{if(t&&a&&a.source&&typeof a.source!="string"){let u=Object.keys(a.source);if(a.source.id&&a.source.type&&u.length===2)return{...a,source:a.source.id}}return a};if(e){if(e.source&&e.source.partOf)return o(e);let a=Object.keys(e);if(a.length===2&&e.type&&e.source||a.length===3&&e.type&&e.source&&a.indexOf("selector")!==-1&&!e.selector)return r&&(!n||n===e.source.type)?e.source.id:e.source.type==="ContentResource"?{type:"SpecificResource",source:e.source.id}:e.source;if(e.selector&&!Array.isArray(e.selector)&&typeof e.selector!="string"&&e.selector.type==="FragmentSelector"){let u=`${e.source.id}#${e.selector.value}`;return r?u:{id:u,type:e.source.type}}}return o(e)}function En(e){if(!e)return;let t=Object.keys(e);if(t.length!==0){if(t.length===1){let r=t[0];if(!r)return"";let n=(e[r]||[]).join("");return r==="@none"||r==="none"||r==="en"?n:{"@language":r,"@value":n}}return t.map(r=>({"@language":r,"@value":(e[r]||[]).join("")}))}}function Iy(e){return Array.isArray(e)?e.map(t=>Iy(t)):typeof e=="string"?e:e.type&&e.type==="Canvas"?e.id:e}function Yi(e,t=!1){if(e)return e.length>1&&!t?e:e[0]||void 0}function YA(e){if(e){if(typeof e=="string")return{"@id":e};if("@id"in e){let t={...e};return delete t["@type"],t}return{"@context":"http://iiif.io/api/image/2/context.json","@id":e.id,profile:`http://iiif.io/api/image/2/profiles/${e.profile}.json`}}}function wn(e,t){return[["@id",e.id],["@type",t],["format",e.format],["height",e.height],["width",e.width],["viewingDirection",e.viewingDirection!=="left-to-right"?e.viewingDirection:void 0],["license",e.license?e.license:void 0]]}function*An(e){let t=e.provider?yield e.provider[0]:void 0;return[["label",En(e.label)],["metadata",e.metadata&&e.metadata.length?e.metadata.map(r=>({label:En(r.label)||"",value:En(r.value)||""})):void 0],["description",En(e.summary)],["thumbnail",Yi(yield e.thumbnail)],["navDate",e.navDate],["logo",t?Yi(t.logo):void 0],["homepage",t?t.homepage:void 0],["attribution",e.requiredStatement?En(e.requiredStatement.value):void 0]]}function*Po(e){let t=e.start&&e.start.type&&e.start.type==="SpecificResource"?As(e.start):e.start;return[["seeAlso",Yi(yield e.seeAlso)],["service",Yi((e.service||[]).map(YA))],["rendering",Yi(yield e.rendering)],["startCanvas",t?t.id:void 0]]}function GA(e){return e.type==="SpecificResource"}function XA(e){return e&&e.type==="FragmentSelector"}function $A(e){if(e&&GA(e)){let t=e.id,r=e.selector?Array.isArray(e.selector)?e.selector[0]:e.selector:void 0;return XA(r)&&(t+="#"+r.value),t}return e?.id}var pd={Manifest:function*(e,t,{isTopLevel:r}){return[...r?[["@context","http://iiif.io/api/presentation/2/context.json"]]:[],...wn(e,"sc:Manifest"),...yield*An(e),...yield*Po(e),["sequences",[{"@id":`${e.id}/sequence0`,"@type":"sc:Sequence",canvases:yield e.items}]],["structures",yield e.structures]]},Canvas:function*(e){let t=(yield e.items)[0];return[...wn(e,"sc:Canvas"),...yield*An(e),...yield*Po(e),["images",t?[t.resources]:void 0],["annotations",e.annotations&&e.annotations.length?Yi(yield e.annotations):void 0]]},AnnotationPage:function*(e){return[...wn(e,"sc:AnnotationList"),...yield*An(e),["resources",e.items&&e.items.length?Yi(yield e.items):void 0]]},Annotation:function*(e){return[["@id",e.id],["@type","oa:Annotation"],["motivation","sc:painting"],["on",Iy(e.target)],["resource",Yi(yield e.body,!0)]]},ContentResource:function*(e){switch(e.type){case"Image":return[...wn(e,"dctypes:Image"),...yield*An(e),...yield*Po(e)];case"Text":case"Dataset":default:return[...wn(e,void 0),...yield*An(e)]}},AnnotationCollection:function*(e){return[["@id",e.id],["@type","sc:Layer"],["label",En(e.label)]]},Collection:function*(e){return[...wn(e,"sc:Collection"),...yield*An(e),...yield*Po(e),["members",yield*e.items]]},Range:function*(e){let t=[],r=[];if(e.items)for(let n of e.items){let o=n.type==="SpecificResource"?n.source:n;if(o){let a=yield o;t.push({"@id":$A(n),"@type":o.type,label:a?a.label:void 0,within:e.id}),o.type==="Canvas"&&r.push(o.id)}}return[...wn(e,"sc:Range"),...yield*An(e),...yield*Po(e),["canvases",r.length===t.length?r:void 0],["members",r.length!==t.length?t:void 0]]}};function bn(e){return[["id",e.id?.startsWith("vault://")?void 0:e.id],["type",e.type],["format",e.format],["profile",e.profile],["height",e.height||void 0],["width",e.width||void 0],["duration",e.duration||void 0],["viewingDirection",e.viewingDirection!=="left-to-right"?e.viewingDirection:void 0],["behavior",e.behavior&&e.behavior.length?e.behavior:void 0],["timeMode",e.timeMode],["motivation",Array.isArray(e.motivation)?e.motivation[0]:e.motivation],[at,Er]]}function pt(e){if(e===Er||!e||e.length===0)return;let t=e.filter(r=>r!==Er);if(t.length!==0)return t}function _y(e){if(e&&e.type&&e.type==="ImageService2"){let{id:t,type:r,profile:n,...o}=e,a=typeof n=="string"?n:Array.isArray(n)?n.find(u=>typeof u=="string"):"";return{"@id":t,"@type":r,profile:a?a.startsWith("http")?a:`http://iiif.io/api/image/2/${a}.json`:"http://iiif.io/api/image/2/level0.json",...o}}return e}function my(e){if(Array.isArray(e)||(e=e?[e]:[]),!(!e||e.length===0))return e.map(_y)}function*qi(e){return[["label",e.label],["metadata",pt(e.metadata)],["summary",e.summary],["requiredStatement",e.requiredStatement],["rights",Array.isArray(e.rights)?e.rights[0]||void 0:e.rights||void 0],["navDate",e.navDate],["language",e.language],["thumbnail",pt(yield e.thumbnail)],["placeholderCanvas",yield e.placeholderCanvas],["accompanyingCanvas",yield e.accompanyingCanvas],["provider",pt(yield e.provider)]]}function*Qi(e){return[["seeAlso",pt(yield e.seeAlso)],["service",pt(my(e.service))],["services",pt(my(e.services))],["rendering",pt(yield e.rendering)],["supplementary",pt(yield e.supplementary)],["homepage",pt(yield e.homepage)],["logo",pt(yield e.logo)],["partOf",pt(yield e.partOf)],["start",e.start?As(e.start):e.start]]}var md={Manifest:function*(e,t,{isTopLevel:r}){return r?[["@context",e["@context"]?e["@context"]:"http://iiif.io/api/presentation/3/context.json"],...bn(e),...yield*qi(e),...yield*Qi(e),["items",yield e.items],["structures",pt(yield e.structures)],["annotations",pt(yield e.annotations)],["navPlace",e.navPlace]]:[...bn(e),...yield*qi(e)]},Canvas:function*(e){return[...bn(e),...yield*qi(e),...yield*Qi(e),["items",yield e.items],["annotations",pt(yield e.annotations)],["navPlace",e.navPlace]]},Agent:function*(e){return[["id",e.id],["type","Agent"],["label",e.label],...yield*Qi(e)]},AnnotationPage:function*(e){let t=Object.entries(e).map(([n,o])=>[n,Array.isArray(o)?pt(o):o]).filter(([n,o])=>n!=="items"&&n!=="id"&&n!==at&&n!==dr&&n!==ws),r=yield e.items;return[["id",e.id?.startsWith("vault://")?void 0:e.id],...t,...yield*Qi(e),["items",r.length||e[ws]===!1?r:Er]]},Service:function*(e){return[[cd,_y(e)]]},Annotation:function*(e){let t=Object.entries(e).map(([n,o])=>n==="motivation"?[n,Array.isArray(o)?o[0]:o]:n==="target"?[n,As(o,{allowString:!0,allowSourceString:!0,allowedStringType:"Canvas"})]:[n,Array.isArray(o)?pt(o):o]).filter(([n])=>n!=="body"&&n!==at&&n!==ws),r;if(Array.isArray(e.body)){let n=[];for(let o of e.body)if(o&&Nr(o)){let a={...o};a.source=yield o.source,n.push(As(a,{allowSourceString:!0}))}else n.push(yield o);r=n}else e.body&&Nr(e.body)?(r={...e.body},r.source=yield e.body.source):r=yield e.body;return[...t,...yield*qi(e),...yield*Qi(e),["body",r.length===1?r[0]:r]]},ContentResource:function*(e){return ZA([...bn(e),...yield*qi(e),...yield*Qi(e),["annotations",pt(yield e.annotations)],["items",pt(yield e.items)]],e)},AnnotationCollection:function*(e){return[["id",e.id],["type","AnnotationCollection"],["label",e.label]]},Collection:function*(e,t,{isTopLevel:r}){return r?[["@context","http://iiif.io/api/presentation/3/context.json"],...bn(e),...yield*qi(e),...yield*Qi(e),["items",pt(yield e.items)],["navPlace",e.navPlace]]:[...bn(e),...yield*qi(e)]},Range:function*(e){let t=[];for(let r of e.items)r.type==="Range"?t.push(yield r):r&&r.type==="SpecificResource"?t.push(As(r)):t.push(r);return[...bn(e),...yield*qi(e),...yield*Qi(e),["items",t],["annotations",pt(yield e.annotations)],["navPlace",e.navPlace]]}};function ZA(e,t){let r=Object.keys(t),n=e.map(([o])=>o);for(let o of r)o===at||o===ws||n.indexOf(o)===-1&&typeof t[o]<"u"&&e.push([o,t[o]]);return e}var KA=(e,t)=>{let{entities:r,resource:n,mapping:o}=dd(t);if(n.id===void 0)return[Eo({id:e,message:"ID is not defined in resource."})];let a=[$l({entities:r}),Vh({mapping:o})];return n.id!==e&&(a.push(Bh({id:e,type:n.type})),a.push(Hh({requestId:e,actualId:n.id}))),a.push(qh({id:e})),a},Oy=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function JA(e,t){return!!(e===t||Oy(e)&&Oy(t))}function vd(e,t){if(!Array.isArray(e)||!Array.isArray(t))return e===t;if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!JA(e[r],t[r]))return!1;return!0}function gd(e,t,r){let n=e.iiif.requests[t],o=e.iiif.mapping[t];if(!o||!e.iiif.entities[o][n.resourceUri])return;let a=e.iiif.entities[o][n.resourceUri];if(a&&a[at]){let u=a[at].find(h=>r?h[dr]===r.id:h[dr]===a.id);return bs(a,u)}return a}function eb(e){return e&&typeof e.then=="function"}function yd(e,t,{waitTimeout:r=30}={}){return(n,o)=>{let a=e.getStore(),u=a.getState(),h=u.iiif.requests[n];if(h){if(h.loadingState===gs){let g=gd(u,n);if(g)return g}switch(h.loadingState){case ms:break;case bo:return(async()=>{let g,p=!1;try{let v=await Promise.race([new Promise((x,b)=>{p||(g=a.subscribe(()=>{let w=a.getState();if(w.iiif.requests[n].loadingState===ms){b();return}if(w.iiif.requests[n].loadingState===gs){let A=gd(w,n);A?x(A):b()}}))}),new Promise((x,b)=>setTimeout(()=>{p=!0,b()},r*60*1e3))]);if(g&&g(),v)return v}catch{g&&g()}})()}}e.dispatch(Wh({id:n}));let f=g=>{if(!g)return;!g.id&&!g["@id"]&&(g["@type"]&&(g["@id"]=n),g.id=n);let p=KA(n,g);return e.dispatch(ys({actions:p})),gd(a.getState(),n)};try{let g=t(n,o);return eb(g)?(async()=>{try{return f(await g)}catch(p){throw e.dispatch(Eo({id:n,message:p.toString()})),p}})():f(g)}catch(g){throw e.dispatch(Eo({id:n,message:g.toString()})),g}}}function tb(e){return{all:e=e||new Map,on:function(t,r){var n=e.get(t);n?n.push(r):e.set(t,[r])},off:function(t,r){var n=e.get(t);n&&(r?n.splice(n.indexOf(r)>>>0,1):e.set(t,[]))},emit:function(t,r){var n=e.get(t);n&&n.slice().map(function(o){o(r)}),(n=e.get("*"))&&n.slice().map(function(o){o(t,r)})}}}function Wt(e,t,r,n=!0){t[Es]=t[Es]||[],t[Es].push(e);let o=new Map;Object.defineProperty(t,e,{enumerable:n,get(){if(typeof t[Pn][e]>"u")return;let a=t[Pn][e];if(!a)return a;let u=r.get(t[Pn][e],{parent:this.id?{id:this.id,type:this.type}:void 0});return o.has(u)||(o.clear(),o.set(u,Rn(u,r))),o.get(u)},set(a){t[Pn][e]!==a&&(this[Cn]?r.modifyEntityField({id:this.id,type:this.type},e,Ly(a)):this[Pn][e]=a)}})}var Pn=Symbol.for("_refs_"),Cn=Symbol.for("_reactive_"),Es=Symbol.for("_defined_"),My=Symbol.for("_parent_");function rb(e,t=!1,r){let n={id:"",type:"unknown",[Es]:[],[Pn]:{},[My]:r||null,[Cn]:null,is(o){return typeof o=="string"?this.id===o:o.id?o.id===this.id:!1},reactive(){if(!this[Cn])return this[Cn]=this.subscribe(()=>this.refresh(),!0),()=>{this.unreactive()}},refresh(){if(this.id){let o=this.unwrap();for(let a of Object.keys(o||{}))this[Es].includes(a)?this[Pn][a]=o[a]:this[a]=o[a]}},unreactive(){this[Cn]&&(this[Cn](),this[Cn]=null)},unwrap(){if(!this.id)throw new Error("Invalid object");let o=this[My];return e.get(this.id,{parent:o?{id:o,type:"unknown"}:void 0})},toPresentation3(){return e.toPresentation3(this.unwrap())},toPresentation2(){return e.toPresentation2(this.unwrap())},valueOf(){return this.unwrap()},toJSON(){let o=this;return{...o,items:o.items,annotations:o.annotations,structures:o.structures,seeAlso:o.seeAlso,service:o.service,services:o.services,rendering:o.rendering,partOf:o.partOf,start:o.start,supplementary:o.supplementary,homepage:o.homepage,thumbnail:o.thumbnail,placeholderCanvas:o.placeholderCanvas,accompanyingCanvas:o.accompanyingCanvas,provider:o.provider}},subscribe(o,a=!0){return e.subscribe(()=>this.id?e.get(this.id):null,o,a)}};return Wt("items",n,e),Wt("annotations",n,e),Wt("structures",n,e),Wt("seeAlso",n,e),Wt("rendering",n,e),Wt("partOf",n,e),Wt("start",n,e,!1),Wt("supplementary",n,e),Wt("homepage",n,e),Wt("thumbnail",n,e),Wt("placeholderCanvas",n,e,!1),Wt("accompanyingCanvas",n,e,!1),Wt("provider",n,e),Wt("body",n,e),Wt("logo",n,e),n}function ib(e){return!!e[Es]}function Ly(e){return Array.isArray(e)?e.map(t=>Ly(t)):!e||!e.type?e:{id:e.id,type:e.type}}function Rn(e,t,r=!1,n){if(Array.isArray(e))return e.map(h=>Rn(h,t,r));if(!e||!e.type||!e.id)return e;let o=rb(t,r),a=Object.create(o),u=Object.assign(a,e);return r&&u.reactive(),u}function ky(e){switch(e){case"Image":case"Video":case"Sound":case"Dataset":case"Text":case"Composite":case"List":case"Independents":case"Audience":return"ContentResource";case"ImageService1":case"ImageService2":case"ImageService3":return"Service"}return e}var Cs=class{constructor(e,t){Jt(this,"options"),Jt(this,"store"),Jt(this,"emitter"),Jt(this,"isBatching",!1),Jt(this,"batchQueue",[]),Jt(this,"remoteFetcher"),Jt(this,"staticFetcher"),Jt(this,"defaultFetcher",r=>fetch(r).then(n=>n.json())),this.options=Object.assign({reducers:{},customFetcher:this.defaultFetcher,enableDevtools:!0},e||{}),this.store=t||jv({customReducers:this.options.reducers,defaultState:this.options.defaultState,enableDevtools:this.options.enableDevtools}),this.emitter=tb(),this.remoteFetcher=yd(this,this.options.customFetcher),this.staticFetcher=yd(this,(r,n)=>n)}batch(e){this.isBatching=!0;try{e(this),this.isBatching=!1,this.dispatch(ys({actions:this.batchQueue}))}catch(t){throw this.batchQueue=[],this.isBatching=!1,t}this.batchQueue=[]}async asyncBatch(e){this.isBatching=!0;try{await e(this),this.isBatching=!1,this.dispatch(ys({actions:this.batchQueue}))}catch(t){throw this.batchQueue=[],this.isBatching=!1,t}this.batchQueue=[]}modifyEntityField(e,t,r){this.dispatch(xn.modifyEntityField({id:e.id,type:e.type,key:t,value:r}))}dispatch(e){if(this.isBatching)this.batchQueue.push(e);else{if(e.type===vs){for(let n of e.payload.actions)this.emitter.emit(n.type,{action:n,state:this.store.getState()});this.store.dispatch(e);let r=this.getState();for(let n of e.payload.actions)this.emitter.emit(`after:${n.type}`,{action:n,state:r});return}this.emitter.emit(e.type,{action:e,state:this.store.getState()}),this.store.dispatch(e);let t=this.store.getState();this.emitter.emit(`after:${e.type}`,{action:e,state:t});return}}on(e,t){return this.emitter.on(e,t),()=>{this.emitter.off(e,t)}}serialize(e,t){return fd(this.getState().iiif,e,t)}toPresentation2(e){return this.serialize(e,pd)}toPresentation3(e){return this.serialize(e,md)}hydrate(e,t,r={}){return this.get(e,t,{...r,skipSelfReturn:!1})}get(e,t,r={}){typeof t!="string"&&(r=t||{},t=void 0);let{skipSelfReturn:n=!0}=r||{},o=r.parent?typeof r.parent=="string"?r.parent:r.parent.id:void 0;if(Array.isArray(e))return e.map(p=>this.get(p,r));let a=this.getState();if(Nr(e)&&!r.preserveSpecificResources&&(e=e.source),typeof e=="string"){let p=ky(t||a.iiif.mapping[e]);if(!p)return n?null:{id:e,type:"unknown"};e={id:e,type:p}}if(e&&e.partOf&&!o&&!r.skipPartOfCheck){let p=Array.isArray(e.partOf)?e.partOf[0]:e.partOf;p&&(typeof p=="string"&&(o=p),typeof p.id=="string"&&(o=p.id))}let u=ky(t||e?.type),h=e?.id,f=a.iiif.entities[u];if(!f){let p=a.iiif.requests[h];return p&&p.resourceUri!==h?this.get(p.resourceUri,r):n?null:e}let g=f[e.id];if(g&&g[at]){let p=g[at].find(v=>o?v[dr]===o:v[dr]===g.id);return bs(g,p)}return f[e.id]||(n?null:e)}select(e){return e(this.getState())}getStore(){return this.store}getState(){return this.store.getState()}deep(e,t){if(typeof e>"u")return this.get(t,{skipSelfReturn:!1});if(typeof e=="function")try{let n=e(this.get(t,{skipSelfReturn:!1})),o=a=>this.deep(a,n);return o.size=Array.isArray(n)?n.length:1,o}catch{let o=a=>this.deep(a,void 0);return o.size=0,o}let r=n=>this.deep(n,e);return r.size=Array.isArray(e)?e.length:1,r}loadManifest(e,t){let r=typeof e=="string"?e:e.id;return this.load(r,t)}loadCollection(e,t){let r=typeof e=="string"?e:e.id;return this.load(r,t)}load(e,t){let r=typeof e=="string"?e:e.id;return t?Promise.resolve(this.staticFetcher(r,t)):Promise.resolve(this.remoteFetcher(r))}loadSync(e,t){let r=typeof e=="string"?e:e.id;return this.staticFetcher(r,t)}loadManifestSync(e,t){let r=typeof e=="string"?e:e.id;return this.loadSync(r,t)}loadCollectionSync(e,t){let r=typeof e=="string"?e:e.id;return this.loadSync(r,t)}areInputsEqual(e,t){return vd(e,t)}subscribe(e,t,r){return typeof r>"u"&&(typeof t>"u"||t===!1||t===!0)&&(r=t,t=e,e=n=>n),this.store.subscribe(e,n=>t(n,this),{equalityFn:vd,fireImmediately:!r})}async ensureLoaded(e){let t=typeof e=="string"?e:e.id;this.requestStatus(t)||await this.load(t)}requestStatus(e){return this.select(t=>t.iiif.requests[e])}getResourceMeta(e,t){let r=this.getState().iiif.meta[e];if(r)return t?r[t]:r}getObject(e,t,r={}){let{reactive:n,...o}=r;return Rn(this.get(e,t,o),this,n)}async loadObject(e,t){return Rn(await this.load(e,t),this)}async loadManifestObject(e,t){return Rn(await this.loadManifest(e,t),this)}async loadCollectionObject(e,t){return Rn(await this.loadCollection(e,t),this)}wrapObject(e){return Rn(this.get(e,{skipSelfReturn:!1}),this)}isWrapped(e){return ib(e)}setMetaValue([e,t,r],n){this.dispatch(typeof n=="function"?Xh.setMetaValueDynamic({id:e,meta:t,key:r,updateValue:n}):Xh.setMetaValue({id:e,meta:t,key:r,value:n}))}};function zy(){return typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}function Ro(e){let t=zy();try{let n=t.IIIF_VAULT;if(n)return n}catch{}let r=new Cs(e);try{t.IIIF_VAULT=r}catch{}return r}var xd=T(G(),1),Gi=cu.default.createContext({vault:null,setVaultInstance:e=>{}});function Tn({vault:e,vaultOptions:t,useGlobal:r,resources:n,children:o}){let[a,u]=(0,cu.useState)(()=>e||(r?Ro(t):t?new Cs(t):new Cs));return(0,xd.jsx)(Gi.Provider,{value:{vault:a,setVaultInstance:u},children:(0,xd.jsx)(Vt,{value:n||{},children:o})})}var d0=T(q(),1),vu=T(q(),1);var Ny=T(q(),1);function In(e){let t=(0,Ny.useContext)(Gi);return e||(t&&t.vault?t.vault:Ro())}var Xi=T(q(),1);function To(e,{noCache:t=!1}={}){let r=typeof e=="string"?e:e.id,n=In(),[o,a]=(0,Xi.useState)(r),[u,h]=(0,Xi.useState)(void 0),f=(0,Xi.useMemo)(()=>n.get(r,{skipSelfReturn:!0})||void 0,[r,n]),[g,p]=(0,Xi.useState)(f);return(0,Xi.useEffect)(()=>{(async()=>{try{let v=f&&!t?f:await n.load(r),x=v?v.id||v["@id"]:null;v&&o!==x&&a(x),p(v)}catch(v){h(v)}})()},[r,t]),{isLoaded:!!g,id:o,requestId:r,error:u,resource:g,cached:!!(g&&g===f)}}function Sd(e,t){let{id:r,isLoaded:n,error:o,resource:a,requestId:u,cached:h}=To(e,t);return{id:r,isLoaded:n,error:o,manifest:a,requestId:u,cached:h}}var Fy=T(G(),1);function wd({manifest:e,children:t}){return(0,Fy.jsx)(Vt,{value:{manifest:e},children:t})}var Dy=T(G(),1);function wi({canvas:e,children:t}){return(0,Dy.jsx)(Vt,{value:{canvas:e},children:t})}var Uy=T(q(),1),By=T(q(),1);var jy=T(q(),1),be=()=>{let{vault:e}=(0,jy.useContext)(Gi);if(e===null)throw new Error("Vault not found. Ensure you have your provider set up correctly.");return e};var hu=T(q(),1);function ke(e,t=[]){let r=be(),[n,o]=(0,hu.useState)(()=>e(r.getState(),r));return(0,hu.useEffect)(()=>r.subscribe(a=>e(a,r),a=>{o(a)},!1),t),n}var _n=By.default.createContext([]);function Io(){let e=(0,Uy.useContext)(_n);return ke(t=>e.map(r=>t.iiif.entities.Canvas[r]).filter(Boolean),[e])}var Vy=T(q(),1);function bt(e={},t=[]){let{id:r,selector:n}=e,o=Ft(),a=be(),u=r||o.manifest,h=ke(f=>u?f.iiif.entities.Manifest[u]:void 0,[u]);return(0,Vy.useMemo)(()=>{if(h)return n?n(h):h},[h,n,...t])}var Wy=T(G(),1);function Ad({range:e,children:t}){return(0,Wy.jsx)(Vt,{value:{range:e},children:t})}function Hy(e,t){for(let r of t.items){if(r.type==="Canvas")return r;if(r.type==="SpecificResource")return r.source;if(r.type==="Range"){let n=Hy(e,e.get(r));if(n)return n}}return null}function du(e,t){let r=[];for(let n of t.items)if(n.type==="SpecificResource"&&n.source?.type==="Canvas"&&(n.source.id.indexOf("#")!==-1?r.push({id:n.source.id.split("#")[0],type:"Canvas"}):r.push(n.source)),n.type==="Range"&&r.push(...du(e,e.get(n))),n.type==="SpecificResource"){let o=typeof n.source=="string"?n.source:n.source.id;r.push({id:o,type:"Canvas"})}return r}function nb(e,t,r){for(let n of t.structures){let o=bd(e,e.get(n),r);if(o)return o}return null}function bd(e,t,r){for(let n of t.items){let o=n?.source?.id?.split("#")[0];if(n.type==="SpecificResource"&&n.source===r||n.type==="SpecificResource"&&n.source?.type==="Canvas"&&r===o)return t;if(n.type==="Range"){let a=bd(e,e.get(n),r);if(a)return a}}return null}function sb(e,t,r,n=!1){let o=t.behavior,a=r?e.get(r):null;if(!a)return[];let u=a.behavior,h=n?!1:o.includes("paged"),f=h?!1:o.includes("continuous"),g=h||f?!1:o.includes("individuals"),p=u.includes("facing-pages"),v=u.includes("non-paged");if(p||v||g||n)return[{id:a.id,type:"Canvas"}];let[x,b]=fu(e,t);if(f)return x;let w=x.findIndex(A=>A.id===r);if(w===-1)return[];for(let A of b)if(A.includes(w))return A.map(E=>x[E]);return[{id:a.id,type:"Canvas"}]}function fu(e,t,{disablePaging:r,skipNonPaged:n}={}){let o=t.behavior,a=o.includes("paged"),u=a?!1:o.includes("continuous"),h=a||u?!1:o.includes("individuals"),f=t.type==="Manifest"?t.items:du(e,t);if(u)return[f,[f.map((w,A)=>A)]];if(h||!a||r)return[f,f.map((w,A)=>[A])];let g=[],p=[],v=()=>{p.length&&(g.push([...p]),p=[])},x=0,b=!1;for(let w=0;w<f.length;w++){let A=e.get(f[w]);if(A.behavior.includes("non-paged")){w===x&&x++,n||(v(),g.push([w]),v());continue}if(w===x||A.behavior.includes("facing-pages")){p.length&&(b=!0),v(),g.push([w]),v();continue}if(p.push(w),b){v(),b=!1;continue}p.length>1&&v()}return p.length&&v(),[f,g]}var Fr=T(q(),1);var qy=T(q(),1);function _o(e={},t=[]){let{id:r,selector:n}=e,o=Ft(),a=r||o.range,u=ke(h=>a?h.iiif.entities.Range[a]:void 0,[a]);return(0,qy.useMemo)(()=>{if(u)return n?n(u):u},[u,n,...t])}function Ed({startCanvas:e,disablePaging:t}){let r=be(),n=bt(),o=_o(),[a,u]=(0,Fr.useState)(void 0),h=o||n;if(!h)throw new Error("Nothing selected");let[f,g]=(0,Fr.useMemo)(()=>fu(r,h,{disablePaging:t}),[r,h,t]),p=(0,Fr.useRef)(g);if(p.current!==g){let E=p.current[a][0],P=g.findIndex(I=>I.includes(E));p.current=g,u(P)}let v=(0,Fr.useCallback)(A=>{let E=g.findIndex(P=>P.includes(A));u(E===-1?0:E)},[f,g]),x=(0,Fr.useCallback)(A=>{let E=f.findIndex(P=>P.id===A);E!==-1?v(E):u(0)},[f,g]),b=(0,Fr.useCallback)(()=>{u(A=>A>=g.length-1?A:A+1)},[g]),w=(0,Fr.useCallback)(()=>{u(A=>A<=0?0:A-1)},[g]);return typeof a>"u"&&(e?x(e):u(0)),{visibleItems:g[a]?.map(A=>f[A].id)||[],cursor:a,items:f,sequence:g,hasPrevious:a>0,hasNext:a<g.length-1,setSequenceIndex:u,setCanvasIndex:v,setCanvasId:x,next:b,previous:w}}var mt=T(q(),1);var Ts=T(q(),1);var Yy={},Qy=e=>{let t,r=new Set,n=(p,v)=>{let x=typeof p=="function"?p(t):p;if(!Object.is(x,t)){let b=t;t=v??(typeof x!="object"||x===null)?x:Object.assign({},t,x),r.forEach(w=>w(t,b))}},o=()=>t,f={setState:n,getState:o,getInitialState:()=>g,subscribe:p=>(r.add(p),()=>r.delete(p)),destroy:()=>{(Yy.env?Yy.env.MODE:void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),r.clear()}},g=t=e(n,o,f);return f},Oo=e=>e?Qy(e):Qy;function ob(e){let t=e.service||e.services||[];for(let r of t)if(r.type==="AuthProbeService2")return!0;return!1}function Dr(e,t,r){let n=t.findIndex(u=>u.service.id===e);if(n===-1)return t;let o=[...t],a=r(o[n]);return a===o[n]?t:(o[n]=a,o)}var Cd=()=>Oo((e,t)=>({currentAuth:-1,authItems:[],login:()=>{let r=t().authItems[t().currentAuth];if(!r||r.isPending||r.isLoggedIn)return;if(r.type!=="active")throw new Error("Cannot login to non-active service");let n=r.service.service.find(o=>o.type==="AuthAccessTokenService2");if(!n)throw new Error("Token service not found");e(()=>({authItems:Dr(r.id,t().authItems,o=>({...o,isPending:!0}))})),Ps(r.service).then(()=>{$i(n).then(o=>{let a=o.expiresIn,u=Date.now()+a*1e3;e(()=>({authItems:Dr(r.id,t().authItems,h=>({...h,isLoggedIn:!0,isPending:!1,session:{token:o.accessToken,expires:u}}))}))}).catch(o=>{e(()=>({authItems:Dr(r.id,t().authItems,a=>({...a,isLoggedIn:!1,isPending:!1,error:o.message}))}))})})},logout:()=>{let r=t().authItems[t().currentAuth];if(!r||r.isPending||!r.isLoggedIn)return;if(r.type!=="active")throw new Error("Cannot logout of non-active service");let n=r.service.service.find(u=>u.type==="AuthLogoutService2");if(!n)return;let o=`${n.id}?origin=${Gy()}`,a=window.open(o);e(()=>({authItems:Dr(r.id,t().authItems,u=>({...u,isLoggedIn:!1,session:null,isPending:!1}))}))},nextAuth:()=>{let r=t().authItems.length,n=t().currentAuth+1;n>=r||e(()=>({currentAuth:n}))},previousAuth:()=>{let r=t().currentAuth-1;r<0||e(()=>({currentAuth:r}))},setAuth:r=>{r!==-1&&(r<0||r>=t().authItems.length)||e(()=>({currentAuth:r}))},addService:(r,n)=>{if(!r.service)return;let o=r.service.find(h=>h.type==="AuthAccessTokenService2"),a=r;if(t().authItems.find(h=>h.service.id===r.id)){e(()=>({authItems:Dr(r.id,t().authItems,h=>({...h,instances:h.instances+1}))}));return}if(e(()=>({currentAuth:a.profile==="active"?0:t().currentAuth,authItems:[{id:r.id,type:r.profile,service:r,probeId:n,canAuthenticate:!0,instances:1,isPending:!1,isLoggedIn:!1,session:null},...t().authItems]})),r.profile==="external"){if(!o)throw new Error("Token service not found");$i(o).then(h=>{e(()=>({authItems:Dr(r.id,t().authItems,f=>({...f,isLoggedIn:!0,isPending:!1,session:{token:h.accessToken,expires:h.expiresIn}}))}))}).catch(h=>{e(()=>({authItems:Dr(r.id,t().authItems,f=>({...f,isLoggedIn:!1,isPending:!1,canAuthenticate:!1,error:h.message}))}))})}if(r.profile==="kiosk"){if(!o)throw new Error("Token service not found");e(()=>({authItems:Dr(r.id,t().authItems,h=>({...h,isPending:!0}))})),Ps(a).then(()=>{$i(o).then(h=>{e(()=>({authItems:Dr(r.id,t().authItems,f=>({...f,isLoggedIn:!0,isPending:!1,session:{token:h.accessToken,expires:h.expiresIn}}))}))}).catch(h=>{e(()=>({authItems:Dr(r.id,t().authItems,f=>({...f,isLoggedIn:!1,isPending:!1,error:h.message}))}))})})}r.profile},removeService:(r,n)=>{let o=t().currentAuth===t().authItems.findIndex(u=>u.service.id===r.id),a=t().currentAuth;if(o){let u=t().authItems.find(f=>f.service.id===r.id);u&&u.instances>1||(a=t().authItems.findIndex(g=>g.service.id!==r.id&&g.instances>0))}e(()=>({authItems:Dr(r.id,t().authItems,u=>({...u,instances:u.instances-1})),currentAuth:a}))}})),Pd=(e,t)=>Oo((r,n)=>({service:e,status:e?"unknown":"success",shouldRedirect:!1,redirectResource:null,shouldSubstitute:!1,substituteResource:null,error:null,errorHeading:null,errorNote:null,shouldDisplayResource:!1,token:t||null,async probe(){if(!n().service)return;let o=n().service?.id;if(!o){r({status:"error",error:"Service ID not found",errorHeading:{en:["Service ID not found"]}});return}r({status:"probing"});let a=n().token;try{let u=await fetch(o,{headers:a?{Authorization:`Bearer ${n().token}`,Accept:"application/json"}:{Accept:"application/json"}}).then(h=>h.json());if(u.status===200)r({status:"success",shouldDisplayResource:!0,error:null,errorHeading:null,errorNote:null,shouldSubstitute:!1,shouldRedirect:!1});else if(u.status<400&&u.status>=300){if(!u.location)throw new Error("Redirect location not found");r({status:"error",shouldDisplayResource:!1,shouldRedirect:!0,redirectResource:u.location||null})}else if(u.status===401)r({status:"error",shouldDisplayResource:!1,shouldRedirect:!1,shouldSubstitute:!!u.substitute,substituteResource:u.substitute||null,error:"Unauthorized",errorHeading:u.heading||{en:["Unauthorized"]},errorNote:u.note||null});else throw new Error("Unknown error")}catch(u){r({status:"error",error:u.message,errorHeading:{en:["Unknown error"]}})}},setToken(o){r({token:o})}}));function Rd(e){let t=e.service||e.services||[],r={hasAuth:!1,services:{}};for(let n of t)if(n.type==="AuthProbeService2"){r.services.probe=n,r.hasAuth=!0;let o=n.service.filter(a=>a.type==="AuthAccessService2");o[0]&&(r.services.access=o[0])}return r}async function $i(e,{strict:t=!0}={}){return new Promise((r,n)=>{let o=Math.random().toString(36).substring(7),a=`${e.id}?messageId=${o}&origin=${window.location.origin}`,u=g=>{let p=g.data;if(p.messageId===o){if(t&&p.type!=="AuthAccessToken2"){h(),n("Invalid response, expected type=AuthAccessToken2");return}if(!p.accessToken){h(),n("Invalid response, expected accessToken");return}h(),r(p)}},h=()=>window.removeEventListener("message",u),f=document.createElement("iframe");f.src=a,f.style.display="none",document.body.appendChild(f),window.addEventListener("message",u)})}function Gy(e){let t=window.location;if(e){let r=document.createElement("a");return r.href=e,r.protocol+"//"+r.hostname+(r.port?":"+r.port:"")}return t.protocol+"//"+t.hostname+(t.port?":"+t.port:"")}async function Ps(e){let t=`${e.id}?origin=${Gy()}`,r=window.open(t);if(!r)throw new Error("Failed to open window");return new Promise((n,o)=>{let a=setInterval(()=>{r.closed&&(clearInterval(a),n())},500)})}var s0=T(q(),1),o0=T(r0(),1),n0={},{useDebugValue:Eb}=s0.default,{useSyncExternalStoreWithSelector:Cb}=o0.default,i0=!1,Pb=e=>e;function Zi(e,t=Pb,r){(n0.env?n0.env.MODE:void 0)!=="production"&&r&&!i0&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),i0=!0);let n=Cb(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,r);return Eb(n),n}function a0(e){let t=(0,Ts.useMemo)(()=>Rd(e),[e]),r=Id(t.services.access?.id),n=(0,Ts.useMemo)(()=>Pd(t.services.probe,r),[t.services.probe]),o=Zi(n);return(0,Ts.useEffect)(()=>{o.status==="unknown"&&!r&&o.probe()},[t.services.probe,o.status]),(0,Ts.useEffect)(()=>{r&&(o.setToken(r),o.probe())},[r]),[e,o,t.hasAuth]}var Mn=T(G(),1),kn=(0,mt.createContext)(null),Ln=(0,mt.createContext)(null);Ln.displayName="CurrentAuth";var mu=(0,mt.createContext)(null);mu.displayName="AuthActions";function On(e,t,r){let n=t.authItems.findIndex(u=>u.service.id===e);if(n===-1)return t;let o=[...t.authItems],a=r(o[n]);return a===o[n]?t:(o[n]=a,{...t,authItems:o})}function Rb(e,t){switch(t.type){case"login.start":return On(t.payload.id,e,r=>({...r,isPending:!0}));case"login.success":return On(t.payload.id,e,r=>({...r,isLoggedIn:!0,isPending:!1,session:{token:t.payload.token,expires:t.payload.expires}}));case"login.error":return On(t.payload.id,e,r=>({...r,isLoggedIn:!1,isPending:!1,canAuthenticate:!1,error:t.payload.error}));case"session.expire":return On(t.payload.id,e,r=>({...r,isPending:!1,isLoggedIn:!1,session:null}));case"logout":return On(t.payload.id,e,r=>({...r,isLoggedIn:!1,session:null,isPending:!1}));case"service.add":return e.authItems.find(n=>n.service.id===t.payload.service.id)?On(t.payload.service.id,e,n=>({...n,instances:n.instances+1})):{...e,currentAuth:t.payload.service.profile==="active"?0:e.currentAuth,authItems:[{id:t.payload.service.id,type:t.payload.service.profile,service:t.payload.service,probeId:t.payload.probeId,canAuthenticate:!0,instances:1,isPending:!1,isLoggedIn:!1,session:null},...e.authItems]};case"service.remove":{let r=e.currentAuth===e.authItems.findIndex(o=>o.service.id===t.payload.id),n=e.currentAuth;if(r){let o=e.authItems.find(u=>u.service.id===t.payload.id);o&&o.instances>1||(n=e.authItems.findIndex(h=>h.service.id!==t.payload.id&&h.instances>0))}return{...On(t.payload.id,e,o=>({...o,instances:o.instances-1})),currentAuth:n}}case"list.next":{let r=e.authItems.length,n=e.currentAuth+1;return n>=r?e:{...e,currentAuth:n}}case"list.previous":{let r=e.currentAuth-1;return r<0?e:{...e,currentAuth:r}}case"list.set":return t.payload!==-1&&(t.payload<0||t.payload>=e.authItems.length)?e:{...e,currentAuth:t.payload};default:return e}}function Od({children:e}){let t=(0,mt.useMemo)(()=>Cd(),[]);return(0,Mn.jsx)(kn.Provider,{value:t,children:e})}function Tb({children:e}){let[t,r]=(0,mt.useReducer)(Rb,{currentAuth:-1,authItems:[]}),n=(x,b)=>{if(!x.service)return;let w=x.service.find(E=>E.type==="AuthAccessTokenService2"),A=x;if(r({type:"service.add",payload:{service:x,probeId:b}}),x.profile==="external"){if(!w)throw new Error("Token service not found");$i(w).then(E=>{r({type:"login.success",payload:{id:x.id,token:E.accessToken,expires:E.expiresIn}})}).catch(E=>{r({type:"login.error",payload:{id:x.id,error:E.message}})})}if(x.profile==="kiosk"){if(!w)throw new Error("Token service not found");r({type:"login.start",payload:{id:x.id}}),Ps(A).then(()=>{$i(w).then(E=>{r({type:"login.success",payload:{id:x.id,token:E.accessToken,expires:E.expiresIn}})}).catch(E=>{r({type:"login.error",payload:{id:x.id,error:E.message}})})}).catch(E=>{r({type:"login.error",payload:{id:x.id,error:E.message}})})}x.profile},o=x=>{r({type:"service.remove",payload:x})},a=()=>{let x=t.authItems[t.currentAuth];if(!x||x.isPending||x.isLoggedIn)return;if(x.type!=="active")throw new Error("Cannot login to non-active service");let b=x.service.service.find(w=>w.type==="AuthAccessTokenService2");if(!b)throw new Error("Token service not found");r({type:"login.start",payload:{id:x.id}}),Ps(x.service).then(()=>{$i(b).then(w=>{let A=w.expiresIn,E=Date.now()+A*1e3;r({type:"login.success",payload:{id:x.id,token:w.accessToken,expires:E}})}).catch(w=>{r({type:"login.error",payload:{id:x.id,error:w.message}})})})},u=()=>{let x=t.authItems[t.currentAuth];if(!x||x.isPending||!x.isLoggedIn)return;if(x.type!=="active")throw new Error("Cannot logout of non-active service");let b=x.service.service.find(E=>E.type==="AuthLogoutService2");if(!b)return;let w=`${b.id}?origin=${window.location.origin}`,A=window.open(w);r({type:"logout",payload:{id:x.id}})},h=()=>{},f=()=>{},g=x=>{},p=(0,mt.useMemo)(()=>({addService:n,removeService:o}),[]),v=(0,mt.useMemo)(()=>({...t,login:a,logout:u,nextAuth:h,previousAuth:f,setAuth:g}),[t]);return(0,Mn.jsx)(Ln.Provider,{value:v,children:(0,Mn.jsx)(mu.Provider,{value:p,children:e})})}function Md(){return!!(0,mt.useContext)(kn)}function Is(){let e=(0,mt.useContext)(kn);if(!e)throw new Error("useAuthActions must be used within a AuthProvider");return e}function l0(){let e=Is();return Zi(e,r=>({login:r.login,logout:r.logout,nextAuth:r.nextAuth,previousAuth:r.previousAuth,setAuth:r.setAuth,addService:r.addService,removeService:r.removeService}))}function Ib(){let e=Is();return Zi(e,t=>t)}function u0(e){let t=Is();return Zi(t,n=>n.authItems.find(o=>o.service.id===e))}function Id(e){let t=Is();return Zi(t,n=>n.authItems.find(o=>o.id===e)?.session?.token)}function _b(e){let t=Is();return Zi(t,n=>{let o=n.authItems.find(a=>a.service.id===e);return!o||!o.isLoggedIn||!o.session?null:o.session?.token||null})}function Ob(){let e=(0,mt.useContext)(Ln);if(!e)throw new Error("useCurrentAuth must be used within a AuthProvider");return e}function Mb(e){let t=(0,mt.useContext)(Ln);return t&&t.authItems.find(r=>r.service.id===e)||null}function kb(e){let t=(0,mt.useContext)(Ln);return!t||!e?null:t.authItems.find(r=>r.id===e)?.session?.token||null}function Lb(e){let t=(0,mt.useContext)(Ln);if(!e||!t)return null;let r=t.authItems.find(n=>n.service.id===e);return!r||!r.isLoggedIn||!r.session?null:r.session?.token||null}function zb(){return(0,mt.useContext)(mu)}function Nb(e){let t=l0(),r=u0(e.service.id);return(0,mt.useEffect)(()=>(t?.addService(e.service,e.probeId),()=>{t?.removeService(e.service,e.probeId)}),[e.service]),r?(r.error||!r.isLoggedIn,e.children):null}function _d(){return null}function kd(e){let[t,r,n]=a0(e.resource),o=e.fallbackComponent||_d,a=e.loadingComponent||_d,u=e.errorComponent||_d,h=r.service,f=null;if(!n||!h)return e.children(t);let g=h.service.filter(p=>p.type==="AuthAccessService2");r.status==="error"&&(f=(0,Mn.jsx)(u,{resource:e.resource,error:r.error||"",heading:r.errorHeading,note:r.errorNote,extra:e.extra})),(r.status==="unknown"||r.status==="probing")&&(f=(0,Mn.jsx)(a,{})),r.status==="success"&&(f=e.children(t));for(let p of g)f=(0,Mn.jsx)(Nb,{service:p,probeId:h.id,children:f},p.id);return f}var Mo=T(q(),1);var Fb=e=>e.id||e["@id"];function Db(e){return(Array.isArray(e.service)?e.service:[e.service]).find(r=>r.profile==="http://iiif.io/api/search/0/autocomplete"||r.profile==="http://iiif.io/api/search/1/autocomplete"||r.profile==="AutoCompleteService1")}var c0=e=>{let t;typeof e=="string"?t={"@context":"http://iiif.io/api/search/1/context.json",profile:"http://iiif.io/api/search/1/search","@id":e,id:e,service:[]}:t=e;let r=t?Fb(t):void 0,n=null;return Oo((o,a)=>({service:t,resources:[],lastQuery:{},loading:!1,error:!1,highlight:null,hasSearch:!!t,hasAutocomplete:t?!!Db(t):!1,errorMessage:"",search(u,h={}){if(!r)throw new Error("No search service found.");n&&!n.signal.aborted&&n.abort(),n=new AbortController;let f=new URLSearchParams;u.q&&f.set("q",u.q),u.motivation&&f.set("motivation",u.motivation),u.date&&f.set("date",u.date),u.user&&f.set("user",u.user),o({loading:!0}),fetch(`${r}?${f.toString()}`,{signal:n.signal,headers:{"Content-Type":"application/json",Accept:"application/json",...h.headers||{}}}).then(async g=>{if(!n?.signal.aborted)if(g.ok){let p=await g.json();o({resources:p.resources,error:!1,errorMessage:""})}else o({resources:[],error:!0,errorMessage:g.statusText})})},clearSearch(){o({resources:[],error:!1,errorMessage:""})},highlightResult(u){let h=a().resources.find(f=>f["@id"]===u);o({highlight:h})},nextResult(){let u=a().resources,h=a().highlight;if(!h){o({highlight:u[0]||null});return}let f=u.findIndex(g=>g["@id"]===h["@id"]);if(f===-1){o({highlight:u[0]||null});return}o({highlight:u[f+1]||u[0]||null})},previousResult(){let u=a().resources,h=a().highlight;if(!h){o({highlight:u[u.length-1]||null});return}let f=u.findIndex(g=>g["@id"]===h["@id"]);if(f===-1){o({highlight:u[u.length-1]||null});return}if(f===0){o({highlight:u[u.length-1]||null});return}o({highlight:u[f-1]||u[u.length-1]||null})}}))};function Ld(){let e=bt();return e?e.service.find(t=>t.profile==="SearchService1"||t.profile==="http://iiif.io/api/search/1/search"):void 0}var gu=T(G(),1),_s=(0,Mo.createContext)(null);_s.displayName="Search";function h0(e){let t=Ld();return e.store?(0,gu.jsx)(_s.Provider,{value:e.store,children:e.children}):(0,gu.jsx)(jb,{service:t,children:e.children})}function jb({service:e,children:t}){let r=(0,Mo.useMemo)(()=>c0(e),[e]);return(0,gu.jsx)(_s.Provider,{value:r,children:t})}var er=T(G(),1),ko=()=>{},Os=(0,vu.createContext)({setCurrentCanvasId:ko,setCurrentCanvasIndex:ko,nextCanvas:ko,previousCanvas:ko,items:[],sequence:[],setSequenceIndex:ko,currentSequenceIndex:0,hasNext:!1,hasPrevious:!1});function f0(e){let t=bt(),{cursor:r,visibleItems:n,next:o,sequence:a,items:u,setCanvasIndex:h,setCanvasId:f,previous:g,setSequenceIndex:p,hasNext:v,hasPrevious:x}=Ed({startCanvas:e.startCanvas,disablePaging:e.pagingEnabled===!1}),b=(0,vu.useMemo)(()=>({sequence:a,items:u,setCurrentCanvasId:f,nextCanvas:o,previousCanvas:g,totalCanvases:u.length,setCurrentCanvasIndex:h,setSequenceIndex:p,currentSequenceIndex:r,hasNext:v,hasPrevious:x}),[a,u,f,o,g,u,h,p,r]);return t?n.length===0?null:(0,er.jsx)(Os.Provider,{value:b,children:(0,er.jsx)(_n.Provider,{value:n,children:(0,er.jsx)(wi,{canvas:n[0],children:e.children})})}):(console.warn("The manifest passed to the provider is not a valid IIIF manifest."),(0,er.jsx)("div",{children:"Sorry, something went wrong."}))}function zd(e){let t=In(e.vault),r=Sd(e.manifest);if(!r)return console.warn("The manifest passed to the provider is not a valid IIIF manifest."),(0,er.jsx)("div",{children:"Sorry, something went wrong."});if(r.error)return(0,er.jsx)("div",{children:r.error.toString()});if(!r.isLoaded)return(0,er.jsx)("div",{children:"Loading..."});let n=(0,er.jsx)(f0,{...e,children:e.children});return(0,er.jsx)(Tn,{vault:t,children:(0,er.jsx)(wd,{manifest:r.id,children:(0,er.jsx)(Od,{children:(0,er.jsx)(h0,{children:e.rangeId?(0,er.jsx)(Ad,{range:e.rangeId,children:n}):n})})})})}function Lo(){return(0,d0.useContext)(Os)}var Ms=T(G(),1);function Nd(){return{VaultContext:(0,zn.useContext)(Gi),ResourceContext:(0,zn.useContext)(So),SimpleViewerReactContext:(0,zn.useContext)(Os),VisibleCanvasReactContext:(0,zn.useContext)(_n),AuthRContext:(0,zn.useContext)(kn),SearchReactContext:(0,zn.useContext)(_s)}}function Fd(e){return(0,Ms.jsx)(Tn,{vault:e.bridge.VaultContext.vault||void 0,resources:e.bridge.ResourceContext,children:(0,Ms.jsx)(_n.Provider,{value:e.bridge.VisibleCanvasReactContext,children:(0,Ms.jsx)(Os.Provider,{value:e.bridge.SimpleViewerReactContext,children:(0,Ms.jsx)(kn.Provider,{value:e.bridge.AuthRContext,children:(0,Ms.jsx)(_s.Provider,{value:e.bridge.SearchReactContext,children:e.children})})})})})}var ks=T(q(),1);var Ai=T(q(),1);var p0=T(q(),1);function Dd(){let t=be().getStore();return(0,p0.useMemo)(()=>r=>t.dispatch(r),[t])}function m0(e){return typeof e!="string"&&e&&e.bindToVault}function jd(){let e=be(),t=(0,Ai.useRef)([]),r=Dd(),n=(0,Ai.useMemo)(()=>`vault://annotation-page/${new Date().getTime()}/${Math.round(Math.random()*1e9).toString(16)}`,[]);(0,Ai.useLayoutEffect)(()=>{let h={id:n,type:"AnnotationPage",behavior:[],label:null,thumbnail:[],summary:null,requiredStatement:null,metadata:[],rights:null,provider:[],items:[],seeAlso:[],homepage:[],rendering:[],service:[]};r(xn.importEntities({entities:{AnnotationPage:{[h.id]:h}}}))},[n]);let o=ke(h=>n&&h.iiif.entities.AnnotationPage[n]||null,[n]),a=(0,Ai.useCallback)((h,f)=>{if(n){if(m0(h)){let v=h;v.__vault||v.bindToVault(e),h=typeof v.source=="string"?v.source:v.source.id,t.current[h]=v}else typeof h!="string"&&(h=h.id);let g=e.get({id:n,type:"AnnotationPage"}),p=e.get({id:h,type:"Annotation"});g&&p&&(g.items.find(v=>v.id===p.id)||r(xn.addReference({id:n,type:"AnnotationPage",key:"items",reference:{id:h,type:"Annotation"},index:f})))}},[n]),u=(0,Ai.useCallback)(h=>{n&&(m0(h)?h=typeof h.source=="string"?h.source:h.source.id:typeof h!="string"&&(h=h.id),t.current[h]&&t.current[h].beforeRemove(),e.get({id:n,type:"AnnotationPage"})&&r(xn.removeReference({id:n,type:"AnnotationPage",key:"items",reference:{id:h,type:"Annotation"}})))},[n]);return[o,{addAnnotation:a,removeAnnotation:u}]}var v0=T(G(),1),g0=(0,ks.createContext)(null);function Ud(){let e=(0,ks.useContext)(g0);return[e.fullPage,{addAnnotation:e.addAnnotation,removeAnnotation:e.removeAnnotation}]}function Bd({children:e}){let[t,{addAnnotation:r,removeAnnotation:n}]=jd();return(0,v0.jsx)(g0.Provider,{value:(0,ks.useMemo)(()=>({fullPage:t,addAnnotation:r,removeAnnotation:n}),[t]),children:e})}var Ls=T(G(),1);function y0({width:e,style:t,height:r,error:n,resetErrorBoundary:o}){return(0,Ls.jsxs)("div",{style:{width:e,height:r,minHeight:500,...t||{},background:"#f9f9f9"},children:[(0,Ls.jsx)("h3",{children:"Error occurred"}),(0,Ls.jsx)("p",{children:n.message}),(0,Ls.jsx)("button",{onClick:o,children:"Reset"})]})}var yu=T(q(),1),zs=(0,yu.createContext)(null);function Vd(){return(0,yu.useContext)(zs)}var Nn=T(q(),1),Wd=(0,Nn.createContext)(()=>{}),Hd=(0,Nn.createContext)(()=>{});function jr(e,t,r,n,o=[]){let a=(0,Nn.useContext)(e==="portal"?Hd:Wd);(0,Nn.useEffect)(()=>(e!=="none"&&a(t,r,n),()=>{a(t,null)}),[t,e,a,...o])}var Ns=T(q(),1);var x0=T(q(),1);function nt(e={},t=[]){let{id:r,selector:n}=e,o=Ft(),a=r||o.canvas,u=ke(h=>a?h.iiif.entities.Canvas[a]:void 0,[a]);return(0,x0.useMemo)(()=>{if(u)return n?n(u):u},[u,n,...t])}var qd=(0,Ns.createContext)(()=>{});function S0(e){let t=nt(),r=(0,Ns.useContext)(qd);(0,Ns.useEffect)(()=>t&&t.id?(r(t.id,e),()=>r(t.id,-1)):()=>{},[t,e])}var gt=T(G(),1);function w0({children:e,errorFallback:t,outerContainerProps:r={},worldScale:n,...o}){let[a,u]=(0,Ht.useState)(),h=Nd(),f=t||y0,[g,p]=(0,Ht.useState)({}),v=Object.entries(g),[x,b]=(0,Ht.useState)({}),w=Object.entries(x),[A,E]=(0,Ht.useState)({}),P=(0,Ht.useMemo)(()=>n||Math.max(...Object.values(A)),[A]),I=(0,Ht.useMemo)(()=>({maxOverZoom:P||1,...o.runtimeOptions||{}}),[P,o.runtimeOptions]),F=(0,Ht.useCallback)((L,N)=>{E(D=>{if(N===-1){let{[L]:j,...se}=D;return se}return{...D,[L]:N}})},[]),X=(0,Ht.useCallback)((L,N,D)=>{p(({[L]:j,...se})=>N?{...se,[L]:{element:N,props:D}}:se)},[]),W=(0,Ht.useCallback)((L,N,D)=>{b(({[L]:j,...se})=>N?{...se,[L]:{element:N,props:D}}:se)},[]);return(0,gt.jsxs)(Bl,{resetKeys:[],fallbackRender:L=>(0,gt.jsx)(f,{...o,...L}),children:[(0,gt.jsx)(dv,{...o,containerProps:{style:{position:"relative"},...o.containerProps||{}},htmlChildren:(0,gt.jsx)(gt.Fragment,{children:v.map(([L,{element:N,props:D}])=>(0,gt.jsx)(Ht.default.Fragment,{children:(0,gt.jsx)(N,{...D||{}})},L))}),onCreated:L=>{u(L),o.onCreated&&o.onCreated(L)},runtimeOptions:I,children:(0,gt.jsx)(zs.Provider,{value:a,children:(0,gt.jsx)(qd.Provider,{value:F,children:(0,gt.jsx)(Wd.Provider,{value:X,children:(0,gt.jsx)(Hd.Provider,{value:W,children:(0,gt.jsx)(Fd,{bridge:h,children:(0,gt.jsx)(ds.Provider,{value:o.mode||"explore",children:(0,gt.jsx)(Bd,{children:e})})})})})})})}),(0,gt.jsx)("div",{children:w.map(([L,{element:N,props:D}])=>(0,gt.jsx)(Ht.default.Fragment,{children:(0,gt.jsx)(N,{...D||{}})},L))})]})}var Qd=T(q(),1);function zo(e=yi){return{addEventListener(t,r,n,o){if(t)return e.setMetaValue([t.id,"eventManager",r],a=>{let u=a||[];for(let h of u)if(h.callback===n)return u;return[...u,{callback:n,scope:o}]}),n},removeEventListener(t,r,n){t&&e.setMetaValue([t.id,"eventManager",r],o=>(o||[]).filter(a=>a.callback!==n))},getListenersAsProps(t,r){let n=typeof t=="string"?{id:t}:t;if(!n||!n.id)return{};let o=e.getResourceMeta(n.id,"eventManager"),a={};if(o&&n)for(let u of Object.keys(o))a[u]=h=>{let f=e.get(n);for(let{callback:g,scope:p}of o[u]||[])(!p||r&&p.indexOf(r)!==-1)&&g(h,f)};return a}}}function No(e,t){let r=be(),n=(0,Qd.useMemo)(()=>zo(r),[r]),o=ke(()=>e&&e.id?r.getResourceMeta(e.id,"eventManager"):null,[e]);return(0,Qd.useMemo)(()=>e?n.getListenersAsProps(e,t):{},[o,e,r,t])}var A0=T(q(),1);function Fn(e=yi){return{applyStyles(t,r,n){let o=typeof t=="string"?t:t.id;return e.setMetaValue([o,"styles",r],n)},getAppliedStyles(t){let r=typeof t=="string"?t:t.id;return e.getResourceMeta(r,"styles")}}}function Dn(e,t){let r=be(),n=(0,A0.useMemo)(()=>Fn(r),[r]);return ke(()=>{if(!e)return null;let o=n.getAppliedStyles(e.id);return o?t?o[t]:o:void 0},[e,t])}var I0=T(q(),1);var T0=T(q(),1);var Ub=Rh({"node_modules/.pnpm/parse-svg-path@0.1.2/node_modules/parse-svg-path/index.js"(e,t){"use strict";t.exports=o;var r={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},n=/([astvzqmhlc])([^astvzqmhlc]*)/ig;function o(h){var f=[];return h.replace(n,function(g,p,v){var x=p.toLowerCase();for(v=u(v),x=="m"&&v.length>2&&(f.push([p].concat(v.splice(0,2))),x="l",p=p=="m"?"l":"L");;){if(v.length==r[x])return v.unshift(p),f.push(v);if(v.length<r[x])throw new Error("malformed path data");f.push([p].concat(v.splice(0,r[x])))}}),f}var a=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/ig;function u(h){var f=h.match(a);return f?f.map(Number):[]}}}),Bb=Rh({"node_modules/.pnpm/abs-svg-path@0.1.1/node_modules/abs-svg-path/index.js"(e,t){"use strict";t.exports=r;function r(n){var o=0,a=0,u=0,h=0;return n.map(function(f){f=f.slice();var g=f[0],p=g.toUpperCase();if(g!=p)switch(f[0]=p,g){case"a":f[6]+=u,f[7]+=h;break;case"v":f[1]+=h;break;case"h":f[1]+=u;break;default:for(var v=1;v<f.length;)f[v++]+=u,f[v++]+=h}switch(p){case"Z":u=o,h=a;break;case"H":u=f[1];break;case"V":h=f[1];break;case"M":u=o=f[1],h=a=f[2];break;default:u=f[f.length-2],h=f[f.length-1]}return f})}}}),Vb=function(){function e(t,r){var n=[],o=!0,a=!1,u=void 0;try{for(var h=t[Symbol.iterator](),f;!(o=(f=h.next()).done)&&(n.push(f.value),!(r&&n.length===r));o=!0);}catch(g){a=!0,u=g}finally{try{!o&&h.return&&h.return()}finally{if(a)throw u}}return n}return function(t,r){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),Fo=Math.PI*2,Yd=function(t,r,n,o,a,u,h){var f=t.x,g=t.y;f*=r,g*=n;var p=o*f-a*g,v=a*f+o*g;return{x:p+u,y:v+h}},Wb=function(t,r){var n=r===1.5707963267948966?.551915024494:r===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(r/4),o=Math.cos(t),a=Math.sin(t),u=Math.cos(t+r),h=Math.sin(t+r);return[{x:o-a*n,y:a+o*n},{x:u+h*n,y:h-u*n},{x:u,y:h}]},b0=function(t,r,n,o){var a=t*o-r*n<0?-1:1,u=t*n+r*o;return u>1&&(u=1),u<-1&&(u=-1),a*Math.acos(u)},Hb=function(t,r,n,o,a,u,h,f,g,p,v,x){var b=Math.pow(a,2),w=Math.pow(u,2),A=Math.pow(v,2),E=Math.pow(x,2),P=b*w-b*E-w*A;P<0&&(P=0),P/=b*E+w*A,P=Math.sqrt(P)*(h===f?-1:1);var I=P*a/u*x,F=P*-u/a*v,X=p*I-g*F+(t+n)/2,W=g*I+p*F+(r+o)/2,L=(v-I)/a,N=(x-F)/u,D=(-v-I)/a,j=(-x-F)/u,se=b0(1,0,L,N),ee=b0(L,N,D,j);return f===0&&ee>0&&(ee-=Fo),f===1&&ee<0&&(ee+=Fo),[X,W,se,ee]},qb=function(t){var r=t.px,n=t.py,o=t.cx,a=t.cy,u=t.rx,h=t.ry,f=t.xAxisRotation,g=f===void 0?0:f,p=t.largeArcFlag,v=p===void 0?0:p,x=t.sweepFlag,b=x===void 0?0:x,w=[];if(u===0||h===0)return[];var A=Math.sin(g*Fo/360),E=Math.cos(g*Fo/360),P=E*(r-o)/2+A*(n-a)/2,I=-A*(r-o)/2+E*(n-a)/2;if(P===0&&I===0)return[];u=Math.abs(u),h=Math.abs(h);var F=Math.pow(P,2)/Math.pow(u,2)+Math.pow(I,2)/Math.pow(h,2);F>1&&(u*=Math.sqrt(F),h*=Math.sqrt(F));var X=Hb(r,n,o,a,u,h,v,b,A,E,P,I),W=Vb(X,4),L=W[0],N=W[1],D=W[2],j=W[3],se=Math.abs(j)/(Fo/4);Math.abs(1-se)<1e-7&&(se=1);var ee=Math.max(Math.ceil(se),1);j/=ee;for(var he=0;he<ee;he++)w.push(Wb(D,j)),D+=j;return w.map(function(Ae){var Re=Yd(Ae[0],u,h,E,A,L,N),Te=Re.x,ge=Re.y,lt=Yd(Ae[1],u,h,E,A,L,N),ce=lt.x,st=lt.y,Pe=Yd(Ae[2],u,h,E,A,L,N),V=Pe.x,fe=Pe.y;return{x1:Te,y1:ge,x2:ce,y2:st,x:V,y:fe}})},Qb=qb,Yb=Th(Ub(),1),Gb=Th(Bb(),1);function Xb(e){let t=(0,Yb.default)(e),r=(0,Gb.default)(t),n,o=0,a=0,u=0,h=0,f,g,p=0,v=0,x=[];for(let b=0;b<r.length;b++){let w=r[b],A=w[0];switch(A){case"M":o=w[1],a=w[2];break;case"H":w=["L",w[1],a];break;case"V":w=["L",o,w[1]];break;case"S":{let E=p,P=v;(n==="C"||n=="S")&&(E+=E-u,P+=P-h),w=["C",E,P,w[1],w[2],w[3],w[4]]}break;case"T":n==="Q"||n=="T"?(f=p*2-f,g=v*2-g):(f=p,g=v),w=["Q",f,g,w[1],w[2]];break;case"Q":f=w[1],g=w[2];break;case"A":{let E=Qb({px:p,py:v,cx:w[6],cy:w[7],rx:w[1],ry:w[2],xAxisRotation:w[3],largeArcFlag:w[4],sweepFlag:w[5]});if(!E.length)continue;for(let[P,I]of E.entries())w=["C",I.x1,I.y1,I.x2,I.y2,I.x,I.y],P<E.length-1&&x.push(w);w=w}break;case"Z":w=["L",o,a];break}n=A,p=w[w.length-2],v=w[w.length-1],["C","Q","A"].indexOf(A)>-1?(u=w[w.length-4],h=w[w.length-3]):(u=p,h=v),x.push(w)}return x}function $b(e,t,r,n=1){return new C0(e,t,r).subdivide(n)}function Zb(e,t,r,n,o=1){return new Jb(new Float64Array([e.x,e.y,t.x,t.y,r.x,r.y,n.x,n.y])).subdivide(o)}function Kb(e){return e.x*e.x+e.y*e.y}function Do(e){return e/(1-.67+Math.pow(Math.pow(.67,4)+.25*e*e,.25))}function Fs(e){return e*(1-.39+Math.sqrt(.39*.39+.25*e*e))}var C0=class{constructor(e,t,r){Jt(this,"start"),Jt(this,"control"),Jt(this,"end"),this.start=e,this.control=t,this.end=r}eval(e){let t=1-e;return{x:this.start.x*t*t+2*this.control.x*t*e+this.end.x*e*e,y:this.start.y*t*t+2*this.control.y*t*e+this.end.y*e*e}}mapToBasic(){let{x:e,y:t}=this.start,{x:r,y:n}=this.control,{x:o,y:a}=this.end,u=2*r-e-o,h=2*n-t-a,f=(r-e)*u+(n-t)*h,g=(o-r)*u+(a-n)*h,p=(o-e)*h-(a-t)*u,v=f/p,x=g/p,b=Math.abs(p)/(Math.hypot(u,h)*Math.abs(x-v));return{x0:e,x2:o,scale:b,cross:p}}subdivide(e){let t=this.mapToBasic(),r=Do(t.x0),n=Do(t.x2),o=.5*Math.abs(n-r)*Math.sqrt(t.scale/e),a=Math.ceil(o),u=Fs(r),h=Fs(n),f=[0];for(let g=1;g<a;g++){let v=(Fs(r+(n-r)*g/a)-u)/(h-u);f.push(v)}return f.push(1),f.map(g=>this.eval(g))}},Jb=class P0{constructor(t){Jt(this,"c"),this.c=t}weightsum(t,r,n,o){let a=t*this.c[0]+r*this.c[2]+n*this.c[4]+o*this.c[6],u=t*this.c[1]+r*this.c[3]+n*this.c[5]+o*this.c[7];return{x:a,y:u}}eval(t){let r=1-t,n=r*r*r,o=3*r*r*t,a=3*r*t*t,u=t*t*t;return this.weightsum(n,o,a,u)}deriv(t){let r=1-t,n=-3*r*r,o=3*t*t,a=-6*t*r-n,u=6*t*r-o;return this.weightsum(n,a,u,o)}midpoint_quadbez(){let t=this.weightsum(-.25,.75,.75,-.25);return new C0({x:this.c[0],y:this.c[1]},t,{x:this.c[6],y:this.c[7]})}subsegment(t,r){let n=new Float64Array(8),o=this.eval(t),a=this.eval(r);n[0]=o.x,n[1]=o.y;let u=(r-t)/3,h=this.deriv(t);n[2]=o.x+u*h.x,n[3]=o.y+u*h.y;let f=this.deriv(r);return n[4]=a.x-u*f.x,n[5]=a.y-u*f.y,n[6]=a.x,n[7]=a.y,new P0(n)}subdivide(t){let r=.1*t,n=t-r,o=Math.sqrt(n),a=Kb(this.weightsum(1,-3,3,-1)),u=Math.ceil(Math.pow(a/(432*r*r),1/6)),h=[],f=0;for(let w=0;w<u;w++){let A=w/u,E=(w+1)/u,P=this.subsegment(A,E).midpoint_quadbez(),I=P.mapToBasic(),F=Do(I.x0),X=Do(I.x2),W=Math.sqrt(I.scale),L=Math.abs(X-F)*W;if(Math.sign(I.x0)!=Math.sign(I.x2)){let N=o/W,D=o*Math.abs(X-F)/Do(N);L=Math.max(L,D)}h.push({quad:P,a0:F,a2:X,val:L}),f+=L}let g=.5*f/o,p=Math.ceil(g),v=[{x:this.c[0],y:this.c[1]}],x=0,b=0;for(let w=1;w<p;w++){let A=f*w/p;for(;x+h[b].val<A;)x+=h[b].val,b++;let E=h[b].a0,P=h[b].a2,I=Fs(E),F=Fs(P),X=E+(P-E)*(A-x)/h[b].val,L=(Fs(X)-I)/(F-I);v.push(h[b].quad.eval(L))}return v.push({x:this.c[6],y:this.c[7]}),v}},eE=/&?(xywh=)?(pixel:|percent:|pct:)?([0-9]+(?:\.[0-9]+)?),([0-9]+(?:\.[0-9]+)?),([0-9]+(?:\.[0-9]+)?),([0-9]+(?:\.[0-9]+)?)/,tE=/&?(t=)(npt:)?([0-9]+(.[0-9]+)?)?(,([0-9]+(.[0-9]+)?))?/,E0=/^rgba\((\d+),(\d+),(\d+),([0-9.]+)\)$/;function jn(e,{domParser:t,svgPreprocessor:r,iiifRenderingHints:n}={}){if(Array.isArray(e))return Ur(e.reduce((o,a)=>{let{selector:u,selectors:h,iiifRenderingHints:f}=jn(a,{domParser:t,svgPreprocessor:r,iiifRenderingHints:n});return u&&(o.selector||(o.selector=u),o.selectors.push(...h)),f&&(o.iiifRenderingHints=o.iiifRenderingHints||{type:"ImageApiSelector"},Object.assign(o.iiifRenderingHints,f)),o},{selector:null,selectors:[],iiifRenderingHints:n}));if(!e)return Ur({selector:null,selectors:[],iiifRenderingHints:n});if(typeof e=="string"){let[o,a]=e.split("#");return a?jn({type:"FragmentSelector",value:a},{svgPreprocessor:r,iiifRenderingHints:n,domParser:t}):Ur({selector:null,selectors:[],iiifRenderingHints:n})}if(e.type&&e.type==="PointSelector"&&(e.t||e.t===0)){let o={type:"TemporalSelector",temporal:{startTime:e.t}};return Ur({selector:o,selectors:[o],iiifRenderingHints:n})}if(xu(e)){let o=[];if(e.region){let a=jn({type:"FragmentSelector",value:"xywh="+e.region},{domParser:t,svgPreprocessor:r,iiifRenderingHints:n});o.push(...a.selectors)}return Ur({selector:o[0],selectors:o,iiifRenderingHints:n?{...n,...e}:e})}if(e.type==="FragmentSelector"){let o=eE.exec(e.value);if(o){let u={type:"BoxSelector",spatial:{unit:o[2]==="percent:"||o[2]==="pct:"?"percent":"pixel",x:parseFloat(o[3]),y:parseFloat(o[4]),width:parseFloat(o[5]),height:parseFloat(o[6])}};return Ur({selector:u,selectors:[u],iiifRenderingHints:n})}let a=e.value.match(tE);if(a){let u={type:"TemporalSelector",temporal:{startTime:a[4]?parseFloat(a[4]):0,endTime:a[7]?parseFloat(a[7]):void 0}};return Ur({selector:u,selectors:[u],iiifRenderingHints:n})}return Ur({selector:null,selectors:[],iiifRenderingHints:n})}if(e.type==="SvgSelector"&&"value"in e){t||(typeof window<"u"?t=new window.DOMParser:console.warn("No DOMParser available, cannot parse SVG selector, `points`, `spatial` and `style` will be unavailable and the SVG will not be normalized."));let o=[],a,u,h=r?.(e.value)??e.value,f;if(t){let p=t.parseFromString(e.value,"image/svg+xml").querySelector("svg");if(!p)return console.warn(`Illegal SVG selector: ${e.value}`),Ur({selector:null,selectors:[],iiifRenderingHints:n});let v=R0(p);v&&(o=v.points,f=v.shapeType,a=[Math.min(...o.map(x=>x[0])),Math.min(...o.map(x=>x[1])),Math.max(...o.map(x=>x[0])),Math.max(...o.map(x=>x[1]))],{style:u,svg:h}=nE(v.element)??{svg:h})}let g={type:"SvgSelector",svg:h,svgShape:f,style:u,points:o.length?o:void 0,spatial:a?{unit:"pixel",x:a[0],y:a[1],width:a[2]-a[0],height:a[3]-a[1]}:void 0};return Ur({selector:g,selectors:[g],iiifRenderingHints:n})}return Ur({selector:null,selectors:[],iiifRenderingHints:n})}function rE(e){let t=e.map(n=>n[0]).reduce((n,o)=>(n[o]+=1,n),{C:0,Q:0,L:0,M:0}),r=new Set(e.map(n=>n[0]));if(t.C>0||t.Q>0)return"path";if(t.L>0&&(r.size===1||r.size===2&&r.has("M"))){if(t.L===4)return"rect";let n=e.slice(-1)[0];return e[0][0]==="M"&&n[0]==="L"&&n[1]==e[0][1]&&n[2]===e[0][2]||n[1]===0&&n[2]===0?"polygon":"polyline"}return"path"}function R0(e){for(let t of Array.from(e.children))switch(t?.tagName.toLowerCase()){case"g":{let r=R0(t);if(r)return r}continue;case"path":{let r=t.getAttribute("d");if(!r)continue;let n=Xb(r);return{element:t,points:iE(n),shapeType:rE(n)}}case"circle":{let r=parseFloat(t.getAttribute("cx")??"0"),n=parseFloat(t.getAttribute("cy")??"0"),o=parseFloat(t.getAttribute("r")??"0");if(!o)continue;let a=[];for(let u=0;u<=360;u+=12){let h=u*Math.PI/180;a.push([r+o*Math.cos(h),n+o*Math.sin(h)])}return{element:t,points:a,shapeType:"circle"}}case"ellipse":{let r=parseFloat(t.getAttribute("cx")??"0"),n=parseFloat(t.getAttribute("cy")??"0"),o=parseFloat(t.getAttribute("rx")??"0"),a=parseFloat(t.getAttribute("ry")??"0");if(!o&&!a)continue;let u=[];for(let h=0;h<=360;h+=12){let f=Math.tan(h/360*Math.PI),g=o*(1-f**2)/(1+f**2),p=a*2*f/(1+f**2);u.push([r+g,n+p])}return{element:t,points:u,shapeType:"ellipse"}}case"line":{let r=parseFloat(t.getAttribute("x0")??"0"),n=parseFloat(t.getAttribute("y0")??"0"),o=parseFloat(t.getAttribute("x1")??"0"),a=parseFloat(t.getAttribute("y1")??"0");if(r===o&&n===a)continue;return{element:t,points:[[r,n],[o,a]],shapeType:"polyline"}}case"polygon":case"polyline":{let r=t.getAttribute("points")?.split(" ").map(o=>o.split(",").map(parseFloat))??[];if(!r.length)continue;let n="polyline";return t.tagName.toLowerCase()==="polygon"&&(r.push(r[0]),n="polygon"),{element:t,points:r,shapeType:n}}case"rect":{let r=parseFloat(t.getAttribute("x")??"0"),n=parseFloat(t.getAttribute("y")??"0"),o=parseFloat(t.getAttribute("width")??"0"),a=parseFloat(t.getAttribute("height")??"0");if(!o||!a)continue;return{element:t,points:[[r,n],[r+o,n],[r+o,n+a],[r,n+a],[r,n]],shapeType:"rect"}}default:continue}return null}function iE(e){let t=[];for(let r=0;r<e.length;r++){let n=t[t.length-1]??[0,0],o=e[r];switch(o[0]){case"M":case"L":t.push([o[1],o[2]]);continue;case"C":t.push(...Zb({x:n[0],y:n[1]},{x:o[1],y:o[2]},{x:o[3],y:o[4]},{x:o[5],y:o[6]}).map(a=>[a.x,a.y]).slice(1));continue;case"Q":t.push(...$b({x:n[0],y:n[1]},{x:o[1],y:o[2]},{x:o[3],y:o[4]}).map(a=>[a.x,a.y]).slice(1));continue}}return t}function nE(e){let t={};if(e.hasAttribute("fill")?(t.fill=e.getAttribute("fill"),e.removeAttribute("fill")):e.style.fill&&(t.fill=e.style.fill),t.fill){let n=E0.exec(t.fill);n&&(t.fillOpacity=parseFloat(n[4]),t.fill=`rgb(${n[1]}, ${n[2]}, ${n[3]})`)}if(e.hasAttribute("fill-opacity")?(t.fillOpacity=parseFloat(e.getAttribute("fill-opacity")),e.removeAttribute("fill-opacity")):e.style.fillOpacity&&(t.fillOpacity=parseFloat(e.style.fillOpacity)),e.hasAttribute("stroke")?(t.stroke=e.getAttribute("stroke"),e.removeAttribute("stroke")):e.style.stroke&&(t.stroke=e.style.stroke),t.stroke){let n=E0.exec(t.stroke);n&&(t.strokeOpacity=parseFloat(n[4]),t.stroke=`rgb(${n[1]}, ${n[2]}, ${n[3]})`)}e.hasAttribute("stroke-opacity")?(t.strokeOpacity=parseFloat(e.getAttribute("stroke-opacity")),e.removeAttribute("stroke-opacity")):e.style.strokeOpacity&&(t.strokeOpacity=parseFloat(e.style.strokeOpacity)),e.hasAttribute("stroke-width")?(t.strokeWidth=e.getAttribute("stroke-width"),e.removeAttribute("stroke-width")):e.style.strokeWidth&&(t.strokeWidth=e.style.strokeWidth),e.hasAttribute("stroke-dasharray")?(t.strokeDasharray=e.getAttribute("stroke-dasharray"),e.removeAttribute("stroke-dasharray")):e.style.strokeDasharray&&(t.strokeDasharray=e.style.strokeDasharray);let r=e;for(;r.tagName.toLowerCase()!=="svg";)if(r=r.parentElement,r===null)throw new Error("Could not find root SVG element");return{svg:r.outerHTML,style:Object.keys(t).length>0?t:void 0}}function xu(e){return!!e&&e.type==="iiif:ImageApiSelector"&&e.type==="iiif:ImageApiSelector"}function Ur(e){if(e.iiifRenderingHints){let t=e.iiifRenderingHints;if(t.rotation){let r=Su(`${t.rotation}`);if(r)if(e.selectors.length)for(let n of e.selectors)n.rotation=r;else e.selectors.push({type:"RotationSelector",rotation:r})}}else delete e.iiifRenderingHints;return e}function Su(e){let t=parseFloat(e);return t&&e.startsWith("!")&&(t=360-t),t&&(t=t%360),t!==t?0:t||0}function tr(e,t={}){if(Array.isArray(e))return tr(e[0]);if(typeof e=="string"){let[r,n]=e.split("#");return n?tr({type:"SpecificResource",source:{id:r,type:"Unknown"},selector:{type:"FragmentSelector",value:n}}):{type:"SpecificResource",source:{id:r,type:t.typeMap&&t.typeMap[r]||"Unknown"},selector:null,selectors:[]}}if(e.type==="Choice"||e.type==="List"||e.type==="Composite"||e.type==="Independents")return tr(e.items[0]);if(e.type==="SpecificResource"){e.source.type==="Canvas"&&e.source.partOf&&typeof e.source.partOf=="string"&&(e.source.partOf=[{id:e.source.partOf,type:"Manifest"}]);let{selector:r,selectors:n}=e.selector?jn(e.selector,t):{selector:null,selectors:[]};return{type:"SpecificResource",source:e.source,selector:r,selectors:n}}if(e.id){e.type==="Canvas"&&e.partOf&&typeof e.partOf=="string"&&(e.partOf=[{id:e.partOf,type:"Manifest"}]);let[r,n]=e.id.split("#");return n?tr({type:"SpecificResource",source:{...e,id:r},selector:{type:"FragmentSelector",value:n}}):{type:"SpecificResource",source:{...e,id:r},selector:null,selectors:[]}}return{type:"SpecificResource",source:e,selector:null,selectors:[]}}function jo(e={},t=[]){let{id:r,selector:n}=e,o=Ft(),a=be(),u=r||o.annotation,h=ke(g=>u?g.iiif.entities.Annotation[u]:void 0,[u]),f=ke(g=>h&&h.body?h.body.map(p=>p?p.type==="SpecificResource"?{...p,source:a.get(p)}:p?g.iiif.entities[p.type][p.id]:null:null).filter(Boolean):[],[h]);return(0,T0.useMemo)(()=>{if(!h)return;let g={...h,body:f,target:tr(h.target,{typeMap:a.getState().iiif.mapping})};return n?n(g):g},[h,n,f,...t])}var _0=T(G(),1),wu=({id:e,style:t,className:r,interactive:n})=>{let o=jo({id:e}),a=Dn(o,"atlas"),u=Dn(o,"html"),h=No(o,["atlas"]),f=nt(),g=(0,I0.useMemo)(()=>Pv(t,a),[t,a]);return f&&o&&o.target&&o.target.selector&&o.target.selector.type==="BoxSelector"&&o.target.source&&(o.target.source.id===f.id||o.target.source===f.id)?(0,_0.jsx)(Av,{id:o.id,isEditing:!0,region:o.target.selector.spatial,style:g,className:u?.className||r,interactive:!!(u?.href||n),href:u?.href||null,title:u?.title||null,hrefTarget:u?.target||null,onClick:()=>{},...h}):null};var M0=T(q(),1);var O0=T(q(),1);function Gd(e={},t=[]){let{id:r,selector:n}=e,o=Ft(),a=r||o.annotationPage,u=ke(h=>a?h.iiif.entities.AnnotationPage[a]:void 0,[a]);return(0,O0.useMemo)(()=>{if(u)return n?n(u):u},[u,...t])}var Xd=T(G(),1),Uo=({className:e,page:t})=>{let r=Gd({id:t.id})||t,n=Dn(r,"atlas"),o=Dn(r,"html");return ke(a=>r.id?a.iiif.entities.AnnotationPage[r.id]:null,[]),(0,Xd.jsx)(M0.Fragment,{children:r.items?.map(a=>(0,Xd.jsx)(wu,{id:a.id,style:n,className:o?.className||e},a.id))})};var Bo=T(q(),1);var Un=T(q(),1),bi=T(G(),1),L0=Un.default.createContext("en");function sE(e){return(0,bi.jsx)(L0.Provider,{value:e.language,children:e.children})}function Au(){return Un.default.useContext(L0)}function k0(e){return e.indexOf("-")!==-1?e.slice(0,e.indexOf("-")):e}function z0({as:e,language:t,children:r,viewingDirection:n,...o}){let a=Au();return(0,Un.useMemo)(()=>k0(a)===k0(t),[a,t])?e?(0,bi.jsx)(e,{...o,children:r}):(0,bi.jsx)("span",{...o,children:r}):e?(0,bi.jsx)(e,{...o,lang:t,dir:n,children:r}):(0,bi.jsx)("span",{...o,lang:t,dir:n,children:r})}function N0(e,t,r){if(t.length===0)return;if(t.length===1)return t[0];if(t.indexOf(e)!==-1)return e;let n=e.indexOf("-")!==-1?e.slice(0,e.indexOf("-")):null;if(n&&t.indexOf(n)!==-1)return n;for(let o of r)if(t.indexOf(o)!==-1)return o;return t.indexOf("none")!==-1?"none":t.indexOf("@none")!==-1?"@none":t[0]}var F0=(e,t=[])=>{let r=Au();return(0,Un.useMemo)(()=>{let n=e();return N0(r,n,[])},[r,...t])};function D0(e,t,r=`
|
|
75
|
+
`){let n=F0(()=>Object.keys(e||{}),[e]);return[(0,Un.useMemo)(()=>{if(!e)return t||"";if(typeof e=="string")return e;let o=n?e[n]:void 0;return o?typeof o=="string"?o:o.join(r):""},[n,t,e]),n]}function oE(){let e=Au();return function(r,n,o){let a=Object.keys(r||{}),u=N0(e,a,[]);if(!r)return n||"";if(typeof r=="string")return r;let h=u?r[u]:void 0;return h?typeof h=="string"?h:h.join(typeof o<"u"?o:`
|
|
76
|
+
`):""}}function fr({as:e,defaultText:t,enableDangerouslySetInnerHTML:r,children:n,separator:o,...a}){let[u,h]=D0(n,t,o);return h?(0,bi.jsx)(z0,{...a,as:e,language:h,title:r?void 0:u,dangerouslySetInnerHTML:r?{__html:u}:void 0,children:r?void 0:u}):e?(0,bi.jsx)(e,{...a,children:u}):(0,bi.jsx)("span",{...a,title:r?void 0:u,dangerouslySetInnerHTML:r?{__html:u}:void 0,children:r?void 0:u})}var Cr=T(G(),1);function aE({resource:e,heading:t,note:r,extra:n}){return n?(0,Cr.jsx)(fs,{target:{x:0,y:0,width:n.target?.spatial.width,height:n.target?.spatial.height},backgroundColor:"#333",relative:!0,children:(0,Cr.jsx)("div",{style:{display:"flex",alignContent:"center",justifyContent:"center",alignItems:"center",height:"100%",width:"100%",background:"#444",color:"#BBB"},children:(0,Cr.jsxs)("div",{children:[(0,Cr.jsx)(fr,{children:t||"Not authorised"}),r&&(0,Cr.jsx)("p",{children:(0,Cr.jsx)(fr,{children:r})}),(0,Cr.jsx)("p",{children:e.id||e["@id"]||"unknown"})]})})}):null}function j0({image:e,thumbnail:t,crop:r,enableSizes:n}){if(!Md()){let a=e.service,u=a.width||e.width||0,h=a.height||e.height||0;return(0,Cr.jsx)(jh,{tiles:{id:a.id||a["@id"]||"unknown",height:h,width:u,imageService:a},enableSizes:n,x:0,y:0,width:e.target?.spatial.width,height:e.target?.spatial.height,crop:r})}return(0,Cr.jsx)(kd,{resource:e.service,errorComponent:aE,extra:e,children:a=>{let u=a.width||e.width||0,h=a.height||e.height||0;return(0,Cr.jsx)(jh,{tiles:{id:a.id||a["@id"]||"unknown",height:h,width:u,imageService:a},enableSizes:n,x:0,y:0,width:e.target?.spatial.width,height:e.target?.spatial.height,crop:r})}},e.id)}var Bn=T(G(),1);function bu({id:e,image:t,thumbnail:r,isStatic:n,x:o=0,y:a=0,children:u,selector:h,onClick:f,enableSizes:g}){let p=(0,Bo.useMemo)(()=>{if(!(!h||h.spatial.x===0&&h.spatial.y===0))return h.spatial},[h]);return(0,Bn.jsx)("world-object",{x:o+t.target.spatial.x,y:a+t.target.spatial.y,width:t.target.spatial.width,height:t.target.spatial.height,onClick:f,children:t.service?(0,Bn.jsxs)(Bo.Fragment,{children:[(0,Bn.jsx)(j0,{image:t,thumbnail:r,crop:p,enableSizes:g}),u]},"service"):(0,Bn.jsxs)(Bo.Fragment,{children:[(0,Bn.jsx)("world-image",{onClick:f,uri:t.id,target:{x:0,y:0,width:t.target.spatial.width,height:t.target.spatial.height},display:t.width&&t.height?{width:t.width,height:t.height}:void 0,crop:p}),u]},"no-service")},e+(t.service?"server":"no-service"))}var oi=T(q(),1);var hf=T(q(),1);function U0(e){return e.type==="SpecificResource"?[e.source,{selector:e.selector}]:[e,{selector:null}]}function $d(e=yi){function t(o){let a=o?typeof o=="string"?e.get(o):o:null;if(!a)return[];let u=e.get(a.items,{parent:a}),h=[];for(let f of u)h.push(...e.get(f.items,{parent:f}));return h}function r(o,a=[]){let u=Array.isArray(o)?o:t(o),h=[],f={items:[],type:"complex-choice"},g=[];for(let p of u){if(p.type!=="Annotation")throw new Error("getPaintables() accept either a canvas or list of annotations");let v=Array.from(Array.isArray(p.body)?p.body:[p.body]);for(let x of v){let[b,{selector:w}]=U0(x),A=e.get(b),E=(A.type||"unknown").toLowerCase();if(E==="choice"){let P=e.get(A.items,{parent:A.id}),I=a.length?a.map(F=>P.find(X=>X.id===F)).filter(Boolean):[P[0]];I.length===0&&I.push(P[0]),f.items.push({type:"single-choice",items:P.map(F=>({id:F.id,label:F.label,selected:I.indexOf(F)!==-1})),label:b.label}),v.push(...I);continue}h.indexOf(E)===-1&&h.push(E),g.push({type:E,annotationId:p.id,resource:A,target:p.target,selector:w})}}return{types:h,items:g,choice:f.items.length<2?f.items[0]||null:f}}function n(o){let{choice:a}=r(o);return a}return{getAllPaintingAnnotations:t,getPaintables:r,extractChoices:n}}function B0(e,t,r=[],n=!1,o=[]){if(o.length&&(t=t.filter(u=>o.indexOf(u)===-1)),!t||t.length===0)return;if(t.length===1)return t[0];if(!e)return t.indexOf("none")!==-1?"none":t[0];if(t.indexOf(e)!==-1)return e;let a=e.indexOf("-")!==-1?e.slice(0,e.indexOf("-")):null;if(a&&t.indexOf(a)!==-1)return a;for(let u of r)if(t.indexOf(u)!==-1)return u;if(!n&&e){let h=t.map(f=>f.indexOf("-")!==-1?f.slice(0,f.indexOf("-")):null).indexOf(e);if(h!==-1)return t[h];for(let f of r){let g=f.indexOf("-")!==-1?f.slice(0,f.indexOf("-")):null,p=g?t.indexOf(g):-1;if(p!==-1)return t[p]}}return t.indexOf("none")!==-1?"none":t.indexOf("@none")!==-1?"@none":t[0]}function Zd(e,t,r={}){let{strictFallback:n=!1,defaultText:o="",separator:a=`
|
|
77
|
+
`,fallbackLanguages:u=[],closest:h,skipLanguages:f}=r,g=Object.keys(e||{}),p=h?t:B0(t,g,u,n,f);if(!e)return o;if(typeof e=="string")return e;let v=p?e[p]:void 0;if(v&&p){if(typeof v=="string")return v;if(v.length===1&&v[0]===""){let x=r.skipLanguages||[];return Zd(e,t,{...r,skipLanguages:[...x,p]})}return v.join(a)}return""}function Kd(e,t={}){return Zd(e,t.language||(typeof navigator<"u"?navigator.language:"en"),t)}function lE(e){return e.type==="SpecificResource"?[e.source,{selector:e.selector}]:[e,{selector:null}]}function Vo(e,t){let{selector:r,source:n}=tr(t);if(n.id!==e.id)return[null,n];let o={type:"BoxSelector",spatial:{x:0,y:0,width:Number(e.width),height:Number(e.height)}};return[r?r.type==="TemporalSelector"?{type:"TemporalBoxSelector",temporal:r.temporal,spatial:o.spatial}:r:null,n]}var Jd={makeChoice:()=>{}},Wo={type:"unknown"},qe=e=>({type:"unknown",reason:e,annotations:{pages:[]}}),ef=(e,t)=>({type:"empty",width:e,height:t,annotations:{pages:[]},image:null,images:[]});var Ho=T(q(),1);function uE(e,t){let r=e?.iiif?.meta[t];return r?r.annotationPageManager:null}function V0(e,t){return ke(r=>{let n=[];if(!e)return n;let o=Object.keys(r.iiif.entities.AnnotationPage);for(let a of o)if(!t||t.indexOf(a)!==-1){let u=uE(r,a);u&&u.views&&u.views[e]&&n.push(a)}return n},[e,t])}function tf({canvas:e,manifest:t,all:r,canvases:n}){let o=[];if(t)for(let a of t.annotations)o.indexOf(a.id)===-1&&o.push(a.id);if(r){if(n&&n.length)for(let a of n)for(let u of a.annotations)o.indexOf(u.id)===-1&&o.push(u.id)}else if(e)for(let a of e.annotations)o.indexOf(a.id)===-1&&o.push(a.id);return o}function cE(e,t){let r=e?.iiif?.meta[t];return r?r.annotationPageManager:null}function qo(e,t={}){let r=be(),n=bt(),o=nt(),a=Io(),u=(0,Ho.useMemo)(()=>tf({all:t.all,manifest:n,canvas:o,canvases:a}),[t.all,o,a,n]),h=V0(e,t.all?void 0:u),f=(0,Ho.useCallback)(p=>{e&&r.setMetaValue([p,"annotationPageManager","views"],v=>v&&!v[e]?v:{...v||{},[e]:!1})},[e,r]),g=(0,Ho.useCallback)((p,v={})=>{if(!e)return;let x=r.getState(),b=[];if(v?.deselectOthers){let w=Object.keys(x.iiif.entities.AnnotationPage);for(let A of w){let E=cE(x,A);E&&E.views&&E.views[e]&&b.push(A)}}for(let w of b)f(w);r.setMetaValue([p,"annotationPageManager","views"],w=>w&&w[e]?w:{...w||{},[e]:!0})},[e,f,r]);return{availablePageIds:u,enabledPageIds:h,setPageEnabled:g,setPageDisabled:f}}function rf(e,t){return ke((r,n)=>n.get(e.map(o=>({id:o,type:t}))),[e,t])}var Ki=T(q(),1);var Eu=T(q(),1);var W0=Eu.default.createContext(new ls);function Ei(){return(0,Eu.useContext)(W0)}function nf(){let e=Ei(),[t,r]=(0,Ki.useState)({}),n=(0,Ki.useRef)(!1);return(0,Ki.useEffect)(()=>()=>{n.current=!0},[]),[(0,Ki.useCallback)((a,{height:u,width:h})=>{if(a){let f=a.id||a["@id"],g=e.loadServiceSync({id:f,width:a.width||h,height:a.height||u,source:a});g?a=g:t[f]||(n.current||r(p=>({...p,[f]:"loading"})),e.loadService({id:f,width:a.width||h,height:a.height||u}).then(()=>{n.current||r(p=>({...p,[f]:"done"}))}))}return a},[e,t]),t]}var Wn=T(q(),1);function Vn(e={}){let t=jo(),r=nt(e.canvasId?{id:e.canvasId}:void 0);return ke((n,o)=>{if(!r)return[];if(t&&e.enableSingleAnnotation)return[t];let a=o.get(r.items),u=[];for(let h of a)u.push(...o.get(h.items));return u},[r])}function sf(e,t=[]){let r=be(),n=(0,Wn.useMemo)(()=>$d(r),[]),o=Vn({enableSingleAnnotation:e?.enableSingleAnnotation}),[a,u]=(0,Wn.useState)(e?.defaultChoices||[]),h=(0,Wn.useMemo)(()=>n.getPaintables(o,a),[r,o,a,...t]),g={makeChoice:(0,Wn.useCallback)((p,{deselectOthers:v=!0,deselect:x=!1}={})=>{if(h.choice){if(h.choice.type!=="single-choice")throw new Error("Complex choice not supported yet");u(b=>{if(x){let A=b.filter(E=>E!==p);if(A.length===0){let E=h.items[0].resource.id;return E?[E]:[]}return A}if(v)return[p];let w=[...b];if(w.length===0&&h.items.length){let A=h.items[0].resource.id;A&&w.push(A)}return b.indexOf(p)!==-1?b:[...b,p]})}},[h.choice])};return[h,g]}var hE=["model/gltf-binary"];function of(e,t){let n=t.items[0].resource;return n.format?hE.indexOf(n.format)===-1?qe(`3D format: ${n.format} is unsupported`):{type:"3d-model",model:n}:qe("Unknown format")}function H0(e,t){if(!e.duration)return qe("No duration on canvas");if(t.items.length>1)return qe("Only one audio source supported");let r=t.items[0]?.resource;return r?r.format?{type:"media",media:{annotationId:t.items[0].annotationId,duration:e.duration,url:r.id,type:"Sound",target:{type:"TemporalSelector",temporal:{startTime:0,endTime:e.duration}},format:r.format,selector:{type:"TemporalSelector",temporal:{startTime:0,endTime:e.duration}}},annotations:{pages:[]}}:qe("Audio does not have format"):qe("Unknown audio")}function af(e,t,r){let n=[];for(let o of t.items){let a=o.resource&&o.resource.type==="SpecificResource"?o.resource.source:o.resource;if(!a.id)return qe("No resource Identifier");let u;if(a.service){let w=vn(a);w[0]&&(u=r(w[0],e))}let h={type:"BoxSelector",spatial:{x:0,y:0,width:Number(e.width),height:Number(e.height)}},[f,g]=Vo(e,o.target);if(!(g.id===e.id||decodeURIComponent(g.id||"")===(e.id||"")))continue;let p=o.resource.width&&o.resource.height?{type:"BoxSelector",spatial:{x:0,y:0,width:o.resource.width,height:o.resource.height}}:void 0,v=o.resource.type==="SpecificResource"?tr(o.resource):null;if(o.selector){let w=tr({type:"SpecificResource",source:o.resource,selector:o.selector});w&&(v=w)}let x=v&&v.selector&&(v.selector.type==="BoxSelector"||v.selector.type==="TemporalBoxSelector")?{type:"BoxSelector",spatial:{x:v.selector.spatial.x,y:v.selector.spatial.y,width:v.selector.spatial.width,height:v.selector.spatial.height}}:void 0;u&&!u.id&&(u.id=u["@id"]);let b={id:a.id,type:"Image",annotationId:o.annotationId,width:Number(f||x?a.width:e.width),height:Number(f||x?a.height:e.height),service:u,sizes:u&&u.sizes?u.sizes:a.width&&a.height?[{width:a.width,height:a.height}]:[],target:f&&f.type!=="PointSelector"?f:h,selector:x};n.push(b)}return{type:"images",image:n[0],images:n,choice:t.choice}}function q0(e,t={},r){let n=e.language||r||"none";switch(e.type){case"TextualBody":{typeof e.value<"u"&&(t[n]=e.value);break}case"List":case"Composite":case"Choice":e.items&&e.items.forEach(o=>q0(o,t,n))}return t}function lf(e,t){let r=[];return t.items.forEach(n=>{if(n.resource){let[o]=Vo(e,n.target);r.push({annotationId:n.annotationId,text:q0(n.resource),target:o})}}),{type:"textual-content",items:r}}var dE=/^.*(?:(?:youtu\.be\/|v\/|vi\/|u\/\w\/|embed\/|shorts\/)|(?:(?:watch)?\?vi?=|&vi?=))([^#&?]*).*/;function uf(e,t){let r=t.items.filter(h=>h.type==="video"),n=!1;if(e.duration||(n=!0),r.length>1)return qe("Only one video source supported");let o=r[0]?.resource,a=!!(o.service||[]).find(h=>(h.profile||"").includes("youtube.com"));if(!a&&n)return qe("Video does not have duration");if(!o)return qe("Unknown video");if((!o.format||o.format==="text/html")&&!a)return qe("Video does not have format");let u={annotationId:t.items[0].annotationId,duration:e.duration,url:o.id,type:"Video",items:[],target:{type:"TemporalSelector",temporal:{startTime:0,endTime:e.duration}},format:o.format,selector:{type:"TemporalSelector",temporal:{startTime:0,endTime:e.duration}}};if(a){u.type="VideoYouTube";let h=o.id.match(dE);if(!h[1])return qe("Video is not known youtube video");u.youTubeId=h[1]}return{type:"media",media:u,annotations:{pages:[]}}}function cf({canvas:e,paintables:t,supports:r,loadImageService:n}){if(!e)return Wo;if(t.types.length===0)return r.indexOf("empty")!==-1?ef(e.width,e.height):Wo;if(t.types.length!==1)if(t.types.length===2&&t.types.indexOf("text")!==-1)t.types=t.types.filter(a=>a!=="text");else return r.indexOf("complex-timeline")===-1?qe("Complex timeline not supported"):qe("ComplexTimelineStrategy not yet supported");let o=t.types[0];return o==="image"?r.indexOf("images")===-1?qe("Image not supported"):af(e,t,n):o==="Model"||o==="model"?r.indexOf("3d-model")===-1?qe("3D not supported"):of(e,t):o==="textualbody"?r.indexOf("textual-content")===-1?qe("Textual content not supported"):lf(e,t):o==="sound"||o==="audio"?r.indexOf("media")===-1?qe("Media not supported"):H0(e,t):o==="video"?r.indexOf("media")===-1?qe("Media not supported"):uf(e,t):Wo}function df(e){let t=bt(),r=nt(),n=be(),[o,a]=nf(),{enabledPageIds:u}=qo(e?.annotationPageManagerId||t?.id||r?.id,{all:!1}),h=rf(u,"AnnotationPage"),f=e?.strategies||["empty","images","media","textual-content","complex-timeline"],[g,p]=sf(e,[a]),v=(0,hf.useMemo)(()=>cf({canvas:r,paintables:g,supports:f,loadImageService:o}),[r,g,n,p.makeChoice]);return(0,hf.useMemo)(()=>v.type==="unknown"?[v,Jd]:[{...v,annotations:{pages:h}},p],[v,h])}var Ji=T(q(),1);var Q0=T(q(),1),ff=(e,t=[])=>{let r=be();(0,Q0.useEffect)(()=>{e(r)},[r,...t])};function Qo(e,t,{canvasId:r,manifestId:n}={}){let o=be(),a=Ei(),u=(0,Ji.useMemo)(()=>Ch(o,{imageServiceLoader:a}),[o,a]),[h,f]=(0,Ji.useState)(),g=bt(n?{id:n}:void 0),p=nt(r?{id:r}:void 0),v=p||g,x=(0,Ji.useRef)(!1);if((0,Ji.useEffect)(()=>(x.current=!1,()=>{x.current=!0}),[]),!v)throw new Error("Must be called under a manifest or canvas context.");return ff(b=>{u.getBestThumbnailAtSize(v,e,t).then(w=>{w.best&&!x.current&&f(w.best)})},[v]),h}var ct=T(q(),1);function fE(e){return{isMuted:!1,playRequested:!1,isPlaying:!1,isFinished:!1,volume:100,duration:e}}function pE(e,t){switch(t.type){case"FINISHED":return{...e,isFinished:!0,isPlaying:!1,playRequested:!1};case"PLAY_PAUSE":return{...e,isFinished:!1,isPlaying:!e.isPlaying};case"PLAY_REQUESTED":return{...e,isFinished:!1,playRequested:!0};case"PAUSE":return{...e,isPlaying:!1};case"PLAY":return{...e,isFinished:!1,playRequested:!1,isPlaying:!0};case"MUTE":return{...e,isMuted:!0};case"SET_VOLUME":return{...e,volume:t.volume,isMuted:t.volume===0};case"TOGGLE_MUTE":return{...e,isMuted:!e.isMuted};case"UNMUTE":return{...e,isMuted:!1}}return e}function Y0(e){let t=Math.round(e);return`${Math.floor(t/60)}:${`${t%60}`.padStart(2,"0")}`}function Hn(e){let[t,r]=(0,ct.useReducer)(pE,fE(e.duration)),n=(0,ct.useRef)(null),o=(0,ct.useRef)(null),a=(0,ct.useRef)(null),u=(0,ct.useRef)(!1),h=(0,ct.useCallback)(()=>{o.current&&n.current&&(o.current.innerHTML=Y0(n.current.currentTime),a.current&&(a.current.style.width=`${n.current.currentTime/e.duration*100}%`),u.current!==n.current.muted&&(u.current=n.current.muted,r(n.current.muted?{type:"MUTE"}:{type:"UNMUTE"})))},[e.duration]),f=(0,ct.useCallback)(()=>{n.current&&(r({type:"PLAY_REQUESTED"}),n.current.play().then(()=>{r({type:"PLAY"})}),h())},[h]),g=(0,ct.useCallback)(()=>{n.current&&(n.current.duration>0&&n.current.paused?f():p())},[h]),p=(0,ct.useCallback)(()=>{n.current&&(n.current.pause(),r({type:"PAUSE"}),h())},[h]),v=(0,ct.useCallback)(()=>{n.current&&(n.current.muted=!n.current.muted,r(n.current.muted?{type:"MUTE"}:{type:"UNMUTE"}))},[]),x=(0,ct.useCallback)(()=>{n.current&&(n.current.muted=!0,r({type:"MUTE"}))},[]),b=(0,ct.useCallback)(()=>{n.current&&(n.current.muted=!1,r({type:"UNMUTE"}))},[]),w=(0,ct.useCallback)(P=>{n.current&&(n.current.muted=!1,n.current.volume=P/100,r({type:"SET_VOLUME",volume:P}))},[]),A=(0,ct.useCallback)(P=>{n.current&&(n.current.currentTime=Math.max(0,Math.min(P*e.duration,e.duration)),h())},[]),E=(0,ct.useCallback)(P=>{n.current&&(n.current.currentTime=Math.max(0,Math.min(P,e.duration)),h())},[]);return(0,ct.useEffect)(()=>{let P=setInterval(()=>{h()},350);return()=>clearInterval(P)},[h,e.duration]),(0,ct.useEffect)(()=>{let P=()=>{r({type:"FINISHED"})},I=n.current;return I?.addEventListener("ended",P),()=>I?.removeEventListener("ended",P)},[]),[{element:n,currentTime:o,progress:a},t,{play:f,pause:p,playPause:g,mute:x,unmute:b,toggleMute:v,setVolume:w,setDurationPercent:A,setTime:E}]}var en=T(q(),1),Cu=T(G(),1),G0=(0,en.createContext)(null),X0=(0,en.createContext)(null),$0=(0,en.createContext)(null);function mE(){let e=(0,en.useContext)(G0);if(!e)throw new Error("Ctx not found");return e}function gE(){let e=(0,en.useContext)(X0);if(!e)throw new Error("Ctx not found");return e}function vE(){let e=(0,en.useContext)($0);if(!e)throw new Error("Ctx not found");return e}function Yo({actions:e,state:t,children:r,currentTime:n,progress:o,element:a}){return(0,Cu.jsx)($0.Provider,{value:{currentTime:n,progress:o,element:a},children:(0,Cu.jsx)(X0.Provider,{value:e,children:(0,Cu.jsx)(G0.Provider,{value:t,children:r})})})}var Ru=T(G(),1);function pf({media:e,children:t}){let[{element:r,currentTime:n,progress:o},a,u]=Hn({duration:e.duration});return(0,Ru.jsxs)(Yo,{state:a,actions:u,currentTime:n,progress:o,element:r,children:[(0,Ru.jsx)("audio",{ref:r,src:e.url}),t]})}function Pu({media:e,mediaControlsDeps:t,children:r}){return jr("portal","audio",pf,{media:e,children:r},[e,...t||[]]),null}var Go=T(G(),1);function mf({element:e,media:t,playPause:r}){return(0,Go.jsxs)("div",{className:"video-container",part:"video-container",onClick:r,children:[(0,Go.jsx)("style",{children:`
|
|
78
|
+
.video-container {
|
|
79
|
+
position: absolute;
|
|
80
|
+
top: 0;
|
|
81
|
+
bottom: 0;
|
|
82
|
+
left: 0;
|
|
83
|
+
right: 0;
|
|
84
|
+
background: #000;
|
|
85
|
+
z-index: 13;
|
|
86
|
+
display: flex;
|
|
87
|
+
justify-content: center;
|
|
88
|
+
pointer-events: visible;
|
|
89
|
+
}
|
|
90
|
+
`}),(0,Go.jsx)("video",{ref:e,src:t.url,style:{width:"100%",objectFit:"contain"}})]})}function Tu({media:e,mediaControlsDeps:t,children:r}){let[{element:n,currentTime:o,progress:a},u,h]=Hn({duration:e.duration});return jr("overlay","video-element",mf,{element:n,media:e,playPause:h.playPause}),jr("portal","custom-controls",Yo,{state:u,actions:h,currentTime:o,progress:a,element:n,children:r},[o,u,e,...t||[]]),null}var tn=T(G(),1);function gf({model:e}){return(0,tn.jsxs)(tn.Fragment,{children:[(0,tn.jsx)("style",{children:`
|
|
91
|
+
.model-container {
|
|
92
|
+
position: absolute;
|
|
93
|
+
top: 0;
|
|
94
|
+
bottom: 0;
|
|
95
|
+
left: 0;
|
|
96
|
+
right: 0;
|
|
97
|
+
background: #000;
|
|
98
|
+
z-index: 13;
|
|
99
|
+
display: flex;
|
|
100
|
+
justify-content: center;
|
|
101
|
+
pointer-events: visible;
|
|
102
|
+
}
|
|
103
|
+
`}),(0,tn.jsx)("div",{className:"model-container",children:(0,tn.jsx)("model-viewer",{"interaction-prompt":"none",style:{width:"100%",height:"100%"},"camera-controls":"","ar-status":"not-presenting",src:e.id})})]})}function Iu({model:e,name:t}){return jr("overlay",`model-${t}`,gf,{model:e},[e]),null}var Z0=T(G(),1);function _u({style:e}){let t=nt();return!t||!t.height||!t.width?null:(0,Z0.jsx)("box",{interactive:!1,target:{x:0,y:0,width:Number(t.width),height:Number(t.height)},style:e})}var K0=T(q(),1),Xo=T(G(),1);function yE({element:e,media:t,playPause:r}){let n=(0,K0.useRef)(null);return t.youTubeId?(0,Xo.jsxs)("div",{className:"video-container",part:"video-container",onClick:r,children:[(0,Xo.jsx)("style",{children:`
|
|
104
|
+
.video-container {
|
|
105
|
+
position: absolute;
|
|
106
|
+
top: 0;
|
|
107
|
+
bottom: 0;
|
|
108
|
+
left: 0;
|
|
109
|
+
right: 0;
|
|
110
|
+
background: #000;
|
|
111
|
+
z-index: 13;
|
|
112
|
+
display: flex;
|
|
113
|
+
justify-content: center;
|
|
114
|
+
pointer-events: visible;
|
|
115
|
+
}
|
|
116
|
+
.video-yt {
|
|
117
|
+
border: none;
|
|
118
|
+
width: 100%;
|
|
119
|
+
object-fit: contain;
|
|
120
|
+
}
|
|
121
|
+
`}),(0,Xo.jsx)("iframe",{className:"video-yt",ref:n,src:`https://www.youtube.com/embed/${t.youTubeId}?enablejsapi=1&origin=${window.location.host}`,referrerPolicy:"no-referrer",sandbox:"allow-scripts allow-same-origin allow-presentation"})]}):null}function J0({media:e,mediaControlsDeps:t,children:r}){let[{element:n,currentTime:o,progress:a},u,h]=Hn({duration:e.duration});return jr("overlay","video-element",yE,{element:n,media:e,playPause:h.playPause}),null}var ze=T(G(),1);function vf({x:e,y:t,onChoiceChange:r,registerActions:n,defaultChoices:o,isStatic:a,renderViewerControls:u,renderMediaControls:h,viewControlsDeps:f,mediaControlsDeps:g,strategies:p,throwOnUnknown:v,backgroundStyle:x,alwaysShowBackground:b,keepCanvasScale:w=!1,enableSizes:A=!1,enableYouTube:E=!0,onClickPaintingAnnotation:P,children:I}){let F=nt(),X=No(F,["deep-zoom"]),[W]=Ud(),L=Vd(),N=be(),D=(0,oi.useMemo)(()=>Fn(N),[N]),[j,se]=df({strategies:p||["images"],defaultChoices:o?.map(({id:ce})=>ce)}),ee=j.type==="images"?j.choice:void 0,he=(0,oi.useMemo)(()=>w?1:Math.max(1,...j.type==="images"?j.images.map(ce=>(ce.width||0)/ce.target?.spatial.width):[]),[w,j]);S0(he),(0,oi.useEffect)(()=>{n&&n(se)},[j.annotations]),(0,oi.useEffect)(()=>{if(o)for(let ce of o)typeof ce.opacity<"u"&&D.applyStyles({id:ce.id},"atlas",{opacity:ce.opacity})},[o]),(0,oi.useLayoutEffect)(()=>{r&&r(ee)},[ee]),jr(L&&(j.type==="images"||j.type==="empty"||j.type==="textual-content"&&u)?"overlay":"none",`canvas-portal-controls-${F?.id}`,zs.Provider,u?{value:L||null,children:u(j)}:{},[F,L,j,...f||[]]);let Ae=Qo({maxWidth:256,maxHeight:256});if(!F)return null;let Re=F.accompanyingCanvas,Te=Ae&&Ae.type==="fixed"?(0,ze.jsx)("world-object",{height:F.height,width:F.width,x:e,y:t,children:(0,ze.jsx)("world-image",{uri:Ae.id,target:{x:0,y:0,width:F.width,height:F.height},display:Ae.width&&Ae.height?{width:Ae.width,height:Ae.height}:void 0,crop:void 0})}):null;if(j.type==="unknown"){if(Te)return Te;if(v)throw new Error(j.reason||"Unknown image strategy");return null}let ge=(0,ze.jsxs)(oi.Fragment,{children:[W?(0,ze.jsx)(Uo,{page:W}):null,j.annotations&&j.annotations.pages?j.annotations.pages.map(ce=>(0,ze.jsx)(Uo,{page:ce},ce.id)):null,I]}),lt=j.type==="images"?j.images.length:0;return(0,ze.jsxs)(ze.Fragment,{children:[(0,ze.jsxs)("world-object",{height:F.height,width:F.width,x:e,y:t,...X,children:[j.type==="empty"||b?(0,ze.jsx)(_u,{style:x}):null,j.type==="textual-content"?j.items.map((ce,st)=>(0,ze.jsxs)(ze.Fragment,{children:[(0,ze.jsx)(fs,{onClick:P?Pe=>{Pe.stopPropagation(),P(ce.annotationId,ce,Pe)}:void 0,target:ce.target?.spatial||void 0,children:(0,ze.jsx)("div",{"data-textual-content":!0,children:(0,ze.jsx)(fr,{enableDangerouslySetInnerHTML:!0,children:ce.text})})},st),ge]})):null,j.type==="images"?(0,ze.jsxs)(ze.Fragment,{children:[j.images.map((ce,st)=>(0,ze.jsx)(bu,{isStatic:a,image:ce,id:ce.id,thumbnail:st===0?Ae:void 0,selector:ce.selector,enableSizes:A,onClick:P?Pe=>{Pe.stopPropagation(),P(ce.annotationId,ce,Pe)}:void 0},ce.id+st)),ge]}):null,j.type==="3d-model"?(0,ze.jsx)(Iu,{model:j.model}):null,j.type==="media"?(0,ze.jsx)(ze.Fragment,{children:j.media.type==="Sound"?(0,ze.jsxs)(Pu,{media:j.media,mediaControlsDeps:g,children:[Te,h?h(j):null]}):j.media.type==="Video"?(0,ze.jsxs)(Tu,{media:j.media,mediaControlsDeps:g,children:[Te,h?h(j):null]}):j.media.type==="VideoYouTube"&&E?(0,ze.jsxs)(J0,{media:j.media,mediaControlsDeps:g,children:[Te,h?h(j):null]}):null}):null]},`${F.id}/${j.type}/${lt}`),j.type==="media"&&j.media.type==="Sound"&&Re?(0,ze.jsx)(wi,{canvas:Re.id,children:(0,ze.jsx)(vf,{renderViewerControls:u})}):null]})}var rr=T(G(),1),xE=(0,$o.forwardRef)(function(t,r){let n=bt(),o=Io(),a=Lo(),{ViewerControls:u,MediaControls:h}=t.components||{};if((0,$o.useImperativeHandle)(r,()=>a,[a]),!n)return(0,rr.jsx)("div",{});let f=0;return(0,rr.jsxs)(rr.Fragment,{children:[t.header,(0,rr.jsx)(_t.Viewer,{height:t.height,mode:t.mode,children:o.map((g,p)=>{let v=f;return f+=g.width+(t.spacing||0),(0,rr.jsx)(wi,{canvas:g.id,children:(0,rr.jsx)(_t.RenderCanvas,{strategies:["3d-model","media","images","empty","textual-content"],renderViewerControls:p===0&&u?()=>(0,rr.jsx)(u,{}):void 0,renderMediaControls:p===0&&h?()=>(0,rr.jsx)(h,{}):void 0,x:v,...t.canvasProps||{},children:t.annotations},g.id)},g.id)})},t.reuseAtlas?"":a.currentSequenceIndex),t.children]})}),_t=(0,$o.forwardRef)(function({children:t,height:r,annotations:n,canvasProps:o,spacing:a,header:u,components:h,mode:f,reuseAtlas:g,...p},v){let x=In();return(0,rr.jsx)(Tn,{vault:x,children:(0,rr.jsx)(zd,{...p,children:(0,rr.jsx)(xE,{ref:v,height:r,components:h,spacing:a,canvasProps:o,annotations:n,header:u,mode:f,reuseAtlas:g,children:t})})})});_t.RenderImage=bu;_t.RenderCanvas=vf;_t.RenderAnnotationPage=Uo;_t.RenderAnnotation=wu;_t.Viewer=w0;_t.CanvasBackground=_u;_t.Audio=Pu;_t.Video=Tu;_t.Model=Iu;_t.AudioHTML=pf;_t.VideoHTML=mf;_t.ModelHTML=gf;var Ou=T(q(),1),Zo=T(G(),1),SE=(0,Ou.forwardRef)(function({canvasId:t},r){let n=vv(),o=qo(t||n?.id),a=be();return(0,Ou.useImperativeHandle)(r,()=>o,[t,n]),!n||o.enabledPageIds.length===0?null:(0,Zo.jsx)(Zo.Fragment,{children:o.enabledPageIds.map(u=>(0,Zo.jsx)(_t.RenderAnnotationPage,{page:a.get(u)},u))})});var tx=T(q(),1);var ex=T(q(),1);var vt=T(G(),1);function Ko({metadata:e=[],config:t,labelWidth:r=16,showEmptyMessage:n=!0,allowHtml:o,emptyFallback:a,classes:u={},emptyMessage:h="No metadata available",emptyValueFallback:f="No value",emptyLabelFallback:g="",separator:p,tableFooter:v,tableHeader:x}){let b=(0,ex.useMemo)(()=>{let A=(t||[]).reduce((P,I)=>[...P,...I.keys],[]),E={};for(let P of e){let I=P&&P.label?Object.values(P.label):[];for(let F of I)if(F&&F.length&&(A.indexOf(`metadata.${F[0]}`)!==-1||A.length===0)&&P){let X=`metadata.${F[0]}`;E[X]=E[X]?E[X]:[],E[X].push(P);break}}return E},[t,e]);return Object.keys(b).length===0&&n?(0,vt.jsx)(vt.Fragment,{children:a})||(0,vt.jsx)("div",{className:u.empty,children:h}):t&&t.length?(0,vt.jsxs)("table",{className:u.container,children:[x,(0,vt.jsx)("tbody",{children:t.map((A,E)=>{let P=[];for(let I of A.keys)for(let F of b[I]||[])P.push((0,vt.jsx)(fr,{enableDangerouslySetInnerHTML:o,defaultText:f,separator:p,children:F.value},E+"__"+I));return P.length===0?null:(0,vt.jsxs)("tr",{className:u.row,children:[(0,vt.jsx)("td",{className:u.label,style:r?{minWidth:r}:{},children:(0,vt.jsx)(fr,{enableDangerouslySetInnerHTML:o,separator:p,defaultText:g,children:A.label})}),(0,vt.jsx)("td",{className:u.value,children:P})]},E)})}),v]}):(0,vt.jsxs)("table",{className:u.container,children:[x,(0,vt.jsx)("tbody",{children:e&&e.length?e.map((A,E)=>A?(0,vt.jsxs)("tr",{className:u.row,children:[(0,vt.jsx)("td",{className:u.label,style:r?{minWidth:r}:{},children:(0,vt.jsx)(fr,{enableDangerouslySetInnerHTML:o,defaultText:f,separator:p,children:A.label})}),(0,vt.jsx)("td",{className:u.value,children:(0,vt.jsx)(fr,{enableDangerouslySetInnerHTML:o,defaultText:f,separator:p,children:A.value})})]},E):null):null}),v]})}var rx=T(G(),1);function wE(e){let t=bt(),r=nt(),n=_o(),o=(0,tx.useMemo)(()=>{let a=t?.metadata||[],u=r?.metadata||[],h=n?.metadata||[];return[...a,...u,...h]},[t,r,n]);return(0,rx.jsx)(Ko,{metadata:o,...e})}var ku=T(q(),1);var ix=T(q(),1);function Mu(e,t={},r=[]){return(0,ix.useMemo)(()=>{if(!e)return null;let n=t.quality;e&&e.extraQualities&&t.quality&&(e.extraQualities.includes(t.quality)||(n="default"));let o=bh(e);return Eh({identifier:o.identifier,server:o.server,scheme:o.scheme,type:"image",size:{max:!t.size?.width&&!t.size?.height,confined:!1,upscaled:!1,...t.size||{}},format:t.format||"jpg",region:t.region||{full:!0},rotation:t?.rotation?Number.isInteger(t.rotation)?{angle:t.rotation}:t.rotation:{angle:0},quality:n||"default",prefix:o.prefix,originalPath:o.originalPath})},[...r])}var Jo=T(G(),1);function AE(e){let t=typeof e.src=="string"?e.src:e.src.id,r=Ei(),[n,o]=(0,ku.useState)(!1),a;if(t){let h=r.loadServiceSync({id:t});h&&(a=h)}!a&&!n&&r.loadService({id:t}).then(()=>{o(!0)});let u=Mu(a,{size:e.size,selector:e.region,rotation:e.rotation,format:e.format,region:e.region,quality:e.quality},[n,e.src,e.size,e.region,e.rotation,e.format,e.region,e.quality]);return(0,ku.useEffect)(()=>()=>{o(!1)},[t]),u?(0,Jo.jsx)("img",{src:u,alt:e.alt,className:e.className,style:e.style}):(0,Jo.jsx)(nx,{...e,fetchImageService:!1})}function nx(e){if(e.fetchImageService)return(0,Jo.jsx)(AE,{...e});let t=typeof e.src=="string"?{id:e.src,profile:"level0"}:e.src,r=Mu(t,{size:e.size,selector:e.region,rotation:e.rotation,format:e.format,region:e.region,quality:e.quality},[e.src,e.size,e.region,e.rotation,e.format,e.region,e.quality]);return r?(0,Jo.jsx)("img",{src:r,alt:e.alt,className:e.className,style:e.style}):null}var sx=T(G(),1);function bE(e){let t=bt();return(0,sx.jsx)(Ko,{metadata:t?.metadata||[],...e})}var Lu=T(q(),1);var yf=T(ax(),1);var ir=T(G(),1),{LazyLoadComponent:EE}=yf||yf.default;function xf(e){let{size:t,visible:r,classes:n,canvasId:o,figure:a}=e,u=t?.width||128,h=t?.height||t?.width||128,f=(0,ir.jsx)(CE,{...e}),g=(0,ir.jsx)(EE,{threshold:300,style:{height:h,width:u},visibleByDefault:r,children:o?(0,ir.jsx)(wi,{canvas:o,children:f}):f});return a?(0,ir.jsx)("figure",{className:n?.figure,children:g}):g}function CE({fallback:e,size:t,classes:r,showLabel:n,alt:o,dereference:a=!1}){let u=nt(),h=t?.width||128,f=t?.height||t?.width||128,g=o||Kd(u?.label)||"",p=Qo({width:h,height:f},a);return!p||p.type!=="fixed"?(0,ir.jsx)(ir.Fragment,{children:e}):(0,ir.jsxs)(ir.Fragment,{children:[(0,ir.jsx)("div",{className:r?.imageWrapper,children:(0,ir.jsx)("img",{className:r?.img,src:p.id,alt:g})}),n?(0,ir.jsx)(fr,{as:"figcaption",className:r?.label,children:u?.label}):null]})}var Ds=T(G(),1);function PE({flat:e,size:t,classes:r={},showLabel:n,figure:o,fallback:a}){let u=(0,Lu.useRef)(null),{items:h,sequence:f,currentSequenceIndex:g,setSequenceIndex:p}=Lo(),v={row:r.selected?.row||r.row,item:r.selected?.item||r.item,figure:r.selected?.figure||r.figure,img:r.selected?.img||r.img,label:r.selected?.label||r.label,imageWrapper:r.selected?.imageWrapper||r.imageWrapper};(0,Lu.useLayoutEffect)(()=>{if(!u.current)return;let b=u.current.querySelector("[data-selected=true]");b&&b.scrollIntoView({behavior:"smooth",block:"nearest",inline:"center"})},[g]);let x=[];for(let b of f){let w=[],A=f[g]===b;for(let E of b){let P=h[E];w.push((0,Ds.jsx)("div",{className:A?v.item:r.item,children:(0,Ds.jsx)(xf,{classes:A?v:r,canvasId:P.id,size:t,showLabel:n,figure:o,placeholder:(0,Ds.jsx)("div",{style:{height:128,width:128}}),fallback:a})},E))}if(e){x.push(w);continue}x.push((0,Ds.jsx)("div",{onClick:E=>{p(f.indexOf(b))},"data-selected":A,className:A?v.row:r.row,children:w}))}return(0,Ds.jsx)("div",{ref:u,className:r.container,children:x})}var lx=T(G(),1);function RE({annotation:e,children:t}){return(0,lx.jsx)(Vt,{value:{annotation:e},children:t})}var ux=T(G(),1);function TE({annotationPage:e,children:t}){return(0,ux.jsx)(Vt,{value:{annotationPage:e},children:t})}var cx=T(G(),1);function IE({collection:e,children:t}){return(0,cx.jsx)(Vt,{value:{collection:e},children:t})}function _E(e,t={}){return Vn(t)}function OE(e,t=!1){}function ME(e){let r=Ft().manifest,n=e?e.map(o=>typeof o=="string"?o:o?.id):[];return ke(o=>{let a=r?o.iiif.entities.Manifest[r]:void 0,u=a?.items||[];if(typeof e>"u")return u;let h=[];for(let f of a?.items||[])n.indexOf(f.id)!==-1&&h.push(f);return h},[n.join("/")])}var hx=T(q(),1);function kE(e,t=[]){let{id:r,selector:n}=e,o=Ft(),a=r||o.collection,u=ke(h=>a?h.iiif.entities.Collection[a]:void 0,[a]);return(0,hx.useMemo)(()=>{if(u)return n?n(u):u},[u,n,...t])}var zu=T(q(),1);function LE(e,t,r,n,o=[]){let a=be(),u=(0,zu.useMemo)(()=>zo(a),[a]);(0,zu.useEffect)(()=>{let h=e;return h?(u.addEventListener(h,t,r,n),()=>{u.removeEventListener(h,t,r)}):()=>{}},[u,e,t,...o])}function zE(e,t){let{id:r,isLoaded:n,error:o,resource:a,requestId:u,cached:h}=To(e,t);return{id:r,isLoaded:n,error:o,manifest:a,requestId:u,cached:h}}var ai=T(q(),1);function Sf({cacheKey:e}={}){let t=nt(),r=Vn(),n=be(),o=Ei(),[a,u]=(0,ai.useState)(void 0),[h,f]=(0,ai.useState)(!1),[g,p]=(0,ai.useState)("idle"),[v,x]=(0,ai.useState)(void 0),b=t?t.id:"undefined",w=(0,ai.useMemo)(()=>{try{if(t&&r.length){let E=r[0],P=n.get(E.body[0]),F=vn(P)[0];return F&&o.loadServiceSync({id:F.id||F["@id"],width:F.width||t.width,height:F.height||t.height})||void 0}}catch(E){console.error(E)}},[b,e,t]),A=g==="success"&&a?a:w;return(0,ai.useEffect)(()=>{(async()=>{try{if(t&&r.length){let E=r[0],P=n.get(E.body[0]),F=vn(P)[0];if(!F)return;f(!0),p("loading");try{let X=await o.loadService({id:F.id||F["@id"],width:F.width||t.width,height:F.height||t.height})||void 0;u(X),p("success"),f(!1)}catch(X){p("error"),x(X)}}}catch(E){p("error"),x(E)}})()},[b,e]),(0,ai.useMemo)(()=>({data:A,isFetching:h,status:g,error:v}),[A,h,g,v])}function NE(){let e=Sf();return{isLoading:e.isFetching,tile:e.data?{id:e.data.id||e.data["@id"],width:e.data.width,height:e.data.height,imageService:e.data,thumbnail:void 0}:null}}var dx=T(q(),1);function FE(){let e=be();return(0,dx.useMemo)(()=>Fn(e),[e])}return IS(DE);})();
|
|
122
|
+
/*! Bundled license information:
|
|
123
|
+
|
|
124
|
+
normalize-wheel/src/isEventSupported.js:
|
|
125
|
+
(**
|
|
126
|
+
* Checks if an event is supported in the current execution environment.
|
|
127
|
+
*
|
|
128
|
+
* NOTE: This will not work correctly for non-generic events such as `change`,
|
|
129
|
+
* `reset`, `load`, `error`, and `select`.
|
|
130
|
+
*
|
|
131
|
+
* Borrows from Modernizr.
|
|
132
|
+
*
|
|
133
|
+
* @param {string} eventNameSuffix Event name, e.g. "click".
|
|
134
|
+
* @param {?boolean} capture Check if the capture phase is supported.
|
|
135
|
+
* @return {boolean} True if the event is supported.
|
|
136
|
+
* @internal
|
|
137
|
+
* @license Modernizr 3.0.0pre (Custom Build) | MIT
|
|
138
|
+
*)
|
|
139
|
+
|
|
140
|
+
react/cjs/react-jsx-runtime.production.min.js:
|
|
141
|
+
(**
|
|
142
|
+
* @license React
|
|
143
|
+
* react-jsx-runtime.production.min.js
|
|
144
|
+
*
|
|
145
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
146
|
+
*
|
|
147
|
+
* This source code is licensed under the MIT license found in the
|
|
148
|
+
* LICENSE file in the root directory of this source tree.
|
|
149
|
+
*)
|
|
150
|
+
|
|
151
|
+
scheduler/cjs/scheduler.production.min.js:
|
|
152
|
+
(**
|
|
153
|
+
* @license React
|
|
154
|
+
* scheduler.production.min.js
|
|
155
|
+
*
|
|
156
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
157
|
+
*
|
|
158
|
+
* This source code is licensed under the MIT license found in the
|
|
159
|
+
* LICENSE file in the root directory of this source tree.
|
|
160
|
+
*)
|
|
161
|
+
|
|
162
|
+
react-reconciler/cjs/react-reconciler.production.min.js:
|
|
163
|
+
(**
|
|
164
|
+
* @license React
|
|
165
|
+
* react-reconciler.production.min.js
|
|
166
|
+
*
|
|
167
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
168
|
+
*
|
|
169
|
+
* This source code is licensed under the MIT license found in the
|
|
170
|
+
* LICENSE file in the root directory of this source tree.
|
|
171
|
+
*)
|
|
172
|
+
|
|
173
|
+
use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js:
|
|
174
|
+
(**
|
|
175
|
+
* @license React
|
|
176
|
+
* use-sync-external-store-shim.production.min.js
|
|
177
|
+
*
|
|
178
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
179
|
+
*
|
|
180
|
+
* This source code is licensed under the MIT license found in the
|
|
181
|
+
* LICENSE file in the root directory of this source tree.
|
|
182
|
+
*)
|
|
183
|
+
|
|
184
|
+
use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.js:
|
|
185
|
+
(**
|
|
186
|
+
* @license React
|
|
187
|
+
* use-sync-external-store-shim/with-selector.production.min.js
|
|
188
|
+
*
|
|
189
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
190
|
+
*
|
|
191
|
+
* This source code is licensed under the MIT license found in the
|
|
192
|
+
* LICENSE file in the root directory of this source tree.
|
|
193
|
+
*)
|
|
194
|
+
|
|
195
|
+
@iiif/helpers/dist/chunk-NHPZ6ZYV.js:
|
|
196
|
+
(** Code to "flatten" quadratic and cubic Bézier curves to polylines.
|
|
197
|
+
*
|
|
198
|
+
* All code in this module is based on JavaScript code by Raph Levien, published on his blog at
|
|
199
|
+
* https://raphlinus.github.io/.
|
|
200
|
+
* I merely changed the structure a bit, removed some unneeded parts and added some comments and type hints.
|
|
201
|
+
*
|
|
202
|
+
* Flattening of quadratic Bézier curves:
|
|
203
|
+
* - Article: https://raphlinus.github.io/graphics/curves/2019/12/23/flatten-quadbez.html
|
|
204
|
+
* - Code: https://github.com/raphlinus/raphlinus.github.io/blob/master/_posts/2019-12-23-flatten-quadbez.md?plain=1#L73-L212
|
|
205
|
+
*
|
|
206
|
+
* Flattening of cubic Bézier curves: https://levien.com/tmp/flatten.html
|
|
207
|
+
*
|
|
208
|
+
* Note that the code in this module has a different license than the rest of the package,
|
|
209
|
+
* due to the inclusion of Apache-licensed third party code.
|
|
210
|
+
*
|
|
211
|
+
* @license
|
|
212
|
+
* Copyright 2022 Johannes Baiter <johannes.baiter@gmail.com>
|
|
213
|
+
* Copyright 2019, 2022 Raph Levien <raph.levien@gmail.com>
|
|
214
|
+
*
|
|
215
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
216
|
+
* you may not use this file except in compliance with the License.
|
|
217
|
+
* You may obtain a copy of the License at
|
|
218
|
+
*
|
|
219
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
220
|
+
*
|
|
221
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
222
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
223
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
224
|
+
* See the License for the specific language governing permissions and
|
|
225
|
+
* limitations under the License.
|
|
226
|
+
*)
|
|
227
|
+
*/
|