react-iiif-vault 2.0.11 → 2.0.12
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 +7 -3
- package/dist/bundle.global.js +52 -46
- package/dist/canvas-panel.cjs +6 -6
- package/dist/canvas-panel.d.cts +1 -1
- package/dist/canvas-panel.d.ts +1 -1
- package/dist/canvas-panel.js +1 -1
- package/dist/{chunk-MOYFNKQ7.js → chunk-5EBWATUV.js} +6 -6
- package/dist/{index-BAwkF_tl.d.cts → index-DHghDluJ.d.cts} +5 -2
- package/dist/{index-C3XrwwYg.d.ts → index-DijgVxjb.d.ts} +5 -2
- package/dist/index.cjs +6 -6
- package/dist/index.d.cts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +1 -1
- package/package.json +2 -1
package/dist/bundle.global.js
CHANGED
|
@@ -1,36 +1,43 @@
|
|
|
1
|
-
"use strict";var ReactIIIFVault=(()=>{var WB=Object.create;var um=Object.defineProperty;var JB=Object.getOwnPropertyDescriptor;var $B=Object.getOwnPropertyNames;var tP=Object.getPrototypeOf,eP=Object.prototype.hasOwnProperty;var ui=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),nP=(t,e)=>{for(var n in e)um(t,n,{get:e[n],enumerable:!0})},Ww=(t,e,n,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of $B(e))!eP.call(t,a)&&a!==n&&um(t,a,{get:()=>e[a],enumerable:!(i=JB(e,a))||i.enumerable});return t};var _=(t,e,n)=>(n=t!=null?WB(tP(t)):{},Ww(e||!t||!t.__esModule?um(n,"default",{value:t,enumerable:!0}):n,t)),iP=t=>Ww(um({},"__esModule",{value:!0}),t);var nt=ui((gF,s2)=>{"use strict";s2.exports=React});var c2=ui(pm=>{"use strict";var DP=Symbol.for("react.transitional.element"),LP=Symbol.for("react.fragment");function u2(t,e,n){var i=null;if(n!==void 0&&(i=""+n),e.key!==void 0&&(i=""+e.key),"key"in e){n={};for(var a in e)a!=="key"&&(n[a]=e[a])}else n=e;return e=n.ref,{$$typeof:DP,type:t,key:i,ref:e!==void 0?e:null,props:n}}pm.Fragment=LP;pm.jsx=u2;pm.jsxs=u2});var Y=ui((vF,f2)=>{"use strict";f2.exports=c2()});var wM=ui(CM=>{"use strict";var Fu=nt();function W6(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var J6=typeof Object.is=="function"?Object.is:W6,$6=Fu.useState,tH=Fu.useEffect,eH=Fu.useLayoutEffect,nH=Fu.useDebugValue;function iH(t,e){var n=e(),i=$6({inst:{value:n,getSnapshot:e}}),a=i[0].inst,o=i[1];return eH(function(){a.value=n,a.getSnapshot=e,g1(a)&&o({inst:a})},[t,n,e]),tH(function(){return g1(a)&&o({inst:a}),t(function(){g1(a)&&o({inst:a})})},[t]),nH(n),n}function g1(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!J6(t,n)}catch{return!0}}function aH(t,e){return e()}var oH=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?aH:iH;CM.useSyncExternalStore=Fu.useSyncExternalStore!==void 0?Fu.useSyncExternalStore:oH});var OM=ui((rk,MM)=>{"use strict";MM.exports=wM()});var zM=ui(_M=>{"use strict";var Km=nt(),rH=OM();function lH(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var sH=typeof Object.is=="function"?Object.is:lH,uH=rH.useSyncExternalStore,cH=Km.useRef,fH=Km.useEffect,dH=Km.useMemo,hH=Km.useDebugValue;_M.useSyncExternalStoreWithSelector=function(t,e,n,i,a){var o=cH(null);if(o.current===null){var s={hasValue:!1,value:null};o.current=s}else s=o.current;o=dH(function(){function d(v){if(!p){if(p=!0,f=v,v=i(v),a!==void 0&&s.hasValue){var S=s.value;if(a(S,v))return m=S}return m=v}if(S=m,sH(f,v))return S;var E=i(v);return a!==void 0&&a(S,E)?S:(f=v,m=E)}var p=!1,f,m,g=n===void 0?null:n;return[function(){return d(e())},g===null?void 0:function(){return d(g())}]},[e,n,i,a]);var u=uH(t,o[0],o[1]);return fH(function(){s.hasValue=!0,s.value=u},[u]),hH(u),u}});var IM=ui((sk,NM)=>{"use strict";NM.exports=zM()});var lO=ui(Le=>{"use strict";function N1(t,e){var n=t.length;t.push(e);t:for(;0<n;){var i=n-1>>>1,a=t[i];if(0<eg(a,e))t[i]=e,t[n]=a,n=i;else break t}}function lo(t){return t.length===0?null:t[0]}function ig(t){if(t.length===0)return null;var e=t[0],n=t.pop();if(n!==e){t[0]=n;t:for(var i=0,a=t.length,o=a>>>1;i<o;){var s=2*(i+1)-1,u=t[s],d=s+1,p=t[d];if(0>eg(u,n))d<a&&0>eg(p,u)?(t[i]=p,t[d]=n,i=d):(t[i]=u,t[s]=n,i=s);else if(d<a&&0>eg(p,n))t[i]=p,t[d]=n,i=d;else break t}}return e}function eg(t,e){var n=t.sortIndex-e.sortIndex;return n!==0?n:t.id-e.id}Le.unstable_now=void 0;typeof performance=="object"&&typeof performance.now=="function"?(JM=performance,Le.unstable_now=function(){return JM.now()}):(O1=Date,$M=O1.now(),Le.unstable_now=function(){return O1.now()-$M});var JM,O1,$M,Bo=[],jr=[],MH=1,ya=null,ni=3,I1=!1,sd=!1,ud=!1,D1=!1,nO=typeof setTimeout=="function"?setTimeout:null,iO=typeof clearTimeout=="function"?clearTimeout:null,tO=typeof setImmediate<"u"?setImmediate:null;function ng(t){for(var e=lo(jr);e!==null;){if(e.callback===null)ig(jr);else if(e.startTime<=t)ig(jr),e.sortIndex=e.expirationTime,N1(Bo,e);else break;e=lo(jr)}}function L1(t){if(ud=!1,ng(t),!sd)if(lo(Bo)!==null)sd=!0,Wu||(Wu=!0,Zu());else{var e=lo(jr);e!==null&&B1(L1,e.startTime-t)}}var Wu=!1,cd=-1,aO=5,oO=-1;function rO(){return D1?!0:!(Le.unstable_now()-oO<aO)}function _1(){if(D1=!1,Wu){var t=Le.unstable_now();oO=t;var e=!0;try{t:{sd=!1,ud&&(ud=!1,iO(cd),cd=-1),I1=!0;var n=ni;try{e:{for(ng(t),ya=lo(Bo);ya!==null&&!(ya.expirationTime>t&&rO());){var i=ya.callback;if(typeof i=="function"){ya.callback=null,ni=ya.priorityLevel;var a=i(ya.expirationTime<=t);if(t=Le.unstable_now(),typeof a=="function"){ya.callback=a,ng(t),e=!0;break e}ya===lo(Bo)&&ig(Bo),ng(t)}else ig(Bo);ya=lo(Bo)}if(ya!==null)e=!0;else{var o=lo(jr);o!==null&&B1(L1,o.startTime-t),e=!1}}break t}finally{ya=null,ni=n,I1=!1}e=void 0}}finally{e?Zu():Wu=!1}}}var Zu;typeof tO=="function"?Zu=function(){tO(_1)}:typeof MessageChannel<"u"?(z1=new MessageChannel,eO=z1.port2,z1.port1.onmessage=_1,Zu=function(){eO.postMessage(null)}):Zu=function(){nO(_1,0)};var z1,eO;function B1(t,e){cd=nO(function(){t(Le.unstable_now())},e)}Le.unstable_IdlePriority=5;Le.unstable_ImmediatePriority=1;Le.unstable_LowPriority=4;Le.unstable_NormalPriority=3;Le.unstable_Profiling=null;Le.unstable_UserBlockingPriority=2;Le.unstable_cancelCallback=function(t){t.callback=null};Le.unstable_forceFrameRate=function(t){0>t||125<t?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):aO=0<t?Math.floor(1e3/t):5};Le.unstable_getCurrentPriorityLevel=function(){return ni};Le.unstable_next=function(t){switch(ni){case 1:case 2:case 3:var e=3;break;default:e=ni}var n=ni;ni=e;try{return t()}finally{ni=n}};Le.unstable_requestPaint=function(){D1=!0};Le.unstable_runWithPriority=function(t,e){switch(t){case 1:case 2:case 3:case 4:case 5:break;default:t=3}var n=ni;ni=t;try{return e()}finally{ni=n}};Le.unstable_scheduleCallback=function(t,e,n){var i=Le.unstable_now();switch(typeof n=="object"&&n!==null?(n=n.delay,n=typeof n=="number"&&0<n?i+n:i):n=i,t){case 1:var a=-1;break;case 2:a=250;break;case 5:a=1073741823;break;case 4:a=1e4;break;default:a=5e3}return a=n+a,t={id:MH++,callback:e,priorityLevel:t,startTime:n,expirationTime:a,sortIndex:-1},n>i?(t.sortIndex=n,N1(jr,t),lo(Bo)===null&&t===lo(jr)&&(ud?(iO(cd),cd=-1):ud=!0,B1(L1,n-i))):(t.sortIndex=a,N1(Bo,t),sd||I1||(sd=!0,Wu||(Wu=!0,Zu()))),t};Le.unstable_shouldYield=rO;Le.unstable_wrapCallback=function(t){var e=ni;return function(){var n=ni;ni=e;try{return t.apply(this,arguments)}finally{ni=n}}}});var P1=ui((lY,sO)=>{"use strict";sO.exports=lO()});var uO=ui((sY,fd)=>{"use strict";fd.exports=function(t){function e(r,l,c,h){return new n5(r,l,c,h)}function n(){}function i(r){var l="https://react.dev/errors/"+r;if(1<arguments.length){l+="?args[]="+encodeURIComponent(arguments[1]);for(var c=2;c<arguments.length;c++)l+="&args[]="+encodeURIComponent(arguments[c])}return"Minified React error #"+r+"; visit "+l+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(r){var l=r,c=r;if(r.alternate)for(;l.return;)l=l.return;else{r=l;do l=r,l.flags&4098&&(c=l.return),r=l.return;while(r)}return l.tag===3?c:null}function o(r){if(a(r)!==r)throw Error(i(188))}function s(r){var l=r.alternate;if(!l){if(l=a(r),l===null)throw Error(i(188));return l!==r?null:r}for(var c=r,h=l;;){var y=c.return;if(y===null)break;var b=y.alternate;if(b===null){if(h=y.return,h!==null){c=h;continue}break}if(y.child===b.child){for(b=y.child;b;){if(b===c)return o(y),r;if(b===h)return o(y),l;b=b.sibling}throw Error(i(188))}if(c.return!==h.return)c=y,h=b;else{for(var w=!1,I=y.child;I;){if(I===c){w=!0,c=y,h=b;break}if(I===h){w=!0,h=y,c=b;break}I=I.sibling}if(!w){for(I=b.child;I;){if(I===c){w=!0,c=b,h=y;break}if(I===h){w=!0,h=b,c=y;break}I=I.sibling}if(!w)throw Error(i(189))}}if(c.alternate!==h)throw Error(i(190))}if(c.tag!==3)throw Error(i(188));return c.stateNode.current===c?r:l}function u(r){var l=r.tag;if(l===5||l===26||l===27||l===6)return r;for(r=r.child;r!==null;){if(l=u(r),l!==null)return l;r=r.sibling}return null}function d(r){var l=r.tag;if(l===5||l===26||l===27||l===6)return r;for(r=r.child;r!==null;){if(r.tag!==4&&(l=d(r),l!==null))return l;r=r.sibling}return null}function p(r){return r===null||typeof r!="object"?null:(r=gw&&r[gw]||r["@@iterator"],typeof r=="function"?r:null)}function f(r){if(r==null)return null;if(typeof r=="function")return r.$$typeof===l5?null:r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case ru:return"Fragment";case pS:return"Profiler";case pw:return"StrictMode";case gS:return"Suspense";case yS:return"SuspenseList";case SS:return"Activity"}if(typeof r=="object")switch(r.$$typeof){case ou:return"Portal";case Er:return r.displayName||"Context";case mw:return(r._context.displayName||"Context")+".Consumer";case mS:var l=r.render;return r=r.displayName,r||(r=l.displayName||l.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case vS:return l=r.displayName||null,l!==null?l:f(r.type)||"Memo";case Ar:l=r._payload,r=r._init;try{return f(r(l))}catch{}}return null}function m(r){return{current:r}}function g(r){0>uu||(r.current=TS[uu],TS[uu]=null,uu--)}function v(r,l){uu++,TS[uu]=r.current,r.current=l}function S(r){return r>>>=0,r===0?32:31-(LB(r)/BB|0)|0}function E(r){var l=r&42;if(l!==0)return l;switch(r&-r){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:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return r&261888;case 262144:case 524288:case 1048576:case 2097152:return r&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return r&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return r}}function T(r,l,c){var h=r.pendingLanes;if(h===0)return 0;var y=0,b=r.suspendedLanes,w=r.pingedLanes;r=r.warmLanes;var I=h&134217727;return I!==0?(h=I&~b,h!==0?y=E(h):(w&=I,w!==0?y=E(w):c||(c=I&~r,c!==0&&(y=E(c))))):(I=h&~b,I!==0?y=E(I):w!==0?y=E(w):c||(c=h&~r,c!==0&&(y=E(c)))),y===0?0:l!==0&&l!==y&&!(l&b)&&(b=y&-y,c=l&-l,b>=c||b===32&&(c&4194048)!==0)?l:y}function A(r,l){return(r.pendingLanes&~(r.suspendedLanes&~r.pingedLanes)&l)===0}function x(r,l){switch(r){case 1:case 2:case 4:case 8:case 64:return l+250;case 16:case 32: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 l+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function R(){var r=Gp;return Gp<<=1,!(Gp&62914560)&&(Gp=4194304),r}function C(r){for(var l=[],c=0;31>c;c++)l.push(r);return l}function M(r,l){r.pendingLanes|=l,l!==268435456&&(r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0)}function z(r,l,c,h,y,b){var w=r.pendingLanes;r.pendingLanes=c,r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0,r.expiredLanes&=c,r.entangledLanes&=c,r.errorRecoveryDisabledLanes&=c,r.shellSuspendCounter=0;var I=r.entanglements,k=r.expirationTimes,et=r.hiddenUpdates;for(c=w&~c;0<c;){var ct=31-Hi(c),ot=1<<ct;I[ct]=0,k[ct]=-1;var gt=et[ct];if(gt!==null)for(et[ct]=null,ct=0;ct<gt.length;ct++){var Bt=gt[ct];Bt!==null&&(Bt.lane&=-536870913)}c&=~ot}h!==0&&N(r,h,0),b!==0&&y===0&&r.tag!==0&&(r.suspendedLanes|=b&~(w&~l))}function N(r,l,c){r.pendingLanes|=l,r.suspendedLanes&=~l;var h=31-Hi(l);r.entangledLanes|=l,r.entanglements[h]=r.entanglements[h]|1073741824|c&261930}function D(r,l){var c=r.entangledLanes|=l;for(r=r.entanglements;c;){var h=31-Hi(c),y=1<<h;y&l|r[h]&l&&(r[h]|=l),c&=~y}}function q(r,l){var c=l&-l;return c=c&42?1:P(c),c&(r.suspendedLanes|l)?0:c}function P(r){switch(r){case 2:r=1;break;case 8:r=4;break;case 32:r=16;break;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:r=128;break;case 268435456:r=134217728;break;default:r=0}return r}function U(r){return r&=-r,2<r?8<r?r&134217727?32:268435456:8:2}function J(r){if(typeof jB=="function"&&qB(r),Ui&&typeof Ui.setStrictMode=="function")try{Ui.setStrictMode(zf,r)}catch{}}function at(r,l){return r===l&&(r!==0||1/r===1/l)||r!==r&&l!==l}function X(r){if(MS===void 0)try{throw Error()}catch(c){var l=c.stack.trim().match(/\n( *(at )?)/);MS=l&&l[1]||"",qw=-1<c.stack.indexOf(`
|
|
1
|
+
"use strict";var ReactIIIFVault=(()=>{var l6=Object.create;var Hm=Object.defineProperty;var u6=Object.getOwnPropertyDescriptor;var c6=Object.getOwnPropertyNames;var d6=Object.getPrototypeOf,f6=Object.prototype.hasOwnProperty;var Ni=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),h6=(t,e)=>{for(var n in e)Hm(t,n,{get:e[n],enumerable:!0})},E2=(t,e,n,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of c6(e))!f6.call(t,a)&&a!==n&&Hm(t,a,{get:()=>e[a],enumerable:!(i=u6(e,a))||i.enumerable});return t};var N=(t,e,n)=>(n=t!=null?l6(d6(t)):{},E2(e||!t||!t.__esModule?Hm(n,"default",{value:t,enumerable:!0}):n,t)),p6=t=>E2(Hm({},"__esModule",{value:!0}),t);var ct=Ni((pG,P2)=>{"use strict";P2.exports=React});var H2=Ni(jm=>{"use strict";var G6=Symbol.for("react.transitional.element"),Y6=Symbol.for("react.fragment");function B2(t,e,n){var i=null;if(n!==void 0&&(i=""+n),e.key!==void 0&&(i=""+e.key),"key"in e){n={};for(var a in e)a!=="key"&&(n[a]=e[a])}else n=e;return e=n.ref,{$$typeof:G6,type:t,key:i,ref:e!==void 0?e:null,props:n}}jm.Fragment=Y6;jm.jsx=B2;jm.jsxs=B2});var tt=Ni((gG,F2)=>{"use strict";F2.exports=H2()});var eO=Ni(tO=>{"use strict";var xc=ct();function lF(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var uF=typeof Object.is=="function"?Object.is:lF,cF=xc.useState,dF=xc.useEffect,fF=xc.useLayoutEffect,hF=xc.useDebugValue;function pF(t,e){var n=e(),i=cF({inst:{value:n,getSnapshot:e}}),a=i[0].inst,r=i[1];return fF(function(){a.value=n,a.getSnapshot=e,F1(a)&&r({inst:a})},[t,n,e]),dF(function(){return F1(a)&&r({inst:a}),t(function(){F1(a)&&r({inst:a})})},[t]),hF(n),n}function F1(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!uF(t,n)}catch{return!0}}function mF(t,e){return e()}var gF=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?mF:pF;tO.useSyncExternalStore=xc.useSyncExternalStore!==void 0?xc.useSyncExternalStore:gF});var iO=Ni((aX,nO)=>{"use strict";nO.exports=eO()});var rO=Ni(aO=>{"use strict";var Rg=ct(),yF=iO();function vF(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var bF=typeof Object.is=="function"?Object.is:vF,SF=yF.useSyncExternalStore,xF=Rg.useRef,wF=Rg.useEffect,TF=Rg.useMemo,RF=Rg.useDebugValue;aO.useSyncExternalStoreWithSelector=function(t,e,n,i,a){var r=xF(null);if(r.current===null){var l={hasValue:!1,value:null};r.current=l}else l=r.current;r=TF(function(){function f(g){if(!h){if(h=!0,d=g,g=i(g),a!==void 0&&l.hasValue){var b=l.value;if(a(b,g))return m=b}return m=g}if(b=m,bF(d,g))return b;var w=i(g);return a!==void 0&&a(b,w)?b:(d=g,m=w)}var h=!1,d,m,y=n===void 0?null:n;return[function(){return f(e())},y===null?void 0:function(){return f(y())}]},[e,n,i,a]);var u=SF(t,r[0],r[1]);return wF(function(){l.hasValue=!0,l.value=u},[u]),RF(u),u}});var sO=Ni((oX,oO)=>{"use strict";oO.exports=rO()});var R_=Ni(an=>{"use strict";function ux(t,e){var n=t.length;t.push(e);t:for(;0<n;){var i=n-1>>>1,a=t[i];if(0<Hg(a,e))t[i]=e,t[n]=a,n=i;else break t}}function Lr(t){return t.length===0?null:t[0]}function qg(t){if(t.length===0)return null;var e=t[0],n=t.pop();if(n!==e){t[0]=n;t:for(var i=0,a=t.length,r=a>>>1;i<r;){var l=2*(i+1)-1,u=t[l],f=l+1,h=t[f];if(0>Hg(u,n))f<a&&0>Hg(h,u)?(t[i]=h,t[f]=n,i=f):(t[i]=u,t[l]=n,i=l);else if(f<a&&0>Hg(h,n))t[i]=h,t[f]=n,i=f;else break t}}return e}function Hg(t,e){var n=t.sortIndex-e.sortIndex;return n!==0?n:t.id-e.id}an.unstable_now=void 0;typeof performance=="object"&&typeof performance.now=="function"?(m_=performance,an.unstable_now=function(){return m_.now()}):(ox=Date,g_=ox.now(),an.unstable_now=function(){return ox.now()-g_});var m_,ox,g_,mo=[],ys=[],Pq=1,Va=null,Ti=3,cx=!1,Ff=!1,qf=!1,dx=!1,b_=typeof setTimeout=="function"?setTimeout:null,S_=typeof clearTimeout=="function"?clearTimeout:null,y_=typeof setImmediate<"u"?setImmediate:null;function Fg(t){for(var e=Lr(ys);e!==null;){if(e.callback===null)qg(ys);else if(e.startTime<=t)qg(ys),e.sortIndex=e.expirationTime,ux(mo,e);else break;e=Lr(ys)}}function fx(t){if(qf=!1,Fg(t),!Ff)if(Lr(mo)!==null)Ff=!0,zc||(zc=!0,_c());else{var e=Lr(ys);e!==null&&hx(fx,e.startTime-t)}}var zc=!1,Uf=-1,x_=5,w_=-1;function T_(){return dx?!0:!(an.unstable_now()-w_<x_)}function sx(){if(dx=!1,zc){var t=an.unstable_now();w_=t;var e=!0;try{t:{Ff=!1,qf&&(qf=!1,S_(Uf),Uf=-1),cx=!0;var n=Ti;try{e:{for(Fg(t),Va=Lr(mo);Va!==null&&!(Va.expirationTime>t&&T_());){var i=Va.callback;if(typeof i=="function"){Va.callback=null,Ti=Va.priorityLevel;var a=i(Va.expirationTime<=t);if(t=an.unstable_now(),typeof a=="function"){Va.callback=a,Fg(t),e=!0;break e}Va===Lr(mo)&&qg(mo),Fg(t)}else qg(mo);Va=Lr(mo)}if(Va!==null)e=!0;else{var r=Lr(ys);r!==null&&hx(fx,r.startTime-t),e=!1}}break t}finally{Va=null,Ti=n,cx=!1}e=void 0}}finally{e?_c():zc=!1}}}var _c;typeof y_=="function"?_c=function(){y_(sx)}:typeof MessageChannel<"u"?(lx=new MessageChannel,v_=lx.port2,lx.port1.onmessage=sx,_c=function(){v_.postMessage(null)}):_c=function(){b_(sx,0)};var lx,v_;function hx(t,e){Uf=b_(function(){t(an.unstable_now())},e)}an.unstable_IdlePriority=5;an.unstable_ImmediatePriority=1;an.unstable_LowPriority=4;an.unstable_NormalPriority=3;an.unstable_Profiling=null;an.unstable_UserBlockingPriority=2;an.unstable_cancelCallback=function(t){t.callback=null};an.unstable_forceFrameRate=function(t){0>t||125<t?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):x_=0<t?Math.floor(1e3/t):5};an.unstable_getCurrentPriorityLevel=function(){return Ti};an.unstable_next=function(t){switch(Ti){case 1:case 2:case 3:var e=3;break;default:e=Ti}var n=Ti;Ti=e;try{return t()}finally{Ti=n}};an.unstable_requestPaint=function(){dx=!0};an.unstable_runWithPriority=function(t,e){switch(t){case 1:case 2:case 3:case 4:case 5:break;default:t=3}var n=Ti;Ti=t;try{return e()}finally{Ti=n}};an.unstable_scheduleCallback=function(t,e,n){var i=an.unstable_now();switch(typeof n=="object"&&n!==null?(n=n.delay,n=typeof n=="number"&&0<n?i+n:i):n=i,t){case 1:var a=-1;break;case 2:a=250;break;case 5:a=1073741823;break;case 4:a=1e4;break;default:a=5e3}return a=n+a,t={id:Pq++,callback:e,priorityLevel:t,startTime:n,expirationTime:a,sortIndex:-1},n>i?(t.sortIndex=n,ux(ys,t),Lr(mo)===null&&t===Lr(ys)&&(qf?(S_(Uf),Uf=-1):qf=!0,hx(fx,n-i))):(t.sortIndex=a,ux(mo,t),Ff||cx||(Ff=!0,zc||(zc=!0,_c()))),t};an.unstable_shouldYield=T_;an.unstable_wrapCallback=function(t){var e=Ti;return function(){var n=Ti;Ti=e;try{return t.apply(this,arguments)}finally{Ti=n}}}});var px=Ni((RQ,E_)=>{"use strict";E_.exports=R_()});var A_=Ni((EQ,Vf)=>{"use strict";Vf.exports=function(t){function e(o,s,c,p){return new h5(o,s,c,p)}function n(){}function i(o){var s="https://react.dev/errors/"+o;if(1<arguments.length){s+="?args[]="+encodeURIComponent(arguments[1]);for(var c=2;c<arguments.length;c++)s+="&args[]="+encodeURIComponent(arguments[c])}return"Minified React error #"+o+"; visit "+s+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(o){var s=o,c=o;if(o.alternate)for(;s.return;)s=s.return;else{o=s;do s=o,s.flags&4098&&(c=s.return),o=s.return;while(o)}return s.tag===3?c:null}function r(o){if(a(o)!==o)throw Error(i(188))}function l(o){var s=o.alternate;if(!s){if(s=a(o),s===null)throw Error(i(188));return s!==o?null:o}for(var c=o,p=s;;){var v=c.return;if(v===null)break;var x=v.alternate;if(x===null){if(p=v.return,p!==null){c=p;continue}break}if(v.child===x.child){for(x=v.child;x;){if(x===c)return r(v),o;if(x===p)return r(v),s;x=x.sibling}throw Error(i(188))}if(c.return!==p.return)c=v,p=x;else{for(var O=!1,D=v.child;D;){if(D===c){O=!0,c=v,p=x;break}if(D===p){O=!0,p=v,c=x;break}D=D.sibling}if(!O){for(D=x.child;D;){if(D===c){O=!0,c=x,p=v;break}if(D===p){O=!0,p=x,c=v;break}D=D.sibling}if(!O)throw Error(i(189))}}if(c.alternate!==p)throw Error(i(190))}if(c.tag!==3)throw Error(i(188));return c.stateNode.current===c?o:s}function u(o){var s=o.tag;if(s===5||s===26||s===27||s===6)return o;for(o=o.child;o!==null;){if(s=u(o),s!==null)return s;o=o.sibling}return null}function f(o){var s=o.tag;if(s===5||s===26||s===27||s===6)return o;for(o=o.child;o!==null;){if(o.tag!==4&&(s=f(o),s!==null))return s;o=o.sibling}return null}function h(o){return o===null||typeof o!="object"?null:(o=kC&&o[kC]||o["@@iterator"],typeof o=="function"?o:null)}function d(o){if(o==null)return null;if(typeof o=="function")return o.$$typeof===v5?null:o.displayName||o.name||null;if(typeof o=="string")return o;switch(o){case Hu:return"Fragment";case Bb:return"Profiler";case VC:return"StrictMode";case Fb:return"Suspense";case qb:return"SuspenseList";case Vb:return"Activity"}if(typeof o=="object")switch(o.$$typeof){case Bu:return"Portal";case Zo:return o.displayName||"Context";case jC:return(o._context.displayName||"Context")+".Consumer";case Hb:var s=o.render;return o=o.displayName,o||(o=s.displayName||s.name||"",o=o!==""?"ForwardRef("+o+")":"ForwardRef"),o;case Ub:return s=o.displayName||null,s!==null?s:d(o.type)||"Memo";case Wo:s=o._payload,o=o._init;try{return d(o(s))}catch{}}return null}function m(o){return{current:o}}function y(o){0>Uu||(o.current=Qb[Uu],Qb[Uu]=null,Uu--)}function g(o,s){Uu++,Qb[Uu]=o.current,o.current=s}function b(o){return o>>>=0,o===0?32:31-(YB(o)/XB|0)|0}function w(o){var s=o&42;if(s!==0)return s;switch(o&-o){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:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return o&261888;case 262144:case 524288:case 1048576:case 2097152:return o&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return o&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return o}}function E(o,s,c){var p=o.pendingLanes;if(p===0)return 0;var v=0,x=o.suspendedLanes,O=o.pingedLanes;o=o.warmLanes;var D=p&134217727;return D!==0?(p=D&~x,p!==0?v=w(p):(O&=D,O!==0?v=w(O):c||(c=D&~o,c!==0&&(v=w(c))))):(D=p&~x,D!==0?v=w(D):O!==0?v=w(O):c||(c=p&~o,c!==0&&(v=w(c)))),v===0?0:s!==0&&s!==v&&!(s&x)&&(x=v&-v,c=s&-s,x>=c||x===32&&(c&4194048)!==0)?s:v}function T(o,s){return(o.pendingLanes&~(o.suspendedLanes&~o.pingedLanes)&s)===0}function S(o,s){switch(o){case 1:case 2:case 4:case 8:case 64:return s+250;case 16:case 32: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:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function R(){var o=bm;return bm<<=1,!(bm&62914560)&&(bm=4194304),o}function A(o){for(var s=[],c=0;31>c;c++)s.push(o);return s}function M(o,s){o.pendingLanes|=s,s!==268435456&&(o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0)}function z(o,s,c,p,v,x){var O=o.pendingLanes;o.pendingLanes=c,o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0,o.expiredLanes&=c,o.entangledLanes&=c,o.errorRecoveryDisabledLanes&=c,o.shellSuspendCounter=0;var D=o.entanglements,$=o.expirationTimes,ut=o.hiddenUpdates;for(c=O&~c;0<c;){var Et=31-ua(c),bt=1<<Et;D[Et]=0,$[Et]=-1;var _t=ut[Et];if(_t!==null)for(ut[Et]=null,Et=0;Et<_t.length;Et++){var oe=_t[Et];oe!==null&&(oe.lane&=-536870913)}c&=~bt}p!==0&&I(o,p,0),x!==0&&v===0&&o.tag!==0&&(o.suspendedLanes|=x&~(O&~s))}function I(o,s,c){o.pendingLanes|=s,o.suspendedLanes&=~s;var p=31-ua(s);o.entangledLanes|=s,o.entanglements[p]=o.entanglements[p]|1073741824|c&261930}function L(o,s){var c=o.entangledLanes|=s;for(o=o.entanglements;c;){var p=31-ua(c),v=1<<p;v&s|o[p]&s&&(o[p]|=s),c&=~v}}function H(o,s){var c=s&-s;return c=c&42?1:V(c),c&(o.suspendedLanes|s)?0:c}function V(o){switch(o){case 2:o=1;break;case 8:o=4;break;case 32:o=16;break;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:o=128;break;case 268435456:o=134217728;break;default:o=0}return o}function nt(o){return o&=-o,2<o?8<o?o&134217727?32:268435456:8:2}function X(o){if(typeof JB=="function"&&$B(o),ca&&typeof ca.setStrictMode=="function")try{ca.setStrictMode(of,o)}catch{}}function mt(o,s){return o===s&&(o!==0||1/o===1/s)||o!==o&&s!==s}function lt(o){if(Wb===void 0)try{throw Error()}catch(c){var s=c.stack.trim().match(/\n( *(at )?)/);Wb=s&&s[1]||"",g2=-1<c.stack.indexOf(`
|
|
2
2
|
at`)?" (<anonymous>)":-1<c.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
3
|
-
`+
|
|
4
|
-
`),
|
|
5
|
-
`);for(
|
|
6
|
-
|
|
7
|
-
Error generating stack: `+
|
|
8
|
-
`+h.stack}}function lt(r,l){if(typeof r=="object"&&r!==null){var c=Fw.get(r);return c!==void 0?c:(l={value:r,source:l,stack:xt(l)},Fw.set(r,l),l)}return{value:r,source:l,stack:xt(l)}}function dt(r,l){fu[du++]=Nf,fu[du++]=Yp,Yp=r,Nf=l}function Rt(r,l,c){ua[ca++]=no,ua[ca++]=io,ua[ca++]=Rr,Rr=r;var h=no;r=io;var y=32-Hi(h)-1;h&=~(1<<y),c+=1;var b=32-Hi(l)+y;if(30<b){var w=y-y%5;b=(h&(1<<w)-1).toString(32),h>>=w,y-=w,no=1<<32-Hi(l)+y|c<<y|h,io=b+r}else no=1<<b|c<<y|h,io=r}function K(r){r.return!==null&&(dt(r,1),Rt(r,1,0))}function Ct(r){for(;r===Yp;)Yp=fu[--du],fu[du]=null,Nf=fu[--du],fu[du]=null;for(;r===Rr;)Rr=ua[--ca],ua[ca]=null,io=ua[--ca],ua[ca]=null,no=ua[--ca],ua[ca]=null}function ee(r,l){ua[ca++]=no,ua[ca++]=io,ua[ca++]=Rr,no=l.id,io=l.overflow,Rr=r}function ce(r,l){v(Tr,l),v(If,r),v(Vn,null),r=c5(l),g(Vn),v(Vn,r)}function le(){g(Vn),g(If),g(Tr)}function pe(r){r.memoizedState!==null&&v(Qp,r);var l=Vn.current,c=f5(l,r.type);l!==c&&(v(If,r),v(Vn,c))}function De(r){If.current===r&&(g(Vn),g(If)),Qp.current===r&&(g(Qp),Ao?Gl._currentValue=lu:Gl._currentValue2=lu)}function ne(r){var l=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Mn(lt(l,r)),_S}function Di(r,l){if(!$n)throw Error(i(175));fB(r.stateNode,r.type,r.memoizedProps,l,r)||ne(r,!0)}function ri(r){for(jn=r.return;jn;)switch(jn.tag){case 5:case 31:case 13:fa=!1;return;case 27:case 3:fa=!0;return;default:jn=jn.return}}function me(r){if(!$n||r!==jn)return!1;if(!Kt)return ri(r),Kt=!0,!1;var l=r.tag;if(En?l!==3&&l!==27&&(l!==5||Ow(r.type)&&!jp(r.type,r.memoizedProps))&&Ue&&ne(r):l!==3&&(l!==5||Ow(r.type)&&!jp(r.type,r.memoizedProps))&&Ue&&ne(r),ri(r),l===13){if(!$n)throw Error(i(316));if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(i(317));Ue=gB(r)}else if(l===31){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(i(317));Ue=mB(r)}else Ue=En&&l===27?eB(r.type,Ue):jn?Mw(r.stateNode):null;return!0}function ge(){$n&&(Ue=jn=null,Kt=!1)}function $t(){var r=Cr;return r!==null&&(xi===null?xi=r:xi.push.apply(xi,r),Cr=null),r}function Mn(r){Cr===null?Cr=[r]:Cr.push(r)}function St(r,l,c){Ao?(v(Xp,l._currentValue),l._currentValue=c):(v(Xp,l._currentValue2),l._currentValue2=c)}function It(r){var l=Xp.current;Ao?r._currentValue=l:r._currentValue2=l,g(Xp)}function te(r,l,c){for(;r!==null;){var h=r.alternate;if((r.childLanes&l)!==l?(r.childLanes|=l,h!==null&&(h.childLanes|=l)):h!==null&&(h.childLanes&l)!==l&&(h.childLanes|=l),r===c)break;r=r.return}}function Hn(r,l,c,h){var y=r.child;for(y!==null&&(y.return=r);y!==null;){var b=y.dependencies;if(b!==null){var w=y.child;b=b.firstContext;t:for(;b!==null;){var I=b;b=y;for(var k=0;k<l.length;k++)if(I.context===l[k]){b.lanes|=c,I=b.alternate,I!==null&&(I.lanes|=c),te(b.return,c,r),h||(w=null);break t}b=I.next}}else if(y.tag===18){if(w=y.return,w===null)throw Error(i(341));w.lanes|=c,b=w.alternate,b!==null&&(b.lanes|=c),te(w,c,r),w=null}else w=y.child;if(w!==null)w.return=y;else for(w=y;w!==null;){if(w===r){w=null;break}if(y=w.sibling,y!==null){y.return=w.return,w=y;break}w=w.return}y=w}}function Zn(r,l,c,h){r=null;for(var y=l,b=!1;y!==null;){if(!b){if(y.flags&524288)b=!0;else if(y.flags&262144)break}if(y.tag===10){var w=y.alternate;if(w===null)throw Error(i(387));if(w=w.memoizedProps,w!==null){var I=y.type;Vi(y.pendingProps.value,w.value)||(r!==null?r.push(I):r=[I])}}else if(y===Qp.current){if(w=y.alternate,w===null)throw Error(i(387));w.memoizedState.memoizedState!==y.memoizedState.memoizedState&&(r!==null?r.push(Gl):r=[Gl])}y=y.return}r!==null&&Hn(l,r,c,h),l.flags|=262144}function tn(r){for(r=r.firstContext;r!==null;){var l=r.context;if(!Vi(Ao?l._currentValue:l._currentValue2,r.memoizedValue))return!0;r=r.next}return!1}function bn(r){kl=r,To=null,r=r.dependencies,r!==null&&(r.firstContext=null)}function B(r){return ft(kl,r)}function Q(r,l){return kl===null&&bn(r),ft(r,l)}function ft(r,l){var c=Ao?l._currentValue:l._currentValue2;if(l={context:l,memoizedValue:c,next:null},To===null){if(r===null)throw Error(i(308));To=l,r.dependencies={lanes:0,firstContext:l},r.flags|=524288}else To=To.next=l;return c}function ht(){return{controller:new GB,data:new Map,refCount:0}}function vt(r){r.refCount--,r.refCount===0&&kB(YB,function(){r.controller.abort()})}function j(){}function L(r){r!==hu&&r.next===null&&(hu===null?Kp=hu=r:hu=hu.next=r),Zp=!0,zS||(zS=!0,Z())}function $(r,l){if(!NS&&Zp){NS=!0;do for(var c=!1,h=Kp;h!==null;){if(!l)if(r!==0){var y=h.pendingLanes;if(y===0)var b=0;else{var w=h.suspendedLanes,I=h.pingedLanes;b=(1<<31-Hi(42|r)+1)-1,b&=y&~(w&~I),b=b&201326741?b&201326741|1:b?b|2:0}b!==0&&(c=!0,G(h,b))}else b=Qt,b=T(h,h===Ae?b:0,h.cancelPendingCommit!==null||h.timeoutHandle!==Fl),!(b&3)||A(h,b)||(c=!0,G(h,b));h=h.next}while(c);NS=!1}}function it(){Nt()}function Nt(){Zp=zS=!1;var r=0;Yl!==0&&b5()&&(r=Yl);for(var l=Si(),c=null,h=Kp;h!==null;){var y=h.next,b=Lt(h,l);b===0?(h.next=null,c===null?Kp=y:c.next=y,y===null&&(hu=c)):(c=h,(r!==0||b&3)&&(Zp=!0)),h=y}An!==0&&An!==5||$(r,!1),Yl!==0&&(Yl=0)}function Lt(r,l){for(var c=r.suspendedLanes,h=r.pingedLanes,y=r.expirationTimes,b=r.pendingLanes&-62914561;0<b;){var w=31-Hi(b),I=1<<w,k=y[w];k===-1?(!(I&c)||I&h)&&(y[w]=x(I,l)):k<=l&&(r.expiredLanes|=I),b&=~I}if(l=Ae,c=Qt,c=T(r,r===l?c:0,r.cancelPendingCommit!==null||r.timeoutHandle!==Fl),h=r.callbackNode,c===0||r===l&&(fe===2||fe===9)||r.cancelPendingCommit!==null)return h!==null&&h!==null&&CS(h),r.callbackNode=null,r.callbackPriority=0;if(!(c&3)||A(r,c)){if(l=c&-c,l===r.callbackPriority)return l;switch(h!==null&&CS(h),U(c)){case 2:case 8:c=UB;break;case 32:c=wS;break;case 268435456:c=VB;break;default:c=wS}return h=jt.bind(null,r),c=kp(c,h),r.callbackPriority=l,r.callbackNode=c,l}return h!==null&&h!==null&&CS(h),r.callbackPriority=2,r.callbackNode=null,2}function jt(r,l){if(An!==0&&An!==5)return r.callbackNode=null,r.callbackPriority=0,null;var c=r.callbackNode;if(wf()&&r.callbackNode!==c)return null;var h=Qt;return h=T(r,r===Ae?h:0,r.cancelPendingCommit!==null||r.timeoutHandle!==Fl),h===0?null:(FC(r,h,l),Lt(r,Si()),r.callbackNode!=null&&r.callbackNode===c?jt.bind(null,r):null)}function G(r,l){if(wf())return null;FC(r,l,!0)}function Z(){w5?M5(function(){Ft&6?kp(Vw,it):Nt()}):kp(Vw,it)}function mt(){if(Yl===0){var r=pu;r===0&&(r=qp,qp<<=1,!(qp&261888)&&(qp=256)),Yl=r}return Yl}function yt(r,l){if(Df===null){var c=Df=[];IS=0,pu=mt(),mu={status:"pending",value:void 0,then:function(h){c.push(h)}}}return IS++,l.then(pt,pt),l}function pt(){if(--IS===0&&Df!==null){mu!==null&&(mu.status="fulfilled");var r=Df;Df=null,pu=0,mu=null;for(var l=0;l<r.length;l++)(0,r[l])()}}function Ut(r,l){var c=[],h={status:"pending",value:null,reason:null,then:function(y){c.push(y)}};return r.then(function(){h.status="fulfilled",h.value=l;for(var y=0;y<c.length;y++)(0,c[y])(l)},function(y){for(h.status="rejected",h.reason=y,y=0;y<c.length;y++)(0,c[y])(void 0)}),h}function Ee(){var r=Ql.current;return r!==null?r:Ae.pooledCache}function ye(r,l){l===null?v(Ql,Ql.current):v(Ql,l.pool)}function ve(){var r=Ee();return r===null?null:{parent:Ao?Ve._currentValue:Ve._currentValue2,pool:r}}function Ye(r,l){if(Vi(r,l))return!0;if(typeof r!="object"||r===null||typeof l!="object"||l===null)return!1;var c=Object.keys(r),h=Object.keys(l);if(c.length!==h.length)return!1;for(h=0;h<c.length;h++){var y=c[h];if(!FB.call(l,y)||!Vi(r[y],l[y]))return!1}return!0}function He(r){return r=r.status,r==="fulfilled"||r==="rejected"}function xn(r,l,c){switch(c=r[c],c===void 0?r.push(l):c!==l&&(l.then(j,j),l=c),l.status){case"fulfilled":return l.value;case"rejected":throw r=l.reason,Bl(r),r;default:if(typeof l.status=="string")l.then(j,j);else{if(r=Ae,r!==null&&100<r.shellSuspendCounter)throw Error(i(482));r=l,r.status="pending",r.then(function(h){if(l.status==="pending"){var y=l;y.status="fulfilled",y.value=h}},function(h){if(l.status==="pending"){var y=l;y.status="rejected",y.reason=h}})}switch(l.status){case"fulfilled":return l.value;case"rejected":throw r=l.reason,Bl(r),r}throw Xl=l,gu}}function yi(r){try{var l=r._init;return l(r._payload)}catch(c){throw c!==null&&typeof c=="object"&&typeof c.then=="function"?(Xl=c,gu):c}}function $a(){if(Xl===null)throw Error(i(459));var r=Xl;return Xl=null,r}function Bl(r){if(r===gu||r===Wp)throw Error(i(483))}function Pl(r){var l=Lf;return Lf+=1,yu===null&&(yu=[]),xn(yu,r,l)}function mr(r,l){l=l.props.ref,r.ref=l!==void 0?l:null}function gp(r,l){throw l.$$typeof===o5?Error(i(525)):(r=Object.prototype.toString.call(l),Error(i(31,r==="[object Object]"?"object with keys {"+Object.keys(l).join(", ")+"}":r)))}function pT(r){function l(V,H){if(r){var F=V.deletions;F===null?(V.deletions=[H],V.flags|=16):F.push(H)}}function c(V,H){if(!r)return null;for(;H!==null;)l(V,H),H=H.sibling;return null}function h(V){for(var H=new Map;V!==null;)V.key!==null?H.set(V.key,V):H.set(V.index,V),V=V.sibling;return H}function y(V,H){return V=Eo(V,H),V.index=0,V.sibling=null,V}function b(V,H,F){return V.index=F,r?(F=V.alternate,F!==null?(F=F.index,F<H?(V.flags|=67108866,H):F):(V.flags|=67108866,H)):(V.flags|=1048576,H)}function w(V){return r&&V.alternate===null&&(V.flags|=67108866),V}function I(V,H,F,rt){return H===null||H.tag!==6?(H=cS(F,V.mode,rt),H.return=V,H):(H=y(H,F),H.return=V,H)}function k(V,H,F,rt){var Mt=F.type;return Mt===ru?ct(V,H,F.props.children,rt,F.key):H!==null&&(H.elementType===Mt||typeof Mt=="object"&&Mt!==null&&Mt.$$typeof===Ar&&yi(Mt)===H.type)?(H=y(H,F.props),mr(H,F),H.return=V,H):(H=Hp(F.type,F.key,F.props,null,V.mode,rt),mr(H,F),H.return=V,H)}function et(V,H,F,rt){return H===null||H.tag!==4||H.stateNode.containerInfo!==F.containerInfo||H.stateNode.implementation!==F.implementation?(H=fS(F,V.mode,rt),H.return=V,H):(H=y(H,F.children||[]),H.return=V,H)}function ct(V,H,F,rt,Mt){return H===null||H.tag!==7?(H=ql(F,V.mode,rt,Mt),H.return=V,H):(H=y(H,F),H.return=V,H)}function ot(V,H,F){if(typeof H=="string"&&H!==""||typeof H=="number"||typeof H=="bigint")return H=cS(""+H,V.mode,F),H.return=V,H;if(typeof H=="object"&&H!==null){switch(H.$$typeof){case Up:return F=Hp(H.type,H.key,H.props,null,V.mode,F),mr(F,H),F.return=V,F;case ou:return H=fS(H,V.mode,F),H.return=V,H;case Ar:return H=yi(H),ot(V,H,F)}if(Vp(H)||p(H))return H=ql(H,V.mode,F,null),H.return=V,H;if(typeof H.then=="function")return ot(V,Pl(H),F);if(H.$$typeof===Er)return ot(V,Q(V,H),F);gp(V,H)}return null}function gt(V,H,F,rt){var Mt=H!==null?H.key:null;if(typeof F=="string"&&F!==""||typeof F=="number"||typeof F=="bigint")return Mt!==null?null:I(V,H,""+F,rt);if(typeof F=="object"&&F!==null){switch(F.$$typeof){case Up:return F.key===Mt?k(V,H,F,rt):null;case ou:return F.key===Mt?et(V,H,F,rt):null;case Ar:return F=yi(F),gt(V,H,F,rt)}if(Vp(F)||p(F))return Mt!==null?null:ct(V,H,F,rt,null);if(typeof F.then=="function")return gt(V,H,Pl(F),rt);if(F.$$typeof===Er)return gt(V,H,Q(V,F),rt);gp(V,F)}return null}function Bt(V,H,F,rt,Mt){if(typeof rt=="string"&&rt!==""||typeof rt=="number"||typeof rt=="bigint")return V=V.get(F)||null,I(H,V,""+rt,Mt);if(typeof rt=="object"&&rt!==null){switch(rt.$$typeof){case Up:return V=V.get(rt.key===null?F:rt.key)||null,k(H,V,rt,Mt);case ou:return V=V.get(rt.key===null?F:rt.key)||null,et(H,V,rt,Mt);case Ar:return rt=yi(rt),Bt(V,H,F,rt,Mt)}if(Vp(rt)||p(rt))return V=V.get(F)||null,ct(H,V,rt,Mt,null);if(typeof rt.then=="function")return Bt(V,H,F,Pl(rt),Mt);if(rt.$$typeof===Er)return Bt(V,H,F,Q(H,rt),Mt);gp(H,rt)}return null}function qn(V,H,F,rt){for(var Mt=null,je=null,Ot=H,ae=H=0,zn=null;Ot!==null&&ae<F.length;ae++){Ot.index>ae?(zn=Ot,Ot=null):zn=Ot.sibling;var oe=gt(V,Ot,F[ae],rt);if(oe===null){Ot===null&&(Ot=zn);break}r&&Ot&&oe.alternate===null&&l(V,Ot),H=b(oe,H,ae),je===null?Mt=oe:je.sibling=oe,je=oe,Ot=zn}if(ae===F.length)return c(V,Ot),Kt&&dt(V,ae),Mt;if(Ot===null){for(;ae<F.length;ae++)Ot=ot(V,F[ae],rt),Ot!==null&&(H=b(Ot,H,ae),je===null?Mt=Ot:je.sibling=Ot,je=Ot);return Kt&&dt(V,ae),Mt}for(Ot=h(Ot);ae<F.length;ae++)zn=Bt(Ot,V,ae,F[ae],rt),zn!==null&&(r&&zn.alternate!==null&&Ot.delete(zn.key===null?ae:zn.key),H=b(zn,H,ae),je===null?Mt=zn:je.sibling=zn,je=zn);return r&&Ot.forEach(function(Nr){return l(V,Nr)}),Kt&&dt(V,ae),Mt}function qf(V,H,F,rt){if(F==null)throw Error(i(151));for(var Mt=null,je=null,Ot=H,ae=H=0,zn=null,oe=F.next();Ot!==null&&!oe.done;ae++,oe=F.next()){Ot.index>ae?(zn=Ot,Ot=null):zn=Ot.sibling;var Nr=gt(V,Ot,oe.value,rt);if(Nr===null){Ot===null&&(Ot=zn);break}r&&Ot&&Nr.alternate===null&&l(V,Ot),H=b(Nr,H,ae),je===null?Mt=Nr:je.sibling=Nr,je=Nr,Ot=zn}if(oe.done)return c(V,Ot),Kt&&dt(V,ae),Mt;if(Ot===null){for(;!oe.done;ae++,oe=F.next())oe=ot(V,oe.value,rt),oe!==null&&(H=b(oe,H,ae),je===null?Mt=oe:je.sibling=oe,je=oe);return Kt&&dt(V,ae),Mt}for(Ot=h(Ot);!oe.done;ae++,oe=F.next())oe=Bt(Ot,V,ae,oe.value,rt),oe!==null&&(r&&oe.alternate!==null&&Ot.delete(oe.key===null?ae:oe.key),H=b(oe,H,ae),je===null?Mt=oe:je.sibling=oe,je=oe);return r&&Ot.forEach(function(ZB){return l(V,ZB)}),Kt&&dt(V,ae),Mt}function Jl(V,H,F,rt){if(typeof F=="object"&&F!==null&&F.type===ru&&F.key===null&&(F=F.props.children),typeof F=="object"&&F!==null){switch(F.$$typeof){case Up:t:{for(var Mt=F.key;H!==null;){if(H.key===Mt){if(Mt=F.type,Mt===ru){if(H.tag===7){c(V,H.sibling),rt=y(H,F.props.children),rt.return=V,V=rt;break t}}else if(H.elementType===Mt||typeof Mt=="object"&&Mt!==null&&Mt.$$typeof===Ar&&yi(Mt)===H.type){c(V,H.sibling),rt=y(H,F.props),mr(rt,F),rt.return=V,V=rt;break t}c(V,H);break}else l(V,H);H=H.sibling}F.type===ru?(rt=ql(F.props.children,V.mode,rt,F.key),rt.return=V,V=rt):(rt=Hp(F.type,F.key,F.props,null,V.mode,rt),mr(rt,F),rt.return=V,V=rt)}return w(V);case ou:t:{for(Mt=F.key;H!==null;){if(H.key===Mt)if(H.tag===4&&H.stateNode.containerInfo===F.containerInfo&&H.stateNode.implementation===F.implementation){c(V,H.sibling),rt=y(H,F.children||[]),rt.return=V,V=rt;break t}else{c(V,H);break}else l(V,H);H=H.sibling}rt=fS(F,V.mode,rt),rt.return=V,V=rt}return w(V);case Ar:return F=yi(F),Jl(V,H,F,rt)}if(Vp(F))return qn(V,H,F,rt);if(p(F)){if(Mt=p(F),typeof Mt!="function")throw Error(i(150));return F=Mt.call(F),qf(V,H,F,rt)}if(typeof F.then=="function")return Jl(V,H,Pl(F),rt);if(F.$$typeof===Er)return Jl(V,H,Q(V,F),rt);gp(V,F)}return typeof F=="string"&&F!==""||typeof F=="number"||typeof F=="bigint"?(F=""+F,H!==null&&H.tag===6?(c(V,H.sibling),rt=y(H,F),rt.return=V,V=rt):(c(V,H),rt=cS(F,V.mode,rt),rt.return=V,V=rt),w(V)):c(V,H)}return function(V,H,F,rt){try{Lf=0;var Mt=Jl(V,H,F,rt);return yu=null,Mt}catch(Ot){if(Ot===gu||Ot===Wp)throw Ot;var je=e(29,Ot,null,V.mode);return je.lanes=rt,je.return=V,je}finally{}}}function yp(){for(var r=vu,l=LS=vu=0;l<r;){var c=da[l];da[l++]=null;var h=da[l];da[l++]=null;var y=da[l];da[l++]=null;var b=da[l];if(da[l++]=null,h!==null&&y!==null){var w=h.pending;w===null?y.next=y:(y.next=w.next,w.next=y),h.pending=y}b!==0&&mT(c,y,b)}}function vp(r,l,c,h){da[vu++]=r,da[vu++]=l,da[vu++]=c,da[vu++]=h,LS|=h,r.lanes|=h,r=r.alternate,r!==null&&(r.lanes|=h)}function g0(r,l,c,h){return vp(r,l,c,h),Sp(r)}function Hl(r,l){return vp(r,null,null,l),Sp(r)}function mT(r,l,c){r.lanes|=c;var h=r.alternate;h!==null&&(h.lanes|=c);for(var y=!1,b=r.return;b!==null;)b.childLanes|=c,h=b.alternate,h!==null&&(h.childLanes|=c),b.tag===22&&(r=b.stateNode,r===null||r._visibility&1||(y=!0)),r=b,b=b.return;return r.tag===3?(b=r.stateNode,y&&l!==null&&(y=31-Hi(c),r=b.hiddenUpdates,h=r[y],h===null?r[y]=[l]:h.push(l),l.lane=c|536870912),b):null}function Sp(r){if(50<jf)throw jf=0,QS=null,Error(i(185));for(var l=r.return;l!==null;)r=l,l=r.return;return r.tag===3?r.stateNode:null}function y0(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function v0(r,l){r=r.updateQueue,l.updateQueue===r&&(l.updateQueue={baseState:r.baseState,firstBaseUpdate:r.firstBaseUpdate,lastBaseUpdate:r.lastBaseUpdate,shared:r.shared,callbacks:null})}function gr(r){return{lane:r,tag:0,payload:null,callback:null,next:null}}function yr(r,l,c){var h=r.updateQueue;if(h===null)return null;if(h=h.shared,Ft&2){var y=h.pending;return y===null?l.next=l:(l.next=y.next,y.next=l),h.pending=l,l=Sp(r),mT(r,null,c),l}return vp(r,h,l,c),Sp(r)}function gf(r,l,c){if(l=l.updateQueue,l!==null&&(l=l.shared,(c&4194048)!==0)){var h=l.lanes;h&=r.pendingLanes,c|=h,l.lanes=c,D(r,c)}}function S0(r,l){var c=r.updateQueue,h=r.alternate;if(h!==null&&(h=h.updateQueue,c===h)){var y=null,b=null;if(c=c.firstBaseUpdate,c!==null){do{var w={lane:c.lane,tag:c.tag,payload:c.payload,callback:null,next:null};b===null?y=b=w:b=b.next=w,c=c.next}while(c!==null);b===null?y=b=l:b=b.next=l}else y=b=l;c={baseState:h.baseState,firstBaseUpdate:y,lastBaseUpdate:b,shared:h.shared,callbacks:h.callbacks},r.updateQueue=c;return}r=c.lastBaseUpdate,r===null?c.firstBaseUpdate=l:r.next=l,c.lastBaseUpdate=l}function yf(){if(BS){var r=mu;if(r!==null)throw r}}function vf(r,l,c,h){BS=!1;var y=r.updateQueue;wr=!1;var b=y.firstBaseUpdate,w=y.lastBaseUpdate,I=y.shared.pending;if(I!==null){y.shared.pending=null;var k=I,et=k.next;k.next=null,w===null?b=et:w.next=et,w=k;var ct=r.alternate;ct!==null&&(ct=ct.updateQueue,I=ct.lastBaseUpdate,I!==w&&(I===null?ct.firstBaseUpdate=et:I.next=et,ct.lastBaseUpdate=k))}if(b!==null){var ot=y.baseState;w=0,ct=et=k=null,I=b;do{var gt=I.lane&-536870913,Bt=gt!==I.lane;if(Bt?(Qt>)===gt:(h>)===gt){gt!==0&>===pu&&(BS=!0),ct!==null&&(ct=ct.next={lane:0,tag:I.tag,payload:I.payload,callback:null,next:null});t:{var qn=r,qf=I;gt=l;var Jl=c;switch(qf.tag){case 1:if(qn=qf.payload,typeof qn=="function"){ot=qn.call(Jl,ot,gt);break t}ot=qn;break t;case 3:qn.flags=qn.flags&-65537|128;case 0:if(qn=qf.payload,gt=typeof qn=="function"?qn.call(Jl,ot,gt):qn,gt==null)break t;ot=hS({},ot,gt);break t;case 2:wr=!0}}gt=I.callback,gt!==null&&(r.flags|=64,Bt&&(r.flags|=8192),Bt=y.callbacks,Bt===null?y.callbacks=[gt]:Bt.push(gt))}else Bt={lane:gt,tag:I.tag,payload:I.payload,callback:I.callback,next:null},ct===null?(et=ct=Bt,k=ot):ct=ct.next=Bt,w|=gt;if(I=I.next,I===null){if(I=y.shared.pending,I===null)break;Bt=I,I=Bt.next,Bt.next=null,y.lastBaseUpdate=Bt,y.shared.pending=null}}while(!0);ct===null&&(k=ot),y.baseState=k,y.firstBaseUpdate=et,y.lastBaseUpdate=ct,b===null&&(y.shared.lanes=0),Or|=w,r.lanes=w,r.memoizedState=ot}}function gT(r,l){if(typeof r!="function")throw Error(i(191,r));r.call(l)}function yT(r,l){var c=r.callbacks;if(c!==null)for(r.callbacks=null,r=0;r<c.length;r++)gT(c[r],l)}function vT(r,l){r=Mo,v($p,r),v(Su,l),Mo=r|l.baseLanes}function b0(){v($p,Mo),v(Su,Su.current)}function x0(){Mo=$p.current,g(Su),g($p)}function vr(r){var l=r.alternate;v(nn,nn.current&1),v(ji,r),ha===null&&(l===null||Su.current!==null||l.memoizedState!==null)&&(ha=r)}function E0(r){v(nn,nn.current),v(ji,r),ha===null&&(ha=r)}function ST(r){r.tag===22?(v(nn,nn.current),v(ji,r),ha===null&&(ha=r)):Sr(r)}function Sr(){v(nn,nn.current),v(ji,ji.current)}function Li(r){g(ji),ha===r&&(ha=null),g(nn)}function bp(r){for(var l=r;l!==null;){if(l.tag===13){var c=l.memoizedState;if(c!==null&&(c=c.dehydrated,c===null||ES(c)||AS(c)))return l}else if(l.tag===19&&(l.memoizedProps.revealOrder==="forwards"||l.memoizedProps.revealOrder==="backwards"||l.memoizedProps.revealOrder==="unstable_legacy-backwards"||l.memoizedProps.revealOrder==="together")){if(l.flags&128)return l}else if(l.child!==null){l.child.return=l,l=l.child;continue}if(l===r)break;for(;l.sibling===null;){if(l.return===null||l.return===r)return null;l=l.return}l.sibling.return=l.return,l=l.sibling}return null}function Qe(){throw Error(i(321))}function A0(r,l){if(l===null)return!1;for(var c=0;c<l.length&&c<r.length;c++)if(!Vi(r[c],l[c]))return!1;return!0}function R0(r,l,c,h,y,b){return Co=b,Pt=l,l.memoizedState=null,l.updateQueue=null,l.lanes=0,wt.H=r===null||r.memoizedState===null?Yw:PS,Zl=!1,b=c(h,y),Zl=!1,bu&&(b=xT(l,c,h,y)),bT(r),b}function bT(r){wt.H=Pf;var l=Se!==null&&Se.next!==null;if(Co=0,sn=Se=Pt=null,tm=!1,Bf=0,xu=null,l)throw Error(i(300));r===null||un||(r=r.dependencies,r!==null&&tn(r)&&(un=!0))}function xT(r,l,c,h){Pt=r;var y=0;do{if(bu&&(xu=null),Bf=0,bu=!1,25<=y)throw Error(i(301));if(y+=1,sn=Se=null,r.updateQueue!=null){var b=r.updateQueue;b.lastEffect=null,b.events=null,b.stores=null,b.memoCache!=null&&(b.memoCache.index=0)}wt.H=Qw,b=l(c,h)}while(bu);return b}function L4(){var r=wt.H,l=r.useState()[0];return l=typeof l.then=="function"?Sf(l):l,r=r.useState()[0],(Se!==null?Se.memoizedState:null)!==r&&(Pt.flags|=1024),l}function T0(){var r=em!==0;return em=0,r}function C0(r,l,c){l.updateQueue=r.updateQueue,l.flags&=-2053,r.lanes&=~c}function w0(r){if(tm){for(r=r.memoizedState;r!==null;){var l=r.queue;l!==null&&(l.pending=null),r=r.next}tm=!1}Co=0,sn=Se=Pt=null,bu=!1,Bf=em=0,xu=null}function li(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return sn===null?Pt.memoizedState=sn=r:sn=sn.next=r,sn}function en(){if(Se===null){var r=Pt.alternate;r=r!==null?r.memoizedState:null}else r=Se.next;var l=sn===null?Pt.memoizedState:sn.next;if(l!==null)sn=l,Se=r;else{if(r===null)throw Pt.alternate===null?Error(i(467)):Error(i(310));Se=r,r={memoizedState:Se.memoizedState,baseState:Se.baseState,baseQueue:Se.baseQueue,queue:Se.queue,next:null},sn===null?Pt.memoizedState=sn=r:sn=sn.next=r}return sn}function xp(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Sf(r){var l=Bf;return Bf+=1,xu===null&&(xu=[]),r=xn(xu,r,l),l=Pt,(sn===null?l.memoizedState:sn.next)===null&&(l=l.alternate,wt.H=l===null||l.memoizedState===null?Yw:PS),r}function Ep(r){if(r!==null&&typeof r=="object"){if(typeof r.then=="function")return Sf(r);if(r.$$typeof===Er)return B(r)}throw Error(i(438,String(r)))}function M0(r){var l=null,c=Pt.updateQueue;if(c!==null&&(l=c.memoCache),l==null){var h=Pt.alternate;h!==null&&(h=h.updateQueue,h!==null&&(h=h.memoCache,h!=null&&(l={data:h.data.map(function(y){return y.slice()}),index:0})))}if(l==null&&(l={data:[],index:0}),c===null&&(c=xp(),Pt.updateQueue=c),c.memoCache=l,c=l.data[l.index],c===void 0)for(c=l.data[l.index]=Array(r),h=0;h<r;h++)c[h]=r5;return l.index++,c}function vo(r,l){return typeof l=="function"?l(r):l}function Ap(r){var l=en();return O0(l,Se,r)}function O0(r,l,c){var h=r.queue;if(h===null)throw Error(i(311));h.lastRenderedReducer=c;var y=r.baseQueue,b=h.pending;if(b!==null){if(y!==null){var w=y.next;y.next=b.next,b.next=w}l.baseQueue=y=b,h.pending=null}if(b=r.baseState,y===null)r.memoizedState=b;else{l=y.next;var I=w=null,k=null,et=l,ct=!1;do{var ot=et.lane&-536870913;if(ot!==et.lane?(Qt&ot)===ot:(Co&ot)===ot){var gt=et.revertLane;if(gt===0)k!==null&&(k=k.next={lane:0,revertLane:0,gesture:null,action:et.action,hasEagerState:et.hasEagerState,eagerState:et.eagerState,next:null}),ot===pu&&(ct=!0);else if((Co>)===gt){et=et.next,gt===pu&&(ct=!0);continue}else ot={lane:0,revertLane:et.revertLane,gesture:null,action:et.action,hasEagerState:et.hasEagerState,eagerState:et.eagerState,next:null},k===null?(I=k=ot,w=b):k=k.next=ot,Pt.lanes|=gt,Or|=gt;ot=et.action,Zl&&c(b,ot),b=et.hasEagerState?et.eagerState:c(b,ot)}else gt={lane:ot,revertLane:et.revertLane,gesture:et.gesture,action:et.action,hasEagerState:et.hasEagerState,eagerState:et.eagerState,next:null},k===null?(I=k=gt,w=b):k=k.next=gt,Pt.lanes|=ot,Or|=ot;et=et.next}while(et!==null&&et!==l);if(k===null?w=b:k.next=I,!Vi(b,r.memoizedState)&&(un=!0,ct&&(c=mu,c!==null)))throw c;r.memoizedState=b,r.baseState=w,r.baseQueue=k,h.lastRenderedState=b}return y===null&&(h.lanes=0),[r.memoizedState,h.dispatch]}function _0(r){var l=en(),c=l.queue;if(c===null)throw Error(i(311));c.lastRenderedReducer=r;var h=c.dispatch,y=c.pending,b=l.memoizedState;if(y!==null){c.pending=null;var w=y=y.next;do b=r(b,w.action),w=w.next;while(w!==y);Vi(b,l.memoizedState)||(un=!0),l.memoizedState=b,l.baseQueue===null&&(l.baseState=b),c.lastRenderedState=b}return[b,h]}function ET(r,l,c){var h=Pt,y=en(),b=Kt;if(b){if(c===void 0)throw Error(i(407));c=c()}else c=l();var w=!Vi((Se||y).memoizedState,c);if(w&&(y.memoizedState=c,un=!0),y=y.queue,I0(TT.bind(null,h,y,r),[r]),y.getSnapshot!==l||w||sn!==null&&sn.memoizedState.tag&1){if(h.flags|=2048,eu(9,{destroy:void 0},RT.bind(null,h,y,c,l),null),Ae===null)throw Error(i(349));b||Co&127||AT(h,l,c)}return c}function AT(r,l,c){r.flags|=16384,r={getSnapshot:l,value:c},l=Pt.updateQueue,l===null?(l=xp(),Pt.updateQueue=l,l.stores=[r]):(c=l.stores,c===null?l.stores=[r]:c.push(r))}function RT(r,l,c,h){l.value=c,l.getSnapshot=h,CT(l)&&wT(r)}function TT(r,l,c){return c(function(){CT(l)&&wT(r)})}function CT(r){var l=r.getSnapshot;r=r.value;try{var c=l();return!Vi(r,c)}catch{return!0}}function wT(r){var l=Hl(r,2);l!==null&&vi(l,r,2)}function z0(r){var l=li();if(typeof r=="function"){var c=r;if(r=c(),Zl){J(!0);try{c()}finally{J(!1)}}}return l.memoizedState=l.baseState=r,l.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:vo,lastRenderedState:r},l}function MT(r,l,c,h){return r.baseState=c,O0(r,Se,typeof h=="function"?h:vo)}function B4(r,l,c,h,y){if(Cp(r))throw Error(i(485));if(r=l.action,r!==null){var b={payload:y,action:r,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(w){b.listeners.push(w)}};wt.T!==null?c(!0):b.isTransition=!1,h(b),c=l.pending,c===null?(b.next=l.pending=b,OT(l,b)):(b.next=c.next,l.pending=c.next=b)}}function OT(r,l){var c=l.action,h=l.payload,y=r.state;if(l.isTransition){var b=wt.T,w={};wt.T=w;try{var I=c(y,h),k=wt.S;k!==null&&k(w,I),_T(r,l,I)}catch(et){N0(r,l,et)}finally{b!==null&&w.types!==null&&(b.types=w.types),wt.T=b}}else try{b=c(y,h),_T(r,l,b)}catch(et){N0(r,l,et)}}function _T(r,l,c){c!==null&&typeof c=="object"&&typeof c.then=="function"?c.then(function(h){zT(r,l,h)},function(h){return N0(r,l,h)}):zT(r,l,c)}function zT(r,l,c){l.status="fulfilled",l.value=c,NT(l),r.state=c,l=r.pending,l!==null&&(c=l.next,c===l?r.pending=null:(c=c.next,l.next=c,OT(r,c)))}function N0(r,l,c){var h=r.pending;if(r.pending=null,h!==null){h=h.next;do l.status="rejected",l.reason=c,NT(l),l=l.next;while(l!==h)}r.action=null}function NT(r){r=r.listeners;for(var l=0;l<r.length;l++)(0,r[l])()}function IT(r,l){return l}function DT(r,l){if(Kt){var c=Ae.formState;if(c!==null){t:{var h=Pt;if(Kt){if(Ue){var y=$5(Ue,fa);if(y){Ue=Mw(y),h=tB(y);break t}}ne(h)}h=!1}h&&(l=c[0])}}c=li(),c.memoizedState=c.baseState=l,h={pending:null,lanes:0,dispatch:null,lastRenderedReducer:IT,lastRenderedState:l},c.queue=h,c=JT.bind(null,Pt,h),h.dispatch=c,h=z0(!1);var b=P0.bind(null,Pt,!1,h.queue);return h=li(),y={state:l,dispatch:null,action:r,pending:null},h.queue=y,c=B4.bind(null,Pt,y,b,c),y.dispatch=c,h.memoizedState=r,[l,c,!1]}function LT(r){var l=en();return BT(l,Se,r)}function BT(r,l,c){if(l=O0(r,l,IT)[0],r=Ap(vo)[0],typeof l=="object"&&l!==null&&typeof l.then=="function")try{var h=Sf(l)}catch(w){throw w===gu?Wp:w}else h=l;l=en();var y=l.queue,b=y.dispatch;return c!==l.memoizedState&&(Pt.flags|=2048,eu(9,{destroy:void 0},P4.bind(null,y,c),null)),[h,b,r]}function P4(r,l){r.action=l}function PT(r){var l=en(),c=Se;if(c!==null)return BT(l,c,r);en(),l=l.memoizedState,c=en();var h=c.queue.dispatch;return c.memoizedState=r,[l,h,!1]}function eu(r,l,c,h){return r={tag:r,create:c,deps:h,inst:l,next:null},l=Pt.updateQueue,l===null&&(l=xp(),Pt.updateQueue=l),c=l.lastEffect,c===null?l.lastEffect=r.next=r:(h=c.next,c.next=r,r.next=h,l.lastEffect=r),r}function HT(){return en().memoizedState}function Rp(r,l,c,h){var y=li();Pt.flags|=r,y.memoizedState=eu(1|l,{destroy:void 0},c,h===void 0?null:h)}function Tp(r,l,c,h){var y=en();h=h===void 0?null:h;var b=y.memoizedState.inst;Se!==null&&h!==null&&A0(h,Se.memoizedState.deps)?y.memoizedState=eu(l,b,c,h):(Pt.flags|=r,y.memoizedState=eu(1|l,b,c,h))}function UT(r,l){Rp(8390656,8,r,l)}function I0(r,l){Tp(2048,8,r,l)}function H4(r){Pt.flags|=4;var l=Pt.updateQueue;if(l===null)l=xp(),Pt.updateQueue=l,l.events=[r];else{var c=l.events;c===null?l.events=[r]:c.push(r)}}function VT(r){var l=en().memoizedState;return H4({ref:l,nextImpl:r}),function(){if(Ft&2)throw Error(i(440));return l.impl.apply(void 0,arguments)}}function jT(r,l){return Tp(4,2,r,l)}function qT(r,l){return Tp(4,4,r,l)}function FT(r,l){if(typeof l=="function"){r=r();var c=l(r);return function(){typeof c=="function"?c():l(null)}}if(l!=null)return r=r(),l.current=r,function(){l.current=null}}function GT(r,l,c){c=c!=null?c.concat([r]):null,Tp(4,4,FT.bind(null,l,r),c)}function D0(){}function kT(r,l){var c=en();l=l===void 0?null:l;var h=c.memoizedState;return l!==null&&A0(l,h[1])?h[0]:(c.memoizedState=[r,l],r)}function YT(r,l){var c=en();l=l===void 0?null:l;var h=c.memoizedState;if(l!==null&&A0(l,h[1]))return h[0];if(h=r(),Zl){J(!0);try{r()}finally{J(!1)}}return c.memoizedState=[h,l],h}function L0(r,l,c){return c===void 0||Co&1073741824&&!(Qt&261930)?r.memoizedState=l:(r.memoizedState=c,r=qC(),Pt.lanes|=r,Or|=r,c)}function QT(r,l,c,h){return Vi(c,l)?c:Su.current!==null?(r=L0(r,c,h),Vi(r,l)||(un=!0),r):!(Co&42)||Co&1073741824&&!(Qt&261930)?(un=!0,r.memoizedState=c):(r=qC(),Pt.lanes|=r,Or|=r,l)}function XT(r,l,c,h,y){var b=Ro();On(b!==0&&8>b?b:8);var w=wt.T,I={};wt.T=I,P0(r,!1,l,c);try{var k=y(),et=wt.S;if(et!==null&&et(I,k),k!==null&&typeof k=="object"&&typeof k.then=="function"){var ct=Ut(k,h);bf(r,l,ct,Bi(r))}else bf(r,l,h,Bi(r))}catch(ot){bf(r,l,{then:function(){},status:"rejected",reason:ot},Bi())}finally{On(b),w!==null&&I.types!==null&&(w.types=I.types),wt.T=w}}function KT(r){var l=r.memoizedState;if(l!==null)return l;l={memoizedState:lu,baseState:lu,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:vo,lastRenderedState:lu},next:null};var c={};return l.next={memoizedState:c,baseState:c,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:vo,lastRenderedState:c},next:null},r.memoizedState=l,r=r.alternate,r!==null&&(r.memoizedState=l),l}function B0(){return B(Gl)}function ZT(){return en().memoizedState}function WT(){return en().memoizedState}function U4(r){for(var l=r.return;l!==null;){switch(l.tag){case 24:case 3:var c=Bi();r=gr(c);var h=yr(l,r,c);h!==null&&(vi(h,l,c),gf(h,l,c)),l={cache:ht()},r.payload=l;return}l=l.return}}function V4(r,l,c){var h=Bi();c={lane:h,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},Cp(r)?$T(l,c):(c=g0(r,l,c,h),c!==null&&(vi(c,r,h),tC(c,l,h)))}function JT(r,l,c){var h=Bi();bf(r,l,c,h)}function bf(r,l,c,h){var y={lane:h,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null};if(Cp(r))$T(l,y);else{var b=r.alternate;if(r.lanes===0&&(b===null||b.lanes===0)&&(b=l.lastRenderedReducer,b!==null))try{var w=l.lastRenderedState,I=b(w,c);if(y.hasEagerState=!0,y.eagerState=I,Vi(I,w))return vp(r,l,y,0),Ae===null&&yp(),!1}catch{}finally{}if(c=g0(r,l,y,h),c!==null)return vi(c,r,h),tC(c,l,h),!0}return!1}function P0(r,l,c,h){if(h={lane:2,revertLane:mt(),gesture:null,action:h,hasEagerState:!1,eagerState:null,next:null},Cp(r)){if(l)throw Error(i(479))}else l=g0(r,c,h,2),l!==null&&vi(l,r,2)}function Cp(r){var l=r.alternate;return r===Pt||l!==null&&l===Pt}function $T(r,l){bu=tm=!0;var c=r.pending;c===null?l.next=l:(l.next=c.next,c.next=l),r.pending=l}function tC(r,l,c){if(c&4194048){var h=l.lanes;h&=r.pendingLanes,c|=h,l.lanes=c,D(r,c)}}function H0(r,l,c,h){l=r.memoizedState,c=c(h,l),c=c==null?l:hS({},l,c),r.memoizedState=c,r.lanes===0&&(r.updateQueue.baseState=c)}function eC(r,l,c,h,y,b,w){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(h,b,w):l.prototype&&l.prototype.isPureReactComponent?!Ye(c,h)||!Ye(y,b):!0}function nC(r,l,c,h){r=l.state,typeof l.componentWillReceiveProps=="function"&&l.componentWillReceiveProps(c,h),typeof l.UNSAFE_componentWillReceiveProps=="function"&&l.UNSAFE_componentWillReceiveProps(c,h),l.state!==r&&HS.enqueueReplaceState(l,l.state,null)}function Ul(r,l){var c=l;if("ref"in l){c={};for(var h in l)h!=="ref"&&(c[h]=l[h])}if(r=r.defaultProps){c===l&&(c=hS({},c));for(var y in r)c[y]===void 0&&(c[y]=r[y])}return c}function wp(r,l){try{var c=r.onUncaughtError;c(l.value,{componentStack:l.stack})}catch(h){setTimeout(function(){throw h})}}function iC(r,l,c){try{var h=r.onCaughtError;h(c.value,{componentStack:c.stack,errorBoundary:l.tag===1?l.stateNode:null})}catch(y){setTimeout(function(){throw y})}}function U0(r,l,c){return c=gr(c),c.tag=3,c.payload={element:null},c.callback=function(){wp(r,l)},c}function aC(r){return r=gr(r),r.tag=3,r}function oC(r,l,c,h){var y=c.type.getDerivedStateFromError;if(typeof y=="function"){var b=h.value;r.payload=function(){return y(b)},r.callback=function(){iC(l,c,h)}}var w=c.stateNode;w!==null&&typeof w.componentDidCatch=="function"&&(r.callback=function(){iC(l,c,h),typeof y!="function"&&(_r===null?_r=new Set([this]):_r.add(this));var I=h.stack;this.componentDidCatch(h.value,{componentStack:I!==null?I:""})})}function j4(r,l,c,h,y){if(c.flags|=32768,h!==null&&typeof h=="object"&&typeof h.then=="function"){if(l=c.alternate,l!==null&&Zn(l,c,y,!0),c=ji.current,c!==null){switch(c.tag){case 31:case 13:return ha===null?Bp():c.alternate===null&&Xe===0&&(Xe=3),c.flags&=-257,c.flags|=65536,c.lanes=y,h===Jp?c.flags|=16384:(l=c.updateQueue,l===null?c.updateQueue=new Set([h]):l.add(h),sS(r,h,y)),!1;case 22:return c.flags|=65536,h===Jp?c.flags|=16384:(l=c.updateQueue,l===null?(l={transitions:null,markerInstances:null,retryQueue:new Set([h])},c.updateQueue=l):(c=l.retryQueue,c===null?l.retryQueue=new Set([h]):c.add(h)),sS(r,h,y)),!1}throw Error(i(435,c.tag))}return sS(r,h,y),Bp(),!1}if(Kt)return l=ji.current,l!==null?(!(l.flags&65536)&&(l.flags|=256),l.flags|=65536,l.lanes=y,h!==_S&&(r=Error(i(422),{cause:h}),Mn(lt(r,c)))):(h!==_S&&(l=Error(i(423),{cause:h}),Mn(lt(l,c))),r=r.current.alternate,r.flags|=65536,y&=-y,r.lanes|=y,h=lt(h,c),y=U0(r.stateNode,h,y),S0(r,y),Xe!==4&&(Xe=2)),!1;var b=Error(i(520),{cause:h});if(b=lt(b,c),Uf===null?Uf=[b]:Uf.push(b),Xe!==4&&(Xe=2),l===null)return!0;h=lt(h,c),c=l;do{switch(c.tag){case 3:return c.flags|=65536,r=y&-y,c.lanes|=r,r=U0(c.stateNode,h,r),S0(c,r),!1;case 1:if(l=c.type,b=c.stateNode,(c.flags&128)===0&&(typeof l.getDerivedStateFromError=="function"||b!==null&&typeof b.componentDidCatch=="function"&&(_r===null||!_r.has(b))))return c.flags|=65536,y&=-y,c.lanes|=y,y=aC(y),oC(y,r,c,h),S0(c,y),!1}c=c.return}while(c!==null);return!1}function Un(r,l,c,h){l.child=r===null?kw(l,null,c,h):Kl(l,r.child,c,h)}function rC(r,l,c,h,y){c=c.render;var b=l.ref;if("ref"in h){var w={};for(var I in h)I!=="ref"&&(w[I]=h[I])}else w=h;return bn(l),h=R0(r,l,c,w,b,y),I=T0(),r!==null&&!un?(C0(r,l,y),So(r,l,y)):(Kt&&I&&K(l),l.flags|=1,Un(r,l,h,y),l.child)}function lC(r,l,c,h,y){if(r===null){var b=c.type;return typeof b=="function"&&!uS(b)&&b.defaultProps===void 0&&c.compare===null?(l.tag=15,l.type=b,sC(r,l,b,h,y)):(r=Hp(c.type,null,h,l,l.mode,y),r.ref=l.ref,r.return=l,l.child=r)}if(b=r.child,!Y0(r,y)){var w=b.memoizedProps;if(c=c.compare,c=c!==null?c:Ye,c(w,h)&&r.ref===l.ref)return So(r,l,y)}return l.flags|=1,r=Eo(b,h),r.ref=l.ref,r.return=l,l.child=r}function sC(r,l,c,h,y){if(r!==null){var b=r.memoizedProps;if(Ye(b,h)&&r.ref===l.ref)if(un=!1,l.pendingProps=h=b,Y0(r,y))r.flags&131072&&(un=!0);else return l.lanes=r.lanes,So(r,l,y)}return V0(r,l,c,h,y)}function uC(r,l,c,h){var y=h.children,b=r!==null?r.memoizedState:null;if(r===null&&l.stateNode===null&&(l.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),h.mode==="hidden"){if(l.flags&128){if(b=b!==null?b.baseLanes|c:c,r!==null){for(h=l.child=r.child,y=0;h!==null;)y=y|h.lanes|h.childLanes,h=h.sibling;h=y&~b}else h=0,l.child=null;return cC(r,l,b,c,h)}if(c&536870912)l.memoizedState={baseLanes:0,cachePool:null},r!==null&&ye(l,b!==null?b.cachePool:null),b!==null?vT(l,b):b0(),ST(l);else return h=l.lanes=536870912,cC(r,l,b!==null?b.baseLanes|c:c,c,h)}else b!==null?(ye(l,b.cachePool),vT(l,b),Sr(l),l.memoizedState=null):(r!==null&&ye(l,null),b0(),Sr(l));return Un(r,l,y,c),l.child}function xf(r,l){return r!==null&&r.tag===22||l.stateNode!==null||(l.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.sibling}function cC(r,l,c,h,y){var b=Ee();return b=b===null?null:{parent:Ao?Ve._currentValue:Ve._currentValue2,pool:b},l.memoizedState={baseLanes:c,cachePool:b},r!==null&&ye(l,null),b0(),ST(l),r!==null&&Zn(r,l,h,!0),l.childLanes=y,null}function Mp(r,l){return l=_p({mode:l.mode,children:l.children},r.mode),l.ref=r.ref,r.child=l,l.return=r,l}function fC(r,l,c){return Kl(l,r.child,null,c),r=Mp(l,l.pendingProps),r.flags|=2,Li(l),l.memoizedState=null,r}function q4(r,l,c){var h=l.pendingProps,y=(l.flags&128)!==0;if(l.flags&=-129,r===null){if(Kt){if(h.mode==="hidden")return r=Mp(l,h),l.lanes=536870912,xf(null,r);if(E0(l),(r=Ue)?(r=uB(r,fa),r!==null&&(l.memoizedState={dehydrated:r,treeContext:Rr!==null?{id:no,overflow:io}:null,retryLane:536870912,hydrationErrors:null},c=sw(r),c.return=l,l.child=c,jn=l,Ue=null)):r=null,r===null)throw ne(l);return l.lanes=536870912,null}return Mp(l,h)}var b=r.memoizedState;if(b!==null){var w=b.dehydrated;if(E0(l),y)if(l.flags&256)l.flags&=-257,l=fC(r,l,c);else if(l.memoizedState!==null)l.child=r.child,l.flags|=128,l=null;else throw Error(i(558));else if(un||Zn(r,l,c,!1),y=(c&r.childLanes)!==0,un||y){if(h=Ae,h!==null&&(w=q(h,c),w!==0&&w!==b.retryLane))throw b.retryLane=w,Hl(r,w),vi(h,r,w),US;Bp(),l=fC(r,l,c)}else r=b.treeContext,$n&&(Ue=aB(w),jn=l,Kt=!0,Cr=null,fa=!1,r!==null&&ee(l,r)),l=Mp(l,h),l.flags|=4096;return l}return r=Eo(r.child,{mode:h.mode,children:h.children}),r.ref=l.ref,l.child=r,r.return=l,r}function Op(r,l){var c=l.ref;if(c===null)r!==null&&r.ref!==null&&(l.flags|=4194816);else{if(typeof c!="function"&&typeof c!="object")throw Error(i(284));(r===null||r.ref!==c)&&(l.flags|=4194816)}}function V0(r,l,c,h,y){return bn(l),c=R0(r,l,c,h,void 0,y),h=T0(),r!==null&&!un?(C0(r,l,y),So(r,l,y)):(Kt&&h&&K(l),l.flags|=1,Un(r,l,c,y),l.child)}function dC(r,l,c,h,y,b){return bn(l),l.updateQueue=null,c=xT(l,h,c,y),bT(r),h=T0(),r!==null&&!un?(C0(r,l,b),So(r,l,b)):(Kt&&h&&K(l),l.flags|=1,Un(r,l,c,b),l.child)}function hC(r,l,c,h,y){if(bn(l),l.stateNode===null){var b=cu,w=c.contextType;typeof w=="object"&&w!==null&&(b=B(w)),b=new c(h,b),l.memoizedState=b.state!==null&&b.state!==void 0?b.state:null,b.updater=HS,l.stateNode=b,b._reactInternals=l,b=l.stateNode,b.props=h,b.state=l.memoizedState,b.refs={},y0(l),w=c.contextType,b.context=typeof w=="object"&&w!==null?B(w):cu,b.state=l.memoizedState,w=c.getDerivedStateFromProps,typeof w=="function"&&(H0(l,c,w,h),b.state=l.memoizedState),typeof c.getDerivedStateFromProps=="function"||typeof b.getSnapshotBeforeUpdate=="function"||typeof b.UNSAFE_componentWillMount!="function"&&typeof b.componentWillMount!="function"||(w=b.state,typeof b.componentWillMount=="function"&&b.componentWillMount(),typeof b.UNSAFE_componentWillMount=="function"&&b.UNSAFE_componentWillMount(),w!==b.state&&HS.enqueueReplaceState(b,b.state,null),vf(l,h,b,y),yf(),b.state=l.memoizedState),typeof b.componentDidMount=="function"&&(l.flags|=4194308),h=!0}else if(r===null){b=l.stateNode;var I=l.memoizedProps,k=Ul(c,I);b.props=k;var et=b.context,ct=c.contextType;w=cu,typeof ct=="object"&&ct!==null&&(w=B(ct));var ot=c.getDerivedStateFromProps;ct=typeof ot=="function"||typeof b.getSnapshotBeforeUpdate=="function",I=l.pendingProps!==I,ct||typeof b.UNSAFE_componentWillReceiveProps!="function"&&typeof b.componentWillReceiveProps!="function"||(I||et!==w)&&nC(l,b,h,w),wr=!1;var gt=l.memoizedState;b.state=gt,vf(l,h,b,y),yf(),et=l.memoizedState,I||gt!==et||wr?(typeof ot=="function"&&(H0(l,c,ot,h),et=l.memoizedState),(k=wr||eC(l,c,k,h,gt,et,w))?(ct||typeof b.UNSAFE_componentWillMount!="function"&&typeof b.componentWillMount!="function"||(typeof b.componentWillMount=="function"&&b.componentWillMount(),typeof b.UNSAFE_componentWillMount=="function"&&b.UNSAFE_componentWillMount()),typeof b.componentDidMount=="function"&&(l.flags|=4194308)):(typeof b.componentDidMount=="function"&&(l.flags|=4194308),l.memoizedProps=h,l.memoizedState=et),b.props=h,b.state=et,b.context=w,h=k):(typeof b.componentDidMount=="function"&&(l.flags|=4194308),h=!1)}else{b=l.stateNode,v0(r,l),w=l.memoizedProps,ct=Ul(c,w),b.props=ct,ot=l.pendingProps,gt=b.context,et=c.contextType,k=cu,typeof et=="object"&&et!==null&&(k=B(et)),I=c.getDerivedStateFromProps,(et=typeof I=="function"||typeof b.getSnapshotBeforeUpdate=="function")||typeof b.UNSAFE_componentWillReceiveProps!="function"&&typeof b.componentWillReceiveProps!="function"||(w!==ot||gt!==k)&&nC(l,b,h,k),wr=!1,gt=l.memoizedState,b.state=gt,vf(l,h,b,y),yf();var Bt=l.memoizedState;w!==ot||gt!==Bt||wr||r!==null&&r.dependencies!==null&&tn(r.dependencies)?(typeof I=="function"&&(H0(l,c,I,h),Bt=l.memoizedState),(ct=wr||eC(l,c,ct,h,gt,Bt,k)||r!==null&&r.dependencies!==null&&tn(r.dependencies))?(et||typeof b.UNSAFE_componentWillUpdate!="function"&&typeof b.componentWillUpdate!="function"||(typeof b.componentWillUpdate=="function"&&b.componentWillUpdate(h,Bt,k),typeof b.UNSAFE_componentWillUpdate=="function"&&b.UNSAFE_componentWillUpdate(h,Bt,k)),typeof b.componentDidUpdate=="function"&&(l.flags|=4),typeof b.getSnapshotBeforeUpdate=="function"&&(l.flags|=1024)):(typeof b.componentDidUpdate!="function"||w===r.memoizedProps&>===r.memoizedState||(l.flags|=4),typeof b.getSnapshotBeforeUpdate!="function"||w===r.memoizedProps&>===r.memoizedState||(l.flags|=1024),l.memoizedProps=h,l.memoizedState=Bt),b.props=h,b.state=Bt,b.context=k,h=ct):(typeof b.componentDidUpdate!="function"||w===r.memoizedProps&>===r.memoizedState||(l.flags|=4),typeof b.getSnapshotBeforeUpdate!="function"||w===r.memoizedProps&>===r.memoizedState||(l.flags|=1024),h=!1)}return b=h,Op(r,l),h=(l.flags&128)!==0,b||h?(b=l.stateNode,c=h&&typeof c.getDerivedStateFromError!="function"?null:b.render(),l.flags|=1,r!==null&&h?(l.child=Kl(l,r.child,null,y),l.child=Kl(l,null,c,y)):Un(r,l,c,y),l.memoizedState=b.state,r=l.child):r=So(r,l,y),r}function pC(r,l,c,h){return ge(),l.flags|=256,Un(r,l,c,h),l.child}function j0(r){return{baseLanes:r,cachePool:ve()}}function q0(r,l,c){return r=r!==null?r.childLanes&~c:0,l&&(r|=Fi),r}function mC(r,l,c){var h=l.pendingProps,y=!1,b=(l.flags&128)!==0,w;if((w=b)||(w=r!==null&&r.memoizedState===null?!1:(nn.current&2)!==0),w&&(y=!0,l.flags&=-129),w=(l.flags&32)!==0,l.flags&=-33,r===null){if(Kt){if(y?vr(l):Sr(l),(r=Ue)?(r=cB(r,fa),r!==null&&(l.memoizedState={dehydrated:r,treeContext:Rr!==null?{id:no,overflow:io}:null,retryLane:536870912,hydrationErrors:null},c=sw(r),c.return=l,l.child=c,jn=l,Ue=null)):r=null,r===null)throw ne(l);return AS(r)?l.lanes=32:l.lanes=536870912,null}var I=h.children;return h=h.fallback,y?(Sr(l),y=l.mode,I=_p({mode:"hidden",children:I},y),h=ql(h,y,c,null),I.return=l,h.return=l,I.sibling=h,l.child=I,h=l.child,h.memoizedState=j0(c),h.childLanes=q0(r,w,c),l.memoizedState=VS,xf(null,h)):(vr(l),F0(l,I))}var k=r.memoizedState;if(k!==null&&(I=k.dehydrated,I!==null)){if(b)l.flags&256?(vr(l),l.flags&=-257,l=G0(r,l,c)):l.memoizedState!==null?(Sr(l),l.child=r.child,l.flags|=128,l=null):(Sr(l),I=h.fallback,y=l.mode,h=_p({mode:"visible",children:h.children},y),I=ql(I,y,c,null),I.flags|=2,h.return=l,I.return=l,h.sibling=I,l.child=h,Kl(l,r.child,null,c),h=l.child,h.memoizedState=j0(c),h.childLanes=q0(r,w,c),l.memoizedState=VS,l=xf(null,h));else if(vr(l),AS(I))w=W5(I).digest,h=Error(i(419)),h.stack="",h.digest=w,Mn({value:h,source:null,stack:null}),l=G0(r,l,c);else if(un||Zn(r,l,c,!1),w=(c&r.childLanes)!==0,un||w){if(w=Ae,w!==null&&(h=q(w,c),h!==0&&h!==k.retryLane))throw k.retryLane=h,Hl(r,h),vi(w,r,h),US;ES(I)||Bp(),l=G0(r,l,c)}else ES(I)?(l.flags|=192,l.child=r.child,l=null):(r=k.treeContext,$n&&(Ue=oB(I),jn=l,Kt=!0,Cr=null,fa=!1,r!==null&&ee(l,r)),l=F0(l,h.children),l.flags|=4096);return l}return y?(Sr(l),I=h.fallback,y=l.mode,k=r.child,b=k.sibling,h=Eo(k,{mode:"hidden",children:h.children}),h.subtreeFlags=k.subtreeFlags&65011712,b!==null?I=Eo(b,I):(I=ql(I,y,c,null),I.flags|=2),I.return=l,h.return=l,h.sibling=I,l.child=h,xf(null,h),h=l.child,I=r.child.memoizedState,I===null?I=j0(c):(y=I.cachePool,y!==null?(k=Ao?Ve._currentValue:Ve._currentValue2,y=y.parent!==k?{parent:k,pool:k}:y):y=ve(),I={baseLanes:I.baseLanes|c,cachePool:y}),h.memoizedState=I,h.childLanes=q0(r,w,c),l.memoizedState=VS,xf(r.child,h)):(vr(l),c=r.child,r=c.sibling,c=Eo(c,{mode:"visible",children:h.children}),c.return=l,c.sibling=null,r!==null&&(w=l.deletions,w===null?(l.deletions=[r],l.flags|=16):w.push(r)),l.child=c,l.memoizedState=null,c)}function F0(r,l){return l=_p({mode:"visible",children:l},r.mode),l.return=r,r.child=l}function _p(r,l){return r=e(22,r,null,l),r.lanes=0,r}function G0(r,l,c){return Kl(l,r.child,null,c),r=F0(l,l.pendingProps.children),r.flags|=2,l.memoizedState=null,r}function gC(r,l,c){r.lanes|=l;var h=r.alternate;h!==null&&(h.lanes|=l),te(r.return,l,c)}function k0(r,l,c,h,y,b){var w=r.memoizedState;w===null?r.memoizedState={isBackwards:l,rendering:null,renderingStartTime:0,last:h,tail:c,tailMode:y,treeForkCount:b}:(w.isBackwards=l,w.rendering=null,w.renderingStartTime=0,w.last=h,w.tail=c,w.tailMode=y,w.treeForkCount=b)}function yC(r,l,c){var h=l.pendingProps,y=h.revealOrder,b=h.tail;h=h.children;var w=nn.current,I=(w&2)!==0;if(I?(w=w&1|2,l.flags|=128):w&=1,v(nn,w),Un(r,l,h,c),h=Kt?Nf:0,!I&&r!==null&&r.flags&128)t:for(r=l.child;r!==null;){if(r.tag===13)r.memoizedState!==null&&gC(r,c,l);else if(r.tag===19)gC(r,c,l);else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===l)break t;for(;r.sibling===null;){if(r.return===null||r.return===l)break t;r=r.return}r.sibling.return=r.return,r=r.sibling}switch(y){case"forwards":for(c=l.child,y=null;c!==null;)r=c.alternate,r!==null&&bp(r)===null&&(y=c),c=c.sibling;c=y,c===null?(y=l.child,l.child=null):(y=c.sibling,c.sibling=null),k0(l,!1,y,c,b,h);break;case"backwards":case"unstable_legacy-backwards":for(c=null,y=l.child,l.child=null;y!==null;){if(r=y.alternate,r!==null&&bp(r)===null){l.child=y;break}r=y.sibling,y.sibling=c,c=y,y=r}k0(l,!0,c,null,b,h);break;case"together":k0(l,!1,null,null,void 0,h);break;default:l.memoizedState=null}return l.child}function So(r,l,c){if(r!==null&&(l.dependencies=r.dependencies),Or|=l.lanes,!(c&l.childLanes))if(r!==null){if(Zn(r,l,c,!1),(c&l.childLanes)===0)return null}else return null;if(r!==null&&l.child!==r.child)throw Error(i(153));if(l.child!==null){for(r=l.child,c=Eo(r,r.pendingProps),l.child=c,c.return=l;r.sibling!==null;)r=r.sibling,c=c.sibling=Eo(r,r.pendingProps),c.return=l;c.sibling=null}return l.child}function Y0(r,l){return r.lanes&l?!0:(r=r.dependencies,!!(r!==null&&tn(r)))}function F4(r,l,c){switch(l.tag){case 3:ce(l,l.stateNode.containerInfo),St(l,Ve,r.memoizedState.cache),ge();break;case 27:case 5:pe(l);break;case 4:ce(l,l.stateNode.containerInfo);break;case 10:St(l,l.type,l.memoizedProps.value);break;case 31:if(l.memoizedState!==null)return l.flags|=128,E0(l),null;break;case 13:var h=l.memoizedState;if(h!==null)return h.dehydrated!==null?(vr(l),l.flags|=128,null):c&l.child.childLanes?mC(r,l,c):(vr(l),r=So(r,l,c),r!==null?r.sibling:null);vr(l);break;case 19:var y=(r.flags&128)!==0;if(h=(c&l.childLanes)!==0,h||(Zn(r,l,c,!1),h=(c&l.childLanes)!==0),y){if(h)return yC(r,l,c);l.flags|=128}if(y=l.memoizedState,y!==null&&(y.rendering=null,y.tail=null,y.lastEffect=null),v(nn,nn.current),h)break;return null;case 22:return l.lanes=0,uC(r,l,c,l.pendingProps);case 24:St(l,Ve,r.memoizedState.cache)}return So(r,l,c)}function vC(r,l,c){if(r!==null)if(r.memoizedProps!==l.pendingProps)un=!0;else{if(!Y0(r,c)&&!(l.flags&128))return un=!1,F4(r,l,c);un=!!(r.flags&131072)}else un=!1,Kt&&l.flags&1048576&&Rt(l,Nf,l.index);switch(l.lanes=0,l.tag){case 16:t:{var h=l.pendingProps;if(r=yi(l.elementType),l.type=r,typeof r=="function")uS(r)?(h=Ul(r,h),l.tag=1,l=hC(null,l,r,h,c)):(l.tag=0,l=V0(null,l,r,h,c));else{if(r!=null){var y=r.$$typeof;if(y===mS){l.tag=11,l=rC(null,l,r,h,c);break t}else if(y===vS){l.tag=14,l=lC(null,l,r,h,c);break t}}throw l=f(r)||r,Error(i(306,l,""))}}return l;case 0:return V0(r,l,l.type,l.pendingProps,c);case 1:return h=l.type,y=Ul(h,l.pendingProps),hC(r,l,h,y,c);case 3:t:{if(ce(l,l.stateNode.containerInfo),r===null)throw Error(i(387));var b=l.pendingProps;y=l.memoizedState,h=y.element,v0(r,l),vf(l,b,null,c);var w=l.memoizedState;if(b=w.cache,St(l,Ve,b),b!==y.cache&&Hn(l,[Ve],c,!0),yf(),b=w.element,$n&&y.isDehydrated)if(y={element:b,isDehydrated:!1,cache:w.cache},l.updateQueue.baseState=y,l.memoizedState=y,l.flags&256){l=pC(r,l,b,c);break t}else if(b!==h){h=lt(Error(i(424)),l),Mn(h),l=pC(r,l,b,c);break t}else for($n&&(Ue=iB(l.stateNode.containerInfo),jn=l,Kt=!0,Cr=null,fa=!0),c=kw(l,null,b,c),l.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling;else{if(ge(),b===h){l=So(r,l,c);break t}Un(r,l,b,c)}l=l.child}return l;case 26:if(Da)return Op(r,l),r===null?(c=zw(l.type,null,l.pendingProps,null))?l.memoizedState=c:Kt||(l.stateNode=_B(l.type,l.pendingProps,Tr.current,l)):l.memoizedState=zw(l.type,r.memoizedProps,l.pendingProps,r.memoizedState),null;case 27:if(En)return pe(l),r===null&&En&&Kt&&(h=l.stateNode=Pw(l.type,l.pendingProps,Tr.current,Vn.current,!1),jn=l,fa=!0,Ue=rB(l.type,h,Ue)),Un(r,l,l.pendingProps.children,c),Op(r,l),r===null&&(l.flags|=4194304),l.child;case 5:return r===null&&Kt&&(wB(l.type,l.pendingProps,Vn.current),(y=h=Ue)&&(h=lB(h,l.type,l.pendingProps,fa),h!==null?(l.stateNode=h,jn=l,Ue=nB(h),fa=!1,y=!0):y=!1),y||ne(l)),pe(l),y=l.type,b=l.pendingProps,w=r!==null?r.memoizedProps:null,h=b.children,jp(y,b)?h=null:w!==null&&jp(y,w)&&(l.flags|=32),l.memoizedState!==null&&(y=R0(r,l,L4,null,null,c),Ao?Gl._currentValue=y:Gl._currentValue2=y),Op(r,l),Un(r,l,h,c),l.child;case 6:return r===null&&Kt&&(MB(l.pendingProps,Vn.current),(r=c=Ue)&&(c=sB(c,l.pendingProps,fa),c!==null?(l.stateNode=c,jn=l,Ue=null,r=!0):r=!1),r||ne(l)),null;case 13:return mC(r,l,c);case 4:return ce(l,l.stateNode.containerInfo),h=l.pendingProps,r===null?l.child=Kl(l,null,h,c):Un(r,l,h,c),l.child;case 11:return rC(r,l,l.type,l.pendingProps,c);case 7:return Un(r,l,l.pendingProps,c),l.child;case 8:return Un(r,l,l.pendingProps.children,c),l.child;case 12:return Un(r,l,l.pendingProps.children,c),l.child;case 10:return h=l.pendingProps,St(l,l.type,h.value),Un(r,l,h.children,c),l.child;case 9:return y=l.type._context,h=l.pendingProps.children,bn(l),y=B(y),h=h(y),l.flags|=1,Un(r,l,h,c),l.child;case 14:return lC(r,l,l.type,l.pendingProps,c);case 15:return sC(r,l,l.type,l.pendingProps,c);case 19:return yC(r,l,c);case 31:return q4(r,l,c);case 22:return uC(r,l,c,l.pendingProps);case 24:return bn(l),h=B(Ve),r===null?(y=Ee(),y===null&&(y=Ae,b=ht(),y.pooledCache=b,b.refCount++,b!==null&&(y.pooledCacheLanes|=c),y=b),l.memoizedState={parent:h,cache:y},y0(l),St(l,Ve,y)):(r.lanes&c&&(v0(r,l),vf(l,null,null,c),yf()),y=r.memoizedState,b=l.memoizedState,y.parent!==h?(y={parent:h,cache:h},l.memoizedState=y,l.lanes===0&&(l.memoizedState=l.updateQueue.baseState=y),St(l,Ve,h)):(h=b.cache,St(l,Ve,h),h!==y.cache&&Hn(l,[Ve],c,!0))),Un(r,l,l.pendingProps.children,c),l.child;case 29:throw l.pendingProps}throw Error(i(156,l.tag))}function za(r){r.flags|=4}function zp(r){eo&&(r.flags|=8)}function SC(r,l){if(r!==null&&r.child===l.child)return!1;if(l.flags&16)return!0;for(r=l.child;r!==null;){if(r.flags&8218||r.subtreeFlags&8218)return!0;r=r.sibling}return!1}function Q0(r,l,c,h){if(Jn)for(c=l.child;c!==null;){if(c.tag===5||c.tag===6)bS(r,c.stateNode);else if(!(c.tag===4||En&&c.tag===27)&&c.child!==null){c.child.return=c,c=c.child;continue}if(c===l)break;for(;c.sibling===null;){if(c.return===null||c.return===l)return;c=c.return}c.sibling.return=c.return,c=c.sibling}else if(eo)for(var y=l.child;y!==null;){if(y.tag===5){var b=y.stateNode;c&&h&&(b=Cw(b,y.type,y.memoizedProps)),bS(r,b)}else if(y.tag===6)b=y.stateNode,c&&h&&(b=ww(b,y.memoizedProps)),bS(r,b);else if(y.tag!==4){if(y.tag===22&&y.memoizedState!==null)b=y.child,b!==null&&(b.return=y),Q0(r,y,!0,!0);else if(y.child!==null){y.child.return=y,y=y.child;continue}}if(y===l)break;for(;y.sibling===null;){if(y.return===null||y.return===l)return;y=y.return}y.sibling.return=y.return,y=y.sibling}}function bC(r,l,c,h){var y=!1;if(eo)for(var b=l.child;b!==null;){if(b.tag===5){var w=b.stateNode;c&&h&&(w=Cw(w,b.type,b.memoizedProps)),Rw(r,w)}else if(b.tag===6)w=b.stateNode,c&&h&&(w=ww(w,b.memoizedProps)),Rw(r,w);else if(b.tag!==4){if(b.tag===22&&b.memoizedState!==null)y=b.child,y!==null&&(y.return=b),bC(r,b,!0,!0),y=!0;else if(b.child!==null){b.child.return=b,b=b.child;continue}}if(b===l)break;for(;b.sibling===null;){if(b.return===null||b.return===l)return y;b=b.return}b.sibling.return=b.return,b=b.sibling}return y}function xC(r,l){if(eo&&SC(r,l)){r=l.stateNode;var c=r.containerInfo,h=Aw();bC(h,l,!1,!1),r.pendingChildren=h,za(l),Z5(c,h)}}function X0(r,l,c,h){if(Jn)r.memoizedProps!==h&&za(l);else if(eo){var y=r.stateNode,b=r.memoizedProps;if((r=SC(r,l))||b!==h){var w=Vn.current;b=K5(y,c,b,h,!r,null),b===y?l.stateNode=y:(zp(l),vw(b,c,h,w)&&za(l),l.stateNode=b,r&&Q0(b,l,!1,!1))}else l.stateNode=y}}function K0(r,l,c,h,y){if(r.mode&32&&(c===null?E5(l,h):A5(l,c,h))){if(r.flags|=16777216,(y&335544128)===y||xS(l,h))if(bw(r.stateNode,l,h))r.flags|=8192;else if(QC())r.flags|=8192;else throw Xl=Jp,DS}else r.flags&=-16777217}function EC(r,l){if(NB(l)){if(r.flags|=16777216,!Bw(l))if(QC())r.flags|=8192;else throw Xl=Jp,DS}else r.flags&=-16777217}function Np(r,l){l!==null&&(r.flags|=4),r.flags&16384&&(l=r.tag!==22?R():536870912,r.lanes|=l,Ru|=l)}function Ef(r,l){if(!Kt)switch(r.tailMode){case"hidden":l=r.tail;for(var c=null;l!==null;)l.alternate!==null&&(c=l),l=l.sibling;c===null?r.tail=null:c.sibling=null;break;case"collapsed":c=r.tail;for(var h=null;c!==null;)c.alternate!==null&&(h=c),c=c.sibling;h===null?l||r.tail===null?r.tail=null:r.tail.sibling=null:h.sibling=null}}function Oe(r){var l=r.alternate!==null&&r.alternate.child===r.child,c=0,h=0;if(l)for(var y=r.child;y!==null;)c|=y.lanes|y.childLanes,h|=y.subtreeFlags&65011712,h|=y.flags&65011712,y.return=r,y=y.sibling;else for(y=r.child;y!==null;)c|=y.lanes|y.childLanes,h|=y.subtreeFlags,h|=y.flags,y.return=r,y=y.sibling;return r.subtreeFlags|=h,r.childLanes=c,l}function G4(r,l,c){var h=l.pendingProps;switch(Ct(l),l.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Oe(l),null;case 1:return Oe(l),null;case 3:return c=l.stateNode,h=null,r!==null&&(h=r.memoizedState.cache),l.memoizedState.cache!==h&&(l.flags|=2048),It(Ve),le(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(r===null||r.child===null)&&(me(l)?za(l):r===null||r.memoizedState.isDehydrated&&!(l.flags&256)||(l.flags|=1024,$t())),xC(r,l),Oe(l),null;case 26:if(Da){var y=l.type,b=l.memoizedState;return r===null?(za(l),b!==null?(Oe(l),EC(l,b)):(Oe(l),K0(l,y,null,h,c))):b?b!==r.memoizedState?(za(l),Oe(l),EC(l,b)):(Oe(l),l.flags&=-16777217):(b=r.memoizedProps,Jn?b!==h&&za(l):X0(r,l,y,h),Oe(l),K0(l,y,b,h,c)),null}case 27:if(En){if(De(l),c=Tr.current,y=l.type,r!==null&&l.stateNode!=null)Jn?r.memoizedProps!==h&&za(l):X0(r,l,y,h);else{if(!h){if(l.stateNode===null)throw Error(i(166));return Oe(l),null}r=Vn.current,me(l)?Di(l,r):(r=Pw(y,h,c,r,!0),l.stateNode=r,za(l))}return Oe(l),null}case 5:if(De(l),y=l.type,r!==null&&l.stateNode!=null)X0(r,l,y,h);else{if(!h){if(l.stateNode===null)throw Error(i(166));return Oe(l),null}if(b=Vn.current,me(l))Di(l,b),xB(l.stateNode,y,h,b)&&(l.flags|=64);else{var w=p5(y,h,Tr.current,b,l);zp(l),Q0(w,l,!1,!1),l.stateNode=w,vw(w,y,h,b)&&za(l)}}return Oe(l),K0(l,l.type,r===null?null:r.memoizedProps,l.pendingProps,c),null;case 6:if(r&&l.stateNode!=null)c=r.memoizedProps,Jn?c!==h&&za(l):eo&&(c!==h?(r=Tr.current,c=Vn.current,zp(l),l.stateNode=Sw(h,r,c,l)):l.stateNode=r.stateNode);else{if(typeof h!="string"&&l.stateNode===null)throw Error(i(166));if(r=Tr.current,c=Vn.current,me(l)){if(!$n)throw Error(i(176));if(r=l.stateNode,c=l.memoizedProps,h=null,y=jn,y!==null)switch(y.tag){case 27:case 5:h=y.memoizedProps}dB(r,c,l,h)||ne(l,!0)}else zp(l),l.stateNode=Sw(h,r,c,l)}return Oe(l),null;case 31:if(c=l.memoizedState,r===null||r.memoizedState!==null){if(h=me(l),c!==null){if(r===null){if(!h)throw Error(i(318));if(!$n)throw Error(i(556));if(r=l.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(i(557));hB(r,l)}else ge(),!(l.flags&128)&&(l.memoizedState=null),l.flags|=4;Oe(l),r=!1}else c=$t(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=c),r=!0;if(!r)return l.flags&256?(Li(l),l):(Li(l),null);if(l.flags&128)throw Error(i(558))}return Oe(l),null;case 13:if(h=l.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(y=me(l),h!==null&&h.dehydrated!==null){if(r===null){if(!y)throw Error(i(318));if(!$n)throw Error(i(344));if(y=l.memoizedState,y=y!==null?y.dehydrated:null,!y)throw Error(i(317));pB(y,l)}else ge(),!(l.flags&128)&&(l.memoizedState=null),l.flags|=4;Oe(l),y=!1}else y=$t(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=y),y=!0;if(!y)return l.flags&256?(Li(l),l):(Li(l),null)}return Li(l),l.flags&128?(l.lanes=c,l):(c=h!==null,r=r!==null&&r.memoizedState!==null,c&&(h=l.child,y=null,h.alternate!==null&&h.alternate.memoizedState!==null&&h.alternate.memoizedState.cachePool!==null&&(y=h.alternate.memoizedState.cachePool.pool),b=null,h.memoizedState!==null&&h.memoizedState.cachePool!==null&&(b=h.memoizedState.cachePool.pool),b!==y&&(h.flags|=2048)),c!==r&&c&&(l.child.flags|=8192),Np(l,l.updateQueue),Oe(l),null);case 4:return le(),xC(r,l),r===null&&v5(l.stateNode.containerInfo),Oe(l),null;case 10:return It(l.type),Oe(l),null;case 19:if(g(nn),h=l.memoizedState,h===null)return Oe(l),null;if(y=(l.flags&128)!==0,b=h.rendering,b===null)if(y)Ef(h,!1);else{if(Xe!==0||r!==null&&r.flags&128)for(r=l.child;r!==null;){if(b=bp(r),b!==null){for(l.flags|=128,Ef(h,!1),r=b.updateQueue,l.updateQueue=r,Np(l,r),l.subtreeFlags=0,r=c,c=l.child;c!==null;)lw(c,r),c=c.sibling;return v(nn,nn.current&1|2),Kt&&dt(l,h.treeForkCount),l.child}r=r.sibling}h.tail!==null&&Si()>Vf&&(l.flags|=128,y=!0,Ef(h,!1),l.lanes=4194304)}else{if(!y)if(r=bp(b),r!==null){if(l.flags|=128,y=!0,r=r.updateQueue,l.updateQueue=r,Np(l,r),Ef(h,!0),h.tail===null&&h.tailMode==="hidden"&&!b.alternate&&!Kt)return Oe(l),null}else 2*Si()-h.renderingStartTime>Vf&&c!==536870912&&(l.flags|=128,y=!0,Ef(h,!1),l.lanes=4194304);h.isBackwards?(b.sibling=l.child,l.child=b):(r=h.last,r!==null?r.sibling=b:l.child=b,h.last=b)}return h.tail!==null?(r=h.tail,h.rendering=r,h.tail=r.sibling,h.renderingStartTime=Si(),r.sibling=null,c=nn.current,v(nn,y?c&1|2:c&1),Kt&&dt(l,h.treeForkCount),r):(Oe(l),null);case 22:case 23:return Li(l),x0(),h=l.memoizedState!==null,r!==null?r.memoizedState!==null!==h&&(l.flags|=8192):h&&(l.flags|=8192),h?c&536870912&&!(l.flags&128)&&(Oe(l),l.subtreeFlags&6&&(l.flags|=8192)):Oe(l),c=l.updateQueue,c!==null&&Np(l,c.retryQueue),c=null,r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(c=r.memoizedState.cachePool.pool),h=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(h=l.memoizedState.cachePool.pool),h!==c&&(l.flags|=2048),r!==null&&g(Ql),null;case 24:return c=null,r!==null&&(c=r.memoizedState.cache),l.memoizedState.cache!==c&&(l.flags|=2048),It(Ve),Oe(l),null;case 25:return null;case 30:return null}throw Error(i(156,l.tag))}function k4(r,l){switch(Ct(l),l.tag){case 1:return r=l.flags,r&65536?(l.flags=r&-65537|128,l):null;case 3:return It(Ve),le(),r=l.flags,r&65536&&!(r&128)?(l.flags=r&-65537|128,l):null;case 26:case 27:case 5:return De(l),null;case 31:if(l.memoizedState!==null){if(Li(l),l.alternate===null)throw Error(i(340));ge()}return r=l.flags,r&65536?(l.flags=r&-65537|128,l):null;case 13:if(Li(l),r=l.memoizedState,r!==null&&r.dehydrated!==null){if(l.alternate===null)throw Error(i(340));ge()}return r=l.flags,r&65536?(l.flags=r&-65537|128,l):null;case 19:return g(nn),null;case 4:return le(),null;case 10:return It(l.type),null;case 22:case 23:return Li(l),x0(),r!==null&&g(Ql),r=l.flags,r&65536?(l.flags=r&-65537|128,l):null;case 24:return It(Ve),null;case 25:return null;default:return null}}function AC(r,l){switch(Ct(l),l.tag){case 3:It(Ve),le();break;case 26:case 27:case 5:De(l);break;case 4:le();break;case 31:l.memoizedState!==null&&Li(l);break;case 13:Li(l);break;case 19:g(nn);break;case 10:It(l.type);break;case 22:case 23:Li(l),x0(),r!==null&&g(Ql);break;case 24:It(Ve)}}function Af(r,l){try{var c=l.updateQueue,h=c!==null?c.lastEffect:null;if(h!==null){var y=h.next;c=y;do{if((c.tag&r)===r){h=void 0;var b=c.create,w=c.inst;h=b(),w.destroy=h}c=c.next}while(c!==y)}}catch(I){ie(l,l.return,I)}}function br(r,l,c){try{var h=l.updateQueue,y=h!==null?h.lastEffect:null;if(y!==null){var b=y.next;h=b;do{if((h.tag&r)===r){var w=h.inst,I=w.destroy;if(I!==void 0){w.destroy=void 0,y=l;var k=c,et=I;try{et()}catch(ct){ie(y,k,ct)}}}h=h.next}while(h!==b)}}catch(ct){ie(l,l.return,ct)}}function RC(r){var l=r.updateQueue;if(l!==null){var c=r.stateNode;try{yT(l,c)}catch(h){ie(r,r.return,h)}}}function TC(r,l,c){c.props=Ul(r.type,r.memoizedProps),c.state=r.memoizedState;try{c.componentWillUnmount()}catch(h){ie(r,l,h)}}function Rf(r,l){try{var c=r.ref;if(c!==null){switch(r.tag){case 26:case 27:case 5:var h=Mf(r.stateNode);break;case 30:h=r.stateNode;break;default:h=r.stateNode}typeof c=="function"?r.refCleanup=c(h):c.current=h}}catch(y){ie(r,l,y)}}function to(r,l){var c=r.ref,h=r.refCleanup;if(c!==null)if(typeof h=="function")try{h()}catch(y){ie(r,l,y)}finally{r.refCleanup=null,r=r.alternate,r!=null&&(r.refCleanup=null)}else if(typeof c=="function")try{c(null)}catch(y){ie(r,l,y)}else c.current=null}function CC(r){var l=r.type,c=r.memoizedProps,h=r.stateNode;try{H5(h,l,c,r)}catch(y){ie(r,r.return,y)}}function Z0(r,l,c){try{U5(r.stateNode,r.type,c,l,r)}catch(h){ie(r,r.return,h)}}function wC(r){return r.tag===5||r.tag===3||(Da?r.tag===26:!1)||(En?r.tag===27&&su(r.type):!1)||r.tag===4}function W0(r){t:for(;;){for(;r.sibling===null;){if(r.return===null||wC(r.return))return null;r=r.return}for(r.sibling.return=r.return,r=r.sibling;r.tag!==5&&r.tag!==6&&r.tag!==18;){if(En&&r.tag===27&&su(r.type)||r.flags&2||r.child===null||r.tag===4)continue t;r.child.return=r,r=r.child}if(!(r.flags&2))return r.stateNode}}function J0(r,l,c){var h=r.tag;if(h===5||h===6)r=r.stateNode,l?j5(c,r,l):B5(c,r);else if(h!==4&&(En&&h===27&&su(r.type)&&(c=r.stateNode,l=null),r=r.child,r!==null))for(J0(r,l,c),r=r.sibling;r!==null;)J0(r,l,c),r=r.sibling}function Ip(r,l,c){var h=r.tag;if(h===5||h===6)r=r.stateNode,l?V5(c,r,l):L5(c,r);else if(h!==4&&(En&&h===27&&su(r.type)&&(c=r.stateNode),r=r.child,r!==null))for(Ip(r,l,c),r=r.sibling;r!==null;)Ip(r,l,c),r=r.sibling}function MC(r,l,c){r=r.containerInfo;try{Tw(r,c)}catch(h){ie(l,l.return,h)}}function OC(r){var l=r.stateNode,c=r.memoizedProps;try{DB(r.type,c,l,r)}catch(h){ie(r,r.return,h)}}function Y4(r,l){for(d5(r.containerInfo),_n=l;_n!==null;)if(r=_n,l=r.child,(r.subtreeFlags&1028)!==0&&l!==null)l.return=r,_n=l;else for(;_n!==null;){r=_n;var c=r.alternate;switch(l=r.flags,r.tag){case 0:if(l&4&&(l=r.updateQueue,l=l!==null?l.events:null,l!==null))for(var h=0;h<l.length;h++){var y=l[h];y.ref.impl=y.nextImpl}break;case 11:case 15:break;case 1:if(l&1024&&c!==null){l=void 0,h=r,y=c.memoizedProps,c=c.memoizedState;var b=h.stateNode;try{var w=Ul(h.type,y);l=b.getSnapshotBeforeUpdate(w,c),b.__reactInternalSnapshotBeforeUpdate=l}catch(I){ie(h,h.return,I)}}break;case 3:l&1024&&Jn&&X5(r.stateNode.containerInfo);break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if(l&1024)throw Error(i(163))}if(l=r.sibling,l!==null){l.return=r.return,_n=l;break}_n=r.return}}function _C(r,l,c){var h=c.flags;switch(c.tag){case 0:case 11:case 15:bo(r,c),h&4&&Af(5,c);break;case 1:if(bo(r,c),h&4)if(r=c.stateNode,l===null)try{r.componentDidMount()}catch(w){ie(c,c.return,w)}else{var y=Ul(c.type,l.memoizedProps);l=l.memoizedState;try{r.componentDidUpdate(y,l,r.__reactInternalSnapshotBeforeUpdate)}catch(w){ie(c,c.return,w)}}h&64&&RC(c),h&512&&Rf(c,c.return);break;case 3:if(bo(r,c),h&64&&(h=c.updateQueue,h!==null)){if(r=null,c.child!==null)switch(c.child.tag){case 27:case 5:r=Mf(c.child.stateNode);break;case 1:r=c.child.stateNode}try{yT(h,r)}catch(w){ie(c,c.return,w)}}break;case 27:En&&l===null&&h&4&&OC(c);case 26:case 5:if(bo(r,c),l===null){if(h&4)CC(c);else if(h&64){r=c.type,l=c.memoizedProps,y=c.stateNode;try{yB(y,r,l,c)}catch(w){ie(c,c.return,w)}}}h&512&&Rf(c,c.return);break;case 12:bo(r,c);break;case 31:bo(r,c),h&4&&NC(r,c);break;case 13:bo(r,c),h&4&&IC(r,c),h&64&&(h=c.memoizedState,h!==null&&(h=h.dehydrated,h!==null&&(c=$4.bind(null,c),J5(h,c))));break;case 22:if(h=c.memoizedState!==null||wo,!h){l=l!==null&&l.memoizedState!==null||cn,y=wo;var b=cn;wo=h,(cn=l)&&!b?xo(r,c,(c.subtreeFlags&8772)!==0):bo(r,c),wo=y,cn=b}break;case 30:break;default:bo(r,c)}}function zC(r){var l=r.alternate;l!==null&&(r.alternate=null,zC(l)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(l=r.stateNode,l!==null&&x5(l)),r.stateNode=null,r.return=null,r.dependencies=null,r.memoizedProps=null,r.memoizedState=null,r.pendingProps=null,r.stateNode=null,r.updateQueue=null}function Na(r,l,c){for(c=c.child;c!==null;)$0(r,l,c),c=c.sibling}function $0(r,l,c){if(Ui&&typeof Ui.onCommitFiberUnmount=="function")try{Ui.onCommitFiberUnmount(zf,c)}catch{}switch(c.tag){case 26:if(Da){cn||to(c,l),Na(r,l,c),c.memoizedState?Iw(c.memoizedState):c.stateNode&&Lw(c.stateNode);break}case 27:if(En){cn||to(c,l);var h=fn,y=bi;su(c.type)&&(fn=c.stateNode,bi=!1),Na(r,l,c),Hw(c.stateNode),fn=h,bi=y;break}case 5:cn||to(c,l);case 6:if(Jn){if(h=fn,y=bi,fn=null,Na(r,l,c),fn=h,bi=y,fn!==null)if(bi)try{F5(fn,c.stateNode)}catch(b){ie(c,l,b)}else try{q5(fn,c.stateNode)}catch(b){ie(c,l,b)}}else Na(r,l,c);break;case 18:Jn&&fn!==null&&(bi?RB(fn,c.stateNode):AB(fn,c.stateNode));break;case 4:Jn?(h=fn,y=bi,fn=c.stateNode.containerInfo,bi=!0,Na(r,l,c),fn=h,bi=y):(eo&&MC(c.stateNode,c,Aw()),Na(r,l,c));break;case 0:case 11:case 14:case 15:br(2,c,l),cn||br(4,c,l),Na(r,l,c);break;case 1:cn||(to(c,l),h=c.stateNode,typeof h.componentWillUnmount=="function"&&TC(c,l,h)),Na(r,l,c);break;case 21:Na(r,l,c);break;case 22:cn=(h=cn)||c.memoizedState!==null,Na(r,l,c),cn=h;break;default:Na(r,l,c)}}function NC(r,l){if($n&&l.memoizedState===null&&(r=l.alternate,r!==null&&(r=r.memoizedState,r!==null))){r=r.dehydrated;try{SB(r)}catch(c){ie(l,l.return,c)}}}function IC(r,l){if($n&&l.memoizedState===null&&(r=l.alternate,r!==null&&(r=r.memoizedState,r!==null&&(r=r.dehydrated,r!==null))))try{bB(r)}catch(c){ie(l,l.return,c)}}function Q4(r){switch(r.tag){case 31:case 13:case 19:var l=r.stateNode;return l===null&&(l=r.stateNode=new Xw),l;case 22:return r=r.stateNode,l=r._retryCache,l===null&&(l=r._retryCache=new Xw),l;default:throw Error(i(435,r.tag))}}function Dp(r,l){var c=Q4(r);l.forEach(function(h){if(!c.has(h)){c.add(h);var y=t5.bind(null,r,h);h.then(y,y)}})}function Wn(r,l){var c=l.deletions;if(c!==null)for(var h=0;h<c.length;h++){var y=c[h],b=r,w=l;if(Jn){var I=w;t:for(;I!==null;){switch(I.tag){case 27:if(En){if(su(I.type)){fn=I.stateNode,bi=!1;break t}break}case 5:fn=I.stateNode,bi=!1;break t;case 3:case 4:fn=I.stateNode.containerInfo,bi=!0;break t}I=I.return}if(fn===null)throw Error(i(160));$0(b,w,y),fn=null,bi=!1}else $0(b,w,y);b=y.alternate,b!==null&&(b.return=null),y.return=null}if(l.subtreeFlags&13886)for(l=l.child;l!==null;)DC(l,r),l=l.sibling}function DC(r,l){var c=r.alternate,h=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:Wn(l,r),si(r),h&4&&(br(3,r,r.return),Af(3,r),br(5,r,r.return));break;case 1:Wn(l,r),si(r),h&512&&(cn||c===null||to(c,c.return)),h&64&&wo&&(r=r.updateQueue,r!==null&&(h=r.callbacks,h!==null&&(c=r.shared.hiddenCallbacks,r.shared.hiddenCallbacks=c===null?h:c.concat(h))));break;case 26:if(Da){var y=La;if(Wn(l,r),si(r),h&512&&(cn||c===null||to(c,c.return)),h&4){h=c!==null?c.memoizedState:null;var b=r.memoizedState;c===null?b===null?r.stateNode===null?r.stateNode=OB(y,r.type,r.memoizedProps,r):Dw(y,r.type,r.stateNode):r.stateNode=Nw(y,b,r.memoizedProps):h!==b?(h===null?c.stateNode!==null&&Lw(c.stateNode):Iw(h),b===null?Dw(y,r.type,r.stateNode):Nw(y,b,r.memoizedProps)):b===null&&r.stateNode!==null&&Z0(r,r.memoizedProps,c.memoizedProps)}break}case 27:if(En){Wn(l,r),si(r),h&512&&(cn||c===null||to(c,c.return)),c!==null&&h&4&&Z0(r,r.memoizedProps,c.memoizedProps);break}case 5:if(Wn(l,r),si(r),h&512&&(cn||c===null||to(c,c.return)),Jn){if(r.flags&32){y=r.stateNode;try{Ew(y)}catch(ot){ie(r,r.return,ot)}}h&4&&r.stateNode!=null&&(y=r.memoizedProps,Z0(r,y,c!==null?c.memoizedProps:y)),h&1024&&(jS=!0)}else eo&&r.alternate!==null&&(r.alternate.stateNode=r.stateNode);break;case 6:if(Wn(l,r),si(r),h&4&&Jn){if(r.stateNode===null)throw Error(i(162));h=r.memoizedProps,c=c!==null?c.memoizedProps:h,y=r.stateNode;try{P5(y,c,h)}catch(ot){ie(r,r.return,ot)}}break;case 3:if(Da?(zB(),y=La,La=RS(l.containerInfo),Wn(l,r),La=y):Wn(l,r),si(r),h&4){if(Jn&&$n&&c!==null&&c.memoizedState.isDehydrated)try{vB(l.containerInfo)}catch(ot){ie(r,r.return,ot)}if(eo){h=l.containerInfo,c=l.pendingChildren;try{Tw(h,c)}catch(ot){ie(r,r.return,ot)}}}jS&&(jS=!1,LC(r));break;case 4:Da?(c=La,La=RS(r.stateNode.containerInfo),Wn(l,r),si(r),La=c):(Wn(l,r),si(r)),h&4&&eo&&MC(r.stateNode,r,r.stateNode.pendingChildren);break;case 12:Wn(l,r),si(r);break;case 31:Wn(l,r),si(r),h&4&&(h=r.updateQueue,h!==null&&(r.updateQueue=null,Dp(r,h)));break;case 13:Wn(l,r),si(r),r.child.flags&8192&&r.memoizedState!==null!=(c!==null&&c.memoizedState!==null)&&(lm=Si()),h&4&&(h=r.updateQueue,h!==null&&(r.updateQueue=null,Dp(r,h)));break;case 22:y=r.memoizedState!==null;var w=c!==null&&c.memoizedState!==null,I=wo,k=cn;if(wo=I||y,cn=k||w,Wn(l,r),cn=k,wo=I,si(r),h&8192&&(l=r.stateNode,l._visibility=y?l._visibility&-2:l._visibility|1,y&&(c===null||w||wo||cn||Vl(r)),Jn)){t:if(c=null,Jn)for(l=r;;){if(l.tag===5||Da&&l.tag===26){if(c===null){w=c=l;try{b=w.stateNode,y?G5(b):Y5(w.stateNode,w.memoizedProps)}catch(ot){ie(w,w.return,ot)}}}else if(l.tag===6){if(c===null){w=l;try{var et=w.stateNode;y?k5(et):Q5(et,w.memoizedProps)}catch(ot){ie(w,w.return,ot)}}}else if(l.tag===18){if(c===null){w=l;try{var ct=w.stateNode;y?TB(ct):CB(w.stateNode)}catch(ot){ie(w,w.return,ot)}}}else if((l.tag!==22&&l.tag!==23||l.memoizedState===null||l===r)&&l.child!==null){l.child.return=l,l=l.child;continue}if(l===r)break t;for(;l.sibling===null;){if(l.return===null||l.return===r)break t;c===l&&(c=null),l=l.return}c===l&&(c=null),l.sibling.return=l.return,l=l.sibling}}h&4&&(h=r.updateQueue,h!==null&&(c=h.retryQueue,c!==null&&(h.retryQueue=null,Dp(r,c))));break;case 19:Wn(l,r),si(r),h&4&&(h=r.updateQueue,h!==null&&(r.updateQueue=null,Dp(r,h)));break;case 30:break;case 21:break;default:Wn(l,r),si(r)}}function si(r){var l=r.flags;if(l&2){try{for(var c,h=r.return;h!==null;){if(wC(h)){c=h;break}h=h.return}if(Jn){if(c==null)throw Error(i(160));switch(c.tag){case 27:if(En){var y=c.stateNode,b=W0(r);Ip(r,b,y);break}case 5:var w=c.stateNode;c.flags&32&&(Ew(w),c.flags&=-33);var I=W0(r);Ip(r,I,w);break;case 3:case 4:var k=c.stateNode.containerInfo,et=W0(r);J0(r,et,k);break;default:throw Error(i(161))}}}catch(ct){ie(r,r.return,ct)}r.flags&=-3}l&4096&&(r.flags&=-4097)}function LC(r){if(r.subtreeFlags&1024)for(r=r.child;r!==null;){var l=r;LC(l),l.tag===5&&l.flags&1024&&C5(l.stateNode),r=r.sibling}}function bo(r,l){if(l.subtreeFlags&8772)for(l=l.child;l!==null;)_C(r,l.alternate,l),l=l.sibling}function Vl(r){for(r=r.child;r!==null;){var l=r;switch(l.tag){case 0:case 11:case 14:case 15:br(4,l,l.return),Vl(l);break;case 1:to(l,l.return);var c=l.stateNode;typeof c.componentWillUnmount=="function"&&TC(l,l.return,c),Vl(l);break;case 27:En&&Hw(l.stateNode);case 26:case 5:to(l,l.return),Vl(l);break;case 22:l.memoizedState===null&&Vl(l);break;case 30:Vl(l);break;default:Vl(l)}r=r.sibling}}function xo(r,l,c){for(c=c&&(l.subtreeFlags&8772)!==0,l=l.child;l!==null;){var h=l.alternate,y=r,b=l,w=b.flags;switch(b.tag){case 0:case 11:case 15:xo(y,b,c),Af(4,b);break;case 1:if(xo(y,b,c),h=b,y=h.stateNode,typeof y.componentDidMount=="function")try{y.componentDidMount()}catch(et){ie(h,h.return,et)}if(h=b,y=h.updateQueue,y!==null){var I=h.stateNode;try{var k=y.shared.hiddenCallbacks;if(k!==null)for(y.shared.hiddenCallbacks=null,y=0;y<k.length;y++)gT(k[y],I)}catch(et){ie(h,h.return,et)}}c&&w&64&&RC(b),Rf(b,b.return);break;case 27:En&&OC(b);case 26:case 5:xo(y,b,c),c&&h===null&&w&4&&CC(b),Rf(b,b.return);break;case 12:xo(y,b,c);break;case 31:xo(y,b,c),c&&w&4&&NC(y,b);break;case 13:xo(y,b,c),c&&w&4&&IC(y,b);break;case 22:b.memoizedState===null&&xo(y,b,c),Rf(b,b.return);break;case 30:break;default:xo(y,b,c)}l=l.sibling}}function tS(r,l){var c=null;r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(c=r.memoizedState.cachePool.pool),r=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(r=l.memoizedState.cachePool.pool),r!==c&&(r!=null&&r.refCount++,c!=null&&vt(c))}function eS(r,l){r=null,l.alternate!==null&&(r=l.alternate.memoizedState.cache),l=l.memoizedState.cache,l!==r&&(l.refCount++,r!=null&&vt(r))}function Ia(r,l,c,h){if(l.subtreeFlags&10256)for(l=l.child;l!==null;)BC(r,l,c,h),l=l.sibling}function BC(r,l,c,h){var y=l.flags;switch(l.tag){case 0:case 11:case 15:Ia(r,l,c,h),y&2048&&Af(9,l);break;case 1:Ia(r,l,c,h);break;case 3:Ia(r,l,c,h),y&2048&&(r=null,l.alternate!==null&&(r=l.alternate.memoizedState.cache),l=l.memoizedState.cache,l!==r&&(l.refCount++,r!=null&&vt(r)));break;case 12:if(y&2048){Ia(r,l,c,h),r=l.stateNode;try{var b=l.memoizedProps,w=b.id,I=b.onPostCommit;typeof I=="function"&&I(w,l.alternate===null?"mount":"update",r.passiveEffectDuration,-0)}catch(k){ie(l,l.return,k)}}else Ia(r,l,c,h);break;case 31:Ia(r,l,c,h);break;case 13:Ia(r,l,c,h);break;case 23:break;case 22:b=l.stateNode,w=l.alternate,l.memoizedState!==null?b._visibility&2?Ia(r,l,c,h):Tf(r,l):b._visibility&2?Ia(r,l,c,h):(b._visibility|=2,nu(r,l,c,h,(l.subtreeFlags&10256)!==0||!1)),y&2048&&tS(w,l);break;case 24:Ia(r,l,c,h),y&2048&&eS(l.alternate,l);break;default:Ia(r,l,c,h)}}function nu(r,l,c,h,y){for(y=y&&((l.subtreeFlags&10256)!==0||!1),l=l.child;l!==null;){var b=r,w=l,I=c,k=h,et=w.flags;switch(w.tag){case 0:case 11:case 15:nu(b,w,I,k,y),Af(8,w);break;case 23:break;case 22:var ct=w.stateNode;w.memoizedState!==null?ct._visibility&2?nu(b,w,I,k,y):Tf(b,w):(ct._visibility|=2,nu(b,w,I,k,y)),y&&et&2048&&tS(w.alternate,w);break;case 24:nu(b,w,I,k,y),y&&et&2048&&eS(w.alternate,w);break;default:nu(b,w,I,k,y)}l=l.sibling}}function Tf(r,l){if(l.subtreeFlags&10256)for(l=l.child;l!==null;){var c=r,h=l,y=h.flags;switch(h.tag){case 22:Tf(c,h),y&2048&&tS(h.alternate,h);break;case 24:Tf(c,h),y&2048&&eS(h.alternate,h);break;default:Tf(c,h)}l=l.sibling}}function jl(r,l,c){if(r.subtreeFlags&Eu)for(r=r.child;r!==null;)PC(r,l,c),r=r.sibling}function PC(r,l,c){switch(r.tag){case 26:if(jl(r,l,c),r.flags&Eu)if(r.memoizedState!==null)IB(c,La,r.memoizedState,r.memoizedProps);else{var h=r.stateNode,y=r.type;r=r.memoizedProps,((l&335544128)===l||xS(y,r))&&xw(c,h,y,r)}break;case 5:jl(r,l,c),r.flags&Eu&&(h=r.stateNode,y=r.type,r=r.memoizedProps,((l&335544128)===l||xS(y,r))&&xw(c,h,y,r));break;case 3:case 4:Da?(h=La,La=RS(r.stateNode.containerInfo),jl(r,l,c),La=h):jl(r,l,c);break;case 22:r.memoizedState===null&&(h=r.alternate,h!==null&&h.memoizedState!==null?(h=Eu,Eu=16777216,jl(r,l,c),Eu=h):jl(r,l,c));break;default:jl(r,l,c)}}function HC(r){var l=r.alternate;if(l!==null&&(r=l.child,r!==null)){l.child=null;do l=r.sibling,r.sibling=null,r=l;while(r!==null)}}function Cf(r){var l=r.deletions;if(r.flags&16){if(l!==null)for(var c=0;c<l.length;c++){var h=l[c];_n=h,VC(h,r)}HC(r)}if(r.subtreeFlags&10256)for(r=r.child;r!==null;)UC(r),r=r.sibling}function UC(r){switch(r.tag){case 0:case 11:case 15:Cf(r),r.flags&2048&&br(9,r,r.return);break;case 3:Cf(r);break;case 12:Cf(r);break;case 22:var l=r.stateNode;r.memoizedState!==null&&l._visibility&2&&(r.return===null||r.return.tag!==13)?(l._visibility&=-3,Lp(r)):Cf(r);break;default:Cf(r)}}function Lp(r){var l=r.deletions;if(r.flags&16){if(l!==null)for(var c=0;c<l.length;c++){var h=l[c];_n=h,VC(h,r)}HC(r)}for(r=r.child;r!==null;){switch(l=r,l.tag){case 0:case 11:case 15:br(8,l,l.return),Lp(l);break;case 22:c=l.stateNode,c._visibility&2&&(c._visibility&=-3,Lp(l));break;default:Lp(l)}r=r.sibling}}function VC(r,l){for(;_n!==null;){var c=_n;switch(c.tag){case 0:case 11:case 15:br(8,c,l);break;case 23:case 22:if(c.memoizedState!==null&&c.memoizedState.cachePool!==null){var h=c.memoizedState.cachePool.pool;h!=null&&h.refCount++}break;case 24:vt(c.memoizedState.cache)}if(h=c.child,h!==null)h.return=c,_n=h;else t:for(c=r;_n!==null;){h=_n;var y=h.sibling,b=h.return;if(zC(h),h===c){_n=null;break t}if(y!==null){y.return=b,_n=y;break t}_n=b}}}function nS(r){var l=y5(r);if(l!=null){if(typeof l.memoizedProps["data-testname"]!="string")throw Error(i(364));return l}if(r=O5(r),r===null)throw Error(i(362));return r.stateNode.current}function iS(r,l){var c=r.tag;switch(l.$$typeof){case nm:if(r.type===l.value)return!0;break;case im:t:{for(l=l.value,r=[r,0],c=0;c<r.length;){var h=r[c++],y=h.tag,b=r[c++],w=l[b];if(y!==5&&y!==26&&y!==27||!_f(h)){for(;w!=null&&iS(h,w);)b++,w=l[b];if(b===l.length){l=!0;break t}else for(h=h.child;h!==null;)r.push(h,b),h=h.sibling}}l=!1}return l;case am:if((c===5||c===26||c===27)&&N5(r.stateNode,l.value))return!0;break;case rm:if((c===5||c===6||c===26||c===27)&&(r=z5(r),r!==null&&0<=r.indexOf(l.value)))return!0;break;case om:if((c===5||c===26||c===27)&&(r=r.memoizedProps["data-testname"],typeof r=="string"&&r.toLowerCase()===l.value.toLowerCase()))return!0;break;default:throw Error(i(365))}return!1}function aS(r){switch(r.$$typeof){case nm:return"<"+(f(r.value)||"Unknown")+">";case im:return":has("+(aS(r)||"")+")";case am:return'[role="'+r.value+'"]';case rm:return'"'+r.value+'"';case om:return'[data-testname="'+r.value+'"]';default:throw Error(i(365))}}function jC(r,l){var c=[];r=[r,0];for(var h=0;h<r.length;){var y=r[h++],b=y.tag,w=r[h++],I=l[w];if(b!==5&&b!==26&&b!==27||!_f(y)){for(;I!=null&&iS(y,I);)w++,I=l[w];if(w===l.length)c.push(y);else for(y=y.child;y!==null;)r.push(y,w),y=y.sibling}}return c}function oS(r,l){if(!Of)throw Error(i(363));r=nS(r),r=jC(r,l),l=[],r=Array.from(r);for(var c=0;c<r.length;){var h=r[c++],y=h.tag;if(y===5||y===26||y===27)_f(h)||l.push(h.stateNode);else for(h=h.child;h!==null;)r.push(h),h=h.sibling}return l}function Bi(){return Ft&2&&Qt!==0?Qt&-Qt:wt.T!==null?mt():S5()}function qC(){if(Fi===0)if(!(Qt&536870912)||Kt){var r=Fp;Fp<<=1,!(Fp&3932160)&&(Fp=262144),Fi=r}else Fi=536870912;return r=ji.current,r!==null&&(r.flags|=32),Fi}function vi(r,l,c){(r===Ae&&(fe===2||fe===9)||r.cancelPendingCommit!==null)&&(iu(r,0),xr(r,Qt,Fi,!1)),M(r,c),(!(Ft&2)||r!==Ae)&&(r===Ae&&(!(Ft&2)&&(Wl|=c),Xe===4&&xr(r,Qt,Fi,!1)),L(r))}function FC(r,l,c){if(Ft&6)throw Error(i(327));var h=!c&&(l&127)===0&&(l&r.expiredLanes)===0||A(r,l),y=h?Z4(r,l):lS(r,l,!0),b=h;do{if(y===0){Au&&!h&&xr(r,l,0,!1);break}else{if(c=r.current.alternate,b&&!X4(c)){y=lS(r,l,!1),b=!1;continue}if(y===2){if(b=l,r.errorRecoveryDisabledLanes&b)var w=0;else w=r.pendingLanes&-536870913,w=w!==0?w:w&536870912?536870912:0;if(w!==0){l=w;t:{var I=r;y=Uf;var k=$n&&I.current.memoizedState.isDehydrated;if(k&&(iu(I,w).flags|=256),w=lS(I,w,!1),w!==2){if(qS&&!k){I.errorRecoveryDisabledLanes|=b,Wl|=b,y=4;break t}b=xi,xi=y,b!==null&&(xi===null?xi=b:xi.push.apply(xi,b))}y=w}if(b=!1,y!==2)continue}}if(y===1){iu(r,0),xr(r,l,0,!0);break}t:{switch(h=r,b=y,b){case 0:case 1:throw Error(i(345));case 4:if((l&4194048)!==l)break;case 6:xr(h,l,Fi,!Mr);break t;case 2:xi=null;break;case 3:case 5:break;default:throw Error(i(329))}if((l&62914560)===l&&(y=lm+300-Si(),10<y)){if(xr(h,l,Fi,!Mr),T(h,0,!0)!==0)break t;Oo=l,h.timeoutHandle=m5(GC.bind(null,h,c,xi,sm,GS,l,Fi,Wl,Ru,Mr,b,"Throttled",-0,0),y);break t}GC(h,c,xi,sm,GS,l,Fi,Wl,Ru,Mr,b,null,-0,0)}}break}while(!0);L(r)}function GC(r,l,c,h,y,b,w,I,k,et,ct,ot,gt,Bt){if(r.timeoutHandle=Fl,ot=l.subtreeFlags,ot&8192||(ot&16785408)===16785408){ot=R5(),PC(l,b,ot);var qn=(b&62914560)===b?lm-Si():(b&4194048)===b?Kw-Si():0;if(qn=T5(ot,qn),qn!==null){Oo=b,r.cancelPendingCommit=qn($C.bind(null,r,l,b,c,h,y,w,I,k,ct,ot,null,gt,Bt)),xr(r,b,w,!et);return}}$C(r,l,b,c,h,y,w,I,k)}function X4(r){for(var l=r;;){var c=l.tag;if((c===0||c===11||c===15)&&l.flags&16384&&(c=l.updateQueue,c!==null&&(c=c.stores,c!==null)))for(var h=0;h<c.length;h++){var y=c[h],b=y.getSnapshot;y=y.value;try{if(!Vi(b(),y))return!1}catch{return!1}}if(c=l.child,l.subtreeFlags&16384&&c!==null)c.return=l,l=c;else{if(l===r)break;for(;l.sibling===null;){if(l.return===null||l.return===r)return!0;l=l.return}l.sibling.return=l.return,l=l.sibling}}return!0}function xr(r,l,c,h){l&=~FS,l&=~Wl,r.suspendedLanes|=l,r.pingedLanes&=~l,h&&(r.warmLanes|=l),h=r.expirationTimes;for(var y=l;0<y;){var b=31-Hi(y),w=1<<b;h[b]=-1,y&=~w}c!==0&&N(r,c,l)}function kC(){return Ft&6?!0:($(0,!1),!1)}function rS(){if(Gt!==null){if(fe===0)var r=Gt.return;else r=Gt,To=kl=null,w0(r),yu=null,Lf=0,r=Gt;for(;r!==null;)AC(r.alternate,r),r=r.return;Gt=null}}function iu(r,l){var c=r.timeoutHandle;c!==Fl&&(r.timeoutHandle=Fl,g5(c)),c=r.cancelPendingCommit,c!==null&&(r.cancelPendingCommit=null,c()),Oo=0,rS(),Ae=r,Gt=c=Eo(r.current,null),Qt=l,fe=0,qi=null,Mr=!1,Au=A(r,l),qS=!1,Ru=Fi=FS=Wl=Or=Xe=0,xi=Uf=null,GS=!1,l&8&&(l|=l&32);var h=r.entangledLanes;if(h!==0)for(r=r.entanglements,h&=l;0<h;){var y=31-Hi(h),b=1<<y;l|=r[y],h&=~b}return Mo=l,yp(),c}function YC(r,l){Pt=null,wt.H=Pf,l===gu||l===Wp?(l=$a(),fe=3):l===DS?(l=$a(),fe=4):fe=l===US?8:l!==null&&typeof l=="object"&&typeof l.then=="function"?6:1,qi=l,Gt===null&&(Xe=1,wp(r,lt(l,r.current)))}function QC(){var r=ji.current;return r===null?!0:(Qt&4194048)===Qt?ha===null:(Qt&62914560)===Qt||Qt&536870912?r===ha:!1}function XC(){var r=wt.H;return wt.H=Pf,r===null?Pf:r}function KC(){var r=wt.A;return wt.A=XB,r}function Bp(){Xe=4,Mr||(Qt&4194048)!==Qt&&ji.current!==null||(Au=!0),!(Or&134217727)&&!(Wl&134217727)||Ae===null||xr(Ae,Qt,Fi,!1)}function lS(r,l,c){var h=Ft;Ft|=2;var y=XC(),b=KC();(Ae!==r||Qt!==l)&&(sm=null,iu(r,l)),l=!1;var w=Xe;t:do try{if(fe!==0&&Gt!==null){var I=Gt,k=qi;switch(fe){case 8:rS(),w=6;break t;case 3:case 2:case 9:case 6:ji.current===null&&(l=!0);var et=fe;if(fe=0,qi=null,au(r,I,k,et),c&&Au){w=0;break t}break;default:et=fe,fe=0,qi=null,au(r,I,k,et)}}K4(),w=Xe;break}catch(ct){YC(r,ct)}while(!0);return l&&r.shellSuspendCounter++,To=kl=null,Ft=h,wt.H=y,wt.A=b,Gt===null&&(Ae=null,Qt=0,yp()),w}function K4(){for(;Gt!==null;)ZC(Gt)}function Z4(r,l){var c=Ft;Ft|=2;var h=XC(),y=KC();Ae!==r||Qt!==l?(sm=null,Vf=Si()+500,iu(r,l)):Au=A(r,l);t:do try{if(fe!==0&&Gt!==null){l=Gt;var b=qi;e:switch(fe){case 1:fe=0,qi=null,au(r,l,b,1);break;case 2:case 9:if(He(b)){fe=0,qi=null,WC(l);break}l=function(){fe!==2&&fe!==9||Ae!==r||(fe=7),L(r)},b.then(l,l);break t;case 3:fe=7;break t;case 4:fe=5;break t;case 7:He(b)?(fe=0,qi=null,WC(l)):(fe=0,qi=null,au(r,l,b,7));break;case 5:var w=null;switch(Gt.tag){case 26:w=Gt.memoizedState;case 5:case 27:var I=Gt,k=I.type,et=I.pendingProps;if(w?Bw(w):bw(I.stateNode,k,et)){fe=0,qi=null;var ct=I.sibling;if(ct!==null)Gt=ct;else{var ot=I.return;ot!==null?(Gt=ot,Pp(ot)):Gt=null}break e}}fe=0,qi=null,au(r,l,b,5);break;case 6:fe=0,qi=null,au(r,l,b,6);break;case 8:rS(),Xe=6;break t;default:throw Error(i(462))}}W4();break}catch(gt){YC(r,gt)}while(!0);return To=kl=null,wt.H=h,wt.A=y,Ft=c,Gt!==null?0:(Ae=null,Qt=0,yp(),Xe)}function W4(){for(;Gt!==null&&!PB();)ZC(Gt)}function ZC(r){var l=vC(r.alternate,r,Mo);r.memoizedProps=r.pendingProps,l===null?Pp(r):Gt=l}function WC(r){var l=r,c=l.alternate;switch(l.tag){case 15:case 0:l=dC(c,l,l.pendingProps,l.type,void 0,Qt);break;case 11:l=dC(c,l,l.pendingProps,l.type.render,l.ref,Qt);break;case 5:w0(l);default:AC(c,l),l=Gt=lw(l,Mo),l=vC(c,l,Mo)}r.memoizedProps=r.pendingProps,l===null?Pp(r):Gt=l}function au(r,l,c,h){To=kl=null,w0(l),yu=null,Lf=0;var y=l.return;try{if(j4(r,y,l,c,Qt)){Xe=1,wp(r,lt(c,r.current)),Gt=null;return}}catch(b){if(y!==null)throw Gt=y,b;Xe=1,wp(r,lt(c,r.current)),Gt=null;return}l.flags&32768?(Kt||h===1?r=!0:Au||Qt&536870912?r=!1:(Mr=r=!0,(h===2||h===9||h===3||h===6)&&(h=ji.current,h!==null&&h.tag===13&&(h.flags|=16384))),JC(l,r)):Pp(l)}function Pp(r){var l=r;do{if(l.flags&32768){JC(l,Mr);return}r=l.return;var c=G4(l.alternate,l,Mo);if(c!==null){Gt=c;return}if(l=l.sibling,l!==null){Gt=l;return}Gt=l=r}while(l!==null);Xe===0&&(Xe=5)}function JC(r,l){do{var c=k4(r.alternate,r);if(c!==null){c.flags&=32767,Gt=c;return}if(c=r.return,c!==null&&(c.flags|=32768,c.subtreeFlags=0,c.deletions=null),!l&&(r=r.sibling,r!==null)){Gt=r;return}Gt=r=c}while(r!==null);Xe=6,Gt=null}function $C(r,l,c,h,y,b,w,I,k){r.cancelPendingCommit=null;do wf();while(An!==0);if(Ft&6)throw Error(i(327));if(l!==null){if(l===r.current)throw Error(i(177));if(b=l.lanes|l.childLanes,b|=LS,z(r,c,b,w,I,k),r===Ae&&(Gt=Ae=null,Qt=0),Tu=l,zr=r,Oo=c,kS=b,YS=y,Zw=h,l.subtreeFlags&10256||l.flags&10256?(r.callbackNode=null,r.callbackPriority=0,e5(wS,function(){return aw(),null})):(r.callbackNode=null,r.callbackPriority=0),h=(l.flags&13878)!==0,l.subtreeFlags&13878||h){h=wt.T,wt.T=null,y=Ro(),On(2),w=Ft,Ft|=4;try{Y4(r,l,c)}finally{Ft=w,On(y),wt.T=h}}An=1,tw(),ew(),nw()}}function tw(){if(An===1){An=0;var r=zr,l=Tu,c=(l.flags&13878)!==0;if(l.subtreeFlags&13878||c){c=wt.T,wt.T=null;var h=Ro();On(2);var y=Ft;Ft|=4;try{DC(l,r),h5(r.containerInfo)}finally{Ft=y,On(h),wt.T=c}}r.current=l,An=2}}function ew(){if(An===2){An=0;var r=zr,l=Tu,c=(l.flags&8772)!==0;if(l.subtreeFlags&8772||c){c=wt.T,wt.T=null;var h=Ro();On(2);var y=Ft;Ft|=4;try{_C(r,l.alternate,l)}finally{Ft=y,On(h),wt.T=c}}An=3}}function nw(){if(An===4||An===3){An=0,HB();var r=zr,l=Tu,c=Oo,h=Zw;l.subtreeFlags&10256||l.flags&10256?An=5:(An=0,Tu=zr=null,iw(r,r.pendingLanes));var y=r.pendingLanes;if(y===0&&(_r=null),U(c),l=l.stateNode,Ui&&typeof Ui.onCommitFiberRoot=="function")try{Ui.onCommitFiberRoot(zf,l,void 0,(l.current.flags&128)===128)}catch{}if(h!==null){l=wt.T,y=Ro(),On(2),wt.T=null;try{for(var b=r.onRecoverableError,w=0;w<h.length;w++){var I=h[w];b(I.value,{componentStack:I.stack})}}finally{wt.T=l,On(y)}}Oo&3&&wf(),L(r),y=r.pendingLanes,c&261930&&y&42?r===QS?jf++:(jf=0,QS=r):jf=0,$n&&EB(),$(0,!1)}}function iw(r,l){(r.pooledCacheLanes&=l)===0&&(l=r.pooledCache,l!=null&&(r.pooledCache=null,vt(l)))}function wf(){return tw(),ew(),nw(),aw()}function aw(){if(An!==5)return!1;var r=zr,l=kS;kS=0;var c=U(Oo),h=32>c?32:c;c=wt.T;var y=Ro();try{On(h),wt.T=null,h=YS,YS=null;var b=zr,w=Oo;if(An=0,Tu=zr=null,Oo=0,Ft&6)throw Error(i(331));var I=Ft;if(Ft|=4,UC(b.current),BC(b,b.current,w,h),Ft=I,$(0,!1),Ui&&typeof Ui.onPostCommitFiberRoot=="function")try{Ui.onPostCommitFiberRoot(zf,b)}catch{}return!0}finally{On(y),wt.T=c,iw(r,l)}}function ow(r,l,c){l=lt(c,l),l=U0(r.stateNode,l,2),r=yr(r,l,2),r!==null&&(M(r,2),L(r))}function ie(r,l,c){if(r.tag===3)ow(r,r,c);else for(;l!==null;){if(l.tag===3){ow(l,r,c);break}else if(l.tag===1){var h=l.stateNode;if(typeof l.type.getDerivedStateFromError=="function"||typeof h.componentDidCatch=="function"&&(_r===null||!_r.has(h))){r=lt(c,r),c=aC(2),h=yr(l,c,2),h!==null&&(oC(c,h,l,r),M(h,2),L(h));break}}l=l.return}}function sS(r,l,c){var h=r.pingCache;if(h===null){h=r.pingCache=new KB;var y=new Set;h.set(l,y)}else y=h.get(l),y===void 0&&(y=new Set,h.set(l,y));y.has(c)||(qS=!0,y.add(c),r=J4.bind(null,r,l,c),l.then(r,r))}function J4(r,l,c){var h=r.pingCache;h!==null&&h.delete(l),r.pingedLanes|=r.suspendedLanes&c,r.warmLanes&=~c,Ae===r&&(Qt&c)===c&&(Xe===4||Xe===3&&(Qt&62914560)===Qt&&300>Si()-lm?!(Ft&2)&&iu(r,0):FS|=c,Ru===Qt&&(Ru=0)),L(r)}function rw(r,l){l===0&&(l=R()),r=Hl(r,l),r!==null&&(M(r,l),L(r))}function $4(r){var l=r.memoizedState,c=0;l!==null&&(c=l.retryLane),rw(r,c)}function t5(r,l){var c=0;switch(r.tag){case 31:case 13:var h=r.stateNode,y=r.memoizedState;y!==null&&(c=y.retryLane);break;case 19:h=r.stateNode;break;case 22:h=r.stateNode._retryCache;break;default:throw Error(i(314))}h!==null&&h.delete(l),rw(r,c)}function e5(r,l){return kp(r,l)}function n5(r,l,c,h){this.tag=r,this.key=c,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=l,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=h,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function uS(r){return r=r.prototype,!(!r||!r.isReactComponent)}function Eo(r,l){var c=r.alternate;return c===null?(c=e(r.tag,l,r.key,r.mode),c.elementType=r.elementType,c.type=r.type,c.stateNode=r.stateNode,c.alternate=r,r.alternate=c):(c.pendingProps=l,c.type=r.type,c.flags=0,c.subtreeFlags=0,c.deletions=null),c.flags=r.flags&65011712,c.childLanes=r.childLanes,c.lanes=r.lanes,c.child=r.child,c.memoizedProps=r.memoizedProps,c.memoizedState=r.memoizedState,c.updateQueue=r.updateQueue,l=r.dependencies,c.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext},c.sibling=r.sibling,c.index=r.index,c.ref=r.ref,c.refCleanup=r.refCleanup,c}function lw(r,l){r.flags&=65011714;var c=r.alternate;return c===null?(r.childLanes=0,r.lanes=l,r.child=null,r.subtreeFlags=0,r.memoizedProps=null,r.memoizedState=null,r.updateQueue=null,r.dependencies=null,r.stateNode=null):(r.childLanes=c.childLanes,r.lanes=c.lanes,r.child=c.child,r.subtreeFlags=0,r.deletions=null,r.memoizedProps=c.memoizedProps,r.memoizedState=c.memoizedState,r.updateQueue=c.updateQueue,r.type=c.type,l=c.dependencies,r.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext}),r}function Hp(r,l,c,h,y,b){var w=0;if(h=r,typeof r=="function")uS(r)&&(w=1);else if(typeof r=="string")w=Da&&En?_w(r,c,Vn.current)?26:Uw(r)?27:5:Da?_w(r,c,Vn.current)?26:5:En&&Uw(r)?27:5;else t:switch(r){case SS:return r=e(31,c,l,y),r.elementType=SS,r.lanes=b,r;case ru:return ql(c.children,y,b,l);case pw:w=8,y|=24;break;case pS:return r=e(12,c,l,y|2),r.elementType=pS,r.lanes=b,r;case gS:return r=e(13,c,l,y),r.elementType=gS,r.lanes=b,r;case yS:return r=e(19,c,l,y),r.elementType=yS,r.lanes=b,r;default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case Er:w=10;break t;case mw:w=9;break t;case mS:w=11;break t;case vS:w=14;break t;case Ar:w=16,h=null;break t}w=29,c=Error(i(130,r===null?"null":typeof r,"")),h=null}return l=e(w,c,l,y),l.elementType=r,l.type=h,l.lanes=b,l}function ql(r,l,c,h){return r=e(7,r,h,l),r.lanes=c,r}function cS(r,l,c){return r=e(6,r,null,l),r.lanes=c,r}function sw(r){var l=e(18,null,null,0);return l.stateNode=r,l}function fS(r,l,c){return l=e(4,r.children!==null?r.children:[],r.key,l),l.lanes=c,l.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},l}function i5(r,l,c,h,y,b,w,I,k){this.tag=1,this.containerInfo=r,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=Fl,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=C(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=C(0),this.hiddenUpdates=C(null),this.identifierPrefix=h,this.onUncaughtError=y,this.onCaughtError=b,this.onRecoverableError=w,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=k,this.incompleteTransitions=new Map}function uw(r,l,c,h,y,b,w,I,k,et,ct,ot){return r=new i5(r,l,c,w,k,et,ct,ot,I),l=1,b===!0&&(l|=24),b=e(3,null,null,l),r.current=b,b.stateNode=r,l=ht(),l.refCount++,r.pooledCache=l,l.refCount++,b.memoizedState={element:h,isDehydrated:c,cache:l},y0(b),r}function cw(r){return r?(r=cu,r):cu}function fw(r){var l=r._reactInternals;if(l===void 0)throw typeof r.render=="function"?Error(i(188)):(r=Object.keys(r).join(","),Error(i(268,r)));return r=s(l),r=r!==null?u(r):null,r===null?null:Mf(r.stateNode)}function dw(r,l,c,h,y,b){y=cw(y),h.context===null?h.context=y:h.pendingContext=y,h=gr(l),h.payload={element:c},b=b===void 0?null:b,b!==null&&(h.callback=b),c=yr(r,h,l),c!==null&&(vi(c,r,l),gf(c,r,l))}function hw(r,l){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var c=r.retryLane;r.retryLane=c!==0&&c<l?c:l}}function dS(r,l){hw(r,l),(r=r.alternate)&&hw(r,l)}var qt={},a5=nt(),Pi=P1(),hS=Object.assign,o5=Symbol.for("react.element"),Up=Symbol.for("react.transitional.element"),ou=Symbol.for("react.portal"),ru=Symbol.for("react.fragment"),pw=Symbol.for("react.strict_mode"),pS=Symbol.for("react.profiler"),mw=Symbol.for("react.consumer"),Er=Symbol.for("react.context"),mS=Symbol.for("react.forward_ref"),gS=Symbol.for("react.suspense"),yS=Symbol.for("react.suspense_list"),vS=Symbol.for("react.memo"),Ar=Symbol.for("react.lazy");Symbol.for("react.scope");var SS=Symbol.for("react.activity");Symbol.for("react.legacy_hidden"),Symbol.for("react.tracing_marker");var r5=Symbol.for("react.memo_cache_sentinel");Symbol.for("react.view_transition");var gw=Symbol.iterator,l5=Symbol.for("react.client.reference"),Vp=Array.isArray,wt=a5.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,s5=t.rendererVersion,u5=t.rendererPackageName,yw=t.extraDevToolsConfig,Mf=t.getPublicInstance,c5=t.getRootHostContext,f5=t.getChildHostContext,d5=t.prepareForCommit,h5=t.resetAfterCommit,p5=t.createInstance;t.cloneMutableInstance;var bS=t.appendInitialChild,vw=t.finalizeInitialChildren,jp=t.shouldSetTextContent,Sw=t.createTextInstance;t.cloneMutableTextInstance;var m5=t.scheduleTimeout,g5=t.cancelTimeout,Fl=t.noTimeout,Ao=t.isPrimaryRenderer;t.warnsIfNotActing;var Jn=t.supportsMutation,eo=t.supportsPersistence,$n=t.supportsHydration,y5=t.getInstanceFromNode;t.beforeActiveInstanceBlur;var v5=t.preparePortalMount;t.prepareScopeUpdate,t.getInstanceFromScope;var On=t.setCurrentUpdatePriority,Ro=t.getCurrentUpdatePriority,S5=t.resolveUpdatePriority;t.trackSchedulerEvent,t.resolveEventType,t.resolveEventTimeStamp;var b5=t.shouldAttemptEagerTransition,x5=t.detachDeletedInstance;t.requestPostPaintCallback;var E5=t.maySuspendCommit,A5=t.maySuspendCommitOnUpdate,xS=t.maySuspendCommitInSyncRender,bw=t.preloadInstance,R5=t.startSuspendingCommit,xw=t.suspendInstance;t.suspendOnActiveViewTransition;var T5=t.waitForCommitToBeReady;t.getSuspendedCommitReason;var lu=t.NotPendingTransition,Gl=t.HostTransitionContext,C5=t.resetFormInstance;t.bindToConsole;var w5=t.supportsMicrotasks,M5=t.scheduleMicrotask,Of=t.supportsTestSelectors,O5=t.findFiberRoot,_5=t.getBoundingRect,z5=t.getTextContent,_f=t.isHiddenSubtree,N5=t.matchAccessibilityRole,I5=t.setFocusIfFocusable,D5=t.setupIntersectionObserver,L5=t.appendChild,B5=t.appendChildToContainer,P5=t.commitTextUpdate,H5=t.commitMount,U5=t.commitUpdate,V5=t.insertBefore,j5=t.insertInContainerBefore,q5=t.removeChild,F5=t.removeChildFromContainer,Ew=t.resetTextContent,G5=t.hideInstance,k5=t.hideTextInstance,Y5=t.unhideInstance,Q5=t.unhideTextInstance;t.cancelViewTransitionName,t.cancelRootViewTransitionName,t.restoreRootViewTransitionName,t.cloneRootViewTransitionContainer,t.removeRootViewTransitionClone,t.measureClonedInstance,t.hasInstanceChanged,t.hasInstanceAffectedParent,t.startViewTransition,t.startGestureTransition,t.stopViewTransition,t.getCurrentGestureOffset,t.createViewTransitionInstance;var X5=t.clearContainer;t.createFragmentInstance,t.updateFragmentInstanceFiber,t.commitNewChildToFragmentInstance,t.deleteChildFromFragmentInstance;var K5=t.cloneInstance,Aw=t.createContainerChildSet,Rw=t.appendChildToContainerChildSet,Z5=t.finalizeContainerChildren,Tw=t.replaceContainerChildren,Cw=t.cloneHiddenInstance,ww=t.cloneHiddenTextInstance,ES=t.isSuspenseInstancePending,AS=t.isSuspenseInstanceFallback,W5=t.getSuspenseInstanceFallbackErrorDetails,J5=t.registerSuspenseInstanceRetry,$5=t.canHydrateFormStateMarker,tB=t.isFormStateMarkerMatching,Mw=t.getNextHydratableSibling,eB=t.getNextHydratableSiblingAfterSingleton,nB=t.getFirstHydratableChild,iB=t.getFirstHydratableChildWithinContainer,aB=t.getFirstHydratableChildWithinActivityInstance,oB=t.getFirstHydratableChildWithinSuspenseInstance,rB=t.getFirstHydratableChildWithinSingleton,lB=t.canHydrateInstance,sB=t.canHydrateTextInstance,uB=t.canHydrateActivityInstance,cB=t.canHydrateSuspenseInstance,fB=t.hydrateInstance,dB=t.hydrateTextInstance,hB=t.hydrateActivityInstance,pB=t.hydrateSuspenseInstance,mB=t.getNextHydratableInstanceAfterActivityInstance,gB=t.getNextHydratableInstanceAfterSuspenseInstance,yB=t.commitHydratedInstance,vB=t.commitHydratedContainer,SB=t.commitHydratedActivityInstance,bB=t.commitHydratedSuspenseInstance,xB=t.finalizeHydratedChildren,EB=t.flushHydrationEvents;t.clearActivityBoundary;var AB=t.clearSuspenseBoundary;t.clearActivityBoundaryFromContainer;var RB=t.clearSuspenseBoundaryFromContainer,TB=t.hideDehydratedBoundary,CB=t.unhideDehydratedBoundary,Ow=t.shouldDeleteUnhydratedTailInstances;t.diffHydratedPropsForDevWarnings,t.diffHydratedTextForDevWarnings,t.describeHydratableInstanceForDevWarnings;var wB=t.validateHydratableInstance,MB=t.validateHydratableTextInstance,Da=t.supportsResources,_w=t.isHostHoistableType,RS=t.getHoistableRoot,zw=t.getResource,Nw=t.acquireResource,Iw=t.releaseResource,OB=t.hydrateHoistable,Dw=t.mountHoistable,Lw=t.unmountHoistable,_B=t.createHoistableInstance,zB=t.prepareToCommitHoistables,NB=t.mayResourceSuspendCommit,Bw=t.preloadResource,IB=t.suspendResource,En=t.supportsSingletons,Pw=t.resolveSingletonInstance,DB=t.acquireSingletonInstance,Hw=t.releaseSingletonInstance,Uw=t.isHostSingletonType,su=t.isSingletonScope,TS=[],uu=-1,cu={},Hi=Math.clz32?Math.clz32:S,LB=Math.log,BB=Math.LN2,qp=256,Fp=262144,Gp=4194304,kp=Pi.unstable_scheduleCallback,CS=Pi.unstable_cancelCallback,PB=Pi.unstable_shouldYield,HB=Pi.unstable_requestPaint,Si=Pi.unstable_now,Vw=Pi.unstable_ImmediatePriority,UB=Pi.unstable_UserBlockingPriority,wS=Pi.unstable_NormalPriority,VB=Pi.unstable_IdlePriority,jB=Pi.log,qB=Pi.unstable_setDisableYieldValue,zf=null,Ui=null,Vi=typeof Object.is=="function"?Object.is:at,jw=typeof reportError=="function"?reportError:function(r){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var l=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof r=="object"&&r!==null&&typeof r.message=="string"?String(r.message):String(r),error:r});if(!window.dispatchEvent(l))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",r);return}console.error(r)},FB=Object.prototype.hasOwnProperty,MS,qw,OS=!1,Fw=new WeakMap,fu=[],du=0,Yp=null,Nf=0,ua=[],ca=0,Rr=null,no=1,io="",Vn=m(null),If=m(null),Tr=m(null),Qp=m(null),jn=null,Ue=null,Kt=!1,Cr=null,fa=!1,_S=Error(i(519)),Xp=m(null),kl=null,To=null,GB=typeof AbortController<"u"?AbortController:function(){var r=[],l=this.signal={aborted:!1,addEventListener:function(c,h){r.push(h)}};this.abort=function(){l.aborted=!0,r.forEach(function(c){return c()})}},kB=Pi.unstable_scheduleCallback,YB=Pi.unstable_NormalPriority,Ve={$$typeof:Er,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0},Kp=null,hu=null,zS=!1,Zp=!1,NS=!1,Yl=0,Df=null,IS=0,pu=0,mu=null,Gw=wt.S;wt.S=function(r,l){Kw=Si(),typeof l=="object"&&l!==null&&typeof l.then=="function"&&yt(r,l),Gw!==null&&Gw(r,l)};var Ql=m(null),gu=Error(i(460)),DS=Error(i(474)),Wp=Error(i(542)),Jp={then:function(){}},Xl=null,yu=null,Lf=0,Kl=pT(!0),kw=pT(!1),da=[],vu=0,LS=0,wr=!1,BS=!1,Su=m(null),$p=m(0),ji=m(null),ha=null,nn=m(0),Co=0,Pt=null,Se=null,sn=null,tm=!1,bu=!1,Zl=!1,em=0,Bf=0,xu=null,QB=0,Pf={readContext:B,use:Ep,useCallback:Qe,useContext:Qe,useEffect:Qe,useImperativeHandle:Qe,useLayoutEffect:Qe,useInsertionEffect:Qe,useMemo:Qe,useReducer:Qe,useRef:Qe,useState:Qe,useDebugValue:Qe,useDeferredValue:Qe,useTransition:Qe,useSyncExternalStore:Qe,useId:Qe,useHostTransitionStatus:Qe,useFormState:Qe,useActionState:Qe,useOptimistic:Qe,useMemoCache:Qe,useCacheRefresh:Qe};Pf.useEffectEvent=Qe;var Yw={readContext:B,use:Ep,useCallback:function(r,l){return li().memoizedState=[r,l===void 0?null:l],r},useContext:B,useEffect:UT,useImperativeHandle:function(r,l,c){c=c!=null?c.concat([r]):null,Rp(4194308,4,FT.bind(null,l,r),c)},useLayoutEffect:function(r,l){return Rp(4194308,4,r,l)},useInsertionEffect:function(r,l){Rp(4,2,r,l)},useMemo:function(r,l){var c=li();l=l===void 0?null:l;var h=r();if(Zl){J(!0);try{r()}finally{J(!1)}}return c.memoizedState=[h,l],h},useReducer:function(r,l,c){var h=li();if(c!==void 0){var y=c(l);if(Zl){J(!0);try{c(l)}finally{J(!1)}}}else y=l;return h.memoizedState=h.baseState=y,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:r,lastRenderedState:y},h.queue=r,r=r.dispatch=V4.bind(null,Pt,r),[h.memoizedState,r]},useRef:function(r){var l=li();return r={current:r},l.memoizedState=r},useState:function(r){r=z0(r);var l=r.queue,c=JT.bind(null,Pt,l);return l.dispatch=c,[r.memoizedState,c]},useDebugValue:D0,useDeferredValue:function(r,l){var c=li();return L0(c,r,l)},useTransition:function(){var r=z0(!1);return r=XT.bind(null,Pt,r.queue,!0,!1),li().memoizedState=r,[!1,r]},useSyncExternalStore:function(r,l,c){var h=Pt,y=li();if(Kt){if(c===void 0)throw Error(i(407));c=c()}else{if(c=l(),Ae===null)throw Error(i(349));Qt&127||AT(h,l,c)}y.memoizedState=c;var b={value:c,getSnapshot:l};return y.queue=b,UT(TT.bind(null,h,b,r),[r]),h.flags|=2048,eu(9,{destroy:void 0},RT.bind(null,h,b,c,l),null),c},useId:function(){var r=li(),l=Ae.identifierPrefix;if(Kt){var c=io,h=no;c=(h&~(1<<32-Hi(h)-1)).toString(32)+c,l="_"+l+"R_"+c,c=em++,0<c&&(l+="H"+c.toString(32)),l+="_"}else c=QB++,l="_"+l+"r_"+c.toString(32)+"_";return r.memoizedState=l},useHostTransitionStatus:B0,useFormState:DT,useActionState:DT,useOptimistic:function(r){var l=li();l.memoizedState=l.baseState=r;var c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return l.queue=c,l=P0.bind(null,Pt,!0,c),c.dispatch=l,[r,l]},useMemoCache:M0,useCacheRefresh:function(){return li().memoizedState=U4.bind(null,Pt)},useEffectEvent:function(r){var l=li(),c={impl:r};return l.memoizedState=c,function(){if(Ft&2)throw Error(i(440));return c.impl.apply(void 0,arguments)}}},PS={readContext:B,use:Ep,useCallback:kT,useContext:B,useEffect:I0,useImperativeHandle:GT,useInsertionEffect:jT,useLayoutEffect:qT,useMemo:YT,useReducer:Ap,useRef:HT,useState:function(){return Ap(vo)},useDebugValue:D0,useDeferredValue:function(r,l){var c=en();return QT(c,Se.memoizedState,r,l)},useTransition:function(){var r=Ap(vo)[0],l=en().memoizedState;return[typeof r=="boolean"?r:Sf(r),l]},useSyncExternalStore:ET,useId:ZT,useHostTransitionStatus:B0,useFormState:LT,useActionState:LT,useOptimistic:function(r,l){var c=en();return MT(c,Se,r,l)},useMemoCache:M0,useCacheRefresh:WT};PS.useEffectEvent=VT;var Qw={readContext:B,use:Ep,useCallback:kT,useContext:B,useEffect:I0,useImperativeHandle:GT,useInsertionEffect:jT,useLayoutEffect:qT,useMemo:YT,useReducer:_0,useRef:HT,useState:function(){return _0(vo)},useDebugValue:D0,useDeferredValue:function(r,l){var c=en();return Se===null?L0(c,r,l):QT(c,Se.memoizedState,r,l)},useTransition:function(){var r=_0(vo)[0],l=en().memoizedState;return[typeof r=="boolean"?r:Sf(r),l]},useSyncExternalStore:ET,useId:ZT,useHostTransitionStatus:B0,useFormState:PT,useActionState:PT,useOptimistic:function(r,l){var c=en();return Se!==null?MT(c,Se,r,l):(c.baseState=r,[r,c.queue.dispatch])},useMemoCache:M0,useCacheRefresh:WT};Qw.useEffectEvent=VT;var HS={enqueueSetState:function(r,l,c){r=r._reactInternals;var h=Bi(),y=gr(h);y.payload=l,c!=null&&(y.callback=c),l=yr(r,y,h),l!==null&&(vi(l,r,h),gf(l,r,h))},enqueueReplaceState:function(r,l,c){r=r._reactInternals;var h=Bi(),y=gr(h);y.tag=1,y.payload=l,c!=null&&(y.callback=c),l=yr(r,y,h),l!==null&&(vi(l,r,h),gf(l,r,h))},enqueueForceUpdate:function(r,l){r=r._reactInternals;var c=Bi(),h=gr(c);h.tag=2,l!=null&&(h.callback=l),l=yr(r,h,c),l!==null&&(vi(l,r,c),gf(l,r,c))}},US=Error(i(461)),un=!1,VS={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null},wo=!1,cn=!1,jS=!1,Xw=typeof WeakSet=="function"?WeakSet:Set,_n=null,fn=null,bi=!1,La=null,Eu=8192,XB={getCacheForType:function(r){var l=B(Ve),c=l.data.get(r);return c===void 0&&(c=r(),l.data.set(r,c)),c},cacheSignal:function(){return B(Ve).controller.signal}},nm=0,im=1,am=2,om=3,rm=4;if(typeof Symbol=="function"&&Symbol.for){var Hf=Symbol.for;nm=Hf("selector.component"),im=Hf("selector.has_pseudo_class"),am=Hf("selector.role"),om=Hf("selector.test_id"),rm=Hf("selector.text")}var KB=typeof WeakMap=="function"?WeakMap:Map,Ft=0,Ae=null,Gt=null,Qt=0,fe=0,qi=null,Mr=!1,Au=!1,qS=!1,Mo=0,Xe=0,Or=0,Wl=0,FS=0,Fi=0,Ru=0,Uf=null,xi=null,GS=!1,lm=0,Kw=0,Vf=1/0,sm=null,_r=null,An=0,zr=null,Tu=null,Oo=0,kS=0,YS=null,Zw=null,jf=0,QS=null;return qt.attemptContinuousHydration=function(r){if(r.tag===13||r.tag===31){var l=Hl(r,67108864);l!==null&&vi(l,r,67108864),dS(r,67108864)}},qt.attemptHydrationAtCurrentPriority=function(r){if(r.tag===13||r.tag===31){var l=Bi();l=P(l);var c=Hl(r,l);c!==null&&vi(c,r,l),dS(r,l)}},qt.attemptSynchronousHydration=function(r){switch(r.tag){case 3:if(r=r.stateNode,r.current.memoizedState.isDehydrated){var l=E(r.pendingLanes);if(l!==0){for(r.pendingLanes|=2,r.entangledLanes|=2;l;){var c=1<<31-Hi(l);r.entanglements[1]|=c,l&=~c}L(r),!(Ft&6)&&(Vf=Si()+500,$(0,!1))}}break;case 31:case 13:l=Hl(r,2),l!==null&&vi(l,r,2),kC(),dS(r,2)}},qt.batchedUpdates=function(r,l){return r(l)},qt.createComponentSelector=function(r){return{$$typeof:nm,value:r}},qt.createContainer=function(r,l,c,h,y,b,w,I,k,et){return uw(r,l,!1,null,c,h,b,null,w,I,k,et)},qt.createHasPseudoClassSelector=function(r){return{$$typeof:im,value:r}},qt.createHydrationContainer=function(r,l,c,h,y,b,w,I,k,et,ct,ot,gt,Bt){return r=uw(c,h,!0,r,y,b,I,Bt,k,et,ct,ot),r.context=cw(null),c=r.current,h=Bi(),h=P(h),y=gr(h),y.callback=l??null,yr(c,y,h),l=h,r.current.lanes=l,M(r,l),L(r),r},qt.createPortal=function(r,l,c){var h=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:ou,key:h==null?null:""+h,children:r,containerInfo:l,implementation:c}},qt.createRoleSelector=function(r){return{$$typeof:am,value:r}},qt.createTestNameSelector=function(r){return{$$typeof:om,value:r}},qt.createTextSelector=function(r){return{$$typeof:rm,value:r}},qt.defaultOnCaughtError=function(r){console.error(r)},qt.defaultOnRecoverableError=function(r){jw(r)},qt.defaultOnUncaughtError=function(r){jw(r)},qt.deferredUpdates=function(r){var l=wt.T,c=Ro();try{return On(32),wt.T=null,r()}finally{On(c),wt.T=l}},qt.discreteUpdates=function(r,l,c,h,y){var b=wt.T,w=Ro();try{return On(2),wt.T=null,r(l,c,h,y)}finally{On(w),wt.T=b,Ft===0&&(Vf=Si()+500)}},qt.findAllNodes=oS,qt.findBoundingRects=function(r,l){if(!Of)throw Error(i(363));l=oS(r,l),r=[];for(var c=0;c<l.length;c++)r.push(_5(l[c]));for(l=r.length-1;0<l;l--){c=r[l];for(var h=c.x,y=h+c.width,b=c.y,w=b+c.height,I=l-1;0<=I;I--)if(l!==I){var k=r[I],et=k.x,ct=et+k.width,ot=k.y,gt=ot+k.height;if(h>=et&&b>=ot&&y<=ct&&w<=gt){r.splice(l,1);break}else if(h!==et||c.width!==k.width||gt<b||ot>w){if(!(b!==ot||c.height!==k.height||ct<h||et>y)){et>h&&(k.width+=et-h,k.x=h),ct<y&&(k.width=y-et),r.splice(l,1);break}}else{ot>b&&(k.height+=ot-b,k.y=b),gt<w&&(k.height=w-ot),r.splice(l,1);break}}}return r},qt.findHostInstance=fw,qt.findHostInstanceWithNoPortals=function(r){return r=s(r),r=r!==null?d(r):null,r===null?null:Mf(r.stateNode)},qt.findHostInstanceWithWarning=function(r){return fw(r)},qt.flushPassiveEffects=wf,qt.flushSyncFromReconciler=function(r){var l=Ft;Ft|=1;var c=wt.T,h=Ro();try{if(On(2),wt.T=null,r)return r()}finally{On(h),wt.T=c,Ft=l,!(Ft&6)&&$(0,!1)}},qt.flushSyncWork=kC,qt.focusWithin=function(r,l){if(!Of)throw Error(i(363));for(r=nS(r),l=jC(r,l),l=Array.from(l),r=0;r<l.length;){var c=l[r++],h=c.tag;if(!_f(c)){if((h===5||h===26||h===27)&&I5(c.stateNode))return!0;for(c=c.child;c!==null;)l.push(c),c=c.sibling}}return!1},qt.getFindAllNodesFailureDescription=function(r,l){if(!Of)throw Error(i(363));var c=0,h=[];r=[nS(r),0];for(var y=0;y<r.length;){var b=r[y++],w=b.tag,I=r[y++],k=l[I];if((w!==5&&w!==26&&w!==27||!_f(b))&&(iS(b,k)&&(h.push(aS(k)),I++,I>c&&(c=I)),I<l.length))for(b=b.child;b!==null;)r.push(b,I),b=b.sibling}if(c<l.length){for(r=[];c<l.length;c++)r.push(aS(l[c]));return`findAllNodes was able to match part of the selector:
|
|
9
|
-
`+(
|
|
3
|
+
`+Wb+o+g2}function it(o,s){if(!o||Jb)return"";Jb=!0;var c=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var p={DetermineComponentFrameRoot:function(){try{if(s){var bt=function(){throw Error()};if(Object.defineProperty(bt.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(bt,[])}catch(oe){var _t=oe}Reflect.construct(o,[],bt)}else{try{bt.call()}catch(oe){_t=oe}o.call(bt.prototype)}}else{try{throw Error()}catch(oe){_t=oe}(bt=o())&&typeof bt.catch=="function"&&bt.catch(function(){})}}catch(oe){if(oe&&_t&&typeof oe.stack=="string")return[oe.stack,_t.stack]}return[null,null]}};p.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var v=Object.getOwnPropertyDescriptor(p.DetermineComponentFrameRoot,"name");v&&v.configurable&&Object.defineProperty(p.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var x=p.DetermineComponentFrameRoot(),O=x[0],D=x[1];if(O&&D){var $=O.split(`
|
|
4
|
+
`),ut=D.split(`
|
|
5
|
+
`);for(v=p=0;p<$.length&&!$[p].includes("DetermineComponentFrameRoot");)p++;for(;v<ut.length&&!ut[v].includes("DetermineComponentFrameRoot");)v++;if(p===$.length||v===ut.length)for(p=$.length-1,v=ut.length-1;1<=p&&0<=v&&$[p]!==ut[v];)v--;for(;1<=p&&0<=v;p--,v--)if($[p]!==ut[v]){if(p!==1||v!==1)do if(p--,v--,0>v||$[p]!==ut[v]){var Et=`
|
|
6
|
+
`+$[p].replace(" at new "," at ");return o.displayName&&Et.includes("<anonymous>")&&(Et=Et.replace("<anonymous>",o.displayName)),Et}while(1<=p&&0<=v);break}}}finally{Jb=!1,Error.prepareStackTrace=c}return(c=o?o.displayName||o.name:"")?lt(c):""}function yt(o,s){switch(o.tag){case 26:case 27:case 5:return lt(o.type);case 16:return lt("Lazy");case 13:return o.child!==s&&s!==null?lt("Suspense Fallback"):lt("Suspense");case 19:return lt("SuspenseList");case 0:case 15:return it(o.type,!1);case 11:return it(o.type.render,!1);case 1:return it(o.type,!0);case 31:return lt("Activity");default:return""}}function xt(o){try{var s="",c=null;do s+=yt(o,c),c=o,o=o.return;while(o);return s}catch(p){return`
|
|
7
|
+
Error generating stack: `+p.message+`
|
|
8
|
+
`+p.stack}}function et(o,s){if(typeof o=="object"&&o!==null){var c=y2.get(o);return c!==void 0?c:(s={value:o,source:s,stack:xt(s)},y2.set(o,s),s)}return{value:o,source:s,stack:xt(s)}}function gt(o,s){ju[ku++]=sf,ju[ku++]=xm,xm=o,sf=s}function Mt(o,s,c){La[Da++]=_r,La[Da++]=zr,La[Da++]=Jo,Jo=o;var p=_r;o=zr;var v=32-ua(p)-1;p&=~(1<<v),c+=1;var x=32-ua(s)+v;if(30<x){var O=v-v%5;x=(p&(1<<O)-1).toString(32),p>>=O,v-=O,_r=1<<32-ua(s)+v|c<<v|p,zr=x+o}else _r=1<<x|c<<v|p,zr=o}function Vt(o){o.return!==null&&(gt(o,1),Mt(o,1,0))}function Kt(o){for(;o===xm;)xm=ju[--ku],ju[ku]=null,sf=ju[--ku],ju[ku]=null;for(;o===Jo;)Jo=La[--Da],La[Da]=null,zr=La[--Da],La[Da]=null,_r=La[--Da],La[Da]=null}function te(o,s){La[Da++]=_r,La[Da++]=zr,La[Da++]=Jo,_r=s.id,zr=s.overflow,Jo=o}function ue(o,s){g($o,s),g(lf,o),g(si,null),o=x5(s),y(si),g(si,o)}function dt(){y(si),y(lf),y($o)}function Ht(o){o.memoizedState!==null&&g(wm,o);var s=si.current,c=w5(s,o.type);s!==c&&(g(lf,o),g(si,c))}function ee(o){lf.current===o&&(y(si),y(lf)),wm.current===o&&(y(wm),to?vl._currentValue=Fu:vl._currentValue2=Fu)}function Gt(o){var s=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw tn(et(s,o)),$b}function re(o,s){if(!xi)throw Error(i(175));wB(o.stateNode,o.type,o.memoizedProps,s,o)||Gt(o,!0)}function Ae(o){for(li=o.return;li;)switch(li.tag){case 5:case 31:case 13:Pa=!1;return;case 27:case 3:Pa=!0;return;default:li=li.return}}function Zt(o){if(!xi||o!==li)return!1;if(!Te)return Ae(o),Te=!0,!1;var s=o.tag;if(Vn?s!==3&&s!==27&&(s!==5||i2(o.type)&&!gm(o.type,o.memoizedProps))&&sn&&Gt(o):s!==3&&(s!==5||i2(o.type)&&!gm(o.type,o.memoizedProps))&&sn&&Gt(o),Ae(o),s===13){if(!xi)throw Error(i(316));if(o=o.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(i(317));sn=CB(o)}else if(s===31){if(o=o.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(i(317));sn=AB(o)}else sn=Vn&&s===27?fB(o.type,sn):li?n2(o.stateNode):null;return!0}function fe(){xi&&(sn=li=null,Te=!1)}function Ft(){var o=ts;return o!==null&&(Gi===null?Gi=o:Gi.push.apply(Gi,o),ts=null),o}function tn(o){ts===null?ts=[o]:ts.push(o)}function Jt(o,s,c){to?(g(Tm,s._currentValue),s._currentValue=c):(g(Tm,s._currentValue2),s._currentValue2=c)}function ze(o){var s=Tm.current;to?o._currentValue=s:o._currentValue2=s,y(Tm)}function ri(o,s,c){for(;o!==null;){var p=o.alternate;if((o.childLanes&s)!==s?(o.childLanes|=s,p!==null&&(p.childLanes|=s)):p!==null&&(p.childLanes&s)!==s&&(p.childLanes|=s),o===c)break;o=o.return}}function qn(o,s,c,p){var v=o.child;for(v!==null&&(v.return=o);v!==null;){var x=v.dependencies;if(x!==null){var O=v.child;x=x.firstContext;t:for(;x!==null;){var D=x;x=v;for(var $=0;$<s.length;$++)if(D.context===s[$]){x.lanes|=c,D=x.alternate,D!==null&&(D.lanes|=c),ri(x.return,c,o),p||(O=null);break t}x=D.next}}else if(v.tag===18){if(O=v.return,O===null)throw Error(i(341));O.lanes|=c,x=O.alternate,x!==null&&(x.lanes|=c),ri(O,c,o),O=null}else O=v.child;if(O!==null)O.return=v;else for(O=v;O!==null;){if(O===o){O=null;break}if(v=O.sibling,v!==null){v.return=O.return,O=v;break}O=O.return}v=O}}function st(o,s,c,p){o=null;for(var v=s,x=!1;v!==null;){if(!x){if(v.flags&524288)x=!0;else if(v.flags&262144)break}if(v.tag===10){var O=v.alternate;if(O===null)throw Error(i(387));if(O=O.memoizedProps,O!==null){var D=v.type;da(v.pendingProps.value,O.value)||(o!==null?o.push(D):o=[D])}}else if(v===wm.current){if(O=v.alternate,O===null)throw Error(i(387));O.memoizedState.memoizedState!==v.memoizedState.memoizedState&&(o!==null?o.push(vl):o=[vl])}v=v.return}o!==null&&qn(s,o,c,p),s.flags|=262144}function Tt(o){for(o=o.firstContext;o!==null;){var s=o.context;if(!da(to?s._currentValue:s._currentValue2,o.memoizedValue))return!0;o=o.next}return!1}function qt(o){bl=o,no=null,o=o.dependencies,o!==null&&(o.firstContext=null)}function _(o){return rt(bl,o)}function B(o,s){return bl===null&&qt(o),rt(o,s)}function rt(o,s){var c=to?s._currentValue:s._currentValue2;if(s={context:s,memoizedValue:c,next:null},no===null){if(o===null)throw Error(i(308));no=s,o.dependencies={lanes:0,firstContext:s},o.flags|=524288}else no=no.next=s;return c}function ft(){return{controller:new e6,data:new Map,refCount:0}}function wt(o){o.refCount--,o.refCount===0&&n6(i6,function(){o.controller.abort()})}function U(){}function P(o){o!==Gu&&o.next===null&&(Gu===null?Rm=Gu=o:Gu=Gu.next=o),Em=!0,tS||(tS=!0,at())}function Z(o,s){if(!eS&&Em){eS=!0;do for(var c=!1,p=Rm;p!==null;){if(!s)if(o!==0){var v=p.pendingLanes;if(v===0)var x=0;else{var O=p.suspendedLanes,D=p.pingedLanes;x=(1<<31-ua(42|o)+1)-1,x&=v&~(O&~D),x=x&201326741?x&201326741|1:x?x|2:0}x!==0&&(c=!0,Y(p,x))}else x=xe,x=E(p,p===je?x:0,p.cancelPendingCommit!==null||p.timeoutHandle!==yl),!(x&3)||T(p,x)||(c=!0,Y(p,x));p=p.next}while(c);eS=!1}}function W(){Lt()}function Lt(){Em=tS=!1;var o=0;Sl!==0&&z5()&&(o=Sl);for(var s=ji(),c=null,p=Rm;p!==null;){var v=p.next,x=Yt(p,s);x===0?(p.next=null,c===null?Rm=v:c.next=v,v===null&&(Gu=c)):(c=p,(o!==0||x&3)&&(Em=!0)),p=v}jn!==0&&jn!==5||Z(o,!1),Sl!==0&&(Sl=0)}function Yt(o,s){for(var c=o.suspendedLanes,p=o.pingedLanes,v=o.expirationTimes,x=o.pendingLanes&-62914561;0<x;){var O=31-ua(x),D=1<<O,$=v[O];$===-1?(!(D&c)||D&p)&&(v[O]=S(D,s)):$<=s&&(o.expiredLanes|=D),x&=~D}if(s=je,c=xe,c=E(o,o===s?c:0,o.cancelPendingCommit!==null||o.timeoutHandle!==yl),p=o.callbackNode,c===0||o===s&&(De===2||De===9)||o.cancelPendingCommit!==null)return p!==null&&p!==null&&Kb(p),o.callbackNode=null,o.callbackPriority=0;if(!(c&3)||T(o,c)){if(s=c&-c,s===o.callbackPriority)return s;switch(p!==null&&Kb(p),nt(c)){case 2:case 8:c=ZB;break;case 32:c=Zb;break;case 268435456:c=WB;break;default:c=Zb}return p=Pt.bind(null,o),c=Sm(c,p),o.callbackPriority=s,o.callbackNode=c,s}return p!==null&&p!==null&&Kb(p),o.callbackPriority=2,o.callbackNode=null,2}function Pt(o,s){if(jn!==0&&jn!==5)return o.callbackNode=null,o.callbackPriority=0,null;var c=o.callbackNode;if(ef()&&o.callbackNode!==c)return null;var p=xe;return p=E(o,o===je?p:0,o.cancelPendingCommit!==null||o.timeoutHandle!==yl),p===0?null:(yC(o,p,s),Yt(o,ji()),o.callbackNode!=null&&o.callbackNode===c?Pt.bind(null,o):null)}function Y(o,s){if(ef())return null;yC(o,s,!0)}function at(){H5?F5(function(){ge&6?Sm(p2,W):Lt()}):Sm(p2,W)}function At(){if(Sl===0){var o=Yu;o===0&&(o=ym,ym<<=1,!(ym&261888)&&(ym=256)),Sl=o}return Sl}function Ct(o,s){if(uf===null){var c=uf=[];nS=0,Yu=At(),Xu={status:"pending",value:void 0,then:function(p){c.push(p)}}}return nS++,s.then(Rt,Rt),s}function Rt(){if(--nS===0&&uf!==null){Xu!==null&&(Xu.status="fulfilled");var o=uf;uf=null,Yu=0,Xu=null;for(var s=0;s<o.length;s++)(0,o[s])()}}function Ut(o,s){var c=[],p={status:"pending",value:null,reason:null,then:function(v){c.push(v)}};return o.then(function(){p.status="fulfilled",p.value=s;for(var v=0;v<c.length;v++)(0,c[v])(s)},function(v){for(p.status="rejected",p.reason=v,v=0;v<c.length;v++)(0,c[v])(void 0)}),p}function G(){var o=xl.current;return o!==null?o:je.pooledCache}function Bt(o,s){s===null?g(xl,xl.current):g(xl,s.pool)}function he(){var o=G();return o===null?null:{parent:to?ln._currentValue:ln._currentValue2,pool:o}}function Ue(o,s){if(da(o,s))return!0;if(typeof o!="object"||o===null||typeof s!="object"||s===null)return!1;var c=Object.keys(o),p=Object.keys(s);if(c.length!==p.length)return!1;for(p=0;p<c.length;p++){var v=c[p];if(!t6.call(s,v)||!da(o[v],s[v]))return!1}return!0}function Le(o){return o=o.status,o==="fulfilled"||o==="rejected"}function Ve(o,s,c){switch(c=o[c],c===void 0?o.push(s):c!==s&&(s.then(U,U),s=c),s.status){case"fulfilled":return s.value;case"rejected":throw o=s.reason,Mi(o),o;default:if(typeof s.status=="string")s.then(U,U);else{if(o=je,o!==null&&100<o.shellSuspendCounter)throw Error(i(482));o=s,o.status="pending",o.then(function(p){if(s.status==="pending"){var v=s;v.status="fulfilled",v.value=p}},function(p){if(s.status==="pending"){var v=s;v.status="rejected",v.reason=p}})}switch(s.status){case"fulfilled":return s.value;case"rejected":throw o=s.reason,Mi(o),o}throw wl=s,Qu}}function An(o){try{var s=o._init;return s(o._payload)}catch(c){throw c!==null&&typeof c=="object"&&typeof c.then=="function"?(wl=c,Qu):c}}function Qn(){if(wl===null)throw Error(i(459));var o=wl;return wl=null,o}function Mi(o){if(o===Qu||o===Am)throw Error(i(483))}function Oi(o){var s=cf;return cf+=1,Ku===null&&(Ku=[]),Ve(Ku,o,s)}function Ui(o,s){s=s.props.ref,o.ref=s!==void 0?s:null}function Xr(o,s){throw s.$$typeof===g5?Error(i(525)):(o=Object.prototype.toString.call(s),Error(i(31,o==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":o)))}function ra(o){function s(j,F){if(o){var Q=j.deletions;Q===null?(j.deletions=[F],j.flags|=16):Q.push(F)}}function c(j,F){if(!o)return null;for(;F!==null;)s(j,F),F=F.sibling;return null}function p(j){for(var F=new Map;j!==null;)j.key!==null?F.set(j.key,j):F.set(j.index,j),j=j.sibling;return F}function v(j,F){return j=$r(j,F),j.index=0,j.sibling=null,j}function x(j,F,Q){return j.index=Q,o?(Q=j.alternate,Q!==null?(Q=Q.index,Q<F?(j.flags|=67108866,F):Q):(j.flags|=67108866,F)):(j.flags|=1048576,F)}function O(j){return o&&j.alternate===null&&(j.flags|=67108866),j}function D(j,F,Q,St){return F===null||F.tag!==6?(F=Nb(Q,j.mode,St),F.return=j,F):(F=v(F,Q),F.return=j,F)}function $(j,F,Q,St){var kt=Q.type;return kt===Hu?Et(j,F,Q.props.children,St,Q.key):F!==null&&(F.elementType===kt||typeof kt=="object"&&kt!==null&&kt.$$typeof===Wo&&An(kt)===F.type)?(F=v(F,Q.props),Ui(F,Q),F.return=j,F):(F=hm(Q.type,Q.key,Q.props,null,j.mode,St),Ui(F,Q),F.return=j,F)}function ut(j,F,Q,St){return F===null||F.tag!==4||F.stateNode.containerInfo!==Q.containerInfo||F.stateNode.implementation!==Q.implementation?(F=Lb(Q,j.mode,St),F.return=j,F):(F=v(F,Q.children||[]),F.return=j,F)}function Et(j,F,Q,St,kt){return F===null||F.tag!==7?(F=gl(Q,j.mode,St,kt),F.return=j,F):(F=v(F,Q),F.return=j,F)}function bt(j,F,Q){if(typeof F=="string"&&F!==""||typeof F=="number"||typeof F=="bigint")return F=Nb(""+F,j.mode,Q),F.return=j,F;if(typeof F=="object"&&F!==null){switch(F.$$typeof){case pm:return Q=hm(F.type,F.key,F.props,null,j.mode,Q),Ui(Q,F),Q.return=j,Q;case Bu:return F=Lb(F,j.mode,Q),F.return=j,F;case Wo:return F=An(F),bt(j,F,Q)}if(mm(F)||h(F))return F=gl(F,j.mode,Q,null),F.return=j,F;if(typeof F.then=="function")return bt(j,Oi(F),Q);if(F.$$typeof===Zo)return bt(j,B(j,F),Q);Xr(j,F)}return null}function _t(j,F,Q,St){var kt=F!==null?F.key:null;if(typeof Q=="string"&&Q!==""||typeof Q=="number"||typeof Q=="bigint")return kt!==null?null:D(j,F,""+Q,St);if(typeof Q=="object"&&Q!==null){switch(Q.$$typeof){case pm:return Q.key===kt?$(j,F,Q,St):null;case Bu:return Q.key===kt?ut(j,F,Q,St):null;case Wo:return Q=An(Q),_t(j,F,Q,St)}if(mm(Q)||h(Q))return kt!==null?null:Et(j,F,Q,St,null);if(typeof Q.then=="function")return _t(j,F,Oi(Q),St);if(Q.$$typeof===Zo)return _t(j,F,B(j,Q),St);Xr(j,Q)}return null}function oe(j,F,Q,St,kt){if(typeof St=="string"&&St!==""||typeof St=="number"||typeof St=="bigint")return j=j.get(Q)||null,D(F,j,""+St,kt);if(typeof St=="object"&&St!==null){switch(St.$$typeof){case pm:return j=j.get(St.key===null?Q:St.key)||null,$(F,j,St,kt);case Bu:return j=j.get(St.key===null?Q:St.key)||null,ut(F,j,St,kt);case Wo:return St=An(St),oe(j,F,Q,St,kt)}if(mm(St)||h(St))return j=j.get(Q)||null,Et(F,j,St,kt,null);if(typeof St.then=="function")return oe(j,F,Q,Oi(St),kt);if(St.$$typeof===Zo)return oe(j,F,Q,B(F,St),kt);Xr(F,St)}return null}function ui(j,F,Q,St){for(var kt=null,un=null,Xt=F,Me=F=0,Jn=null;Xt!==null&&Me<Q.length;Me++){Xt.index>Me?(Jn=Xt,Xt=null):Jn=Xt.sibling;var Oe=_t(j,Xt,Q[Me],St);if(Oe===null){Xt===null&&(Xt=Jn);break}o&&Xt&&Oe.alternate===null&&s(j,Xt),F=x(Oe,F,Me),un===null?kt=Oe:un.sibling=Oe,un=Oe,Xt=Jn}if(Me===Q.length)return c(j,Xt),Te&>(j,Me),kt;if(Xt===null){for(;Me<Q.length;Me++)Xt=bt(j,Q[Me],St),Xt!==null&&(F=x(Xt,F,Me),un===null?kt=Xt:un.sibling=Xt,un=Xt);return Te&>(j,Me),kt}for(Xt=p(Xt);Me<Q.length;Me++)Jn=oe(Xt,j,Me,Q[Me],St),Jn!==null&&(o&&Jn.alternate!==null&&Xt.delete(Jn.key===null?Me:Jn.key),F=x(Jn,F,Me),un===null?kt=Jn:un.sibling=Jn,un=Jn);return o&&Xt.forEach(function(os){return s(j,os)}),Te&>(j,Me),kt}function yf(j,F,Q,St){if(Q==null)throw Error(i(151));for(var kt=null,un=null,Xt=F,Me=F=0,Jn=null,Oe=Q.next();Xt!==null&&!Oe.done;Me++,Oe=Q.next()){Xt.index>Me?(Jn=Xt,Xt=null):Jn=Xt.sibling;var os=_t(j,Xt,Oe.value,St);if(os===null){Xt===null&&(Xt=Jn);break}o&&Xt&&os.alternate===null&&s(j,Xt),F=x(os,F,Me),un===null?kt=os:un.sibling=os,un=os,Xt=Jn}if(Oe.done)return c(j,Xt),Te&>(j,Me),kt;if(Xt===null){for(;!Oe.done;Me++,Oe=Q.next())Oe=bt(j,Oe.value,St),Oe!==null&&(F=x(Oe,F,Me),un===null?kt=Oe:un.sibling=Oe,un=Oe);return Te&>(j,Me),kt}for(Xt=p(Xt);!Oe.done;Me++,Oe=Q.next())Oe=oe(Xt,j,Me,Oe.value,St),Oe!==null&&(o&&Oe.alternate!==null&&Xt.delete(Oe.key===null?Me:Oe.key),F=x(Oe,F,Me),un===null?kt=Oe:un.sibling=Oe,un=Oe);return o&&Xt.forEach(function(s6){return s(j,s6)}),Te&>(j,Me),kt}function Al(j,F,Q,St){if(typeof Q=="object"&&Q!==null&&Q.type===Hu&&Q.key===null&&(Q=Q.props.children),typeof Q=="object"&&Q!==null){switch(Q.$$typeof){case pm:t:{for(var kt=Q.key;F!==null;){if(F.key===kt){if(kt=Q.type,kt===Hu){if(F.tag===7){c(j,F.sibling),St=v(F,Q.props.children),St.return=j,j=St;break t}}else if(F.elementType===kt||typeof kt=="object"&&kt!==null&&kt.$$typeof===Wo&&An(kt)===F.type){c(j,F.sibling),St=v(F,Q.props),Ui(St,Q),St.return=j,j=St;break t}c(j,F);break}else s(j,F);F=F.sibling}Q.type===Hu?(St=gl(Q.props.children,j.mode,St,Q.key),St.return=j,j=St):(St=hm(Q.type,Q.key,Q.props,null,j.mode,St),Ui(St,Q),St.return=j,j=St)}return O(j);case Bu:t:{for(kt=Q.key;F!==null;){if(F.key===kt)if(F.tag===4&&F.stateNode.containerInfo===Q.containerInfo&&F.stateNode.implementation===Q.implementation){c(j,F.sibling),St=v(F,Q.children||[]),St.return=j,j=St;break t}else{c(j,F);break}else s(j,F);F=F.sibling}St=Lb(Q,j.mode,St),St.return=j,j=St}return O(j);case Wo:return Q=An(Q),Al(j,F,Q,St)}if(mm(Q))return ui(j,F,Q,St);if(h(Q)){if(kt=h(Q),typeof kt!="function")throw Error(i(150));return Q=kt.call(Q),yf(j,F,Q,St)}if(typeof Q.then=="function")return Al(j,F,Oi(Q),St);if(Q.$$typeof===Zo)return Al(j,F,B(j,Q),St);Xr(j,Q)}return typeof Q=="string"&&Q!==""||typeof Q=="number"||typeof Q=="bigint"?(Q=""+Q,F!==null&&F.tag===6?(c(j,F.sibling),St=v(F,Q),St.return=j,j=St):(c(j,F),St=Nb(Q,j.mode,St),St.return=j,j=St),O(j)):c(j,F)}return function(j,F,Q,St){try{cf=0;var kt=Al(j,F,Q,St);return Ku=null,kt}catch(Xt){if(Xt===Qu||Xt===Am)throw Xt;var un=e(29,Xt,null,j.mode);return un.lanes=St,un.return=j,un}finally{}}}function cl(){for(var o=Zu,s=aS=Zu=0;s<o;){var c=Ba[s];Ba[s++]=null;var p=Ba[s];Ba[s++]=null;var v=Ba[s];Ba[s++]=null;var x=Ba[s];if(Ba[s++]=null,p!==null&&v!==null){var O=p.pending;O===null?v.next=v:(v.next=O.next,O.next=v),p.pending=v}x!==0&&ht(c,v,x)}}function dl(o,s,c,p){Ba[Zu++]=o,Ba[Zu++]=s,Ba[Zu++]=c,Ba[Zu++]=p,aS|=p,o.lanes|=p,o=o.alternate,o!==null&&(o.lanes|=p)}function fl(o,s,c,p){return dl(o,s,c,p),Ot(o)}function q(o,s){return dl(o,null,null,s),Ot(o)}function ht(o,s,c){o.lanes|=c;var p=o.alternate;p!==null&&(p.lanes|=c);for(var v=!1,x=o.return;x!==null;)x.childLanes|=c,p=x.alternate,p!==null&&(p.childLanes|=c),x.tag===22&&(o=x.stateNode,o===null||o._visibility&1||(v=!0)),o=x,x=x.return;return o.tag===3?(x=o.stateNode,v&&s!==null&&(v=31-ua(c),o=x.hiddenUpdates,p=o[v],p===null?o[v]=[s]:p.push(s),s.lane=c|536870912),x):null}function Ot(o){if(50<gf)throw gf=0,gS=null,Error(i(185));for(var s=o.return;s!==null;)o=s,s=o.return;return o.tag===3?o.stateNode:null}function ne(o){o.updateQueue={baseState:o.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function J(o,s){o=o.updateQueue,s.updateQueue===o&&(s.updateQueue={baseState:o.baseState,firstBaseUpdate:o.firstBaseUpdate,lastBaseUpdate:o.lastBaseUpdate,shared:o.shared,callbacks:null})}function pt(o){return{lane:o,tag:0,payload:null,callback:null,next:null}}function vt(o,s,c){var p=o.updateQueue;if(p===null)return null;if(p=p.shared,ge&2){var v=p.pending;return v===null?s.next=s:(s.next=v.next,v.next=s),p.pending=s,s=Ot(o),ht(o,null,c),s}return dl(o,p,s,c),Ot(o)}function $t(o,s,c){if(s=s.updateQueue,s!==null&&(s=s.shared,(c&4194048)!==0)){var p=s.lanes;p&=o.pendingLanes,c|=p,s.lanes=c,L(o,c)}}function Se(o,s){var c=o.updateQueue,p=o.alternate;if(p!==null&&(p=p.updateQueue,c===p)){var v=null,x=null;if(c=c.firstBaseUpdate,c!==null){do{var O={lane:c.lane,tag:c.tag,payload:c.payload,callback:null,next:null};x===null?v=x=O:x=x.next=O,c=c.next}while(c!==null);x===null?v=x=s:x=x.next=s}else v=x=s;c={baseState:p.baseState,firstBaseUpdate:v,lastBaseUpdate:x,shared:p.shared,callbacks:p.callbacks},o.updateQueue=c;return}o=c.lastBaseUpdate,o===null?c.firstBaseUpdate=s:o.next=s,c.lastBaseUpdate=s}function en(){if(rS){var o=Xu;if(o!==null)throw o}}function Un(o,s,c,p){rS=!1;var v=o.updateQueue;es=!1;var x=v.firstBaseUpdate,O=v.lastBaseUpdate,D=v.shared.pending;if(D!==null){v.shared.pending=null;var $=D,ut=$.next;$.next=null,O===null?x=ut:O.next=ut,O=$;var Et=o.alternate;Et!==null&&(Et=Et.updateQueue,D=Et.lastBaseUpdate,D!==O&&(D===null?Et.firstBaseUpdate=ut:D.next=ut,Et.lastBaseUpdate=$))}if(x!==null){var bt=v.baseState;O=0,Et=ut=$=null,D=x;do{var _t=D.lane&-536870913,oe=_t!==D.lane;if(oe?(xe&_t)===_t:(p&_t)===_t){_t!==0&&_t===Yu&&(rS=!0),Et!==null&&(Et=Et.next={lane:0,tag:D.tag,payload:D.payload,callback:null,next:null});t:{var ui=o,yf=D;_t=s;var Al=c;switch(yf.tag){case 1:if(ui=yf.payload,typeof ui=="function"){bt=ui.call(Al,bt,_t);break t}bt=ui;break t;case 3:ui.flags=ui.flags&-65537|128;case 0:if(ui=yf.payload,_t=typeof ui=="function"?ui.call(Al,bt,_t):ui,_t==null)break t;bt=Pb({},bt,_t);break t;case 2:es=!0}}_t=D.callback,_t!==null&&(o.flags|=64,oe&&(o.flags|=8192),oe=v.callbacks,oe===null?v.callbacks=[_t]:oe.push(_t))}else oe={lane:_t,tag:D.tag,payload:D.payload,callback:D.callback,next:null},Et===null?(ut=Et=oe,$=bt):Et=Et.next=oe,O|=_t;if(D=D.next,D===null){if(D=v.shared.pending,D===null)break;oe=D,D=oe.next,oe.next=null,v.lastBaseUpdate=oe,v.shared.pending=null}}while(!0);Et===null&&($=bt),v.baseState=$,v.firstBaseUpdate=ut,v.lastBaseUpdate=Et,x===null&&(v.shared.lanes=0),is|=O,o.lanes=O,o.memoizedState=bt}}function oa(o,s){if(typeof o!="function")throw Error(i(191,o));o.call(s)}function Qr(o,s){var c=o.callbacks;if(c!==null)for(o.callbacks=null,o=0;o<c.length;o++)oa(c[o],s)}function nr(o,s){o=ro,g(Mm,o),g(Wu,s),ro=o|s.baseLanes}function Ar(){g(Mm,ro),g(Wu,Wu.current)}function ie(){ro=Mm.current,y(Wu),y(Mm)}function pe(o){var s=o.alternate;g(xn,xn.current&1),g(fa,o),Ha===null&&(s===null||Wu.current!==null||s.memoizedState!==null)&&(Ha=o)}function Ye(o){g(xn,xn.current),g(fa,o),Ha===null&&(Ha=o)}function Cn(o){o.tag===22?(g(xn,xn.current),g(fa,o),Ha===null&&(Ha=o)):Kn(o)}function Kn(){g(xn,xn.current),g(fa,fa.current)}function _i(o){y(fa),Ha===o&&(Ha=null),y(xn)}function Iu(o){for(var s=o;s!==null;){if(s.tag===13){var c=s.memoizedState;if(c!==null&&(c=c.dehydrated,c===null||Gb(c)||Yb(c)))return s}else if(s.tag===19&&(s.memoizedProps.revealOrder==="forwards"||s.memoizedProps.revealOrder==="backwards"||s.memoizedProps.revealOrder==="unstable_legacy-backwards"||s.memoizedProps.revealOrder==="together")){if(s.flags&128)return s}else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===o)break;for(;s.sibling===null;){if(s.return===null||s.return===o)return null;s=s.return}s.sibling.return=s.return,s=s.sibling}return null}function nn(){throw Error(i(321))}function Cr(o,s){if(s===null)return!1;for(var c=0;c<s.length&&c<o.length;c++)if(!da(o[c],s[c]))return!1;return!0}function X0(o,s,c,p,v,x){return io=x,se=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,jt.H=o===null||o.memoizedState===null?S2:oS,Rl=!1,x=c(p,v),Rl=!1,Ju&&(x=KE(s,c,p,v)),QE(o),x}function QE(o){jt.H=ff;var s=He!==null&&He.next!==null;if(io=0,Mn=He=se=null,Om=!1,df=0,$u=null,s)throw Error(i(300));o===null||On||(o=o.dependencies,o!==null&&Tt(o)&&(On=!0))}function KE(o,s,c,p){se=o;var v=0;do{if(Ju&&($u=null),df=0,Ju=!1,25<=v)throw Error(i(301));if(v+=1,Mn=He=null,o.updateQueue!=null){var x=o.updateQueue;x.lastEffect=null,x.events=null,x.stores=null,x.memoCache!=null&&(x.memoCache.index=0)}jt.H=x2,x=s(c,p)}while(Ju);return x}function Y4(){var o=jt.H,s=o.useState()[0];return s=typeof s.then=="function"?Xd(s):s,o=o.useState()[0],(He!==null?He.memoizedState:null)!==o&&(se.flags|=1024),s}function Q0(){var o=_m!==0;return _m=0,o}function K0(o,s,c){s.updateQueue=o.updateQueue,s.flags&=-2053,o.lanes&=~c}function Z0(o){if(Om){for(o=o.memoizedState;o!==null;){var s=o.queue;s!==null&&(s.pending=null),o=o.next}Om=!1}io=0,Mn=He=se=null,Ju=!1,df=_m=0,$u=null}function zi(){var o={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Mn===null?se.memoizedState=Mn=o:Mn=Mn.next=o,Mn}function Sn(){if(He===null){var o=se.alternate;o=o!==null?o.memoizedState:null}else o=He.next;var s=Mn===null?se.memoizedState:Mn.next;if(s!==null)Mn=s,He=o;else{if(o===null)throw se.alternate===null?Error(i(467)):Error(i(310));He=o,o={memoizedState:He.memoizedState,baseState:He.baseState,baseQueue:He.baseQueue,queue:He.queue,next:null},Mn===null?se.memoizedState=Mn=o:Mn=Mn.next=o}return Mn}function Zp(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Xd(o){var s=df;return df+=1,$u===null&&($u=[]),o=Ve($u,o,s),s=se,(Mn===null?s.memoizedState:Mn.next)===null&&(s=s.alternate,jt.H=s===null||s.memoizedState===null?S2:oS),o}function Wp(o){if(o!==null&&typeof o=="object"){if(typeof o.then=="function")return Xd(o);if(o.$$typeof===Zo)return _(o)}throw Error(i(438,String(o)))}function W0(o){var s=null,c=se.updateQueue;if(c!==null&&(s=c.memoCache),s==null){var p=se.alternate;p!==null&&(p=p.updateQueue,p!==null&&(p=p.memoCache,p!=null&&(s={data:p.data.map(function(v){return v.slice()}),index:0})))}if(s==null&&(s={data:[],index:0}),c===null&&(c=Zp(),se.updateQueue=c),c.memoCache=s,c=s.data[s.index],c===void 0)for(c=s.data[s.index]=Array(o),p=0;p<o;p++)c[p]=y5;return s.index++,c}function Kr(o,s){return typeof s=="function"?s(o):s}function Jp(o){var s=Sn();return J0(s,He,o)}function J0(o,s,c){var p=o.queue;if(p===null)throw Error(i(311));p.lastRenderedReducer=c;var v=o.baseQueue,x=p.pending;if(x!==null){if(v!==null){var O=v.next;v.next=x.next,x.next=O}s.baseQueue=v=x,p.pending=null}if(x=o.baseState,v===null)o.memoizedState=x;else{s=v.next;var D=O=null,$=null,ut=s,Et=!1;do{var bt=ut.lane&-536870913;if(bt!==ut.lane?(xe&bt)===bt:(io&bt)===bt){var _t=ut.revertLane;if(_t===0)$!==null&&($=$.next={lane:0,revertLane:0,gesture:null,action:ut.action,hasEagerState:ut.hasEagerState,eagerState:ut.eagerState,next:null}),bt===Yu&&(Et=!0);else if((io&_t)===_t){ut=ut.next,_t===Yu&&(Et=!0);continue}else bt={lane:0,revertLane:ut.revertLane,gesture:null,action:ut.action,hasEagerState:ut.hasEagerState,eagerState:ut.eagerState,next:null},$===null?(D=$=bt,O=x):$=$.next=bt,se.lanes|=_t,is|=_t;bt=ut.action,Rl&&c(x,bt),x=ut.hasEagerState?ut.eagerState:c(x,bt)}else _t={lane:bt,revertLane:ut.revertLane,gesture:ut.gesture,action:ut.action,hasEagerState:ut.hasEagerState,eagerState:ut.eagerState,next:null},$===null?(D=$=_t,O=x):$=$.next=_t,se.lanes|=bt,is|=bt;ut=ut.next}while(ut!==null&&ut!==s);if($===null?O=x:$.next=D,!da(x,o.memoizedState)&&(On=!0,Et&&(c=Xu,c!==null)))throw c;o.memoizedState=x,o.baseState=O,o.baseQueue=$,p.lastRenderedState=x}return v===null&&(p.lanes=0),[o.memoizedState,p.dispatch]}function $0(o){var s=Sn(),c=s.queue;if(c===null)throw Error(i(311));c.lastRenderedReducer=o;var p=c.dispatch,v=c.pending,x=s.memoizedState;if(v!==null){c.pending=null;var O=v=v.next;do x=o(x,O.action),O=O.next;while(O!==v);da(x,s.memoizedState)||(On=!0),s.memoizedState=x,s.baseQueue===null&&(s.baseState=x),c.lastRenderedState=x}return[x,p]}function ZE(o,s,c){var p=se,v=Sn(),x=Te;if(x){if(c===void 0)throw Error(i(407));c=c()}else c=s();var O=!da((He||v).memoizedState,c);if(O&&(v.memoizedState=c,On=!0),v=v.queue,nb($E.bind(null,p,v,o),[o]),v.getSnapshot!==s||O||Mn!==null&&Mn.memoizedState.tag&1){if(p.flags|=2048,Nu(9,{destroy:void 0},JE.bind(null,p,v,c,s),null),je===null)throw Error(i(349));x||io&127||WE(p,s,c)}return c}function WE(o,s,c){o.flags|=16384,o={getSnapshot:s,value:c},s=se.updateQueue,s===null?(s=Zp(),se.updateQueue=s,s.stores=[o]):(c=s.stores,c===null?s.stores=[o]:c.push(o))}function JE(o,s,c,p){s.value=c,s.getSnapshot=p,tA(s)&&eA(o)}function $E(o,s,c){return c(function(){tA(s)&&eA(o)})}function tA(o){var s=o.getSnapshot;o=o.value;try{var c=s();return!da(o,c)}catch{return!0}}function eA(o){var s=q(o,2);s!==null&&Vi(s,o,2)}function tb(o){var s=zi();if(typeof o=="function"){var c=o;if(o=c(),Rl){X(!0);try{c()}finally{X(!1)}}}return s.memoizedState=s.baseState=o,s.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Kr,lastRenderedState:o},s}function nA(o,s,c,p){return o.baseState=c,J0(o,He,typeof p=="function"?p:Kr)}function X4(o,s,c,p,v){if(em(o))throw Error(i(485));if(o=s.action,o!==null){var x={payload:v,action:o,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(O){x.listeners.push(O)}};jt.T!==null?c(!0):x.isTransition=!1,p(x),c=s.pending,c===null?(x.next=s.pending=x,iA(s,x)):(x.next=c.next,s.pending=c.next=x)}}function iA(o,s){var c=s.action,p=s.payload,v=o.state;if(s.isTransition){var x=jt.T,O={};jt.T=O;try{var D=c(v,p),$=jt.S;$!==null&&$(O,D),aA(o,s,D)}catch(ut){eb(o,s,ut)}finally{x!==null&&O.types!==null&&(x.types=O.types),jt.T=x}}else try{x=c(v,p),aA(o,s,x)}catch(ut){eb(o,s,ut)}}function aA(o,s,c){c!==null&&typeof c=="object"&&typeof c.then=="function"?c.then(function(p){rA(o,s,p)},function(p){return eb(o,s,p)}):rA(o,s,c)}function rA(o,s,c){s.status="fulfilled",s.value=c,oA(s),o.state=c,s=o.pending,s!==null&&(c=s.next,c===s?o.pending=null:(c=c.next,s.next=c,iA(o,c)))}function eb(o,s,c){var p=o.pending;if(o.pending=null,p!==null){p=p.next;do s.status="rejected",s.reason=c,oA(s),s=s.next;while(s!==p)}o.action=null}function oA(o){o=o.listeners;for(var s=0;s<o.length;s++)(0,o[s])()}function sA(o,s){return s}function lA(o,s){if(Te){var c=je.formState;if(c!==null){t:{var p=se;if(Te){if(sn){var v=cB(sn,Pa);if(v){sn=n2(v),p=dB(v);break t}}Gt(p)}p=!1}p&&(s=c[0])}}c=zi(),c.memoizedState=c.baseState=s,p={pending:null,lanes:0,dispatch:null,lastRenderedReducer:sA,lastRenderedState:s},c.queue=p,c=AA.bind(null,se,p),p.dispatch=c,p=tb(!1);var x=ob.bind(null,se,!1,p.queue);return p=zi(),v={state:s,dispatch:null,action:o,pending:null},p.queue=v,c=X4.bind(null,se,v,x,c),v.dispatch=c,p.memoizedState=o,[s,c,!1]}function uA(o){var s=Sn();return cA(s,He,o)}function cA(o,s,c){if(s=J0(o,s,sA)[0],o=Jp(Kr)[0],typeof s=="object"&&s!==null&&typeof s.then=="function")try{var p=Xd(s)}catch(O){throw O===Qu?Am:O}else p=s;s=Sn();var v=s.queue,x=v.dispatch;return c!==s.memoizedState&&(se.flags|=2048,Nu(9,{destroy:void 0},Q4.bind(null,v,c),null)),[p,x,o]}function Q4(o,s){o.action=s}function dA(o){var s=Sn(),c=He;if(c!==null)return cA(s,c,o);Sn(),s=s.memoizedState,c=Sn();var p=c.queue.dispatch;return c.memoizedState=o,[s,p,!1]}function Nu(o,s,c,p){return o={tag:o,create:c,deps:p,inst:s,next:null},s=se.updateQueue,s===null&&(s=Zp(),se.updateQueue=s),c=s.lastEffect,c===null?s.lastEffect=o.next=o:(p=c.next,c.next=o,o.next=p,s.lastEffect=o),o}function fA(){return Sn().memoizedState}function $p(o,s,c,p){var v=zi();se.flags|=o,v.memoizedState=Nu(1|s,{destroy:void 0},c,p===void 0?null:p)}function tm(o,s,c,p){var v=Sn();p=p===void 0?null:p;var x=v.memoizedState.inst;He!==null&&p!==null&&Cr(p,He.memoizedState.deps)?v.memoizedState=Nu(s,x,c,p):(se.flags|=o,v.memoizedState=Nu(1|s,x,c,p))}function hA(o,s){$p(8390656,8,o,s)}function nb(o,s){tm(2048,8,o,s)}function K4(o){se.flags|=4;var s=se.updateQueue;if(s===null)s=Zp(),se.updateQueue=s,s.events=[o];else{var c=s.events;c===null?s.events=[o]:c.push(o)}}function pA(o){var s=Sn().memoizedState;return K4({ref:s,nextImpl:o}),function(){if(ge&2)throw Error(i(440));return s.impl.apply(void 0,arguments)}}function mA(o,s){return tm(4,2,o,s)}function gA(o,s){return tm(4,4,o,s)}function yA(o,s){if(typeof s=="function"){o=o();var c=s(o);return function(){typeof c=="function"?c():s(null)}}if(s!=null)return o=o(),s.current=o,function(){s.current=null}}function vA(o,s,c){c=c!=null?c.concat([o]):null,tm(4,4,yA.bind(null,s,o),c)}function ib(){}function bA(o,s){var c=Sn();s=s===void 0?null:s;var p=c.memoizedState;return s!==null&&Cr(s,p[1])?p[0]:(c.memoizedState=[o,s],o)}function SA(o,s){var c=Sn();s=s===void 0?null:s;var p=c.memoizedState;if(s!==null&&Cr(s,p[1]))return p[0];if(p=o(),Rl){X(!0);try{o()}finally{X(!1)}}return c.memoizedState=[p,s],p}function ab(o,s,c){return c===void 0||io&1073741824&&!(xe&261930)?o.memoizedState=s:(o.memoizedState=c,o=gC(),se.lanes|=o,is|=o,c)}function xA(o,s,c,p){return da(c,s)?c:Wu.current!==null?(o=ab(o,c,p),da(o,s)||(On=!0),o):!(io&42)||io&1073741824&&!(xe&261930)?(On=!0,o.memoizedState=c):(o=gC(),se.lanes|=o,is|=o,s)}function wA(o,s,c,p,v){var x=eo();Zn(x!==0&&8>x?x:8);var O=jt.T,D={};jt.T=D,ob(o,!1,s,c);try{var $=v(),ut=jt.S;if(ut!==null&&ut(D,$),$!==null&&typeof $=="object"&&typeof $.then=="function"){var Et=Ut($,p);Qd(o,s,Et,sa(o))}else Qd(o,s,p,sa(o))}catch(bt){Qd(o,s,{then:function(){},status:"rejected",reason:bt},sa())}finally{Zn(x),O!==null&&D.types!==null&&(O.types=D.types),jt.T=O}}function TA(o){var s=o.memoizedState;if(s!==null)return s;s={memoizedState:Fu,baseState:Fu,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Kr,lastRenderedState:Fu},next:null};var c={};return s.next={memoizedState:c,baseState:c,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Kr,lastRenderedState:c},next:null},o.memoizedState=s,o=o.alternate,o!==null&&(o.memoizedState=s),s}function rb(){return _(vl)}function RA(){return Sn().memoizedState}function EA(){return Sn().memoizedState}function Z4(o){for(var s=o.return;s!==null;){switch(s.tag){case 24:case 3:var c=sa();o=pt(c);var p=vt(s,o,c);p!==null&&(Vi(p,s,c),$t(p,s,c)),s={cache:ft()},o.payload=s;return}s=s.return}}function W4(o,s,c){var p=sa();c={lane:p,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},em(o)?CA(s,c):(c=fl(o,s,c,p),c!==null&&(Vi(c,o,p),MA(c,s,p)))}function AA(o,s,c){var p=sa();Qd(o,s,c,p)}function Qd(o,s,c,p){var v={lane:p,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null};if(em(o))CA(s,v);else{var x=o.alternate;if(o.lanes===0&&(x===null||x.lanes===0)&&(x=s.lastRenderedReducer,x!==null))try{var O=s.lastRenderedState,D=x(O,c);if(v.hasEagerState=!0,v.eagerState=D,da(D,O))return dl(o,s,v,0),je===null&&cl(),!1}catch{}finally{}if(c=fl(o,s,v,p),c!==null)return Vi(c,o,p),MA(c,s,p),!0}return!1}function ob(o,s,c,p){if(p={lane:2,revertLane:At(),gesture:null,action:p,hasEagerState:!1,eagerState:null,next:null},em(o)){if(s)throw Error(i(479))}else s=fl(o,c,p,2),s!==null&&Vi(s,o,2)}function em(o){var s=o.alternate;return o===se||s!==null&&s===se}function CA(o,s){Ju=Om=!0;var c=o.pending;c===null?s.next=s:(s.next=c.next,c.next=s),o.pending=s}function MA(o,s,c){if(c&4194048){var p=s.lanes;p&=o.pendingLanes,c|=p,s.lanes=c,L(o,c)}}function sb(o,s,c,p){s=o.memoizedState,c=c(p,s),c=c==null?s:Pb({},s,c),o.memoizedState=c,o.lanes===0&&(o.updateQueue.baseState=c)}function OA(o,s,c,p,v,x,O){return o=o.stateNode,typeof o.shouldComponentUpdate=="function"?o.shouldComponentUpdate(p,x,O):s.prototype&&s.prototype.isPureReactComponent?!Ue(c,p)||!Ue(v,x):!0}function _A(o,s,c,p){o=s.state,typeof s.componentWillReceiveProps=="function"&&s.componentWillReceiveProps(c,p),typeof s.UNSAFE_componentWillReceiveProps=="function"&&s.UNSAFE_componentWillReceiveProps(c,p),s.state!==o&&sS.enqueueReplaceState(s,s.state,null)}function hl(o,s){var c=s;if("ref"in s){c={};for(var p in s)p!=="ref"&&(c[p]=s[p])}if(o=o.defaultProps){c===s&&(c=Pb({},c));for(var v in o)c[v]===void 0&&(c[v]=o[v])}return c}function nm(o,s){try{var c=o.onUncaughtError;c(s.value,{componentStack:s.stack})}catch(p){setTimeout(function(){throw p})}}function zA(o,s,c){try{var p=o.onCaughtError;p(c.value,{componentStack:c.stack,errorBoundary:s.tag===1?s.stateNode:null})}catch(v){setTimeout(function(){throw v})}}function lb(o,s,c){return c=pt(c),c.tag=3,c.payload={element:null},c.callback=function(){nm(o,s)},c}function IA(o){return o=pt(o),o.tag=3,o}function NA(o,s,c,p){var v=c.type.getDerivedStateFromError;if(typeof v=="function"){var x=p.value;o.payload=function(){return v(x)},o.callback=function(){zA(s,c,p)}}var O=c.stateNode;O!==null&&typeof O.componentDidCatch=="function"&&(o.callback=function(){zA(s,c,p),typeof v!="function"&&(as===null?as=new Set([this]):as.add(this));var D=p.stack;this.componentDidCatch(p.value,{componentStack:D!==null?D:""})})}function J4(o,s,c,p,v){if(c.flags|=32768,p!==null&&typeof p=="object"&&typeof p.then=="function"){if(s=c.alternate,s!==null&&st(s,c,v,!0),c=fa.current,c!==null){switch(c.tag){case 31:case 13:return Ha===null?dm():c.alternate===null&&pn===0&&(pn=3),c.flags&=-257,c.flags|=65536,c.lanes=v,p===Cm?c.flags|=16384:(s=c.updateQueue,s===null?c.updateQueue=new Set([p]):s.add(p),zb(o,p,v)),!1;case 22:return c.flags|=65536,p===Cm?c.flags|=16384:(s=c.updateQueue,s===null?(s={transitions:null,markerInstances:null,retryQueue:new Set([p])},c.updateQueue=s):(c=s.retryQueue,c===null?s.retryQueue=new Set([p]):c.add(p)),zb(o,p,v)),!1}throw Error(i(435,c.tag))}return zb(o,p,v),dm(),!1}if(Te)return s=fa.current,s!==null?(!(s.flags&65536)&&(s.flags|=256),s.flags|=65536,s.lanes=v,p!==$b&&(o=Error(i(422),{cause:p}),tn(et(o,c)))):(p!==$b&&(s=Error(i(423),{cause:p}),tn(et(s,c))),o=o.current.alternate,o.flags|=65536,v&=-v,o.lanes|=v,p=et(p,c),v=lb(o.stateNode,p,v),Se(o,v),pn!==4&&(pn=2)),!1;var x=Error(i(520),{cause:p});if(x=et(x,c),pf===null?pf=[x]:pf.push(x),pn!==4&&(pn=2),s===null)return!0;p=et(p,c),c=s;do{switch(c.tag){case 3:return c.flags|=65536,o=v&-v,c.lanes|=o,o=lb(c.stateNode,p,o),Se(c,o),!1;case 1:if(s=c.type,x=c.stateNode,(c.flags&128)===0&&(typeof s.getDerivedStateFromError=="function"||x!==null&&typeof x.componentDidCatch=="function"&&(as===null||!as.has(x))))return c.flags|=65536,v&=-v,c.lanes|=v,v=IA(v),NA(v,o,c,p),Se(c,v),!1}c=c.return}while(c!==null);return!1}function oi(o,s,c,p){s.child=o===null?b2(s,null,c,p):Tl(s,o.child,c,p)}function LA(o,s,c,p,v){c=c.render;var x=s.ref;if("ref"in p){var O={};for(var D in p)D!=="ref"&&(O[D]=p[D])}else O=p;return qt(s),p=X0(o,s,c,O,x,v),D=Q0(),o!==null&&!On?(K0(o,s,v),Zr(o,s,v)):(Te&&D&&Vt(s),s.flags|=1,oi(o,s,p,v),s.child)}function DA(o,s,c,p,v){if(o===null){var x=c.type;return typeof x=="function"&&!Ib(x)&&x.defaultProps===void 0&&c.compare===null?(s.tag=15,s.type=x,PA(o,s,x,p,v)):(o=hm(c.type,null,p,s,s.mode,v),o.ref=s.ref,o.return=s,s.child=o)}if(x=o.child,!mb(o,v)){var O=x.memoizedProps;if(c=c.compare,c=c!==null?c:Ue,c(O,p)&&o.ref===s.ref)return Zr(o,s,v)}return s.flags|=1,o=$r(x,p),o.ref=s.ref,o.return=s,s.child=o}function PA(o,s,c,p,v){if(o!==null){var x=o.memoizedProps;if(Ue(x,p)&&o.ref===s.ref)if(On=!1,s.pendingProps=p=x,mb(o,v))o.flags&131072&&(On=!0);else return s.lanes=o.lanes,Zr(o,s,v)}return ub(o,s,c,p,v)}function BA(o,s,c,p){var v=p.children,x=o!==null?o.memoizedState:null;if(o===null&&s.stateNode===null&&(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),p.mode==="hidden"){if(s.flags&128){if(x=x!==null?x.baseLanes|c:c,o!==null){for(p=s.child=o.child,v=0;p!==null;)v=v|p.lanes|p.childLanes,p=p.sibling;p=v&~x}else p=0,s.child=null;return HA(o,s,x,c,p)}if(c&536870912)s.memoizedState={baseLanes:0,cachePool:null},o!==null&&Bt(s,x!==null?x.cachePool:null),x!==null?nr(s,x):Ar(),Cn(s);else return p=s.lanes=536870912,HA(o,s,x!==null?x.baseLanes|c:c,c,p)}else x!==null?(Bt(s,x.cachePool),nr(s,x),Kn(s),s.memoizedState=null):(o!==null&&Bt(s,null),Ar(),Kn(s));return oi(o,s,v,c),s.child}function Kd(o,s){return o!==null&&o.tag===22||s.stateNode!==null||(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.sibling}function HA(o,s,c,p,v){var x=G();return x=x===null?null:{parent:to?ln._currentValue:ln._currentValue2,pool:x},s.memoizedState={baseLanes:c,cachePool:x},o!==null&&Bt(s,null),Ar(),Cn(s),o!==null&&st(o,s,p,!0),s.childLanes=v,null}function im(o,s){return s=rm({mode:s.mode,children:s.children},o.mode),s.ref=o.ref,o.child=s,s.return=o,s}function FA(o,s,c){return Tl(s,o.child,null,c),o=im(s,s.pendingProps),o.flags|=2,_i(s),s.memoizedState=null,o}function $4(o,s,c){var p=s.pendingProps,v=(s.flags&128)!==0;if(s.flags&=-129,o===null){if(Te){if(p.mode==="hidden")return o=im(s,p),s.lanes=536870912,Kd(null,o);if(Ye(s),(o=sn)?(o=SB(o,Pa),o!==null&&(s.memoizedState={dehydrated:o,treeContext:Jo!==null?{id:_r,overflow:zr}:null,retryLane:536870912,hydrationErrors:null},c=PC(o),c.return=s,s.child=c,li=s,sn=null)):o=null,o===null)throw Gt(s);return s.lanes=536870912,null}return im(s,p)}var x=o.memoizedState;if(x!==null){var O=x.dehydrated;if(Ye(s),v)if(s.flags&256)s.flags&=-257,s=FA(o,s,c);else if(s.memoizedState!==null)s.child=o.child,s.flags|=128,s=null;else throw Error(i(558));else if(On||st(o,s,c,!1),v=(c&o.childLanes)!==0,On||v){if(p=je,p!==null&&(O=H(p,c),O!==0&&O!==x.retryLane))throw x.retryLane=O,q(o,O),Vi(p,o,O),lS;dm(),s=FA(o,s,c)}else o=x.treeContext,xi&&(sn=mB(O),li=s,Te=!0,ts=null,Pa=!1,o!==null&&te(s,o)),s=im(s,p),s.flags|=4096;return s}return o=$r(o.child,{mode:p.mode,children:p.children}),o.ref=s.ref,s.child=o,o.return=s,o}function am(o,s){var c=s.ref;if(c===null)o!==null&&o.ref!==null&&(s.flags|=4194816);else{if(typeof c!="function"&&typeof c!="object")throw Error(i(284));(o===null||o.ref!==c)&&(s.flags|=4194816)}}function ub(o,s,c,p,v){return qt(s),c=X0(o,s,c,p,void 0,v),p=Q0(),o!==null&&!On?(K0(o,s,v),Zr(o,s,v)):(Te&&p&&Vt(s),s.flags|=1,oi(o,s,c,v),s.child)}function qA(o,s,c,p,v,x){return qt(s),s.updateQueue=null,c=KE(s,p,c,v),QE(o),p=Q0(),o!==null&&!On?(K0(o,s,x),Zr(o,s,x)):(Te&&p&&Vt(s),s.flags|=1,oi(o,s,c,x),s.child)}function UA(o,s,c,p,v){if(qt(s),s.stateNode===null){var x=Vu,O=c.contextType;typeof O=="object"&&O!==null&&(x=_(O)),x=new c(p,x),s.memoizedState=x.state!==null&&x.state!==void 0?x.state:null,x.updater=sS,s.stateNode=x,x._reactInternals=s,x=s.stateNode,x.props=p,x.state=s.memoizedState,x.refs={},ne(s),O=c.contextType,x.context=typeof O=="object"&&O!==null?_(O):Vu,x.state=s.memoizedState,O=c.getDerivedStateFromProps,typeof O=="function"&&(sb(s,c,O,p),x.state=s.memoizedState),typeof c.getDerivedStateFromProps=="function"||typeof x.getSnapshotBeforeUpdate=="function"||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(O=x.state,typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount(),O!==x.state&&sS.enqueueReplaceState(x,x.state,null),Un(s,p,x,v),en(),x.state=s.memoizedState),typeof x.componentDidMount=="function"&&(s.flags|=4194308),p=!0}else if(o===null){x=s.stateNode;var D=s.memoizedProps,$=hl(c,D);x.props=$;var ut=x.context,Et=c.contextType;O=Vu,typeof Et=="object"&&Et!==null&&(O=_(Et));var bt=c.getDerivedStateFromProps;Et=typeof bt=="function"||typeof x.getSnapshotBeforeUpdate=="function",D=s.pendingProps!==D,Et||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(D||ut!==O)&&_A(s,x,p,O),es=!1;var _t=s.memoizedState;x.state=_t,Un(s,p,x,v),en(),ut=s.memoizedState,D||_t!==ut||es?(typeof bt=="function"&&(sb(s,c,bt,p),ut=s.memoizedState),($=es||OA(s,c,$,p,_t,ut,O))?(Et||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount()),typeof x.componentDidMount=="function"&&(s.flags|=4194308)):(typeof x.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=p,s.memoizedState=ut),x.props=p,x.state=ut,x.context=O,p=$):(typeof x.componentDidMount=="function"&&(s.flags|=4194308),p=!1)}else{x=s.stateNode,J(o,s),O=s.memoizedProps,Et=hl(c,O),x.props=Et,bt=s.pendingProps,_t=x.context,ut=c.contextType,$=Vu,typeof ut=="object"&&ut!==null&&($=_(ut)),D=c.getDerivedStateFromProps,(ut=typeof D=="function"||typeof x.getSnapshotBeforeUpdate=="function")||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(O!==bt||_t!==$)&&_A(s,x,p,$),es=!1,_t=s.memoizedState,x.state=_t,Un(s,p,x,v),en();var oe=s.memoizedState;O!==bt||_t!==oe||es||o!==null&&o.dependencies!==null&&Tt(o.dependencies)?(typeof D=="function"&&(sb(s,c,D,p),oe=s.memoizedState),(Et=es||OA(s,c,Et,p,_t,oe,$)||o!==null&&o.dependencies!==null&&Tt(o.dependencies))?(ut||typeof x.UNSAFE_componentWillUpdate!="function"&&typeof x.componentWillUpdate!="function"||(typeof x.componentWillUpdate=="function"&&x.componentWillUpdate(p,oe,$),typeof x.UNSAFE_componentWillUpdate=="function"&&x.UNSAFE_componentWillUpdate(p,oe,$)),typeof x.componentDidUpdate=="function"&&(s.flags|=4),typeof x.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof x.componentDidUpdate!="function"||O===o.memoizedProps&&_t===o.memoizedState||(s.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||O===o.memoizedProps&&_t===o.memoizedState||(s.flags|=1024),s.memoizedProps=p,s.memoizedState=oe),x.props=p,x.state=oe,x.context=$,p=Et):(typeof x.componentDidUpdate!="function"||O===o.memoizedProps&&_t===o.memoizedState||(s.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||O===o.memoizedProps&&_t===o.memoizedState||(s.flags|=1024),p=!1)}return x=p,am(o,s),p=(s.flags&128)!==0,x||p?(x=s.stateNode,c=p&&typeof c.getDerivedStateFromError!="function"?null:x.render(),s.flags|=1,o!==null&&p?(s.child=Tl(s,o.child,null,v),s.child=Tl(s,null,c,v)):oi(o,s,c,v),s.memoizedState=x.state,o=s.child):o=Zr(o,s,v),o}function VA(o,s,c,p){return fe(),s.flags|=256,oi(o,s,c,p),s.child}function cb(o){return{baseLanes:o,cachePool:he()}}function db(o,s,c){return o=o!==null?o.childLanes&~c:0,s&&(o|=pa),o}function jA(o,s,c){var p=s.pendingProps,v=!1,x=(s.flags&128)!==0,O;if((O=x)||(O=o!==null&&o.memoizedState===null?!1:(xn.current&2)!==0),O&&(v=!0,s.flags&=-129),O=(s.flags&32)!==0,s.flags&=-33,o===null){if(Te){if(v?pe(s):Kn(s),(o=sn)?(o=xB(o,Pa),o!==null&&(s.memoizedState={dehydrated:o,treeContext:Jo!==null?{id:_r,overflow:zr}:null,retryLane:536870912,hydrationErrors:null},c=PC(o),c.return=s,s.child=c,li=s,sn=null)):o=null,o===null)throw Gt(s);return Yb(o)?s.lanes=32:s.lanes=536870912,null}var D=p.children;return p=p.fallback,v?(Kn(s),v=s.mode,D=rm({mode:"hidden",children:D},v),p=gl(p,v,c,null),D.return=s,p.return=s,D.sibling=p,s.child=D,p=s.child,p.memoizedState=cb(c),p.childLanes=db(o,O,c),s.memoizedState=uS,Kd(null,p)):(pe(s),fb(s,D))}var $=o.memoizedState;if($!==null&&(D=$.dehydrated,D!==null)){if(x)s.flags&256?(pe(s),s.flags&=-257,s=hb(o,s,c)):s.memoizedState!==null?(Kn(s),s.child=o.child,s.flags|=128,s=null):(Kn(s),D=p.fallback,v=s.mode,p=rm({mode:"visible",children:p.children},v),D=gl(D,v,c,null),D.flags|=2,p.return=s,D.return=s,p.sibling=D,s.child=p,Tl(s,o.child,null,c),p=s.child,p.memoizedState=cb(c),p.childLanes=db(o,O,c),s.memoizedState=uS,s=Kd(null,p));else if(pe(s),Yb(D))O=lB(D).digest,p=Error(i(419)),p.stack="",p.digest=O,tn({value:p,source:null,stack:null}),s=hb(o,s,c);else if(On||st(o,s,c,!1),O=(c&o.childLanes)!==0,On||O){if(O=je,O!==null&&(p=H(O,c),p!==0&&p!==$.retryLane))throw $.retryLane=p,q(o,p),Vi(O,o,p),lS;Gb(D)||dm(),s=hb(o,s,c)}else Gb(D)?(s.flags|=192,s.child=o.child,s=null):(o=$.treeContext,xi&&(sn=gB(D),li=s,Te=!0,ts=null,Pa=!1,o!==null&&te(s,o)),s=fb(s,p.children),s.flags|=4096);return s}return v?(Kn(s),D=p.fallback,v=s.mode,$=o.child,x=$.sibling,p=$r($,{mode:"hidden",children:p.children}),p.subtreeFlags=$.subtreeFlags&65011712,x!==null?D=$r(x,D):(D=gl(D,v,c,null),D.flags|=2),D.return=s,p.return=s,p.sibling=D,s.child=p,Kd(null,p),p=s.child,D=o.child.memoizedState,D===null?D=cb(c):(v=D.cachePool,v!==null?($=to?ln._currentValue:ln._currentValue2,v=v.parent!==$?{parent:$,pool:$}:v):v=he(),D={baseLanes:D.baseLanes|c,cachePool:v}),p.memoizedState=D,p.childLanes=db(o,O,c),s.memoizedState=uS,Kd(o.child,p)):(pe(s),c=o.child,o=c.sibling,c=$r(c,{mode:"visible",children:p.children}),c.return=s,c.sibling=null,o!==null&&(O=s.deletions,O===null?(s.deletions=[o],s.flags|=16):O.push(o)),s.child=c,s.memoizedState=null,c)}function fb(o,s){return s=rm({mode:"visible",children:s},o.mode),s.return=o,o.child=s}function rm(o,s){return o=e(22,o,null,s),o.lanes=0,o}function hb(o,s,c){return Tl(s,o.child,null,c),o=fb(s,s.pendingProps.children),o.flags|=2,s.memoizedState=null,o}function kA(o,s,c){o.lanes|=s;var p=o.alternate;p!==null&&(p.lanes|=s),ri(o.return,s,c)}function pb(o,s,c,p,v,x){var O=o.memoizedState;O===null?o.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:p,tail:c,tailMode:v,treeForkCount:x}:(O.isBackwards=s,O.rendering=null,O.renderingStartTime=0,O.last=p,O.tail=c,O.tailMode=v,O.treeForkCount=x)}function GA(o,s,c){var p=s.pendingProps,v=p.revealOrder,x=p.tail;p=p.children;var O=xn.current,D=(O&2)!==0;if(D?(O=O&1|2,s.flags|=128):O&=1,g(xn,O),oi(o,s,p,c),p=Te?sf:0,!D&&o!==null&&o.flags&128)t:for(o=s.child;o!==null;){if(o.tag===13)o.memoizedState!==null&&kA(o,c,s);else if(o.tag===19)kA(o,c,s);else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===s)break t;for(;o.sibling===null;){if(o.return===null||o.return===s)break t;o=o.return}o.sibling.return=o.return,o=o.sibling}switch(v){case"forwards":for(c=s.child,v=null;c!==null;)o=c.alternate,o!==null&&Iu(o)===null&&(v=c),c=c.sibling;c=v,c===null?(v=s.child,s.child=null):(v=c.sibling,c.sibling=null),pb(s,!1,v,c,x,p);break;case"backwards":case"unstable_legacy-backwards":for(c=null,v=s.child,s.child=null;v!==null;){if(o=v.alternate,o!==null&&Iu(o)===null){s.child=v;break}o=v.sibling,v.sibling=c,c=v,v=o}pb(s,!0,c,null,x,p);break;case"together":pb(s,!1,null,null,void 0,p);break;default:s.memoizedState=null}return s.child}function Zr(o,s,c){if(o!==null&&(s.dependencies=o.dependencies),is|=s.lanes,!(c&s.childLanes))if(o!==null){if(st(o,s,c,!1),(c&s.childLanes)===0)return null}else return null;if(o!==null&&s.child!==o.child)throw Error(i(153));if(s.child!==null){for(o=s.child,c=$r(o,o.pendingProps),s.child=c,c.return=s;o.sibling!==null;)o=o.sibling,c=c.sibling=$r(o,o.pendingProps),c.return=s;c.sibling=null}return s.child}function mb(o,s){return o.lanes&s?!0:(o=o.dependencies,!!(o!==null&&Tt(o)))}function t5(o,s,c){switch(s.tag){case 3:ue(s,s.stateNode.containerInfo),Jt(s,ln,o.memoizedState.cache),fe();break;case 27:case 5:Ht(s);break;case 4:ue(s,s.stateNode.containerInfo);break;case 10:Jt(s,s.type,s.memoizedProps.value);break;case 31:if(s.memoizedState!==null)return s.flags|=128,Ye(s),null;break;case 13:var p=s.memoizedState;if(p!==null)return p.dehydrated!==null?(pe(s),s.flags|=128,null):c&s.child.childLanes?jA(o,s,c):(pe(s),o=Zr(o,s,c),o!==null?o.sibling:null);pe(s);break;case 19:var v=(o.flags&128)!==0;if(p=(c&s.childLanes)!==0,p||(st(o,s,c,!1),p=(c&s.childLanes)!==0),v){if(p)return GA(o,s,c);s.flags|=128}if(v=s.memoizedState,v!==null&&(v.rendering=null,v.tail=null,v.lastEffect=null),g(xn,xn.current),p)break;return null;case 22:return s.lanes=0,BA(o,s,c,s.pendingProps);case 24:Jt(s,ln,o.memoizedState.cache)}return Zr(o,s,c)}function YA(o,s,c){if(o!==null)if(o.memoizedProps!==s.pendingProps)On=!0;else{if(!mb(o,c)&&!(s.flags&128))return On=!1,t5(o,s,c);On=!!(o.flags&131072)}else On=!1,Te&&s.flags&1048576&&Mt(s,sf,s.index);switch(s.lanes=0,s.tag){case 16:t:{var p=s.pendingProps;if(o=An(s.elementType),s.type=o,typeof o=="function")Ib(o)?(p=hl(o,p),s.tag=1,s=UA(null,s,o,p,c)):(s.tag=0,s=ub(null,s,o,p,c));else{if(o!=null){var v=o.$$typeof;if(v===Hb){s.tag=11,s=LA(null,s,o,p,c);break t}else if(v===Ub){s.tag=14,s=DA(null,s,o,p,c);break t}}throw s=d(o)||o,Error(i(306,s,""))}}return s;case 0:return ub(o,s,s.type,s.pendingProps,c);case 1:return p=s.type,v=hl(p,s.pendingProps),UA(o,s,p,v,c);case 3:t:{if(ue(s,s.stateNode.containerInfo),o===null)throw Error(i(387));var x=s.pendingProps;v=s.memoizedState,p=v.element,J(o,s),Un(s,x,null,c);var O=s.memoizedState;if(x=O.cache,Jt(s,ln,x),x!==v.cache&&qn(s,[ln],c,!0),en(),x=O.element,xi&&v.isDehydrated)if(v={element:x,isDehydrated:!1,cache:O.cache},s.updateQueue.baseState=v,s.memoizedState=v,s.flags&256){s=VA(o,s,x,c);break t}else if(x!==p){p=et(Error(i(424)),s),tn(p),s=VA(o,s,x,c);break t}else for(xi&&(sn=pB(s.stateNode.containerInfo),li=s,Te=!0,ts=null,Pa=!0),c=b2(s,null,x,c),s.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling;else{if(fe(),x===p){s=Zr(o,s,c);break t}oi(o,s,x,c)}s=s.child}return s;case 26:if(or)return am(o,s),o===null?(c=r2(s.type,null,s.pendingProps,null))?s.memoizedState=c:Te||(s.stateNode=UB(s.type,s.pendingProps,$o.current,s)):s.memoizedState=r2(s.type,o.memoizedProps,s.pendingProps,o.memoizedState),null;case 27:if(Vn)return Ht(s),o===null&&Vn&&Te&&(p=s.stateNode=d2(s.type,s.pendingProps,$o.current,si.current,!1),li=s,Pa=!0,sn=yB(s.type,p,sn)),oi(o,s,s.pendingProps.children,c),am(o,s),o===null&&(s.flags|=4194304),s.child;case 5:return o===null&&Te&&(HB(s.type,s.pendingProps,si.current),(v=p=sn)&&(p=vB(p,s.type,s.pendingProps,Pa),p!==null?(s.stateNode=p,li=s,sn=hB(p),Pa=!1,v=!0):v=!1),v||Gt(s)),Ht(s),v=s.type,x=s.pendingProps,O=o!==null?o.memoizedProps:null,p=x.children,gm(v,x)?p=null:O!==null&&gm(v,O)&&(s.flags|=32),s.memoizedState!==null&&(v=X0(o,s,Y4,null,null,c),to?vl._currentValue=v:vl._currentValue2=v),am(o,s),oi(o,s,p,c),s.child;case 6:return o===null&&Te&&(FB(s.pendingProps,si.current),(o=c=sn)&&(c=bB(c,s.pendingProps,Pa),c!==null?(s.stateNode=c,li=s,sn=null,o=!0):o=!1),o||Gt(s)),null;case 13:return jA(o,s,c);case 4:return ue(s,s.stateNode.containerInfo),p=s.pendingProps,o===null?s.child=Tl(s,null,p,c):oi(o,s,p,c),s.child;case 11:return LA(o,s,s.type,s.pendingProps,c);case 7:return oi(o,s,s.pendingProps,c),s.child;case 8:return oi(o,s,s.pendingProps.children,c),s.child;case 12:return oi(o,s,s.pendingProps.children,c),s.child;case 10:return p=s.pendingProps,Jt(s,s.type,p.value),oi(o,s,p.children,c),s.child;case 9:return v=s.type._context,p=s.pendingProps.children,qt(s),v=_(v),p=p(v),s.flags|=1,oi(o,s,p,c),s.child;case 14:return DA(o,s,s.type,s.pendingProps,c);case 15:return PA(o,s,s.type,s.pendingProps,c);case 19:return GA(o,s,c);case 31:return $4(o,s,c);case 22:return BA(o,s,c,s.pendingProps);case 24:return qt(s),p=_(ln),o===null?(v=G(),v===null&&(v=je,x=ft(),v.pooledCache=x,x.refCount++,x!==null&&(v.pooledCacheLanes|=c),v=x),s.memoizedState={parent:p,cache:v},ne(s),Jt(s,ln,v)):(o.lanes&c&&(J(o,s),Un(s,null,null,c),en()),v=o.memoizedState,x=s.memoizedState,v.parent!==p?(v={parent:p,cache:p},s.memoizedState=v,s.lanes===0&&(s.memoizedState=s.updateQueue.baseState=v),Jt(s,ln,p)):(p=x.cache,Jt(s,ln,p),p!==v.cache&&qn(s,[ln],c,!0))),oi(o,s,s.pendingProps.children,c),s.child;case 29:throw s.pendingProps}throw Error(i(156,s.tag))}function ir(o){o.flags|=4}function om(o){Or&&(o.flags|=8)}function XA(o,s){if(o!==null&&o.child===s.child)return!1;if(s.flags&16)return!0;for(o=s.child;o!==null;){if(o.flags&8218||o.subtreeFlags&8218)return!0;o=o.sibling}return!1}function gb(o,s,c,p){if(Si)for(c=s.child;c!==null;){if(c.tag===5||c.tag===6)jb(o,c.stateNode);else if(!(c.tag===4||Vn&&c.tag===27)&&c.child!==null){c.child.return=c,c=c.child;continue}if(c===s)break;for(;c.sibling===null;){if(c.return===null||c.return===s)return;c=c.return}c.sibling.return=c.return,c=c.sibling}else if(Or)for(var v=s.child;v!==null;){if(v.tag===5){var x=v.stateNode;c&&p&&(x=t2(x,v.type,v.memoizedProps)),jb(o,x)}else if(v.tag===6)x=v.stateNode,c&&p&&(x=e2(x,v.memoizedProps)),jb(o,x);else if(v.tag!==4){if(v.tag===22&&v.memoizedState!==null)x=v.child,x!==null&&(x.return=v),gb(o,v,!0,!0);else if(v.child!==null){v.child.return=v,v=v.child;continue}}if(v===s)break;for(;v.sibling===null;){if(v.return===null||v.return===s)return;v=v.return}v.sibling.return=v.return,v=v.sibling}}function QA(o,s,c,p){var v=!1;if(Or)for(var x=s.child;x!==null;){if(x.tag===5){var O=x.stateNode;c&&p&&(O=t2(O,x.type,x.memoizedProps)),JC(o,O)}else if(x.tag===6)O=x.stateNode,c&&p&&(O=e2(O,x.memoizedProps)),JC(o,O);else if(x.tag!==4){if(x.tag===22&&x.memoizedState!==null)v=x.child,v!==null&&(v.return=x),QA(o,x,!0,!0),v=!0;else if(x.child!==null){x.child.return=x,x=x.child;continue}}if(x===s)break;for(;x.sibling===null;){if(x.return===null||x.return===s)return v;x=x.return}x.sibling.return=x.return,x=x.sibling}return v}function KA(o,s){if(Or&&XA(o,s)){o=s.stateNode;var c=o.containerInfo,p=WC();QA(p,s,!1,!1),o.pendingChildren=p,ir(s),sB(c,p)}}function yb(o,s,c,p){if(Si)o.memoizedProps!==p&&ir(s);else if(Or){var v=o.stateNode,x=o.memoizedProps;if((o=XA(o,s))||x!==p){var O=si.current;x=oB(v,c,x,p,!o,null),x===v?s.stateNode=v:(om(s),YC(x,c,p,O)&&ir(s),s.stateNode=x,o&&gb(x,s,!1,!1))}else s.stateNode=v}}function vb(o,s,c,p,v){if(o.mode&32&&(c===null?N5(s,p):L5(s,c,p))){if(o.flags|=16777216,(v&335544128)===v||kb(s,p))if(QC(o.stateNode,s,p))o.flags|=8192;else if(xC())o.flags|=8192;else throw wl=Cm,iS}else o.flags&=-16777217}function ZA(o,s){if(jB(s)){if(o.flags|=16777216,!c2(s))if(xC())o.flags|=8192;else throw wl=Cm,iS}else o.flags&=-16777217}function sm(o,s){s!==null&&(o.flags|=4),o.flags&16384&&(s=o.tag!==22?R():536870912,o.lanes|=s,nc|=s)}function Zd(o,s){if(!Te)switch(o.tailMode){case"hidden":s=o.tail;for(var c=null;s!==null;)s.alternate!==null&&(c=s),s=s.sibling;c===null?o.tail=null:c.sibling=null;break;case"collapsed":c=o.tail;for(var p=null;c!==null;)c.alternate!==null&&(p=c),c=c.sibling;p===null?s||o.tail===null?o.tail=null:o.tail.sibling=null:p.sibling=null}}function Ke(o){var s=o.alternate!==null&&o.alternate.child===o.child,c=0,p=0;if(s)for(var v=o.child;v!==null;)c|=v.lanes|v.childLanes,p|=v.subtreeFlags&65011712,p|=v.flags&65011712,v.return=o,v=v.sibling;else for(v=o.child;v!==null;)c|=v.lanes|v.childLanes,p|=v.subtreeFlags,p|=v.flags,v.return=o,v=v.sibling;return o.subtreeFlags|=p,o.childLanes=c,s}function e5(o,s,c){var p=s.pendingProps;switch(Kt(s),s.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ke(s),null;case 1:return Ke(s),null;case 3:return c=s.stateNode,p=null,o!==null&&(p=o.memoizedState.cache),s.memoizedState.cache!==p&&(s.flags|=2048),ze(ln),dt(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(o===null||o.child===null)&&(Zt(s)?ir(s):o===null||o.memoizedState.isDehydrated&&!(s.flags&256)||(s.flags|=1024,Ft())),KA(o,s),Ke(s),null;case 26:if(or){var v=s.type,x=s.memoizedState;return o===null?(ir(s),x!==null?(Ke(s),ZA(s,x)):(Ke(s),vb(s,v,null,p,c))):x?x!==o.memoizedState?(ir(s),Ke(s),ZA(s,x)):(Ke(s),s.flags&=-16777217):(x=o.memoizedProps,Si?x!==p&&ir(s):yb(o,s,v,p),Ke(s),vb(s,v,x,p,c)),null}case 27:if(Vn){if(ee(s),c=$o.current,v=s.type,o!==null&&s.stateNode!=null)Si?o.memoizedProps!==p&&ir(s):yb(o,s,v,p);else{if(!p){if(s.stateNode===null)throw Error(i(166));return Ke(s),null}o=si.current,Zt(s)?re(s,o):(o=d2(v,p,c,o,!0),s.stateNode=o,ir(s))}return Ke(s),null}case 5:if(ee(s),v=s.type,o!==null&&s.stateNode!=null)yb(o,s,v,p);else{if(!p){if(s.stateNode===null)throw Error(i(166));return Ke(s),null}if(x=si.current,Zt(s))re(s,x),IB(s.stateNode,v,p,x)&&(s.flags|=64);else{var O=E5(v,p,$o.current,x,s);om(s),gb(O,s,!1,!1),s.stateNode=O,YC(O,v,p,x)&&ir(s)}}return Ke(s),vb(s,s.type,o===null?null:o.memoizedProps,s.pendingProps,c),null;case 6:if(o&&s.stateNode!=null)c=o.memoizedProps,Si?c!==p&&ir(s):Or&&(c!==p?(o=$o.current,c=si.current,om(s),s.stateNode=XC(p,o,c,s)):s.stateNode=o.stateNode);else{if(typeof p!="string"&&s.stateNode===null)throw Error(i(166));if(o=$o.current,c=si.current,Zt(s)){if(!xi)throw Error(i(176));if(o=s.stateNode,c=s.memoizedProps,p=null,v=li,v!==null)switch(v.tag){case 27:case 5:p=v.memoizedProps}TB(o,c,s,p)||Gt(s,!0)}else om(s),s.stateNode=XC(p,o,c,s)}return Ke(s),null;case 31:if(c=s.memoizedState,o===null||o.memoizedState!==null){if(p=Zt(s),c!==null){if(o===null){if(!p)throw Error(i(318));if(!xi)throw Error(i(556));if(o=s.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(i(557));RB(o,s)}else fe(),!(s.flags&128)&&(s.memoizedState=null),s.flags|=4;Ke(s),o=!1}else c=Ft(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=c),o=!0;if(!o)return s.flags&256?(_i(s),s):(_i(s),null);if(s.flags&128)throw Error(i(558))}return Ke(s),null;case 13:if(p=s.memoizedState,o===null||o.memoizedState!==null&&o.memoizedState.dehydrated!==null){if(v=Zt(s),p!==null&&p.dehydrated!==null){if(o===null){if(!v)throw Error(i(318));if(!xi)throw Error(i(344));if(v=s.memoizedState,v=v!==null?v.dehydrated:null,!v)throw Error(i(317));EB(v,s)}else fe(),!(s.flags&128)&&(s.memoizedState=null),s.flags|=4;Ke(s),v=!1}else v=Ft(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=v),v=!0;if(!v)return s.flags&256?(_i(s),s):(_i(s),null)}return _i(s),s.flags&128?(s.lanes=c,s):(c=p!==null,o=o!==null&&o.memoizedState!==null,c&&(p=s.child,v=null,p.alternate!==null&&p.alternate.memoizedState!==null&&p.alternate.memoizedState.cachePool!==null&&(v=p.alternate.memoizedState.cachePool.pool),x=null,p.memoizedState!==null&&p.memoizedState.cachePool!==null&&(x=p.memoizedState.cachePool.pool),x!==v&&(p.flags|=2048)),c!==o&&c&&(s.child.flags|=8192),sm(s,s.updateQueue),Ke(s),null);case 4:return dt(),KA(o,s),o===null&&O5(s.stateNode.containerInfo),Ke(s),null;case 10:return ze(s.type),Ke(s),null;case 19:if(y(xn),p=s.memoizedState,p===null)return Ke(s),null;if(v=(s.flags&128)!==0,x=p.rendering,x===null)if(v)Zd(p,!1);else{if(pn!==0||o!==null&&o.flags&128)for(o=s.child;o!==null;){if(x=Iu(o),x!==null){for(s.flags|=128,Zd(p,!1),o=x.updateQueue,s.updateQueue=o,sm(s,o),s.subtreeFlags=0,o=c,c=s.child;c!==null;)DC(c,o),c=c.sibling;return g(xn,xn.current&1|2),Te&>(s,p.treeForkCount),s.child}o=o.sibling}p.tail!==null&&ji()>mf&&(s.flags|=128,v=!0,Zd(p,!1),s.lanes=4194304)}else{if(!v)if(o=Iu(x),o!==null){if(s.flags|=128,v=!0,o=o.updateQueue,s.updateQueue=o,sm(s,o),Zd(p,!0),p.tail===null&&p.tailMode==="hidden"&&!x.alternate&&!Te)return Ke(s),null}else 2*ji()-p.renderingStartTime>mf&&c!==536870912&&(s.flags|=128,v=!0,Zd(p,!1),s.lanes=4194304);p.isBackwards?(x.sibling=s.child,s.child=x):(o=p.last,o!==null?o.sibling=x:s.child=x,p.last=x)}return p.tail!==null?(o=p.tail,p.rendering=o,p.tail=o.sibling,p.renderingStartTime=ji(),o.sibling=null,c=xn.current,g(xn,v?c&1|2:c&1),Te&>(s,p.treeForkCount),o):(Ke(s),null);case 22:case 23:return _i(s),ie(),p=s.memoizedState!==null,o!==null?o.memoizedState!==null!==p&&(s.flags|=8192):p&&(s.flags|=8192),p?c&536870912&&!(s.flags&128)&&(Ke(s),s.subtreeFlags&6&&(s.flags|=8192)):Ke(s),c=s.updateQueue,c!==null&&sm(s,c.retryQueue),c=null,o!==null&&o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(c=o.memoizedState.cachePool.pool),p=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(p=s.memoizedState.cachePool.pool),p!==c&&(s.flags|=2048),o!==null&&y(xl),null;case 24:return c=null,o!==null&&(c=o.memoizedState.cache),s.memoizedState.cache!==c&&(s.flags|=2048),ze(ln),Ke(s),null;case 25:return null;case 30:return null}throw Error(i(156,s.tag))}function n5(o,s){switch(Kt(s),s.tag){case 1:return o=s.flags,o&65536?(s.flags=o&-65537|128,s):null;case 3:return ze(ln),dt(),o=s.flags,o&65536&&!(o&128)?(s.flags=o&-65537|128,s):null;case 26:case 27:case 5:return ee(s),null;case 31:if(s.memoizedState!==null){if(_i(s),s.alternate===null)throw Error(i(340));fe()}return o=s.flags,o&65536?(s.flags=o&-65537|128,s):null;case 13:if(_i(s),o=s.memoizedState,o!==null&&o.dehydrated!==null){if(s.alternate===null)throw Error(i(340));fe()}return o=s.flags,o&65536?(s.flags=o&-65537|128,s):null;case 19:return y(xn),null;case 4:return dt(),null;case 10:return ze(s.type),null;case 22:case 23:return _i(s),ie(),o!==null&&y(xl),o=s.flags,o&65536?(s.flags=o&-65537|128,s):null;case 24:return ze(ln),null;case 25:return null;default:return null}}function WA(o,s){switch(Kt(s),s.tag){case 3:ze(ln),dt();break;case 26:case 27:case 5:ee(s);break;case 4:dt();break;case 31:s.memoizedState!==null&&_i(s);break;case 13:_i(s);break;case 19:y(xn);break;case 10:ze(s.type);break;case 22:case 23:_i(s),ie(),o!==null&&y(xl);break;case 24:ze(ln)}}function Wd(o,s){try{var c=s.updateQueue,p=c!==null?c.lastEffect:null;if(p!==null){var v=p.next;c=v;do{if((c.tag&o)===o){p=void 0;var x=c.create,O=c.inst;p=x(),O.destroy=p}c=c.next}while(c!==v)}}catch(D){Ce(s,s.return,D)}}function Qo(o,s,c){try{var p=s.updateQueue,v=p!==null?p.lastEffect:null;if(v!==null){var x=v.next;p=x;do{if((p.tag&o)===o){var O=p.inst,D=O.destroy;if(D!==void 0){O.destroy=void 0,v=s;var $=c,ut=D;try{ut()}catch(Et){Ce(v,$,Et)}}}p=p.next}while(p!==x)}}catch(Et){Ce(s,s.return,Et)}}function JA(o){var s=o.updateQueue;if(s!==null){var c=o.stateNode;try{Qr(s,c)}catch(p){Ce(o,o.return,p)}}}function $A(o,s,c){c.props=hl(o.type,o.memoizedProps),c.state=o.memoizedState;try{c.componentWillUnmount()}catch(p){Ce(o,s,p)}}function Jd(o,s){try{var c=o.ref;if(c!==null){switch(o.tag){case 26:case 27:case 5:var p=nf(o.stateNode);break;case 30:p=o.stateNode;break;default:p=o.stateNode}typeof c=="function"?o.refCleanup=c(p):c.current=p}}catch(v){Ce(o,s,v)}}function Mr(o,s){var c=o.ref,p=o.refCleanup;if(c!==null)if(typeof p=="function")try{p()}catch(v){Ce(o,s,v)}finally{o.refCleanup=null,o=o.alternate,o!=null&&(o.refCleanup=null)}else if(typeof c=="function")try{c(null)}catch(v){Ce(o,s,v)}else c.current=null}function tC(o){var s=o.type,c=o.memoizedProps,p=o.stateNode;try{K5(p,s,c,o)}catch(v){Ce(o,o.return,v)}}function bb(o,s,c){try{Z5(o.stateNode,o.type,c,s,o)}catch(p){Ce(o,o.return,p)}}function eC(o){return o.tag===5||o.tag===3||(or?o.tag===26:!1)||(Vn?o.tag===27&&qu(o.type):!1)||o.tag===4}function Sb(o){t:for(;;){for(;o.sibling===null;){if(o.return===null||eC(o.return))return null;o=o.return}for(o.sibling.return=o.return,o=o.sibling;o.tag!==5&&o.tag!==6&&o.tag!==18;){if(Vn&&o.tag===27&&qu(o.type)||o.flags&2||o.child===null||o.tag===4)continue t;o.child.return=o,o=o.child}if(!(o.flags&2))return o.stateNode}}function xb(o,s,c){var p=o.tag;if(p===5||p===6)o=o.stateNode,s?J5(c,o,s):X5(c,o);else if(p!==4&&(Vn&&p===27&&qu(o.type)&&(c=o.stateNode,s=null),o=o.child,o!==null))for(xb(o,s,c),o=o.sibling;o!==null;)xb(o,s,c),o=o.sibling}function lm(o,s,c){var p=o.tag;if(p===5||p===6)o=o.stateNode,s?W5(c,o,s):Y5(c,o);else if(p!==4&&(Vn&&p===27&&qu(o.type)&&(c=o.stateNode),o=o.child,o!==null))for(lm(o,s,c),o=o.sibling;o!==null;)lm(o,s,c),o=o.sibling}function nC(o,s,c){o=o.containerInfo;try{$C(o,c)}catch(p){Ce(s,s.return,p)}}function iC(o){var s=o.stateNode,c=o.memoizedProps;try{GB(o.type,c,s,o)}catch(p){Ce(o,o.return,p)}}function i5(o,s){for(T5(o.containerInfo),Wn=s;Wn!==null;)if(o=Wn,s=o.child,(o.subtreeFlags&1028)!==0&&s!==null)s.return=o,Wn=s;else for(;Wn!==null;){o=Wn;var c=o.alternate;switch(s=o.flags,o.tag){case 0:if(s&4&&(s=o.updateQueue,s=s!==null?s.events:null,s!==null))for(var p=0;p<s.length;p++){var v=s[p];v.ref.impl=v.nextImpl}break;case 11:case 15:break;case 1:if(s&1024&&c!==null){s=void 0,p=o,v=c.memoizedProps,c=c.memoizedState;var x=p.stateNode;try{var O=hl(p.type,v);s=x.getSnapshotBeforeUpdate(O,c),x.__reactInternalSnapshotBeforeUpdate=s}catch(D){Ce(p,p.return,D)}}break;case 3:s&1024&&Si&&rB(o.stateNode.containerInfo);break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if(s&1024)throw Error(i(163))}if(s=o.sibling,s!==null){s.return=o.return,Wn=s;break}Wn=o.return}}function aC(o,s,c){var p=c.flags;switch(c.tag){case 0:case 11:case 15:Wr(o,c),p&4&&Wd(5,c);break;case 1:if(Wr(o,c),p&4)if(o=c.stateNode,s===null)try{o.componentDidMount()}catch(O){Ce(c,c.return,O)}else{var v=hl(c.type,s.memoizedProps);s=s.memoizedState;try{o.componentDidUpdate(v,s,o.__reactInternalSnapshotBeforeUpdate)}catch(O){Ce(c,c.return,O)}}p&64&&JA(c),p&512&&Jd(c,c.return);break;case 3:if(Wr(o,c),p&64&&(p=c.updateQueue,p!==null)){if(o=null,c.child!==null)switch(c.child.tag){case 27:case 5:o=nf(c.child.stateNode);break;case 1:o=c.child.stateNode}try{Qr(p,o)}catch(O){Ce(c,c.return,O)}}break;case 27:Vn&&s===null&&p&4&&iC(c);case 26:case 5:if(Wr(o,c),s===null){if(p&4)tC(c);else if(p&64){o=c.type,s=c.memoizedProps,v=c.stateNode;try{MB(v,o,s,c)}catch(O){Ce(c,c.return,O)}}}p&512&&Jd(c,c.return);break;case 12:Wr(o,c);break;case 31:Wr(o,c),p&4&&oC(o,c);break;case 13:Wr(o,c),p&4&&sC(o,c),p&64&&(p=c.memoizedState,p!==null&&(p=p.dehydrated,p!==null&&(c=c5.bind(null,c),uB(p,c))));break;case 22:if(p=c.memoizedState!==null||ao,!p){s=s!==null&&s.memoizedState!==null||_n,v=ao;var x=_n;ao=p,(_n=s)&&!x?Jr(o,c,(c.subtreeFlags&8772)!==0):Wr(o,c),ao=v,_n=x}break;case 30:break;default:Wr(o,c)}}function rC(o){var s=o.alternate;s!==null&&(o.alternate=null,rC(s)),o.child=null,o.deletions=null,o.sibling=null,o.tag===5&&(s=o.stateNode,s!==null&&I5(s)),o.stateNode=null,o.return=null,o.dependencies=null,o.memoizedProps=null,o.memoizedState=null,o.pendingProps=null,o.stateNode=null,o.updateQueue=null}function ar(o,s,c){for(c=c.child;c!==null;)wb(o,s,c),c=c.sibling}function wb(o,s,c){if(ca&&typeof ca.onCommitFiberUnmount=="function")try{ca.onCommitFiberUnmount(of,c)}catch{}switch(c.tag){case 26:if(or){_n||Mr(c,s),ar(o,s,c),c.memoizedState?s2(c.memoizedState):c.stateNode&&u2(c.stateNode);break}case 27:if(Vn){_n||Mr(c,s);var p=zn,v=ki;qu(c.type)&&(zn=c.stateNode,ki=!1),ar(o,s,c),f2(c.stateNode),zn=p,ki=v;break}case 5:_n||Mr(c,s);case 6:if(Si){if(p=zn,v=ki,zn=null,ar(o,s,c),zn=p,ki=v,zn!==null)if(ki)try{tB(zn,c.stateNode)}catch(x){Ce(c,s,x)}else try{$5(zn,c.stateNode)}catch(x){Ce(c,s,x)}}else ar(o,s,c);break;case 18:Si&&zn!==null&&(ki?DB(zn,c.stateNode):LB(zn,c.stateNode));break;case 4:Si?(p=zn,v=ki,zn=c.stateNode.containerInfo,ki=!0,ar(o,s,c),zn=p,ki=v):(Or&&nC(c.stateNode,c,WC()),ar(o,s,c));break;case 0:case 11:case 14:case 15:Qo(2,c,s),_n||Qo(4,c,s),ar(o,s,c);break;case 1:_n||(Mr(c,s),p=c.stateNode,typeof p.componentWillUnmount=="function"&&$A(c,s,p)),ar(o,s,c);break;case 21:ar(o,s,c);break;case 22:_n=(p=_n)||c.memoizedState!==null,ar(o,s,c),_n=p;break;default:ar(o,s,c)}}function oC(o,s){if(xi&&s.memoizedState===null&&(o=s.alternate,o!==null&&(o=o.memoizedState,o!==null))){o=o.dehydrated;try{_B(o)}catch(c){Ce(s,s.return,c)}}}function sC(o,s){if(xi&&s.memoizedState===null&&(o=s.alternate,o!==null&&(o=o.memoizedState,o!==null&&(o=o.dehydrated,o!==null))))try{zB(o)}catch(c){Ce(s,s.return,c)}}function a5(o){switch(o.tag){case 31:case 13:case 19:var s=o.stateNode;return s===null&&(s=o.stateNode=new w2),s;case 22:return o=o.stateNode,s=o._retryCache,s===null&&(s=o._retryCache=new w2),s;default:throw Error(i(435,o.tag))}}function um(o,s){var c=a5(o);s.forEach(function(p){if(!c.has(p)){c.add(p);var v=d5.bind(null,o,p);p.then(v,v)}})}function bi(o,s){var c=s.deletions;if(c!==null)for(var p=0;p<c.length;p++){var v=c[p],x=o,O=s;if(Si){var D=O;t:for(;D!==null;){switch(D.tag){case 27:if(Vn){if(qu(D.type)){zn=D.stateNode,ki=!1;break t}break}case 5:zn=D.stateNode,ki=!1;break t;case 3:case 4:zn=D.stateNode.containerInfo,ki=!0;break t}D=D.return}if(zn===null)throw Error(i(160));wb(x,O,v),zn=null,ki=!1}else wb(x,O,v);x=v.alternate,x!==null&&(x.return=null),v.return=null}if(s.subtreeFlags&13886)for(s=s.child;s!==null;)lC(s,o),s=s.sibling}function lC(o,s){var c=o.alternate,p=o.flags;switch(o.tag){case 0:case 11:case 14:case 15:bi(s,o),Ii(o),p&4&&(Qo(3,o,o.return),Wd(3,o),Qo(5,o,o.return));break;case 1:bi(s,o),Ii(o),p&512&&(_n||c===null||Mr(c,c.return)),p&64&&ao&&(o=o.updateQueue,o!==null&&(p=o.callbacks,p!==null&&(c=o.shared.hiddenCallbacks,o.shared.hiddenCallbacks=c===null?p:c.concat(p))));break;case 26:if(or){var v=sr;if(bi(s,o),Ii(o),p&512&&(_n||c===null||Mr(c,c.return)),p&4){p=c!==null?c.memoizedState:null;var x=o.memoizedState;c===null?x===null?o.stateNode===null?o.stateNode=qB(v,o.type,o.memoizedProps,o):l2(v,o.type,o.stateNode):o.stateNode=o2(v,x,o.memoizedProps):p!==x?(p===null?c.stateNode!==null&&u2(c.stateNode):s2(p),x===null?l2(v,o.type,o.stateNode):o2(v,x,o.memoizedProps)):x===null&&o.stateNode!==null&&bb(o,o.memoizedProps,c.memoizedProps)}break}case 27:if(Vn){bi(s,o),Ii(o),p&512&&(_n||c===null||Mr(c,c.return)),c!==null&&p&4&&bb(o,o.memoizedProps,c.memoizedProps);break}case 5:if(bi(s,o),Ii(o),p&512&&(_n||c===null||Mr(c,c.return)),Si){if(o.flags&32){v=o.stateNode;try{ZC(v)}catch(bt){Ce(o,o.return,bt)}}p&4&&o.stateNode!=null&&(v=o.memoizedProps,bb(o,v,c!==null?c.memoizedProps:v)),p&1024&&(cS=!0)}else Or&&o.alternate!==null&&(o.alternate.stateNode=o.stateNode);break;case 6:if(bi(s,o),Ii(o),p&4&&Si){if(o.stateNode===null)throw Error(i(162));p=o.memoizedProps,c=c!==null?c.memoizedProps:p,v=o.stateNode;try{Q5(v,c,p)}catch(bt){Ce(o,o.return,bt)}}break;case 3:if(or?(VB(),v=sr,sr=Xb(s.containerInfo),bi(s,o),sr=v):bi(s,o),Ii(o),p&4){if(Si&&xi&&c!==null&&c.memoizedState.isDehydrated)try{OB(s.containerInfo)}catch(bt){Ce(o,o.return,bt)}if(Or){p=s.containerInfo,c=s.pendingChildren;try{$C(p,c)}catch(bt){Ce(o,o.return,bt)}}}cS&&(cS=!1,uC(o));break;case 4:or?(c=sr,sr=Xb(o.stateNode.containerInfo),bi(s,o),Ii(o),sr=c):(bi(s,o),Ii(o)),p&4&&Or&&nC(o.stateNode,o,o.stateNode.pendingChildren);break;case 12:bi(s,o),Ii(o);break;case 31:bi(s,o),Ii(o),p&4&&(p=o.updateQueue,p!==null&&(o.updateQueue=null,um(o,p)));break;case 13:bi(s,o),Ii(o),o.child.flags&8192&&o.memoizedState!==null!=(c!==null&&c.memoizedState!==null)&&(Pm=ji()),p&4&&(p=o.updateQueue,p!==null&&(o.updateQueue=null,um(o,p)));break;case 22:v=o.memoizedState!==null;var O=c!==null&&c.memoizedState!==null,D=ao,$=_n;if(ao=D||v,_n=$||O,bi(s,o),_n=$,ao=D,Ii(o),p&8192&&(s=o.stateNode,s._visibility=v?s._visibility&-2:s._visibility|1,v&&(c===null||O||ao||_n||pl(o)),Si)){t:if(c=null,Si)for(s=o;;){if(s.tag===5||or&&s.tag===26){if(c===null){O=c=s;try{x=O.stateNode,v?eB(x):iB(O.stateNode,O.memoizedProps)}catch(bt){Ce(O,O.return,bt)}}}else if(s.tag===6){if(c===null){O=s;try{var ut=O.stateNode;v?nB(ut):aB(ut,O.memoizedProps)}catch(bt){Ce(O,O.return,bt)}}}else if(s.tag===18){if(c===null){O=s;try{var Et=O.stateNode;v?PB(Et):BB(O.stateNode)}catch(bt){Ce(O,O.return,bt)}}}else if((s.tag!==22&&s.tag!==23||s.memoizedState===null||s===o)&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===o)break t;for(;s.sibling===null;){if(s.return===null||s.return===o)break t;c===s&&(c=null),s=s.return}c===s&&(c=null),s.sibling.return=s.return,s=s.sibling}}p&4&&(p=o.updateQueue,p!==null&&(c=p.retryQueue,c!==null&&(p.retryQueue=null,um(o,c))));break;case 19:bi(s,o),Ii(o),p&4&&(p=o.updateQueue,p!==null&&(o.updateQueue=null,um(o,p)));break;case 30:break;case 21:break;default:bi(s,o),Ii(o)}}function Ii(o){var s=o.flags;if(s&2){try{for(var c,p=o.return;p!==null;){if(eC(p)){c=p;break}p=p.return}if(Si){if(c==null)throw Error(i(160));switch(c.tag){case 27:if(Vn){var v=c.stateNode,x=Sb(o);lm(o,x,v);break}case 5:var O=c.stateNode;c.flags&32&&(ZC(O),c.flags&=-33);var D=Sb(o);lm(o,D,O);break;case 3:case 4:var $=c.stateNode.containerInfo,ut=Sb(o);xb(o,ut,$);break;default:throw Error(i(161))}}}catch(Et){Ce(o,o.return,Et)}o.flags&=-3}s&4096&&(o.flags&=-4097)}function uC(o){if(o.subtreeFlags&1024)for(o=o.child;o!==null;){var s=o;uC(s),s.tag===5&&s.flags&1024&&B5(s.stateNode),o=o.sibling}}function Wr(o,s){if(s.subtreeFlags&8772)for(s=s.child;s!==null;)aC(o,s.alternate,s),s=s.sibling}function pl(o){for(o=o.child;o!==null;){var s=o;switch(s.tag){case 0:case 11:case 14:case 15:Qo(4,s,s.return),pl(s);break;case 1:Mr(s,s.return);var c=s.stateNode;typeof c.componentWillUnmount=="function"&&$A(s,s.return,c),pl(s);break;case 27:Vn&&f2(s.stateNode);case 26:case 5:Mr(s,s.return),pl(s);break;case 22:s.memoizedState===null&&pl(s);break;case 30:pl(s);break;default:pl(s)}o=o.sibling}}function Jr(o,s,c){for(c=c&&(s.subtreeFlags&8772)!==0,s=s.child;s!==null;){var p=s.alternate,v=o,x=s,O=x.flags;switch(x.tag){case 0:case 11:case 15:Jr(v,x,c),Wd(4,x);break;case 1:if(Jr(v,x,c),p=x,v=p.stateNode,typeof v.componentDidMount=="function")try{v.componentDidMount()}catch(ut){Ce(p,p.return,ut)}if(p=x,v=p.updateQueue,v!==null){var D=p.stateNode;try{var $=v.shared.hiddenCallbacks;if($!==null)for(v.shared.hiddenCallbacks=null,v=0;v<$.length;v++)oa($[v],D)}catch(ut){Ce(p,p.return,ut)}}c&&O&64&&JA(x),Jd(x,x.return);break;case 27:Vn&&iC(x);case 26:case 5:Jr(v,x,c),c&&p===null&&O&4&&tC(x),Jd(x,x.return);break;case 12:Jr(v,x,c);break;case 31:Jr(v,x,c),c&&O&4&&oC(v,x);break;case 13:Jr(v,x,c),c&&O&4&&sC(v,x);break;case 22:x.memoizedState===null&&Jr(v,x,c),Jd(x,x.return);break;case 30:break;default:Jr(v,x,c)}s=s.sibling}}function Tb(o,s){var c=null;o!==null&&o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(c=o.memoizedState.cachePool.pool),o=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(o=s.memoizedState.cachePool.pool),o!==c&&(o!=null&&o.refCount++,c!=null&&wt(c))}function Rb(o,s){o=null,s.alternate!==null&&(o=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==o&&(s.refCount++,o!=null&&wt(o))}function rr(o,s,c,p){if(s.subtreeFlags&10256)for(s=s.child;s!==null;)cC(o,s,c,p),s=s.sibling}function cC(o,s,c,p){var v=s.flags;switch(s.tag){case 0:case 11:case 15:rr(o,s,c,p),v&2048&&Wd(9,s);break;case 1:rr(o,s,c,p);break;case 3:rr(o,s,c,p),v&2048&&(o=null,s.alternate!==null&&(o=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==o&&(s.refCount++,o!=null&&wt(o)));break;case 12:if(v&2048){rr(o,s,c,p),o=s.stateNode;try{var x=s.memoizedProps,O=x.id,D=x.onPostCommit;typeof D=="function"&&D(O,s.alternate===null?"mount":"update",o.passiveEffectDuration,-0)}catch($){Ce(s,s.return,$)}}else rr(o,s,c,p);break;case 31:rr(o,s,c,p);break;case 13:rr(o,s,c,p);break;case 23:break;case 22:x=s.stateNode,O=s.alternate,s.memoizedState!==null?x._visibility&2?rr(o,s,c,p):$d(o,s):x._visibility&2?rr(o,s,c,p):(x._visibility|=2,Lu(o,s,c,p,(s.subtreeFlags&10256)!==0||!1)),v&2048&&Tb(O,s);break;case 24:rr(o,s,c,p),v&2048&&Rb(s.alternate,s);break;default:rr(o,s,c,p)}}function Lu(o,s,c,p,v){for(v=v&&((s.subtreeFlags&10256)!==0||!1),s=s.child;s!==null;){var x=o,O=s,D=c,$=p,ut=O.flags;switch(O.tag){case 0:case 11:case 15:Lu(x,O,D,$,v),Wd(8,O);break;case 23:break;case 22:var Et=O.stateNode;O.memoizedState!==null?Et._visibility&2?Lu(x,O,D,$,v):$d(x,O):(Et._visibility|=2,Lu(x,O,D,$,v)),v&&ut&2048&&Tb(O.alternate,O);break;case 24:Lu(x,O,D,$,v),v&&ut&2048&&Rb(O.alternate,O);break;default:Lu(x,O,D,$,v)}s=s.sibling}}function $d(o,s){if(s.subtreeFlags&10256)for(s=s.child;s!==null;){var c=o,p=s,v=p.flags;switch(p.tag){case 22:$d(c,p),v&2048&&Tb(p.alternate,p);break;case 24:$d(c,p),v&2048&&Rb(p.alternate,p);break;default:$d(c,p)}s=s.sibling}}function ml(o,s,c){if(o.subtreeFlags&tc)for(o=o.child;o!==null;)dC(o,s,c),o=o.sibling}function dC(o,s,c){switch(o.tag){case 26:if(ml(o,s,c),o.flags&tc)if(o.memoizedState!==null)kB(c,sr,o.memoizedState,o.memoizedProps);else{var p=o.stateNode,v=o.type;o=o.memoizedProps,((s&335544128)===s||kb(v,o))&&KC(c,p,v,o)}break;case 5:ml(o,s,c),o.flags&tc&&(p=o.stateNode,v=o.type,o=o.memoizedProps,((s&335544128)===s||kb(v,o))&&KC(c,p,v,o));break;case 3:case 4:or?(p=sr,sr=Xb(o.stateNode.containerInfo),ml(o,s,c),sr=p):ml(o,s,c);break;case 22:o.memoizedState===null&&(p=o.alternate,p!==null&&p.memoizedState!==null?(p=tc,tc=16777216,ml(o,s,c),tc=p):ml(o,s,c));break;default:ml(o,s,c)}}function fC(o){var s=o.alternate;if(s!==null&&(o=s.child,o!==null)){s.child=null;do s=o.sibling,o.sibling=null,o=s;while(o!==null)}}function tf(o){var s=o.deletions;if(o.flags&16){if(s!==null)for(var c=0;c<s.length;c++){var p=s[c];Wn=p,pC(p,o)}fC(o)}if(o.subtreeFlags&10256)for(o=o.child;o!==null;)hC(o),o=o.sibling}function hC(o){switch(o.tag){case 0:case 11:case 15:tf(o),o.flags&2048&&Qo(9,o,o.return);break;case 3:tf(o);break;case 12:tf(o);break;case 22:var s=o.stateNode;o.memoizedState!==null&&s._visibility&2&&(o.return===null||o.return.tag!==13)?(s._visibility&=-3,cm(o)):tf(o);break;default:tf(o)}}function cm(o){var s=o.deletions;if(o.flags&16){if(s!==null)for(var c=0;c<s.length;c++){var p=s[c];Wn=p,pC(p,o)}fC(o)}for(o=o.child;o!==null;){switch(s=o,s.tag){case 0:case 11:case 15:Qo(8,s,s.return),cm(s);break;case 22:c=s.stateNode,c._visibility&2&&(c._visibility&=-3,cm(s));break;default:cm(s)}o=o.sibling}}function pC(o,s){for(;Wn!==null;){var c=Wn;switch(c.tag){case 0:case 11:case 15:Qo(8,c,s);break;case 23:case 22:if(c.memoizedState!==null&&c.memoizedState.cachePool!==null){var p=c.memoizedState.cachePool.pool;p!=null&&p.refCount++}break;case 24:wt(c.memoizedState.cache)}if(p=c.child,p!==null)p.return=c,Wn=p;else t:for(c=o;Wn!==null;){p=Wn;var v=p.sibling,x=p.return;if(rC(p),p===c){Wn=null;break t}if(v!==null){v.return=x,Wn=v;break t}Wn=x}}}function Eb(o){var s=M5(o);if(s!=null){if(typeof s.memoizedProps["data-testname"]!="string")throw Error(i(364));return s}if(o=q5(o),o===null)throw Error(i(362));return o.stateNode.current}function Ab(o,s){var c=o.tag;switch(s.$$typeof){case zm:if(o.type===s.value)return!0;break;case Im:t:{for(s=s.value,o=[o,0],c=0;c<o.length;){var p=o[c++],v=p.tag,x=o[c++],O=s[x];if(v!==5&&v!==26&&v!==27||!rf(p)){for(;O!=null&&Ab(p,O);)x++,O=s[x];if(x===s.length){s=!0;break t}else for(p=p.child;p!==null;)o.push(p,x),p=p.sibling}}s=!1}return s;case Nm:if((c===5||c===26||c===27)&&j5(o.stateNode,s.value))return!0;break;case Dm:if((c===5||c===6||c===26||c===27)&&(o=V5(o),o!==null&&0<=o.indexOf(s.value)))return!0;break;case Lm:if((c===5||c===26||c===27)&&(o=o.memoizedProps["data-testname"],typeof o=="string"&&o.toLowerCase()===s.value.toLowerCase()))return!0;break;default:throw Error(i(365))}return!1}function Cb(o){switch(o.$$typeof){case zm:return"<"+(d(o.value)||"Unknown")+">";case Im:return":has("+(Cb(o)||"")+")";case Nm:return'[role="'+o.value+'"]';case Dm:return'"'+o.value+'"';case Lm:return'[data-testname="'+o.value+'"]';default:throw Error(i(365))}}function mC(o,s){var c=[];o=[o,0];for(var p=0;p<o.length;){var v=o[p++],x=v.tag,O=o[p++],D=s[O];if(x!==5&&x!==26&&x!==27||!rf(v)){for(;D!=null&&Ab(v,D);)O++,D=s[O];if(O===s.length)c.push(v);else for(v=v.child;v!==null;)o.push(v,O),v=v.sibling}}return c}function Mb(o,s){if(!af)throw Error(i(363));o=Eb(o),o=mC(o,s),s=[],o=Array.from(o);for(var c=0;c<o.length;){var p=o[c++],v=p.tag;if(v===5||v===26||v===27)rf(p)||s.push(p.stateNode);else for(p=p.child;p!==null;)o.push(p),p=p.sibling}return s}function sa(){return ge&2&&xe!==0?xe&-xe:jt.T!==null?At():_5()}function gC(){if(pa===0)if(!(xe&536870912)||Te){var o=vm;vm<<=1,!(vm&3932160)&&(vm=262144),pa=o}else pa=536870912;return o=fa.current,o!==null&&(o.flags|=32),pa}function Vi(o,s,c){(o===je&&(De===2||De===9)||o.cancelPendingCommit!==null)&&(Du(o,0),Ko(o,xe,pa,!1)),M(o,c),(!(ge&2)||o!==je)&&(o===je&&(!(ge&2)&&(El|=c),pn===4&&Ko(o,xe,pa,!1)),P(o))}function yC(o,s,c){if(ge&6)throw Error(i(327));var p=!c&&(s&127)===0&&(s&o.expiredLanes)===0||T(o,s),v=p?s5(o,s):_b(o,s,!0),x=p;do{if(v===0){ec&&!p&&Ko(o,s,0,!1);break}else{if(c=o.current.alternate,x&&!r5(c)){v=_b(o,s,!1),x=!1;continue}if(v===2){if(x=s,o.errorRecoveryDisabledLanes&x)var O=0;else O=o.pendingLanes&-536870913,O=O!==0?O:O&536870912?536870912:0;if(O!==0){s=O;t:{var D=o;v=pf;var $=xi&&D.current.memoizedState.isDehydrated;if($&&(Du(D,O).flags|=256),O=_b(D,O,!1),O!==2){if(dS&&!$){D.errorRecoveryDisabledLanes|=x,El|=x,v=4;break t}x=Gi,Gi=v,x!==null&&(Gi===null?Gi=x:Gi.push.apply(Gi,x))}v=O}if(x=!1,v!==2)continue}}if(v===1){Du(o,0),Ko(o,s,0,!0);break}t:{switch(p=o,x=v,x){case 0:case 1:throw Error(i(345));case 4:if((s&4194048)!==s)break;case 6:Ko(p,s,pa,!ns);break t;case 2:Gi=null;break;case 3:case 5:break;default:throw Error(i(329))}if((s&62914560)===s&&(v=Pm+300-ji(),10<v)){if(Ko(p,s,pa,!ns),E(p,0,!0)!==0)break t;oo=s,p.timeoutHandle=A5(vC.bind(null,p,c,Gi,Bm,hS,s,pa,El,nc,ns,x,"Throttled",-0,0),v);break t}vC(p,c,Gi,Bm,hS,s,pa,El,nc,ns,x,null,-0,0)}}break}while(!0);P(o)}function vC(o,s,c,p,v,x,O,D,$,ut,Et,bt,_t,oe){if(o.timeoutHandle=yl,bt=s.subtreeFlags,bt&8192||(bt&16785408)===16785408){bt=D5(),dC(s,x,bt);var ui=(x&62914560)===x?Pm-ji():(x&4194048)===x?T2-ji():0;if(ui=P5(bt,ui),ui!==null){oo=x,o.cancelPendingCommit=ui(CC.bind(null,o,s,x,c,p,v,O,D,$,Et,bt,null,_t,oe)),Ko(o,x,O,!ut);return}}CC(o,s,x,c,p,v,O,D,$)}function r5(o){for(var s=o;;){var c=s.tag;if((c===0||c===11||c===15)&&s.flags&16384&&(c=s.updateQueue,c!==null&&(c=c.stores,c!==null)))for(var p=0;p<c.length;p++){var v=c[p],x=v.getSnapshot;v=v.value;try{if(!da(x(),v))return!1}catch{return!1}}if(c=s.child,s.subtreeFlags&16384&&c!==null)c.return=s,s=c;else{if(s===o)break;for(;s.sibling===null;){if(s.return===null||s.return===o)return!0;s=s.return}s.sibling.return=s.return,s=s.sibling}}return!0}function Ko(o,s,c,p){s&=~fS,s&=~El,o.suspendedLanes|=s,o.pingedLanes&=~s,p&&(o.warmLanes|=s),p=o.expirationTimes;for(var v=s;0<v;){var x=31-ua(v),O=1<<x;p[x]=-1,v&=~O}c!==0&&I(o,c,s)}function bC(){return ge&6?!0:(Z(0,!1),!1)}function Ob(){if(ye!==null){if(De===0)var o=ye.return;else o=ye,no=bl=null,Z0(o),Ku=null,cf=0,o=ye;for(;o!==null;)WA(o.alternate,o),o=o.return;ye=null}}function Du(o,s){var c=o.timeoutHandle;c!==yl&&(o.timeoutHandle=yl,C5(c)),c=o.cancelPendingCommit,c!==null&&(o.cancelPendingCommit=null,c()),oo=0,Ob(),je=o,ye=c=$r(o.current,null),xe=s,De=0,ha=null,ns=!1,ec=T(o,s),dS=!1,nc=pa=fS=El=is=pn=0,Gi=pf=null,hS=!1,s&8&&(s|=s&32);var p=o.entangledLanes;if(p!==0)for(o=o.entanglements,p&=s;0<p;){var v=31-ua(p),x=1<<v;s|=o[v],p&=~x}return ro=s,cl(),c}function SC(o,s){se=null,jt.H=ff,s===Qu||s===Am?(s=Qn(),De=3):s===iS?(s=Qn(),De=4):De=s===lS?8:s!==null&&typeof s=="object"&&typeof s.then=="function"?6:1,ha=s,ye===null&&(pn=1,nm(o,et(s,o.current)))}function xC(){var o=fa.current;return o===null?!0:(xe&4194048)===xe?Ha===null:(xe&62914560)===xe||xe&536870912?o===Ha:!1}function wC(){var o=jt.H;return jt.H=ff,o===null?ff:o}function TC(){var o=jt.A;return jt.A=r6,o}function dm(){pn=4,ns||(xe&4194048)!==xe&&fa.current!==null||(ec=!0),!(is&134217727)&&!(El&134217727)||je===null||Ko(je,xe,pa,!1)}function _b(o,s,c){var p=ge;ge|=2;var v=wC(),x=TC();(je!==o||xe!==s)&&(Bm=null,Du(o,s)),s=!1;var O=pn;t:do try{if(De!==0&&ye!==null){var D=ye,$=ha;switch(De){case 8:Ob(),O=6;break t;case 3:case 2:case 9:case 6:fa.current===null&&(s=!0);var ut=De;if(De=0,ha=null,Pu(o,D,$,ut),c&&ec){O=0;break t}break;default:ut=De,De=0,ha=null,Pu(o,D,$,ut)}}o5(),O=pn;break}catch(Et){SC(o,Et)}while(!0);return s&&o.shellSuspendCounter++,no=bl=null,ge=p,jt.H=v,jt.A=x,ye===null&&(je=null,xe=0,cl()),O}function o5(){for(;ye!==null;)RC(ye)}function s5(o,s){var c=ge;ge|=2;var p=wC(),v=TC();je!==o||xe!==s?(Bm=null,mf=ji()+500,Du(o,s)):ec=T(o,s);t:do try{if(De!==0&&ye!==null){s=ye;var x=ha;e:switch(De){case 1:De=0,ha=null,Pu(o,s,x,1);break;case 2:case 9:if(Le(x)){De=0,ha=null,EC(s);break}s=function(){De!==2&&De!==9||je!==o||(De=7),P(o)},x.then(s,s);break t;case 3:De=7;break t;case 4:De=5;break t;case 7:Le(x)?(De=0,ha=null,EC(s)):(De=0,ha=null,Pu(o,s,x,7));break;case 5:var O=null;switch(ye.tag){case 26:O=ye.memoizedState;case 5:case 27:var D=ye,$=D.type,ut=D.pendingProps;if(O?c2(O):QC(D.stateNode,$,ut)){De=0,ha=null;var Et=D.sibling;if(Et!==null)ye=Et;else{var bt=D.return;bt!==null?(ye=bt,fm(bt)):ye=null}break e}}De=0,ha=null,Pu(o,s,x,5);break;case 6:De=0,ha=null,Pu(o,s,x,6);break;case 8:Ob(),pn=6;break t;default:throw Error(i(462))}}l5();break}catch(_t){SC(o,_t)}while(!0);return no=bl=null,jt.H=p,jt.A=v,ge=c,ye!==null?0:(je=null,xe=0,cl(),pn)}function l5(){for(;ye!==null&&!QB();)RC(ye)}function RC(o){var s=YA(o.alternate,o,ro);o.memoizedProps=o.pendingProps,s===null?fm(o):ye=s}function EC(o){var s=o,c=s.alternate;switch(s.tag){case 15:case 0:s=qA(c,s,s.pendingProps,s.type,void 0,xe);break;case 11:s=qA(c,s,s.pendingProps,s.type.render,s.ref,xe);break;case 5:Z0(s);default:WA(c,s),s=ye=DC(s,ro),s=YA(c,s,ro)}o.memoizedProps=o.pendingProps,s===null?fm(o):ye=s}function Pu(o,s,c,p){no=bl=null,Z0(s),Ku=null,cf=0;var v=s.return;try{if(J4(o,v,s,c,xe)){pn=1,nm(o,et(c,o.current)),ye=null;return}}catch(x){if(v!==null)throw ye=v,x;pn=1,nm(o,et(c,o.current)),ye=null;return}s.flags&32768?(Te||p===1?o=!0:ec||xe&536870912?o=!1:(ns=o=!0,(p===2||p===9||p===3||p===6)&&(p=fa.current,p!==null&&p.tag===13&&(p.flags|=16384))),AC(s,o)):fm(s)}function fm(o){var s=o;do{if(s.flags&32768){AC(s,ns);return}o=s.return;var c=e5(s.alternate,s,ro);if(c!==null){ye=c;return}if(s=s.sibling,s!==null){ye=s;return}ye=s=o}while(s!==null);pn===0&&(pn=5)}function AC(o,s){do{var c=n5(o.alternate,o);if(c!==null){c.flags&=32767,ye=c;return}if(c=o.return,c!==null&&(c.flags|=32768,c.subtreeFlags=0,c.deletions=null),!s&&(o=o.sibling,o!==null)){ye=o;return}ye=o=c}while(o!==null);pn=6,ye=null}function CC(o,s,c,p,v,x,O,D,$){o.cancelPendingCommit=null;do ef();while(jn!==0);if(ge&6)throw Error(i(327));if(s!==null){if(s===o.current)throw Error(i(177));if(x=s.lanes|s.childLanes,x|=aS,z(o,c,x,O,D,$),o===je&&(ye=je=null,xe=0),ic=s,rs=o,oo=c,pS=x,mS=v,R2=p,s.subtreeFlags&10256||s.flags&10256?(o.callbackNode=null,o.callbackPriority=0,f5(Zb,function(){return IC(),null})):(o.callbackNode=null,o.callbackPriority=0),p=(s.flags&13878)!==0,s.subtreeFlags&13878||p){p=jt.T,jt.T=null,v=eo(),Zn(2),O=ge,ge|=4;try{i5(o,s,c)}finally{ge=O,Zn(v),jt.T=p}}jn=1,MC(),OC(),_C()}}function MC(){if(jn===1){jn=0;var o=rs,s=ic,c=(s.flags&13878)!==0;if(s.subtreeFlags&13878||c){c=jt.T,jt.T=null;var p=eo();Zn(2);var v=ge;ge|=4;try{lC(s,o),R5(o.containerInfo)}finally{ge=v,Zn(p),jt.T=c}}o.current=s,jn=2}}function OC(){if(jn===2){jn=0;var o=rs,s=ic,c=(s.flags&8772)!==0;if(s.subtreeFlags&8772||c){c=jt.T,jt.T=null;var p=eo();Zn(2);var v=ge;ge|=4;try{aC(o,s.alternate,s)}finally{ge=v,Zn(p),jt.T=c}}jn=3}}function _C(){if(jn===4||jn===3){jn=0,KB();var o=rs,s=ic,c=oo,p=R2;s.subtreeFlags&10256||s.flags&10256?jn=5:(jn=0,ic=rs=null,zC(o,o.pendingLanes));var v=o.pendingLanes;if(v===0&&(as=null),nt(c),s=s.stateNode,ca&&typeof ca.onCommitFiberRoot=="function")try{ca.onCommitFiberRoot(of,s,void 0,(s.current.flags&128)===128)}catch{}if(p!==null){s=jt.T,v=eo(),Zn(2),jt.T=null;try{for(var x=o.onRecoverableError,O=0;O<p.length;O++){var D=p[O];x(D.value,{componentStack:D.stack})}}finally{jt.T=s,Zn(v)}}oo&3&&ef(),P(o),v=o.pendingLanes,c&261930&&v&42?o===gS?gf++:(gf=0,gS=o):gf=0,xi&&NB(),Z(0,!1)}}function zC(o,s){(o.pooledCacheLanes&=s)===0&&(s=o.pooledCache,s!=null&&(o.pooledCache=null,wt(s)))}function ef(){return MC(),OC(),_C(),IC()}function IC(){if(jn!==5)return!1;var o=rs,s=pS;pS=0;var c=nt(oo),p=32>c?32:c;c=jt.T;var v=eo();try{Zn(p),jt.T=null,p=mS,mS=null;var x=rs,O=oo;if(jn=0,ic=rs=null,oo=0,ge&6)throw Error(i(331));var D=ge;if(ge|=4,hC(x.current),cC(x,x.current,O,p),ge=D,Z(0,!1),ca&&typeof ca.onPostCommitFiberRoot=="function")try{ca.onPostCommitFiberRoot(of,x)}catch{}return!0}finally{Zn(v),jt.T=c,zC(o,s)}}function NC(o,s,c){s=et(c,s),s=lb(o.stateNode,s,2),o=vt(o,s,2),o!==null&&(M(o,2),P(o))}function Ce(o,s,c){if(o.tag===3)NC(o,o,c);else for(;s!==null;){if(s.tag===3){NC(s,o,c);break}else if(s.tag===1){var p=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof p.componentDidCatch=="function"&&(as===null||!as.has(p))){o=et(c,o),c=IA(2),p=vt(s,c,2),p!==null&&(NA(c,p,s,o),M(p,2),P(p));break}}s=s.return}}function zb(o,s,c){var p=o.pingCache;if(p===null){p=o.pingCache=new o6;var v=new Set;p.set(s,v)}else v=p.get(s),v===void 0&&(v=new Set,p.set(s,v));v.has(c)||(dS=!0,v.add(c),o=u5.bind(null,o,s,c),s.then(o,o))}function u5(o,s,c){var p=o.pingCache;p!==null&&p.delete(s),o.pingedLanes|=o.suspendedLanes&c,o.warmLanes&=~c,je===o&&(xe&c)===c&&(pn===4||pn===3&&(xe&62914560)===xe&&300>ji()-Pm?!(ge&2)&&Du(o,0):fS|=c,nc===xe&&(nc=0)),P(o)}function LC(o,s){s===0&&(s=R()),o=q(o,s),o!==null&&(M(o,s),P(o))}function c5(o){var s=o.memoizedState,c=0;s!==null&&(c=s.retryLane),LC(o,c)}function d5(o,s){var c=0;switch(o.tag){case 31:case 13:var p=o.stateNode,v=o.memoizedState;v!==null&&(c=v.retryLane);break;case 19:p=o.stateNode;break;case 22:p=o.stateNode._retryCache;break;default:throw Error(i(314))}p!==null&&p.delete(s),LC(o,c)}function f5(o,s){return Sm(o,s)}function h5(o,s,c,p){this.tag=o,this.key=c,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=s,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=p,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ib(o){return o=o.prototype,!(!o||!o.isReactComponent)}function $r(o,s){var c=o.alternate;return c===null?(c=e(o.tag,s,o.key,o.mode),c.elementType=o.elementType,c.type=o.type,c.stateNode=o.stateNode,c.alternate=o,o.alternate=c):(c.pendingProps=s,c.type=o.type,c.flags=0,c.subtreeFlags=0,c.deletions=null),c.flags=o.flags&65011712,c.childLanes=o.childLanes,c.lanes=o.lanes,c.child=o.child,c.memoizedProps=o.memoizedProps,c.memoizedState=o.memoizedState,c.updateQueue=o.updateQueue,s=o.dependencies,c.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},c.sibling=o.sibling,c.index=o.index,c.ref=o.ref,c.refCleanup=o.refCleanup,c}function DC(o,s){o.flags&=65011714;var c=o.alternate;return c===null?(o.childLanes=0,o.lanes=s,o.child=null,o.subtreeFlags=0,o.memoizedProps=null,o.memoizedState=null,o.updateQueue=null,o.dependencies=null,o.stateNode=null):(o.childLanes=c.childLanes,o.lanes=c.lanes,o.child=c.child,o.subtreeFlags=0,o.deletions=null,o.memoizedProps=c.memoizedProps,o.memoizedState=c.memoizedState,o.updateQueue=c.updateQueue,o.type=c.type,s=c.dependencies,o.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext}),o}function hm(o,s,c,p,v,x){var O=0;if(p=o,typeof o=="function")Ib(o)&&(O=1);else if(typeof o=="string")O=or&&Vn?a2(o,c,si.current)?26:h2(o)?27:5:or?a2(o,c,si.current)?26:5:Vn&&h2(o)?27:5;else t:switch(o){case Vb:return o=e(31,c,s,v),o.elementType=Vb,o.lanes=x,o;case Hu:return gl(c.children,v,x,s);case VC:O=8,v|=24;break;case Bb:return o=e(12,c,s,v|2),o.elementType=Bb,o.lanes=x,o;case Fb:return o=e(13,c,s,v),o.elementType=Fb,o.lanes=x,o;case qb:return o=e(19,c,s,v),o.elementType=qb,o.lanes=x,o;default:if(typeof o=="object"&&o!==null)switch(o.$$typeof){case Zo:O=10;break t;case jC:O=9;break t;case Hb:O=11;break t;case Ub:O=14;break t;case Wo:O=16,p=null;break t}O=29,c=Error(i(130,o===null?"null":typeof o,"")),p=null}return s=e(O,c,s,v),s.elementType=o,s.type=p,s.lanes=x,s}function gl(o,s,c,p){return o=e(7,o,p,s),o.lanes=c,o}function Nb(o,s,c){return o=e(6,o,null,s),o.lanes=c,o}function PC(o){var s=e(18,null,null,0);return s.stateNode=o,s}function Lb(o,s,c){return s=e(4,o.children!==null?o.children:[],o.key,s),s.lanes=c,s.stateNode={containerInfo:o.containerInfo,pendingChildren:null,implementation:o.implementation},s}function p5(o,s,c,p,v,x,O,D,$){this.tag=1,this.containerInfo=o,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=yl,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=A(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=A(0),this.hiddenUpdates=A(null),this.identifierPrefix=p,this.onUncaughtError=v,this.onCaughtError=x,this.onRecoverableError=O,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=$,this.incompleteTransitions=new Map}function BC(o,s,c,p,v,x,O,D,$,ut,Et,bt){return o=new p5(o,s,c,O,$,ut,Et,bt,D),s=1,x===!0&&(s|=24),x=e(3,null,null,s),o.current=x,x.stateNode=o,s=ft(),s.refCount++,o.pooledCache=s,s.refCount++,x.memoizedState={element:p,isDehydrated:c,cache:s},ne(x),o}function HC(o){return o?(o=Vu,o):Vu}function FC(o){var s=o._reactInternals;if(s===void 0)throw typeof o.render=="function"?Error(i(188)):(o=Object.keys(o).join(","),Error(i(268,o)));return o=l(s),o=o!==null?u(o):null,o===null?null:nf(o.stateNode)}function qC(o,s,c,p,v,x){v=HC(v),p.context===null?p.context=v:p.pendingContext=v,p=pt(s),p.payload={element:c},x=x===void 0?null:x,x!==null&&(p.callback=x),c=vt(o,p,s),c!==null&&(Vi(c,o,s),$t(c,o,s))}function UC(o,s){if(o=o.memoizedState,o!==null&&o.dehydrated!==null){var c=o.retryLane;o.retryLane=c!==0&&c<s?c:s}}function Db(o,s){UC(o,s),(o=o.alternate)&&UC(o,s)}var me={},m5=ct(),la=px(),Pb=Object.assign,g5=Symbol.for("react.element"),pm=Symbol.for("react.transitional.element"),Bu=Symbol.for("react.portal"),Hu=Symbol.for("react.fragment"),VC=Symbol.for("react.strict_mode"),Bb=Symbol.for("react.profiler"),jC=Symbol.for("react.consumer"),Zo=Symbol.for("react.context"),Hb=Symbol.for("react.forward_ref"),Fb=Symbol.for("react.suspense"),qb=Symbol.for("react.suspense_list"),Ub=Symbol.for("react.memo"),Wo=Symbol.for("react.lazy");Symbol.for("react.scope");var Vb=Symbol.for("react.activity");Symbol.for("react.legacy_hidden"),Symbol.for("react.tracing_marker");var y5=Symbol.for("react.memo_cache_sentinel");Symbol.for("react.view_transition");var kC=Symbol.iterator,v5=Symbol.for("react.client.reference"),mm=Array.isArray,jt=m5.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,b5=t.rendererVersion,S5=t.rendererPackageName,GC=t.extraDevToolsConfig,nf=t.getPublicInstance,x5=t.getRootHostContext,w5=t.getChildHostContext,T5=t.prepareForCommit,R5=t.resetAfterCommit,E5=t.createInstance;t.cloneMutableInstance;var jb=t.appendInitialChild,YC=t.finalizeInitialChildren,gm=t.shouldSetTextContent,XC=t.createTextInstance;t.cloneMutableTextInstance;var A5=t.scheduleTimeout,C5=t.cancelTimeout,yl=t.noTimeout,to=t.isPrimaryRenderer;t.warnsIfNotActing;var Si=t.supportsMutation,Or=t.supportsPersistence,xi=t.supportsHydration,M5=t.getInstanceFromNode;t.beforeActiveInstanceBlur;var O5=t.preparePortalMount;t.prepareScopeUpdate,t.getInstanceFromScope;var Zn=t.setCurrentUpdatePriority,eo=t.getCurrentUpdatePriority,_5=t.resolveUpdatePriority;t.trackSchedulerEvent,t.resolveEventType,t.resolveEventTimeStamp;var z5=t.shouldAttemptEagerTransition,I5=t.detachDeletedInstance;t.requestPostPaintCallback;var N5=t.maySuspendCommit,L5=t.maySuspendCommitOnUpdate,kb=t.maySuspendCommitInSyncRender,QC=t.preloadInstance,D5=t.startSuspendingCommit,KC=t.suspendInstance;t.suspendOnActiveViewTransition;var P5=t.waitForCommitToBeReady;t.getSuspendedCommitReason;var Fu=t.NotPendingTransition,vl=t.HostTransitionContext,B5=t.resetFormInstance;t.bindToConsole;var H5=t.supportsMicrotasks,F5=t.scheduleMicrotask,af=t.supportsTestSelectors,q5=t.findFiberRoot,U5=t.getBoundingRect,V5=t.getTextContent,rf=t.isHiddenSubtree,j5=t.matchAccessibilityRole,k5=t.setFocusIfFocusable,G5=t.setupIntersectionObserver,Y5=t.appendChild,X5=t.appendChildToContainer,Q5=t.commitTextUpdate,K5=t.commitMount,Z5=t.commitUpdate,W5=t.insertBefore,J5=t.insertInContainerBefore,$5=t.removeChild,tB=t.removeChildFromContainer,ZC=t.resetTextContent,eB=t.hideInstance,nB=t.hideTextInstance,iB=t.unhideInstance,aB=t.unhideTextInstance;t.cancelViewTransitionName,t.cancelRootViewTransitionName,t.restoreRootViewTransitionName,t.cloneRootViewTransitionContainer,t.removeRootViewTransitionClone,t.measureClonedInstance,t.hasInstanceChanged,t.hasInstanceAffectedParent,t.startViewTransition,t.startGestureTransition,t.stopViewTransition,t.getCurrentGestureOffset,t.createViewTransitionInstance;var rB=t.clearContainer;t.createFragmentInstance,t.updateFragmentInstanceFiber,t.commitNewChildToFragmentInstance,t.deleteChildFromFragmentInstance;var oB=t.cloneInstance,WC=t.createContainerChildSet,JC=t.appendChildToContainerChildSet,sB=t.finalizeContainerChildren,$C=t.replaceContainerChildren,t2=t.cloneHiddenInstance,e2=t.cloneHiddenTextInstance,Gb=t.isSuspenseInstancePending,Yb=t.isSuspenseInstanceFallback,lB=t.getSuspenseInstanceFallbackErrorDetails,uB=t.registerSuspenseInstanceRetry,cB=t.canHydrateFormStateMarker,dB=t.isFormStateMarkerMatching,n2=t.getNextHydratableSibling,fB=t.getNextHydratableSiblingAfterSingleton,hB=t.getFirstHydratableChild,pB=t.getFirstHydratableChildWithinContainer,mB=t.getFirstHydratableChildWithinActivityInstance,gB=t.getFirstHydratableChildWithinSuspenseInstance,yB=t.getFirstHydratableChildWithinSingleton,vB=t.canHydrateInstance,bB=t.canHydrateTextInstance,SB=t.canHydrateActivityInstance,xB=t.canHydrateSuspenseInstance,wB=t.hydrateInstance,TB=t.hydrateTextInstance,RB=t.hydrateActivityInstance,EB=t.hydrateSuspenseInstance,AB=t.getNextHydratableInstanceAfterActivityInstance,CB=t.getNextHydratableInstanceAfterSuspenseInstance,MB=t.commitHydratedInstance,OB=t.commitHydratedContainer,_B=t.commitHydratedActivityInstance,zB=t.commitHydratedSuspenseInstance,IB=t.finalizeHydratedChildren,NB=t.flushHydrationEvents;t.clearActivityBoundary;var LB=t.clearSuspenseBoundary;t.clearActivityBoundaryFromContainer;var DB=t.clearSuspenseBoundaryFromContainer,PB=t.hideDehydratedBoundary,BB=t.unhideDehydratedBoundary,i2=t.shouldDeleteUnhydratedTailInstances;t.diffHydratedPropsForDevWarnings,t.diffHydratedTextForDevWarnings,t.describeHydratableInstanceForDevWarnings;var HB=t.validateHydratableInstance,FB=t.validateHydratableTextInstance,or=t.supportsResources,a2=t.isHostHoistableType,Xb=t.getHoistableRoot,r2=t.getResource,o2=t.acquireResource,s2=t.releaseResource,qB=t.hydrateHoistable,l2=t.mountHoistable,u2=t.unmountHoistable,UB=t.createHoistableInstance,VB=t.prepareToCommitHoistables,jB=t.mayResourceSuspendCommit,c2=t.preloadResource,kB=t.suspendResource,Vn=t.supportsSingletons,d2=t.resolveSingletonInstance,GB=t.acquireSingletonInstance,f2=t.releaseSingletonInstance,h2=t.isHostSingletonType,qu=t.isSingletonScope,Qb=[],Uu=-1,Vu={},ua=Math.clz32?Math.clz32:b,YB=Math.log,XB=Math.LN2,ym=256,vm=262144,bm=4194304,Sm=la.unstable_scheduleCallback,Kb=la.unstable_cancelCallback,QB=la.unstable_shouldYield,KB=la.unstable_requestPaint,ji=la.unstable_now,p2=la.unstable_ImmediatePriority,ZB=la.unstable_UserBlockingPriority,Zb=la.unstable_NormalPriority,WB=la.unstable_IdlePriority,JB=la.log,$B=la.unstable_setDisableYieldValue,of=null,ca=null,da=typeof Object.is=="function"?Object.is:mt,m2=typeof reportError=="function"?reportError:function(o){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var s=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof o=="object"&&o!==null&&typeof o.message=="string"?String(o.message):String(o),error:o});if(!window.dispatchEvent(s))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",o);return}console.error(o)},t6=Object.prototype.hasOwnProperty,Wb,g2,Jb=!1,y2=new WeakMap,ju=[],ku=0,xm=null,sf=0,La=[],Da=0,Jo=null,_r=1,zr="",si=m(null),lf=m(null),$o=m(null),wm=m(null),li=null,sn=null,Te=!1,ts=null,Pa=!1,$b=Error(i(519)),Tm=m(null),bl=null,no=null,e6=typeof AbortController<"u"?AbortController:function(){var o=[],s=this.signal={aborted:!1,addEventListener:function(c,p){o.push(p)}};this.abort=function(){s.aborted=!0,o.forEach(function(c){return c()})}},n6=la.unstable_scheduleCallback,i6=la.unstable_NormalPriority,ln={$$typeof:Zo,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0},Rm=null,Gu=null,tS=!1,Em=!1,eS=!1,Sl=0,uf=null,nS=0,Yu=0,Xu=null,v2=jt.S;jt.S=function(o,s){T2=ji(),typeof s=="object"&&s!==null&&typeof s.then=="function"&&Ct(o,s),v2!==null&&v2(o,s)};var xl=m(null),Qu=Error(i(460)),iS=Error(i(474)),Am=Error(i(542)),Cm={then:function(){}},wl=null,Ku=null,cf=0,Tl=ra(!0),b2=ra(!1),Ba=[],Zu=0,aS=0,es=!1,rS=!1,Wu=m(null),Mm=m(0),fa=m(null),Ha=null,xn=m(0),io=0,se=null,He=null,Mn=null,Om=!1,Ju=!1,Rl=!1,_m=0,df=0,$u=null,a6=0,ff={readContext:_,use:Wp,useCallback:nn,useContext:nn,useEffect:nn,useImperativeHandle:nn,useLayoutEffect:nn,useInsertionEffect:nn,useMemo:nn,useReducer:nn,useRef:nn,useState:nn,useDebugValue:nn,useDeferredValue:nn,useTransition:nn,useSyncExternalStore:nn,useId:nn,useHostTransitionStatus:nn,useFormState:nn,useActionState:nn,useOptimistic:nn,useMemoCache:nn,useCacheRefresh:nn};ff.useEffectEvent=nn;var S2={readContext:_,use:Wp,useCallback:function(o,s){return zi().memoizedState=[o,s===void 0?null:s],o},useContext:_,useEffect:hA,useImperativeHandle:function(o,s,c){c=c!=null?c.concat([o]):null,$p(4194308,4,yA.bind(null,s,o),c)},useLayoutEffect:function(o,s){return $p(4194308,4,o,s)},useInsertionEffect:function(o,s){$p(4,2,o,s)},useMemo:function(o,s){var c=zi();s=s===void 0?null:s;var p=o();if(Rl){X(!0);try{o()}finally{X(!1)}}return c.memoizedState=[p,s],p},useReducer:function(o,s,c){var p=zi();if(c!==void 0){var v=c(s);if(Rl){X(!0);try{c(s)}finally{X(!1)}}}else v=s;return p.memoizedState=p.baseState=v,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:o,lastRenderedState:v},p.queue=o,o=o.dispatch=W4.bind(null,se,o),[p.memoizedState,o]},useRef:function(o){var s=zi();return o={current:o},s.memoizedState=o},useState:function(o){o=tb(o);var s=o.queue,c=AA.bind(null,se,s);return s.dispatch=c,[o.memoizedState,c]},useDebugValue:ib,useDeferredValue:function(o,s){var c=zi();return ab(c,o,s)},useTransition:function(){var o=tb(!1);return o=wA.bind(null,se,o.queue,!0,!1),zi().memoizedState=o,[!1,o]},useSyncExternalStore:function(o,s,c){var p=se,v=zi();if(Te){if(c===void 0)throw Error(i(407));c=c()}else{if(c=s(),je===null)throw Error(i(349));xe&127||WE(p,s,c)}v.memoizedState=c;var x={value:c,getSnapshot:s};return v.queue=x,hA($E.bind(null,p,x,o),[o]),p.flags|=2048,Nu(9,{destroy:void 0},JE.bind(null,p,x,c,s),null),c},useId:function(){var o=zi(),s=je.identifierPrefix;if(Te){var c=zr,p=_r;c=(p&~(1<<32-ua(p)-1)).toString(32)+c,s="_"+s+"R_"+c,c=_m++,0<c&&(s+="H"+c.toString(32)),s+="_"}else c=a6++,s="_"+s+"r_"+c.toString(32)+"_";return o.memoizedState=s},useHostTransitionStatus:rb,useFormState:lA,useActionState:lA,useOptimistic:function(o){var s=zi();s.memoizedState=s.baseState=o;var c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return s.queue=c,s=ob.bind(null,se,!0,c),c.dispatch=s,[o,s]},useMemoCache:W0,useCacheRefresh:function(){return zi().memoizedState=Z4.bind(null,se)},useEffectEvent:function(o){var s=zi(),c={impl:o};return s.memoizedState=c,function(){if(ge&2)throw Error(i(440));return c.impl.apply(void 0,arguments)}}},oS={readContext:_,use:Wp,useCallback:bA,useContext:_,useEffect:nb,useImperativeHandle:vA,useInsertionEffect:mA,useLayoutEffect:gA,useMemo:SA,useReducer:Jp,useRef:fA,useState:function(){return Jp(Kr)},useDebugValue:ib,useDeferredValue:function(o,s){var c=Sn();return xA(c,He.memoizedState,o,s)},useTransition:function(){var o=Jp(Kr)[0],s=Sn().memoizedState;return[typeof o=="boolean"?o:Xd(o),s]},useSyncExternalStore:ZE,useId:RA,useHostTransitionStatus:rb,useFormState:uA,useActionState:uA,useOptimistic:function(o,s){var c=Sn();return nA(c,He,o,s)},useMemoCache:W0,useCacheRefresh:EA};oS.useEffectEvent=pA;var x2={readContext:_,use:Wp,useCallback:bA,useContext:_,useEffect:nb,useImperativeHandle:vA,useInsertionEffect:mA,useLayoutEffect:gA,useMemo:SA,useReducer:$0,useRef:fA,useState:function(){return $0(Kr)},useDebugValue:ib,useDeferredValue:function(o,s){var c=Sn();return He===null?ab(c,o,s):xA(c,He.memoizedState,o,s)},useTransition:function(){var o=$0(Kr)[0],s=Sn().memoizedState;return[typeof o=="boolean"?o:Xd(o),s]},useSyncExternalStore:ZE,useId:RA,useHostTransitionStatus:rb,useFormState:dA,useActionState:dA,useOptimistic:function(o,s){var c=Sn();return He!==null?nA(c,He,o,s):(c.baseState=o,[o,c.queue.dispatch])},useMemoCache:W0,useCacheRefresh:EA};x2.useEffectEvent=pA;var sS={enqueueSetState:function(o,s,c){o=o._reactInternals;var p=sa(),v=pt(p);v.payload=s,c!=null&&(v.callback=c),s=vt(o,v,p),s!==null&&(Vi(s,o,p),$t(s,o,p))},enqueueReplaceState:function(o,s,c){o=o._reactInternals;var p=sa(),v=pt(p);v.tag=1,v.payload=s,c!=null&&(v.callback=c),s=vt(o,v,p),s!==null&&(Vi(s,o,p),$t(s,o,p))},enqueueForceUpdate:function(o,s){o=o._reactInternals;var c=sa(),p=pt(c);p.tag=2,s!=null&&(p.callback=s),s=vt(o,p,c),s!==null&&(Vi(s,o,c),$t(s,o,c))}},lS=Error(i(461)),On=!1,uS={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null},ao=!1,_n=!1,cS=!1,w2=typeof WeakSet=="function"?WeakSet:Set,Wn=null,zn=null,ki=!1,sr=null,tc=8192,r6={getCacheForType:function(o){var s=_(ln),c=s.data.get(o);return c===void 0&&(c=o(),s.data.set(o,c)),c},cacheSignal:function(){return _(ln).controller.signal}},zm=0,Im=1,Nm=2,Lm=3,Dm=4;if(typeof Symbol=="function"&&Symbol.for){var hf=Symbol.for;zm=hf("selector.component"),Im=hf("selector.has_pseudo_class"),Nm=hf("selector.role"),Lm=hf("selector.test_id"),Dm=hf("selector.text")}var o6=typeof WeakMap=="function"?WeakMap:Map,ge=0,je=null,ye=null,xe=0,De=0,ha=null,ns=!1,ec=!1,dS=!1,ro=0,pn=0,is=0,El=0,fS=0,pa=0,nc=0,pf=null,Gi=null,hS=!1,Pm=0,T2=0,mf=1/0,Bm=null,as=null,jn=0,rs=null,ic=null,oo=0,pS=0,mS=null,R2=null,gf=0,gS=null;return me.attemptContinuousHydration=function(o){if(o.tag===13||o.tag===31){var s=q(o,67108864);s!==null&&Vi(s,o,67108864),Db(o,67108864)}},me.attemptHydrationAtCurrentPriority=function(o){if(o.tag===13||o.tag===31){var s=sa();s=V(s);var c=q(o,s);c!==null&&Vi(c,o,s),Db(o,s)}},me.attemptSynchronousHydration=function(o){switch(o.tag){case 3:if(o=o.stateNode,o.current.memoizedState.isDehydrated){var s=w(o.pendingLanes);if(s!==0){for(o.pendingLanes|=2,o.entangledLanes|=2;s;){var c=1<<31-ua(s);o.entanglements[1]|=c,s&=~c}P(o),!(ge&6)&&(mf=ji()+500,Z(0,!1))}}break;case 31:case 13:s=q(o,2),s!==null&&Vi(s,o,2),bC(),Db(o,2)}},me.batchedUpdates=function(o,s){return o(s)},me.createComponentSelector=function(o){return{$$typeof:zm,value:o}},me.createContainer=function(o,s,c,p,v,x,O,D,$,ut){return BC(o,s,!1,null,c,p,x,null,O,D,$,ut)},me.createHasPseudoClassSelector=function(o){return{$$typeof:Im,value:o}},me.createHydrationContainer=function(o,s,c,p,v,x,O,D,$,ut,Et,bt,_t,oe){return o=BC(c,p,!0,o,v,x,D,oe,$,ut,Et,bt),o.context=HC(null),c=o.current,p=sa(),p=V(p),v=pt(p),v.callback=s??null,vt(c,v,p),s=p,o.current.lanes=s,M(o,s),P(o),o},me.createPortal=function(o,s,c){var p=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Bu,key:p==null?null:""+p,children:o,containerInfo:s,implementation:c}},me.createRoleSelector=function(o){return{$$typeof:Nm,value:o}},me.createTestNameSelector=function(o){return{$$typeof:Lm,value:o}},me.createTextSelector=function(o){return{$$typeof:Dm,value:o}},me.defaultOnCaughtError=function(o){console.error(o)},me.defaultOnRecoverableError=function(o){m2(o)},me.defaultOnUncaughtError=function(o){m2(o)},me.deferredUpdates=function(o){var s=jt.T,c=eo();try{return Zn(32),jt.T=null,o()}finally{Zn(c),jt.T=s}},me.discreteUpdates=function(o,s,c,p,v){var x=jt.T,O=eo();try{return Zn(2),jt.T=null,o(s,c,p,v)}finally{Zn(O),jt.T=x,ge===0&&(mf=ji()+500)}},me.findAllNodes=Mb,me.findBoundingRects=function(o,s){if(!af)throw Error(i(363));s=Mb(o,s),o=[];for(var c=0;c<s.length;c++)o.push(U5(s[c]));for(s=o.length-1;0<s;s--){c=o[s];for(var p=c.x,v=p+c.width,x=c.y,O=x+c.height,D=s-1;0<=D;D--)if(s!==D){var $=o[D],ut=$.x,Et=ut+$.width,bt=$.y,_t=bt+$.height;if(p>=ut&&x>=bt&&v<=Et&&O<=_t){o.splice(s,1);break}else if(p!==ut||c.width!==$.width||_t<x||bt>O){if(!(x!==bt||c.height!==$.height||Et<p||ut>v)){ut>p&&($.width+=ut-p,$.x=p),Et<v&&($.width=v-ut),o.splice(s,1);break}}else{bt>x&&($.height+=bt-x,$.y=x),_t<O&&($.height=O-bt),o.splice(s,1);break}}}return o},me.findHostInstance=FC,me.findHostInstanceWithNoPortals=function(o){return o=l(o),o=o!==null?f(o):null,o===null?null:nf(o.stateNode)},me.findHostInstanceWithWarning=function(o){return FC(o)},me.flushPassiveEffects=ef,me.flushSyncFromReconciler=function(o){var s=ge;ge|=1;var c=jt.T,p=eo();try{if(Zn(2),jt.T=null,o)return o()}finally{Zn(p),jt.T=c,ge=s,!(ge&6)&&Z(0,!1)}},me.flushSyncWork=bC,me.focusWithin=function(o,s){if(!af)throw Error(i(363));for(o=Eb(o),s=mC(o,s),s=Array.from(s),o=0;o<s.length;){var c=s[o++],p=c.tag;if(!rf(c)){if((p===5||p===26||p===27)&&k5(c.stateNode))return!0;for(c=c.child;c!==null;)s.push(c),c=c.sibling}}return!1},me.getFindAllNodesFailureDescription=function(o,s){if(!af)throw Error(i(363));var c=0,p=[];o=[Eb(o),0];for(var v=0;v<o.length;){var x=o[v++],O=x.tag,D=o[v++],$=s[D];if((O!==5&&O!==26&&O!==27||!rf(x))&&(Ab(x,$)&&(p.push(Cb($)),D++,D>c&&(c=D)),D<s.length))for(x=x.child;x!==null;)o.push(x,D),x=x.sibling}if(c<s.length){for(o=[];c<s.length;c++)o.push(Cb(s[c]));return`findAllNodes was able to match part of the selector:
|
|
9
|
+
`+(p.join(" > ")+`
|
|
10
10
|
|
|
11
11
|
No matching component was found for:
|
|
12
|
-
`)+
|
|
12
|
+
`)+o.join(" > ")}return null},me.getPublicRootInstance=function(o){if(o=o.current,!o.child)return null;switch(o.child.tag){case 27:case 5:return nf(o.child.stateNode);default:return o.child.stateNode}},me.injectIntoDevTools=function(){var o={bundleType:0,version:b5,rendererPackageName:S5,currentDispatcherRef:jt,reconcilerVersion:"19.2.0"};if(GC!==null&&(o.rendererConfig=GC),typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")o=!1;else{var s=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(s.isDisabled||!s.supportsFiber)o=!0;else{try{of=s.inject(o),ca=s}catch{}o=!!s.checkDCE}}return o},me.isAlreadyRendering=function(){return(ge&6)!==0},me.observeVisibleRects=function(o,s,c,p){if(!af)throw Error(i(363));o=Mb(o,s);var v=G5(o,c,p).disconnect;return{disconnect:function(){v()}}},me.shouldError=function(){return null},me.shouldSuspend=function(){return!1},me.startHostTransition=function(o,s,c,p){if(o.tag!==5)throw Error(i(476));var v=TA(o).queue;wA(o,v,s,Fu,c===null?n:function(){var x=TA(o);return x.next===null&&(x=o.alternate.memoizedState),Qd(o,x.next.queue,{},sa()),c(p)})},me.updateContainer=function(o,s,c,p){var v=s.current,x=sa();return qC(v,x,o,s,c,p),x},me.updateContainerSync=function(o,s,c,p){return qC(s.current,2,o,s,c,p),2},me};Vf.exports.default=Vf.exports;Object.defineProperty(Vf.exports,"__esModule",{value:!0})});var M_=Ni((AQ,C_)=>{"use strict";C_.exports=A_()});var kl=Ni((CQ,O_)=>{"use strict";O_.exports=ReactDOM});var UL=Ni(dv=>{"use strict";var Yn=px(),eI=ct(),Bq=kl();function ot(t){var e="https://react.dev/errors/"+t;if(1<arguments.length){e+="?args[]="+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)e+="&args[]="+encodeURIComponent(arguments[n])}return"Minified React error #"+t+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function nI(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function Mh(t){var e=t,n=t;if(t.alternate)for(;e.return;)e=e.return;else{t=e;do e=t,e.flags&4098&&(n=e.return),t=e.return;while(t)}return e.tag===3?n:null}function iI(t){if(t.tag===13){var e=t.memoizedState;if(e===null&&(t=t.alternate,t!==null&&(e=t.memoizedState)),e!==null)return e.dehydrated}return null}function aI(t){if(t.tag===31){var e=t.memoizedState;if(e===null&&(t=t.alternate,t!==null&&(e=t.memoizedState)),e!==null)return e.dehydrated}return null}function __(t){if(Mh(t)!==t)throw Error(ot(188))}function Hq(t){var e=t.alternate;if(!e){if(e=Mh(t),e===null)throw Error(ot(188));return e!==t?null:t}for(var n=t,i=e;;){var a=n.return;if(a===null)break;var r=a.alternate;if(r===null){if(i=a.return,i!==null){n=i;continue}break}if(a.child===r.child){for(r=a.child;r;){if(r===n)return __(a),t;if(r===i)return __(a),e;r=r.sibling}throw Error(ot(188))}if(n.return!==i.return)n=a,i=r;else{for(var l=!1,u=a.child;u;){if(u===n){l=!0,n=a,i=r;break}if(u===i){l=!0,i=a,n=r;break}u=u.sibling}if(!l){for(u=r.child;u;){if(u===n){l=!0,n=r,i=a;break}if(u===i){l=!0,i=r,n=a;break}u=u.sibling}if(!l)throw Error(ot(189))}}if(n.alternate!==i)throw Error(ot(190))}if(n.tag!==3)throw Error(ot(188));return n.stateNode.current===n?t:e}function rI(t){var e=t.tag;if(e===5||e===26||e===27||e===6)return t;for(t=t.child;t!==null;){if(e=rI(t),e!==null)return e;t=t.sibling}return null}var Je=Object.assign,Fq=Symbol.for("react.element"),Ug=Symbol.for("react.transitional.element"),Zf=Symbol.for("react.portal"),Bc=Symbol.for("react.fragment"),oI=Symbol.for("react.strict_mode"),Qx=Symbol.for("react.profiler"),sI=Symbol.for("react.consumer"),To=Symbol.for("react.context"),jw=Symbol.for("react.forward_ref"),Kx=Symbol.for("react.suspense"),Zx=Symbol.for("react.suspense_list"),kw=Symbol.for("react.memo"),vs=Symbol.for("react.lazy");Symbol.for("react.scope");var Wx=Symbol.for("react.activity");Symbol.for("react.legacy_hidden");Symbol.for("react.tracing_marker");var qq=Symbol.for("react.memo_cache_sentinel");Symbol.for("react.view_transition");var z_=Symbol.iterator;function jf(t){return t===null||typeof t!="object"?null:(t=z_&&t[z_]||t["@@iterator"],typeof t=="function"?t:null)}var Uq=Symbol.for("react.client.reference");function Jx(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===Uq?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case Bc:return"Fragment";case Qx:return"Profiler";case oI:return"StrictMode";case Kx:return"Suspense";case Zx:return"SuspenseList";case Wx:return"Activity"}if(typeof t=="object")switch(t.$$typeof){case Zf:return"Portal";case To:return t.displayName||"Context";case sI:return(t._context.displayName||"Context")+".Consumer";case jw:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case kw:return e=t.displayName||null,e!==null?e:Jx(t.type)||"Memo";case vs:e=t._payload,t=t._init;try{return Jx(t(e))}catch{}}return null}var Wf=Array.isArray,Qt=eI.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Ne=Bq.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Zl={pending:!1,data:null,method:null,action:null},$x=[],Hc=-1;function Fr(t){return{current:t}}function ei(t){0>Hc||(t.current=$x[Hc],$x[Hc]=null,Hc--)}function Qe(t,e){Hc++,$x[Hc]=t.current,t.current=e}var Hr=Fr(null),ph=Fr(null),Os=Fr(null),Sy=Fr(null);function xy(t,e){switch(Qe(Os,e),Qe(ph,t),Qe(Hr,null),e.nodeType){case 9:case 11:t=(t=e.documentElement)&&(t=t.namespaceURI)?Hz(t):0;break;default:if(t=e.tagName,e=e.namespaceURI)e=Hz(e),t=CL(e,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}ei(Hr),Qe(Hr,t)}function nd(){ei(Hr),ei(ph),ei(Os)}function tw(t){t.memoizedState!==null&&Qe(Sy,t);var e=Hr.current,n=CL(e,t.type);e!==n&&(Qe(ph,t),Qe(Hr,n))}function wy(t){ph.current===t&&(ei(Hr),ei(ph)),Sy.current===t&&(ei(Sy),Eh._currentValue=Zl)}var mx,I_;function Yl(t){if(mx===void 0)try{throw Error()}catch(n){var e=n.stack.trim().match(/\n( *(at )?)/);mx=e&&e[1]||"",I_=-1<n.stack.indexOf(`
|
|
13
13
|
at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
14
|
-
`+
|
|
15
|
-
`),
|
|
16
|
-
`);for(a=i=0;i<
|
|
17
|
-
`+
|
|
14
|
+
`+mx+t+I_}var gx=!1;function yx(t,e){if(!t||gx)return"";gx=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var i={DetermineComponentFrameRoot:function(){try{if(e){var m=function(){throw Error()};if(Object.defineProperty(m.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(m,[])}catch(g){var y=g}Reflect.construct(t,[],m)}else{try{m.call()}catch(g){y=g}t.call(m.prototype)}}else{try{throw Error()}catch(g){y=g}(m=t())&&typeof m.catch=="function"&&m.catch(function(){})}}catch(g){if(g&&y&&typeof g.stack=="string")return[g.stack,y.stack]}return[null,null]}};i.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var a=Object.getOwnPropertyDescriptor(i.DetermineComponentFrameRoot,"name");a&&a.configurable&&Object.defineProperty(i.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var r=i.DetermineComponentFrameRoot(),l=r[0],u=r[1];if(l&&u){var f=l.split(`
|
|
15
|
+
`),h=u.split(`
|
|
16
|
+
`);for(a=i=0;i<f.length&&!f[i].includes("DetermineComponentFrameRoot");)i++;for(;a<h.length&&!h[a].includes("DetermineComponentFrameRoot");)a++;if(i===f.length||a===h.length)for(i=f.length-1,a=h.length-1;1<=i&&0<=a&&f[i]!==h[a];)a--;for(;1<=i&&0<=a;i--,a--)if(f[i]!==h[a]){if(i!==1||a!==1)do if(i--,a--,0>a||f[i]!==h[a]){var d=`
|
|
17
|
+
`+f[i].replace(" at new "," at ");return t.displayName&&d.includes("<anonymous>")&&(d=d.replace("<anonymous>",t.displayName)),d}while(1<=i&&0<=a);break}}}finally{gx=!1,Error.prepareStackTrace=n}return(n=t?t.displayName||t.name:"")?Yl(n):""}function Vq(t,e){switch(t.tag){case 26:case 27:case 5:return Yl(t.type);case 16:return Yl("Lazy");case 13:return t.child!==e&&e!==null?Yl("Suspense Fallback"):Yl("Suspense");case 19:return Yl("SuspenseList");case 0:case 15:return yx(t.type,!1);case 11:return yx(t.type.render,!1);case 1:return yx(t.type,!0);case 31:return Yl("Activity");default:return""}}function N_(t){try{var e="",n=null;do e+=Vq(t,n),n=t,t=t.return;while(t);return e}catch(i){return`
|
|
18
18
|
Error generating stack: `+i.message+`
|
|
19
|
-
`+i.stack}}var Nx=Object.prototype.hasOwnProperty,EE=Cn.unstable_scheduleCallback,K1=Cn.unstable_cancelCallback,NU=Cn.unstable_shouldYield,IU=Cn.unstable_requestPaint,Ji=Cn.unstable_now,DU=Cn.unstable_getCurrentPriorityLevel,Dz=Cn.unstable_ImmediatePriority,Lz=Cn.unstable_UserBlockingPriority,Xg=Cn.unstable_NormalPriority,LU=Cn.unstable_LowPriority,Bz=Cn.unstable_IdlePriority,BU=Cn.log,PU=Cn.unstable_setDisableYieldValue,th=null,$i=null;function Zr(t){if(typeof BU=="function"&&PU(t),$i&&typeof $i.setStrictMode=="function")try{$i.setStrictMode(th,t)}catch{}}var ta=Math.clz32?Math.clz32:VU,HU=Math.log,UU=Math.LN2;function VU(t){return t>>>=0,t===0?32:31-(HU(t)/UU|0)|0}var hg=256,pg=262144,mg=4194304;function vs(t){var e=t&42;if(e!==0)return e;switch(t&-t){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:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return t&261888;case 262144:case 524288:case 1048576:case 2097152:return t&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function by(t,e,n){var i=t.pendingLanes;if(i===0)return 0;var a=0,o=t.suspendedLanes,s=t.pingedLanes;t=t.warmLanes;var u=i&134217727;return u!==0?(i=u&~o,i!==0?a=vs(i):(s&=u,s!==0?a=vs(s):n||(n=u&~t,n!==0&&(a=vs(n))))):(u=i&~o,u!==0?a=vs(u):s!==0?a=vs(s):n||(n=i&~t,n!==0&&(a=vs(n)))),a===0?0:e!==0&&e!==a&&!(e&o)&&(o=a&-a,n=e&-e,o>=n||o===32&&(n&4194048)!==0)?e:a}function eh(t,e){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&e)===0}function jU(t,e){switch(t){case 1:case 2:case 4:case 8:case 64:return e+250;case 16:case 32: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 e+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Pz(){var t=mg;return mg<<=1,!(mg&62914560)&&(mg=4194304),t}function Z1(t){for(var e=[],n=0;31>n;n++)e.push(t);return e}function nh(t,e){t.pendingLanes|=e,e!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function qU(t,e,n,i,a,o){var s=t.pendingLanes;t.pendingLanes=n,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=n,t.entangledLanes&=n,t.errorRecoveryDisabledLanes&=n,t.shellSuspendCounter=0;var u=t.entanglements,d=t.expirationTimes,p=t.hiddenUpdates;for(n=s&~n;0<n;){var f=31-ta(n),m=1<<f;u[f]=0,d[f]=-1;var g=p[f];if(g!==null)for(p[f]=null,f=0;f<g.length;f++){var v=g[f];v!==null&&(v.lane&=-536870913)}n&=~m}i!==0&&Hz(t,i,0),o!==0&&a===0&&t.tag!==0&&(t.suspendedLanes|=o&~(s&~e))}function Hz(t,e,n){t.pendingLanes|=e,t.suspendedLanes&=~e;var i=31-ta(e);t.entangledLanes|=e,t.entanglements[i]=t.entanglements[i]|1073741824|n&261930}function Uz(t,e){var n=t.entangledLanes|=e;for(t=t.entanglements;n;){var i=31-ta(n),a=1<<i;a&e|t[i]&e&&(t[i]|=e),n&=~a}}function Vz(t,e){var n=e&-e;return n=n&42?1:AE(n),n&(t.suspendedLanes|e)?0:n}function AE(t){switch(t){case 2:t=1;break;case 8:t=4;break;case 32:t=16;break;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:t=128;break;case 268435456:t=134217728;break;default:t=0}return t}function RE(t){return t&=-t,2<t?8<t?t&134217727?32:268435456:8:2}function jz(){var t=ue.p;return t!==0?t:(t=window.event,t===void 0?32:cI(t.type))}function r_(t,e){var n=ue.p;try{return ue.p=t,e()}finally{ue.p=n}}var pl=Math.random().toString(36).slice(2),Gn="__reactFiber$"+pl,Mi="__reactProps$"+pl,Bc="__reactContainer$"+pl,Ix="__reactEvents$"+pl,FU="__reactListeners$"+pl,GU="__reactHandles$"+pl,l_="__reactResources$"+pl,ih="__reactMarker$"+pl;function TE(t){delete t[Gn],delete t[Mi],delete t[Ix],delete t[FU],delete t[GU]}function sc(t){var e=t[Gn];if(e)return e;for(var n=t.parentNode;n;){if(e=n[Bc]||n[Gn]){if(n=e.alternate,e.child!==null||n!==null&&n.child!==null)for(t=mz(t);t!==null;){if(n=t[Gn])return n;t=mz(t)}return e}t=n,n=t.parentNode}return null}function Pc(t){if(t=t[Gn]||t[Bc]){var e=t.tag;if(e===5||e===6||e===13||e===31||e===26||e===27||e===3)return t}return null}function Ad(t){var e=t.tag;if(e===5||e===26||e===27||e===6)return t.stateNode;throw Error(W(33))}function vc(t){var e=t[l_];return e||(e=t[l_]={hoistableStyles:new Map,hoistableScripts:new Map}),e}function In(t){t[ih]=!0}var qz=new Set,Fz={};function zs(t,e){Cc(t,e),Cc(t+"Capture",e)}function Cc(t,e){for(Fz[t]=e,t=0;t<e.length;t++)qz.add(e[t])}var kU=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),s_={},u_={};function YU(t){return Nx.call(u_,t)?!0:Nx.call(s_,t)?!1:kU.test(t)?u_[t]=!0:(s_[t]=!0,!1)}function _g(t,e,n){if(YU(e))if(n===null)t.removeAttribute(e);else{switch(typeof n){case"undefined":case"function":case"symbol":t.removeAttribute(e);return;case"boolean":var i=e.toLowerCase().slice(0,5);if(i!=="data-"&&i!=="aria-"){t.removeAttribute(e);return}}t.setAttribute(e,""+n)}}function gg(t,e,n){if(n===null)t.removeAttribute(e);else{switch(typeof n){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(e);return}t.setAttribute(e,""+n)}}function Ho(t,e,n,i){if(i===null)t.removeAttribute(n);else{switch(typeof i){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(n);return}t.setAttributeNS(e,n,""+i)}}function Sa(t){switch(typeof t){case"bigint":case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function Gz(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function QU(t,e,n){var i=Object.getOwnPropertyDescriptor(t.constructor.prototype,e);if(!t.hasOwnProperty(e)&&typeof i<"u"&&typeof i.get=="function"&&typeof i.set=="function"){var a=i.get,o=i.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return a.call(this)},set:function(s){n=""+s,o.call(this,s)}}),Object.defineProperty(t,e,{enumerable:i.enumerable}),{getValue:function(){return n},setValue:function(s){n=""+s},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function Dx(t){if(!t._valueTracker){var e=Gz(t)?"checked":"value";t._valueTracker=QU(t,e,""+t[e])}}function kz(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),i="";return t&&(i=Gz(t)?t.checked?"true":"false":t.value),t=i,t!==n?(e.setValue(t),!0):!1}function Kg(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}var XU=/[\n"\\]/g;function Ea(t){return t.replace(XU,function(e){return"\\"+e.charCodeAt(0).toString(16)+" "})}function Lx(t,e,n,i,a,o,s,u){t.name="",s!=null&&typeof s!="function"&&typeof s!="symbol"&&typeof s!="boolean"?t.type=s:t.removeAttribute("type"),e!=null?s==="number"?(e===0&&t.value===""||t.value!=e)&&(t.value=""+Sa(e)):t.value!==""+Sa(e)&&(t.value=""+Sa(e)):s!=="submit"&&s!=="reset"||t.removeAttribute("value"),e!=null?Bx(t,s,Sa(e)):n!=null?Bx(t,s,Sa(n)):i!=null&&t.removeAttribute("value"),a==null&&o!=null&&(t.defaultChecked=!!o),a!=null&&(t.checked=a&&typeof a!="function"&&typeof a!="symbol"),u!=null&&typeof u!="function"&&typeof u!="symbol"&&typeof u!="boolean"?t.name=""+Sa(u):t.removeAttribute("name")}function Yz(t,e,n,i,a,o,s,u){if(o!=null&&typeof o!="function"&&typeof o!="symbol"&&typeof o!="boolean"&&(t.type=o),e!=null||n!=null){if(!(o!=="submit"&&o!=="reset"||e!=null)){Dx(t);return}n=n!=null?""+Sa(n):"",e=e!=null?""+Sa(e):n,u||e===t.value||(t.value=e),t.defaultValue=e}i=i??a,i=typeof i!="function"&&typeof i!="symbol"&&!!i,t.checked=u?t.checked:!!i,t.defaultChecked=!!i,s!=null&&typeof s!="function"&&typeof s!="symbol"&&typeof s!="boolean"&&(t.name=s),Dx(t)}function Bx(t,e,n){e==="number"&&Kg(t.ownerDocument)===t||t.defaultValue===""+n||(t.defaultValue=""+n)}function Sc(t,e,n,i){if(t=t.options,e){e={};for(var a=0;a<n.length;a++)e["$"+n[a]]=!0;for(n=0;n<t.length;n++)a=e.hasOwnProperty("$"+t[n].value),t[n].selected!==a&&(t[n].selected=a),a&&i&&(t[n].defaultSelected=!0)}else{for(n=""+Sa(n),e=null,a=0;a<t.length;a++){if(t[a].value===n){t[a].selected=!0,i&&(t[a].defaultSelected=!0);return}e!==null||t[a].disabled||(e=t[a])}e!==null&&(e.selected=!0)}}function Qz(t,e,n){if(e!=null&&(e=""+Sa(e),e!==t.value&&(t.value=e),n==null)){t.defaultValue!==e&&(t.defaultValue=e);return}t.defaultValue=n!=null?""+Sa(n):""}function Xz(t,e,n,i){if(e==null){if(i!=null){if(n!=null)throw Error(W(92));if(Ed(i)){if(1<i.length)throw Error(W(93));i=i[0]}n=i}n==null&&(n=""),e=n}n=Sa(e),t.defaultValue=n,i=t.textContent,i===n&&i!==""&&i!==null&&(t.value=i),Dx(t)}function wc(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var KU=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function c_(t,e,n){var i=e.indexOf("--")===0;n==null||typeof n=="boolean"||n===""?i?t.setProperty(e,""):e==="float"?t.cssFloat="":t[e]="":i?t.setProperty(e,n):typeof n!="number"||n===0||KU.has(e)?e==="float"?t.cssFloat=n:t[e]=(""+n).trim():t[e]=n+"px"}function Kz(t,e,n){if(e!=null&&typeof e!="object")throw Error(W(62));if(t=t.style,n!=null){for(var i in n)!n.hasOwnProperty(i)||e!=null&&e.hasOwnProperty(i)||(i.indexOf("--")===0?t.setProperty(i,""):i==="float"?t.cssFloat="":t[i]="");for(var a in e)i=e[a],e.hasOwnProperty(a)&&n[a]!==i&&c_(t,a,i)}else for(var o in e)e.hasOwnProperty(o)&&c_(t,o,e[o])}function CE(t){if(t.indexOf("-")===-1)return!1;switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var ZU=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),WU=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function zg(t){return WU.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}function Yo(){}var Px=null;function wE(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var uc=null,bc=null;function f_(t){var e=Pc(t);if(e&&(t=e.stateNode)){var n=t[Mi]||null;t:switch(t=e.stateNode,e.type){case"input":if(Lx(t,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),e=n.name,n.type==="radio"&&e!=null){for(n=t;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll('input[name="'+Ea(""+e)+'"][type="radio"]'),e=0;e<n.length;e++){var i=n[e];if(i!==t&&i.form===t.form){var a=i[Mi]||null;if(!a)throw Error(W(90));Lx(i,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name)}}for(e=0;e<n.length;e++)i=n[e],i.form===t.form&&kz(i)}break t;case"textarea":Qz(t,n.value,n.defaultValue);break t;case"select":e=n.value,e!=null&&Sc(t,!!n.multiple,e,!1)}}}var W1=!1;function Zz(t,e,n){if(W1)return t(e,n);W1=!0;try{var i=t(e);return i}finally{if(W1=!1,(uc!==null||bc!==null)&&(Ny(),uc&&(e=uc,t=bc,bc=uc=null,f_(e),t)))for(e=0;e<t.length;e++)f_(t[e])}}function Vd(t,e){var n=t.stateNode;if(n===null)return null;var i=n[Mi]||null;if(i===null)return null;n=i[e];t:switch(e){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(i=!i.disabled)||(t=t.type,i=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!i;break t;default:t=!1}if(t)return null;if(n&&typeof n!="function")throw Error(W(231,e,typeof n));return n}var Wo=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Hx=!1;if(Wo)try{ec={},Object.defineProperty(ec,"passive",{get:function(){Hx=!0}}),window.addEventListener("test",ec,ec),window.removeEventListener("test",ec,ec)}catch{Hx=!1}var ec,Wr=null,ME=null,Ng=null;function Wz(){if(Ng)return Ng;var t,e=ME,n=e.length,i,a="value"in Wr?Wr.value:Wr.textContent,o=a.length;for(t=0;t<n&&e[t]===a[t];t++);var s=n-t;for(i=1;i<=s&&e[n-i]===a[o-i];i++);return Ng=a.slice(t,1<i?1-i:void 0)}function Ig(t){var e=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&e===13&&(t=13)):t=e,t===10&&(t=13),32<=t||t===13?t:0}function yg(){return!0}function d_(){return!1}function Oi(t){function e(n,i,a,o,s){this._reactName=n,this._targetInst=a,this.type=i,this.nativeEvent=o,this.target=s,this.currentTarget=null;for(var u in t)t.hasOwnProperty(u)&&(n=t[u],this[u]=n?n(o):o[u]);return this.isDefaultPrevented=(o.defaultPrevented!=null?o.defaultPrevented:o.returnValue===!1)?yg:d_,this.isPropagationStopped=d_,this}return Ne(e.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=yg)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=yg)},persist:function(){},isPersistent:yg}),e}var Ns={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},xy=Oi(Ns),ah=Ne({},Ns,{view:0,detail:0}),JU=Oi(ah),J1,$1,md,Ey=Ne({},ah,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:OE,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==md&&(md&&t.type==="mousemove"?(J1=t.screenX-md.screenX,$1=t.screenY-md.screenY):$1=J1=0,md=t),J1)},movementY:function(t){return"movementY"in t?t.movementY:$1}}),h_=Oi(Ey),$U=Ne({},Ey,{dataTransfer:0}),tV=Oi($U),eV=Ne({},ah,{relatedTarget:0}),tx=Oi(eV),nV=Ne({},Ns,{animationName:0,elapsedTime:0,pseudoElement:0}),iV=Oi(nV),aV=Ne({},Ns,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),oV=Oi(aV),rV=Ne({},Ns,{data:0}),p_=Oi(rV),lV={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},sV={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},uV={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function cV(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):(t=uV[t])?!!e[t]:!1}function OE(){return cV}var fV=Ne({},ah,{key:function(t){if(t.key){var e=lV[t.key]||t.key;if(e!=="Unidentified")return e}return t.type==="keypress"?(t=Ig(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?sV[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:OE,charCode:function(t){return t.type==="keypress"?Ig(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?Ig(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),dV=Oi(fV),hV=Ne({},Ey,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),m_=Oi(hV),pV=Ne({},ah,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:OE}),mV=Oi(pV),gV=Ne({},Ns,{propertyName:0,elapsedTime:0,pseudoElement:0}),yV=Oi(gV),vV=Ne({},Ey,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),SV=Oi(vV),bV=Ne({},Ns,{newState:0,oldState:0}),xV=Oi(bV),EV=[9,13,27,32],_E=Wo&&"CompositionEvent"in window,Cd=null;Wo&&"documentMode"in document&&(Cd=document.documentMode);var AV=Wo&&"TextEvent"in window&&!Cd,Jz=Wo&&(!_E||Cd&&8<Cd&&11>=Cd),g_=" ",y_=!1;function $z(t,e){switch(t){case"keyup":return EV.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function tN(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var cc=!1;function RV(t,e){switch(t){case"compositionend":return tN(e);case"keypress":return e.which!==32?null:(y_=!0,g_);case"textInput":return t=e.data,t===g_&&y_?null:t;default:return null}}function TV(t,e){if(cc)return t==="compositionend"||!_E&&$z(t,e)?(t=Wz(),Ng=ME=Wr=null,cc=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1<e.char.length)return e.char;if(e.which)return String.fromCharCode(e.which)}return null;case"compositionend":return Jz&&e.locale!=="ko"?null:e.data;default:return null}}var CV={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function v_(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e==="input"?!!CV[t.type]:e==="textarea"}function eN(t,e,n,i){uc?bc?bc.push(i):bc=[i]:uc=i,e=hy(e,"onChange"),0<e.length&&(n=new xy("onChange","change",null,n,i),t.push({event:n,listeners:e}))}var wd=null,jd=null;function wV(t){Z3(t,0)}function Ay(t){var e=Ad(t);if(kz(e))return t}function S_(t,e){if(t==="change")return e}var nN=!1;Wo&&(Wo?(Sg="oninput"in document,Sg||(ex=document.createElement("div"),ex.setAttribute("oninput","return;"),Sg=typeof ex.oninput=="function"),vg=Sg):vg=!1,nN=vg&&(!document.documentMode||9<document.documentMode));var vg,Sg,ex;function b_(){wd&&(wd.detachEvent("onpropertychange",iN),jd=wd=null)}function iN(t){if(t.propertyName==="value"&&Ay(jd)){var e=[];eN(e,jd,t,wE(t)),Zz(wV,e)}}function MV(t,e,n){t==="focusin"?(b_(),wd=e,jd=n,wd.attachEvent("onpropertychange",iN)):t==="focusout"&&b_()}function OV(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return Ay(jd)}function _V(t,e){if(t==="click")return Ay(e)}function zV(t,e){if(t==="input"||t==="change")return Ay(e)}function NV(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var na=typeof Object.is=="function"?Object.is:NV;function qd(t,e){if(na(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;var n=Object.keys(t),i=Object.keys(e);if(n.length!==i.length)return!1;for(i=0;i<n.length;i++){var a=n[i];if(!Nx.call(e,a)||!na(t[a],e[a]))return!1}return!0}function x_(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function E_(t,e){var n=x_(t);t=0;for(var i;n;){if(n.nodeType===3){if(i=t+n.textContent.length,t<=e&&i>=e)return{node:n,offset:e-t};t=i}t:{for(;n;){if(n.nextSibling){n=n.nextSibling;break t}n=n.parentNode}n=void 0}n=x_(n)}}function aN(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?aN(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function oN(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var e=Kg(t.document);e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=Kg(t.document)}return e}function zE(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}var IV=Wo&&"documentMode"in document&&11>=document.documentMode,fc=null,Ux=null,Md=null,Vx=!1;function A_(t,e,n){var i=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Vx||fc==null||fc!==Kg(i)||(i=fc,"selectionStart"in i&&zE(i)?i={start:i.selectionStart,end:i.selectionEnd}:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection(),i={anchorNode:i.anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset}),Md&&qd(Md,i)||(Md=i,i=hy(Ux,"onSelect"),0<i.length&&(e=new xy("onSelect","select",null,e,n),t.push({event:e,listeners:i}),e.target=fc)))}function gs(t,e){var n={};return n[t.toLowerCase()]=e.toLowerCase(),n["Webkit"+t]="webkit"+e,n["Moz"+t]="moz"+e,n}var dc={animationend:gs("Animation","AnimationEnd"),animationiteration:gs("Animation","AnimationIteration"),animationstart:gs("Animation","AnimationStart"),transitionrun:gs("Transition","TransitionRun"),transitionstart:gs("Transition","TransitionStart"),transitioncancel:gs("Transition","TransitionCancel"),transitionend:gs("Transition","TransitionEnd")},nx={},rN={};Wo&&(rN=document.createElement("div").style,"AnimationEvent"in window||(delete dc.animationend.animation,delete dc.animationiteration.animation,delete dc.animationstart.animation),"TransitionEvent"in window||delete dc.transitionend.transition);function Is(t){if(nx[t])return nx[t];if(!dc[t])return t;var e=dc[t],n;for(n in e)if(e.hasOwnProperty(n)&&n in rN)return nx[t]=e[n];return t}var lN=Is("animationend"),sN=Is("animationiteration"),uN=Is("animationstart"),DV=Is("transitionrun"),LV=Is("transitionstart"),BV=Is("transitioncancel"),cN=Is("transitionend"),fN=new Map,jx="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");jx.push("scrollEnd");function Ga(t,e){fN.set(t,e),zs(e,[t])}var Zg=typeof reportError=="function"?reportError:function(t){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var e=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof t=="object"&&t!==null&&typeof t.message=="string"?String(t.message):String(t),error:t});if(!window.dispatchEvent(e))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",t);return}console.error(t)},va=[],hc=0,NE=0;function Ry(){for(var t=hc,e=NE=hc=0;e<t;){var n=va[e];va[e++]=null;var i=va[e];va[e++]=null;var a=va[e];va[e++]=null;var o=va[e];if(va[e++]=null,i!==null&&a!==null){var s=i.pending;s===null?a.next=a:(a.next=s.next,s.next=a),i.pending=a}o!==0&&dN(n,a,o)}}function Ty(t,e,n,i){va[hc++]=t,va[hc++]=e,va[hc++]=n,va[hc++]=i,NE|=i,t.lanes|=i,t=t.alternate,t!==null&&(t.lanes|=i)}function IE(t,e,n,i){return Ty(t,e,n,i),Wg(t)}function Ds(t,e){return Ty(t,null,null,e),Wg(t)}function dN(t,e,n){t.lanes|=n;var i=t.alternate;i!==null&&(i.lanes|=n);for(var a=!1,o=t.return;o!==null;)o.childLanes|=n,i=o.alternate,i!==null&&(i.childLanes|=n),o.tag===22&&(t=o.stateNode,t===null||t._visibility&1||(a=!0)),t=o,o=o.return;return t.tag===3?(o=t.stateNode,a&&e!==null&&(a=31-ta(n),t=o.hiddenUpdates,i=t[a],i===null?t[a]=[e]:i.push(e),e.lane=n|536870912),o):null}function Wg(t){if(50<Pd)throw Pd=0,sE=null,Error(W(185));for(var e=t.return;e!==null;)t=e,e=t.return;return t.tag===3?t.stateNode:null}var pc={};function PV(t,e,n,i){this.tag=t,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=i,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Zi(t,e,n,i){return new PV(t,e,n,i)}function DE(t){return t=t.prototype,!(!t||!t.isReactComponent)}function Xo(t,e){var n=t.alternate;return n===null?(n=Zi(t.tag,e,t.key,t.mode),n.elementType=t.elementType,n.type=t.type,n.stateNode=t.stateNode,n.alternate=t,t.alternate=n):(n.pendingProps=e,n.type=t.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=t.flags&65011712,n.childLanes=t.childLanes,n.lanes=t.lanes,n.child=t.child,n.memoizedProps=t.memoizedProps,n.memoizedState=t.memoizedState,n.updateQueue=t.updateQueue,e=t.dependencies,n.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},n.sibling=t.sibling,n.index=t.index,n.ref=t.ref,n.refCleanup=t.refCleanup,n}function hN(t,e){t.flags&=65011714;var n=t.alternate;return n===null?(t.childLanes=0,t.lanes=e,t.child=null,t.subtreeFlags=0,t.memoizedProps=null,t.memoizedState=null,t.updateQueue=null,t.dependencies=null,t.stateNode=null):(t.childLanes=n.childLanes,t.lanes=n.lanes,t.child=n.child,t.subtreeFlags=0,t.deletions=null,t.memoizedProps=n.memoizedProps,t.memoizedState=n.memoizedState,t.updateQueue=n.updateQueue,t.type=n.type,e=n.dependencies,t.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),t}function Dg(t,e,n,i,a,o){var s=0;if(i=t,typeof t=="function")DE(t)&&(s=1);else if(typeof t=="string")s=V8(t,n,fo.current)?26:t==="html"||t==="head"||t==="body"?27:5;else t:switch(t){case Mx:return t=Zi(31,n,e,a),t.elementType=Mx,t.lanes=o,t;case rc:return Es(n.children,a,o,e);case Nz:s=8,a|=24;break;case Tx:return t=Zi(12,n,e,a|2),t.elementType=Tx,t.lanes=o,t;case Cx:return t=Zi(13,n,e,a),t.elementType=Cx,t.lanes=o,t;case wx:return t=Zi(19,n,e,a),t.elementType=wx,t.lanes=o,t;default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case ko:s=10;break t;case Iz:s=9;break t;case bE:s=11;break t;case xE:s=14;break t;case Gr:s=16,i=null;break t}s=29,n=Error(W(130,t===null?"null":typeof t,"")),i=null}return e=Zi(s,n,e,a),e.elementType=t,e.type=i,e.lanes=o,e}function Es(t,e,n,i){return t=Zi(7,t,i,e),t.lanes=n,t}function ix(t,e,n){return t=Zi(6,t,null,e),t.lanes=n,t}function pN(t){var e=Zi(18,null,null,0);return e.stateNode=t,e}function ax(t,e,n){return e=Zi(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}var R_=new WeakMap;function Aa(t,e){if(typeof t=="object"&&t!==null){var n=R_.get(t);return n!==void 0?n:(e={value:t,source:e,stack:o_(e)},R_.set(t,e),e)}return{value:t,source:e,stack:o_(e)}}var mc=[],gc=0,Jg=null,Fd=0,ba=[],xa=0,cl=null,so=1,uo="";function Fo(t,e){mc[gc++]=Fd,mc[gc++]=Jg,Jg=t,Fd=e}function mN(t,e,n){ba[xa++]=so,ba[xa++]=uo,ba[xa++]=cl,cl=t;var i=so;t=uo;var a=32-ta(i)-1;i&=~(1<<a),n+=1;var o=32-ta(e)+a;if(30<o){var s=a-a%5;o=(i&(1<<s)-1).toString(32),i>>=s,a-=s,so=1<<32-ta(e)+a|n<<a|i,uo=o+t}else so=1<<o|n<<a|i,uo=t}function LE(t){t.return!==null&&(Fo(t,1),mN(t,1,0))}function BE(t){for(;t===Jg;)Jg=mc[--gc],mc[gc]=null,Fd=mc[--gc],mc[gc]=null;for(;t===cl;)cl=ba[--xa],ba[xa]=null,uo=ba[--xa],ba[xa]=null,so=ba[--xa],ba[xa]=null}function gN(t,e){ba[xa++]=so,ba[xa++]=uo,ba[xa++]=cl,so=e.id,uo=e.overflow,cl=t}var kn=null,ze=null,Wt=!1,nl=null,Ra=!1,qx=Error(W(519));function fl(t){var e=Error(W(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Gd(Aa(e,t)),qx}function T_(t){var e=t.stateNode,n=t.type,i=t.memoizedProps;switch(e[Gn]=t,e[Mi]=i,n){case"dialog":kt("cancel",e),kt("close",e);break;case"iframe":case"object":case"embed":kt("load",e);break;case"video":case"audio":for(n=0;n<Xd.length;n++)kt(Xd[n],e);break;case"source":kt("error",e);break;case"img":case"image":case"link":kt("error",e),kt("load",e);break;case"details":kt("toggle",e);break;case"input":kt("invalid",e),Yz(e,i.value,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name,!0);break;case"select":kt("invalid",e);break;case"textarea":kt("invalid",e),Xz(e,i.value,i.defaultValue,i.children)}n=i.children,typeof n!="string"&&typeof n!="number"&&typeof n!="bigint"||e.textContent===""+n||i.suppressHydrationWarning===!0||J3(e.textContent,n)?(i.popover!=null&&(kt("beforetoggle",e),kt("toggle",e)),i.onScroll!=null&&kt("scroll",e),i.onScrollEnd!=null&&kt("scrollend",e),i.onClick!=null&&(e.onclick=Yo),e=!0):e=!1,e||fl(t,!0)}function C_(t){for(kn=t.return;kn;)switch(kn.tag){case 5:case 31:case 13:Ra=!1;return;case 27:case 3:Ra=!0;return;default:kn=kn.return}}function nc(t){if(t!==kn)return!1;if(!Wt)return C_(t),Wt=!0,!1;var e=t.tag,n;if((n=e!==3&&e!==27)&&((n=e===5)&&(n=t.type,n=!(n!=="form"&&n!=="button")||hE(t.type,t.memoizedProps)),n=!n),n&&ze&&fl(t),C_(t),e===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(W(317));ze=pz(t)}else if(e===31){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(W(317));ze=pz(t)}else e===27?(e=ze,ml(t.type)?(t=yE,yE=null,ze=t):ze=e):ze=kn?Ca(t.stateNode.nextSibling):null;return!0}function Cs(){ze=kn=null,Wt=!1}function ox(){var t=nl;return t!==null&&(Ci===null?Ci=t:Ci.push.apply(Ci,t),nl=null),t}function Gd(t){nl===null?nl=[t]:nl.push(t)}var Fx=ho(null),Ls=null,Qo=null;function Yr(t,e,n){Me(Fx,e._currentValue),e._currentValue=n}function Ko(t){t._currentValue=Fx.current,Dn(Fx)}function Gx(t,e,n){for(;t!==null;){var i=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,i!==null&&(i.childLanes|=e)):i!==null&&(i.childLanes&e)!==e&&(i.childLanes|=e),t===n)break;t=t.return}}function kx(t,e,n,i){var a=t.child;for(a!==null&&(a.return=t);a!==null;){var o=a.dependencies;if(o!==null){var s=a.child;o=o.firstContext;t:for(;o!==null;){var u=o;o=a;for(var d=0;d<e.length;d++)if(u.context===e[d]){o.lanes|=n,u=o.alternate,u!==null&&(u.lanes|=n),Gx(o.return,n,t),i||(s=null);break t}o=u.next}}else if(a.tag===18){if(s=a.return,s===null)throw Error(W(341));s.lanes|=n,o=s.alternate,o!==null&&(o.lanes|=n),Gx(s,n,t),s=null}else s=a.child;if(s!==null)s.return=a;else for(s=a;s!==null;){if(s===t){s=null;break}if(a=s.sibling,a!==null){a.return=s.return,s=a;break}s=s.return}a=s}}function Hc(t,e,n,i){t=null;for(var a=e,o=!1;a!==null;){if(!o){if(a.flags&524288)o=!0;else if(a.flags&262144)break}if(a.tag===10){var s=a.alternate;if(s===null)throw Error(W(387));if(s=s.memoizedProps,s!==null){var u=a.type;na(a.pendingProps.value,s.value)||(t!==null?t.push(u):t=[u])}}else if(a===kg.current){if(s=a.alternate,s===null)throw Error(W(387));s.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(t!==null?t.push(Zd):t=[Zd])}a=a.return}t!==null&&kx(e,t,n,i),e.flags|=262144}function $g(t){for(t=t.firstContext;t!==null;){if(!na(t.context._currentValue,t.memoizedValue))return!0;t=t.next}return!1}function ws(t){Ls=t,Qo=null,t=t.dependencies,t!==null&&(t.firstContext=null)}function Yn(t){return yN(Ls,t)}function bg(t,e){return Ls===null&&ws(t),yN(t,e)}function yN(t,e){var n=e._currentValue;if(e={context:e,memoizedValue:n,next:null},Qo===null){if(t===null)throw Error(W(308));Qo=e,t.dependencies={lanes:0,firstContext:e},t.flags|=524288}else Qo=Qo.next=e;return n}var HV=typeof AbortController<"u"?AbortController:function(){var t=[],e=this.signal={aborted:!1,addEventListener:function(n,i){t.push(i)}};this.abort=function(){e.aborted=!0,t.forEach(function(n){return n()})}},UV=Cn.unstable_scheduleCallback,VV=Cn.unstable_NormalPriority,mn={$$typeof:ko,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function PE(){return{controller:new HV,data:new Map,refCount:0}}function oh(t){t.refCount--,t.refCount===0&&UV(VV,function(){t.controller.abort()})}var Od=null,Yx=0,Mc=0,xc=null;function jV(t,e){if(Od===null){var n=Od=[];Yx=0,Mc=sA(),xc={status:"pending",value:void 0,then:function(i){n.push(i)}}}return Yx++,e.then(w_,w_),e}function w_(){if(--Yx===0&&Od!==null){xc!==null&&(xc.status="fulfilled");var t=Od;Od=null,Mc=0,xc=null;for(var e=0;e<t.length;e++)(0,t[e])()}}function qV(t,e){var n=[],i={status:"pending",value:null,reason:null,then:function(a){n.push(a)}};return t.then(function(){i.status="fulfilled",i.value=e;for(var a=0;a<n.length;a++)(0,n[a])(e)},function(a){for(i.status="rejected",i.reason=a,a=0;a<n.length;a++)(0,n[a])(void 0)}),i}var M_=_t.S;_t.S=function(t,e){z3=Ji(),typeof e=="object"&&e!==null&&typeof e.then=="function"&&jV(t,e),M_!==null&&M_(t,e)};var As=ho(null);function HE(){var t=As.current;return t!==null?t:Te.pooledCache}function Lg(t,e){e===null?Me(As,As.current):Me(As,e.pool)}function vN(){var t=HE();return t===null?null:{parent:mn._currentValue,pool:t}}var Uc=Error(W(460)),UE=Error(W(474)),Cy=Error(W(542)),ty={then:function(){}};function O_(t){return t=t.status,t==="fulfilled"||t==="rejected"}function SN(t,e,n){switch(n=t[n],n===void 0?t.push(e):n!==e&&(e.then(Yo,Yo),e=n),e.status){case"fulfilled":return e.value;case"rejected":throw t=e.reason,z_(t),t;default:if(typeof e.status=="string")e.then(Yo,Yo);else{if(t=Te,t!==null&&100<t.shellSuspendCounter)throw Error(W(482));t=e,t.status="pending",t.then(function(i){if(e.status==="pending"){var a=e;a.status="fulfilled",a.value=i}},function(i){if(e.status==="pending"){var a=e;a.status="rejected",a.reason=i}})}switch(e.status){case"fulfilled":return e.value;case"rejected":throw t=e.reason,z_(t),t}throw Rs=e,Uc}}function Ss(t){try{var e=t._init;return e(t._payload)}catch(n){throw n!==null&&typeof n=="object"&&typeof n.then=="function"?(Rs=n,Uc):n}}var Rs=null;function __(){if(Rs===null)throw Error(W(459));var t=Rs;return Rs=null,t}function z_(t){if(t===Uc||t===Cy)throw Error(W(483))}var Ec=null,kd=0;function xg(t){var e=kd;return kd+=1,Ec===null&&(Ec=[]),SN(Ec,t,e)}function gd(t,e){e=e.props.ref,t.ref=e!==void 0?e:null}function Eg(t,e){throw e.$$typeof===MU?Error(W(525)):(t=Object.prototype.toString.call(e),Error(W(31,t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)))}function bN(t){function e(A,x){if(t){var R=A.deletions;R===null?(A.deletions=[x],A.flags|=16):R.push(x)}}function n(A,x){if(!t)return null;for(;x!==null;)e(A,x),x=x.sibling;return null}function i(A){for(var x=new Map;A!==null;)A.key!==null?x.set(A.key,A):x.set(A.index,A),A=A.sibling;return x}function a(A,x){return A=Xo(A,x),A.index=0,A.sibling=null,A}function o(A,x,R){return A.index=R,t?(R=A.alternate,R!==null?(R=R.index,R<x?(A.flags|=67108866,x):R):(A.flags|=67108866,x)):(A.flags|=1048576,x)}function s(A){return t&&A.alternate===null&&(A.flags|=67108866),A}function u(A,x,R,C){return x===null||x.tag!==6?(x=ix(R,A.mode,C),x.return=A,x):(x=a(x,R),x.return=A,x)}function d(A,x,R,C){var M=R.type;return M===rc?f(A,x,R.props.children,C,R.key):x!==null&&(x.elementType===M||typeof M=="object"&&M!==null&&M.$$typeof===Gr&&Ss(M)===x.type)?(x=a(x,R.props),gd(x,R),x.return=A,x):(x=Dg(R.type,R.key,R.props,null,A.mode,C),gd(x,R),x.return=A,x)}function p(A,x,R,C){return x===null||x.tag!==4||x.stateNode.containerInfo!==R.containerInfo||x.stateNode.implementation!==R.implementation?(x=ax(R,A.mode,C),x.return=A,x):(x=a(x,R.children||[]),x.return=A,x)}function f(A,x,R,C,M){return x===null||x.tag!==7?(x=Es(R,A.mode,C,M),x.return=A,x):(x=a(x,R),x.return=A,x)}function m(A,x,R){if(typeof x=="string"&&x!==""||typeof x=="number"||typeof x=="bigint")return x=ix(""+x,A.mode,R),x.return=A,x;if(typeof x=="object"&&x!==null){switch(x.$$typeof){case dg:return R=Dg(x.type,x.key,x.props,null,A.mode,R),gd(R,x),R.return=A,R;case xd:return x=ax(x,A.mode,R),x.return=A,x;case Gr:return x=Ss(x),m(A,x,R)}if(Ed(x)||pd(x))return x=Es(x,A.mode,R,null),x.return=A,x;if(typeof x.then=="function")return m(A,xg(x),R);if(x.$$typeof===ko)return m(A,bg(A,x),R);Eg(A,x)}return null}function g(A,x,R,C){var M=x!==null?x.key:null;if(typeof R=="string"&&R!==""||typeof R=="number"||typeof R=="bigint")return M!==null?null:u(A,x,""+R,C);if(typeof R=="object"&&R!==null){switch(R.$$typeof){case dg:return R.key===M?d(A,x,R,C):null;case xd:return R.key===M?p(A,x,R,C):null;case Gr:return R=Ss(R),g(A,x,R,C)}if(Ed(R)||pd(R))return M!==null?null:f(A,x,R,C,null);if(typeof R.then=="function")return g(A,x,xg(R),C);if(R.$$typeof===ko)return g(A,x,bg(A,R),C);Eg(A,R)}return null}function v(A,x,R,C,M){if(typeof C=="string"&&C!==""||typeof C=="number"||typeof C=="bigint")return A=A.get(R)||null,u(x,A,""+C,M);if(typeof C=="object"&&C!==null){switch(C.$$typeof){case dg:return A=A.get(C.key===null?R:C.key)||null,d(x,A,C,M);case xd:return A=A.get(C.key===null?R:C.key)||null,p(x,A,C,M);case Gr:return C=Ss(C),v(A,x,R,C,M)}if(Ed(C)||pd(C))return A=A.get(R)||null,f(x,A,C,M,null);if(typeof C.then=="function")return v(A,x,R,xg(C),M);if(C.$$typeof===ko)return v(A,x,R,bg(x,C),M);Eg(x,C)}return null}function S(A,x,R,C){for(var M=null,z=null,N=x,D=x=0,q=null;N!==null&&D<R.length;D++){N.index>D?(q=N,N=null):q=N.sibling;var P=g(A,N,R[D],C);if(P===null){N===null&&(N=q);break}t&&N&&P.alternate===null&&e(A,N),x=o(P,x,D),z===null?M=P:z.sibling=P,z=P,N=q}if(D===R.length)return n(A,N),Wt&&Fo(A,D),M;if(N===null){for(;D<R.length;D++)N=m(A,R[D],C),N!==null&&(x=o(N,x,D),z===null?M=N:z.sibling=N,z=N);return Wt&&Fo(A,D),M}for(N=i(N);D<R.length;D++)q=v(N,A,D,R[D],C),q!==null&&(t&&q.alternate!==null&&N.delete(q.key===null?D:q.key),x=o(q,x,D),z===null?M=q:z.sibling=q,z=q);return t&&N.forEach(function(U){return e(A,U)}),Wt&&Fo(A,D),M}function E(A,x,R,C){if(R==null)throw Error(W(151));for(var M=null,z=null,N=x,D=x=0,q=null,P=R.next();N!==null&&!P.done;D++,P=R.next()){N.index>D?(q=N,N=null):q=N.sibling;var U=g(A,N,P.value,C);if(U===null){N===null&&(N=q);break}t&&N&&U.alternate===null&&e(A,N),x=o(U,x,D),z===null?M=U:z.sibling=U,z=U,N=q}if(P.done)return n(A,N),Wt&&Fo(A,D),M;if(N===null){for(;!P.done;D++,P=R.next())P=m(A,P.value,C),P!==null&&(x=o(P,x,D),z===null?M=P:z.sibling=P,z=P);return Wt&&Fo(A,D),M}for(N=i(N);!P.done;D++,P=R.next())P=v(N,A,D,P.value,C),P!==null&&(t&&P.alternate!==null&&N.delete(P.key===null?D:P.key),x=o(P,x,D),z===null?M=P:z.sibling=P,z=P);return t&&N.forEach(function(J){return e(A,J)}),Wt&&Fo(A,D),M}function T(A,x,R,C){if(typeof R=="object"&&R!==null&&R.type===rc&&R.key===null&&(R=R.props.children),typeof R=="object"&&R!==null){switch(R.$$typeof){case dg:t:{for(var M=R.key;x!==null;){if(x.key===M){if(M=R.type,M===rc){if(x.tag===7){n(A,x.sibling),C=a(x,R.props.children),C.return=A,A=C;break t}}else if(x.elementType===M||typeof M=="object"&&M!==null&&M.$$typeof===Gr&&Ss(M)===x.type){n(A,x.sibling),C=a(x,R.props),gd(C,R),C.return=A,A=C;break t}n(A,x);break}else e(A,x);x=x.sibling}R.type===rc?(C=Es(R.props.children,A.mode,C,R.key),C.return=A,A=C):(C=Dg(R.type,R.key,R.props,null,A.mode,C),gd(C,R),C.return=A,A=C)}return s(A);case xd:t:{for(M=R.key;x!==null;){if(x.key===M)if(x.tag===4&&x.stateNode.containerInfo===R.containerInfo&&x.stateNode.implementation===R.implementation){n(A,x.sibling),C=a(x,R.children||[]),C.return=A,A=C;break t}else{n(A,x);break}else e(A,x);x=x.sibling}C=ax(R,A.mode,C),C.return=A,A=C}return s(A);case Gr:return R=Ss(R),T(A,x,R,C)}if(Ed(R))return S(A,x,R,C);if(pd(R)){if(M=pd(R),typeof M!="function")throw Error(W(150));return R=M.call(R),E(A,x,R,C)}if(typeof R.then=="function")return T(A,x,xg(R),C);if(R.$$typeof===ko)return T(A,x,bg(A,R),C);Eg(A,R)}return typeof R=="string"&&R!==""||typeof R=="number"||typeof R=="bigint"?(R=""+R,x!==null&&x.tag===6?(n(A,x.sibling),C=a(x,R),C.return=A,A=C):(n(A,x),C=ix(R,A.mode,C),C.return=A,A=C),s(A)):n(A,x)}return function(A,x,R,C){try{kd=0;var M=T(A,x,R,C);return Ec=null,M}catch(N){if(N===Uc||N===Cy)throw N;var z=Zi(29,N,null,A.mode);return z.lanes=C,z.return=A,z}finally{}}}var Ms=bN(!0),xN=bN(!1),kr=!1;function VE(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Qx(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function il(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function al(t,e,n){var i=t.updateQueue;if(i===null)return null;if(i=i.shared,se&2){var a=i.pending;return a===null?e.next=e:(e.next=a.next,a.next=e),i.pending=e,e=Wg(t),dN(t,null,n),e}return Ty(t,i,e,n),Wg(t)}function _d(t,e,n){if(e=e.updateQueue,e!==null&&(e=e.shared,(n&4194048)!==0)){var i=e.lanes;i&=t.pendingLanes,n|=i,e.lanes=n,Uz(t,n)}}function rx(t,e){var n=t.updateQueue,i=t.alternate;if(i!==null&&(i=i.updateQueue,n===i)){var a=null,o=null;if(n=n.firstBaseUpdate,n!==null){do{var s={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};o===null?a=o=s:o=o.next=s,n=n.next}while(n!==null);o===null?a=o=e:o=o.next=e}else a=o=e;n={baseState:i.baseState,firstBaseUpdate:a,lastBaseUpdate:o,shared:i.shared,callbacks:i.callbacks},t.updateQueue=n;return}t=n.lastBaseUpdate,t===null?n.firstBaseUpdate=e:t.next=e,n.lastBaseUpdate=e}var Xx=!1;function zd(){if(Xx){var t=xc;if(t!==null)throw t}}function Nd(t,e,n,i){Xx=!1;var a=t.updateQueue;kr=!1;var o=a.firstBaseUpdate,s=a.lastBaseUpdate,u=a.shared.pending;if(u!==null){a.shared.pending=null;var d=u,p=d.next;d.next=null,s===null?o=p:s.next=p,s=d;var f=t.alternate;f!==null&&(f=f.updateQueue,u=f.lastBaseUpdate,u!==s&&(u===null?f.firstBaseUpdate=p:u.next=p,f.lastBaseUpdate=d))}if(o!==null){var m=a.baseState;s=0,f=p=d=null,u=o;do{var g=u.lane&-536870913,v=g!==u.lane;if(v?(Xt&g)===g:(i&g)===g){g!==0&&g===Mc&&(Xx=!0),f!==null&&(f=f.next={lane:0,tag:u.tag,payload:u.payload,callback:null,next:null});t:{var S=t,E=u;g=e;var T=n;switch(E.tag){case 1:if(S=E.payload,typeof S=="function"){m=S.call(T,m,g);break t}m=S;break t;case 3:S.flags=S.flags&-65537|128;case 0:if(S=E.payload,g=typeof S=="function"?S.call(T,m,g):S,g==null)break t;m=Ne({},m,g);break t;case 2:kr=!0}}g=u.callback,g!==null&&(t.flags|=64,v&&(t.flags|=8192),v=a.callbacks,v===null?a.callbacks=[g]:v.push(g))}else v={lane:g,tag:u.tag,payload:u.payload,callback:u.callback,next:null},f===null?(p=f=v,d=m):f=f.next=v,s|=g;if(u=u.next,u===null){if(u=a.shared.pending,u===null)break;v=u,u=v.next,v.next=null,a.lastBaseUpdate=v,a.shared.pending=null}}while(!0);f===null&&(d=m),a.baseState=d,a.firstBaseUpdate=p,a.lastBaseUpdate=f,o===null&&(a.shared.lanes=0),hl|=s,t.lanes=s,t.memoizedState=m}}function EN(t,e){if(typeof t!="function")throw Error(W(191,t));t.call(e)}function AN(t,e){var n=t.callbacks;if(n!==null)for(t.callbacks=null,t=0;t<n.length;t++)EN(n[t],e)}var Oc=ho(null),ey=ho(0);function N_(t,e){t=er,Me(ey,t),Me(Oc,e),er=t|e.baseLanes}function Kx(){Me(ey,er),Me(Oc,Oc.current)}function jE(){er=ey.current,Dn(Oc),Dn(ey)}var ia=ho(null),Ta=null;function Qr(t){var e=t.alternate;Me(rn,rn.current&1),Me(ia,t),Ta===null&&(e===null||Oc.current!==null||e.memoizedState!==null)&&(Ta=t)}function Zx(t){Me(rn,rn.current),Me(ia,t),Ta===null&&(Ta=t)}function RN(t){t.tag===22?(Me(rn,rn.current),Me(ia,t),Ta===null&&(Ta=t)):Xr(t)}function Xr(){Me(rn,rn.current),Me(ia,ia.current)}function Ki(t){Dn(ia),Ta===t&&(Ta=null),Dn(rn)}var rn=ho(0);function ny(t){for(var e=t;e!==null;){if(e.tag===13){var n=e.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||mE(n)||gE(n)))return e}else if(e.tag===19&&(e.memoizedProps.revealOrder==="forwards"||e.memoizedProps.revealOrder==="backwards"||e.memoizedProps.revealOrder==="unstable_legacy-backwards"||e.memoizedProps.revealOrder==="together")){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var Jo=0,Ht=null,xe=null,hn=null,iy=!1,Ac=!1,Os=!1,ay=0,Yd=0,Rc=null,FV=0;function We(){throw Error(W(321))}function qE(t,e){if(e===null)return!1;for(var n=0;n<e.length&&n<t.length;n++)if(!na(t[n],e[n]))return!1;return!0}function FE(t,e,n,i,a,o){return Jo=o,Ht=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,_t.H=t===null||t.memoizedState===null?e3:tA,Os=!1,o=n(i,a),Os=!1,Ac&&(o=CN(e,n,i,a)),TN(t),o}function TN(t){_t.H=Qd;var e=xe!==null&&xe.next!==null;if(Jo=0,hn=xe=Ht=null,iy=!1,Yd=0,Rc=null,e)throw Error(W(300));t===null||gn||(t=t.dependencies,t!==null&&$g(t)&&(gn=!0))}function CN(t,e,n,i){Ht=t;var a=0;do{if(Ac&&(Rc=null),Yd=0,Ac=!1,25<=a)throw Error(W(301));if(a+=1,hn=xe=null,t.updateQueue!=null){var o=t.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}_t.H=n3,o=e(n,i)}while(Ac);return o}function GV(){var t=_t.H,e=t.useState()[0];return e=typeof e.then=="function"?rh(e):e,t=t.useState()[0],(xe!==null?xe.memoizedState:null)!==t&&(Ht.flags|=1024),e}function GE(){var t=ay!==0;return ay=0,t}function kE(t,e,n){e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~n}function YE(t){if(iy){for(t=t.memoizedState;t!==null;){var e=t.queue;e!==null&&(e.pending=null),t=t.next}iy=!1}Jo=0,hn=xe=Ht=null,Ac=!1,Yd=ay=0,Rc=null}function di(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return hn===null?Ht.memoizedState=hn=t:hn=hn.next=t,hn}function ln(){if(xe===null){var t=Ht.alternate;t=t!==null?t.memoizedState:null}else t=xe.next;var e=hn===null?Ht.memoizedState:hn.next;if(e!==null)hn=e,xe=t;else{if(t===null)throw Ht.alternate===null?Error(W(467)):Error(W(310));xe=t,t={memoizedState:xe.memoizedState,baseState:xe.baseState,baseQueue:xe.baseQueue,queue:xe.queue,next:null},hn===null?Ht.memoizedState=hn=t:hn=hn.next=t}return hn}function wy(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function rh(t){var e=Yd;return Yd+=1,Rc===null&&(Rc=[]),t=SN(Rc,t,e),e=Ht,(hn===null?e.memoizedState:hn.next)===null&&(e=e.alternate,_t.H=e===null||e.memoizedState===null?e3:tA),t}function My(t){if(t!==null&&typeof t=="object"){if(typeof t.then=="function")return rh(t);if(t.$$typeof===ko)return Yn(t)}throw Error(W(438,String(t)))}function QE(t){var e=null,n=Ht.updateQueue;if(n!==null&&(e=n.memoCache),e==null){var i=Ht.alternate;i!==null&&(i=i.updateQueue,i!==null&&(i=i.memoCache,i!=null&&(e={data:i.data.map(function(a){return a.slice()}),index:0})))}if(e==null&&(e={data:[],index:0}),n===null&&(n=wy(),Ht.updateQueue=n),n.memoCache=e,n=e.data[e.index],n===void 0)for(n=e.data[e.index]=Array(t),i=0;i<t;i++)n[i]=OU;return e.index++,n}function $o(t,e){return typeof e=="function"?e(t):e}function Bg(t){var e=ln();return XE(e,xe,t)}function XE(t,e,n){var i=t.queue;if(i===null)throw Error(W(311));i.lastRenderedReducer=n;var a=t.baseQueue,o=i.pending;if(o!==null){if(a!==null){var s=a.next;a.next=o.next,o.next=s}e.baseQueue=a=o,i.pending=null}if(o=t.baseState,a===null)t.memoizedState=o;else{e=a.next;var u=s=null,d=null,p=e,f=!1;do{var m=p.lane&-536870913;if(m!==p.lane?(Xt&m)===m:(Jo&m)===m){var g=p.revertLane;if(g===0)d!==null&&(d=d.next={lane:0,revertLane:0,gesture:null,action:p.action,hasEagerState:p.hasEagerState,eagerState:p.eagerState,next:null}),m===Mc&&(f=!0);else if((Jo&g)===g){p=p.next,g===Mc&&(f=!0);continue}else m={lane:0,revertLane:p.revertLane,gesture:null,action:p.action,hasEagerState:p.hasEagerState,eagerState:p.eagerState,next:null},d===null?(u=d=m,s=o):d=d.next=m,Ht.lanes|=g,hl|=g;m=p.action,Os&&n(o,m),o=p.hasEagerState?p.eagerState:n(o,m)}else g={lane:m,revertLane:p.revertLane,gesture:p.gesture,action:p.action,hasEagerState:p.hasEagerState,eagerState:p.eagerState,next:null},d===null?(u=d=g,s=o):d=d.next=g,Ht.lanes|=m,hl|=m;p=p.next}while(p!==null&&p!==e);if(d===null?s=o:d.next=u,!na(o,t.memoizedState)&&(gn=!0,f&&(n=xc,n!==null)))throw n;t.memoizedState=o,t.baseState=s,t.baseQueue=d,i.lastRenderedState=o}return a===null&&(i.lanes=0),[t.memoizedState,i.dispatch]}function lx(t){var e=ln(),n=e.queue;if(n===null)throw Error(W(311));n.lastRenderedReducer=t;var i=n.dispatch,a=n.pending,o=e.memoizedState;if(a!==null){n.pending=null;var s=a=a.next;do o=t(o,s.action),s=s.next;while(s!==a);na(o,e.memoizedState)||(gn=!0),e.memoizedState=o,e.baseQueue===null&&(e.baseState=o),n.lastRenderedState=o}return[o,i]}function wN(t,e,n){var i=Ht,a=ln(),o=Wt;if(o){if(n===void 0)throw Error(W(407));n=n()}else n=e();var s=!na((xe||a).memoizedState,n);if(s&&(a.memoizedState=n,gn=!0),a=a.queue,KE(_N.bind(null,i,a,t),[t]),a.getSnapshot!==e||s||hn!==null&&hn.memoizedState.tag&1){if(i.flags|=2048,_c(9,{destroy:void 0},ON.bind(null,i,a,n,e),null),Te===null)throw Error(W(349));o||Jo&127||MN(i,e,n)}return n}function MN(t,e,n){t.flags|=16384,t={getSnapshot:e,value:n},e=Ht.updateQueue,e===null?(e=wy(),Ht.updateQueue=e,e.stores=[t]):(n=e.stores,n===null?e.stores=[t]:n.push(t))}function ON(t,e,n,i){e.value=n,e.getSnapshot=i,zN(e)&&NN(t)}function _N(t,e,n){return n(function(){zN(e)&&NN(t)})}function zN(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!na(t,n)}catch{return!0}}function NN(t){var e=Ds(t,2);e!==null&&wi(e,t,2)}function Wx(t){var e=di();if(typeof t=="function"){var n=t;if(t=n(),Os){Zr(!0);try{n()}finally{Zr(!1)}}}return e.memoizedState=e.baseState=t,e.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:$o,lastRenderedState:t},e}function IN(t,e,n,i){return t.baseState=n,XE(t,xe,typeof i=="function"?i:$o)}function kV(t,e,n,i,a){if(_y(t))throw Error(W(485));if(t=e.action,t!==null){var o={payload:a,action:t,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(s){o.listeners.push(s)}};_t.T!==null?n(!0):o.isTransition=!1,i(o),n=e.pending,n===null?(o.next=e.pending=o,DN(e,o)):(o.next=n.next,e.pending=n.next=o)}}function DN(t,e){var n=e.action,i=e.payload,a=t.state;if(e.isTransition){var o=_t.T,s={};_t.T=s;try{var u=n(a,i),d=_t.S;d!==null&&d(s,u),I_(t,e,u)}catch(p){Jx(t,e,p)}finally{o!==null&&s.types!==null&&(o.types=s.types),_t.T=o}}else try{o=n(a,i),I_(t,e,o)}catch(p){Jx(t,e,p)}}function I_(t,e,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(i){D_(t,e,i)},function(i){return Jx(t,e,i)}):D_(t,e,n)}function D_(t,e,n){e.status="fulfilled",e.value=n,LN(e),t.state=n,e=t.pending,e!==null&&(n=e.next,n===e?t.pending=null:(n=n.next,e.next=n,DN(t,n)))}function Jx(t,e,n){var i=t.pending;if(t.pending=null,i!==null){i=i.next;do e.status="rejected",e.reason=n,LN(e),e=e.next;while(e!==i)}t.action=null}function LN(t){t=t.listeners;for(var e=0;e<t.length;e++)(0,t[e])()}function BN(t,e){return e}function L_(t,e){if(Wt){var n=Te.formState;if(n!==null){t:{var i=Ht;if(Wt){if(ze){e:{for(var a=ze,o=Ra;a.nodeType!==8;){if(!o){a=null;break e}if(a=Ca(a.nextSibling),a===null){a=null;break e}}o=a.data,a=o==="F!"||o==="F"?a:null}if(a){ze=Ca(a.nextSibling),i=a.data==="F!";break t}}fl(i)}i=!1}i&&(e=n[0])}}return n=di(),n.memoizedState=n.baseState=e,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:BN,lastRenderedState:e},n.queue=i,n=JN.bind(null,Ht,i),i.dispatch=n,i=Wx(!1),o=$E.bind(null,Ht,!1,i.queue),i=di(),a={state:e,dispatch:null,action:t,pending:null},i.queue=a,n=kV.bind(null,Ht,a,o,n),a.dispatch=n,i.memoizedState=t,[e,n,!1]}function B_(t){var e=ln();return PN(e,xe,t)}function PN(t,e,n){if(e=XE(t,e,BN)[0],t=Bg($o)[0],typeof e=="object"&&e!==null&&typeof e.then=="function")try{var i=rh(e)}catch(s){throw s===Uc?Cy:s}else i=e;e=ln();var a=e.queue,o=a.dispatch;return n!==e.memoizedState&&(Ht.flags|=2048,_c(9,{destroy:void 0},YV.bind(null,a,n),null)),[i,o,t]}function YV(t,e){t.action=e}function P_(t){var e=ln(),n=xe;if(n!==null)return PN(e,n,t);ln(),e=e.memoizedState,n=ln();var i=n.queue.dispatch;return n.memoizedState=t,[e,i,!1]}function _c(t,e,n,i){return t={tag:t,create:n,deps:i,inst:e,next:null},e=Ht.updateQueue,e===null&&(e=wy(),Ht.updateQueue=e),n=e.lastEffect,n===null?e.lastEffect=t.next=t:(i=n.next,n.next=t,t.next=i,e.lastEffect=t),t}function HN(){return ln().memoizedState}function Pg(t,e,n,i){var a=di();Ht.flags|=t,a.memoizedState=_c(1|e,{destroy:void 0},n,i===void 0?null:i)}function Oy(t,e,n,i){var a=ln();i=i===void 0?null:i;var o=a.memoizedState.inst;xe!==null&&i!==null&&qE(i,xe.memoizedState.deps)?a.memoizedState=_c(e,o,n,i):(Ht.flags|=t,a.memoizedState=_c(1|e,o,n,i))}function H_(t,e){Pg(8390656,8,t,e)}function KE(t,e){Oy(2048,8,t,e)}function QV(t){Ht.flags|=4;var e=Ht.updateQueue;if(e===null)e=wy(),Ht.updateQueue=e,e.events=[t];else{var n=e.events;n===null?e.events=[t]:n.push(t)}}function UN(t){var e=ln().memoizedState;return QV({ref:e,nextImpl:t}),function(){if(se&2)throw Error(W(440));return e.impl.apply(void 0,arguments)}}function VN(t,e){return Oy(4,2,t,e)}function jN(t,e){return Oy(4,4,t,e)}function qN(t,e){if(typeof e=="function"){t=t();var n=e(t);return function(){typeof n=="function"?n():e(null)}}if(e!=null)return t=t(),e.current=t,function(){e.current=null}}function FN(t,e,n){n=n!=null?n.concat([t]):null,Oy(4,4,qN.bind(null,e,t),n)}function ZE(){}function GN(t,e){var n=ln();e=e===void 0?null:e;var i=n.memoizedState;return e!==null&&qE(e,i[1])?i[0]:(n.memoizedState=[t,e],t)}function kN(t,e){var n=ln();e=e===void 0?null:e;var i=n.memoizedState;if(e!==null&&qE(e,i[1]))return i[0];if(i=t(),Os){Zr(!0);try{t()}finally{Zr(!1)}}return n.memoizedState=[i,e],i}function WE(t,e,n){return n===void 0||Jo&1073741824&&!(Xt&261930)?t.memoizedState=e:(t.memoizedState=n,t=I3(),Ht.lanes|=t,hl|=t,n)}function YN(t,e,n,i){return na(n,e)?n:Oc.current!==null?(t=WE(t,n,i),na(t,e)||(gn=!0),t):!(Jo&42)||Jo&1073741824&&!(Xt&261930)?(gn=!0,t.memoizedState=n):(t=I3(),Ht.lanes|=t,hl|=t,e)}function QN(t,e,n,i,a){var o=ue.p;ue.p=o!==0&&8>o?o:8;var s=_t.T,u={};_t.T=u,$E(t,!1,e,n);try{var d=a(),p=_t.S;if(p!==null&&p(u,d),d!==null&&typeof d=="object"&&typeof d.then=="function"){var f=qV(d,i);Id(t,e,f,ea(t))}else Id(t,e,i,ea(t))}catch(m){Id(t,e,{then:function(){},status:"rejected",reason:m},ea())}finally{ue.p=o,s!==null&&u.types!==null&&(s.types=u.types),_t.T=s}}function XV(){}function $x(t,e,n,i){if(t.tag!==5)throw Error(W(476));var a=XN(t).queue;QN(t,a,e,xs,n===null?XV:function(){return KN(t),n(i)})}function XN(t){var e=t.memoizedState;if(e!==null)return e;e={memoizedState:xs,baseState:xs,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:$o,lastRenderedState:xs},next:null};var n={};return e.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:$o,lastRenderedState:n},next:null},t.memoizedState=e,t=t.alternate,t!==null&&(t.memoizedState=e),e}function KN(t){var e=XN(t);e.next===null&&(e=t.alternate.memoizedState),Id(t,e.next.queue,{},ea())}function JE(){return Yn(Zd)}function ZN(){return ln().memoizedState}function WN(){return ln().memoizedState}function KV(t){for(var e=t.return;e!==null;){switch(e.tag){case 24:case 3:var n=ea();t=il(n);var i=al(e,t,n);i!==null&&(wi(i,e,n),_d(i,e,n)),e={cache:PE()},t.payload=e;return}e=e.return}}function ZV(t,e,n){var i=ea();n={lane:i,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},_y(t)?$N(e,n):(n=IE(t,e,n,i),n!==null&&(wi(n,t,i),t3(n,e,i)))}function JN(t,e,n){var i=ea();Id(t,e,n,i)}function Id(t,e,n,i){var a={lane:i,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(_y(t))$N(e,a);else{var o=t.alternate;if(t.lanes===0&&(o===null||o.lanes===0)&&(o=e.lastRenderedReducer,o!==null))try{var s=e.lastRenderedState,u=o(s,n);if(a.hasEagerState=!0,a.eagerState=u,na(u,s))return Ty(t,e,a,0),Te===null&&Ry(),!1}catch{}finally{}if(n=IE(t,e,a,i),n!==null)return wi(n,t,i),t3(n,e,i),!0}return!1}function $E(t,e,n,i){if(i={lane:2,revertLane:sA(),gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},_y(t)){if(e)throw Error(W(479))}else e=IE(t,n,i,2),e!==null&&wi(e,t,2)}function _y(t){var e=t.alternate;return t===Ht||e!==null&&e===Ht}function $N(t,e){Ac=iy=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function t3(t,e,n){if(n&4194048){var i=e.lanes;i&=t.pendingLanes,n|=i,e.lanes=n,Uz(t,n)}}var Qd={readContext:Yn,use:My,useCallback:We,useContext:We,useEffect:We,useImperativeHandle:We,useLayoutEffect:We,useInsertionEffect:We,useMemo:We,useReducer:We,useRef:We,useState:We,useDebugValue:We,useDeferredValue:We,useTransition:We,useSyncExternalStore:We,useId:We,useHostTransitionStatus:We,useFormState:We,useActionState:We,useOptimistic:We,useMemoCache:We,useCacheRefresh:We};Qd.useEffectEvent=We;var e3={readContext:Yn,use:My,useCallback:function(t,e){return di().memoizedState=[t,e===void 0?null:e],t},useContext:Yn,useEffect:H_,useImperativeHandle:function(t,e,n){n=n!=null?n.concat([t]):null,Pg(4194308,4,qN.bind(null,e,t),n)},useLayoutEffect:function(t,e){return Pg(4194308,4,t,e)},useInsertionEffect:function(t,e){Pg(4,2,t,e)},useMemo:function(t,e){var n=di();e=e===void 0?null:e;var i=t();if(Os){Zr(!0);try{t()}finally{Zr(!1)}}return n.memoizedState=[i,e],i},useReducer:function(t,e,n){var i=di();if(n!==void 0){var a=n(e);if(Os){Zr(!0);try{n(e)}finally{Zr(!1)}}}else a=e;return i.memoizedState=i.baseState=a,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:a},i.queue=t,t=t.dispatch=ZV.bind(null,Ht,t),[i.memoizedState,t]},useRef:function(t){var e=di();return t={current:t},e.memoizedState=t},useState:function(t){t=Wx(t);var e=t.queue,n=JN.bind(null,Ht,e);return e.dispatch=n,[t.memoizedState,n]},useDebugValue:ZE,useDeferredValue:function(t,e){var n=di();return WE(n,t,e)},useTransition:function(){var t=Wx(!1);return t=QN.bind(null,Ht,t.queue,!0,!1),di().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,e,n){var i=Ht,a=di();if(Wt){if(n===void 0)throw Error(W(407));n=n()}else{if(n=e(),Te===null)throw Error(W(349));Xt&127||MN(i,e,n)}a.memoizedState=n;var o={value:n,getSnapshot:e};return a.queue=o,H_(_N.bind(null,i,o,t),[t]),i.flags|=2048,_c(9,{destroy:void 0},ON.bind(null,i,o,n,e),null),n},useId:function(){var t=di(),e=Te.identifierPrefix;if(Wt){var n=uo,i=so;n=(i&~(1<<32-ta(i)-1)).toString(32)+n,e="_"+e+"R_"+n,n=ay++,0<n&&(e+="H"+n.toString(32)),e+="_"}else n=FV++,e="_"+e+"r_"+n.toString(32)+"_";return t.memoizedState=e},useHostTransitionStatus:JE,useFormState:L_,useActionState:L_,useOptimistic:function(t){var e=di();e.memoizedState=e.baseState=t;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return e.queue=n,e=$E.bind(null,Ht,!0,n),n.dispatch=e,[t,e]},useMemoCache:QE,useCacheRefresh:function(){return di().memoizedState=KV.bind(null,Ht)},useEffectEvent:function(t){var e=di(),n={impl:t};return e.memoizedState=n,function(){if(se&2)throw Error(W(440));return n.impl.apply(void 0,arguments)}}},tA={readContext:Yn,use:My,useCallback:GN,useContext:Yn,useEffect:KE,useImperativeHandle:FN,useInsertionEffect:VN,useLayoutEffect:jN,useMemo:kN,useReducer:Bg,useRef:HN,useState:function(){return Bg($o)},useDebugValue:ZE,useDeferredValue:function(t,e){var n=ln();return YN(n,xe.memoizedState,t,e)},useTransition:function(){var t=Bg($o)[0],e=ln().memoizedState;return[typeof t=="boolean"?t:rh(t),e]},useSyncExternalStore:wN,useId:ZN,useHostTransitionStatus:JE,useFormState:B_,useActionState:B_,useOptimistic:function(t,e){var n=ln();return IN(n,xe,t,e)},useMemoCache:QE,useCacheRefresh:WN};tA.useEffectEvent=UN;var n3={readContext:Yn,use:My,useCallback:GN,useContext:Yn,useEffect:KE,useImperativeHandle:FN,useInsertionEffect:VN,useLayoutEffect:jN,useMemo:kN,useReducer:lx,useRef:HN,useState:function(){return lx($o)},useDebugValue:ZE,useDeferredValue:function(t,e){var n=ln();return xe===null?WE(n,t,e):YN(n,xe.memoizedState,t,e)},useTransition:function(){var t=lx($o)[0],e=ln().memoizedState;return[typeof t=="boolean"?t:rh(t),e]},useSyncExternalStore:wN,useId:ZN,useHostTransitionStatus:JE,useFormState:P_,useActionState:P_,useOptimistic:function(t,e){var n=ln();return xe!==null?IN(n,xe,t,e):(n.baseState=t,[t,n.queue.dispatch])},useMemoCache:QE,useCacheRefresh:WN};n3.useEffectEvent=UN;function sx(t,e,n,i){e=t.memoizedState,n=n(i,e),n=n==null?e:Ne({},e,n),t.memoizedState=n,t.lanes===0&&(t.updateQueue.baseState=n)}var tE={enqueueSetState:function(t,e,n){t=t._reactInternals;var i=ea(),a=il(i);a.payload=e,n!=null&&(a.callback=n),e=al(t,a,i),e!==null&&(wi(e,t,i),_d(e,t,i))},enqueueReplaceState:function(t,e,n){t=t._reactInternals;var i=ea(),a=il(i);a.tag=1,a.payload=e,n!=null&&(a.callback=n),e=al(t,a,i),e!==null&&(wi(e,t,i),_d(e,t,i))},enqueueForceUpdate:function(t,e){t=t._reactInternals;var n=ea(),i=il(n);i.tag=2,e!=null&&(i.callback=e),e=al(t,i,n),e!==null&&(wi(e,t,n),_d(e,t,n))}};function U_(t,e,n,i,a,o,s){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(i,o,s):e.prototype&&e.prototype.isPureReactComponent?!qd(n,i)||!qd(a,o):!0}function V_(t,e,n,i){t=e.state,typeof e.componentWillReceiveProps=="function"&&e.componentWillReceiveProps(n,i),typeof e.UNSAFE_componentWillReceiveProps=="function"&&e.UNSAFE_componentWillReceiveProps(n,i),e.state!==t&&tE.enqueueReplaceState(e,e.state,null)}function _s(t,e){var n=e;if("ref"in e){n={};for(var i in e)i!=="ref"&&(n[i]=e[i])}if(t=t.defaultProps){n===e&&(n=Ne({},n));for(var a in t)n[a]===void 0&&(n[a]=t[a])}return n}function i3(t){Zg(t)}function a3(t){console.error(t)}function o3(t){Zg(t)}function oy(t,e){try{var n=t.onUncaughtError;n(e.value,{componentStack:e.stack})}catch(i){setTimeout(function(){throw i})}}function j_(t,e,n){try{var i=t.onCaughtError;i(n.value,{componentStack:n.stack,errorBoundary:e.tag===1?e.stateNode:null})}catch(a){setTimeout(function(){throw a})}}function eE(t,e,n){return n=il(n),n.tag=3,n.payload={element:null},n.callback=function(){oy(t,e)},n}function r3(t){return t=il(t),t.tag=3,t}function l3(t,e,n,i){var a=n.type.getDerivedStateFromError;if(typeof a=="function"){var o=i.value;t.payload=function(){return a(o)},t.callback=function(){j_(e,n,i)}}var s=n.stateNode;s!==null&&typeof s.componentDidCatch=="function"&&(t.callback=function(){j_(e,n,i),typeof a!="function"&&(ol===null?ol=new Set([this]):ol.add(this));var u=i.stack;this.componentDidCatch(i.value,{componentStack:u!==null?u:""})})}function WV(t,e,n,i,a){if(n.flags|=32768,i!==null&&typeof i=="object"&&typeof i.then=="function"){if(e=n.alternate,e!==null&&Hc(e,n,a,!0),n=ia.current,n!==null){switch(n.tag){case 31:case 13:return Ta===null?cy():n.alternate===null&&Je===0&&(Je=3),n.flags&=-257,n.flags|=65536,n.lanes=a,i===ty?n.flags|=16384:(e=n.updateQueue,e===null?n.updateQueue=new Set([i]):e.add(i),Sx(t,i,a)),!1;case 22:return n.flags|=65536,i===ty?n.flags|=16384:(e=n.updateQueue,e===null?(e={transitions:null,markerInstances:null,retryQueue:new Set([i])},n.updateQueue=e):(n=e.retryQueue,n===null?e.retryQueue=new Set([i]):n.add(i)),Sx(t,i,a)),!1}throw Error(W(435,n.tag))}return Sx(t,i,a),cy(),!1}if(Wt)return e=ia.current,e!==null?(!(e.flags&65536)&&(e.flags|=256),e.flags|=65536,e.lanes=a,i!==qx&&(t=Error(W(422),{cause:i}),Gd(Aa(t,n)))):(i!==qx&&(e=Error(W(423),{cause:i}),Gd(Aa(e,n))),t=t.current.alternate,t.flags|=65536,a&=-a,t.lanes|=a,i=Aa(i,n),a=eE(t.stateNode,i,a),rx(t,a),Je!==4&&(Je=2)),!1;var o=Error(W(520),{cause:i});if(o=Aa(o,n),Bd===null?Bd=[o]:Bd.push(o),Je!==4&&(Je=2),e===null)return!0;i=Aa(i,n),n=e;do{switch(n.tag){case 3:return n.flags|=65536,t=a&-a,n.lanes|=t,t=eE(n.stateNode,i,t),rx(n,t),!1;case 1:if(e=n.type,o=n.stateNode,(n.flags&128)===0&&(typeof e.getDerivedStateFromError=="function"||o!==null&&typeof o.componentDidCatch=="function"&&(ol===null||!ol.has(o))))return n.flags|=65536,a&=-a,n.lanes|=a,a=r3(a),l3(a,t,n,i),rx(n,a),!1}n=n.return}while(n!==null);return!1}var eA=Error(W(461)),gn=!1;function Fn(t,e,n,i){e.child=t===null?xN(e,null,n,i):Ms(e,t.child,n,i)}function q_(t,e,n,i,a){n=n.render;var o=e.ref;if("ref"in i){var s={};for(var u in i)u!=="ref"&&(s[u]=i[u])}else s=i;return ws(e),i=FE(t,e,n,s,o,a),u=GE(),t!==null&&!gn?(kE(t,e,a),tr(t,e,a)):(Wt&&u&&LE(e),e.flags|=1,Fn(t,e,i,a),e.child)}function F_(t,e,n,i,a){if(t===null){var o=n.type;return typeof o=="function"&&!DE(o)&&o.defaultProps===void 0&&n.compare===null?(e.tag=15,e.type=o,s3(t,e,o,i,a)):(t=Dg(n.type,null,i,e,e.mode,a),t.ref=e.ref,t.return=e,e.child=t)}if(o=t.child,!nA(t,a)){var s=o.memoizedProps;if(n=n.compare,n=n!==null?n:qd,n(s,i)&&t.ref===e.ref)return tr(t,e,a)}return e.flags|=1,t=Xo(o,i),t.ref=e.ref,t.return=e,e.child=t}function s3(t,e,n,i,a){if(t!==null){var o=t.memoizedProps;if(qd(o,i)&&t.ref===e.ref)if(gn=!1,e.pendingProps=i=o,nA(t,a))t.flags&131072&&(gn=!0);else return e.lanes=t.lanes,tr(t,e,a)}return nE(t,e,n,i,a)}function u3(t,e,n,i){var a=i.children,o=t!==null?t.memoizedState:null;if(t===null&&e.stateNode===null&&(e.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.mode==="hidden"){if(e.flags&128){if(o=o!==null?o.baseLanes|n:n,t!==null){for(i=e.child=t.child,a=0;i!==null;)a=a|i.lanes|i.childLanes,i=i.sibling;i=a&~o}else i=0,e.child=null;return G_(t,e,o,n,i)}if(n&536870912)e.memoizedState={baseLanes:0,cachePool:null},t!==null&&Lg(e,o!==null?o.cachePool:null),o!==null?N_(e,o):Kx(),RN(e);else return i=e.lanes=536870912,G_(t,e,o!==null?o.baseLanes|n:n,n,i)}else o!==null?(Lg(e,o.cachePool),N_(e,o),Xr(e),e.memoizedState=null):(t!==null&&Lg(e,null),Kx(),Xr(e));return Fn(t,e,a,n),e.child}function Rd(t,e){return t!==null&&t.tag===22||e.stateNode!==null||(e.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),e.sibling}function G_(t,e,n,i,a){var o=HE();return o=o===null?null:{parent:mn._currentValue,pool:o},e.memoizedState={baseLanes:n,cachePool:o},t!==null&&Lg(e,null),Kx(),RN(e),t!==null&&Hc(t,e,i,!0),e.childLanes=a,null}function Hg(t,e){return e=ry({mode:e.mode,children:e.children},t.mode),e.ref=t.ref,t.child=e,e.return=t,e}function k_(t,e,n){return Ms(e,t.child,null,n),t=Hg(e,e.pendingProps),t.flags|=2,Ki(e),e.memoizedState=null,t}function JV(t,e,n){var i=e.pendingProps,a=(e.flags&128)!==0;if(e.flags&=-129,t===null){if(Wt){if(i.mode==="hidden")return t=Hg(e,i),e.lanes=536870912,Rd(null,t);if(Zx(e),(t=ze)?(t=eI(t,Ra),t=t!==null&&t.data==="&"?t:null,t!==null&&(e.memoizedState={dehydrated:t,treeContext:cl!==null?{id:so,overflow:uo}:null,retryLane:536870912,hydrationErrors:null},n=pN(t),n.return=e,e.child=n,kn=e,ze=null)):t=null,t===null)throw fl(e);return e.lanes=536870912,null}return Hg(e,i)}var o=t.memoizedState;if(o!==null){var s=o.dehydrated;if(Zx(e),a)if(e.flags&256)e.flags&=-257,e=k_(t,e,n);else if(e.memoizedState!==null)e.child=t.child,e.flags|=128,e=null;else throw Error(W(558));else if(gn||Hc(t,e,n,!1),a=(n&t.childLanes)!==0,gn||a){if(i=Te,i!==null&&(s=Vz(i,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,Ds(t,s),wi(i,t,s),eA;cy(),e=k_(t,e,n)}else t=o.treeContext,ze=Ca(s.nextSibling),kn=e,Wt=!0,nl=null,Ra=!1,t!==null&&gN(e,t),e=Hg(e,i),e.flags|=4096;return e}return t=Xo(t.child,{mode:i.mode,children:i.children}),t.ref=e.ref,e.child=t,t.return=e,t}function Ug(t,e){var n=e.ref;if(n===null)t!==null&&t.ref!==null&&(e.flags|=4194816);else{if(typeof n!="function"&&typeof n!="object")throw Error(W(284));(t===null||t.ref!==n)&&(e.flags|=4194816)}}function nE(t,e,n,i,a){return ws(e),n=FE(t,e,n,i,void 0,a),i=GE(),t!==null&&!gn?(kE(t,e,a),tr(t,e,a)):(Wt&&i&&LE(e),e.flags|=1,Fn(t,e,n,a),e.child)}function Y_(t,e,n,i,a,o){return ws(e),e.updateQueue=null,n=CN(e,i,n,a),TN(t),i=GE(),t!==null&&!gn?(kE(t,e,o),tr(t,e,o)):(Wt&&i&&LE(e),e.flags|=1,Fn(t,e,n,o),e.child)}function Q_(t,e,n,i,a){if(ws(e),e.stateNode===null){var o=pc,s=n.contextType;typeof s=="object"&&s!==null&&(o=Yn(s)),o=new n(i,o),e.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,o.updater=tE,e.stateNode=o,o._reactInternals=e,o=e.stateNode,o.props=i,o.state=e.memoizedState,o.refs={},VE(e),s=n.contextType,o.context=typeof s=="object"&&s!==null?Yn(s):pc,o.state=e.memoizedState,s=n.getDerivedStateFromProps,typeof s=="function"&&(sx(e,n,s,i),o.state=e.memoizedState),typeof n.getDerivedStateFromProps=="function"||typeof o.getSnapshotBeforeUpdate=="function"||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(s=o.state,typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount(),s!==o.state&&tE.enqueueReplaceState(o,o.state,null),Nd(e,i,o,a),zd(),o.state=e.memoizedState),typeof o.componentDidMount=="function"&&(e.flags|=4194308),i=!0}else if(t===null){o=e.stateNode;var u=e.memoizedProps,d=_s(n,u);o.props=d;var p=o.context,f=n.contextType;s=pc,typeof f=="object"&&f!==null&&(s=Yn(f));var m=n.getDerivedStateFromProps;f=typeof m=="function"||typeof o.getSnapshotBeforeUpdate=="function",u=e.pendingProps!==u,f||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(u||p!==s)&&V_(e,o,i,s),kr=!1;var g=e.memoizedState;o.state=g,Nd(e,i,o,a),zd(),p=e.memoizedState,u||g!==p||kr?(typeof m=="function"&&(sx(e,n,m,i),p=e.memoizedState),(d=kr||U_(e,n,d,i,g,p,s))?(f||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(e.flags|=4194308)):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=i,e.memoizedState=p),o.props=i,o.state=p,o.context=s,i=d):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),i=!1)}else{o=e.stateNode,Qx(t,e),s=e.memoizedProps,f=_s(n,s),o.props=f,m=e.pendingProps,g=o.context,p=n.contextType,d=pc,typeof p=="object"&&p!==null&&(d=Yn(p)),u=n.getDerivedStateFromProps,(p=typeof u=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(s!==m||g!==d)&&V_(e,o,i,d),kr=!1,g=e.memoizedState,o.state=g,Nd(e,i,o,a),zd();var v=e.memoizedState;s!==m||g!==v||kr||t!==null&&t.dependencies!==null&&$g(t.dependencies)?(typeof u=="function"&&(sx(e,n,u,i),v=e.memoizedState),(f=kr||U_(e,n,f,i,g,v,d)||t!==null&&t.dependencies!==null&&$g(t.dependencies))?(p||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(i,v,d),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(i,v,d)),typeof o.componentDidUpdate=="function"&&(e.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof o.componentDidUpdate!="function"||s===t.memoizedProps&&g===t.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||s===t.memoizedProps&&g===t.memoizedState||(e.flags|=1024),e.memoizedProps=i,e.memoizedState=v),o.props=i,o.state=v,o.context=d,i=f):(typeof o.componentDidUpdate!="function"||s===t.memoizedProps&&g===t.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||s===t.memoizedProps&&g===t.memoizedState||(e.flags|=1024),i=!1)}return o=i,Ug(t,e),i=(e.flags&128)!==0,o||i?(o=e.stateNode,n=i&&typeof n.getDerivedStateFromError!="function"?null:o.render(),e.flags|=1,t!==null&&i?(e.child=Ms(e,t.child,null,a),e.child=Ms(e,null,n,a)):Fn(t,e,n,a),e.memoizedState=o.state,t=e.child):t=tr(t,e,a),t}function X_(t,e,n,i){return Cs(),e.flags|=256,Fn(t,e,n,i),e.child}var ux={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function cx(t){return{baseLanes:t,cachePool:vN()}}function fx(t,e,n){return t=t!==null?t.childLanes&~n:0,e&&(t|=Wi),t}function c3(t,e,n){var i=e.pendingProps,a=!1,o=(e.flags&128)!==0,s;if((s=o)||(s=t!==null&&t.memoizedState===null?!1:(rn.current&2)!==0),s&&(a=!0,e.flags&=-129),s=(e.flags&32)!==0,e.flags&=-33,t===null){if(Wt){if(a?Qr(e):Xr(e),(t=ze)?(t=eI(t,Ra),t=t!==null&&t.data!=="&"?t:null,t!==null&&(e.memoizedState={dehydrated:t,treeContext:cl!==null?{id:so,overflow:uo}:null,retryLane:536870912,hydrationErrors:null},n=pN(t),n.return=e,e.child=n,kn=e,ze=null)):t=null,t===null)throw fl(e);return gE(t)?e.lanes=32:e.lanes=536870912,null}var u=i.children;return i=i.fallback,a?(Xr(e),a=e.mode,u=ry({mode:"hidden",children:u},a),i=Es(i,a,n,null),u.return=e,i.return=e,u.sibling=i,e.child=u,i=e.child,i.memoizedState=cx(n),i.childLanes=fx(t,s,n),e.memoizedState=ux,Rd(null,i)):(Qr(e),iE(e,u))}var d=t.memoizedState;if(d!==null&&(u=d.dehydrated,u!==null)){if(o)e.flags&256?(Qr(e),e.flags&=-257,e=dx(t,e,n)):e.memoizedState!==null?(Xr(e),e.child=t.child,e.flags|=128,e=null):(Xr(e),u=i.fallback,a=e.mode,i=ry({mode:"visible",children:i.children},a),u=Es(u,a,n,null),u.flags|=2,i.return=e,u.return=e,i.sibling=u,e.child=i,Ms(e,t.child,null,n),i=e.child,i.memoizedState=cx(n),i.childLanes=fx(t,s,n),e.memoizedState=ux,e=Rd(null,i));else if(Qr(e),gE(u)){if(s=u.nextSibling&&u.nextSibling.dataset,s)var p=s.dgst;s=p,i=Error(W(419)),i.stack="",i.digest=s,Gd({value:i,source:null,stack:null}),e=dx(t,e,n)}else if(gn||Hc(t,e,n,!1),s=(n&t.childLanes)!==0,gn||s){if(s=Te,s!==null&&(i=Vz(s,n),i!==0&&i!==d.retryLane))throw d.retryLane=i,Ds(t,i),wi(s,t,i),eA;mE(u)||cy(),e=dx(t,e,n)}else mE(u)?(e.flags|=192,e.child=t.child,e=null):(t=d.treeContext,ze=Ca(u.nextSibling),kn=e,Wt=!0,nl=null,Ra=!1,t!==null&&gN(e,t),e=iE(e,i.children),e.flags|=4096);return e}return a?(Xr(e),u=i.fallback,a=e.mode,d=t.child,p=d.sibling,i=Xo(d,{mode:"hidden",children:i.children}),i.subtreeFlags=d.subtreeFlags&65011712,p!==null?u=Xo(p,u):(u=Es(u,a,n,null),u.flags|=2),u.return=e,i.return=e,i.sibling=u,e.child=i,Rd(null,i),i=e.child,u=t.child.memoizedState,u===null?u=cx(n):(a=u.cachePool,a!==null?(d=mn._currentValue,a=a.parent!==d?{parent:d,pool:d}:a):a=vN(),u={baseLanes:u.baseLanes|n,cachePool:a}),i.memoizedState=u,i.childLanes=fx(t,s,n),e.memoizedState=ux,Rd(t.child,i)):(Qr(e),n=t.child,t=n.sibling,n=Xo(n,{mode:"visible",children:i.children}),n.return=e,n.sibling=null,t!==null&&(s=e.deletions,s===null?(e.deletions=[t],e.flags|=16):s.push(t)),e.child=n,e.memoizedState=null,n)}function iE(t,e){return e=ry({mode:"visible",children:e},t.mode),e.return=t,t.child=e}function ry(t,e){return t=Zi(22,t,null,e),t.lanes=0,t}function dx(t,e,n){return Ms(e,t.child,null,n),t=iE(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function K_(t,e,n){t.lanes|=e;var i=t.alternate;i!==null&&(i.lanes|=e),Gx(t.return,e,n)}function hx(t,e,n,i,a,o){var s=t.memoizedState;s===null?t.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:i,tail:n,tailMode:a,treeForkCount:o}:(s.isBackwards=e,s.rendering=null,s.renderingStartTime=0,s.last=i,s.tail=n,s.tailMode=a,s.treeForkCount=o)}function f3(t,e,n){var i=e.pendingProps,a=i.revealOrder,o=i.tail;i=i.children;var s=rn.current,u=(s&2)!==0;if(u?(s=s&1|2,e.flags|=128):s&=1,Me(rn,s),Fn(t,e,i,n),i=Wt?Fd:0,!u&&t!==null&&t.flags&128)t:for(t=e.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&K_(t,n,e);else if(t.tag===19)K_(t,n,e);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break t;for(;t.sibling===null;){if(t.return===null||t.return===e)break t;t=t.return}t.sibling.return=t.return,t=t.sibling}switch(a){case"forwards":for(n=e.child,a=null;n!==null;)t=n.alternate,t!==null&&ny(t)===null&&(a=n),n=n.sibling;n=a,n===null?(a=e.child,e.child=null):(a=n.sibling,n.sibling=null),hx(e,!1,a,n,o,i);break;case"backwards":case"unstable_legacy-backwards":for(n=null,a=e.child,e.child=null;a!==null;){if(t=a.alternate,t!==null&&ny(t)===null){e.child=a;break}t=a.sibling,a.sibling=n,n=a,a=t}hx(e,!0,n,null,o,i);break;case"together":hx(e,!1,null,null,void 0,i);break;default:e.memoizedState=null}return e.child}function tr(t,e,n){if(t!==null&&(e.dependencies=t.dependencies),hl|=e.lanes,!(n&e.childLanes))if(t!==null){if(Hc(t,e,n,!1),(n&e.childLanes)===0)return null}else return null;if(t!==null&&e.child!==t.child)throw Error(W(153));if(e.child!==null){for(t=e.child,n=Xo(t,t.pendingProps),e.child=n,n.return=e;t.sibling!==null;)t=t.sibling,n=n.sibling=Xo(t,t.pendingProps),n.return=e;n.sibling=null}return e.child}function nA(t,e){return t.lanes&e?!0:(t=t.dependencies,!!(t!==null&&$g(t)))}function $V(t,e,n){switch(e.tag){case 3:Yg(e,e.stateNode.containerInfo),Yr(e,mn,t.memoizedState.cache),Cs();break;case 27:case 5:zx(e);break;case 4:Yg(e,e.stateNode.containerInfo);break;case 10:Yr(e,e.type,e.memoizedProps.value);break;case 31:if(e.memoizedState!==null)return e.flags|=128,Zx(e),null;break;case 13:var i=e.memoizedState;if(i!==null)return i.dehydrated!==null?(Qr(e),e.flags|=128,null):n&e.child.childLanes?c3(t,e,n):(Qr(e),t=tr(t,e,n),t!==null?t.sibling:null);Qr(e);break;case 19:var a=(t.flags&128)!==0;if(i=(n&e.childLanes)!==0,i||(Hc(t,e,n,!1),i=(n&e.childLanes)!==0),a){if(i)return f3(t,e,n);e.flags|=128}if(a=e.memoizedState,a!==null&&(a.rendering=null,a.tail=null,a.lastEffect=null),Me(rn,rn.current),i)break;return null;case 22:return e.lanes=0,u3(t,e,n,e.pendingProps);case 24:Yr(e,mn,t.memoizedState.cache)}return tr(t,e,n)}function d3(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps)gn=!0;else{if(!nA(t,n)&&!(e.flags&128))return gn=!1,$V(t,e,n);gn=!!(t.flags&131072)}else gn=!1,Wt&&e.flags&1048576&&mN(e,Fd,e.index);switch(e.lanes=0,e.tag){case 16:t:{var i=e.pendingProps;if(t=Ss(e.elementType),e.type=t,typeof t=="function")DE(t)?(i=_s(t,i),e.tag=1,e=Q_(null,e,t,i,n)):(e.tag=0,e=nE(null,e,t,i,n));else{if(t!=null){var a=t.$$typeof;if(a===bE){e.tag=11,e=q_(null,e,t,i,n);break t}else if(a===xE){e.tag=14,e=F_(null,e,t,i,n);break t}}throw e=Ox(t)||t,Error(W(306,e,""))}}return e;case 0:return nE(t,e,e.type,e.pendingProps,n);case 1:return i=e.type,a=_s(i,e.pendingProps),Q_(t,e,i,a,n);case 3:t:{if(Yg(e,e.stateNode.containerInfo),t===null)throw Error(W(387));i=e.pendingProps;var o=e.memoizedState;a=o.element,Qx(t,e),Nd(e,i,null,n);var s=e.memoizedState;if(i=s.cache,Yr(e,mn,i),i!==o.cache&&kx(e,[mn],n,!0),zd(),i=s.element,o.isDehydrated)if(o={element:i,isDehydrated:!1,cache:s.cache},e.updateQueue.baseState=o,e.memoizedState=o,e.flags&256){e=X_(t,e,i,n);break t}else if(i!==a){a=Aa(Error(W(424)),e),Gd(a),e=X_(t,e,i,n);break t}else{switch(t=e.stateNode.containerInfo,t.nodeType){case 9:t=t.body;break;default:t=t.nodeName==="HTML"?t.ownerDocument.body:t}for(ze=Ca(t.firstChild),kn=e,Wt=!0,nl=null,Ra=!0,n=xN(e,null,i,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Cs(),i===a){e=tr(t,e,n);break t}Fn(t,e,i,n)}e=e.child}return e;case 26:return Ug(t,e),t===null?(n=yz(e.type,null,e.pendingProps,null))?e.memoizedState=n:Wt||(n=e.type,t=e.pendingProps,i=py(el.current).createElement(n),i[Gn]=e,i[Mi]=t,Qn(i,n,t),In(i),e.stateNode=i):e.memoizedState=yz(e.type,t.memoizedProps,e.pendingProps,t.memoizedState),null;case 27:return zx(e),t===null&&Wt&&(i=e.stateNode=nI(e.type,e.pendingProps,el.current),kn=e,Ra=!0,a=ze,ml(e.type)?(yE=a,ze=Ca(i.firstChild)):ze=a),Fn(t,e,e.pendingProps.children,n),Ug(t,e),t===null&&(e.flags|=4194304),e.child;case 5:return t===null&&Wt&&((a=i=ze)&&(i=w8(i,e.type,e.pendingProps,Ra),i!==null?(e.stateNode=i,kn=e,ze=Ca(i.firstChild),Ra=!1,a=!0):a=!1),a||fl(e)),zx(e),a=e.type,o=e.pendingProps,s=t!==null?t.memoizedProps:null,i=o.children,hE(a,o)?i=null:s!==null&&hE(a,s)&&(e.flags|=32),e.memoizedState!==null&&(a=FE(t,e,GV,null,null,n),Zd._currentValue=a),Ug(t,e),Fn(t,e,i,n),e.child;case 6:return t===null&&Wt&&((t=n=ze)&&(n=M8(n,e.pendingProps,Ra),n!==null?(e.stateNode=n,kn=e,ze=null,t=!0):t=!1),t||fl(e)),null;case 13:return c3(t,e,n);case 4:return Yg(e,e.stateNode.containerInfo),i=e.pendingProps,t===null?e.child=Ms(e,null,i,n):Fn(t,e,i,n),e.child;case 11:return q_(t,e,e.type,e.pendingProps,n);case 7:return Fn(t,e,e.pendingProps,n),e.child;case 8:return Fn(t,e,e.pendingProps.children,n),e.child;case 12:return Fn(t,e,e.pendingProps.children,n),e.child;case 10:return i=e.pendingProps,Yr(e,e.type,i.value),Fn(t,e,i.children,n),e.child;case 9:return a=e.type._context,i=e.pendingProps.children,ws(e),a=Yn(a),i=i(a),e.flags|=1,Fn(t,e,i,n),e.child;case 14:return F_(t,e,e.type,e.pendingProps,n);case 15:return s3(t,e,e.type,e.pendingProps,n);case 19:return f3(t,e,n);case 31:return JV(t,e,n);case 22:return u3(t,e,n,e.pendingProps);case 24:return ws(e),i=Yn(mn),t===null?(a=HE(),a===null&&(a=Te,o=PE(),a.pooledCache=o,o.refCount++,o!==null&&(a.pooledCacheLanes|=n),a=o),e.memoizedState={parent:i,cache:a},VE(e),Yr(e,mn,a)):(t.lanes&n&&(Qx(t,e),Nd(e,null,null,n),zd()),a=t.memoizedState,o=e.memoizedState,a.parent!==i?(a={parent:i,cache:i},e.memoizedState=a,e.lanes===0&&(e.memoizedState=e.updateQueue.baseState=a),Yr(e,mn,i)):(i=o.cache,Yr(e,mn,i),i!==a.cache&&kx(e,[mn],n,!0))),Fn(t,e,e.pendingProps.children,n),e.child;case 29:throw e.pendingProps}throw Error(W(156,e.tag))}function Uo(t){t.flags|=4}function px(t,e,n,i,a){if((e=(t.mode&32)!==0)&&(e=!1),e){if(t.flags|=16777216,(a&335544128)===a)if(t.stateNode.complete)t.flags|=8192;else if(B3())t.flags|=8192;else throw Rs=ty,UE}else t.flags&=-16777217}function Z_(t,e){if(e.type!=="stylesheet"||e.state.loading&4)t.flags&=-16777217;else if(t.flags|=16777216,!oI(e))if(B3())t.flags|=8192;else throw Rs=ty,UE}function Ag(t,e){e!==null&&(t.flags|=4),t.flags&16384&&(e=t.tag!==22?Pz():536870912,t.lanes|=e,zc|=e)}function yd(t,e){if(!Wt)switch(t.tailMode){case"hidden":e=t.tail;for(var n=null;e!==null;)e.alternate!==null&&(n=e),e=e.sibling;n===null?t.tail=null:n.sibling=null;break;case"collapsed":n=t.tail;for(var i=null;n!==null;)n.alternate!==null&&(i=n),n=n.sibling;i===null?e||t.tail===null?t.tail=null:t.tail.sibling=null:i.sibling=null}}function _e(t){var e=t.alternate!==null&&t.alternate.child===t.child,n=0,i=0;if(e)for(var a=t.child;a!==null;)n|=a.lanes|a.childLanes,i|=a.subtreeFlags&65011712,i|=a.flags&65011712,a.return=t,a=a.sibling;else for(a=t.child;a!==null;)n|=a.lanes|a.childLanes,i|=a.subtreeFlags,i|=a.flags,a.return=t,a=a.sibling;return t.subtreeFlags|=i,t.childLanes=n,e}function t8(t,e,n){var i=e.pendingProps;switch(BE(e),e.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return _e(e),null;case 1:return _e(e),null;case 3:return n=e.stateNode,i=null,t!==null&&(i=t.memoizedState.cache),e.memoizedState.cache!==i&&(e.flags|=2048),Ko(mn),Tc(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(t===null||t.child===null)&&(nc(e)?Uo(e):t===null||t.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,ox())),_e(e),null;case 26:var a=e.type,o=e.memoizedState;return t===null?(Uo(e),o!==null?(_e(e),Z_(e,o)):(_e(e),px(e,a,null,i,n))):o?o!==t.memoizedState?(Uo(e),_e(e),Z_(e,o)):(_e(e),e.flags&=-16777217):(t=t.memoizedProps,t!==i&&Uo(e),_e(e),px(e,a,t,i,n)),null;case 27:if(Qg(e),n=el.current,a=e.type,t!==null&&e.stateNode!=null)t.memoizedProps!==i&&Uo(e);else{if(!i){if(e.stateNode===null)throw Error(W(166));return _e(e),null}t=fo.current,nc(e)?T_(e,t):(t=nI(a,i,n),e.stateNode=t,Uo(e))}return _e(e),null;case 5:if(Qg(e),a=e.type,t!==null&&e.stateNode!=null)t.memoizedProps!==i&&Uo(e);else{if(!i){if(e.stateNode===null)throw Error(W(166));return _e(e),null}if(o=fo.current,nc(e))T_(e,o);else{var s=py(el.current);switch(o){case 1:o=s.createElementNS("http://www.w3.org/2000/svg",a);break;case 2:o=s.createElementNS("http://www.w3.org/1998/Math/MathML",a);break;default:switch(a){case"svg":o=s.createElementNS("http://www.w3.org/2000/svg",a);break;case"math":o=s.createElementNS("http://www.w3.org/1998/Math/MathML",a);break;case"script":o=s.createElement("div"),o.innerHTML="<script><\/script>",o=o.removeChild(o.firstChild);break;case"select":o=typeof i.is=="string"?s.createElement("select",{is:i.is}):s.createElement("select"),i.multiple?o.multiple=!0:i.size&&(o.size=i.size);break;default:o=typeof i.is=="string"?s.createElement(a,{is:i.is}):s.createElement(a)}}o[Gn]=e,o[Mi]=i;t:for(s=e.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===e)break t;for(;s.sibling===null;){if(s.return===null||s.return===e)break t;s=s.return}s.sibling.return=s.return,s=s.sibling}e.stateNode=o;t:switch(Qn(o,a,i),a){case"button":case"input":case"select":case"textarea":i=!!i.autoFocus;break t;case"img":i=!0;break t;default:i=!1}i&&Uo(e)}}return _e(e),px(e,e.type,t===null?null:t.memoizedProps,e.pendingProps,n),null;case 6:if(t&&e.stateNode!=null)t.memoizedProps!==i&&Uo(e);else{if(typeof i!="string"&&e.stateNode===null)throw Error(W(166));if(t=el.current,nc(e)){if(t=e.stateNode,n=e.memoizedProps,i=null,a=kn,a!==null)switch(a.tag){case 27:case 5:i=a.memoizedProps}t[Gn]=e,t=!!(t.nodeValue===n||i!==null&&i.suppressHydrationWarning===!0||J3(t.nodeValue,n)),t||fl(e,!0)}else t=py(t).createTextNode(i),t[Gn]=e,e.stateNode=t}return _e(e),null;case 31:if(n=e.memoizedState,t===null||t.memoizedState!==null){if(i=nc(e),n!==null){if(t===null){if(!i)throw Error(W(318));if(t=e.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(W(557));t[Gn]=e}else Cs(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;_e(e),t=!1}else n=ox(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=n),t=!0;if(!t)return e.flags&256?(Ki(e),e):(Ki(e),null);if(e.flags&128)throw Error(W(558))}return _e(e),null;case 13:if(i=e.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(a=nc(e),i!==null&&i.dehydrated!==null){if(t===null){if(!a)throw Error(W(318));if(a=e.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(W(317));a[Gn]=e}else Cs(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;_e(e),a=!1}else a=ox(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=a),a=!0;if(!a)return e.flags&256?(Ki(e),e):(Ki(e),null)}return Ki(e),e.flags&128?(e.lanes=n,e):(n=i!==null,t=t!==null&&t.memoizedState!==null,n&&(i=e.child,a=null,i.alternate!==null&&i.alternate.memoizedState!==null&&i.alternate.memoizedState.cachePool!==null&&(a=i.alternate.memoizedState.cachePool.pool),o=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(o=i.memoizedState.cachePool.pool),o!==a&&(i.flags|=2048)),n!==t&&n&&(e.child.flags|=8192),Ag(e,e.updateQueue),_e(e),null);case 4:return Tc(),t===null&&uA(e.stateNode.containerInfo),_e(e),null;case 10:return Ko(e.type),_e(e),null;case 19:if(Dn(rn),i=e.memoizedState,i===null)return _e(e),null;if(a=(e.flags&128)!==0,o=i.rendering,o===null)if(a)yd(i,!1);else{if(Je!==0||t!==null&&t.flags&128)for(t=e.child;t!==null;){if(o=ny(t),o!==null){for(e.flags|=128,yd(i,!1),t=o.updateQueue,e.updateQueue=t,Ag(e,t),e.subtreeFlags=0,t=n,n=e.child;n!==null;)hN(n,t),n=n.sibling;return Me(rn,rn.current&1|2),Wt&&Fo(e,i.treeForkCount),e.child}t=t.sibling}i.tail!==null&&Ji()>sy&&(e.flags|=128,a=!0,yd(i,!1),e.lanes=4194304)}else{if(!a)if(t=ny(o),t!==null){if(e.flags|=128,a=!0,t=t.updateQueue,e.updateQueue=t,Ag(e,t),yd(i,!0),i.tail===null&&i.tailMode==="hidden"&&!o.alternate&&!Wt)return _e(e),null}else 2*Ji()-i.renderingStartTime>sy&&n!==536870912&&(e.flags|=128,a=!0,yd(i,!1),e.lanes=4194304);i.isBackwards?(o.sibling=e.child,e.child=o):(t=i.last,t!==null?t.sibling=o:e.child=o,i.last=o)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=Ji(),t.sibling=null,n=rn.current,Me(rn,a?n&1|2:n&1),Wt&&Fo(e,i.treeForkCount),t):(_e(e),null);case 22:case 23:return Ki(e),jE(),i=e.memoizedState!==null,t!==null?t.memoizedState!==null!==i&&(e.flags|=8192):i&&(e.flags|=8192),i?n&536870912&&!(e.flags&128)&&(_e(e),e.subtreeFlags&6&&(e.flags|=8192)):_e(e),n=e.updateQueue,n!==null&&Ag(e,n.retryQueue),n=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(n=t.memoizedState.cachePool.pool),i=null,e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(i=e.memoizedState.cachePool.pool),i!==n&&(e.flags|=2048),t!==null&&Dn(As),null;case 24:return n=null,t!==null&&(n=t.memoizedState.cache),e.memoizedState.cache!==n&&(e.flags|=2048),Ko(mn),_e(e),null;case 25:return null;case 30:return null}throw Error(W(156,e.tag))}function e8(t,e){switch(BE(e),e.tag){case 1:return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return Ko(mn),Tc(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 26:case 27:case 5:return Qg(e),null;case 31:if(e.memoizedState!==null){if(Ki(e),e.alternate===null)throw Error(W(340));Cs()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 13:if(Ki(e),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(W(340));Cs()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return Dn(rn),null;case 4:return Tc(),null;case 10:return Ko(e.type),null;case 22:case 23:return Ki(e),jE(),t!==null&&Dn(As),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 24:return Ko(mn),null;case 25:return null;default:return null}}function h3(t,e){switch(BE(e),e.tag){case 3:Ko(mn),Tc();break;case 26:case 27:case 5:Qg(e);break;case 4:Tc();break;case 31:e.memoizedState!==null&&Ki(e);break;case 13:Ki(e);break;case 19:Dn(rn);break;case 10:Ko(e.type);break;case 22:case 23:Ki(e),jE(),t!==null&&Dn(As);break;case 24:Ko(mn)}}function lh(t,e){try{var n=e.updateQueue,i=n!==null?n.lastEffect:null;if(i!==null){var a=i.next;n=a;do{if((n.tag&t)===t){i=void 0;var o=n.create,s=n.inst;i=o(),s.destroy=i}n=n.next}while(n!==a)}}catch(u){he(e,e.return,u)}}function dl(t,e,n){try{var i=e.updateQueue,a=i!==null?i.lastEffect:null;if(a!==null){var o=a.next;i=o;do{if((i.tag&t)===t){var s=i.inst,u=s.destroy;if(u!==void 0){s.destroy=void 0,a=e;var d=n,p=u;try{p()}catch(f){he(a,d,f)}}}i=i.next}while(i!==o)}}catch(f){he(e,e.return,f)}}function p3(t){var e=t.updateQueue;if(e!==null){var n=t.stateNode;try{AN(e,n)}catch(i){he(t,t.return,i)}}}function m3(t,e,n){n.props=_s(t.type,t.memoizedProps),n.state=t.memoizedState;try{n.componentWillUnmount()}catch(i){he(t,e,i)}}function Dd(t,e){try{var n=t.ref;if(n!==null){switch(t.tag){case 26:case 27:case 5:var i=t.stateNode;break;case 30:i=t.stateNode;break;default:i=t.stateNode}typeof n=="function"?t.refCleanup=n(i):n.current=i}}catch(a){he(t,e,a)}}function co(t,e){var n=t.ref,i=t.refCleanup;if(n!==null)if(typeof i=="function")try{i()}catch(a){he(t,e,a)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof n=="function")try{n(null)}catch(a){he(t,e,a)}else n.current=null}function g3(t){var e=t.type,n=t.memoizedProps,i=t.stateNode;try{t:switch(e){case"button":case"input":case"select":case"textarea":n.autoFocus&&i.focus();break t;case"img":n.src?i.src=n.src:n.srcSet&&(i.srcset=n.srcSet)}}catch(a){he(t,t.return,a)}}function mx(t,e,n){try{var i=t.stateNode;x8(i,t.type,n,e),i[Mi]=e}catch(a){he(t,t.return,a)}}function y3(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&ml(t.type)||t.tag===4}function gx(t){t:for(;;){for(;t.sibling===null;){if(t.return===null||y3(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.tag===27&&ml(t.type)||t.flags&2||t.child===null||t.tag===4)continue t;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function aE(t,e,n){var i=t.tag;if(i===5||i===6)t=t.stateNode,e?(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n).insertBefore(t,e):(e=n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,e.appendChild(t),n=n._reactRootContainer,n!=null||e.onclick!==null||(e.onclick=Yo));else if(i!==4&&(i===27&&ml(t.type)&&(n=t.stateNode,e=null),t=t.child,t!==null))for(aE(t,e,n),t=t.sibling;t!==null;)aE(t,e,n),t=t.sibling}function ly(t,e,n){var i=t.tag;if(i===5||i===6)t=t.stateNode,e?n.insertBefore(t,e):n.appendChild(t);else if(i!==4&&(i===27&&ml(t.type)&&(n=t.stateNode),t=t.child,t!==null))for(ly(t,e,n),t=t.sibling;t!==null;)ly(t,e,n),t=t.sibling}function v3(t){var e=t.stateNode,n=t.memoizedProps;try{for(var i=t.type,a=e.attributes;a.length;)e.removeAttributeNode(a[0]);Qn(e,i,n),e[Gn]=t,e[Mi]=n}catch(o){he(t,t.return,o)}}var Go=!1,pn=!1,yx=!1,W_=typeof WeakSet=="function"?WeakSet:Set,Nn=null;function n8(t,e){if(t=t.containerInfo,fE=vy,t=oN(t),zE(t)){if("selectionStart"in t)var n={start:t.selectionStart,end:t.selectionEnd};else t:{n=(n=t.ownerDocument)&&n.defaultView||window;var i=n.getSelection&&n.getSelection();if(i&&i.rangeCount!==0){n=i.anchorNode;var a=i.anchorOffset,o=i.focusNode;i=i.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break t}var s=0,u=-1,d=-1,p=0,f=0,m=t,g=null;e:for(;;){for(var v;m!==n||a!==0&&m.nodeType!==3||(u=s+a),m!==o||i!==0&&m.nodeType!==3||(d=s+i),m.nodeType===3&&(s+=m.nodeValue.length),(v=m.firstChild)!==null;)g=m,m=v;for(;;){if(m===t)break e;if(g===n&&++p===a&&(u=s),g===o&&++f===i&&(d=s),(v=m.nextSibling)!==null)break;m=g,g=m.parentNode}m=v}n=u===-1||d===-1?null:{start:u,end:d}}else n=null}n=n||{start:0,end:0}}else n=null;for(dE={focusedElem:t,selectionRange:n},vy=!1,Nn=e;Nn!==null;)if(e=Nn,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,Nn=t;else for(;Nn!==null;){switch(e=Nn,o=e.alternate,t=e.flags,e.tag){case 0:if(t&4&&(t=e.updateQueue,t=t!==null?t.events:null,t!==null))for(n=0;n<t.length;n++)a=t[n],a.ref.impl=a.nextImpl;break;case 11:case 15:break;case 1:if(t&1024&&o!==null){t=void 0,n=e,a=o.memoizedProps,o=o.memoizedState,i=n.stateNode;try{var S=_s(n.type,a);t=i.getSnapshotBeforeUpdate(S,o),i.__reactInternalSnapshotBeforeUpdate=t}catch(E){he(n,n.return,E)}}break;case 3:if(t&1024){if(t=e.stateNode.containerInfo,n=t.nodeType,n===9)pE(t);else if(n===1)switch(t.nodeName){case"HEAD":case"HTML":case"BODY":pE(t);break;default:t.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if(t&1024)throw Error(W(163))}if(t=e.sibling,t!==null){t.return=e.return,Nn=t;break}Nn=e.return}}function S3(t,e,n){var i=n.flags;switch(n.tag){case 0:case 11:case 15:jo(t,n),i&4&&lh(5,n);break;case 1:if(jo(t,n),i&4)if(t=n.stateNode,e===null)try{t.componentDidMount()}catch(s){he(n,n.return,s)}else{var a=_s(n.type,e.memoizedProps);e=e.memoizedState;try{t.componentDidUpdate(a,e,t.__reactInternalSnapshotBeforeUpdate)}catch(s){he(n,n.return,s)}}i&64&&p3(n),i&512&&Dd(n,n.return);break;case 3:if(jo(t,n),i&64&&(t=n.updateQueue,t!==null)){if(e=null,n.child!==null)switch(n.child.tag){case 27:case 5:e=n.child.stateNode;break;case 1:e=n.child.stateNode}try{AN(t,e)}catch(s){he(n,n.return,s)}}break;case 27:e===null&&i&4&&v3(n);case 26:case 5:jo(t,n),e===null&&i&4&&g3(n),i&512&&Dd(n,n.return);break;case 12:jo(t,n);break;case 31:jo(t,n),i&4&&E3(t,n);break;case 13:jo(t,n),i&4&&A3(t,n),i&64&&(t=n.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(n=f8.bind(null,n),O8(t,n))));break;case 22:if(i=n.memoizedState!==null||Go,!i){e=e!==null&&e.memoizedState!==null||pn,a=Go;var o=pn;Go=i,(pn=e)&&!o?qo(t,n,(n.subtreeFlags&8772)!==0):jo(t,n),Go=a,pn=o}break;case 30:break;default:jo(t,n)}}function b3(t){var e=t.alternate;e!==null&&(t.alternate=null,b3(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&TE(e)),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}var Be=null,Ti=!1;function Vo(t,e,n){for(n=n.child;n!==null;)x3(t,e,n),n=n.sibling}function x3(t,e,n){if($i&&typeof $i.onCommitFiberUnmount=="function")try{$i.onCommitFiberUnmount(th,n)}catch{}switch(n.tag){case 26:pn||co(n,e),Vo(t,e,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:pn||co(n,e);var i=Be,a=Ti;ml(n.type)&&(Be=n.stateNode,Ti=!1),Vo(t,e,n),Hd(n.stateNode),Be=i,Ti=a;break;case 5:pn||co(n,e);case 6:if(i=Be,a=Ti,Be=null,Vo(t,e,n),Be=i,Ti=a,Be!==null)if(Ti)try{(Be.nodeType===9?Be.body:Be.nodeName==="HTML"?Be.ownerDocument.body:Be).removeChild(n.stateNode)}catch(o){he(n,e,o)}else try{Be.removeChild(n.stateNode)}catch(o){he(n,e,o)}break;case 18:Be!==null&&(Ti?(t=Be,dz(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,n.stateNode),Lc(t)):dz(Be,n.stateNode));break;case 4:i=Be,a=Ti,Be=n.stateNode.containerInfo,Ti=!0,Vo(t,e,n),Be=i,Ti=a;break;case 0:case 11:case 14:case 15:dl(2,n,e),pn||dl(4,n,e),Vo(t,e,n);break;case 1:pn||(co(n,e),i=n.stateNode,typeof i.componentWillUnmount=="function"&&m3(n,e,i)),Vo(t,e,n);break;case 21:Vo(t,e,n);break;case 22:pn=(i=pn)||n.memoizedState!==null,Vo(t,e,n),pn=i;break;default:Vo(t,e,n)}}function E3(t,e){if(e.memoizedState===null&&(t=e.alternate,t!==null&&(t=t.memoizedState,t!==null))){t=t.dehydrated;try{Lc(t)}catch(n){he(e,e.return,n)}}}function A3(t,e){if(e.memoizedState===null&&(t=e.alternate,t!==null&&(t=t.memoizedState,t!==null&&(t=t.dehydrated,t!==null))))try{Lc(t)}catch(n){he(e,e.return,n)}}function i8(t){switch(t.tag){case 31:case 13:case 19:var e=t.stateNode;return e===null&&(e=t.stateNode=new W_),e;case 22:return t=t.stateNode,e=t._retryCache,e===null&&(e=t._retryCache=new W_),e;default:throw Error(W(435,t.tag))}}function Rg(t,e){var n=i8(t);e.forEach(function(i){if(!n.has(i)){n.add(i);var a=d8.bind(null,t,i);i.then(a,a)}})}function Ai(t,e){var n=e.deletions;if(n!==null)for(var i=0;i<n.length;i++){var a=n[i],o=t,s=e,u=s;t:for(;u!==null;){switch(u.tag){case 27:if(ml(u.type)){Be=u.stateNode,Ti=!1;break t}break;case 5:Be=u.stateNode,Ti=!1;break t;case 3:case 4:Be=u.stateNode.containerInfo,Ti=!0;break t}u=u.return}if(Be===null)throw Error(W(160));x3(o,s,a),Be=null,Ti=!1,o=a.alternate,o!==null&&(o.return=null),a.return=null}if(e.subtreeFlags&13886)for(e=e.child;e!==null;)R3(e,t),e=e.sibling}var Fa=null;function R3(t,e){var n=t.alternate,i=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:Ai(e,t),Ri(t),i&4&&(dl(3,t,t.return),lh(3,t),dl(5,t,t.return));break;case 1:Ai(e,t),Ri(t),i&512&&(pn||n===null||co(n,n.return)),i&64&&Go&&(t=t.updateQueue,t!==null&&(i=t.callbacks,i!==null&&(n=t.shared.hiddenCallbacks,t.shared.hiddenCallbacks=n===null?i:n.concat(i))));break;case 26:var a=Fa;if(Ai(e,t),Ri(t),i&512&&(pn||n===null||co(n,n.return)),i&4){var o=n!==null?n.memoizedState:null;if(i=t.memoizedState,n===null)if(i===null)if(t.stateNode===null){t:{i=t.type,n=t.memoizedProps,a=a.ownerDocument||a;e:switch(i){case"title":o=a.getElementsByTagName("title")[0],(!o||o[ih]||o[Gn]||o.namespaceURI==="http://www.w3.org/2000/svg"||o.hasAttribute("itemprop"))&&(o=a.createElement(i),a.head.insertBefore(o,a.querySelector("head > title"))),Qn(o,i,n),o[Gn]=t,In(o),i=o;break t;case"link":var s=Sz("link","href",a).get(i+(n.href||""));if(s){for(var u=0;u<s.length;u++)if(o=s[u],o.getAttribute("href")===(n.href==null||n.href===""?null:n.href)&&o.getAttribute("rel")===(n.rel==null?null:n.rel)&&o.getAttribute("title")===(n.title==null?null:n.title)&&o.getAttribute("crossorigin")===(n.crossOrigin==null?null:n.crossOrigin)){s.splice(u,1);break e}}o=a.createElement(i),Qn(o,i,n),a.head.appendChild(o);break;case"meta":if(s=Sz("meta","content",a).get(i+(n.content||""))){for(u=0;u<s.length;u++)if(o=s[u],o.getAttribute("content")===(n.content==null?null:""+n.content)&&o.getAttribute("name")===(n.name==null?null:n.name)&&o.getAttribute("property")===(n.property==null?null:n.property)&&o.getAttribute("http-equiv")===(n.httpEquiv==null?null:n.httpEquiv)&&o.getAttribute("charset")===(n.charSet==null?null:n.charSet)){s.splice(u,1);break e}}o=a.createElement(i),Qn(o,i,n),a.head.appendChild(o);break;default:throw Error(W(468,i))}o[Gn]=t,In(o),i=o}t.stateNode=i}else bz(a,t.type,t.stateNode);else t.stateNode=vz(a,i,t.memoizedProps);else o!==i?(o===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):o.count--,i===null?bz(a,t.type,t.stateNode):vz(a,i,t.memoizedProps)):i===null&&t.stateNode!==null&&mx(t,t.memoizedProps,n.memoizedProps)}break;case 27:Ai(e,t),Ri(t),i&512&&(pn||n===null||co(n,n.return)),n!==null&&i&4&&mx(t,t.memoizedProps,n.memoizedProps);break;case 5:if(Ai(e,t),Ri(t),i&512&&(pn||n===null||co(n,n.return)),t.flags&32){a=t.stateNode;try{wc(a,"")}catch(S){he(t,t.return,S)}}i&4&&t.stateNode!=null&&(a=t.memoizedProps,mx(t,a,n!==null?n.memoizedProps:a)),i&1024&&(yx=!0);break;case 6:if(Ai(e,t),Ri(t),i&4){if(t.stateNode===null)throw Error(W(162));i=t.memoizedProps,n=t.stateNode;try{n.nodeValue=i}catch(S){he(t,t.return,S)}}break;case 3:if(qg=null,a=Fa,Fa=my(e.containerInfo),Ai(e,t),Fa=a,Ri(t),i&4&&n!==null&&n.memoizedState.isDehydrated)try{Lc(e.containerInfo)}catch(S){he(t,t.return,S)}yx&&(yx=!1,T3(t));break;case 4:i=Fa,Fa=my(t.stateNode.containerInfo),Ai(e,t),Ri(t),Fa=i;break;case 12:Ai(e,t),Ri(t);break;case 31:Ai(e,t),Ri(t),i&4&&(i=t.updateQueue,i!==null&&(t.updateQueue=null,Rg(t,i)));break;case 13:Ai(e,t),Ri(t),t.child.flags&8192&&t.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(zy=Ji()),i&4&&(i=t.updateQueue,i!==null&&(t.updateQueue=null,Rg(t,i)));break;case 22:a=t.memoizedState!==null;var d=n!==null&&n.memoizedState!==null,p=Go,f=pn;if(Go=p||a,pn=f||d,Ai(e,t),pn=f,Go=p,Ri(t),i&8192)t:for(e=t.stateNode,e._visibility=a?e._visibility&-2:e._visibility|1,a&&(n===null||d||Go||pn||bs(t)),n=null,e=t;;){if(e.tag===5||e.tag===26){if(n===null){d=n=e;try{if(o=d.stateNode,a)s=o.style,typeof s.setProperty=="function"?s.setProperty("display","none","important"):s.display="none";else{u=d.stateNode;var m=d.memoizedProps.style,g=m!=null&&m.hasOwnProperty("display")?m.display:null;u.style.display=g==null||typeof g=="boolean"?"":(""+g).trim()}}catch(S){he(d,d.return,S)}}}else if(e.tag===6){if(n===null){d=e;try{d.stateNode.nodeValue=a?"":d.memoizedProps}catch(S){he(d,d.return,S)}}}else if(e.tag===18){if(n===null){d=e;try{var v=d.stateNode;a?hz(v,!0):hz(d.stateNode,!1)}catch(S){he(d,d.return,S)}}}else if((e.tag!==22&&e.tag!==23||e.memoizedState===null||e===t)&&e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break t;for(;e.sibling===null;){if(e.return===null||e.return===t)break t;n===e&&(n=null),e=e.return}n===e&&(n=null),e.sibling.return=e.return,e=e.sibling}i&4&&(i=t.updateQueue,i!==null&&(n=i.retryQueue,n!==null&&(i.retryQueue=null,Rg(t,n))));break;case 19:Ai(e,t),Ri(t),i&4&&(i=t.updateQueue,i!==null&&(t.updateQueue=null,Rg(t,i)));break;case 30:break;case 21:break;default:Ai(e,t),Ri(t)}}function Ri(t){var e=t.flags;if(e&2){try{for(var n,i=t.return;i!==null;){if(y3(i)){n=i;break}i=i.return}if(n==null)throw Error(W(160));switch(n.tag){case 27:var a=n.stateNode,o=gx(t);ly(t,o,a);break;case 5:var s=n.stateNode;n.flags&32&&(wc(s,""),n.flags&=-33);var u=gx(t);ly(t,u,s);break;case 3:case 4:var d=n.stateNode.containerInfo,p=gx(t);aE(t,p,d);break;default:throw Error(W(161))}}catch(f){he(t,t.return,f)}t.flags&=-3}e&4096&&(t.flags&=-4097)}function T3(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var e=t;T3(e),e.tag===5&&e.flags&1024&&e.stateNode.reset(),t=t.sibling}}function jo(t,e){if(e.subtreeFlags&8772)for(e=e.child;e!==null;)S3(t,e.alternate,e),e=e.sibling}function bs(t){for(t=t.child;t!==null;){var e=t;switch(e.tag){case 0:case 11:case 14:case 15:dl(4,e,e.return),bs(e);break;case 1:co(e,e.return);var n=e.stateNode;typeof n.componentWillUnmount=="function"&&m3(e,e.return,n),bs(e);break;case 27:Hd(e.stateNode);case 26:case 5:co(e,e.return),bs(e);break;case 22:e.memoizedState===null&&bs(e);break;case 30:bs(e);break;default:bs(e)}t=t.sibling}}function qo(t,e,n){for(n=n&&(e.subtreeFlags&8772)!==0,e=e.child;e!==null;){var i=e.alternate,a=t,o=e,s=o.flags;switch(o.tag){case 0:case 11:case 15:qo(a,o,n),lh(4,o);break;case 1:if(qo(a,o,n),i=o,a=i.stateNode,typeof a.componentDidMount=="function")try{a.componentDidMount()}catch(p){he(i,i.return,p)}if(i=o,a=i.updateQueue,a!==null){var u=i.stateNode;try{var d=a.shared.hiddenCallbacks;if(d!==null)for(a.shared.hiddenCallbacks=null,a=0;a<d.length;a++)EN(d[a],u)}catch(p){he(i,i.return,p)}}n&&s&64&&p3(o),Dd(o,o.return);break;case 27:v3(o);case 26:case 5:qo(a,o,n),n&&i===null&&s&4&&g3(o),Dd(o,o.return);break;case 12:qo(a,o,n);break;case 31:qo(a,o,n),n&&s&4&&E3(a,o);break;case 13:qo(a,o,n),n&&s&4&&A3(a,o);break;case 22:o.memoizedState===null&&qo(a,o,n),Dd(o,o.return);break;case 30:break;default:qo(a,o,n)}e=e.sibling}}function iA(t,e){var n=null;t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(n=t.memoizedState.cachePool.pool),t=null,e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(t=e.memoizedState.cachePool.pool),t!==n&&(t!=null&&t.refCount++,n!=null&&oh(n))}function aA(t,e){t=null,e.alternate!==null&&(t=e.alternate.memoizedState.cache),e=e.memoizedState.cache,e!==t&&(e.refCount++,t!=null&&oh(t))}function qa(t,e,n,i){if(e.subtreeFlags&10256)for(e=e.child;e!==null;)C3(t,e,n,i),e=e.sibling}function C3(t,e,n,i){var a=e.flags;switch(e.tag){case 0:case 11:case 15:qa(t,e,n,i),a&2048&&lh(9,e);break;case 1:qa(t,e,n,i);break;case 3:qa(t,e,n,i),a&2048&&(t=null,e.alternate!==null&&(t=e.alternate.memoizedState.cache),e=e.memoizedState.cache,e!==t&&(e.refCount++,t!=null&&oh(t)));break;case 12:if(a&2048){qa(t,e,n,i),t=e.stateNode;try{var o=e.memoizedProps,s=o.id,u=o.onPostCommit;typeof u=="function"&&u(s,e.alternate===null?"mount":"update",t.passiveEffectDuration,-0)}catch(d){he(e,e.return,d)}}else qa(t,e,n,i);break;case 31:qa(t,e,n,i);break;case 13:qa(t,e,n,i);break;case 23:break;case 22:o=e.stateNode,s=e.alternate,e.memoizedState!==null?o._visibility&2?qa(t,e,n,i):Ld(t,e):o._visibility&2?qa(t,e,n,i):(o._visibility|=2,ac(t,e,n,i,(e.subtreeFlags&10256)!==0||!1)),a&2048&&iA(s,e);break;case 24:qa(t,e,n,i),a&2048&&aA(e.alternate,e);break;default:qa(t,e,n,i)}}function ac(t,e,n,i,a){for(a=a&&((e.subtreeFlags&10256)!==0||!1),e=e.child;e!==null;){var o=t,s=e,u=n,d=i,p=s.flags;switch(s.tag){case 0:case 11:case 15:ac(o,s,u,d,a),lh(8,s);break;case 23:break;case 22:var f=s.stateNode;s.memoizedState!==null?f._visibility&2?ac(o,s,u,d,a):Ld(o,s):(f._visibility|=2,ac(o,s,u,d,a)),a&&p&2048&&iA(s.alternate,s);break;case 24:ac(o,s,u,d,a),a&&p&2048&&aA(s.alternate,s);break;default:ac(o,s,u,d,a)}e=e.sibling}}function Ld(t,e){if(e.subtreeFlags&10256)for(e=e.child;e!==null;){var n=t,i=e,a=i.flags;switch(i.tag){case 22:Ld(n,i),a&2048&&iA(i.alternate,i);break;case 24:Ld(n,i),a&2048&&aA(i.alternate,i);break;default:Ld(n,i)}e=e.sibling}}var Td=8192;function ic(t,e,n){if(t.subtreeFlags&Td)for(t=t.child;t!==null;)w3(t,e,n),t=t.sibling}function w3(t,e,n){switch(t.tag){case 26:ic(t,e,n),t.flags&Td&&t.memoizedState!==null&&j8(n,Fa,t.memoizedState,t.memoizedProps);break;case 5:ic(t,e,n);break;case 3:case 4:var i=Fa;Fa=my(t.stateNode.containerInfo),ic(t,e,n),Fa=i;break;case 22:t.memoizedState===null&&(i=t.alternate,i!==null&&i.memoizedState!==null?(i=Td,Td=16777216,ic(t,e,n),Td=i):ic(t,e,n));break;default:ic(t,e,n)}}function M3(t){var e=t.alternate;if(e!==null&&(t=e.child,t!==null)){e.child=null;do e=t.sibling,t.sibling=null,t=e;while(t!==null)}}function vd(t){var e=t.deletions;if(t.flags&16){if(e!==null)for(var n=0;n<e.length;n++){var i=e[n];Nn=i,_3(i,t)}M3(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)O3(t),t=t.sibling}function O3(t){switch(t.tag){case 0:case 11:case 15:vd(t),t.flags&2048&&dl(9,t,t.return);break;case 3:vd(t);break;case 12:vd(t);break;case 22:var e=t.stateNode;t.memoizedState!==null&&e._visibility&2&&(t.return===null||t.return.tag!==13)?(e._visibility&=-3,Vg(t)):vd(t);break;default:vd(t)}}function Vg(t){var e=t.deletions;if(t.flags&16){if(e!==null)for(var n=0;n<e.length;n++){var i=e[n];Nn=i,_3(i,t)}M3(t)}for(t=t.child;t!==null;){switch(e=t,e.tag){case 0:case 11:case 15:dl(8,e,e.return),Vg(e);break;case 22:n=e.stateNode,n._visibility&2&&(n._visibility&=-3,Vg(e));break;default:Vg(e)}t=t.sibling}}function _3(t,e){for(;Nn!==null;){var n=Nn;switch(n.tag){case 0:case 11:case 15:dl(8,n,e);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var i=n.memoizedState.cachePool.pool;i!=null&&i.refCount++}break;case 24:oh(n.memoizedState.cache)}if(i=n.child,i!==null)i.return=n,Nn=i;else t:for(n=t;Nn!==null;){i=Nn;var a=i.sibling,o=i.return;if(b3(i),i===n){Nn=null;break t}if(a!==null){a.return=o,Nn=a;break t}Nn=o}}}var a8={getCacheForType:function(t){var e=Yn(mn),n=e.data.get(t);return n===void 0&&(n=t(),e.data.set(t,n)),n},cacheSignal:function(){return Yn(mn).controller.signal}},o8=typeof WeakMap=="function"?WeakMap:Map,se=0,Te=null,Yt=null,Xt=0,de=0,Xi=null,Jr=!1,Vc=!1,oA=!1,er=0,Je=0,hl=0,Ts=0,rA=0,Wi=0,zc=0,Bd=null,Ci=null,oE=!1,zy=0,z3=0,sy=1/0,uy=null,ol=null,Tn=0,rl=null,Nc=null,Zo=0,rE=0,lE=null,N3=null,Pd=0,sE=null;function ea(){return se&2&&Xt!==0?Xt&-Xt:_t.T!==null?sA():jz()}function I3(){if(Wi===0)if(!(Xt&536870912)||Wt){var t=pg;pg<<=1,!(pg&3932160)&&(pg=262144),Wi=t}else Wi=536870912;return t=ia.current,t!==null&&(t.flags|=32),Wi}function wi(t,e,n){(t===Te&&(de===2||de===9)||t.cancelPendingCommit!==null)&&(Ic(t,0),$r(t,Xt,Wi,!1)),nh(t,n),(!(se&2)||t!==Te)&&(t===Te&&(!(se&2)&&(Ts|=n),Je===4&&$r(t,Xt,Wi,!1)),po(t))}function D3(t,e,n){if(se&6)throw Error(W(327));var i=!n&&(e&127)===0&&(e&t.expiredLanes)===0||eh(t,e),a=i?s8(t,e):vx(t,e,!0),o=i;do{if(a===0){Vc&&!i&&$r(t,e,0,!1);break}else{if(n=t.current.alternate,o&&!r8(n)){a=vx(t,e,!1),o=!1;continue}if(a===2){if(o=e,t.errorRecoveryDisabledLanes&o)var s=0;else s=t.pendingLanes&-536870913,s=s!==0?s:s&536870912?536870912:0;if(s!==0){e=s;t:{var u=t;a=Bd;var d=u.current.memoizedState.isDehydrated;if(d&&(Ic(u,s).flags|=256),s=vx(u,s,!1),s!==2){if(oA&&!d){u.errorRecoveryDisabledLanes|=o,Ts|=o,a=4;break t}o=Ci,Ci=a,o!==null&&(Ci===null?Ci=o:Ci.push.apply(Ci,o))}a=s}if(o=!1,a!==2)continue}}if(a===1){Ic(t,0),$r(t,e,0,!0);break}t:{switch(i=t,o=a,o){case 0:case 1:throw Error(W(345));case 4:if((e&4194048)!==e)break;case 6:$r(i,e,Wi,!Jr);break t;case 2:Ci=null;break;case 3:case 5:break;default:throw Error(W(329))}if((e&62914560)===e&&(a=zy+300-Ji(),10<a)){if($r(i,e,Wi,!Jr),by(i,0,!0)!==0)break t;Zo=e,i.timeoutHandle=tI(J_.bind(null,i,n,Ci,uy,oE,e,Wi,Ts,zc,Jr,o,"Throttled",-0,0),a);break t}J_(i,n,Ci,uy,oE,e,Wi,Ts,zc,Jr,o,null,-0,0)}}break}while(!0);po(t)}function J_(t,e,n,i,a,o,s,u,d,p,f,m,g,v){if(t.timeoutHandle=-1,m=e.subtreeFlags,m&8192||(m&16785408)===16785408){m={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Yo},w3(e,o,m);var S=(o&62914560)===o?zy-Ji():(o&4194048)===o?z3-Ji():0;if(S=q8(m,S),S!==null){Zo=o,t.cancelPendingCommit=S(tz.bind(null,t,e,o,n,i,a,s,u,d,f,m,null,g,v)),$r(t,o,s,!p);return}}tz(t,e,o,n,i,a,s,u,d)}function r8(t){for(var e=t;;){var n=e.tag;if((n===0||n===11||n===15)&&e.flags&16384&&(n=e.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var i=0;i<n.length;i++){var a=n[i],o=a.getSnapshot;a=a.value;try{if(!na(o(),a))return!1}catch{return!1}}if(n=e.child,e.subtreeFlags&16384&&n!==null)n.return=e,e=n;else{if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return!0;e=e.return}e.sibling.return=e.return,e=e.sibling}}return!0}function $r(t,e,n,i){e&=~rA,e&=~Ts,t.suspendedLanes|=e,t.pingedLanes&=~e,i&&(t.warmLanes|=e),i=t.expirationTimes;for(var a=e;0<a;){var o=31-ta(a),s=1<<o;i[o]=-1,a&=~s}n!==0&&Hz(t,n,e)}function Ny(){return se&6?!0:(sh(0,!1),!1)}function lA(){if(Yt!==null){if(de===0)var t=Yt.return;else t=Yt,Qo=Ls=null,YE(t),Ec=null,kd=0,t=Yt;for(;t!==null;)h3(t.alternate,t),t=t.return;Yt=null}}function Ic(t,e){var n=t.timeoutHandle;n!==-1&&(t.timeoutHandle=-1,R8(n)),n=t.cancelPendingCommit,n!==null&&(t.cancelPendingCommit=null,n()),Zo=0,lA(),Te=t,Yt=n=Xo(t.current,null),Xt=e,de=0,Xi=null,Jr=!1,Vc=eh(t,e),oA=!1,zc=Wi=rA=Ts=hl=Je=0,Ci=Bd=null,oE=!1,e&8&&(e|=e&32);var i=t.entangledLanes;if(i!==0)for(t=t.entanglements,i&=e;0<i;){var a=31-ta(i),o=1<<a;e|=t[a],i&=~o}return er=e,Ry(),n}function L3(t,e){Ht=null,_t.H=Qd,e===Uc||e===Cy?(e=__(),de=3):e===UE?(e=__(),de=4):de=e===eA?8:e!==null&&typeof e=="object"&&typeof e.then=="function"?6:1,Xi=e,Yt===null&&(Je=1,oy(t,Aa(e,t.current)))}function B3(){var t=ia.current;return t===null?!0:(Xt&4194048)===Xt?Ta===null:(Xt&62914560)===Xt||Xt&536870912?t===Ta:!1}function P3(){var t=_t.H;return _t.H=Qd,t===null?Qd:t}function H3(){var t=_t.A;return _t.A=a8,t}function cy(){Je=4,Jr||(Xt&4194048)!==Xt&&ia.current!==null||(Vc=!0),!(hl&134217727)&&!(Ts&134217727)||Te===null||$r(Te,Xt,Wi,!1)}function vx(t,e,n){var i=se;se|=2;var a=P3(),o=H3();(Te!==t||Xt!==e)&&(uy=null,Ic(t,e)),e=!1;var s=Je;t:do try{if(de!==0&&Yt!==null){var u=Yt,d=Xi;switch(de){case 8:lA(),s=6;break t;case 3:case 2:case 9:case 6:ia.current===null&&(e=!0);var p=de;if(de=0,Xi=null,yc(t,u,d,p),n&&Vc){s=0;break t}break;default:p=de,de=0,Xi=null,yc(t,u,d,p)}}l8(),s=Je;break}catch(f){L3(t,f)}while(!0);return e&&t.shellSuspendCounter++,Qo=Ls=null,se=i,_t.H=a,_t.A=o,Yt===null&&(Te=null,Xt=0,Ry()),s}function l8(){for(;Yt!==null;)U3(Yt)}function s8(t,e){var n=se;se|=2;var i=P3(),a=H3();Te!==t||Xt!==e?(uy=null,sy=Ji()+500,Ic(t,e)):Vc=eh(t,e);t:do try{if(de!==0&&Yt!==null){e=Yt;var o=Xi;e:switch(de){case 1:de=0,Xi=null,yc(t,e,o,1);break;case 2:case 9:if(O_(o)){de=0,Xi=null,$_(e);break}e=function(){de!==2&&de!==9||Te!==t||(de=7),po(t)},o.then(e,e);break t;case 3:de=7;break t;case 4:de=5;break t;case 7:O_(o)?(de=0,Xi=null,$_(e)):(de=0,Xi=null,yc(t,e,o,7));break;case 5:var s=null;switch(Yt.tag){case 26:s=Yt.memoizedState;case 5:case 27:var u=Yt;if(s?oI(s):u.stateNode.complete){de=0,Xi=null;var d=u.sibling;if(d!==null)Yt=d;else{var p=u.return;p!==null?(Yt=p,Iy(p)):Yt=null}break e}}de=0,Xi=null,yc(t,e,o,5);break;case 6:de=0,Xi=null,yc(t,e,o,6);break;case 8:lA(),Je=6;break t;default:throw Error(W(462))}}u8();break}catch(f){L3(t,f)}while(!0);return Qo=Ls=null,_t.H=i,_t.A=a,se=n,Yt!==null?0:(Te=null,Xt=0,Ry(),Je)}function u8(){for(;Yt!==null&&!NU();)U3(Yt)}function U3(t){var e=d3(t.alternate,t,er);t.memoizedProps=t.pendingProps,e===null?Iy(t):Yt=e}function $_(t){var e=t,n=e.alternate;switch(e.tag){case 15:case 0:e=Y_(n,e,e.pendingProps,e.type,void 0,Xt);break;case 11:e=Y_(n,e,e.pendingProps,e.type.render,e.ref,Xt);break;case 5:YE(e);default:h3(n,e),e=Yt=hN(e,er),e=d3(n,e,er)}t.memoizedProps=t.pendingProps,e===null?Iy(t):Yt=e}function yc(t,e,n,i){Qo=Ls=null,YE(e),Ec=null,kd=0;var a=e.return;try{if(WV(t,a,e,n,Xt)){Je=1,oy(t,Aa(n,t.current)),Yt=null;return}}catch(o){if(a!==null)throw Yt=a,o;Je=1,oy(t,Aa(n,t.current)),Yt=null;return}e.flags&32768?(Wt||i===1?t=!0:Vc||Xt&536870912?t=!1:(Jr=t=!0,(i===2||i===9||i===3||i===6)&&(i=ia.current,i!==null&&i.tag===13&&(i.flags|=16384))),V3(e,t)):Iy(e)}function Iy(t){var e=t;do{if(e.flags&32768){V3(e,Jr);return}t=e.return;var n=t8(e.alternate,e,er);if(n!==null){Yt=n;return}if(e=e.sibling,e!==null){Yt=e;return}Yt=e=t}while(e!==null);Je===0&&(Je=5)}function V3(t,e){do{var n=e8(t.alternate,t);if(n!==null){n.flags&=32767,Yt=n;return}if(n=t.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!e&&(t=t.sibling,t!==null)){Yt=t;return}Yt=t=n}while(t!==null);Je=6,Yt=null}function tz(t,e,n,i,a,o,s,u,d){t.cancelPendingCommit=null;do Dy();while(Tn!==0);if(se&6)throw Error(W(327));if(e!==null){if(e===t.current)throw Error(W(177));if(o=e.lanes|e.childLanes,o|=NE,qU(t,n,o,s,u,d),t===Te&&(Yt=Te=null,Xt=0),Nc=e,rl=t,Zo=n,rE=o,lE=a,N3=i,e.subtreeFlags&10256||e.flags&10256?(t.callbackNode=null,t.callbackPriority=0,h8(Xg,function(){return k3(),null})):(t.callbackNode=null,t.callbackPriority=0),i=(e.flags&13878)!==0,e.subtreeFlags&13878||i){i=_t.T,_t.T=null,a=ue.p,ue.p=2,s=se,se|=4;try{n8(t,e,n)}finally{se=s,ue.p=a,_t.T=i}}Tn=1,j3(),q3(),F3()}}function j3(){if(Tn===1){Tn=0;var t=rl,e=Nc,n=(e.flags&13878)!==0;if(e.subtreeFlags&13878||n){n=_t.T,_t.T=null;var i=ue.p;ue.p=2;var a=se;se|=4;try{R3(e,t);var o=dE,s=oN(t.containerInfo),u=o.focusedElem,d=o.selectionRange;if(s!==u&&u&&u.ownerDocument&&aN(u.ownerDocument.documentElement,u)){if(d!==null&&zE(u)){var p=d.start,f=d.end;if(f===void 0&&(f=p),"selectionStart"in u)u.selectionStart=p,u.selectionEnd=Math.min(f,u.value.length);else{var m=u.ownerDocument||document,g=m&&m.defaultView||window;if(g.getSelection){var v=g.getSelection(),S=u.textContent.length,E=Math.min(d.start,S),T=d.end===void 0?E:Math.min(d.end,S);!v.extend&&E>T&&(s=T,T=E,E=s);var A=E_(u,E),x=E_(u,T);if(A&&x&&(v.rangeCount!==1||v.anchorNode!==A.node||v.anchorOffset!==A.offset||v.focusNode!==x.node||v.focusOffset!==x.offset)){var R=m.createRange();R.setStart(A.node,A.offset),v.removeAllRanges(),E>T?(v.addRange(R),v.extend(x.node,x.offset)):(R.setEnd(x.node,x.offset),v.addRange(R))}}}}for(m=[],v=u;v=v.parentNode;)v.nodeType===1&&m.push({element:v,left:v.scrollLeft,top:v.scrollTop});for(typeof u.focus=="function"&&u.focus(),u=0;u<m.length;u++){var C=m[u];C.element.scrollLeft=C.left,C.element.scrollTop=C.top}}vy=!!fE,dE=fE=null}finally{se=a,ue.p=i,_t.T=n}}t.current=e,Tn=2}}function q3(){if(Tn===2){Tn=0;var t=rl,e=Nc,n=(e.flags&8772)!==0;if(e.subtreeFlags&8772||n){n=_t.T,_t.T=null;var i=ue.p;ue.p=2;var a=se;se|=4;try{S3(t,e.alternate,e)}finally{se=a,ue.p=i,_t.T=n}}Tn=3}}function F3(){if(Tn===4||Tn===3){Tn=0,IU();var t=rl,e=Nc,n=Zo,i=N3;e.subtreeFlags&10256||e.flags&10256?Tn=5:(Tn=0,Nc=rl=null,G3(t,t.pendingLanes));var a=t.pendingLanes;if(a===0&&(ol=null),RE(n),e=e.stateNode,$i&&typeof $i.onCommitFiberRoot=="function")try{$i.onCommitFiberRoot(th,e,void 0,(e.current.flags&128)===128)}catch{}if(i!==null){e=_t.T,a=ue.p,ue.p=2,_t.T=null;try{for(var o=t.onRecoverableError,s=0;s<i.length;s++){var u=i[s];o(u.value,{componentStack:u.stack})}}finally{_t.T=e,ue.p=a}}Zo&3&&Dy(),po(t),a=t.pendingLanes,n&261930&&a&42?t===sE?Pd++:(Pd=0,sE=t):Pd=0,sh(0,!1)}}function G3(t,e){(t.pooledCacheLanes&=e)===0&&(e=t.pooledCache,e!=null&&(t.pooledCache=null,oh(e)))}function Dy(){return j3(),q3(),F3(),k3()}function k3(){if(Tn!==5)return!1;var t=rl,e=rE;rE=0;var n=RE(Zo),i=_t.T,a=ue.p;try{ue.p=32>n?32:n,_t.T=null,n=lE,lE=null;var o=rl,s=Zo;if(Tn=0,Nc=rl=null,Zo=0,se&6)throw Error(W(331));var u=se;if(se|=4,O3(o.current),C3(o,o.current,s,n),se=u,sh(0,!1),$i&&typeof $i.onPostCommitFiberRoot=="function")try{$i.onPostCommitFiberRoot(th,o)}catch{}return!0}finally{ue.p=a,_t.T=i,G3(t,e)}}function ez(t,e,n){e=Aa(n,e),e=eE(t.stateNode,e,2),t=al(t,e,2),t!==null&&(nh(t,2),po(t))}function he(t,e,n){if(t.tag===3)ez(t,t,n);else for(;e!==null;){if(e.tag===3){ez(e,t,n);break}else if(e.tag===1){var i=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof i.componentDidCatch=="function"&&(ol===null||!ol.has(i))){t=Aa(n,t),n=r3(2),i=al(e,n,2),i!==null&&(l3(n,i,e,t),nh(i,2),po(i));break}}e=e.return}}function Sx(t,e,n){var i=t.pingCache;if(i===null){i=t.pingCache=new o8;var a=new Set;i.set(e,a)}else a=i.get(e),a===void 0&&(a=new Set,i.set(e,a));a.has(n)||(oA=!0,a.add(n),t=c8.bind(null,t,e,n),e.then(t,t))}function c8(t,e,n){var i=t.pingCache;i!==null&&i.delete(e),t.pingedLanes|=t.suspendedLanes&n,t.warmLanes&=~n,Te===t&&(Xt&n)===n&&(Je===4||Je===3&&(Xt&62914560)===Xt&&300>Ji()-zy?!(se&2)&&Ic(t,0):rA|=n,zc===Xt&&(zc=0)),po(t)}function Y3(t,e){e===0&&(e=Pz()),t=Ds(t,e),t!==null&&(nh(t,e),po(t))}function f8(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),Y3(t,n)}function d8(t,e){var n=0;switch(t.tag){case 31:case 13:var i=t.stateNode,a=t.memoizedState;a!==null&&(n=a.retryLane);break;case 19:i=t.stateNode;break;case 22:i=t.stateNode._retryCache;break;default:throw Error(W(314))}i!==null&&i.delete(e),Y3(t,n)}function h8(t,e){return EE(t,e)}var fy=null,oc=null,uE=!1,dy=!1,bx=!1,tl=0;function po(t){t!==oc&&t.next===null&&(oc===null?fy=oc=t:oc=oc.next=t),dy=!0,uE||(uE=!0,m8())}function sh(t,e){if(!bx&&dy){bx=!0;do for(var n=!1,i=fy;i!==null;){if(!e)if(t!==0){var a=i.pendingLanes;if(a===0)var o=0;else{var s=i.suspendedLanes,u=i.pingedLanes;o=(1<<31-ta(42|t)+1)-1,o&=a&~(s&~u),o=o&201326741?o&201326741|1:o?o|2:0}o!==0&&(n=!0,nz(i,o))}else o=Xt,o=by(i,i===Te?o:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),!(o&3)||eh(i,o)||(n=!0,nz(i,o));i=i.next}while(n);bx=!1}}function p8(){Q3()}function Q3(){dy=uE=!1;var t=0;tl!==0&&A8()&&(t=tl);for(var e=Ji(),n=null,i=fy;i!==null;){var a=i.next,o=X3(i,e);o===0?(i.next=null,n===null?fy=a:n.next=a,a===null&&(oc=n)):(n=i,(t!==0||o&3)&&(dy=!0)),i=a}Tn!==0&&Tn!==5||sh(t,!1),tl!==0&&(tl=0)}function X3(t,e){for(var n=t.suspendedLanes,i=t.pingedLanes,a=t.expirationTimes,o=t.pendingLanes&-62914561;0<o;){var s=31-ta(o),u=1<<s,d=a[s];d===-1?(!(u&n)||u&i)&&(a[s]=jU(u,e)):d<=e&&(t.expiredLanes|=u),o&=~u}if(e=Te,n=Xt,n=by(t,t===e?n:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),i=t.callbackNode,n===0||t===e&&(de===2||de===9)||t.cancelPendingCommit!==null)return i!==null&&i!==null&&K1(i),t.callbackNode=null,t.callbackPriority=0;if(!(n&3)||eh(t,n)){if(e=n&-n,e===t.callbackPriority)return e;switch(i!==null&&K1(i),RE(n)){case 2:case 8:n=Lz;break;case 32:n=Xg;break;case 268435456:n=Bz;break;default:n=Xg}return i=K3.bind(null,t),n=EE(n,i),t.callbackPriority=e,t.callbackNode=n,e}return i!==null&&i!==null&&K1(i),t.callbackPriority=2,t.callbackNode=null,2}function K3(t,e){if(Tn!==0&&Tn!==5)return t.callbackNode=null,t.callbackPriority=0,null;var n=t.callbackNode;if(Dy()&&t.callbackNode!==n)return null;var i=Xt;return i=by(t,t===Te?i:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),i===0?null:(D3(t,i,e),X3(t,Ji()),t.callbackNode!=null&&t.callbackNode===n?K3.bind(null,t):null)}function nz(t,e){if(Dy())return null;D3(t,e,!0)}function m8(){T8(function(){se&6?EE(Dz,p8):Q3()})}function sA(){if(tl===0){var t=Mc;t===0&&(t=hg,hg<<=1,!(hg&261888)&&(hg=256)),tl=t}return tl}function iz(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:zg(""+t)}function az(t,e){var n=e.ownerDocument.createElement("input");return n.name=e.name,n.value=e.value,t.id&&n.setAttribute("form",t.id),e.parentNode.insertBefore(n,e),t=new FormData(t),n.parentNode.removeChild(n),t}function g8(t,e,n,i,a){if(e==="submit"&&n&&n.stateNode===a){var o=iz((a[Mi]||null).action),s=i.submitter;s&&(e=(e=s[Mi]||null)?iz(e.formAction):s.getAttribute("formAction"),e!==null&&(o=e,s=null));var u=new xy("action","action",null,i,a);t.push({event:u,listeners:[{instance:null,listener:function(){if(i.defaultPrevented){if(tl!==0){var d=s?az(a,s):new FormData(a);$x(n,{pending:!0,data:d,method:a.method,action:o},null,d)}}else typeof o=="function"&&(u.preventDefault(),d=s?az(a,s):new FormData(a),$x(n,{pending:!0,data:d,method:a.method,action:o},o,d))},currentTarget:a}]})}}for(Tg=0;Tg<jx.length;Tg++)Cg=jx[Tg],oz=Cg.toLowerCase(),rz=Cg[0].toUpperCase()+Cg.slice(1),Ga(oz,"on"+rz);var Cg,oz,rz,Tg;Ga(lN,"onAnimationEnd");Ga(sN,"onAnimationIteration");Ga(uN,"onAnimationStart");Ga("dblclick","onDoubleClick");Ga("focusin","onFocus");Ga("focusout","onBlur");Ga(DV,"onTransitionRun");Ga(LV,"onTransitionStart");Ga(BV,"onTransitionCancel");Ga(cN,"onTransitionEnd");Cc("onMouseEnter",["mouseout","mouseover"]);Cc("onMouseLeave",["mouseout","mouseover"]);Cc("onPointerEnter",["pointerout","pointerover"]);Cc("onPointerLeave",["pointerout","pointerover"]);zs("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));zs("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));zs("onBeforeInput",["compositionend","keypress","textInput","paste"]);zs("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));zs("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));zs("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Xd="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),y8=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Xd));function Z3(t,e){e=(e&4)!==0;for(var n=0;n<t.length;n++){var i=t[n],a=i.event;i=i.listeners;t:{var o=void 0;if(e)for(var s=i.length-1;0<=s;s--){var u=i[s],d=u.instance,p=u.currentTarget;if(u=u.listener,d!==o&&a.isPropagationStopped())break t;o=u,a.currentTarget=p;try{o(a)}catch(f){Zg(f)}a.currentTarget=null,o=d}else for(s=0;s<i.length;s++){if(u=i[s],d=u.instance,p=u.currentTarget,u=u.listener,d!==o&&a.isPropagationStopped())break t;o=u,a.currentTarget=p;try{o(a)}catch(f){Zg(f)}a.currentTarget=null,o=d}}}}function kt(t,e){var n=e[Ix];n===void 0&&(n=e[Ix]=new Set);var i=t+"__bubble";n.has(i)||(W3(e,t,2,!1),n.add(i))}function xx(t,e,n){var i=0;e&&(i|=4),W3(n,t,i,e)}var wg="_reactListening"+Math.random().toString(36).slice(2);function uA(t){if(!t[wg]){t[wg]=!0,qz.forEach(function(n){n!=="selectionchange"&&(y8.has(n)||xx(n,!1,t),xx(n,!0,t))});var e=t.nodeType===9?t:t.ownerDocument;e===null||e[wg]||(e[wg]=!0,xx("selectionchange",!1,e))}}function W3(t,e,n,i){switch(cI(e)){case 2:var a=k8;break;case 8:a=Y8;break;default:a=hA}n=a.bind(null,e,n,t),a=void 0,!Hx||e!=="touchstart"&&e!=="touchmove"&&e!=="wheel"||(a=!0),i?a!==void 0?t.addEventListener(e,n,{capture:!0,passive:a}):t.addEventListener(e,n,!0):a!==void 0?t.addEventListener(e,n,{passive:a}):t.addEventListener(e,n,!1)}function Ex(t,e,n,i,a){var o=i;if(!(e&1)&&!(e&2)&&i!==null)t:for(;;){if(i===null)return;var s=i.tag;if(s===3||s===4){var u=i.stateNode.containerInfo;if(u===a)break;if(s===4)for(s=i.return;s!==null;){var d=s.tag;if((d===3||d===4)&&s.stateNode.containerInfo===a)return;s=s.return}for(;u!==null;){if(s=sc(u),s===null)return;if(d=s.tag,d===5||d===6||d===26||d===27){i=o=s;continue t}u=u.parentNode}}i=i.return}Zz(function(){var p=o,f=wE(n),m=[];t:{var g=fN.get(t);if(g!==void 0){var v=xy,S=t;switch(t){case"keypress":if(Ig(n)===0)break t;case"keydown":case"keyup":v=dV;break;case"focusin":S="focus",v=tx;break;case"focusout":S="blur",v=tx;break;case"beforeblur":case"afterblur":v=tx;break;case"click":if(n.button===2)break t;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":v=h_;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":v=tV;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":v=mV;break;case lN:case sN:case uN:v=iV;break;case cN:v=yV;break;case"scroll":case"scrollend":v=JU;break;case"wheel":v=SV;break;case"copy":case"cut":case"paste":v=oV;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":v=m_;break;case"toggle":case"beforetoggle":v=xV}var E=(e&4)!==0,T=!E&&(t==="scroll"||t==="scrollend"),A=E?g!==null?g+"Capture":null:g;E=[];for(var x=p,R;x!==null;){var C=x;if(R=C.stateNode,C=C.tag,C!==5&&C!==26&&C!==27||R===null||A===null||(C=Vd(x,A),C!=null&&E.push(Kd(x,C,R))),T)break;x=x.return}0<E.length&&(g=new v(g,S,null,n,f),m.push({event:g,listeners:E}))}}if(!(e&7)){t:{if(g=t==="mouseover"||t==="pointerover",v=t==="mouseout"||t==="pointerout",g&&n!==Px&&(S=n.relatedTarget||n.fromElement)&&(sc(S)||S[Bc]))break t;if((v||g)&&(g=f.window===f?f:(g=f.ownerDocument)?g.defaultView||g.parentWindow:window,v?(S=n.relatedTarget||n.toElement,v=p,S=S?sc(S):null,S!==null&&(T=$d(S),E=S.tag,S!==T||E!==5&&E!==27&&E!==6)&&(S=null)):(v=null,S=p),v!==S)){if(E=h_,C="onMouseLeave",A="onMouseEnter",x="mouse",(t==="pointerout"||t==="pointerover")&&(E=m_,C="onPointerLeave",A="onPointerEnter",x="pointer"),T=v==null?g:Ad(v),R=S==null?g:Ad(S),g=new E(C,x+"leave",v,n,f),g.target=T,g.relatedTarget=R,C=null,sc(f)===p&&(E=new E(A,x+"enter",S,n,f),E.target=R,E.relatedTarget=T,C=E),T=C,v&&S)e:{for(E=v8,A=v,x=S,R=0,C=A;C;C=E(C))R++;C=0;for(var M=x;M;M=E(M))C++;for(;0<R-C;)A=E(A),R--;for(;0<C-R;)x=E(x),C--;for(;R--;){if(A===x||x!==null&&A===x.alternate){E=A;break e}A=E(A),x=E(x)}E=null}else E=null;v!==null&&lz(m,g,v,E,!1),S!==null&&T!==null&&lz(m,T,S,E,!0)}}t:{if(g=p?Ad(p):window,v=g.nodeName&&g.nodeName.toLowerCase(),v==="select"||v==="input"&&g.type==="file")var z=S_;else if(v_(g))if(nN)z=zV;else{z=OV;var N=MV}else v=g.nodeName,!v||v.toLowerCase()!=="input"||g.type!=="checkbox"&&g.type!=="radio"?p&&CE(p.elementType)&&(z=S_):z=_V;if(z&&(z=z(t,p))){eN(m,z,n,f);break t}N&&N(t,g,p),t==="focusout"&&p&&g.type==="number"&&p.memoizedProps.value!=null&&Bx(g,"number",g.value)}switch(N=p?Ad(p):window,t){case"focusin":(v_(N)||N.contentEditable==="true")&&(fc=N,Ux=p,Md=null);break;case"focusout":Md=Ux=fc=null;break;case"mousedown":Vx=!0;break;case"contextmenu":case"mouseup":case"dragend":Vx=!1,A_(m,n,f);break;case"selectionchange":if(IV)break;case"keydown":case"keyup":A_(m,n,f)}var D;if(_E)t:{switch(t){case"compositionstart":var q="onCompositionStart";break t;case"compositionend":q="onCompositionEnd";break t;case"compositionupdate":q="onCompositionUpdate";break t}q=void 0}else cc?$z(t,n)&&(q="onCompositionEnd"):t==="keydown"&&n.keyCode===229&&(q="onCompositionStart");q&&(Jz&&n.locale!=="ko"&&(cc||q!=="onCompositionStart"?q==="onCompositionEnd"&&cc&&(D=Wz()):(Wr=f,ME="value"in Wr?Wr.value:Wr.textContent,cc=!0)),N=hy(p,q),0<N.length&&(q=new p_(q,t,null,n,f),m.push({event:q,listeners:N}),D?q.data=D:(D=tN(n),D!==null&&(q.data=D)))),(D=AV?RV(t,n):TV(t,n))&&(q=hy(p,"onBeforeInput"),0<q.length&&(N=new p_("onBeforeInput","beforeinput",null,n,f),m.push({event:N,listeners:q}),N.data=D)),g8(m,t,p,n,f)}Z3(m,e)})}function Kd(t,e,n){return{instance:t,listener:e,currentTarget:n}}function hy(t,e){for(var n=e+"Capture",i=[];t!==null;){var a=t,o=a.stateNode;if(a=a.tag,a!==5&&a!==26&&a!==27||o===null||(a=Vd(t,n),a!=null&&i.unshift(Kd(t,a,o)),a=Vd(t,e),a!=null&&i.push(Kd(t,a,o))),t.tag===3)return i;t=t.return}return[]}function v8(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function lz(t,e,n,i,a){for(var o=e._reactName,s=[];n!==null&&n!==i;){var u=n,d=u.alternate,p=u.stateNode;if(u=u.tag,d!==null&&d===i)break;u!==5&&u!==26&&u!==27||p===null||(d=p,a?(p=Vd(n,o),p!=null&&s.unshift(Kd(n,p,d))):a||(p=Vd(n,o),p!=null&&s.push(Kd(n,p,d)))),n=n.return}s.length!==0&&t.push({event:e,listeners:s})}var S8=/\r\n?/g,b8=/\u0000|\uFFFD/g;function sz(t){return(typeof t=="string"?t:""+t).replace(S8,`
|
|
20
|
-
`).replace(b8,"")}function J3(t,e){return e=sz(e),sz(t)===e}function be(t,e,n,i,a,o){switch(n){case"children":typeof i=="string"?e==="body"||e==="textarea"&&i===""||wc(t,i):(typeof i=="number"||typeof i=="bigint")&&e!=="body"&&wc(t,""+i);break;case"className":gg(t,"class",i);break;case"tabIndex":gg(t,"tabindex",i);break;case"dir":case"role":case"viewBox":case"width":case"height":gg(t,n,i);break;case"style":Kz(t,i,o);break;case"data":if(e!=="object"){gg(t,"data",i);break}case"src":case"href":if(i===""&&(e!=="a"||n!=="href")){t.removeAttribute(n);break}if(i==null||typeof i=="function"||typeof i=="symbol"||typeof i=="boolean"){t.removeAttribute(n);break}i=zg(""+i),t.setAttribute(n,i);break;case"action":case"formAction":if(typeof i=="function"){t.setAttribute(n,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof o=="function"&&(n==="formAction"?(e!=="input"&&be(t,e,"name",a.name,a,null),be(t,e,"formEncType",a.formEncType,a,null),be(t,e,"formMethod",a.formMethod,a,null),be(t,e,"formTarget",a.formTarget,a,null)):(be(t,e,"encType",a.encType,a,null),be(t,e,"method",a.method,a,null),be(t,e,"target",a.target,a,null)));if(i==null||typeof i=="symbol"||typeof i=="boolean"){t.removeAttribute(n);break}i=zg(""+i),t.setAttribute(n,i);break;case"onClick":i!=null&&(t.onclick=Yo);break;case"onScroll":i!=null&&kt("scroll",t);break;case"onScrollEnd":i!=null&&kt("scrollend",t);break;case"dangerouslySetInnerHTML":if(i!=null){if(typeof i!="object"||!("__html"in i))throw Error(W(61));if(n=i.__html,n!=null){if(a.children!=null)throw Error(W(60));t.innerHTML=n}}break;case"multiple":t.multiple=i&&typeof i!="function"&&typeof i!="symbol";break;case"muted":t.muted=i&&typeof i!="function"&&typeof i!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(i==null||typeof i=="function"||typeof i=="boolean"||typeof i=="symbol"){t.removeAttribute("xlink:href");break}n=zg(""+i),t.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",n);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":i!=null&&typeof i!="function"&&typeof i!="symbol"?t.setAttribute(n,""+i):t.removeAttribute(n);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":i&&typeof i!="function"&&typeof i!="symbol"?t.setAttribute(n,""):t.removeAttribute(n);break;case"capture":case"download":i===!0?t.setAttribute(n,""):i!==!1&&i!=null&&typeof i!="function"&&typeof i!="symbol"?t.setAttribute(n,i):t.removeAttribute(n);break;case"cols":case"rows":case"size":case"span":i!=null&&typeof i!="function"&&typeof i!="symbol"&&!isNaN(i)&&1<=i?t.setAttribute(n,i):t.removeAttribute(n);break;case"rowSpan":case"start":i==null||typeof i=="function"||typeof i=="symbol"||isNaN(i)?t.removeAttribute(n):t.setAttribute(n,i);break;case"popover":kt("beforetoggle",t),kt("toggle",t),_g(t,"popover",i);break;case"xlinkActuate":Ho(t,"http://www.w3.org/1999/xlink","xlink:actuate",i);break;case"xlinkArcrole":Ho(t,"http://www.w3.org/1999/xlink","xlink:arcrole",i);break;case"xlinkRole":Ho(t,"http://www.w3.org/1999/xlink","xlink:role",i);break;case"xlinkShow":Ho(t,"http://www.w3.org/1999/xlink","xlink:show",i);break;case"xlinkTitle":Ho(t,"http://www.w3.org/1999/xlink","xlink:title",i);break;case"xlinkType":Ho(t,"http://www.w3.org/1999/xlink","xlink:type",i);break;case"xmlBase":Ho(t,"http://www.w3.org/XML/1998/namespace","xml:base",i);break;case"xmlLang":Ho(t,"http://www.w3.org/XML/1998/namespace","xml:lang",i);break;case"xmlSpace":Ho(t,"http://www.w3.org/XML/1998/namespace","xml:space",i);break;case"is":_g(t,"is",i);break;case"innerText":case"textContent":break;default:(!(2<n.length)||n[0]!=="o"&&n[0]!=="O"||n[1]!=="n"&&n[1]!=="N")&&(n=ZU.get(n)||n,_g(t,n,i))}}function cE(t,e,n,i,a,o){switch(n){case"style":Kz(t,i,o);break;case"dangerouslySetInnerHTML":if(i!=null){if(typeof i!="object"||!("__html"in i))throw Error(W(61));if(n=i.__html,n!=null){if(a.children!=null)throw Error(W(60));t.innerHTML=n}}break;case"children":typeof i=="string"?wc(t,i):(typeof i=="number"||typeof i=="bigint")&&wc(t,""+i);break;case"onScroll":i!=null&&kt("scroll",t);break;case"onScrollEnd":i!=null&&kt("scrollend",t);break;case"onClick":i!=null&&(t.onclick=Yo);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Fz.hasOwnProperty(n))t:{if(n[0]==="o"&&n[1]==="n"&&(a=n.endsWith("Capture"),e=n.slice(2,a?n.length-7:void 0),o=t[Mi]||null,o=o!=null?o[n]:null,typeof o=="function"&&t.removeEventListener(e,o,a),typeof i=="function")){typeof o!="function"&&o!==null&&(n in t?t[n]=null:t.hasAttribute(n)&&t.removeAttribute(n)),t.addEventListener(e,i,a);break t}n in t?t[n]=i:i===!0?t.setAttribute(n,""):_g(t,n,i)}}}function Qn(t,e,n){switch(e){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":kt("error",t),kt("load",t);var i=!1,a=!1,o;for(o in n)if(n.hasOwnProperty(o)){var s=n[o];if(s!=null)switch(o){case"src":i=!0;break;case"srcSet":a=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(W(137,e));default:be(t,e,o,s,n,null)}}a&&be(t,e,"srcSet",n.srcSet,n,null),i&&be(t,e,"src",n.src,n,null);return;case"input":kt("invalid",t);var u=o=s=a=null,d=null,p=null;for(i in n)if(n.hasOwnProperty(i)){var f=n[i];if(f!=null)switch(i){case"name":a=f;break;case"type":s=f;break;case"checked":d=f;break;case"defaultChecked":p=f;break;case"value":o=f;break;case"defaultValue":u=f;break;case"children":case"dangerouslySetInnerHTML":if(f!=null)throw Error(W(137,e));break;default:be(t,e,i,f,n,null)}}Yz(t,o,u,d,p,s,a,!1);return;case"select":kt("invalid",t),i=s=o=null;for(a in n)if(n.hasOwnProperty(a)&&(u=n[a],u!=null))switch(a){case"value":o=u;break;case"defaultValue":s=u;break;case"multiple":i=u;default:be(t,e,a,u,n,null)}e=o,n=s,t.multiple=!!i,e!=null?Sc(t,!!i,e,!1):n!=null&&Sc(t,!!i,n,!0);return;case"textarea":kt("invalid",t),o=a=i=null;for(s in n)if(n.hasOwnProperty(s)&&(u=n[s],u!=null))switch(s){case"value":i=u;break;case"defaultValue":a=u;break;case"children":o=u;break;case"dangerouslySetInnerHTML":if(u!=null)throw Error(W(91));break;default:be(t,e,s,u,n,null)}Xz(t,i,a,o);return;case"option":for(d in n)if(n.hasOwnProperty(d)&&(i=n[d],i!=null))switch(d){case"selected":t.selected=i&&typeof i!="function"&&typeof i!="symbol";break;default:be(t,e,d,i,n,null)}return;case"dialog":kt("beforetoggle",t),kt("toggle",t),kt("cancel",t),kt("close",t);break;case"iframe":case"object":kt("load",t);break;case"video":case"audio":for(i=0;i<Xd.length;i++)kt(Xd[i],t);break;case"image":kt("error",t),kt("load",t);break;case"details":kt("toggle",t);break;case"embed":case"source":case"link":kt("error",t),kt("load",t);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(p in n)if(n.hasOwnProperty(p)&&(i=n[p],i!=null))switch(p){case"children":case"dangerouslySetInnerHTML":throw Error(W(137,e));default:be(t,e,p,i,n,null)}return;default:if(CE(e)){for(f in n)n.hasOwnProperty(f)&&(i=n[f],i!==void 0&&cE(t,e,f,i,n,void 0));return}}for(u in n)n.hasOwnProperty(u)&&(i=n[u],i!=null&&be(t,e,u,i,n,null))}function x8(t,e,n,i){switch(e){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var a=null,o=null,s=null,u=null,d=null,p=null,f=null;for(v in n){var m=n[v];if(n.hasOwnProperty(v)&&m!=null)switch(v){case"checked":break;case"value":break;case"defaultValue":d=m;default:i.hasOwnProperty(v)||be(t,e,v,null,i,m)}}for(var g in i){var v=i[g];if(m=n[g],i.hasOwnProperty(g)&&(v!=null||m!=null))switch(g){case"type":o=v;break;case"name":a=v;break;case"checked":p=v;break;case"defaultChecked":f=v;break;case"value":s=v;break;case"defaultValue":u=v;break;case"children":case"dangerouslySetInnerHTML":if(v!=null)throw Error(W(137,e));break;default:v!==m&&be(t,e,g,v,i,m)}}Lx(t,s,u,d,p,f,o,a);return;case"select":v=s=u=g=null;for(o in n)if(d=n[o],n.hasOwnProperty(o)&&d!=null)switch(o){case"value":break;case"multiple":v=d;default:i.hasOwnProperty(o)||be(t,e,o,null,i,d)}for(a in i)if(o=i[a],d=n[a],i.hasOwnProperty(a)&&(o!=null||d!=null))switch(a){case"value":g=o;break;case"defaultValue":u=o;break;case"multiple":s=o;default:o!==d&&be(t,e,a,o,i,d)}e=u,n=s,i=v,g!=null?Sc(t,!!n,g,!1):!!i!=!!n&&(e!=null?Sc(t,!!n,e,!0):Sc(t,!!n,n?[]:"",!1));return;case"textarea":v=g=null;for(u in n)if(a=n[u],n.hasOwnProperty(u)&&a!=null&&!i.hasOwnProperty(u))switch(u){case"value":break;case"children":break;default:be(t,e,u,null,i,a)}for(s in i)if(a=i[s],o=n[s],i.hasOwnProperty(s)&&(a!=null||o!=null))switch(s){case"value":g=a;break;case"defaultValue":v=a;break;case"children":break;case"dangerouslySetInnerHTML":if(a!=null)throw Error(W(91));break;default:a!==o&&be(t,e,s,a,i,o)}Qz(t,g,v);return;case"option":for(var S in n)if(g=n[S],n.hasOwnProperty(S)&&g!=null&&!i.hasOwnProperty(S))switch(S){case"selected":t.selected=!1;break;default:be(t,e,S,null,i,g)}for(d in i)if(g=i[d],v=n[d],i.hasOwnProperty(d)&&g!==v&&(g!=null||v!=null))switch(d){case"selected":t.selected=g&&typeof g!="function"&&typeof g!="symbol";break;default:be(t,e,d,g,i,v)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var E in n)g=n[E],n.hasOwnProperty(E)&&g!=null&&!i.hasOwnProperty(E)&&be(t,e,E,null,i,g);for(p in i)if(g=i[p],v=n[p],i.hasOwnProperty(p)&&g!==v&&(g!=null||v!=null))switch(p){case"children":case"dangerouslySetInnerHTML":if(g!=null)throw Error(W(137,e));break;default:be(t,e,p,g,i,v)}return;default:if(CE(e)){for(var T in n)g=n[T],n.hasOwnProperty(T)&&g!==void 0&&!i.hasOwnProperty(T)&&cE(t,e,T,void 0,i,g);for(f in i)g=i[f],v=n[f],!i.hasOwnProperty(f)||g===v||g===void 0&&v===void 0||cE(t,e,f,g,i,v);return}}for(var A in n)g=n[A],n.hasOwnProperty(A)&&g!=null&&!i.hasOwnProperty(A)&&be(t,e,A,null,i,g);for(m in i)g=i[m],v=n[m],!i.hasOwnProperty(m)||g===v||g==null&&v==null||be(t,e,m,g,i,v)}function uz(t){switch(t){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function E8(){if(typeof performance.getEntriesByType=="function"){for(var t=0,e=0,n=performance.getEntriesByType("resource"),i=0;i<n.length;i++){var a=n[i],o=a.transferSize,s=a.initiatorType,u=a.duration;if(o&&u&&uz(s)){for(s=0,u=a.responseEnd,i+=1;i<n.length;i++){var d=n[i],p=d.startTime;if(p>u)break;var f=d.transferSize,m=d.initiatorType;f&&uz(m)&&(d=d.responseEnd,s+=f*(d<u?1:(u-p)/(d-p)))}if(--i,e+=8*(o+s)/(a.duration/1e3),t++,10<t)break}}if(0<t)return e/t/1e6}return navigator.connection&&(t=navigator.connection.downlink,typeof t=="number")?t:5}var fE=null,dE=null;function py(t){return t.nodeType===9?t:t.ownerDocument}function cz(t){switch(t){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function $3(t,e){if(t===0)switch(e){case"svg":return 1;case"math":return 2;default:return 0}return t===1&&e==="foreignObject"?0:t}function hE(t,e){return t==="textarea"||t==="noscript"||typeof e.children=="string"||typeof e.children=="number"||typeof e.children=="bigint"||typeof e.dangerouslySetInnerHTML=="object"&&e.dangerouslySetInnerHTML!==null&&e.dangerouslySetInnerHTML.__html!=null}var Ax=null;function A8(){var t=window.event;return t&&t.type==="popstate"?t===Ax?!1:(Ax=t,!0):(Ax=null,!1)}var tI=typeof setTimeout=="function"?setTimeout:void 0,R8=typeof clearTimeout=="function"?clearTimeout:void 0,fz=typeof Promise=="function"?Promise:void 0,T8=typeof queueMicrotask=="function"?queueMicrotask:typeof fz<"u"?function(t){return fz.resolve(null).then(t).catch(C8)}:tI;function C8(t){setTimeout(function(){throw t})}function ml(t){return t==="head"}function dz(t,e){var n=e,i=0;do{var a=n.nextSibling;if(t.removeChild(n),a&&a.nodeType===8)if(n=a.data,n==="/$"||n==="/&"){if(i===0){t.removeChild(a),Lc(e);return}i--}else if(n==="$"||n==="$?"||n==="$~"||n==="$!"||n==="&")i++;else if(n==="html")Hd(t.ownerDocument.documentElement);else if(n==="head"){n=t.ownerDocument.head,Hd(n);for(var o=n.firstChild;o;){var s=o.nextSibling,u=o.nodeName;o[ih]||u==="SCRIPT"||u==="STYLE"||u==="LINK"&&o.rel.toLowerCase()==="stylesheet"||n.removeChild(o),o=s}}else n==="body"&&Hd(t.ownerDocument.body);n=a}while(n);Lc(e)}function hz(t,e){var n=t;t=0;do{var i=n.nextSibling;if(n.nodeType===1?e?(n._stashedDisplay=n.style.display,n.style.display="none"):(n.style.display=n._stashedDisplay||"",n.getAttribute("style")===""&&n.removeAttribute("style")):n.nodeType===3&&(e?(n._stashedText=n.nodeValue,n.nodeValue=""):n.nodeValue=n._stashedText||""),i&&i.nodeType===8)if(n=i.data,n==="/$"){if(t===0)break;t--}else n!=="$"&&n!=="$?"&&n!=="$~"&&n!=="$!"||t++;n=i}while(n)}function pE(t){var e=t.firstChild;for(e&&e.nodeType===10&&(e=e.nextSibling);e;){var n=e;switch(e=e.nextSibling,n.nodeName){case"HTML":case"HEAD":case"BODY":pE(n),TE(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}t.removeChild(n)}}function w8(t,e,n,i){for(;t.nodeType===1;){var a=n;if(t.nodeName.toLowerCase()!==e.toLowerCase()){if(!i&&(t.nodeName!=="INPUT"||t.type!=="hidden"))break}else if(i){if(!t[ih])switch(e){case"meta":if(!t.hasAttribute("itemprop"))break;return t;case"link":if(o=t.getAttribute("rel"),o==="stylesheet"&&t.hasAttribute("data-precedence"))break;if(o!==a.rel||t.getAttribute("href")!==(a.href==null||a.href===""?null:a.href)||t.getAttribute("crossorigin")!==(a.crossOrigin==null?null:a.crossOrigin)||t.getAttribute("title")!==(a.title==null?null:a.title))break;return t;case"style":if(t.hasAttribute("data-precedence"))break;return t;case"script":if(o=t.getAttribute("src"),(o!==(a.src==null?null:a.src)||t.getAttribute("type")!==(a.type==null?null:a.type)||t.getAttribute("crossorigin")!==(a.crossOrigin==null?null:a.crossOrigin))&&o&&t.hasAttribute("async")&&!t.hasAttribute("itemprop"))break;return t;default:return t}}else if(e==="input"&&t.type==="hidden"){var o=a.name==null?null:""+a.name;if(a.type==="hidden"&&t.getAttribute("name")===o)return t}else return t;if(t=Ca(t.nextSibling),t===null)break}return null}function M8(t,e,n){if(e==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!n||(t=Ca(t.nextSibling),t===null))return null;return t}function eI(t,e){for(;t.nodeType!==8;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!e||(t=Ca(t.nextSibling),t===null))return null;return t}function mE(t){return t.data==="$?"||t.data==="$~"}function gE(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState!=="loading"}function O8(t,e){var n=t.ownerDocument;if(t.data==="$~")t._reactRetry=e;else if(t.data!=="$?"||n.readyState!=="loading")e();else{var i=function(){e(),n.removeEventListener("DOMContentLoaded",i)};n.addEventListener("DOMContentLoaded",i),t._reactRetry=i}}function Ca(t){for(;t!=null;t=t.nextSibling){var e=t.nodeType;if(e===1||e===3)break;if(e===8){if(e=t.data,e==="$"||e==="$!"||e==="$?"||e==="$~"||e==="&"||e==="F!"||e==="F")break;if(e==="/$"||e==="/&")return null}}return t}var yE=null;function pz(t){t=t.nextSibling;for(var e=0;t;){if(t.nodeType===8){var n=t.data;if(n==="/$"||n==="/&"){if(e===0)return Ca(t.nextSibling);e--}else n!=="$"&&n!=="$!"&&n!=="$?"&&n!=="$~"&&n!=="&"||e++}t=t.nextSibling}return null}function mz(t){t=t.previousSibling;for(var e=0;t;){if(t.nodeType===8){var n=t.data;if(n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"){if(e===0)return t;e--}else n!=="/$"&&n!=="/&"||e++}t=t.previousSibling}return null}function nI(t,e,n){switch(e=py(n),t){case"html":if(t=e.documentElement,!t)throw Error(W(452));return t;case"head":if(t=e.head,!t)throw Error(W(453));return t;case"body":if(t=e.body,!t)throw Error(W(454));return t;default:throw Error(W(451))}}function Hd(t){for(var e=t.attributes;e.length;)t.removeAttributeNode(e[0]);TE(t)}var wa=new Map,gz=new Set;function my(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var nr=ue.d;ue.d={f:_8,r:z8,D:N8,C:I8,L:D8,m:L8,X:P8,S:B8,M:H8};function _8(){var t=nr.f(),e=Ny();return t||e}function z8(t){var e=Pc(t);e!==null&&e.tag===5&&e.type==="form"?KN(e):nr.r(t)}var jc=typeof document>"u"?null:document;function iI(t,e,n){var i=jc;if(i&&typeof e=="string"&&e){var a=Ea(e);a='link[rel="'+t+'"][href="'+a+'"]',typeof n=="string"&&(a+='[crossorigin="'+n+'"]'),gz.has(a)||(gz.add(a),t={rel:t,crossOrigin:n,href:e},i.querySelector(a)===null&&(e=i.createElement("link"),Qn(e,"link",t),In(e),i.head.appendChild(e)))}}function N8(t){nr.D(t),iI("dns-prefetch",t,null)}function I8(t,e){nr.C(t,e),iI("preconnect",t,e)}function D8(t,e,n){nr.L(t,e,n);var i=jc;if(i&&t&&e){var a='link[rel="preload"][as="'+Ea(e)+'"]';e==="image"&&n&&n.imageSrcSet?(a+='[imagesrcset="'+Ea(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(a+='[imagesizes="'+Ea(n.imageSizes)+'"]')):a+='[href="'+Ea(t)+'"]';var o=a;switch(e){case"style":o=Dc(t);break;case"script":o=qc(t)}wa.has(o)||(t=Ne({rel:"preload",href:e==="image"&&n&&n.imageSrcSet?void 0:t,as:e},n),wa.set(o,t),i.querySelector(a)!==null||e==="style"&&i.querySelector(uh(o))||e==="script"&&i.querySelector(ch(o))||(e=i.createElement("link"),Qn(e,"link",t),In(e),i.head.appendChild(e)))}}function L8(t,e){nr.m(t,e);var n=jc;if(n&&t){var i=e&&typeof e.as=="string"?e.as:"script",a='link[rel="modulepreload"][as="'+Ea(i)+'"][href="'+Ea(t)+'"]',o=a;switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":o=qc(t)}if(!wa.has(o)&&(t=Ne({rel:"modulepreload",href:t},e),wa.set(o,t),n.querySelector(a)===null)){switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(ch(o)))return}i=n.createElement("link"),Qn(i,"link",t),In(i),n.head.appendChild(i)}}}function B8(t,e,n){nr.S(t,e,n);var i=jc;if(i&&t){var a=vc(i).hoistableStyles,o=Dc(t);e=e||"default";var s=a.get(o);if(!s){var u={loading:0,preload:null};if(s=i.querySelector(uh(o)))u.loading=5;else{t=Ne({rel:"stylesheet",href:t,"data-precedence":e},n),(n=wa.get(o))&&cA(t,n);var d=s=i.createElement("link");In(d),Qn(d,"link",t),d._p=new Promise(function(p,f){d.onload=p,d.onerror=f}),d.addEventListener("load",function(){u.loading|=1}),d.addEventListener("error",function(){u.loading|=2}),u.loading|=4,jg(s,e,i)}s={type:"stylesheet",instance:s,count:1,state:u},a.set(o,s)}}}function P8(t,e){nr.X(t,e);var n=jc;if(n&&t){var i=vc(n).hoistableScripts,a=qc(t),o=i.get(a);o||(o=n.querySelector(ch(a)),o||(t=Ne({src:t,async:!0},e),(e=wa.get(a))&&fA(t,e),o=n.createElement("script"),In(o),Qn(o,"link",t),n.head.appendChild(o)),o={type:"script",instance:o,count:1,state:null},i.set(a,o))}}function H8(t,e){nr.M(t,e);var n=jc;if(n&&t){var i=vc(n).hoistableScripts,a=qc(t),o=i.get(a);o||(o=n.querySelector(ch(a)),o||(t=Ne({src:t,async:!0,type:"module"},e),(e=wa.get(a))&&fA(t,e),o=n.createElement("script"),In(o),Qn(o,"link",t),n.head.appendChild(o)),o={type:"script",instance:o,count:1,state:null},i.set(a,o))}}function yz(t,e,n,i){var a=(a=el.current)?my(a):null;if(!a)throw Error(W(446));switch(t){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(e=Dc(n.href),n=vc(a).hoistableStyles,i=n.get(e),i||(i={type:"style",instance:null,count:0,state:null},n.set(e,i)),i):{type:"void",instance:null,count:0,state:null};case"link":if(n.rel==="stylesheet"&&typeof n.href=="string"&&typeof n.precedence=="string"){t=Dc(n.href);var o=vc(a).hoistableStyles,s=o.get(t);if(s||(a=a.ownerDocument||a,s={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},o.set(t,s),(o=a.querySelector(uh(t)))&&!o._p&&(s.instance=o,s.state.loading=5),wa.has(t)||(n={rel:"preload",as:"style",href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},wa.set(t,n),o||U8(a,t,n,s.state))),e&&i===null)throw Error(W(528,""));return s}if(e&&i!==null)throw Error(W(529,""));return null;case"script":return e=n.async,n=n.src,typeof n=="string"&&e&&typeof e!="function"&&typeof e!="symbol"?(e=qc(n),n=vc(a).hoistableScripts,i=n.get(e),i||(i={type:"script",instance:null,count:0,state:null},n.set(e,i)),i):{type:"void",instance:null,count:0,state:null};default:throw Error(W(444,t))}}function Dc(t){return'href="'+Ea(t)+'"'}function uh(t){return'link[rel="stylesheet"]['+t+"]"}function aI(t){return Ne({},t,{"data-precedence":t.precedence,precedence:null})}function U8(t,e,n,i){t.querySelector('link[rel="preload"][as="style"]['+e+"]")?i.loading=1:(e=t.createElement("link"),i.preload=e,e.addEventListener("load",function(){return i.loading|=1}),e.addEventListener("error",function(){return i.loading|=2}),Qn(e,"link",n),In(e),t.head.appendChild(e))}function qc(t){return'[src="'+Ea(t)+'"]'}function ch(t){return"script[async]"+t}function vz(t,e,n){if(e.count++,e.instance===null)switch(e.type){case"style":var i=t.querySelector('style[data-href~="'+Ea(n.href)+'"]');if(i)return e.instance=i,In(i),i;var a=Ne({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return i=(t.ownerDocument||t).createElement("style"),In(i),Qn(i,"style",a),jg(i,n.precedence,t),e.instance=i;case"stylesheet":a=Dc(n.href);var o=t.querySelector(uh(a));if(o)return e.state.loading|=4,e.instance=o,In(o),o;i=aI(n),(a=wa.get(a))&&cA(i,a),o=(t.ownerDocument||t).createElement("link"),In(o);var s=o;return s._p=new Promise(function(u,d){s.onload=u,s.onerror=d}),Qn(o,"link",i),e.state.loading|=4,jg(o,n.precedence,t),e.instance=o;case"script":return o=qc(n.src),(a=t.querySelector(ch(o)))?(e.instance=a,In(a),a):(i=n,(a=wa.get(o))&&(i=Ne({},n),fA(i,a)),t=t.ownerDocument||t,a=t.createElement("script"),In(a),Qn(a,"link",i),t.head.appendChild(a),e.instance=a);case"void":return null;default:throw Error(W(443,e.type))}else e.type==="stylesheet"&&!(e.state.loading&4)&&(i=e.instance,e.state.loading|=4,jg(i,n.precedence,t));return e.instance}function jg(t,e,n){for(var i=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),a=i.length?i[i.length-1]:null,o=a,s=0;s<i.length;s++){var u=i[s];if(u.dataset.precedence===e)o=u;else if(o!==a)break}o?o.parentNode.insertBefore(t,o.nextSibling):(e=n.nodeType===9?n.head:n,e.insertBefore(t,e.firstChild))}function cA(t,e){t.crossOrigin==null&&(t.crossOrigin=e.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=e.referrerPolicy),t.title==null&&(t.title=e.title)}function fA(t,e){t.crossOrigin==null&&(t.crossOrigin=e.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=e.referrerPolicy),t.integrity==null&&(t.integrity=e.integrity)}var qg=null;function Sz(t,e,n){if(qg===null){var i=new Map,a=qg=new Map;a.set(n,i)}else a=qg,i=a.get(n),i||(i=new Map,a.set(n,i));if(i.has(t))return i;for(i.set(t,null),n=n.getElementsByTagName(t),a=0;a<n.length;a++){var o=n[a];if(!(o[ih]||o[Gn]||t==="link"&&o.getAttribute("rel")==="stylesheet")&&o.namespaceURI!=="http://www.w3.org/2000/svg"){var s=o.getAttribute(e)||"";s=t+s;var u=i.get(s);u?u.push(o):i.set(s,[o])}}return i}function bz(t,e,n){t=t.ownerDocument||t,t.head.insertBefore(n,e==="title"?t.querySelector("head > title"):null)}function V8(t,e,n){if(n===1||e.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof e.precedence!="string"||typeof e.href!="string"||e.href==="")break;return!0;case"link":if(typeof e.rel!="string"||typeof e.href!="string"||e.href===""||e.onLoad||e.onError)break;switch(e.rel){case"stylesheet":return t=e.disabled,typeof e.precedence=="string"&&t==null;default:return!0}case"script":if(e.async&&typeof e.async!="function"&&typeof e.async!="symbol"&&!e.onLoad&&!e.onError&&e.src&&typeof e.src=="string")return!0}return!1}function oI(t){return!(t.type==="stylesheet"&&!(t.state.loading&3))}function j8(t,e,n,i){if(n.type==="stylesheet"&&(typeof i.media!="string"||matchMedia(i.media).matches!==!1)&&!(n.state.loading&4)){if(n.instance===null){var a=Dc(i.href),o=e.querySelector(uh(a));if(o){e=o._p,e!==null&&typeof e=="object"&&typeof e.then=="function"&&(t.count++,t=gy.bind(t),e.then(t,t)),n.state.loading|=4,n.instance=o,In(o);return}o=e.ownerDocument||e,i=aI(i),(a=wa.get(a))&&cA(i,a),o=o.createElement("link"),In(o);var s=o;s._p=new Promise(function(u,d){s.onload=u,s.onerror=d}),Qn(o,"link",i),n.instance=o}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(n,e),(e=n.state.preload)&&!(n.state.loading&3)&&(t.count++,n=gy.bind(t),e.addEventListener("load",n),e.addEventListener("error",n))}}var Rx=0;function q8(t,e){return t.stylesheets&&t.count===0&&Fg(t,t.stylesheets),0<t.count||0<t.imgCount?function(n){var i=setTimeout(function(){if(t.stylesheets&&Fg(t,t.stylesheets),t.unsuspend){var o=t.unsuspend;t.unsuspend=null,o()}},6e4+e);0<t.imgBytes&&Rx===0&&(Rx=62500*E8());var a=setTimeout(function(){if(t.waitingForImages=!1,t.count===0&&(t.stylesheets&&Fg(t,t.stylesheets),t.unsuspend)){var o=t.unsuspend;t.unsuspend=null,o()}},(t.imgBytes>Rx?50:800)+e);return t.unsuspend=n,function(){t.unsuspend=null,clearTimeout(i),clearTimeout(a)}}:null}function gy(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Fg(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var yy=null;function Fg(t,e){t.stylesheets=null,t.unsuspend!==null&&(t.count++,yy=new Map,e.forEach(F8,t),yy=null,gy.call(t))}function F8(t,e){if(!(e.state.loading&4)){var n=yy.get(t);if(n)var i=n.get(null);else{n=new Map,yy.set(t,n);for(var a=t.querySelectorAll("link[data-precedence],style[data-precedence]"),o=0;o<a.length;o++){var s=a[o];(s.nodeName==="LINK"||s.getAttribute("media")!=="not all")&&(n.set(s.dataset.precedence,s),i=s)}i&&n.set(null,i)}a=e.instance,s=a.getAttribute("data-precedence"),o=n.get(s)||i,o===i&&n.set(null,a),n.set(s,a),this.count++,i=gy.bind(this),a.addEventListener("load",i),a.addEventListener("error",i),o?o.parentNode.insertBefore(a,o.nextSibling):(t=t.nodeType===9?t.head:t,t.insertBefore(a,t.firstChild)),e.state.loading|=4}}var Zd={$$typeof:ko,Provider:null,Consumer:null,_currentValue:xs,_currentValue2:xs,_threadCount:0};function G8(t,e,n,i,a,o,s,u,d){this.tag=1,this.containerInfo=t,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Z1(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Z1(0),this.hiddenUpdates=Z1(null),this.identifierPrefix=i,this.onUncaughtError=a,this.onCaughtError=o,this.onRecoverableError=s,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=d,this.incompleteTransitions=new Map}function rI(t,e,n,i,a,o,s,u,d,p,f,m){return t=new G8(t,e,n,s,d,p,f,m,u),e=1,o===!0&&(e|=24),o=Zi(3,null,null,e),t.current=o,o.stateNode=t,e=PE(),e.refCount++,t.pooledCache=e,e.refCount++,o.memoizedState={element:i,isDehydrated:n,cache:e},VE(o),t}function lI(t){return t?(t=pc,t):pc}function sI(t,e,n,i,a,o){a=lI(a),i.context===null?i.context=a:i.pendingContext=a,i=il(e),i.payload={element:n},o=o===void 0?null:o,o!==null&&(i.callback=o),n=al(t,i,e),n!==null&&(wi(n,t,e),_d(n,t,e))}function xz(t,e){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var n=t.retryLane;t.retryLane=n!==0&&n<e?n:e}}function dA(t,e){xz(t,e),(t=t.alternate)&&xz(t,e)}function uI(t){if(t.tag===13||t.tag===31){var e=Ds(t,67108864);e!==null&&wi(e,t,67108864),dA(t,67108864)}}function Ez(t){if(t.tag===13||t.tag===31){var e=ea();e=AE(e);var n=Ds(t,e);n!==null&&wi(n,t,e),dA(t,e)}}var vy=!0;function k8(t,e,n,i){var a=_t.T;_t.T=null;var o=ue.p;try{ue.p=2,hA(t,e,n,i)}finally{ue.p=o,_t.T=a}}function Y8(t,e,n,i){var a=_t.T;_t.T=null;var o=ue.p;try{ue.p=8,hA(t,e,n,i)}finally{ue.p=o,_t.T=a}}function hA(t,e,n,i){if(vy){var a=vE(i);if(a===null)Ex(t,e,i,Sy,n),Az(t,i);else if(X8(a,t,e,n,i))i.stopPropagation();else if(Az(t,i),e&4&&-1<Q8.indexOf(t)){for(;a!==null;){var o=Pc(a);if(o!==null)switch(o.tag){case 3:if(o=o.stateNode,o.current.memoizedState.isDehydrated){var s=vs(o.pendingLanes);if(s!==0){var u=o;for(u.pendingLanes|=2,u.entangledLanes|=2;s;){var d=1<<31-ta(s);u.entanglements[1]|=d,s&=~d}po(o),!(se&6)&&(sy=Ji()+500,sh(0,!1))}}break;case 31:case 13:u=Ds(o,2),u!==null&&wi(u,o,2),Ny(),dA(o,2)}if(o=vE(i),o===null&&Ex(t,e,i,Sy,n),o===a)break;a=o}a!==null&&i.stopPropagation()}else Ex(t,e,i,null,n)}}function vE(t){return t=wE(t),pA(t)}var Sy=null;function pA(t){if(Sy=null,t=sc(t),t!==null){var e=$d(t);if(e===null)t=null;else{var n=e.tag;if(n===13){if(t=Oz(e),t!==null)return t;t=null}else if(n===31){if(t=_z(e),t!==null)return t;t=null}else if(n===3){if(e.stateNode.current.memoizedState.isDehydrated)return e.tag===3?e.stateNode.containerInfo:null;t=null}else e!==t&&(t=null)}}return Sy=t,null}function cI(t){switch(t){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(DU()){case Dz:return 2;case Lz:return 8;case Xg:case LU:return 32;case Bz:return 268435456;default:return 32}default:return 32}}var SE=!1,ll=null,sl=null,ul=null,Wd=new Map,Jd=new Map,Kr=[],Q8="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function Az(t,e){switch(t){case"focusin":case"focusout":ll=null;break;case"dragenter":case"dragleave":sl=null;break;case"mouseover":case"mouseout":ul=null;break;case"pointerover":case"pointerout":Wd.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":Jd.delete(e.pointerId)}}function Sd(t,e,n,i,a,o){return t===null||t.nativeEvent!==o?(t={blockedOn:e,domEventName:n,eventSystemFlags:i,nativeEvent:o,targetContainers:[a]},e!==null&&(e=Pc(e),e!==null&&uI(e)),t):(t.eventSystemFlags|=i,e=t.targetContainers,a!==null&&e.indexOf(a)===-1&&e.push(a),t)}function X8(t,e,n,i,a){switch(e){case"focusin":return ll=Sd(ll,t,e,n,i,a),!0;case"dragenter":return sl=Sd(sl,t,e,n,i,a),!0;case"mouseover":return ul=Sd(ul,t,e,n,i,a),!0;case"pointerover":var o=a.pointerId;return Wd.set(o,Sd(Wd.get(o)||null,t,e,n,i,a)),!0;case"gotpointercapture":return o=a.pointerId,Jd.set(o,Sd(Jd.get(o)||null,t,e,n,i,a)),!0}return!1}function fI(t){var e=sc(t.target);if(e!==null){var n=$d(e);if(n!==null){if(e=n.tag,e===13){if(e=Oz(n),e!==null){t.blockedOn=e,r_(t.priority,function(){Ez(n)});return}}else if(e===31){if(e=_z(n),e!==null){t.blockedOn=e,r_(t.priority,function(){Ez(n)});return}}else if(e===3&&n.stateNode.current.memoizedState.isDehydrated){t.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}t.blockedOn=null}function Gg(t){if(t.blockedOn!==null)return!1;for(var e=t.targetContainers;0<e.length;){var n=vE(t.nativeEvent);if(n===null){n=t.nativeEvent;var i=new n.constructor(n.type,n);Px=i,n.target.dispatchEvent(i),Px=null}else return e=Pc(n),e!==null&&uI(e),t.blockedOn=n,!1;e.shift()}return!0}function Rz(t,e,n){Gg(t)&&n.delete(e)}function K8(){SE=!1,ll!==null&&Gg(ll)&&(ll=null),sl!==null&&Gg(sl)&&(sl=null),ul!==null&&Gg(ul)&&(ul=null),Wd.forEach(Rz),Jd.forEach(Rz)}function Mg(t,e){t.blockedOn===e&&(t.blockedOn=null,SE||(SE=!0,Cn.unstable_scheduleCallback(Cn.unstable_NormalPriority,K8)))}var Og=null;function Tz(t){Og!==t&&(Og=t,Cn.unstable_scheduleCallback(Cn.unstable_NormalPriority,function(){Og===t&&(Og=null);for(var e=0;e<t.length;e+=3){var n=t[e],i=t[e+1],a=t[e+2];if(typeof i!="function"){if(pA(i||n)===null)continue;break}var o=Pc(n);o!==null&&(t.splice(e,3),e-=3,$x(o,{pending:!0,data:a,method:n.method,action:i},i,a))}}))}function Lc(t){function e(d){return Mg(d,t)}ll!==null&&Mg(ll,t),sl!==null&&Mg(sl,t),ul!==null&&Mg(ul,t),Wd.forEach(e),Jd.forEach(e);for(var n=0;n<Kr.length;n++){var i=Kr[n];i.blockedOn===t&&(i.blockedOn=null)}for(;0<Kr.length&&(n=Kr[0],n.blockedOn===null);)fI(n),n.blockedOn===null&&Kr.shift();if(n=(t.ownerDocument||t).$$reactFormReplay,n!=null)for(i=0;i<n.length;i+=3){var a=n[i],o=n[i+1],s=a[Mi]||null;if(typeof o=="function")s||Tz(n);else if(s){var u=null;if(o&&o.hasAttribute("formAction")){if(a=o,s=o[Mi]||null)u=s.formAction;else if(pA(a)!==null)continue}else u=s.action;typeof u=="function"?n[i+1]=u:(n.splice(i,3),i-=3),Tz(n)}}}function dI(){function t(o){o.canIntercept&&o.info==="react-transition"&&o.intercept({handler:function(){return new Promise(function(s){return a=s})},focusReset:"manual",scroll:"manual"})}function e(){a!==null&&(a(),a=null),i||setTimeout(n,20)}function n(){if(!i&&!navigation.transition){var o=navigation.currentEntry;o&&o.url!=null&&navigation.navigate(o.url,{state:o.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var i=!1,a=null;return navigation.addEventListener("navigate",t),navigation.addEventListener("navigatesuccess",e),navigation.addEventListener("navigateerror",e),setTimeout(n,100),function(){i=!0,navigation.removeEventListener("navigate",t),navigation.removeEventListener("navigatesuccess",e),navigation.removeEventListener("navigateerror",e),a!==null&&(a(),a=null)}}}function mA(t){this._internalRoot=t}Ly.prototype.render=mA.prototype.render=function(t){var e=this._internalRoot;if(e===null)throw Error(W(409));var n=e.current,i=ea();sI(n,i,t,e,null,null)};Ly.prototype.unmount=mA.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var e=t.containerInfo;sI(t.current,2,null,t,null,null),Ny(),e[Bc]=null}};function Ly(t){this._internalRoot=t}Ly.prototype.unstable_scheduleHydration=function(t){if(t){var e=jz();t={blockedOn:null,target:t,priority:e};for(var n=0;n<Kr.length&&e!==0&&e<Kr[n].priority;n++);Kr.splice(n,0,t),n===0&&fI(t)}};var Cz=wz.version;if(Cz!=="19.2.0")throw Error(W(527,Cz,"19.2.0"));ue.findDOMNode=function(t){var e=t._reactInternals;if(e===void 0)throw typeof t.render=="function"?Error(W(188)):(t=Object.keys(t).join(","),Error(W(268,t)));return t=wU(e),t=t!==null?zz(t):null,t=t===null?null:t.stateNode,t};var Z8={bundleType:0,version:"19.2.0",rendererPackageName:"react-dom",currentDispatcherRef:_t,reconcilerVersion:"19.2.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&(bd=__REACT_DEVTOOLS_GLOBAL_HOOK__,!bd.isDisabled&&bd.supportsFiber))try{th=bd.inject(Z8),$i=bd}catch{}var bd;By.createRoot=function(t,e){if(!Mz(t))throw Error(W(299));var n=!1,i="",a=i3,o=a3,s=o3;return e!=null&&(e.unstable_strictMode===!0&&(n=!0),e.identifierPrefix!==void 0&&(i=e.identifierPrefix),e.onUncaughtError!==void 0&&(a=e.onUncaughtError),e.onCaughtError!==void 0&&(o=e.onCaughtError),e.onRecoverableError!==void 0&&(s=e.onRecoverableError)),e=rI(t,1,!1,null,null,n,i,null,a,o,s,dI),t[Bc]=e.current,uA(t),new mA(e)};By.hydrateRoot=function(t,e,n){if(!Mz(t))throw Error(W(299));var i=!1,a="",o=i3,s=a3,u=o3,d=null;return n!=null&&(n.unstable_strictMode===!0&&(i=!0),n.identifierPrefix!==void 0&&(a=n.identifierPrefix),n.onUncaughtError!==void 0&&(o=n.onUncaughtError),n.onCaughtError!==void 0&&(s=n.onCaughtError),n.onRecoverableError!==void 0&&(u=n.onRecoverableError),n.formState!==void 0&&(d=n.formState)),e=rI(t,1,!0,e,n??null,i,a,d,o,s,u,dI),e.context=lI(null),n=e.current,i=ea(),i=AE(i),a=il(i),a.callback=null,al(n,a,i),n=i,e.current.lanes=n,nh(e,n),po(e),t[Bc]=e.current,uA(t),new Ly(e)};By.version="19.2.0"});var gI=ui((zY,mI)=>{"use strict";function pI(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(pI)}catch(t){console.error(t)}}pI(),mI.exports=hI()});var w4=ui((pit,C4)=>{"use strict";(()=>{var t={296:(a,o,s)=>{var u=/^\s+|\s+$/g,d=/^[-+]0x[0-9a-f]+$/i,p=/^0b[01]+$/i,f=/^0o[0-7]+$/i,m=parseInt,g=typeof s.g=="object"&&s.g&&s.g.Object===Object&&s.g,v=typeof self=="object"&&self&&self.Object===Object&&self,S=g||v||Function("return this")(),E=Object.prototype.toString,T=Math.max,A=Math.min,x=function(){return S.Date.now()};function R(M){var z=typeof M;return!!M&&(z=="object"||z=="function")}function C(M){if(typeof M=="number")return M;if(function(D){return typeof D=="symbol"||function(q){return!!q&&typeof q=="object"}(D)&&E.call(D)=="[object Symbol]"}(M))return NaN;if(R(M)){var z=typeof M.valueOf=="function"?M.valueOf():M;M=R(z)?z+"":z}if(typeof M!="string")return M===0?M:+M;M=M.replace(u,"");var N=p.test(M);return N||f.test(M)?m(M.slice(2),N?2:8):d.test(M)?NaN:+M}a.exports=function(M,z,N){var D,q,P,U,J,at,X=0,tt=!1,ut=!1,xt=!0;if(typeof M!="function")throw new TypeError("Expected a function");function lt(ee){var ce=D,le=q;return D=q=void 0,X=ee,U=M.apply(le,ce)}function dt(ee){var ce=ee-at;return at===void 0||ce>=z||ce<0||ut&&ee-X>=P}function Rt(){var ee=x();if(dt(ee))return K(ee);J=setTimeout(Rt,function(ce){var le=z-(ce-at);return ut?A(le,P-(ce-X)):le}(ee))}function K(ee){return J=void 0,xt&&D?lt(ee):(D=q=void 0,U)}function Ct(){var ee=x(),ce=dt(ee);if(D=arguments,q=this,at=ee,ce){if(J===void 0)return function(le){return X=le,J=setTimeout(Rt,z),tt?lt(le):U}(at);if(ut)return J=setTimeout(Rt,z),lt(at)}return J===void 0&&(J=setTimeout(Rt,z)),U}return z=C(z)||0,R(N)&&(tt=!!N.leading,P=(ut="maxWait"in N)?T(C(N.maxWait)||0,z):P,xt="trailing"in N?!!N.trailing:xt),Ct.cancel=function(){J!==void 0&&clearTimeout(J),X=0,D=at=q=J=void 0},Ct.flush=function(){return J===void 0?U:K(x())},Ct}},96:(a,o,s)=>{var u="Expected a function",d=NaN,p="[object Symbol]",f=/^\s+|\s+$/g,m=/^[-+]0x[0-9a-f]+$/i,g=/^0b[01]+$/i,v=/^0o[0-7]+$/i,S=parseInt,E=typeof s.g=="object"&&s.g&&s.g.Object===Object&&s.g,T=typeof self=="object"&&self&&self.Object===Object&&self,A=E||T||Function("return this")(),x=Object.prototype.toString,R=Math.max,C=Math.min,M=function(){return A.Date.now()};function z(D){var q=typeof D;return!!D&&(q=="object"||q=="function")}function N(D){if(typeof D=="number")return D;if(function(U){return typeof U=="symbol"||function(J){return!!J&&typeof J=="object"}(U)&&x.call(U)==p}(D))return d;if(z(D)){var q=typeof D.valueOf=="function"?D.valueOf():D;D=z(q)?q+"":q}if(typeof D!="string")return D===0?D:+D;D=D.replace(f,"");var P=g.test(D);return P||v.test(D)?S(D.slice(2),P?2:8):m.test(D)?d:+D}a.exports=function(D,q,P){var U=!0,J=!0;if(typeof D!="function")throw new TypeError(u);return z(P)&&(U="leading"in P?!!P.leading:U,J="trailing"in P?!!P.trailing:J),function(at,X,tt){var ut,xt,lt,dt,Rt,K,Ct=0,ee=!1,ce=!1,le=!0;if(typeof at!="function")throw new TypeError(u);function pe(me){var ge=ut,$t=xt;return ut=xt=void 0,Ct=me,dt=at.apply($t,ge)}function De(me){var ge=me-K;return K===void 0||ge>=X||ge<0||ce&&me-Ct>=lt}function ne(){var me=M();if(De(me))return Di(me);Rt=setTimeout(ne,function(ge){var $t=X-(ge-K);return ce?C($t,lt-(ge-Ct)):$t}(me))}function Di(me){return Rt=void 0,le&&ut?pe(me):(ut=xt=void 0,dt)}function ri(){var me=M(),ge=De(me);if(ut=arguments,xt=this,K=me,ge){if(Rt===void 0)return function($t){return Ct=$t,Rt=setTimeout(ne,X),ee?pe($t):dt}(K);if(ce)return Rt=setTimeout(ne,X),pe(K)}return Rt===void 0&&(Rt=setTimeout(ne,X)),dt}return X=N(X)||0,z(tt)&&(ee=!!tt.leading,lt=(ce="maxWait"in tt)?R(N(tt.maxWait)||0,X):lt,le="trailing"in tt?!!tt.trailing:le),ri.cancel=function(){Rt!==void 0&&clearTimeout(Rt),Ct=0,ut=K=xt=Rt=void 0},ri.flush=function(){return Rt===void 0?dt:Di(M())},ri}(D,q,{leading:U,maxWait:q,trailing:J})}},703:(a,o,s)=>{"use strict";var u=s(414);function d(){}function p(){}p.resetWarningCache=d,a.exports=function(){function f(v,S,E,T,A,x){if(x!==u){var R=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 R.name="Invariant Violation",R}}function m(){return f}f.isRequired=f;var g={array:f,bigint:f,bool:f,func:f,number:f,object:f,string:f,symbol:f,any:f,arrayOf:m,element:f,elementType:f,instanceOf:m,node:f,objectOf:m,oneOf:m,oneOfType:m,shape:m,exact:m,checkPropTypes:p,resetWarningCache:d};return g.PropTypes=g,g}},697:(a,o,s)=>{a.exports=s(703)()},414:a=>{"use strict";a.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"}},e={};function n(a){var o=e[a];if(o!==void 0)return o.exports;var s=e[a]={exports:{}};return t[a](s,s.exports,n),s.exports}n.n=a=>{var o=a&&a.__esModule?()=>a.default:()=>a;return n.d(o,{a:o}),o},n.d=(a,o)=>{for(var s in o)n.o(o,s)&&!n.o(a,s)&&Object.defineProperty(a,s,{enumerable:!0,get:o[s]})},n.g=function(){if(typeof globalThis=="object")return globalThis;try{return this||new Function("return this")()}catch{if(typeof window=="object")return window}}(),n.o=(a,o)=>Object.prototype.hasOwnProperty.call(a,o),n.r=a=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(a,"__esModule",{value:!0})};var i={};(()=>{"use strict";n.r(i),n.d(i,{LazyLoadComponent:()=>Mn,LazyLoadImage:()=>vt,trackWindowScroll:()=>K});let a=nt();var o=n.n(a),s=n(697);let u=ms();var d=n.n(u);function p(){return typeof window<"u"&&"IntersectionObserver"in window&&"isIntersecting"in window.IntersectionObserverEntry.prototype}function f(j){return f=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(L){return typeof L}:function(L){return L&&typeof Symbol=="function"&&L.constructor===Symbol&&L!==Symbol.prototype?"symbol":typeof L},f(j)}function m(j,L){var $=Object.keys(j);if(Object.getOwnPropertySymbols){var it=Object.getOwnPropertySymbols(j);L&&(it=it.filter(function(Nt){return Object.getOwnPropertyDescriptor(j,Nt).enumerable})),$.push.apply($,it)}return $}function g(j,L,$){return(L=S(L))in j?Object.defineProperty(j,L,{value:$,enumerable:!0,configurable:!0,writable:!0}):j[L]=$,j}function v(j,L){for(var $=0;$<L.length;$++){var it=L[$];it.enumerable=it.enumerable||!1,it.configurable=!0,"value"in it&&(it.writable=!0),Object.defineProperty(j,S(it.key),it)}}function S(j){var L=function($,it){if(f($)!=="object"||$===null)return $;var Nt=$[Symbol.toPrimitive];if(Nt!==void 0){var Lt=Nt.call($,"string");if(f(Lt)!=="object")return Lt;throw new TypeError("@@toPrimitive must return a primitive value.")}return String($)}(j);return f(L)==="symbol"?L:String(L)}function E(j,L){return E=Object.setPrototypeOf?Object.setPrototypeOf.bind():function($,it){return $.__proto__=it,$},E(j,L)}function T(j){return T=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(L){return L.__proto__||Object.getPrototypeOf(L)},T(j)}var A=function(j){j.forEach(function(L){L.isIntersecting&&L.target.onVisible()})},x={},R=function(j){(function(G,Z){if(typeof Z!="function"&&Z!==null)throw new TypeError("Super expression must either be null or a function");G.prototype=Object.create(Z&&Z.prototype,{constructor:{value:G,writable:!0,configurable:!0}}),Object.defineProperty(G,"prototype",{writable:!1}),Z&&E(G,Z)})(jt,j);var L,$,it,Nt,Lt=(it=jt,Nt=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 G,Z=T(it);if(Nt){var mt=T(this).constructor;G=Reflect.construct(Z,arguments,mt)}else G=Z.apply(this,arguments);return function(yt,pt){if(pt&&(f(pt)==="object"||typeof pt=="function"))return pt;if(pt!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return function(Ut){if(Ut===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return Ut}(yt)}(this,G)});function jt(G){var Z;if(function(yt,pt){if(!(yt instanceof pt))throw new TypeError("Cannot call a class as a function")}(this,jt),(Z=Lt.call(this,G)).supportsObserver=!G.scrollPosition&&G.useIntersectionObserver&&p(),Z.supportsObserver){var mt=G.threshold;Z.observer=function(yt){return x[yt]=x[yt]||new IntersectionObserver(A,{rootMargin:yt+"px"}),x[yt]}(mt)}return Z}return L=jt,$=[{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 G=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.props.scrollPosition,Z=this.placeholder.getBoundingClientRect(),mt=d().findDOMNode(this.placeholder).style,yt=parseInt(mt.getPropertyValue("margin-left"),10)||0,pt=parseInt(mt.getPropertyValue("margin-top"),10)||0;return{bottom:G.y+Z.bottom+pt,left:G.x+Z.left+yt,right:G.x+Z.right+yt,top:G.y+Z.top+pt}}},{key:"isPlaceholderInViewport",value:function(){if(typeof window>"u"||!this.placeholder)return!1;var G=this.props,Z=G.scrollPosition,mt=G.threshold,yt=this.getPlaceholderBoundingBox(Z),pt=Z.y+window.innerHeight,Ut=Z.x,Ee=Z.x+window.innerWidth,ye=Z.y;return ye-mt<=yt.bottom&&pt+mt>=yt.top&&Ut-mt<=yt.right&&Ee+mt>=yt.left}},{key:"updateVisibility",value:function(){this.isPlaceholderInViewport()&&this.props.onVisible()}},{key:"render",value:function(){var G=this,Z=this.props,mt=Z.className,yt=Z.height,pt=Z.placeholder,Ut=Z.style,Ee=Z.width;if(pt&&typeof pt.type!="function")return o().cloneElement(pt,{ref:function(ve){return G.placeholder=ve}});var ye=function(ve){for(var Ye=1;Ye<arguments.length;Ye++){var He=arguments[Ye]!=null?arguments[Ye]:{};Ye%2?m(Object(He),!0).forEach(function(xn){g(ve,xn,He[xn])}):Object.getOwnPropertyDescriptors?Object.defineProperties(ve,Object.getOwnPropertyDescriptors(He)):m(Object(He)).forEach(function(xn){Object.defineProperty(ve,xn,Object.getOwnPropertyDescriptor(He,xn))})}return ve}({display:"inline-block"},Ut);return Ee!==void 0&&(ye.width=Ee),yt!==void 0&&(ye.height=yt),o().createElement("span",{className:mt,ref:function(ve){return G.placeholder=ve},style:ye},pt)}}],$&&v(L.prototype,$),Object.defineProperty(L,"prototype",{writable:!1}),jt}(o().Component);R.propTypes={onVisible:s.PropTypes.func.isRequired,className:s.PropTypes.string,height:s.PropTypes.oneOfType([s.PropTypes.number,s.PropTypes.string]),placeholder:s.PropTypes.element,threshold:s.PropTypes.number,useIntersectionObserver:s.PropTypes.bool,scrollPosition:s.PropTypes.shape({x:s.PropTypes.number.isRequired,y:s.PropTypes.number.isRequired}),width:s.PropTypes.oneOfType([s.PropTypes.number,s.PropTypes.string])},R.defaultProps={className:"",placeholder:null,threshold:100,useIntersectionObserver:!0};let C=R;var M=n(296),z=n.n(M),N=n(96),D=n.n(N),q=function(j){var L=getComputedStyle(j,null);return L.getPropertyValue("overflow")+L.getPropertyValue("overflow-y")+L.getPropertyValue("overflow-x")};let P=function(j){if(!(j instanceof HTMLElement))return window;for(var L=j;L&&L instanceof HTMLElement;){if(/(scroll|auto)/.test(q(L)))return L;L=L.parentNode}return window};function U(j){return U=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(L){return typeof L}:function(L){return L&&typeof Symbol=="function"&&L.constructor===Symbol&&L!==Symbol.prototype?"symbol":typeof L},U(j)}var J=["delayMethod","delayTime"];function at(){return at=Object.assign?Object.assign.bind():function(j){for(var L=1;L<arguments.length;L++){var $=arguments[L];for(var it in $)Object.prototype.hasOwnProperty.call($,it)&&(j[it]=$[it])}return j},at.apply(this,arguments)}function X(j,L){for(var $=0;$<L.length;$++){var it=L[$];it.enumerable=it.enumerable||!1,it.configurable=!0,"value"in it&&(it.writable=!0),Object.defineProperty(j,(Nt=function(Lt,jt){if(U(Lt)!=="object"||Lt===null)return Lt;var G=Lt[Symbol.toPrimitive];if(G!==void 0){var Z=G.call(Lt,"string");if(U(Z)!=="object")return Z;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(Lt)}(it.key),U(Nt)==="symbol"?Nt:String(Nt)),it)}var Nt}function tt(j,L){return tt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function($,it){return $.__proto__=it,$},tt(j,L)}function ut(j,L){if(L&&(U(L)==="object"||typeof L=="function"))return L;if(L!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return xt(j)}function xt(j){if(j===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return j}function lt(j){return lt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(L){return L.__proto__||Object.getPrototypeOf(L)},lt(j)}var dt=function(){return typeof window>"u"?0:window.scrollX||window.pageXOffset},Rt=function(){return typeof window>"u"?0:window.scrollY||window.pageYOffset};let K=function(j){var L=function($){(function(mt,yt){if(typeof yt!="function"&&yt!==null)throw new TypeError("Super expression must either be null or a function");mt.prototype=Object.create(yt&&yt.prototype,{constructor:{value:mt,writable:!0,configurable:!0}}),Object.defineProperty(mt,"prototype",{writable:!1}),yt&&tt(mt,yt)})(Z,$);var it,Nt,Lt,jt,G=(Lt=Z,jt=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 mt,yt=lt(Lt);if(jt){var pt=lt(this).constructor;mt=Reflect.construct(yt,arguments,pt)}else mt=yt.apply(this,arguments);return ut(this,mt)});function Z(mt){var yt;if(function(Ut,Ee){if(!(Ut instanceof Ee))throw new TypeError("Cannot call a class as a function")}(this,Z),(yt=G.call(this,mt)).useIntersectionObserver=mt.useIntersectionObserver&&p(),yt.useIntersectionObserver)return ut(yt);var pt=yt.onChangeScroll.bind(xt(yt));return mt.delayMethod==="debounce"?yt.delayedScroll=z()(pt,mt.delayTime):mt.delayMethod==="throttle"&&(yt.delayedScroll=D()(pt,mt.delayTime)),yt.state={scrollPosition:{x:dt(),y:Rt()}},yt.baseComponentRef=o().createRef(),yt}return it=Z,(Nt=[{key:"componentDidMount",value:function(){this.addListeners()}},{key:"componentWillUnmount",value:function(){this.removeListeners()}},{key:"componentDidUpdate",value:function(){typeof window>"u"||this.useIntersectionObserver||P(d().findDOMNode(this.baseComponentRef.current))!==this.scrollElement&&(this.removeListeners(),this.addListeners())}},{key:"addListeners",value:function(){typeof window>"u"||this.useIntersectionObserver||(this.scrollElement=P(d().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:dt(),y:Rt()}})}},{key:"render",value:function(){var mt=this.props,yt=(mt.delayMethod,mt.delayTime,function(Ut,Ee){if(Ut==null)return{};var ye,ve,Ye=function(xn,yi){if(xn==null)return{};var $a,Bl,Pl={},mr=Object.keys(xn);for(Bl=0;Bl<mr.length;Bl++)$a=mr[Bl],yi.indexOf($a)>=0||(Pl[$a]=xn[$a]);return Pl}(Ut,Ee);if(Object.getOwnPropertySymbols){var He=Object.getOwnPropertySymbols(Ut);for(ve=0;ve<He.length;ve++)ye=He[ve],Ee.indexOf(ye)>=0||Object.prototype.propertyIsEnumerable.call(Ut,ye)&&(Ye[ye]=Ut[ye])}return Ye}(mt,J)),pt=this.useIntersectionObserver?null:this.state.scrollPosition;return o().createElement(j,at({forwardRef:this.baseComponentRef,scrollPosition:pt},yt))}}])&&X(it.prototype,Nt),Object.defineProperty(it,"prototype",{writable:!1}),Z}(o().Component);return L.propTypes={delayMethod:s.PropTypes.oneOf(["debounce","throttle"]),delayTime:s.PropTypes.number,useIntersectionObserver:s.PropTypes.bool},L.defaultProps={delayMethod:"throttle",delayTime:300,useIntersectionObserver:!0},L};function Ct(j){return Ct=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(L){return typeof L}:function(L){return L&&typeof Symbol=="function"&&L.constructor===Symbol&&L!==Symbol.prototype?"symbol":typeof L},Ct(j)}function ee(j,L){for(var $=0;$<L.length;$++){var it=L[$];it.enumerable=it.enumerable||!1,it.configurable=!0,"value"in it&&(it.writable=!0),Object.defineProperty(j,(Nt=function(Lt,jt){if(Ct(Lt)!=="object"||Lt===null)return Lt;var G=Lt[Symbol.toPrimitive];if(G!==void 0){var Z=G.call(Lt,"string");if(Ct(Z)!=="object")return Z;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(Lt)}(it.key),Ct(Nt)==="symbol"?Nt:String(Nt)),it)}var Nt}function ce(j,L){return ce=Object.setPrototypeOf?Object.setPrototypeOf.bind():function($,it){return $.__proto__=it,$},ce(j,L)}function le(j){return le=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(L){return L.__proto__||Object.getPrototypeOf(L)},le(j)}var pe=function(j){(function(G,Z){if(typeof Z!="function"&&Z!==null)throw new TypeError("Super expression must either be null or a function");G.prototype=Object.create(Z&&Z.prototype,{constructor:{value:G,writable:!0,configurable:!0}}),Object.defineProperty(G,"prototype",{writable:!1}),Z&&ce(G,Z)})(jt,j);var L,$,it,Nt,Lt=(it=jt,Nt=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 G,Z=le(it);if(Nt){var mt=le(this).constructor;G=Reflect.construct(Z,arguments,mt)}else G=Z.apply(this,arguments);return function(yt,pt){if(pt&&(Ct(pt)==="object"||typeof pt=="function"))return pt;if(pt!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return function(Ut){if(Ut===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return Ut}(yt)}(this,G)});function jt(G){return function(Z,mt){if(!(Z instanceof mt))throw new TypeError("Cannot call a class as a function")}(this,jt),Lt.call(this,G)}return L=jt,($=[{key:"render",value:function(){return o().createElement(C,this.props)}}])&&ee(L.prototype,$),Object.defineProperty(L,"prototype",{writable:!1}),jt}(o().Component);let De=K(pe);function ne(j){return ne=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(L){return typeof L}:function(L){return L&&typeof Symbol=="function"&&L.constructor===Symbol&&L!==Symbol.prototype?"symbol":typeof L},ne(j)}function Di(j,L){for(var $=0;$<L.length;$++){var it=L[$];it.enumerable=it.enumerable||!1,it.configurable=!0,"value"in it&&(it.writable=!0),Object.defineProperty(j,(Nt=function(Lt,jt){if(ne(Lt)!=="object"||Lt===null)return Lt;var G=Lt[Symbol.toPrimitive];if(G!==void 0){var Z=G.call(Lt,"string");if(ne(Z)!=="object")return Z;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(Lt)}(it.key),ne(Nt)==="symbol"?Nt:String(Nt)),it)}var Nt}function ri(j,L){return ri=Object.setPrototypeOf?Object.setPrototypeOf.bind():function($,it){return $.__proto__=it,$},ri(j,L)}function me(j){if(j===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return j}function ge(j){return ge=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(L){return L.__proto__||Object.getPrototypeOf(L)},ge(j)}var $t=function(j){(function(G,Z){if(typeof Z!="function"&&Z!==null)throw new TypeError("Super expression must either be null or a function");G.prototype=Object.create(Z&&Z.prototype,{constructor:{value:G,writable:!0,configurable:!0}}),Object.defineProperty(G,"prototype",{writable:!1}),Z&&ri(G,Z)})(jt,j);var L,$,it,Nt,Lt=(it=jt,Nt=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 G,Z=ge(it);if(Nt){var mt=ge(this).constructor;G=Reflect.construct(Z,arguments,mt)}else G=Z.apply(this,arguments);return function(yt,pt){if(pt&&(ne(pt)==="object"||typeof pt=="function"))return pt;if(pt!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return me(yt)}(this,G)});function jt(G){var Z;(function(Ee,ye){if(!(Ee instanceof ye))throw new TypeError("Cannot call a class as a function")})(this,jt),Z=Lt.call(this,G);var mt=G.afterLoad,yt=G.beforeLoad,pt=G.scrollPosition,Ut=G.visibleByDefault;return Z.state={visible:Ut},Ut&&(yt(),mt()),Z.onVisible=Z.onVisible.bind(me(Z)),Z.isScrollTracked=!!(pt&&Number.isFinite(pt.x)&&pt.x>=0&&Number.isFinite(pt.y)&&pt.y>=0),Z}return L=jt,($=[{key:"componentDidUpdate",value:function(G,Z){Z.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 G=this.props,Z=G.className,mt=G.delayMethod,yt=G.delayTime,pt=G.height,Ut=G.placeholder,Ee=G.scrollPosition,ye=G.style,ve=G.threshold,Ye=G.useIntersectionObserver,He=G.width;return this.isScrollTracked||Ye&&p()?o().createElement(C,{className:Z,height:pt,onVisible:this.onVisible,placeholder:Ut,scrollPosition:Ee,style:ye,threshold:ve,useIntersectionObserver:Ye,width:He}):o().createElement(De,{className:Z,delayMethod:mt,delayTime:yt,height:pt,onVisible:this.onVisible,placeholder:Ut,style:ye,threshold:ve,width:He})}}])&&Di(L.prototype,$),Object.defineProperty(L,"prototype",{writable:!1}),jt}(o().Component);$t.propTypes={afterLoad:s.PropTypes.func,beforeLoad:s.PropTypes.func,useIntersectionObserver:s.PropTypes.bool,visibleByDefault:s.PropTypes.bool},$t.defaultProps={afterLoad:function(){return{}},beforeLoad:function(){return{}},useIntersectionObserver:!0,visibleByDefault:!1};let Mn=$t;function St(j){return St=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(L){return typeof L}:function(L){return L&&typeof Symbol=="function"&&L.constructor===Symbol&&L!==Symbol.prototype?"symbol":typeof L},St(j)}var It=["afterLoad","beforeLoad","delayMethod","delayTime","effect","placeholder","placeholderSrc","scrollPosition","threshold","useIntersectionObserver","visibleByDefault","wrapperClassName","wrapperProps"];function te(j,L){var $=Object.keys(j);if(Object.getOwnPropertySymbols){var it=Object.getOwnPropertySymbols(j);L&&(it=it.filter(function(Nt){return Object.getOwnPropertyDescriptor(j,Nt).enumerable})),$.push.apply($,it)}return $}function Hn(j){for(var L=1;L<arguments.length;L++){var $=arguments[L]!=null?arguments[L]:{};L%2?te(Object($),!0).forEach(function(it){Zn(j,it,$[it])}):Object.getOwnPropertyDescriptors?Object.defineProperties(j,Object.getOwnPropertyDescriptors($)):te(Object($)).forEach(function(it){Object.defineProperty(j,it,Object.getOwnPropertyDescriptor($,it))})}return j}function Zn(j,L,$){return(L=B(L))in j?Object.defineProperty(j,L,{value:$,enumerable:!0,configurable:!0,writable:!0}):j[L]=$,j}function tn(){return tn=Object.assign?Object.assign.bind():function(j){for(var L=1;L<arguments.length;L++){var $=arguments[L];for(var it in $)Object.prototype.hasOwnProperty.call($,it)&&(j[it]=$[it])}return j},tn.apply(this,arguments)}function bn(j,L){for(var $=0;$<L.length;$++){var it=L[$];it.enumerable=it.enumerable||!1,it.configurable=!0,"value"in it&&(it.writable=!0),Object.defineProperty(j,B(it.key),it)}}function B(j){var L=function($,it){if(St($)!=="object"||$===null)return $;var Nt=$[Symbol.toPrimitive];if(Nt!==void 0){var Lt=Nt.call($,"string");if(St(Lt)!=="object")return Lt;throw new TypeError("@@toPrimitive must return a primitive value.")}return String($)}(j);return St(L)==="symbol"?L:String(L)}function Q(j,L){return Q=Object.setPrototypeOf?Object.setPrototypeOf.bind():function($,it){return $.__proto__=it,$},Q(j,L)}function ft(j){return ft=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(L){return L.__proto__||Object.getPrototypeOf(L)},ft(j)}var ht=function(j){(function(G,Z){if(typeof Z!="function"&&Z!==null)throw new TypeError("Super expression must either be null or a function");G.prototype=Object.create(Z&&Z.prototype,{constructor:{value:G,writable:!0,configurable:!0}}),Object.defineProperty(G,"prototype",{writable:!1}),Z&&Q(G,Z)})(jt,j);var L,$,it,Nt,Lt=(it=jt,Nt=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 G,Z=ft(it);if(Nt){var mt=ft(this).constructor;G=Reflect.construct(Z,arguments,mt)}else G=Z.apply(this,arguments);return function(yt,pt){if(pt&&(St(pt)==="object"||typeof pt=="function"))return pt;if(pt!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return function(Ut){if(Ut===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return Ut}(yt)}(this,G)});function jt(G){var Z;return function(mt,yt){if(!(mt instanceof yt))throw new TypeError("Cannot call a class as a function")}(this,jt),(Z=Lt.call(this,G)).state={loaded:!1},Z}return L=jt,($=[{key:"onImageLoad",value:function(){var G=this;return this.state.loaded?null:function(Z){G.props.onLoad(Z),G.props.afterLoad(),G.setState({loaded:!0})}}},{key:"getImg",value:function(){var G=this.props,Z=(G.afterLoad,G.beforeLoad,G.delayMethod,G.delayTime,G.effect,G.placeholder,G.placeholderSrc,G.scrollPosition,G.threshold,G.useIntersectionObserver,G.visibleByDefault,G.wrapperClassName,G.wrapperProps,function(mt,yt){if(mt==null)return{};var pt,Ut,Ee=function(ve,Ye){if(ve==null)return{};var He,xn,yi={},$a=Object.keys(ve);for(xn=0;xn<$a.length;xn++)He=$a[xn],Ye.indexOf(He)>=0||(yi[He]=ve[He]);return yi}(mt,yt);if(Object.getOwnPropertySymbols){var ye=Object.getOwnPropertySymbols(mt);for(Ut=0;Ut<ye.length;Ut++)pt=ye[Ut],yt.indexOf(pt)>=0||Object.prototype.propertyIsEnumerable.call(mt,pt)&&(Ee[pt]=mt[pt])}return Ee}(G,It));return o().createElement("img",tn({},Z,{onLoad:this.onImageLoad()}))}},{key:"getLazyLoadImage",value:function(){var G=this.props,Z=G.beforeLoad,mt=G.className,yt=G.delayMethod,pt=G.delayTime,Ut=G.height,Ee=G.placeholder,ye=G.scrollPosition,ve=G.style,Ye=G.threshold,He=G.useIntersectionObserver,xn=G.visibleByDefault,yi=G.width;return o().createElement(Mn,{beforeLoad:Z,className:mt,delayMethod:yt,delayTime:pt,height:Ut,placeholder:Ee,scrollPosition:ye,style:ve,threshold:Ye,useIntersectionObserver:He,visibleByDefault:xn,width:yi},this.getImg())}},{key:"getWrappedLazyLoadImage",value:function(G){var Z=this.props,mt=Z.effect,yt=Z.height,pt=Z.placeholderSrc,Ut=Z.width,Ee=Z.wrapperClassName,ye=Z.wrapperProps,ve=this.state.loaded,Ye=ve?" lazy-load-image-loaded":"",He=ve||!pt?{}:{backgroundImage:"url(".concat(pt,")"),backgroundSize:"100% 100%"};return o().createElement("span",tn({className:Ee+" lazy-load-image-background "+mt+Ye,style:Hn(Hn({},He),{},{color:"transparent",display:"inline-block",height:yt,width:Ut})},ye),G)}},{key:"render",value:function(){var G=this.props,Z=G.effect,mt=G.placeholderSrc,yt=G.visibleByDefault,pt=G.wrapperClassName,Ut=G.wrapperProps,Ee=this.getLazyLoadImage();return(Z||mt)&&!yt||pt||Ut?this.getWrappedLazyLoadImage(Ee):Ee}}])&&bn(L.prototype,$),Object.defineProperty(L,"prototype",{writable:!1}),jt}(o().Component);ht.propTypes={onLoad:s.PropTypes.func,afterLoad:s.PropTypes.func,beforeLoad:s.PropTypes.func,delayMethod:s.PropTypes.string,delayTime:s.PropTypes.number,effect:s.PropTypes.string,placeholderSrc:s.PropTypes.string,threshold:s.PropTypes.number,useIntersectionObserver:s.PropTypes.bool,visibleByDefault:s.PropTypes.bool,wrapperClassName:s.PropTypes.string,wrapperProps:s.PropTypes.object},ht.defaultProps={onLoad:function(){},afterLoad:function(){return{}},beforeLoad:function(){return{}},delayMethod:"throttle",delayTime:300,effect:"",placeholderSrc:null,threshold:100,useIntersectionObserver:!0,visibleByDefault:!1,wrapperClassName:""};let vt=ht})(),C4.exports=i})()});var iF={};nP(iF,{AnnotationContext:()=>B9,AnnotationPageContext:()=>P9,AnnotationStyleProvider:()=>H7,AtlasStoreProvider:()=>Xc,AtlasStoreReactContext:()=>Hs,Auth:()=>T1,AuthProvider:()=>A1,AuthRContext:()=>fs,AuthReactContext:()=>VM,AuthReactContextActions:()=>jM,CanvasAnnotations:()=>T9,CanvasContext:()=>ma,CanvasPanel:()=>wn,CanvasStrategyProvider:()=>XR,CanvasWorldObject:()=>ZR,CollectionContext:()=>H9,CombinedMetadata:()=>C9,ComplexTimelineProvider:()=>lR,ContextBridge:()=>$h,ControlsReactContext:()=>Ih,CreateCustomShape:()=>tT,CustomContextBridge:()=>n4,CustomContextBridgeProvider:()=>a9,DEFAULT_BEZIER:()=>mp,DEFAULT_POLL_INTERVAL:()=>sT,DefaultEditingTools:()=>u4,EASING_PRESETS:()=>uT,EventEmitterProvider:()=>Kj,EventsProvider:()=>i9,Image:()=>R4,ImageService:()=>M9,ImageServiceLoaderContext:()=>HD,InnerViewerProvider:()=>QM,LanguageProvider:()=>Q7,LanguageString:()=>ZD,LocaleString:()=>oa,ManifestContext:()=>d1,ManifestMetadata:()=>_9,MediaPlayerProvider:()=>zh,Metadata:()=>hp,PolygonSelector:()=>R9,RangeContext:()=>h1,ReactEmitterContext:()=>pv,ReactEventContext:()=>Ws,ReactVaultContext:()=>Ur,RegionHighlight:()=>jA,Render3DModelStrategy:()=>ZA,RenderAccompanyingCanvas:()=>WA,RenderAnnotation:()=>Vs,RenderAnnotationEditing:()=>BR,RenderAnnotationPage:()=>Al,RenderAnnotationStrategy:()=>nR,RenderAudioStrategy:()=>oR,RenderComplexTimelineStrategy:()=>fR,RenderEmptyStrategy:()=>dR,RenderImageStrategy:()=>hR,RenderSvgEditorControls:()=>L9,RenderTextualContentStrategy:()=>pR,RenderVideoStrategy:()=>gR,RenderYouTubeStrategy:()=>yR,ResizeWorldItem:()=>UA,ResourceProvider:()=>ci,ResourceReactContext:()=>Yf,SelectorControllerProvider:()=>x9,SequenceThumbnails:()=>I9,SimpleViewerProvider:()=>w1,SimpleViewerReactContext:()=>Qu,SingleCanvasThumbnail:()=>oT,StrategyReactContext:()=>Tl,ThumbnailFallbackImage:()=>ks,TranslationProvider:()=>Y7,TransliterationProvider:()=>X7,VaultProvider:()=>Io,ViewerPresetContext:()=>Xa,VirtualAnnotationProvider:()=>eR,VisibleCanvasReactContext:()=>us,annotationResponseToSelector:()=>nF,authDetailsForResource:()=>b1,buildTransitions:()=>fT,cachedParseCssToBoxStyleMap:()=>eb,convertBoxStyleToSelectorStyle:()=>e2,convertSelectorStyleToBoxStyle:()=>cm,createAtlasStore:()=>zA,createAuthStateStore:()=>v1,createProbe:()=>S1,cubicBezierEasing:()=>mf,defaultEmitter:()=>t4,defaultSvgTheme:()=>lL,emptyActions:()=>PR,emptyStrategy:()=>HR,expandTarget:()=>an,findAllCanvasesInRange:()=>Qm,findFirstCanvasFromRange:()=>EM,findManifestSelectedRange:()=>K6,findSelectedRange:()=>p1,flattenAnnotationPageIds:()=>UR,formatTime:()=>xv,get3dStrategy:()=>qR,getAtlasStoreByName:()=>DA,getComplexTimelineStrategy:()=>GR,getDefaultAnnotationStyles:()=>LA,getImageStrategy:()=>lp,getManifestSequence:()=>Xm,getParsedTargetSelector:()=>np,getRenderingStrategy:()=>cp,getSelectorTransformAttributes:()=>Ir,getStepFromProgress:()=>dT,getTextualContentStrategy:()=>sp,getVideoStrategy:()=>up,getVisibleCanvasesFromCanvasId:()=>Z6,hasAuth:()=>yH,interpolateRect:()=>cT,isBoxSelector:()=>B7,isImageApiSelector:()=>fm,isRectangle:()=>Yc,isSvgSelector:()=>pD,isValidCanvasFragment:()=>dm,makeAccessServiceRequest:()=>y1,makeAccessTokenRequest:()=>Jm,parseCssToBoxStyleMap:()=>WS,parseCssTransform:()=>$S,parseCssTransformOrigin:()=>JS,parseCssTransformStyle:()=>tb,parseRotation:()=>hm,parseSelector:()=>_o,parseSpecificResource:()=>s9,polygonToTarget:()=>Qc,requestToAnnotationResponse:()=>Ch,resolveSelectorStyle:()=>Dr,seraliseSupportedSelector:()=>vv,splitCanvasFragment:()=>$l,svgThemes:()=>b9,targetIntersects:()=>tF,unknownResponse:()=>ip,unsupportedStrategy:()=>Pe,useAnnotation:()=>Mh,useAnnotationPage:()=>qA,useAnnotationPageManager:()=>op,useAnnotationStyles:()=>wh,useAnnotationsAtTime:()=>U9,useAtlasContextMenu:()=>ep,useAtlasStore:()=>Ie,useAuthActions:()=>qM,useAuthService:()=>FM,useAuthStore:()=>ku,useAuthToken:()=>SH,useAuthTokens:()=>x1,useCanvas:()=>zt,useCanvasChoices:()=>V9,useCanvasClock:()=>j9,useCanvasSequence:()=>m1,useCanvasStartTime:()=>Nh,useCanvasSubset:()=>q9,useClosestLanguage:()=>JD,useCollection:()=>F9,useComplexTimeline:()=>k7,useContextBridge:()=>Jh,useContextMenuStore:()=>s4,useCreateLocaleString:()=>K7,useCurrentAnnotationActions:()=>G9,useCurrentAnnotationMetadata:()=>k9,useCurrentAnnotationRequest:()=>LR,useCurrentAnnotationTransition:()=>Y9,useCurrentAuth:()=>vH,useCustomContextBridge:()=>Wh,useDispatch:()=>JA,useEmitter:()=>OA,useEvent:()=>Ps,useEventEmitter:()=>Kh,useEventListener:()=>Q9,useExistingVault:()=>Do,useExternalCollection:()=>X9,useExternalManifest:()=>f1,useExternalResource:()=>id,useIIIFLanguage:()=>Nv,useImage:()=>u0,useImageService:()=>lT,useImageServiceLoader:()=>Dh,useImageTile:()=>K9,useIsAuthEnabled:()=>R1,useLoadImageService:()=>rp,useLocaleString:()=>$D,useManifest:()=>on,useMediaActions:()=>V7,useMediaElements:()=>j7,useMediaState:()=>U7,usePaintables:()=>jR,usePaintingAnnotations:()=>dr,usePolygonHelper:()=>vR,useRange:()=>ad,useRemoteStylesheet:()=>PA,useRenderControls:()=>hi,useRenderingStrategy:()=>YR,useRequestAnnotation:()=>$R,useResourceContext:()=>ti,useResourceEvents:()=>_h,useResources:()=>VR,useSearchService:()=>C1,useSelectorController:()=>nT,useSelectorEmitter:()=>E9,useSelectorEvents:()=>eT,useSelectorHelper:()=>A9,useSimpleMediaPlayer:()=>js,useSimpleViewer:()=>ds,useStaticRenderingStrategy:()=>Z9,useStrategy:()=>Fe,useStyleHelper:()=>W9,useStyles:()=>Us,useStylesheetStore:()=>gD,useSvgEditor:()=>SR,useSvgEditorControls:()=>rT,useThumbnail:()=>lr,useTranslations:()=>uR,useTransliteration:()=>sR,useVault:()=>Vt,useVaultEffect:()=>iR,useVaultSelector:()=>re,useViewerPreset:()=>Lh,useViewportScroll:()=>$9,useViewportTour:()=>J9,useVirtualAnnotationPage:()=>$A,useVirtualAnnotationPageContext:()=>tR,useVisibleCanvases:()=>cs});function Ff(t){"@babel/helpers - typeof";return Ff=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ff(t)}function aP(t,e){if(Ff(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var i=n.call(t,e||"default");if(Ff(i)!="object")return i;throw TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function oP(t){var e=aP(t,"string");return Ff(e)=="symbol"?e:e+""}function Rn(t,e,n){return(e=oP(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var rP=Object.create,Jw=Object.defineProperty,lP=Object.getOwnPropertyDescriptor,sP=Object.getOwnPropertyNames,uP=Object.getPrototypeOf,cP=Object.prototype.hasOwnProperty,XS=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var fP=(t,e,n,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(var a=sP(e),o=0,s=a.length,u;o<s;o++)u=a[o],!cP.call(t,u)&&u!==n&&Jw(t,u,{get:(d=>e[d]).bind(null,u),enumerable:!(i=lP(e,u))||i.enumerable});return t},KS=(t,e,n)=>(n=t==null?{}:rP(uP(t)),fP(e||!t||!t.__esModule?Jw(n,"default",{value:t,enumerable:!0}):n,t));var dP=/^(-?(?:\d+|\d*\.\d+))(px|%)?$/,hP=/^(-?(?:\d+|\d*\.\d+))(deg|rad|turn)?$/,$w=/([a-zA-Z0-9]+)\(([^)]*)\)/g;function pP(t){if(t==="%")return"percent";if(!t||t==="px")return"pixel"}function Cu(t){let e=dP.exec(t.trim());if(e)return{value:Number.parseFloat(e[1]),unit:pP(e[2])}}function mP(t){let[e,n=e]=t.trim().split(/\s+/),i=Cu(e),a=Cu(n);if(!i||!a)return;let o={x:i.value,y:a.value};return i.unit&&i.unit===a.unit?o.unit=i.unit:(i.unit&&(o.xUnit=i.unit),a.unit&&(o.yUnit=a.unit)),o}function gP(t){let e=hP.exec(t.trim());if(!e)return;let n=Number.parseFloat(e[1]),i=e[2]||"deg";return i==="rad"?n*180/Math.PI:i==="turn"?n*360:n}function ZS(t,e){return t?{x:t.x+e.x,y:t.y+e.y,...t.unit&&t.unit===e.unit?{unit:t.unit}:{}}:e}function WS(t){let e={},n=t.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\s+/g," ").trim(),i=/([^{]+)\{([^}]+)\}/g,a;for(;(a=i.exec(n))!==null;){let o=a[1].trim(),s=a[2].trim(),u=o.match(/\.([a-zA-Z0-9_-]+)/);if(!u)continue;let d=u[1],p=s.split(";").filter(m=>m.trim()),f={};for(let m of p){let[g,v]=m.split(":").map(S=>S.trim());if(!(!g||!v))switch(g){case"background-color":f.backgroundColor=v;break;case"opacity":f.opacity=parseFloat(v);break;case"box-shadow":f.boxShadow=v;break;case"border-color":f.borderColor=v;break;case"border-width":f.borderWidth=v;break;case"border-style":f.borderStyle=v;break;case"outline-color":f.outlineColor=v;break;case"outline-width":f.outlineWidth=v;break;case"outline-offset":f.outlineOffset=v;break;case"outline-style":f.outlineStyle=v;break;case"border":f.border=v;break;case"outline":f.outline=v;break;case"background":f.background=v;break;case"transform":f.transform=v;break;case"transform-origin":f.transformOrigin=v;break}}e[d]=f}return e}function cm(t){let e={};return t&&(t.fill&&(e.backgroundColor=t.fill,t.fillOpacity),t.stroke&&(e.borderColor=t.stroke),t.strokeWidth&&(e.borderWidth=t.strokeWidth)),e}function e2(t){let e={};if(t.backgroundColor&&(e.fill=t.backgroundColor),!e.fill&&t.background&&(e.fill=t.background),t.opacity!==void 0&&(e.fillOpacity=t.opacity),t.borderColor&&(e.stroke=t.borderColor),!e.stroke&&t.border){let n=t.border.split(" ").find(i=>i.startsWith("#")||i.startsWith("rgb")||i.match(/^[a-z]+$/i));n&&(e.stroke=n)}if(t.borderWidth&&(e.strokeWidth=t.borderWidth),!e.strokeWidth&&t.border){let n=t.border.split(" ").find(i=>i.match(/^\d+(?:px|em|rem|%)?$/));n&&(e.strokeWidth=n)}return e}function JS(t){if(t)return mP(t)}function $S(t){let e={};if(!t)return e;e.transform=t;let n;for($w.lastIndex=0;(n=$w.exec(t))!==null;){let i=n[1].toLowerCase(),a=n[2].split(",").flatMap(o=>o.trim().split(/\s+/)).filter(Boolean);if(i==="rotate"){let o=gP(a[0]||"");o!==void 0&&(e.rotation=o);continue}if(i==="translatex"){let o=Cu(a[0]||"");o&&(e.translate=ZS(e.translate,{x:o.value,y:0,...o.unit?{unit:o.unit}:{}}));continue}if(i==="translatey"){let o=Cu(a[0]||"");o&&(e.translate=ZS(e.translate,{x:0,y:o.value,...o.unit?{unit:o.unit}:{}}));continue}if(i==="translate"){let o=Cu(a[0]||""),s=Cu(a[1]||"0");if(o&&s){let u={x:o.value,y:s.value};o.unit&&o.unit===s.unit?u.unit=o.unit:(o.unit&&(u.xUnit=o.unit),s.unit&&(u.yUnit=s.unit)),e.translate=ZS(e.translate,u)}}}return e}function tb(t){let e=$S(t?.transform),n=JS(t?.transformOrigin);return t?.transformOrigin&&(e.transformOrigin=t.transformOrigin),n&&(e.rotationOrigin=n),e}function Ir(t){let e=tb(t),n={};return e.rotation!==void 0&&(n.rotation=e.rotation),e.rotationOrigin&&(n.rotationOrigin=e.rotationOrigin),e.translate&&(n.translate=e.translate),(e.rotation!==void 0||e.rotationOrigin||e.translate||e.transform||e.transformOrigin)&&(n.transform=e),n}var t2=new Map;function eb(t,e){let n=t2.get(t);if(n?.css===e)return n.styleMap;let i=WS(e);return t2.set(t,{css:e,styleMap:Object.fromEntries(Object.entries(i).map(([a,o])=>[a,o]))}),i}function Dr(t,e,n={}){if(!t||!e)return cm(n||{});let i=cm(n||{}),a=Object.entries(e);for(let[o,s]of a){if(!s)continue;let u=eb(o,s),d=Object.entries(u);for(let[p,f]of d)p===t&&Object.assign(i,f)}return i}function yP(t,e,n,i=1){return new o2(t,e,n).subdivide(i)}function vP(t,e,n,i,a=1){return new bP(new Float64Array([t.x,t.y,e.x,e.y,n.x,n.y,i.x,i.y])).subdivide(a)}function SP(t){return t.x*t.x+t.y*t.y}function Gf(t){let e=.67;return t/(1-e+(e**4+.25*t*t)**.25)}function wu(t){let e=.39;return t*(1-e+Math.sqrt(e*e+.25*t*t))}var o2=class{constructor(t,e,n){Rn(this,"start",void 0),Rn(this,"control",void 0),Rn(this,"end",void 0),this.start=t,this.control=e,this.end=n}eval(t){let e=1-t;return{x:this.start.x*e*e+2*this.control.x*e*t+this.end.x*t*t,y:this.start.y*e*e+2*this.control.y*e*t+this.end.y*t*t}}mapToBasic(){let{x:t,y:e}=this.start,{x:n,y:i}=this.control,{x:a,y:o}=this.end,s=2*n-t-a,u=2*i-e-o,d=(n-t)*s+(i-e)*u,p=(a-n)*s+(o-i)*u,f=(a-t)*u-(o-e)*s,m=d/f,g=p/f;return{x0:t,x2:a,scale:Math.abs(f)/(Math.hypot(s,u)*Math.abs(g-m)),cross:f}}subdivide(t){let e=this.mapToBasic(),n=Gf(e.x0),i=Gf(e.x2),a=.5*Math.abs(i-n)*Math.sqrt(e.scale/t),o=Math.ceil(a),s=wu(n),u=wu(i),d=[0];for(let p=1;p<o;p++){let f=(wu(n+(i-n)*p/o)-s)/(u-s);d.push(f)}return d.push(1),d.map(p=>this.eval(p))}},bP=class r2{constructor(e){Rn(this,"c",void 0),this.c=e}weightsum(e,n,i,a){return{x:e*this.c[0]+n*this.c[2]+i*this.c[4]+a*this.c[6],y:e*this.c[1]+n*this.c[3]+i*this.c[5]+a*this.c[7]}}eval(e){let n=1-e,i=n*n*n,a=3*n*n*e,o=3*n*e*e,s=e*e*e;return this.weightsum(i,a,o,s)}deriv(e){let n=1-e,i=-3*n*n,a=3*e*e,o=-6*e*n-i,s=6*e*n-a;return this.weightsum(i,o,s,a)}midpoint_quadbez(){let e=this.weightsum(-.25,.75,.75,-.25);return new o2({x:this.c[0],y:this.c[1]},e,{x:this.c[6],y:this.c[7]})}subsegment(e,n){let i=new Float64Array(8),a=this.eval(e),o=this.eval(n);i[0]=a.x,i[1]=a.y;let s=(n-e)/3,u=this.deriv(e);i[2]=a.x+s*u.x,i[3]=a.y+s*u.y;let d=this.deriv(n);return i[4]=o.x-s*d.x,i[5]=o.y-s*d.y,i[6]=o.x,i[7]=o.y,new r2(i)}subdivide(e){let n=.1*e,i=e-n,a=Math.sqrt(i),o=SP(this.weightsum(1,-3,3,-1)),s=Math.ceil((o/(432*n*n))**(1/6)),u=[],d=0;for(let S=0;S<s;S++){let E=S/s,T=(S+1)/s,A=this.subsegment(E,T).midpoint_quadbez(),x=A.mapToBasic(),R=Gf(x.x0),C=Gf(x.x2),M=Math.sqrt(x.scale),z=Math.abs(C-R)*M;if(Math.sign(x.x0)!=Math.sign(x.x2)){let N=a/M,D=a*Math.abs(C-R)/Gf(N);z=Math.max(z,D)}u.push({quad:A,a0:R,a2:C,val:z}),d+=z}let p=.5*d/a,f=Math.ceil(p),m=[{x:this.c[0],y:this.c[1]}],g=0,v=0;for(let S=1;S<f;S++){let E=d*S/f;for(;g+u[v].val<E;)g+=u[v].val,v++;let T=u[v].a0,A=u[v].a2,x=wu(T),R=wu(A),C=(wu(T+(A-T)*(E-g)/u[v].val)-x)/(R-x);m.push(u[v].quad.eval(C))}return m.push({x:this.c[6],y:this.c[7]}),m}},xP=function(){function t(e,n){var i=[],a=!0,o=!1,s=void 0;try{for(var u=e[Symbol.iterator](),d;!(a=(d=u.next()).done)&&(i.push(d.value),!(n&&i.length===n));a=!0);}catch(p){o=!0,s=p}finally{try{!a&&u.return&&u.return()}finally{if(o)throw s}}return i}return function(e,n){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,n);throw TypeError("Invalid attempt to destructure non-iterable instance")}}(),kf=Math.PI*2,nb=function(t,e,n,i,a,o,s){var u=t.x,d=t.y;u*=e,d*=n;var p=i*u-a*d,f=a*u+i*d;return{x:p+o,y:f+s}},EP=function(t,e){var n=e===1.5707963267948966?.551915024494:e===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(e/4),i=Math.cos(t),a=Math.sin(t),o=Math.cos(t+e),s=Math.sin(t+e);return[{x:i-a*n,y:a+i*n},{x:o+s*n,y:s-o*n},{x:o,y:s}]},n2=function(t,e,n,i){var a=t*i-e*n<0?-1:1,o=t*n+e*i;return o>1&&(o=1),o<-1&&(o=-1),a*Math.acos(o)},AP=function(t,e,n,i,a,o,s,u,d,p,f,m){var g=a**2,v=o**2,S=f**2,E=m**2,T=g*v-g*E-v*S;T<0&&(T=0),T/=g*E+v*S,T=Math.sqrt(T)*(s===u?-1:1);var A=T*a/o*m,x=T*-o/a*f,R=p*A-d*x+(t+n)/2,C=d*A+p*x+(e+i)/2,M=(f-A)/a,z=(m-x)/o,N=(-f-A)/a,D=(-m-x)/o,q=n2(1,0,M,z),P=n2(M,z,N,D);return u===0&&P>0&&(P-=kf),u===1&&P<0&&(P+=kf),[R,C,q,P]},RP=function(t){var e=t.px,n=t.py,i=t.cx,a=t.cy,o=t.rx,s=t.ry,u=t.xAxisRotation,d=u===void 0?0:u,p=t.largeArcFlag,f=p===void 0?0:p,m=t.sweepFlag,g=m===void 0?0:m,v=[];if(o===0||s===0)return[];var S=Math.sin(d*kf/360),E=Math.cos(d*kf/360),T=E*(e-i)/2+S*(n-a)/2,A=-S*(e-i)/2+E*(n-a)/2;if(T===0&&A===0)return[];o=Math.abs(o),s=Math.abs(s);var x=T**2/o**2+A**2/s**2;x>1&&(o*=Math.sqrt(x),s*=Math.sqrt(x));var R=xP(AP(e,n,i,a,o,s,f,g,S,E,T,A),4),C=R[0],M=R[1],z=R[2],N=R[3],D=Math.abs(N)/(kf/4);Math.abs(1-D)<1e-7&&(D=1);var q=Math.max(Math.ceil(D),1);N/=q;for(var P=0;P<q;P++)v.push(EP(z,N)),z+=N;return v.map(function(U){var J=nb(U[0],o,s,E,S,C,M),at=J.x,X=J.y,tt=nb(U[1],o,s,E,S,C,M),ut=tt.x,xt=tt.y,lt=nb(U[2],o,s,E,S,C,M);return{x1:at,y1:X,x2:ut,y2:xt,x:lt.x,y:lt.y}})},TP=XS((t,e)=>{e.exports=a;var n={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},i=/([astvzqmhlc])([^astvzqmhlc]*)/gi;function a(u){var d=[];return u.replace(i,function(p,f,m){var g=f.toLowerCase();for(m=s(m),g=="m"&&m.length>2&&(d.push([f].concat(m.splice(0,2))),g="l",f=f=="m"?"l":"L");;){if(m.length==n[g])return m.unshift(f),d.push(m);if(m.length<n[g])throw Error("malformed path data");d.push([f].concat(m.splice(0,n[g])))}}),d}var o=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/gi;function s(u){var d=u.match(o);return d?d.map(Number):[]}}),CP=XS((t,e)=>{e.exports=n;function n(i){var a=0,o=0,s=0,u=0;return i.map(function(d){d=d.slice();var p=d[0],f=p.toUpperCase();if(p!=f)switch(d[0]=f,p){case"a":d[6]+=s,d[7]+=u;break;case"v":d[1]+=u;break;case"h":d[1]+=s;break;default:for(var m=1;m<d.length;)d[m++]+=s,d[m++]+=u}switch(f){case"Z":s=a,u=o;break;case"H":s=d[1];break;case"V":u=d[1];break;case"M":s=a=d[1],u=o=d[2];break;default:s=d[d.length-2],u=d[d.length-1]}return d})}}),wP=KS(TP(),1),MP=KS(CP(),1);function OP(t){let e=(0,MP.default)((0,wP.default)(t)),n,i=0,a=0,o=0,s=0,u,d,p=0,f=0,m=[];for(let g=0;g<e.length;g++){let v=e[g],S=v[0];switch(S){case"M":i=v[1],a=v[2];break;case"H":v=["L",v[1],a];break;case"V":v=["L",i,v[1]];break;case"S":{let E=p,T=f;(n==="C"||n=="S")&&(E+=E-o,T+=T-s),v=["C",E,T,v[1],v[2],v[3],v[4]]}break;case"T":n==="Q"||n=="T"?(u=p*2-u,d=f*2-d):(u=p,d=f),v=["Q",u,d,v[1],v[2]];break;case"Q":u=v[1],d=v[2];break;case"A":{let E=RP({px:p,py:f,cx:v[6],cy:v[7],rx:v[1],ry:v[2],xAxisRotation:v[3],largeArcFlag:v[4],sweepFlag:v[5]});if(!E.length)continue;for(let[T,A]of E.entries())v=["C",A.x1,A.y1,A.x2,A.y2,A.x,A.y],T<E.length-1&&m.push(v);v=v}break;case"Z":v=["L",i,a];break}n=S,p=v[v.length-2],f=v[v.length-1],["C","Q","A"].indexOf(S)>-1?(o=v[v.length-4],s=v[v.length-3]):(o=p,s=f),m.push(v)}return m}var _P=/&?(xywh=)?(pixel:|percent:|pct:)?([0-9]+(?:\.[0-9]+)?),([0-9]+(?:\.[0-9]+)?),([0-9]+(?:\.[0-9]+)?),([0-9]+(?:\.[0-9]+)?)/,i2=/&?(t=)(npt:)?([0-9]+(\.[0-9]+)?)?(,([0-9]+(\.[0-9]+)?))?/,a2=/^rgba\((\d+),(\d+),(\d+),([0-9.]+)\)$/;function _o(t,{domParser:e,svgPreprocessor:n,iiifRenderingHints:i,loadedStylesheets:a}={},{styleClass:o}={}){if(Array.isArray(t))return pa(t.reduce((s,u)=>{let{selector:d,selectors:p,iiifRenderingHints:f}=_o(u,{domParser:e,svgPreprocessor:n,iiifRenderingHints:i,loadedStylesheets:a},{styleClass:o});return d&&(s.selector?(!s.selector.temporal&&d.temporal&&(s.selector.temporal=d.temporal),!s.selector.spatial&&d.spatial&&(s.selector.spatial=d.spatial),!s.selector.svg&&d.svg&&(s.selector.svg=d.svg),!s.selector.svgShape&&d.svgShape&&(s.selector.svgShape=d.svgShape)):s.selector=d,s.selectors.push(...p)),f&&(s.iiifRenderingHints=s.iiifRenderingHints||{type:"ImageApiSelector"},Object.assign(s.iiifRenderingHints,f)),s},{selector:null,selectors:[],iiifRenderingHints:i}));if(!t)return pa({selector:null,selectors:[],iiifRenderingHints:i});if(typeof t=="string"){let[s,u]=$l(t);return u?_o({type:"FragmentSelector",value:u},{svgPreprocessor:n,iiifRenderingHints:i,domParser:e,loadedStylesheets:a},{styleClass:o}):pa({selector:null,selectors:[],iiifRenderingHints:i})}if(t.type){if(t.type==="PointSelector"&&(t.t||t.t===0)){let s={type:"TemporalSelector",temporal:{startTime:t.t}};return pa({selector:s,selectors:[s],iiifRenderingHints:i})}if(t.type==="PointSelector"&&t.x&&t.y){let s={type:"PointSelector",spatial:{x:t.x,y:t.y}};return pa({selector:s,selectors:[s],iiifRenderingHints:i})}}if(fm(t)){let s=[];if(t.region){let u=_o({type:"FragmentSelector",value:"xywh="+t.region},{domParser:e,svgPreprocessor:n,iiifRenderingHints:i,loadedStylesheets:a},{styleClass:o});s.push(...u.selectors)}return pa({selector:s[0],selectors:s,iiifRenderingHints:i?{...i,...t}:t})}if(t.type==="FragmentSelector"){let s=_P.exec(t.value);if(s){let d=Dr(o,a),p={type:"BoxSelector",spatial:{unit:s[2]==="percent:"||s[2]==="pct:"?"percent":"pixel",x:Number.parseFloat(s[3]),y:Number.parseFloat(s[4]),width:Number.parseFloat(s[5]),height:Number.parseFloat(s[6])},boxStyle:d,...Ir(d)},f=t.value.match(i2);if(f){let m=Dr(o,a);p={type:"TemporalBoxSelector",spatial:p.spatial,temporal:{startTime:f[3]?Number.parseFloat(f[3]):0,endTime:f[6]?Number.parseFloat(f[6]):void 0},boxStyle:m,...Ir(m)}}return pa({selector:p,selectors:[p],iiifRenderingHints:i})}let u=t.value.match(i2);if(u){let d={type:"TemporalSelector",temporal:{startTime:u[3]?Number.parseFloat(u[3]):0,endTime:u[6]?Number.parseFloat(u[6]):void 0}};return pa({selector:d,selectors:[d],iiifRenderingHints:i})}return pa({selector:null,selectors:[],iiifRenderingHints:i})}if(t.type==="SvgSelector"&&"value"in t){e||(typeof window<"u"?e=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 s=[],u,d,p=n?.(t.value)??t.value,f;if(e){let v=e.parseFromString(t.value,"image/svg+xml").querySelector("svg");if(!v)return console.warn(`Illegal SVG selector: ${t.value}`),pa({selector:null,selectors:[],iiifRenderingHints:i});let S=l2(v);S&&(s=S.points,f=S.shapeType,u=[Math.min(...s.map(E=>E[0])),Math.min(...s.map(E=>E[1])),Math.max(...s.map(E=>E[0])),Math.max(...s.map(E=>E[1]))],{style:d,svg:p}=IP(S.element)??{svg:p})}let m=Dr(o,a,d),g={type:"SvgSelector",svg:p,svgShape:f,style:d,boxStyle:m,...Ir(m),points:s.length?s:void 0,spatial:u?{unit:"pixel",x:u[0],y:u[1],width:u[2]-u[0],height:u[3]-u[1]}:void 0};return pa({selector:g,selectors:[g],iiifRenderingHints:i})}return pa({selector:null,selectors:[],iiifRenderingHints:i})}function zP(t){let e=t.map(i=>i[0]).reduce((i,a)=>(i[a]+=1,i),{C:0,Q:0,L:0,M:0}),n=new Set(t.map(i=>i[0]));if(e.C>0||e.Q>0)return"path";if(e.L>0&&(n.size===1||n.size===2&&n.has("M"))){if(e.L===4)return"rect";let i=t.slice(-1)[0];return t[0][0]==="M"&&i[0]==="L"&&i[1]==t[0][1]&&i[2]===t[0][2]||i[1]===0&&i[2]===0?"polygon":"polyline"}return"path"}function l2(t){for(let e of Array.from(t.children))switch(e?.tagName.toLowerCase()){case"g":{let n=l2(e);if(n)return n}continue;case"path":{let n=e.getAttribute("d");if(!n)continue;let i=OP(n);return{element:e,points:NP(i),shapeType:zP(i)}}case"circle":{let n=Number.parseFloat(e.getAttribute("cx")??"0"),i=Number.parseFloat(e.getAttribute("cy")??"0"),a=Number.parseFloat(e.getAttribute("r")??"0");if(!a)continue;let o=[];for(let s=0;s<=360;s+=12){let u=s*Math.PI/180;o.push([n+a*Math.cos(u),i+a*Math.sin(u)])}return{element:e,points:o,shapeType:"circle"}}case"ellipse":{let n=Number.parseFloat(e.getAttribute("cx")??"0"),i=Number.parseFloat(e.getAttribute("cy")??"0"),a=Number.parseFloat(e.getAttribute("rx")??"0"),o=Number.parseFloat(e.getAttribute("ry")??"0");if(!a&&!o)continue;let s=[];for(let u=0;u<=360;u+=12){let d=Math.tan(u/360*Math.PI),p=a*(1-d**2)/(1+d**2),f=o*2*d/(1+d**2);s.push([n+p,i+f])}return{element:e,points:s,shapeType:"ellipse"}}case"line":{let n=Number.parseFloat(e.getAttribute("x0")??"0"),i=Number.parseFloat(e.getAttribute("y0")??"0"),a=Number.parseFloat(e.getAttribute("x1")??"0"),o=Number.parseFloat(e.getAttribute("y1")??"0");if(n===a&&i===o)continue;return{element:e,points:[[n,i],[a,o]],shapeType:"polyline"}}case"polygon":case"polyline":{let n=e.getAttribute("points")?.split(" ").map(a=>a.split(",").map(Number.parseFloat))??[];if(!n.length)continue;let i="polyline";return e.tagName.toLowerCase()==="polygon"&&(n.push(n[0]),i="polygon"),{element:e,points:n,shapeType:i}}case"rect":{let n=Number.parseFloat(e.getAttribute("x")??"0"),i=Number.parseFloat(e.getAttribute("y")??"0"),a=Number.parseFloat(e.getAttribute("width")??"0"),o=Number.parseFloat(e.getAttribute("height")??"0");if(!a||!o)continue;return{element:e,points:[[n,i],[n+a,i],[n+a,i+o],[n,i+o],[n,i]],shapeType:"rect"}}default:continue}return null}function NP(t){let e=[];for(let n=0;n<t.length;n++){let i=e[e.length-1]??[0,0],a=t[n];switch(a[0]){case"M":case"L":e.push([a[1],a[2]]);continue;case"C":e.push(...vP({x:i[0],y:i[1]},{x:a[1],y:a[2]},{x:a[3],y:a[4]},{x:a[5],y:a[6]}).map(o=>[o.x,o.y]).slice(1));continue;case"Q":e.push(...yP({x:i[0],y:i[1]},{x:a[1],y:a[2]},{x:a[3],y:a[4]}).map(o=>[o.x,o.y]).slice(1));continue}}return e}function IP(t){let e={};if(t.hasAttribute("fill")?(e.fill=t.getAttribute("fill"),t.removeAttribute("fill")):t.style&&t.style.fill&&(e.fill=t.style.fill),e.fill){let i=a2.exec(e.fill);i&&(e.fillOpacity=Number.parseFloat(i[4]),e.fill=`rgb(${i[1]}, ${i[2]}, ${i[3]})`)}if(t.hasAttribute("fill-opacity")?(e.fillOpacity=Number.parseFloat(t.getAttribute("fill-opacity")),t.removeAttribute("fill-opacity")):t.style&&t.style.fillOpacity&&(e.fillOpacity=Number.parseFloat(t.style.fillOpacity)),t.hasAttribute("stroke")?(e.stroke=t.getAttribute("stroke"),t.removeAttribute("stroke")):t.style&&t.style.stroke&&(e.stroke=t.style.stroke),e.stroke){let i=a2.exec(e.stroke);i&&(e.strokeOpacity=Number.parseFloat(i[4]),e.stroke=`rgb(${i[1]}, ${i[2]}, ${i[3]})`)}t.hasAttribute("stroke-opacity")?(e.strokeOpacity=Number.parseFloat(t.getAttribute("stroke-opacity")),t.removeAttribute("stroke-opacity")):t.style&&t.style.strokeOpacity&&(e.strokeOpacity=Number.parseFloat(t.style.strokeOpacity)),t.hasAttribute("stroke-width")?(e.strokeWidth=t.getAttribute("stroke-width"),t.removeAttribute("stroke-width")):t.style&&t.style.strokeWidth&&(e.strokeWidth=t.style.strokeWidth),t.hasAttribute("stroke-dasharray")?(e.strokeDasharray=t.getAttribute("stroke-dasharray"),t.removeAttribute("stroke-dasharray")):t.style&&t.style.strokeDasharray&&(e.strokeDasharray=t.style.strokeDasharray);let n=t;for(;n.tagName.toLowerCase()!=="svg";)if(n=n.parentElement,n===null)throw Error("Could not find root SVG element");return{svg:n.outerHTML,style:Object.keys(e).length>0?e:void 0}}function fm(t){if(!t)return!1;let e=t.type||t["@type"];return e==="iiif:ImageApiSelector"||e==="ImageApiSelector"}function $l(t){let[e,n]=t.split("#");return!n||!dm(n)?[t,""]:[e,n]}function dm(t){return t.includes("xywh=")||t.includes("t=")}function pa(t){if(t.iiifRenderingHints){let e=t.iiifRenderingHints;if(e.rotation){let n=hm(`${e.rotation}`);if(n)if(t.selectors.length)for(let i of t.selectors)i.rotation=n;else t.selectors.push({type:"RotationSelector",rotation:n})}}else delete t.iiifRenderingHints;return t}function hm(t){let e=Number.parseFloat(t);return e&&t.startsWith("!")&&(e=360-e),e&&(e%=360),e===e&&e||0}function an(t,e={}){if(Array.isArray(t))return an(t[0],e);if(typeof t=="string"){let[n,i]=$l(t);return i?an({type:"SpecificResource",source:{id:n,type:e.typeMap&&e.typeMap[n]||e.defaultType||"Canvas"},selector:{type:"FragmentSelector",value:i}},e):{type:"SpecificResource",source:{id:n,type:e.typeMap&&e.typeMap[n]||e.defaultType||"Canvas"},selector:null,selectors:[]}}if(t.type==="Choice"||t.type==="List"||t.type==="Composite"||t.type==="Independents")return an(t.items[0],e);if(!t.type&&"source"in t&&(t.type="SpecificResource"),t.type==="SpecificResource"){t.source.type==="Canvas"&&t.source.partOf&&typeof t.source.partOf=="string"&&(t.source.partOf=[{id:t.source.partOf,type:"Manifest"}]);let n=t.styleClass||e.styleClass,i={selector:null,selectors:[]};if(typeof t.source=="string"){let[,s]=$l(t.source);if(s){let u=an(t.source,{...e,styleClass:n});t.source=u.source,i={selector:u.selector,selectors:u.selectors}}}let{selector:a,selectors:o}=t.selector?_o(t.selector,e,{styleClass:n}):i;return{type:"SpecificResource",source:t.source,selector:a,selectors:o}}if(t.id){t.type==="Canvas"&&t.partOf&&typeof t.partOf=="string"&&(t.partOf=[{id:t.partOf,type:"Manifest"}]);let[n,i]=$l(t.id);return i?an({type:"SpecificResource",source:{...t,id:n},selector:{type:"FragmentSelector",value:i}},e):{type:"SpecificResource",source:{...t,id:n},selector:null,selectors:[]}}return{type:"SpecificResource",source:t,selector:null,selectors:[]}}var $s=_(nt(),1);var Mu=_(nt(),1),d2=_(Y(),1),BP={collection:void 0,manifest:void 0,range:void 0,canvas:void 0,annotation:void 0,annotationPage:void 0},Yf=Mu.default.createContext(BP),ti=()=>(0,Mu.useContext)(Yf);function ci({value:t,children:e}){let n=ti(),i=(0,Mu.useMemo)(()=>({...n,...t}),[t,n]);return(0,d2.jsx)(Yf.Provider,{value:i,children:e})}var h2=_(Y(),1);function ma({canvas:t,children:e}){return(0,h2.jsx)(ci,{value:{canvas:t},children:e})}var km=_(nt(),1);var m2={},p2=t=>{let e,n=new Set,i=(u,d)=>{let p=typeof u=="function"?u(e):u;if(!Object.is(p,e)){let f=e;e=d??(typeof p!="object"||!p)?p:Object.assign({},e,p),n.forEach(m=>m(e,f))}},a=()=>e,o={setState:i,getState:a,getInitialState:()=>s,subscribe:u=>(n.add(u),()=>n.delete(u)),destroy:()=>{(m2.env?m2.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."),n.clear()}},s=e=t(i,a,o);return o},mm=t=>t?p2(t):p2;function gm(t){return{all:t=t||new Map,on:function(e,n){var i=t.get(e);i?i.push(n):t.set(e,[n])},off:function(e,n){var i=t.get(e);i&&(n?i.splice(i.indexOf(n)>>>0,1):t.set(e,[]))},emit:function(e,n){var i=t.get(e);i&&i.slice().map(function(a){a(n)}),(i=t.get("*"))&&i.slice().map(function(a){a(e,n)})}}}function Qf(t){"@babel/helpers - typeof";return Qf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Qf(t)}function PP(t,e){if(Qf(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var i=n.call(t,e||"default");if(Qf(i)!="object")return i;throw TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function HP(t){var e=PP(t,"string");return Qf(e)=="symbol"?e:e+""}function ao(t,e,n){return(e=HP(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Ba(t){return Array.isArray(t)?t:t?[t]:[]}function Pa(t){for(let e in t)(t[e]===void 0||t[e]===null)&&delete t[e];return t}function Gi(t){return typeof t=="string"?!1:t&&!t.type&&"source"in t?(t.type="SpecificResource",!0):!!t&&t.type==="SpecificResource"}function ym(...t){return e=>t.reduce((n,i)=>i(n),e)}var ib=["Collection","Manifest","Canvas","AnnotationPage","AnnotationCollection","Annotation","ContentResource","Range","Service","Selector","Agent"];function g2(t,e){if(t==null)throw Error("Null or undefined is not a valid entity.");if(Array.isArray(t))throw Error("Array is not a valid entity");if(typeof t!="object"){if(e)return e;throw Error(`${typeof t} is not a valid entity`)}if(typeof t.type=="string"){let n=ib.indexOf(t.type);if(n!==-1)return ib[n]}if(t.profile)return"Service";throw Error("Resource type is not known")}var ab=class y2{constructor(e,n={}){ao(this,"traversals",void 0),ao(this,"options",void 0),ao(this,"_traverseManifest",ym(this.traverseManifestItems.bind(this),this.traverseNavPlace.bind(this),this.traverseLinking.bind(this),this.traverseDescriptive.bind(this),this.traverseLinkedCanvases.bind(this),this.traverseManifestStructures.bind(this),this.traverseInlineAnnotationPages.bind(this))),ao(this,"_traverseCanvas",ym(this.traverseCanvasItems.bind(this),this.traverseLinking.bind(this),this.traverseDescriptive.bind(this),this.traverseLinkedCanvases.bind(this),this.traverseInlineAnnotationPages.bind(this))),ao(this,"_traverseAnnotationPage",ym(this.traverseAnnotationPageItems.bind(this),this.traverseLinking.bind(this),this.traverseDescriptive.bind(this))),ao(this,"_traverseRange",ym(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:[],...e},this.options={allowUndefinedReturn:!1,...n}}static all(e){return new y2({collection:[e],manifest:[e],canvas:[e],annotationCollection:[e],annotationPage:[e],annotation:[e],contentResource:[e],choice:[e],range:[e],service:[e],geoJson:[e],specificResource:[e],agent:[e]})}traverseDescriptive(e){return e.thumbnail&&(e.thumbnail=Ba(e.thumbnail).map(n=>this.traverseType(n,{parent:e},this.traversals.contentResource))),e.provider&&(e.provider=e.provider.map(n=>this.traverseAgent(n,e))),e}traverseLinking(e){return e.seeAlso&&(e.seeAlso=Ba(e.seeAlso).map(n=>this.traverseType(n,{parent:e},this.traversals.contentResource))),e.service&&(e.service=Ba(e.service).map(n=>this.traverseService(n))),e.services&&(e.services=Ba(e.services).map(n=>this.traverseService(n,e))),e.logo&&(e.logo=Ba(e.logo).map(n=>this.traverseType(n,{parent:e},this.traversals.contentResource))),e.homepage&&(e.homepage=Ba(e.homepage).map(n=>this.traverseType(n,{parent:e},this.traversals.contentResource))),e.partOf&&(e.partOf=e.partOf.map(n=>typeof n=="string"||!n.type?this.traverseType(n,{parent:e},this.traversals.contentResource):n.type==="Canvas"?this.traverseType(n,{parent:e},this.traversals.canvas):n.type==="AnnotationCollection"?this.traverseType(n,{parent:e},this.traversals.annotationCollection):n.type==="Collection"?this.traverseType(n,{parent:e},this.traversals.collection):this.traverseType(n,{parent:e},this.traversals.contentResource))),e.start&&(Gi(e.start)?e.start=this.traverseSpecificResource(e.start,"Canvas",e):e.start=this.traverseType(e.start,{parent:e},this.traversals.canvas)),e.rendering&&(e.rendering=e.rendering.map(n=>this.traverseType(n,{parent:e},this.traversals.contentResource))),e.supplementary&&(e.supplementary=e.supplementary.map(n=>this.traverseType(n,{parent:e},this.traversals.contentResource))),e}traverseCollectionItems(e){return e.items&&e.items.map(n=>n.type==="Collection"?this.traverseCollection(n):this.traverseManifest(n)),e}traverseCollection(e,n){return this.traverseType(this.traverseDescriptive(this.traverseNavPlace(this.traverseInlineAnnotationPages(this.traverseLinking(this.traverseLinkedCanvases(this.traverseCollectionItems(e)))))),{parent:n},this.traversals.collection)}traverseGeoJson(e,n){return this.traverseType(e,{parent:n},this.traversals.geoJson)}traverseNavPlace(e){return e.navPlace&&(e.navPlace=this.traverseGeoJson(e.navPlace,e)),e}traverseManifestItems(e){return e.items&&(e.items=e.items.map(n=>this.traverseCanvas(n))),e}traverseManifestStructures(e){return e.structures&&(e.structures=e.structures.map(n=>this.traverseRange(n))),e}traverseManifest(e,n){return this.traverseType(this._traverseManifest(e),{parent:n},this.traversals.manifest)}traverseCanvasItems(e){return e.items=(e.items||[]).map(n=>this.traverseAnnotationPage(n,e)),e}traverseInlineAnnotationPages(e){return typeof e=="string"||!e||e.annotations&&(e.annotations=e.annotations.map(n=>this.traverseAnnotationPage(n,e))),e}traverseCanvas(e,n){return this.traverseType(this._traverseCanvas(e),{parent:n},this.traversals.canvas)}traverseAnnotationPageItems(e){return e.items&&(e.items=e.items.map(n=>this.traverseAnnotation(n,e))),e}traverseAnnotationPage(e,n){return this.traverseType(this._traverseAnnotationPage(e),{parent:n},this.traversals.annotationPage)}traverseAnnotationBody(e){return Array.isArray(e.body)?e.body=e.body.map(n=>this.traverseContentResource(n,e)):e.body&&(e.body=this.traverseContentResource(e.body,e)),e}traverseLinkedCanvases(e){return e.placeholderCanvas&&(e.placeholderCanvas=this.traverseCanvas(e.placeholderCanvas)),e.accompanyingCanvas&&(e.accompanyingCanvas=this.traverseCanvas(e.accompanyingCanvas)),e}traverseAnnotation(e,n){return this.traverseType(this.traverseLinking(this.traverseAnnotationBody(this.traverseDescriptive(e))),{parent:n},this.traversals.annotation)}traverseContentResourceLinking(e){return typeof e=="string"||!e||e&&e.service&&(e.service=Ba(e.service||[]).map(n=>this.traverseService(n,e))),e}traverseContentResource(e,n){return e.type==="Choice"&&(e.items=e.items.map(i=>this.traverseContentResource(i,e))),Gi(e)?this.traverseSpecificResource(e,"ContentResource"):this.traverseType(this.traverseInlineAnnotationPages(this.traverseContentResourceLinking(e)),{parent:n},this.traversals.contentResource)}traverseSpecificResource(e,n,i){let a=e.source;return typeof e.source=="string"&&(a={id:e.source,type:n||"unknown"}),this.traverseType({...e,source:n==="Canvas"||a.type==="Canvas"?this.traverseType(a,{parent:i},this.traversals.canvas):n==="ContentResource"?this.traverseContentResource(a,{parent:i}):this.traverseUnknown(a,{parent:i,typeHint:n})},{parent:i},this.traversals.specificResource)}traverseRangeRanges(e){return e.items&&(e.items=e.items.map(n=>typeof n=="string"?this.traverseCanvas({id:n,type:"Canvas"},e):Gi(n)?this.traverseSpecificResource(n,"Canvas",e):n.type==="Manifest"?this.traverseManifest(n,e):this.traverseRange(n,e))),e}traverseRange(e,n){return this.traverseType(this._traverseRange(e),{parent:n},this.traversals.range)}traverseAgent(e,n){return this.traverseType(this.traverseDescriptive(this.traverseLinking(e)),{parent:n},this.traversals.agent)}traverseType(e,n,i){return i.reduce((a,o)=>{let s=o(a,n);return s===void 0&&!this.options.allowUndefinedReturn?a:s},e)}traverseService(e,n){let i=Object.assign({},e);return i&&i.service&&(i.service=Ba(i.service).map(a=>this.traverseService(a))),this.traverseType(i,{parent:n},this.traversals.service)}traverseUnknown(e,{parent:n,typeHint:i}={}){let a=g2(e,i);switch(a){case"Collection":return this.traverseCollection(e,n);case"Manifest":return this.traverseManifest(e,n);case"Canvas":return this.traverseCanvas(e,n);case"AnnotationPage":return this.traverseAnnotationPage(e,n);case"Annotation":return this.traverseAnnotation(e,n);case"ContentResource":return this.traverseContentResource(e,n);case"Range":return this.traverseRange(e,n);case"Service":return this.traverseService(e,n);case"Agent":return this.traverseAgent(e,n);default:throw Error(`Unknown or unsupported resource type of ${a}`)}}};var ob="http://library.stanford.edu/iiif/image-api/compliance.html#level0",rb="http://library.stanford.edu/iiif/image-api/compliance.html#level1",lb="http://library.stanford.edu/iiif/image-api/compliance.html#level2",sb="http://library.stanford.edu/iiif/image-api/conformance.html#level0",ub="http://library.stanford.edu/iiif/image-api/conformance.html#level1",cb="http://library.stanford.edu/iiif/image-api/conformance.html#level2",fb="http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level0",db="http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level1",hb="http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level2",pb="http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level0",mb="http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level1",gb="http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level2",yb="http://iiif.io/api/image/1/level0.json",vb="http://iiif.io/api/image/1/profiles/level0.json",Sb="http://iiif.io/api/image/1/level1.json",bb="http://iiif.io/api/image/1/profiles/level1.json",xb="http://iiif.io/api/image/1/level2.json",Eb="http://iiif.io/api/image/1/profiles/level2.json",Ab="http://iiif.io/api/image/2/level0.json",Rb="http://iiif.io/api/image/2/profiles/level0.json",Tb="http://iiif.io/api/image/2/level1.json",Cb="http://iiif.io/api/image/2/profiles/level1.json",wb="http://iiif.io/api/image/2/level2.json",Mb="http://iiif.io/api/image/2/profiles/level2.json",Ob="level0",_b="level1",zb="level2",Nb="http://iiif.io/api/image/2/level0",Ib="http://iiif.io/api/image/2/level1",Db="http://iiif.io/api/image/2/level2",Ou=[Db,lb,cb,hb,gb,xb,Eb,wb,Mb,zb],vm=[...Ou,Ib,rb,ub,db,mb,Sb,bb,Tb,Cb,_b],Lb=[Nb,Ib,Db,ob,rb,lb,sb,ub,cb,fb,db,hb,pb,mb,gb,yb,vb,Sb,bb,xb,Eb,Ab,Rb,Tb,Cb,wb,Mb,Ob,_b,zb],Bb=Lb,Pb=[Nb,ob,sb,fb,pb,yb,vb,Ab,Rb,Ob],v2={extraFormats:["jpg"],extraQualities:["default"],extraFeatures:["sizeByWhListed"]},S2={extraFormats:["jpg"],extraQualities:["default"],extraFeatures:["baseUriRedirect","cors","jsonldMediaType","regionByPx","regionSquare","sizeByWhListed","sizeByH","sizeByW","sizeByWh"]},b2={extraFormats:["jpg","png"],extraQualities:["default"],extraFeatures:["baseUriRedirect","cors","jsonldMediaType","regionByPct","regionByPx","regionSquare","rotationBy90s","sizeByWhListed","sizeByConfinedWh","sizeByH","sizeByPct","sizeByW","sizeByWh"]};var x2=["sc:Collection","sc:Manifest","sc:Canvas","sc:AnnotationList","oa:Annotation","sc:Range","sc:Layer","sc:Sequence","oa:Choice","Service","ContentResource"];function UP(t){if(t==null)throw Error("Null or undefined is not a valid entity.");if(Array.isArray(t))throw Error("Array is not a valid entity");if(typeof t!="object")throw Error(`${typeof t} is not a valid entity`);if(typeof t["@type"]=="string"){let e=x2.indexOf(t["@type"]);if(e!==-1)return x2[e]}if(t.profile)return"Service";if(t.format||t["@type"])return"ContentResource";throw Error("Resource type is not known")}var VP=class T2{constructor(e,n={}){ao(this,"traversals",void 0),ao(this,"options",void 0),this.traversals={collection:[],manifest:[],canvas:[],annotationList:[],sequence:[],annotation:[],contentResource:[],choice:[],range:[],service:[],layer:[],...e},this.options={convertPropsToArray:!0,mergeMemberProperties:!0,allowUndefinedReturn:!1,...n}}static all(e){return new T2({collection:[e],manifest:[e],canvas:[e],annotationList:[e],sequence:[e],annotation:[e],contentResource:[e],choice:[e],range:[e],service:[e],layer:[e]})}traverseCollection(e){return this.traverseType(this.traverseDescriptive(this.traverseLinking(this.traverseCollectionItems(e))),this.traversals.collection)}traverseCollectionItems(e){if(this.options.mergeMemberProperties){let n=[...(e.manifests||[]).map(o=>typeof o=="string"?{"@id":o,"@type":"sc:Manifest"}:(o["@type"]||(o["@type"]="sc:Manifest"),o)),...(e.collections||[]).map(o=>typeof o=="string"?{"@id":o,"@type":"sc:Collection"}:o),...e.members||[]],i=[],a=n.filter(o=>i.includes(o["@id"])?!1:(i.push(o["@id"]),!0));delete e.collections,delete e.manifests,e.members=a}return e.manifests&&(e.manifests=e.manifests.map(n=>{let i=n;return typeof n=="string"&&(i={"@id":n,"@type":"sc:Manifest"}),i["@type"]||(i["@type"]="sc:Manifest"),this.traverseManifest(i)})),e.collections&&(e.collections=e.collections.map(n=>this.traverseCollection(typeof n=="string"?{"@id":n,"@type":"sc:Collection"}:n))),e.members&&(e.members=e.members.map(n=>typeof n=="string"?n:n["@type"]==="sc:Collection"?this.traverseCollection(n):n["@type"]==="sc:Manifest"?this.traverseManifest(n):this.traverseUnknown(n))),e}traverseManifest(e){return this.traverseType(this.traverseDescriptive(this.traverseLinking(this.traverseManifestItems(e))),this.traversals.manifest)}traverseManifestItems(e){return e.sequences&&(e.sequences=e.sequences.map(n=>this.traverseSequence(n))),e.structures&&(e.structures=e.structures.map(n=>this.traverseRange(n))),e}traverseSequence(e){return this.traverseType(this.traverseDescriptive(this.traverseLinking(this.traverseSequenceItems(e))),this.traversals.sequence)}traverseSequenceItems(e){return e.canvases&&(e.canvases=e.canvases.map(n=>this.traverseCanvas(n))),e}traverseCanvas(e){return this.traverseType(this.traverseDescriptive(this.traverseLinking(this.traverseCanvasItems(e))),this.traversals.canvas)}traverseCanvasItems(e){return e.images&&(e.images=e.images.map(n=>(n.on&&n["@type"]!=="oa:Annotation"&&n["@type"]!=="Annotation"&&(n["@type"]="oa:Annotation"),this.traverseAnnotation(n)))),e.otherContent&&(e.otherContent=e.otherContent.map(n=>this.traverseAnnotationList(n))),e}traverseRange(e){return e["@type"]!=="sc:Range"&&(e["@type"]="sc:Range"),this.traverseType(this.traverseDescriptive(this.traverseLinking(this.traverseRangeItems(e))),this.traversals.range)}traverseRangeItems(e){if(this.options.mergeMemberProperties){let n=[...(e.ranges||[]).map(i=>typeof i=="string"?{"@id":i,"@type":"sc:Range"}:i),...(e.canvases||[]).map(i=>typeof i=="string"?{"@id":i,"@type":"sc:Canvas"}:i),...e.members||[]];delete e.ranges,delete e.canvases,e.members=n.length?n.map(i=>this.traverseUnknown(i)):void 0}return e}traverseAnnotationList(e){let n=typeof e=="string"?{"@id":e,"@type":"sc:AnnotationList"}:e;return this.traverseType(this.traverseDescriptive(this.traverseAnnotationListItems(n)),this.traversals.annotationList)}traverseAnnotationListItems(e){return e.resources&&(e.resources=e.resources.map(n=>this.traverseAnnotation(n))),e}traverseAnnotation(e){return this.traverseType(this.traverseDescriptive(this.traverseLinking(this.traverseAnnotationItems(e))),this.traversals.annotation)}traverseAnnotationItems(e){return e.resource&&(Array.isArray(e.resource)?e.resource=e.resource.map(n=>this.traverseContentResource(n)):e.resource=this.traverseContentResource(e.resource)),e.on,e}traverseLayer(e){return this.traverseType(this.traverseLinking(this.traverseLayerItems(e)),this.traversals.layer)}traverseLayerItems(e){return e.otherContent&&(e.otherContent=e.otherContent.map(n=>this.traverseAnnotationList(n))),e}traverseChoice(e){return this.traverseType(this.traverseChoiceItems(e),this.traversals.choice)}traverseChoiceItems(e){return e.default&&e.default!=="rdf:nil"&&(e.default=this.traverseContentResource(e.default)),e.item&&e.item!=="rdf:nil"&&(e.item=e.item.map(n=>this.traverseContentResource(n))),e}traverseService(e){return this.traverseType(this.traverseLinking(e),this.traversals.service)}traverseContentResource(e){return e["@type"]==="oa:Choice"?this.traverseChoice(e):this.traverseType(this.traverseDescriptive(this.traverseLinking(e)),this.traversals.contentResource)}traverseUnknown(e){if(!e["@type"]||typeof e=="string")return e;switch(UP(e)){case"sc:Collection":return this.traverseCollection(e);case"sc:Manifest":return this.traverseManifest(e);case"sc:Canvas":return this.traverseCanvas(e);case"sc:Sequence":return this.traverseSequence(e);case"sc:Range":return this.traverseRange(e);case"oa:Annotation":return this.traverseAnnotation(e);case"sc:AnnotationList":return this.traverseAnnotationList(e);case"sc:Layer":return this.traverseLayer(e);case"Service":return this.traverseService(e);case"oa:Choice":return this.traverseChoice(e);case"ContentResource":return this.traverseContentResource(e)}return e.profile?this.traverseService(e):e}traverseImageResource(e){let n=Array.isArray(e),i=Array.isArray(e)?e:[e],a=[];for(let o of i)typeof o=="string"?a.push(this.traverseContentResource({"@id":o,"@type":"dctypes:Image"})):a.push(this.traverseContentResource(o));return!n&&!this.options.convertPropsToArray?a[0]:a}traverseDescriptive(e){return e.thumbnail&&(e.thumbnail=this.traverseImageResource(e.thumbnail)),e.logo&&(e.logo=this.traverseImageResource(e.logo)),e}traverseOneOrMoreServices(e){let n=Array.isArray(e),i=Array.isArray(e)?e:[e],a=[];for(let o of i)a.push(this.traverseService(o));return!n&&!this.options.convertPropsToArray?a[0]:a}traverseLinking(e){return e.related&&(e.related=this.traverseOneOrManyType(e.related,this.traversals.contentResource)),e.rendering&&(e.rendering=this.traverseOneOrManyType(e.rendering,this.traversals.contentResource)),e.service&&(e.service=this.traverseOneOrMoreServices(e.service)),e.seeAlso&&(e.seeAlso=this.traverseOneOrManyType(e.seeAlso,this.traversals.contentResource)),e.within&&(typeof e.within=="string"||(e.within=this.traverseOneOrManyType(e.within,this.traversals.contentResource))),e.startCanvas&&(typeof e.startCanvas=="string"?e.startCanvas=this.traverseType({"@id":e.startCanvas,"@type":"sc:Canvas"},this.traversals.canvas):e.startCanvas&&this.traverseType(e.startCanvas,this.traversals.canvas)),e.contentLayer&&(typeof e.contentLayer=="string"?e.contentLayer=this.traverseLayer({"@id":e.contentLayer,"@type":"sc:Layer"}):e.contentLayer=this.traverseLayer(e.contentLayer)),e}traverseOneOrManyType(e,n){if(!Array.isArray(e))if(this.options.convertPropsToArray)e=[e];else return this.traverseType(e,n);return e.map(i=>this.traverseType(i,n))}traverseType(e,n){return n.reduce((i,a)=>{let o=a(i);return o===void 0&&!this.options.allowUndefinedReturn?i:o},e)}},jP=["http://iiif.io/api/image/2/level1","http://iiif.io/api/image/2/level2","http://library.stanford.edu/iiif/image-api/compliance.html#level1","http://library.stanford.edu/iiif/image-api/compliance.html#level2","http://library.stanford.edu/iiif/image-api/conformance.html#level1","http://library.stanford.edu/iiif/image-api/conformance.html#level2","http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level1","http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level2","http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level1","http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level2","http://iiif.io/api/image/1/level1.json","http://iiif.io/api/image/1/profiles/level1.json","http://iiif.io/api/image/1/level2.json","http://iiif.io/api/image/1/profiles/level2.json","http://iiif.io/api/image/2/level1.json","http://iiif.io/api/image/2/profiles/level1.json","http://iiif.io/api/image/2/level2.json","http://iiif.io/api/image/2/profiles/level2.json","level1","level2"],Ub={attributionLabel:"Attribution",lang:"none",providerId:"http://example.org/provider",providerName:""};function qP(t){if(typeof t=="string")return[t];if(!t)return[];let e=Array.isArray(t)?t:[t],n=[];for(let i of e){if(typeof i=="string"){n.push(i);continue}n.push({"@language":i["@language"]||i.language,"@value":i["@value"]||i.value})}return n}function ts(t,e="none"){if(!t)return{none:[""]};let n=qP(t),i={};for(let a of n){if(typeof a=="string"){i[e]=i[e]?i[e]:[],i[e].push(a||"");continue}if(!a["@language"]){i[e]=i[e]?i[e]:[],i[e].push(a["@value"]||"");continue}let o=a["@language"];i[o]=i[o]?i[o]:[],i[o].push(a["@value"]||"")}return Object.keys(i).length===0?{none:[""]}:i}function C2(t){if(Array.isArray(t))return C2(t.find(e=>typeof e=="string"));if(Ou.indexOf(t)!==-1)return"level2";if(jP.indexOf(t)!==-1)return"level1";if(Bb.indexOf(t)!==-1)return"level0";if(typeof t=="string")return t}function FP(t){let e=Array.isArray(t)?t:[t];for(let n of e)switch(n){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 GP(t){switch(t){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 E2(t){for(let e of["sc","oa","dcterms","dctypes","iiif"])if(t.startsWith(`${e}:`))return t.slice(e.length+1);return t}var kP=["Collection","Manifest","Annotation","AnnotationPage","Range","Service"];function jb(t){let e=t["@id"]||t.id,n=t["@type"]||t.type,i=t.profile||void 0,a=t["@context"]||void 0;if(i){let o=GP(i);if(o)return o}if(a){let o=FP(a);if(o)return o}if(n){if(Array.isArray(n)){if(n.indexOf("oa:CssStylesheet")!==-1)return"CssStylesheet";if(n.indexOf("cnt:ContentAsText")!==-1)return"TextualBody";n=n[0]}for(let o of["sc","oa","dcterms","dctypes","iiif"])if(n.startsWith(`${o}:`)){n=n.slice(o.length+1);break}switch(n){case"Layer":return"AnnotationCollection";case"AnnotationList":return"AnnotationPage";case"cnt:ContentAsText":return"TextualBody"}}if(n&&kP.indexOf(n)!==-1)return n;if(t.format){if(t.format.startsWith("image/"))return"Image";if(t.format.startsWith("text/")||t.format==="application/pdf")return"Text";if(t.format.startsWith("application/"))return"Dataset"}return e&&(e.endsWith(".jpg")||e.endsWith(".png")||e.endsWith(".jpeg"))?"Image":n||"unknown"}var YP=/^|["'\\>]http(s)?:\/\/(creativecommons.org|rightsstatements.org)\/[^"'\\<\n]+/gm;function QP(t){let e=t.match(YP);return e?e[0]:t}function XP(t,e="Rights/License",n="none"){let i=null,a=[],o=Array.isArray(t)?t:[t];for(let s of o){let u=s?QP(s):void 0;if(u&&(u.indexOf("creativecommons.org")!==-1||u.indexOf("rightsstatements.org")!==-1)){i=u.startsWith("https://")?`http://${u.slice(8)}`:u;continue}u&&a.push({label:{[n]:[e]},value:{[n]:[u]}})}return[i,a]}var KP=["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 ZP(t){if(t){let e=Array.isArray(t)?t:[t],n=[];for(let i of e)i==="http://iiif.io/api/presentation/2/context.json"&&n.push("http://iiif.io/api/presentation/3/context.json"),KP.indexOf(i)===-1&&n.push(i);if(e.length)return n.length===1?n[0]:n}}function WP(t){return t?t.map(e=>({label:ts(e.label),value:ts(e.value)})):[]}var A2=0;function w2(t,e){let n=encodeURI(t.id||t["@id"]||"").trim();return n&&e?`${n}/${e}`:n||(A2++,`http://example.org/${t["@type"]}${e?`/${e}`:""}/${A2}`)}function zo(t){let e=[...t.behavior||[]];t.viewingHint&&e.push(t.viewingHint);let n;return Array.isArray(t.motivation)?n=t.motivation.map(E2):t.motivation&&(n=E2(t.motivation)),{"@context":t["@context"]?ZP(t["@context"]):void 0,id:(t["@id"]||w2(t)).trim(),type:jb(t),behavior:e.length?e:void 0,height:t.height?t.height:void 0,width:t.width?t.width:void 0,motivation:n,viewingDirection:t.viewingDirection,profile:t.profile,format:t.format?t.format:void 0,duration:void 0,timeMode:void 0}}function No(t){let[e,n]=XP(t.license),i=[...t.metadata?WP(t.metadata):[],...n];return{rights:e,metadata:i.length?i:void 0,label:t.label?ts(t.label):void 0,requiredStatement:t.attribution?{label:ts(Ub.attributionLabel),value:ts(t.attribution)}:void 0,navDate:t.navDate,summary:t.description?ts(t.description):void 0,thumbnail:JP(t.thumbnail)}}function JP(t){return t&&(Array.isArray(t)?t:[t]).map(n=>typeof n=="string"?{id:n,type:"Image"}:(n.type==="unknown"&&(n.type="Image"),n))}function $P(t){if(!t.within)return;let e=Array.isArray(t.within)?t.within:[t.within],n=[];for(let i of e)if(typeof i=="string"){if(i)switch(t["@type"]){case"sc:Manifest":n.push({id:i,type:"Collection"});break}}else i["@id"]&&n.push({id:i["@id"],type:jb(i)});return n.length?n:void 0}function Lr(t){let e=t.related?Array.isArray(t.related)?t.related:[t.related]:[],n=t.contentLayer;return{provider:t.logo||e.length?[{id:Ub.providerId,type:"Agent",homepage:e.length?[e[0]]:void 0,logo:t.logo?Array.isArray(t.logo)?t.logo:[t.logo]:void 0,label:ts(Ub.providerName)}]:void 0,partOf:$P(t),rendering:t.rendering,seeAlso:t.seeAlso,start:t.startCanvas,service:t.service?Ba(t.service):void 0,supplementary:n?[n]:void 0}}function t6(t){return{chars:t.chars,format:t.format?t.format:void 0,language:t.language}}function Hb(t,e){return t?typeof t=="string"?{id:t,type:e}:typeof t?.["@id"]=="string"?{id:t["@id"],type:e}:typeof t.id=="string"?{id:t.id,type:e}:null:null}function e6(t){let e={};if(t.first){let n=Hb(t.first,"Collection");n&&(e.first=n)}if((t.total||t.total===0)&&(e.total=t.total),t.prev){let n=Hb(t.prev,"Collection");n&&(e.prev=n)}if(t.next){let n=Hb(t.next,"Collection");n&&(e.next=n)}return e}function n6(t){let e=[];for(let n of t){let i={...n};i.items&&i.items.length===0&&delete i.items,e.push(i)}return e}function i6(t){return Pa({...zo(t),...No(t),...Lr(t),...e6(t),items:n6(t.members)})}function a6(t){let e=[],n=[],i,a;for(let s of t.sequences||[])s.canvases.length&&e.push(...s.canvases),s.behavior&&n.push(...s.behavior),s.viewingDirection&&(a=s.viewingDirection),s.startCanvas&&(i=s.startCanvas);let o=zo(t);return n.length&&(o.behavior?o.behavior.push(...n):o.behavior=n),Pa({...o,...No(t),...Lr(t),viewingDirection:a,start:i,items:e,structures:o6(t.structures)})}function o6(t){if(!t)return t;let e=new Map;for(let i of t)e.set(i.id,i);let n=[];for(let i of t)if(i.items){let a=i.items.map(o=>typeof o=="string"?(n.push(o),e.get(o)||o):o&&o.id?(n.push(o.id),e.get(o.id)||o):o);i.items=a}return t.filter(i=>n.indexOf(i.id)===-1)}function r6(t){return Pa({...zo(t),...No(t),...Lr(t),annotations:t.otherContent&&t.otherContent.length?t.otherContent:void 0,items:t.images&&t.images.length?[{id:w2(t,"annotation-page"),type:"AnnotationPage",items:t.images}]:void 0})}function l6(t){return Pa({...zo(t),...No(t),...Lr(t),items:t.resources&&t.resources.length?t.resources:void 0})}function s6(t){return!t.canvases||t.canvases.length===0?{canvases:[],behavior:[]}:{canvases:t.canvases,behavior:t.viewingHint?[t.viewingHint]:[],viewingDirection:t.viewingDirection,startCanvas:t.startCanvas}}function u6(t){function e(n){if(Array.isArray(n)){if(n.length>1)return{type:"List",items:n.map(e)};n=n[0]}if(typeof n=="string")return encodeURI(n).trim();if("@type"in n){let i;if(typeof n.full=="string")i=n.full;else if(n.full["@type"]==="dctypes:Image")i={id:n.full["@id"],type:"Image"};else if(n.full["@type"]==="sc:Canvas")i={id:n.full["@id"],type:"Canvas"};else throw Error(`Unsupported source type on annotation: ${n.full["@type"]}`);return{type:"SpecificResource",source:i,selector:Vb(n.selector)}}else return encodeURI(n["@id"]).trim()}return Pa({...zo(t),...No(t),...Lr(t),target:e(t.on),body:Array.isArray(t.resource)?t.resource.map(R2):R2(t.resource)})}function R2(t){return t.type==="Choice"?t:M2(t)}function M2(t){let e=t;return Pa({...zo(e),...No(e),...Lr(e),...t6(e)})}function c6(t){let e=[];return t.default&&t.default!=="rdf:nil"&&e.push(t.default),t.item&&t.item!=="rdf:nil"&&e.push(...t.item),Pa({...zo(t),...No(t),items:e})}function f6(t){return Pa({...zo(t),...No(t),...Lr(t),items:t.members})}function d6(t){let{"@id":e,"@type":n,"@context":i,profile:a,...o}=t,s={};return e&&(s["@id"]=e),s["@type"]=jb(t),s["@type"]==="unknown"&&(i&&i.length&&(s["@context"]=i),s["@type"]="Service"),a&&(s.profile=C2(a)),Pa({...s,...o})}function h6(t){return Pa({...zo(t),...No(t),...Lr(t)})}var p6=new VP({collection:[i6],manifest:[a6],canvas:[r6],annotationList:[l6],sequence:[s6],annotation:[u6],contentResource:[M2],choice:[c6],range:[f6],service:[d6],layer:[h6]});function O2(t){return t&&t["@context"]&&(t["@context"]==="http://iiif.io/api/presentation/2/context.json"||Array.isArray(t["@context"])&&t["@context"].indexOf("http://iiif.io/api/presentation/2/context.json")!==-1||t["@context"]==="http://www.shared-canvas.org/ns/context.json")||t["@context"]==="http://iiif.io/api/image/2/context.json"||t["@id"]&&t["@type"]==="sc:Collection"||t["@id"]&&t["@type"]==="sc:Manifest"?(t["@context"]||(t["@context"]="http://iiif.io/api/presentation/2/context.json"),p6.traverseUnknown(t)):t}function Vb(t){if((Array.isArray(t["@type"])&&t["@type"].includes("oa:SvgSelector")||t["@type"]=="oa:SvgSelector")&&("chars"in t||"value"in t))return{type:"SvgSelector",value:"chars"in t?t.chars:t.value};if(t["@type"]==="oa:FragmentSelector")return{type:"FragmentSelector",value:t.value};if(t["@type"]==="oa:Choice")return[Vb(t.default),...(Array.isArray(t.item)?t.item:[t.item]).map(Vb)];if(t["@type"]=="iiif:ImageApiSelector")return{type:"ImageApiSelector",region:"region"in t?t.region:void 0,rotation:"rotation"in t?t.rotation:void 0};throw Error(`Unsupported selector type: ${t["@type"]}`)}function Du(t,e){let n=e||"unknown";if(!t)return;if(typeof t=="string")return{id:t,type:n};if(Gi(t))return Du(t.source,e);let i=n&&n!=="unknown"?n:t.type||t["@type"],a=t.id||t["@id"];if(i&&i.indexOf(":")!==-1&&(i=i.split(":").pop()),a&&i)return{id:a,type:i}}var zu={},Ke="iiif-parser:hasPart",ki="iiif-parser:partOf",Nu="iiif-parser:isExternal",ga="__$UNSET$__",Fb="__$UNWRAP$__",Et=[];Object.freeze(Et),Object.freeze(zu);function N2(t){if(t===zu||Object.keys(t).length===0)return!0;for(let e in t)return!1;return!0}function Lu(t,e){if(e&&e["@explicit"]){let n={},i=Object.keys(e);for(let a of i)a===ki||a==="@explicit"||(N2(e[a])?n[a]=t[a]:n[a]=e[a]);return n}return t}function Gb(t,e,n){let i=Du(e);if(!i)return[void 0,void 0];let a=t.requests[i.id],o=i.type||t.mapping[i.id];if(!o||a&&a.resourceUri&&(!t.entities[o]||!t.entities[o][a.resourceUri]))return[void 0,void 0];let s=t.entities[o][a?a.resourceUri:i.id];if(i.type&&!s)return Gb(t,{id:i.id},n);if(s&&s[Ke]){let u=s[Ke].find(p=>n?p[ki]===n.id:p[ki]===s.id);return[Lu(s,u),s]}return[s,s]}var I2={id:"https://iiif-parser/annotation-page",type:"AnnotationPage",behavior:Et,label:null,thumbnail:Et,summary:null,requiredStatement:null,metadata:Et,rights:null,provider:Et,items:Et,seeAlso:Et,homepage:Et,rendering:Et,service:Et},D2={id:"https://iiif-parser/empty-canvas",type:"Canvas",label:null,behavior:Et,thumbnail:Et,accompanyingCanvas:null,placeholderCanvas:null,summary:null,requiredStatement:null,metadata:Et,rights:null,navDate:null,provider:Et,items:Et,annotations:Et,seeAlso:Et,homepage:Et,partOf:Et,rendering:Et,service:Et,duration:0,height:0,width:0},L2={id:"https://iiif-parser/empty-collection",type:"Collection",label:null,viewingDirection:"left-to-right",behavior:Et,thumbnail:Et,accompanyingCanvas:null,placeholderCanvas:null,summary:null,requiredStatement:null,metadata:Et,rights:null,navDate:null,provider:Et,items:Et,annotations:Et,seeAlso:Et,homepage:Et,partOf:Et,rendering:Et,service:Et,services:Et},B2={id:"https://iiif-parser/empty-manifest",type:"Manifest",annotations:Et,behavior:Et,homepage:Et,items:Et,label:null,metadata:Et,navDate:null,provider:Et,partOf:Et,accompanyingCanvas:null,placeholderCanvas:null,rendering:Et,requiredStatement:null,rights:null,seeAlso:Et,service:Et,services:Et,start:null,structures:Et,summary:null,thumbnail:Et,viewingDirection:"left-to-right"},P2={id:"https://iiif-parser/empty-canvas",type:"Range",label:null,behavior:Et,thumbnail:Et,accompanyingCanvas:null,placeholderCanvas:null,summary:null,requiredStatement:null,metadata:Et,rights:null,navDate:null,provider:Et,items:Et,annotations:Et,seeAlso:Et,homepage:Et,partOf:Et,rendering:Et,service:Et,start:null,supplementary:null,viewingDirection:"left-to-right"},H2={id:"https://iiif-parser/empty-agent",type:"Agent",label:{},logo:Et,seeAlso:Et,homepage:Et},U2={id:"https://iiif-parser/empty-service",type:"UnknownService"};function Sm(t){let[e,n]=(t||"").split("#");return!n||!m6(n)?[t||"",""]:[e,n]}function m6(t){return t.includes("xywh=")||t.includes("t=")}function bm(t,e={}){if(Array.isArray(t))return bm(t[0]);if(typeof t=="string"){let[n,i]=Sm(t);return i?{type:"SpecificResource",source:{id:n,type:e.typeHint||"Unknown"},selector:{type:"FragmentSelector",value:i}}:{type:"SpecificResource",source:{id:n,type:e.typeMap&&e.typeMap[n]||e.typeHint||"Unknown"}}}if(t.type==="Choice"||t.type==="List"||t.type==="Composite"||t.type==="Independents")return bm(t.items[0]);if(!t.type&&"source"in t&&(t.type="SpecificResource"),t.type==="SpecificResource"){t.source.type==="Canvas"&&t.source.partOf&&typeof t.source.partOf=="string"&&(t.source.partOf=[{id:t.source.partOf,type:"Manifest"}]);let n=typeof t.source=="string"?t.source:t.source.id,[,i]=Sm(n);if(i){let a=bm(n,e);a&&(t.selector=a.selector,t.source=a.source)}return t.selector?{...t,type:"SpecificResource",source:t.source,selector:t.selector}:{...t,type:"SpecificResource",source:t.source}}if(t.id){t.type==="Canvas"&&t.partOf&&typeof t.partOf=="string"&&(t.partOf=[{id:t.partOf,type:"Manifest"}]);let[n,i]=Sm(t.id);return i?{type:"SpecificResource",source:{...t,id:n},selector:{type:"FragmentSelector",value:i}}:{type:"SpecificResource",source:{...t,id:n}}}return{type:"SpecificResource",source:t}}function V2(){return{Collection:{},Manifest:{},Canvas:{},AnnotationPage:{},AnnotationCollection:{},Annotation:{},ContentResource:{},Range:{},Service:{},Selector:{},Agent:{}}}function j2(t,e){if(typeof t=="string")return{id:t,type:e};if(!t.id)throw Error(`Invalid resource does not have an ID (${JSON.stringify(t)}, ${e})`);return t}function g6(t,e){return(n,i)=>{let a=t[n]?t[n]:{};return(o,s)=>{let u=j2(o,i||n);return u&&u.id&&n?(a[u.id]=a[u.id]?Am(a[u.id],u,{parent:s.parent,isTopLevel:e.id===u.id}):Am({id:u.id,type:u.type},u,{parent:s.parent,isTopLevel:e.id===u.id}),{id:u.id,type:n==="ContentResource"?n:u.type}):u}}}function Em(t,e,n){if(!e)return t;if(Array.isArray(t)){if(!Array.isArray(e))throw Error("Cannot merge array with non-array");let i=[...t];for(let a of e)if(a["@id"]&&!a.id&&(a.id=a["@id"]),a["@type"]&&!a.type&&(a.type=a["@type"]),a!=null)if(Array.isArray(a))i.push(a);else if(typeof a=="object"&&a.id&&a.type){let o=i.findIndex(s=>s.id===a.id&&s.type===a.type);o>=0&&(i[o]=Em(i[o],a))}else t.indexOf(a)===-1&&i.push(a);return i}else if(typeof t=="object"){if(Array.isArray(e)||typeof e!="object")throw Error("Cannot merge object with non-object");let i={...t},a=[],o=[],s=Object.keys(t).filter(p=>p!==Ke&&p!=="id"&&p!=="type"),u={},d={};for(let[p,f]of Object.entries(e)){if(p===Ke||p==="id"||p==="type")continue;let m=i[p];m===f?o.push(p):m===Et||!m?(a.push(p),i[p]=f):(m&&f&&(u[p]=m,d[p]=f),i[p]=Em(m,f),i[p]===u[p]&&(o.push(p),delete u[p]))}if(n&&(n.parent&&n.parent.id||n.isTopLevel)){let p=[],f={};if(n.parent?f[ki]=n.parent.id:n.isTopLevel&&(f[ki]=t.id),i[Ke]&&i[Ke].length){let m=!(i[Ke]||[]).find(v=>v["@explicit"]),g=a.length>0||o.length!==s.length;if(m&&g)for(let v of i[Ke]){let S={...v},E=Object.keys(u);if(S){S["@explicit"]=!0;for(let T of s)T!==Ke&&(S[T]=zu);for(let T of E)S[T]=u[T]}p.push(S)}else p.push(...i[Ke]);if(g){let v=Object.keys(d);f["@explicit"]=!0;for(let S of a)f[S]=zu;for(let S of o)f[S]=zu;for(let S of v)f[S]=d[S]}}f.id=i.id,f.type=i.type,p.push(f),i[Ke]=p}return i}else if(t)return t;return e}function Am(t,e,n){if(typeof t=="string")return t;if(e.id!==t.id||e.type!==t.type){if(e.type==="ImageService3")return e;if(t.type==="ImageService3")return t;throw Error(`Can only merge entities with identical identifiers and type! ${e.type}(${e.id}) => ${t.type}(${t.id})`)}return Em({...t},e,n)}function y6(t){return(e,n)=>i=>{let{id:a,type:o}=j2(i,n||e);if(a===void 0)throw Error("Found invalid entity without an ID.");return e==="ContentResource"||e==="Service"?t[a]=e:t[a]=o,i}}function v6(t){let e=Object.assign({},t);if(e["@id"]&&(e.id=e["@id"]),e["@type"]&&(e.type=e["@type"]),e.service){let n=[];e.service=Array.isArray(e.service)?e.service:[e.service];for(let i of e.service)n.push({id:i["@id"]||i.id,type:i["@type"]||i.type});e.service=n}return Object.assign({},U2,e)}function S6(t){return e=>{t.Service=t.Service?t.Service:{};let n=e.id||e["@id"],i=v6(e);return i&&i.id&&(t.Service[i.id]?t.Service[n]=Am(t.Service[n],i):t.Service[n]=i),e}}function b6(t){let e=JSON.stringify(t),n=5381,i=e.length;for(;i;)n=n*33^e.charCodeAt(--i);let a=n>>>0,o=a.toString(16);return o.length%2?"0"+o:o}function qb(t){return e=>typeof e=="string"?{id:e,type:t}:e.id?e.type?e:{type:t,...e}:{id:`vault://${b6(e)}`,type:t,...e}}function _u(t){return e=>({...t,...e})}function Xf(t){return Array.isArray(t)?t:[t]}function x6(t){return t.body&&(t.body=Xf(t.body)),t.seeAlso&&(t.seeAlso=Xf(t.seeAlso)),t.audience&&(t.audience=Xf(t.audience)),t.accessibility&&(t.accessibility=Xf(t.accessibility)),t.motivation&&(t.motivation=Xf(t.motivation)),t}function q2(t,{typeHint:e,partOfTypeHint:n}={}){if(typeof t=="string"&&(t={id:t,type:e||"unknown"}),Gi(t))return typeof t.source=="string"&&(t.source={id:t.source,type:e||"unknown"}),t.source.type==="Canvas"&&t.source.partOf&&typeof t.source.partOf=="string"&&(t.source.partOf=[{id:t.source.partOf,type:n||"Manifest"}]),t;let i,[a,o]=Sm(t.id);return t.id=a,o&&o&&(i={type:"FragmentSelector",value:o}),{type:"SpecificResource",source:t,selector:i}}function E6(t){let e=Object.assign({},t);return t&&t.items&&(e.items=t.items.map(n=>typeof n=="string"||n.type==="Canvas"?q2(n):n)),e}function A6(t){let e=Object.assign({},t);return e.start?(e.start=q2(e.start,{typeHint:"Canvas"}),e):t}function R6(t){let e=Object.assign({},t);return e.target?(e.target=bm(e.target,{typeHint:"Canvas"}),e):t}function F2(t){return t}function xm(t){return t.items===void 0&&(t[Nu]=!0),t}function kb(t){let e=O2(t),n=V2(),i={},a=g6(n,e),o=y6(i),s=new ab({collection:[xm,_u(L2),o("Collection"),a("Collection")],manifest:[xm,_u(B2),A6,o("Manifest"),a("Manifest")],canvas:[_u(D2),o("Canvas"),a("Canvas")],annotationPage:[xm,qb("AnnotationPage"),_u(I2),o("AnnotationPage"),a("AnnotationPage")],annotation:[qb("Annotation"),x6,R6,o("Annotation"),a("Annotation")],contentResource:[qb("ContentResource"),o("ContentResource"),a("ContentResource")],range:[_u(P2),E6,o("Range","Canvas"),a("Range","Canvas")],agent:[_u(H2),o("Agent"),a("Agent")],specificResource:[F2],service:[S6(n)]}),u=s.traverseUnknown(e);return{entities:n,resource:u,mapping:i}}function G2(t){let e={};for(let[n,i]of t){if(n===Fb&&i!==ga)return i;i!==ga&&i!=null&&(e[n]=i)}return e}function Yb(t,e,n){if(!e.type||!e.id)throw Error("Unknown entity");if(!n[e.type])throw Error(`Serializer not found for ${e.type}`);function i(a,o,s=0){let u=n[a.type];if(!u)return ga;if(s>20)throw Error("Circular reference: "+a.id+" "+a.type);let[d,p]=Gb(t,a.type?a:a.id,o)||(a.id&&a.type?a:null);if(!d)return ga;let f=u(d,t,{parent:o,isTopLevel:e.id===a.id,fullResource:p}),m=f.next();for(;!m.done;){let g=m.value,v=ga;if(g)if(Array.isArray(g)){let S=[];for(let E of g)S.push(i(E,a,s+1));v=S}else v=i(g,a,s+1);m=f.next(v)}return m.value===ga?ga:G2(m.value)}return i(e)}function Iu(t,{allowSourceString:e=!0,allowString:n=!1,allowedStringType:i}={}){let a=o=>{if(e&&o&&o.source&&typeof o.source!="string"){let s=Object.keys(o.source);if(o.source.id&&o.source.type&&s.length===2)return{...o,source:o.source.id}}return o};if(t){if(t.source&&t.source.partOf)return a(t);let o=Object.keys(t);if(o.length===2&&t.type&&t.source||o.length===3&&t.type&&t.source&&o.indexOf("selector")!==-1&&!t.selector)return n&&(!i||i===t.source.type)?t.source.id:t.source.type==="ContentResource"?{type:"SpecificResource",source:t.source.id}:t.source;if(t.selector&&!Array.isArray(t.selector)&&typeof t.selector!="string"&&t.selector.type==="FragmentSelector"){let s=`${t.source.id}#${t.selector.value}`;return n?s:{id:s,type:t.source.type}}}return a(t)}function as(t){if(!t)return;let e=Object.keys(t);if(e.length!==0){if(e.length===1){let n=e[0];if(!n)return"";let i=(t[n]||[]).join("");return n==="@none"||n==="none"||n==="en"?i:{"@language":n,"@value":i}}return e.map(n=>({"@language":n,"@value":(t[n]||[]).join("")}))}}function k2(t){return Array.isArray(t)?t.map(e=>k2(e)):typeof t=="string"?t:t.type&&t.type==="Canvas"?t.id:t}function Hr(t,e=!1){if(t)return t.length>1&&!e?t:t[0]||void 0}function T6(t){if(t){if(typeof t=="string")return{"@id":t};if("@id"in t){let e={...t};return delete e["@type"],e}return{"@context":"http://iiif.io/api/image/2/context.json","@id":t.id,profile:`http://iiif.io/api/image/2/profiles/${t.profile}.json`}}}function es(t,e){return[["@id",t.id],["@type",e],["format",t.format],["height",t.height],["width",t.width],["viewingDirection",t.viewingDirection==="left-to-right"?void 0:t.viewingDirection],["license",t.license?t.license:void 0]]}function*ns(t){let e=t.provider?yield t.provider[0]:void 0;return[["label",as(t.label)],["metadata",t.metadata&&t.metadata.length?t.metadata.map(n=>({label:as(n.label)||"",value:as(n.value)||""})):void 0],["description",as(t.summary)],["thumbnail",Hr(yield t.thumbnail)],["navDate",t.navDate],["logo",e?Hr(e.logo):void 0],["homepage",e?e.homepage:void 0],["attribution",t.requiredStatement?as(t.requiredStatement.value):void 0]]}function*Kf(t){let e=t.start&&t.start.type&&t.start.type==="SpecificResource"?Iu(t.start):t.start;return[["seeAlso",Hr(yield t.seeAlso)],["service",Hr((t.service||[]).map(T6))],["rendering",Hr(yield t.rendering)],["startCanvas",e?e.id:void 0]]}function C6(t){return t.type==="SpecificResource"}function w6(t){return t&&t.type==="FragmentSelector"}function M6(t){if(t&&C6(t)){let e=t.id,n=t.selector?Array.isArray(t.selector)?t.selector[0]:t.selector:void 0;return w6(n)&&(e+="#"+n.value),e}return t?.id}var Qb={Manifest:function*(t,e,{isTopLevel:n}){return[...n?[["@context","http://iiif.io/api/presentation/2/context.json"]]:[],...es(t,"sc:Manifest"),...yield*ns(t),...yield*Kf(t),["sequences",[{"@id":`${t.id}/sequence0`,"@type":"sc:Sequence",canvases:yield t.items}]],["structures",yield t.structures]]},Canvas:function*(t){let e=yield t.items,n=e[0];return[...es(t,"sc:Canvas"),...yield*ns(t),...yield*Kf(t),["images",n?[n.resources]:void 0],["annotations",t.annotations&&t.annotations.length?Hr(yield t.annotations):void 0]]},AnnotationPage:function*(t){return[...es(t,"sc:AnnotationList"),...yield*ns(t),["resources",t.items&&t.items.length?Hr(yield t.items):void 0]]},Annotation:function*(t){return[["@id",t.id],["@type","oa:Annotation"],["motivation","sc:painting"],["on",k2(t.target)],["resource",Hr(yield t.body,!0)]]},ContentResource:function*(t){switch(t.type){case"Image":return[...es(t,"dctypes:Image"),...yield*ns(t),...yield*Kf(t)];case"Text":case"Dataset":default:return[...es(t,void 0),...yield*ns(t)]}},AnnotationCollection:function*(t){return[["@id",t.id],["@type","sc:Layer"],["label",as(t.label)]]},Collection:function*(t){return[...es(t,"sc:Collection"),...yield*ns(t),...yield*Kf(t),["members",yield*t.items]]},Range:function*(t){let e=[],n=[];if(t.items)for(let i of t.items){let a=i.type==="SpecificResource"?i.source:i;if(a){let o=yield a;e.push({"@id":M6(i),"@type":a.type,label:o?o.label:void 0,within:t.id}),a.type==="Canvas"&&n.push(a.id)}}return[...es(t,"sc:Range"),...yield*ns(t),...yield*Kf(t),["canvases",n.length===e.length?n:void 0],["members",n.length===e.length?void 0:e]]}};function is(t){return[["id",t.id?.startsWith("vault://")?void 0:t.id],["type",t.type],["format",t.format],["profile",t.profile],["height",t.height||void 0],["width",t.width||void 0],["duration",t.duration||void 0],["viewingDirection",t.viewingDirection==="left-to-right"?void 0:t.viewingDirection],["behavior",t.behavior&&t.behavior.length?t.behavior:void 0],["timeMode",t.timeMode],["motivation",Array.isArray(t.motivation)?t.motivation[0]:t.motivation],[Ke,ga]]}function dn(t){if(t===ga||!t||t.length===0)return;let e=t.filter(n=>n!==ga);if(e.length!==0)return e}function Y2(t){if(t&&t.type&&t.type==="ImageService2"){let{id:e,type:n,profile:i,...a}=t,o=typeof i=="string"?i:Array.isArray(i)?i.find(s=>typeof s=="string"):"";return{"@id":e,"@type":n,profile:o?o.startsWith("http")?o:`http://iiif.io/api/image/2/${o}.json`:"http://iiif.io/api/image/2/level0.json",...a}}return t}function _2(t){if(Array.isArray(t)||(t=t?[t]:[]),!(!t||t.length===0))return t.map(Y2)}function*Br(t){return[["label",t.label],["metadata",dn(t.metadata)],["summary",t.summary],["requiredStatement",t.requiredStatement],["rights",Array.isArray(t.rights)?t.rights[0]||void 0:t.rights||void 0],["navDate",t.navDate],["language",t.language],["thumbnail",dn(yield t.thumbnail)],["placeholderCanvas",yield t.placeholderCanvas],["accompanyingCanvas",yield t.accompanyingCanvas],["provider",dn(yield t.provider)]]}function*Pr(t,e){let n=[];for(let i of t.partOf||[])i.type==="Manifest"&&e.type==="Manifest"||n.push(yield i);return[["seeAlso",dn(yield t.seeAlso)],["service",dn(_2(t.service))],["services",dn(_2(t.services))],["rendering",dn(yield t.rendering)],["supplementary",dn(yield t.supplementary)],["homepage",dn(yield t.homepage)],["logo",dn(yield t.logo)],["partOf",dn(n)],["start",t.start?Iu(t.start):t.start]]}var Xb={Manifest:function*(t,e,{isTopLevel:n}){if(!n)return[...is(t),...yield*Br(t),["navPlace",t.navPlace]];let i="http://iiif.io/api/presentation/3/context.json";return(t.navPlace||z2(t))&&(i=["http://iiif.io/api/presentation/3/context.json","http://iiif.io/api/extension/navplace/context.json"]),[["@context",t["@context"]?t["@context"]:i],...is(t),...yield*Br(t),...yield*Pr(t),["items",yield t.items],["structures",dn(yield t.structures)],["annotations",dn(yield t.annotations)],["navPlace",t.navPlace]]},Canvas:function*(t,e,{parent:n}){return n&&n.type!=="Manifest"&&n.type!=="Canvas"?[["id",t.id]]:[...is(t),...yield*Br(t),...yield*Pr(t,n),["items",yield t.items],["annotations",dn(yield t.annotations)],["navPlace",t.navPlace]]},Agent:function*(t){return[["id",t.id],["type","Agent"],["label",t.label],...yield*Pr(t)]},AnnotationPage:function*(t){let e=Object.entries(t).map(([i,a])=>[i,Array.isArray(a)?dn(a):a]).filter(([i,a])=>i!=="items"&&i!=="id"&&i!==Ke&&i!==ki&&i!==Nu),n=yield t.items;return[["id",t.id?.startsWith("vault://")?void 0:t.id],...e,...yield*Pr(t),["items",n.length||t[Nu]===!1?n:ga]]},Service:function*(t){return[[Fb,Y2(t)]]},Annotation:function*(t){let e=Object.entries(t).map(([i,a])=>i==="motivation"?[i,Array.isArray(a)?a[0]:a]:i==="target"?[i,Iu(a,{allowString:!0,allowSourceString:!0,allowedStringType:"Canvas"})]:[i,Array.isArray(a)?dn(a):a]).filter(([i])=>i!=="body"&&i!==Ke&&i!==Nu),n;if(Array.isArray(t.body)){let i=[];for(let a of t.body)if(a&&Gi(a)){let o={...a};a.source.type==="Canvas"?o.source=a.source:o.source=yield a.source,i.push(Iu(o,{allowSourceString:!0}))}else i.push(yield a);n=i}else t.body&&Gi(t.body)?(n={...t.body},n.source=yield t.body.source):n=yield t.body;return[...e,...yield*Br(t),...yield*Pr(t),["body",n.length===1?n[0]:n]]},ContentResource:function*(t){return O6([...is(t),...yield*Br(t),...yield*Pr(t),["annotations",dn(yield t.annotations)],["items",dn(yield t.items)]],t)},AnnotationCollection:function*(t){return[["id",t.id],["type","AnnotationCollection"],["label",t.label]]},Collection:function*(t,e,{isTopLevel:n}){if(n){let i="http://iiif.io/api/presentation/3/context.json";return(t.navPlace||z2(t))&&(i=["http://iiif.io/api/extension/navplace/context.json","http://iiif.io/api/presentation/3/context.json"]),[["@context",i],...is(t),...yield*Br(t),...yield*Pr(t),["items",dn(yield t.items)],["navPlace",t.navPlace]]}return[...is(t),...yield*Br(t),["navPlace",t.navPlace]]},Range:function*(t){let e=[];for(let n of t.items)n.type==="Range"?e.push(yield n):n&&n.type==="SpecificResource"?e.push(Iu(n)):e.push(n);return[...is(t),...yield*Br(t),...yield*Pr(t),["items",e],["annotations",dn(yield t.annotations)],["navPlace",t.navPlace]]}};function O6(t,e){let n=Object.keys(e),i=t.map(([a])=>a);for(let a of n)a===Ke||a===Nu||i.indexOf(a)===-1&&e[a]!==void 0&&t.push([a,e[a]]);return t}function z2(t){if(!t.items||!Array.isArray(t.items))return!1;for(let e of t.items)if(e.navPlace)return!0;return!1}function Q2(t,e){return Gi(t)?typeof t.source=="string"?{...t,source:e}:{...t,source:{...t.source||{},id:e}}:{...t,id:e}}var we=function(t){return function(){let e={type:t,getType:()=>t,toString:()=>t};return(n,i)=>({...e,...n!==void 0&&{payload:n},...i!==void 0&&{meta:i}})}},Rm="@iiif/IMPORT_ENTITIES",Tm="@iiif/MODIFY_ENTITY_FIELD",Cm="@iiif/REORDER_ENTITY_FIELD",wm="@iiif/MOVE_ENTITY",Zf="@iiif/MOVE_ENTITIES",Mm="@iiif/ADD_REFERENCE",Wf="@iiif/UPDATE_REFERENCE",Om="@iiif/CHANGE_REFERENCE_IDENTIFIER",_m="@iiif/REMOVE_REFERENCE",zm="@iiif/ADD_METADATA",Nm="@iiif/REMOVE_METADATA",Jf="@iiif/UPDATE_METADATA",Im="@iiif/REORDER_METADATA",Dm=we(Rm)(),X2=we(Tm)(),K2=we(Cm)(),Z2=we(wm)(),W2=we(Zf)(),J2=we(Mm)(),$2=we(_m)(),tM=we(Wf)(),eM=we(Om)(),nM=we(zm)(),iM=we(Jf)(),aM=we(Nm)(),oM=we(Im)(),os={importEntities:Dm,modifyEntityField:X2,reorderEntityField:K2,addReference:J2,removeReference:$2,updateReference:tM,changeReferenceIdentifier:eM,addMetadata:nM,removeMetadata:aM,updateMetadata:iM,reorderMetadata:oM,moveEntity:Z2,moveEntities:W2},Lm="@iiif/ADD_MAPPING",Bm="@iiif/ADD_MAPPINGS",Kb=we(Lm)(),Zb=we(Bm)();var Bu="RESOURCE_ERROR",$f="RESOURCE_LOADING",Pu="RESOURCE_READY",Pm="@iiif/REQUEST_RESOURCE",Hm="@iiif/REQUEST_ERROR",Um="@iiif/REQUEST_MISMATCH",Vm="@iiif/REQUEST_COMPLETE",jm="@iiif/REQUEST_OFFLINE_RESOURCE",Wb=we(Pm)(),td=we(Hm)(),Jb=we(Um)(),$b=we(Vm)(),_6=we(jm)();var Hu="@iiif/BATCH",qm="@iiif/BATCH_IMPORT",Uu=we(Hu)(),z6=we(qm)();var t1="@iiif/SET_META_VALUE",e1="@iiif/SET_META_VALUE_DYNAMIC",n1="@iiif/UNSET_META_VALUE",i1={setMetaValue:we(t1)(),setMetaValueDynamic:we(e1)(),unsetMetaValue:we(n1)()};var N6=(t,e)=>{let{entities:n,resource:i,mapping:a}=kb(e);if(i.id===void 0)return[td({id:t,message:"ID is not defined in resource."})];let o=[Dm({entities:n}),Zb({mapping:a})];return i.id!==t&&(o.push(Kb({id:t,type:i.type})),o.push(Jb({requestId:t,actualId:i.id}))),o.push($b({id:t})),o},rM=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function I6(t,e){return!!(t===e||rM(t)&&rM(e))}function o1(t,e){if(!Array.isArray(t)||!Array.isArray(e))return t===e;if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(!I6(t[n],e[n]))return!1;return!0}function a1(t,e,n){let i=t.iiif.requests[e],a=t.iiif.mapping[e];if(!a||!t.iiif.entities[a][i.resourceUri])return;let o=t.iiif.entities[a][i.resourceUri];return o&&o[Ke]?Lu(o,o[Ke].find(s=>n?s[ki]===n.id:s[ki]===o.id)):o}function D6(t){return t&&typeof t.then=="function"}function r1(t,e,{waitTimeout:n=30}={}){return(i,a,o)=>{let s=t.getStore(),u=s.getState(),d=u.iiif.requests[i];if(d){if(d.loadingState===Pu){let f=a1(u,i);if(f)return f}switch(d.loadingState){case Bu:break;case $f:return(async()=>{let f,m=!1;try{let g=await Promise.race([new Promise((v,S)=>{m||(f=s.subscribe(()=>{let E=s.getState();if(E.iiif.requests[i].loadingState===Bu){S();return}if(E.iiif.requests[i].loadingState===Pu){let T=a1(E,i);T?v(T):S()}}))}),new Promise((v,S)=>setTimeout(()=>{m=!0,S()},n*60*1e3))]);if(f&&f(),g)return g}catch{f&&f()}})()}}t.dispatch(Wb({id:i}));let p=f=>{if(!f)return;!f.id&&!f["@id"]&&(f["@type"]&&(f["@id"]=i),f.id=i);let m=N6(i,f);return t.dispatch(Uu({actions:m})),a1(s.getState(),i)};try{let f=e(i,a);return D6(f)?(async()=>{try{let m=await f;return o&&(m=o(m)),p(m)}catch(m){throw t.dispatch(td({id:i,message:m.toString()})),m}})():p(o?o(f):f)}catch(f){throw t.dispatch(td({id:i,message:f.toString()})),f}}}function l1(){return{Collection:{},Manifest:{},Canvas:{},AnnotationPage:{},AnnotationCollection:{},Annotation:{},ContentResource:{},Range:{},Service:{},Selector:{},Agent:{}}}var Vu={},L6=(t,e)=>(n,i,a)=>(a.dispatch=o=>(n(s=>t(s,o),!1,o),o),a.dispatchFromDevtools=!0,{dispatch:(...o)=>a.dispatch(...o),...e}),u1=new Map,Fm=t=>{let e=u1.get(t);return e?Object.fromEntries(Object.entries(e.stores).map(([n,i])=>[n,i.getState()])):{}},B6=(t,e,n)=>{if(t===void 0)return{type:"untracked",connection:e.connect(n)};let i=u1.get(n.name);if(i)return{type:"tracked",store:t,...i};let a={connection:e.connect(n),stores:{}};return u1.set(n.name,a),{type:"tracked",store:t,...a}},P6=(t,e={})=>(n,i,a)=>{let{enabled:o,anonymousActionType:s,store:u,...d}=e,p;try{p=(o??(Vu.env?Vu.env.MODE:void 0)!=="production")&&window.__REDUX_DEVTOOLS_EXTENSION__}catch{}if(!p)return(Vu.env?Vu.env.MODE:void 0)!=="production"&&o&&console.warn("[zustand devtools middleware] Please install/enable Redux devtools extension"),t(n,i,a);let{connection:f,...m}=B6(u,p,d),g=!0;a.setState=(E,T,A)=>{let x=n(E,T);if(!g)return x;let R=A===void 0?{type:s||"anonymous"}:typeof A=="string"?{type:A}:A;return u===void 0?(f?.send(R,i()),x):(f?.send({...R,type:`${u}/${R.type}`},{...Fm(d.name),[u]:a.getState()}),x)};let v=(...E)=>{let T=g;g=!1,n(...E),g=T},S=t(a.setState,i,a);if(m.type==="untracked"?f?.init(S):(m.stores[m.store]=a,f?.init(Object.fromEntries(Object.entries(m.stores).map(([E,T])=>[E,E===m.store?S:T.getState()])))),a.dispatchFromDevtools&&typeof a.dispatch=="function"){let E=!1,T=a.dispatch;a.dispatch=(...A)=>{(Vu.env?Vu.env.MODE:void 0)!=="production"&&A[0].type==="__setState"&&!E&&(console.warn('[zustand devtools middleware] "__setState" action type is reserved to set state from the devtools. Avoid using it.'),E=!0),T(...A)}}return f.subscribe(E=>{switch(E.type){case"ACTION":if(typeof E.payload!="string"){console.error("[zustand devtools middleware] Unsupported action format");return}return s1(E.payload,T=>{if(T.type==="__setState"){if(u===void 0){v(T.state);return}Object.keys(T.state).length!==1&&console.error(`
|
|
19
|
+
`+i.stack}}var ew=Object.prototype.hasOwnProperty,Gw=Yn.unstable_scheduleCallback,vx=Yn.unstable_cancelCallback,jq=Yn.unstable_shouldYield,kq=Yn.unstable_requestPaint,Ta=Yn.unstable_now,Gq=Yn.unstable_getCurrentPriorityLevel,lI=Yn.unstable_ImmediatePriority,uI=Yn.unstable_UserBlockingPriority,Ty=Yn.unstable_NormalPriority,Yq=Yn.unstable_LowPriority,cI=Yn.unstable_IdlePriority,Xq=Yn.log,Qq=Yn.unstable_setDisableYieldValue,Oh=null,Ra=null;function Rs(t){if(typeof Xq=="function"&&Qq(t),Ra&&typeof Ra.setStrictMode=="function")try{Ra.setStrictMode(Oh,t)}catch{}}var Ea=Math.clz32?Math.clz32:Wq,Kq=Math.log,Zq=Math.LN2;function Wq(t){return t>>>=0,t===0?32:31-(Kq(t)/Zq|0)|0}var Vg=256,jg=262144,kg=4194304;function Xl(t){var e=t&42;if(e!==0)return e;switch(t&-t){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:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return t&261888;case 262144:case 524288:case 1048576:case 2097152:return t&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function Ky(t,e,n){var i=t.pendingLanes;if(i===0)return 0;var a=0,r=t.suspendedLanes,l=t.pingedLanes;t=t.warmLanes;var u=i&134217727;return u!==0?(i=u&~r,i!==0?a=Xl(i):(l&=u,l!==0?a=Xl(l):n||(n=u&~t,n!==0&&(a=Xl(n))))):(u=i&~r,u!==0?a=Xl(u):l!==0?a=Xl(l):n||(n=i&~t,n!==0&&(a=Xl(n)))),a===0?0:e!==0&&e!==a&&!(e&r)&&(r=a&-a,n=e&-e,r>=n||r===32&&(n&4194048)!==0)?e:a}function _h(t,e){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&e)===0}function Jq(t,e){switch(t){case 1:case 2:case 4:case 8:case 64:return e+250;case 16:case 32: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 e+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function dI(){var t=kg;return kg<<=1,!(kg&62914560)&&(kg=4194304),t}function bx(t){for(var e=[],n=0;31>n;n++)e.push(t);return e}function zh(t,e){t.pendingLanes|=e,e!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function $q(t,e,n,i,a,r){var l=t.pendingLanes;t.pendingLanes=n,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=n,t.entangledLanes&=n,t.errorRecoveryDisabledLanes&=n,t.shellSuspendCounter=0;var u=t.entanglements,f=t.expirationTimes,h=t.hiddenUpdates;for(n=l&~n;0<n;){var d=31-Ea(n),m=1<<d;u[d]=0,f[d]=-1;var y=h[d];if(y!==null)for(h[d]=null,d=0;d<y.length;d++){var g=y[d];g!==null&&(g.lane&=-536870913)}n&=~m}i!==0&&fI(t,i,0),r!==0&&a===0&&t.tag!==0&&(t.suspendedLanes|=r&~(l&~e))}function fI(t,e,n){t.pendingLanes|=e,t.suspendedLanes&=~e;var i=31-Ea(e);t.entangledLanes|=e,t.entanglements[i]=t.entanglements[i]|1073741824|n&261930}function hI(t,e){var n=t.entangledLanes|=e;for(t=t.entanglements;n;){var i=31-Ea(n),a=1<<i;a&e|t[i]&e&&(t[i]|=e),n&=~a}}function pI(t,e){var n=e&-e;return n=n&42?1:Yw(n),n&(t.suspendedLanes|e)?0:n}function Yw(t){switch(t){case 2:t=1;break;case 8:t=4;break;case 32:t=16;break;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:t=128;break;case 268435456:t=134217728;break;default:t=0}return t}function Xw(t){return t&=-t,2<t?8<t?t&134217727?32:268435456:8:2}function mI(){var t=Ne.p;return t!==0?t:(t=window.event,t===void 0?32:HL(t.type))}function L_(t,e){var n=Ne.p;try{return Ne.p=t,e()}finally{Ne.p=n}}var Vs=Math.random().toString(36).slice(2),fi="__reactFiber$"+Vs,$i="__reactProps$"+Vs,hd="__reactContainer$"+Vs,nw="__reactEvents$"+Vs,tU="__reactListeners$"+Vs,eU="__reactHandles$"+Vs,D_="__reactResources$"+Vs,Ih="__reactMarker$"+Vs;function Qw(t){delete t[fi],delete t[$i],delete t[nw],delete t[tU],delete t[eU]}function Fc(t){var e=t[fi];if(e)return e;for(var n=t.parentNode;n;){if(e=n[hd]||n[fi]){if(n=e.alternate,e.child!==null||n!==null&&n.child!==null)for(t=jz(t);t!==null;){if(n=t[fi])return n;t=jz(t)}return e}t=n,n=t.parentNode}return null}function pd(t){if(t=t[fi]||t[hd]){var e=t.tag;if(e===5||e===6||e===13||e===31||e===26||e===27||e===3)return t}return null}function Jf(t){var e=t.tag;if(e===5||e===26||e===27||e===6)return t.stateNode;throw Error(ot(33))}function Kc(t){var e=t[D_];return e||(e=t[D_]={hoistableStyles:new Map,hoistableScripts:new Map}),e}function ti(t){t[Ih]=!0}var gI=new Set,yI={};function ou(t,e){id(t,e),id(t+"Capture",e)}function id(t,e){for(yI[t]=e,t=0;t<e.length;t++)gI.add(e[t])}var nU=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),P_={},B_={};function iU(t){return ew.call(B_,t)?!0:ew.call(P_,t)?!1:nU.test(t)?B_[t]=!0:(P_[t]=!0,!1)}function ry(t,e,n){if(iU(e))if(n===null)t.removeAttribute(e);else{switch(typeof n){case"undefined":case"function":case"symbol":t.removeAttribute(e);return;case"boolean":var i=e.toLowerCase().slice(0,5);if(i!=="data-"&&i!=="aria-"){t.removeAttribute(e);return}}t.setAttribute(e,""+n)}}function Gg(t,e,n){if(n===null)t.removeAttribute(e);else{switch(typeof n){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(e);return}t.setAttribute(e,""+n)}}function go(t,e,n,i){if(i===null)t.removeAttribute(n);else{switch(typeof i){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(n);return}t.setAttributeNS(e,n,""+i)}}function ka(t){switch(typeof t){case"bigint":case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function vI(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function aU(t,e,n){var i=Object.getOwnPropertyDescriptor(t.constructor.prototype,e);if(!t.hasOwnProperty(e)&&typeof i<"u"&&typeof i.get=="function"&&typeof i.set=="function"){var a=i.get,r=i.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return a.call(this)},set:function(l){n=""+l,r.call(this,l)}}),Object.defineProperty(t,e,{enumerable:i.enumerable}),{getValue:function(){return n},setValue:function(l){n=""+l},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function iw(t){if(!t._valueTracker){var e=vI(t)?"checked":"value";t._valueTracker=aU(t,e,""+t[e])}}function bI(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),i="";return t&&(i=vI(t)?t.checked?"true":"false":t.value),t=i,t!==n?(e.setValue(t),!0):!1}function Ry(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}var rU=/[\n"\\]/g;function Xa(t){return t.replace(rU,function(e){return"\\"+e.charCodeAt(0).toString(16)+" "})}function aw(t,e,n,i,a,r,l,u){t.name="",l!=null&&typeof l!="function"&&typeof l!="symbol"&&typeof l!="boolean"?t.type=l:t.removeAttribute("type"),e!=null?l==="number"?(e===0&&t.value===""||t.value!=e)&&(t.value=""+ka(e)):t.value!==""+ka(e)&&(t.value=""+ka(e)):l!=="submit"&&l!=="reset"||t.removeAttribute("value"),e!=null?rw(t,l,ka(e)):n!=null?rw(t,l,ka(n)):i!=null&&t.removeAttribute("value"),a==null&&r!=null&&(t.defaultChecked=!!r),a!=null&&(t.checked=a&&typeof a!="function"&&typeof a!="symbol"),u!=null&&typeof u!="function"&&typeof u!="symbol"&&typeof u!="boolean"?t.name=""+ka(u):t.removeAttribute("name")}function SI(t,e,n,i,a,r,l,u){if(r!=null&&typeof r!="function"&&typeof r!="symbol"&&typeof r!="boolean"&&(t.type=r),e!=null||n!=null){if(!(r!=="submit"&&r!=="reset"||e!=null)){iw(t);return}n=n!=null?""+ka(n):"",e=e!=null?""+ka(e):n,u||e===t.value||(t.value=e),t.defaultValue=e}i=i??a,i=typeof i!="function"&&typeof i!="symbol"&&!!i,t.checked=u?t.checked:!!i,t.defaultChecked=!!i,l!=null&&typeof l!="function"&&typeof l!="symbol"&&typeof l!="boolean"&&(t.name=l),iw(t)}function rw(t,e,n){e==="number"&&Ry(t.ownerDocument)===t||t.defaultValue===""+n||(t.defaultValue=""+n)}function Zc(t,e,n,i){if(t=t.options,e){e={};for(var a=0;a<n.length;a++)e["$"+n[a]]=!0;for(n=0;n<t.length;n++)a=e.hasOwnProperty("$"+t[n].value),t[n].selected!==a&&(t[n].selected=a),a&&i&&(t[n].defaultSelected=!0)}else{for(n=""+ka(n),e=null,a=0;a<t.length;a++){if(t[a].value===n){t[a].selected=!0,i&&(t[a].defaultSelected=!0);return}e!==null||t[a].disabled||(e=t[a])}e!==null&&(e.selected=!0)}}function xI(t,e,n){if(e!=null&&(e=""+ka(e),e!==t.value&&(t.value=e),n==null)){t.defaultValue!==e&&(t.defaultValue=e);return}t.defaultValue=n!=null?""+ka(n):""}function wI(t,e,n,i){if(e==null){if(i!=null){if(n!=null)throw Error(ot(92));if(Wf(i)){if(1<i.length)throw Error(ot(93));i=i[0]}n=i}n==null&&(n=""),e=n}n=ka(e),t.defaultValue=n,i=t.textContent,i===n&&i!==""&&i!==null&&(t.value=i),iw(t)}function ad(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var oU=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function H_(t,e,n){var i=e.indexOf("--")===0;n==null||typeof n=="boolean"||n===""?i?t.setProperty(e,""):e==="float"?t.cssFloat="":t[e]="":i?t.setProperty(e,n):typeof n!="number"||n===0||oU.has(e)?e==="float"?t.cssFloat=n:t[e]=(""+n).trim():t[e]=n+"px"}function TI(t,e,n){if(e!=null&&typeof e!="object")throw Error(ot(62));if(t=t.style,n!=null){for(var i in n)!n.hasOwnProperty(i)||e!=null&&e.hasOwnProperty(i)||(i.indexOf("--")===0?t.setProperty(i,""):i==="float"?t.cssFloat="":t[i]="");for(var a in e)i=e[a],e.hasOwnProperty(a)&&n[a]!==i&&H_(t,a,i)}else for(var r in e)e.hasOwnProperty(r)&&H_(t,r,e[r])}function Kw(t){if(t.indexOf("-")===-1)return!1;switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var sU=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),lU=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function oy(t){return lU.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}function Ro(){}var ow=null;function Zw(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var qc=null,Wc=null;function F_(t){var e=pd(t);if(e&&(t=e.stateNode)){var n=t[$i]||null;t:switch(t=e.stateNode,e.type){case"input":if(aw(t,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),e=n.name,n.type==="radio"&&e!=null){for(n=t;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll('input[name="'+Xa(""+e)+'"][type="radio"]'),e=0;e<n.length;e++){var i=n[e];if(i!==t&&i.form===t.form){var a=i[$i]||null;if(!a)throw Error(ot(90));aw(i,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name)}}for(e=0;e<n.length;e++)i=n[e],i.form===t.form&&bI(i)}break t;case"textarea":xI(t,n.value,n.defaultValue);break t;case"select":e=n.value,e!=null&&Zc(t,!!n.multiple,e,!1)}}}var Sx=!1;function RI(t,e,n){if(Sx)return t(e,n);Sx=!0;try{var i=t(e);return i}finally{if(Sx=!1,(qc!==null||Wc!==null)&&(sv(),qc&&(e=qc,t=Wc,Wc=qc=null,F_(e),t)))for(e=0;e<t.length;e++)F_(t[e])}}function mh(t,e){var n=t.stateNode;if(n===null)return null;var i=n[$i]||null;if(i===null)return null;n=i[e];t:switch(e){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(i=!i.disabled)||(t=t.type,i=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!i;break t;default:t=!1}if(t)return null;if(n&&typeof n!="function")throw Error(ot(231,e,typeof n));return n}var Oo=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),sw=!1;if(Oo)try{Ic={},Object.defineProperty(Ic,"passive",{get:function(){sw=!0}}),window.addEventListener("test",Ic,Ic),window.removeEventListener("test",Ic,Ic)}catch{sw=!1}var Ic,Es=null,Ww=null,sy=null;function EI(){if(sy)return sy;var t,e=Ww,n=e.length,i,a="value"in Es?Es.value:Es.textContent,r=a.length;for(t=0;t<n&&e[t]===a[t];t++);var l=n-t;for(i=1;i<=l&&e[n-i]===a[r-i];i++);return sy=a.slice(t,1<i?1-i:void 0)}function ly(t){var e=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&e===13&&(t=13)):t=e,t===10&&(t=13),32<=t||t===13?t:0}function Yg(){return!0}function q_(){return!1}function ta(t){function e(n,i,a,r,l){this._reactName=n,this._targetInst=a,this.type=i,this.nativeEvent=r,this.target=l,this.currentTarget=null;for(var u in t)t.hasOwnProperty(u)&&(n=t[u],this[u]=n?n(r):r[u]);return this.isDefaultPrevented=(r.defaultPrevented!=null?r.defaultPrevented:r.returnValue===!1)?Yg:q_,this.isPropagationStopped=q_,this}return Je(e.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=Yg)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Yg)},persist:function(){},isPersistent:Yg}),e}var su={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Zy=ta(su),Nh=Je({},su,{view:0,detail:0}),uU=ta(Nh),xx,wx,kf,Wy=Je({},Nh,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Jw,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==kf&&(kf&&t.type==="mousemove"?(xx=t.screenX-kf.screenX,wx=t.screenY-kf.screenY):wx=xx=0,kf=t),xx)},movementY:function(t){return"movementY"in t?t.movementY:wx}}),U_=ta(Wy),cU=Je({},Wy,{dataTransfer:0}),dU=ta(cU),fU=Je({},Nh,{relatedTarget:0}),Tx=ta(fU),hU=Je({},su,{animationName:0,elapsedTime:0,pseudoElement:0}),pU=ta(hU),mU=Je({},su,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),gU=ta(mU),yU=Je({},su,{data:0}),V_=ta(yU),vU={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},bU={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},SU={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function xU(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):(t=SU[t])?!!e[t]:!1}function Jw(){return xU}var wU=Je({},Nh,{key:function(t){if(t.key){var e=vU[t.key]||t.key;if(e!=="Unidentified")return e}return t.type==="keypress"?(t=ly(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?bU[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Jw,charCode:function(t){return t.type==="keypress"?ly(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?ly(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),TU=ta(wU),RU=Je({},Wy,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),j_=ta(RU),EU=Je({},Nh,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Jw}),AU=ta(EU),CU=Je({},su,{propertyName:0,elapsedTime:0,pseudoElement:0}),MU=ta(CU),OU=Je({},Wy,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),_U=ta(OU),zU=Je({},su,{newState:0,oldState:0}),IU=ta(zU),NU=[9,13,27,32],$w=Oo&&"CompositionEvent"in window,eh=null;Oo&&"documentMode"in document&&(eh=document.documentMode);var LU=Oo&&"TextEvent"in window&&!eh,AI=Oo&&(!$w||eh&&8<eh&&11>=eh),k_=" ",G_=!1;function CI(t,e){switch(t){case"keyup":return NU.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function MI(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Uc=!1;function DU(t,e){switch(t){case"compositionend":return MI(e);case"keypress":return e.which!==32?null:(G_=!0,k_);case"textInput":return t=e.data,t===k_&&G_?null:t;default:return null}}function PU(t,e){if(Uc)return t==="compositionend"||!$w&&CI(t,e)?(t=EI(),sy=Ww=Es=null,Uc=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1<e.char.length)return e.char;if(e.which)return String.fromCharCode(e.which)}return null;case"compositionend":return AI&&e.locale!=="ko"?null:e.data;default:return null}}var BU={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Y_(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e==="input"?!!BU[t.type]:e==="textarea"}function OI(t,e,n,i){qc?Wc?Wc.push(i):Wc=[i]:qc=i,e=Vy(e,"onChange"),0<e.length&&(n=new Zy("onChange","change",null,n,i),t.push({event:n,listeners:e}))}var nh=null,gh=null;function HU(t){RL(t,0)}function Jy(t){var e=Jf(t);if(bI(e))return t}function X_(t,e){if(t==="change")return e}var _I=!1;Oo&&(Oo?(Qg="oninput"in document,Qg||(Rx=document.createElement("div"),Rx.setAttribute("oninput","return;"),Qg=typeof Rx.oninput=="function"),Xg=Qg):Xg=!1,_I=Xg&&(!document.documentMode||9<document.documentMode));var Xg,Qg,Rx;function Q_(){nh&&(nh.detachEvent("onpropertychange",zI),gh=nh=null)}function zI(t){if(t.propertyName==="value"&&Jy(gh)){var e=[];OI(e,gh,t,Zw(t)),RI(HU,e)}}function FU(t,e,n){t==="focusin"?(Q_(),nh=e,gh=n,nh.attachEvent("onpropertychange",zI)):t==="focusout"&&Q_()}function qU(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return Jy(gh)}function UU(t,e){if(t==="click")return Jy(e)}function VU(t,e){if(t==="input"||t==="change")return Jy(e)}function jU(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var Ca=typeof Object.is=="function"?Object.is:jU;function yh(t,e){if(Ca(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;var n=Object.keys(t),i=Object.keys(e);if(n.length!==i.length)return!1;for(i=0;i<n.length;i++){var a=n[i];if(!ew.call(e,a)||!Ca(t[a],e[a]))return!1}return!0}function K_(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function Z_(t,e){var n=K_(t);t=0;for(var i;n;){if(n.nodeType===3){if(i=t+n.textContent.length,t<=e&&i>=e)return{node:n,offset:e-t};t=i}t:{for(;n;){if(n.nextSibling){n=n.nextSibling;break t}n=n.parentNode}n=void 0}n=K_(n)}}function II(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?II(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function NI(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var e=Ry(t.document);e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=Ry(t.document)}return e}function tT(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}var kU=Oo&&"documentMode"in document&&11>=document.documentMode,Vc=null,lw=null,ih=null,uw=!1;function W_(t,e,n){var i=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;uw||Vc==null||Vc!==Ry(i)||(i=Vc,"selectionStart"in i&&tT(i)?i={start:i.selectionStart,end:i.selectionEnd}:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection(),i={anchorNode:i.anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset}),ih&&yh(ih,i)||(ih=i,i=Vy(lw,"onSelect"),0<i.length&&(e=new Zy("onSelect","select",null,e,n),t.push({event:e,listeners:i}),e.target=Vc)))}function Gl(t,e){var n={};return n[t.toLowerCase()]=e.toLowerCase(),n["Webkit"+t]="webkit"+e,n["Moz"+t]="moz"+e,n}var jc={animationend:Gl("Animation","AnimationEnd"),animationiteration:Gl("Animation","AnimationIteration"),animationstart:Gl("Animation","AnimationStart"),transitionrun:Gl("Transition","TransitionRun"),transitionstart:Gl("Transition","TransitionStart"),transitioncancel:Gl("Transition","TransitionCancel"),transitionend:Gl("Transition","TransitionEnd")},Ex={},LI={};Oo&&(LI=document.createElement("div").style,"AnimationEvent"in window||(delete jc.animationend.animation,delete jc.animationiteration.animation,delete jc.animationstart.animation),"TransitionEvent"in window||delete jc.transitionend.transition);function lu(t){if(Ex[t])return Ex[t];if(!jc[t])return t;var e=jc[t],n;for(n in e)if(e.hasOwnProperty(n)&&n in LI)return Ex[t]=e[n];return t}var DI=lu("animationend"),PI=lu("animationiteration"),BI=lu("animationstart"),GU=lu("transitionrun"),YU=lu("transitionstart"),XU=lu("transitioncancel"),HI=lu("transitionend"),FI=new Map,cw="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");cw.push("scrollEnd");function gr(t,e){FI.set(t,e),ou(e,[t])}var Ey=typeof reportError=="function"?reportError:function(t){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var e=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof t=="object"&&t!==null&&typeof t.message=="string"?String(t.message):String(t),error:t});if(!window.dispatchEvent(e))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",t);return}console.error(t)},ja=[],kc=0,eT=0;function $y(){for(var t=kc,e=eT=kc=0;e<t;){var n=ja[e];ja[e++]=null;var i=ja[e];ja[e++]=null;var a=ja[e];ja[e++]=null;var r=ja[e];if(ja[e++]=null,i!==null&&a!==null){var l=i.pending;l===null?a.next=a:(a.next=l.next,l.next=a),i.pending=a}r!==0&&qI(n,a,r)}}function tv(t,e,n,i){ja[kc++]=t,ja[kc++]=e,ja[kc++]=n,ja[kc++]=i,eT|=i,t.lanes|=i,t=t.alternate,t!==null&&(t.lanes|=i)}function nT(t,e,n,i){return tv(t,e,n,i),Ay(t)}function uu(t,e){return tv(t,null,null,e),Ay(t)}function qI(t,e,n){t.lanes|=n;var i=t.alternate;i!==null&&(i.lanes|=n);for(var a=!1,r=t.return;r!==null;)r.childLanes|=n,i=r.alternate,i!==null&&(i.childLanes|=n),r.tag===22&&(t=r.stateNode,t===null||t._visibility&1||(a=!0)),t=r,r=r.return;return t.tag===3?(r=t.stateNode,a&&e!==null&&(a=31-Ea(n),t=r.hiddenUpdates,i=t[a],i===null?t[a]=[e]:i.push(e),e.lane=n|536870912),r):null}function Ay(t){if(50<fh)throw fh=0,zw=null,Error(ot(185));for(var e=t.return;e!==null;)t=e,e=t.return;return t.tag===3?t.stateNode:null}var Gc={};function QU(t,e,n,i){this.tag=t,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=i,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function xa(t,e,n,i){return new QU(t,e,n,i)}function iT(t){return t=t.prototype,!(!t||!t.isReactComponent)}function Ao(t,e){var n=t.alternate;return n===null?(n=xa(t.tag,e,t.key,t.mode),n.elementType=t.elementType,n.type=t.type,n.stateNode=t.stateNode,n.alternate=t,t.alternate=n):(n.pendingProps=e,n.type=t.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=t.flags&65011712,n.childLanes=t.childLanes,n.lanes=t.lanes,n.child=t.child,n.memoizedProps=t.memoizedProps,n.memoizedState=t.memoizedState,n.updateQueue=t.updateQueue,e=t.dependencies,n.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},n.sibling=t.sibling,n.index=t.index,n.ref=t.ref,n.refCleanup=t.refCleanup,n}function UI(t,e){t.flags&=65011714;var n=t.alternate;return n===null?(t.childLanes=0,t.lanes=e,t.child=null,t.subtreeFlags=0,t.memoizedProps=null,t.memoizedState=null,t.updateQueue=null,t.dependencies=null,t.stateNode=null):(t.childLanes=n.childLanes,t.lanes=n.lanes,t.child=n.child,t.subtreeFlags=0,t.deletions=null,t.memoizedProps=n.memoizedProps,t.memoizedState=n.memoizedState,t.updateQueue=n.updateQueue,t.type=n.type,e=n.dependencies,t.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),t}function uy(t,e,n,i,a,r){var l=0;if(i=t,typeof t=="function")iT(t)&&(l=1);else if(typeof t=="string")l=WV(t,n,Hr.current)?26:t==="html"||t==="head"||t==="body"?27:5;else t:switch(t){case Wx:return t=xa(31,n,e,a),t.elementType=Wx,t.lanes=r,t;case Bc:return Wl(n.children,a,r,e);case oI:l=8,a|=24;break;case Qx:return t=xa(12,n,e,a|2),t.elementType=Qx,t.lanes=r,t;case Kx:return t=xa(13,n,e,a),t.elementType=Kx,t.lanes=r,t;case Zx:return t=xa(19,n,e,a),t.elementType=Zx,t.lanes=r,t;default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case To:l=10;break t;case sI:l=9;break t;case jw:l=11;break t;case kw:l=14;break t;case vs:l=16,i=null;break t}l=29,n=Error(ot(130,t===null?"null":typeof t,"")),i=null}return e=xa(l,n,e,a),e.elementType=t,e.type=i,e.lanes=r,e}function Wl(t,e,n,i){return t=xa(7,t,i,e),t.lanes=n,t}function Ax(t,e,n){return t=xa(6,t,null,e),t.lanes=n,t}function VI(t){var e=xa(18,null,null,0);return e.stateNode=t,e}function Cx(t,e,n){return e=xa(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}var J_=new WeakMap;function Qa(t,e){if(typeof t=="object"&&t!==null){var n=J_.get(t);return n!==void 0?n:(e={value:t,source:e,stack:N_(e)},J_.set(t,e),e)}return{value:t,source:e,stack:N_(e)}}var Yc=[],Xc=0,Cy=null,vh=0,Ga=[],Ya=0,Hs=null,Dr=1,Pr="";function xo(t,e){Yc[Xc++]=vh,Yc[Xc++]=Cy,Cy=t,vh=e}function jI(t,e,n){Ga[Ya++]=Dr,Ga[Ya++]=Pr,Ga[Ya++]=Hs,Hs=t;var i=Dr;t=Pr;var a=32-Ea(i)-1;i&=~(1<<a),n+=1;var r=32-Ea(e)+a;if(30<r){var l=a-a%5;r=(i&(1<<l)-1).toString(32),i>>=l,a-=l,Dr=1<<32-Ea(e)+a|n<<a|i,Pr=r+t}else Dr=1<<r|n<<a|i,Pr=t}function aT(t){t.return!==null&&(xo(t,1),jI(t,1,0))}function rT(t){for(;t===Cy;)Cy=Yc[--Xc],Yc[Xc]=null,vh=Yc[--Xc],Yc[Xc]=null;for(;t===Hs;)Hs=Ga[--Ya],Ga[Ya]=null,Pr=Ga[--Ya],Ga[Ya]=null,Dr=Ga[--Ya],Ga[Ya]=null}function kI(t,e){Ga[Ya++]=Dr,Ga[Ya++]=Pr,Ga[Ya++]=Hs,Dr=e.id,Pr=e.overflow,Hs=t}var hi=null,We=null,Re=!1,_s=null,Ka=!1,dw=Error(ot(519));function Fs(t){var e=Error(ot(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw bh(Qa(e,t)),dw}function $_(t){var e=t.stateNode,n=t.type,i=t.memoizedProps;switch(e[fi]=t,e[$i]=i,n){case"dialog":ve("cancel",e),ve("close",e);break;case"iframe":case"object":case"embed":ve("load",e);break;case"video":case"audio":for(n=0;n<Th.length;n++)ve(Th[n],e);break;case"source":ve("error",e);break;case"img":case"image":case"link":ve("error",e),ve("load",e);break;case"details":ve("toggle",e);break;case"input":ve("invalid",e),SI(e,i.value,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name,!0);break;case"select":ve("invalid",e);break;case"textarea":ve("invalid",e),wI(e,i.value,i.defaultValue,i.children)}n=i.children,typeof n!="string"&&typeof n!="number"&&typeof n!="bigint"||e.textContent===""+n||i.suppressHydrationWarning===!0||AL(e.textContent,n)?(i.popover!=null&&(ve("beforetoggle",e),ve("toggle",e)),i.onScroll!=null&&ve("scroll",e),i.onScrollEnd!=null&&ve("scrollend",e),i.onClick!=null&&(e.onclick=Ro),e=!0):e=!1,e||Fs(t,!0)}function tz(t){for(hi=t.return;hi;)switch(hi.tag){case 5:case 31:case 13:Ka=!1;return;case 27:case 3:Ka=!0;return;default:hi=hi.return}}function Nc(t){if(t!==hi)return!1;if(!Re)return tz(t),Re=!0,!1;var e=t.tag,n;if((n=e!==3&&e!==27)&&((n=e===5)&&(n=t.type,n=!(n!=="form"&&n!=="button")||Pw(t.type,t.memoizedProps)),n=!n),n&&We&&Fs(t),tz(t),e===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(ot(317));We=Vz(t)}else if(e===31){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(ot(317));We=Vz(t)}else e===27?(e=We,js(t.type)?(t=qw,qw=null,We=t):We=e):We=hi?Wa(t.stateNode.nextSibling):null;return!0}function eu(){We=hi=null,Re=!1}function Mx(){var t=_s;return t!==null&&(Wi===null?Wi=t:Wi.push.apply(Wi,t),_s=null),t}function bh(t){_s===null?_s=[t]:_s.push(t)}var fw=Fr(null),cu=null,Eo=null;function Ss(t,e,n){Qe(fw,e._currentValue),e._currentValue=n}function Co(t){t._currentValue=fw.current,ei(fw)}function hw(t,e,n){for(;t!==null;){var i=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,i!==null&&(i.childLanes|=e)):i!==null&&(i.childLanes&e)!==e&&(i.childLanes|=e),t===n)break;t=t.return}}function pw(t,e,n,i){var a=t.child;for(a!==null&&(a.return=t);a!==null;){var r=a.dependencies;if(r!==null){var l=a.child;r=r.firstContext;t:for(;r!==null;){var u=r;r=a;for(var f=0;f<e.length;f++)if(u.context===e[f]){r.lanes|=n,u=r.alternate,u!==null&&(u.lanes|=n),hw(r.return,n,t),i||(l=null);break t}r=u.next}}else if(a.tag===18){if(l=a.return,l===null)throw Error(ot(341));l.lanes|=n,r=l.alternate,r!==null&&(r.lanes|=n),hw(l,n,t),l=null}else l=a.child;if(l!==null)l.return=a;else for(l=a;l!==null;){if(l===t){l=null;break}if(a=l.sibling,a!==null){a.return=l.return,l=a;break}l=l.return}a=l}}function md(t,e,n,i){t=null;for(var a=e,r=!1;a!==null;){if(!r){if(a.flags&524288)r=!0;else if(a.flags&262144)break}if(a.tag===10){var l=a.alternate;if(l===null)throw Error(ot(387));if(l=l.memoizedProps,l!==null){var u=a.type;Ca(a.pendingProps.value,l.value)||(t!==null?t.push(u):t=[u])}}else if(a===Sy.current){if(l=a.alternate,l===null)throw Error(ot(387));l.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(t!==null?t.push(Eh):t=[Eh])}a=a.return}t!==null&&pw(e,t,n,i),e.flags|=262144}function My(t){for(t=t.firstContext;t!==null;){if(!Ca(t.context._currentValue,t.memoizedValue))return!0;t=t.next}return!1}function nu(t){cu=t,Eo=null,t=t.dependencies,t!==null&&(t.firstContext=null)}function pi(t){return GI(cu,t)}function Kg(t,e){return cu===null&&nu(t),GI(t,e)}function GI(t,e){var n=e._currentValue;if(e={context:e,memoizedValue:n,next:null},Eo===null){if(t===null)throw Error(ot(308));Eo=e,t.dependencies={lanes:0,firstContext:e},t.flags|=524288}else Eo=Eo.next=e;return n}var KU=typeof AbortController<"u"?AbortController:function(){var t=[],e=this.signal={aborted:!1,addEventListener:function(n,i){t.push(i)}};this.abort=function(){e.aborted=!0,t.forEach(function(n){return n()})}},ZU=Yn.unstable_scheduleCallback,WU=Yn.unstable_NormalPriority,Dn={$$typeof:To,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function oT(){return{controller:new KU,data:new Map,refCount:0}}function Lh(t){t.refCount--,t.refCount===0&&ZU(WU,function(){t.controller.abort()})}var ah=null,mw=0,rd=0,Jc=null;function JU(t,e){if(ah===null){var n=ah=[];mw=0,rd=zT(),Jc={status:"pending",value:void 0,then:function(i){n.push(i)}}}return mw++,e.then(ez,ez),e}function ez(){if(--mw===0&&ah!==null){Jc!==null&&(Jc.status="fulfilled");var t=ah;ah=null,rd=0,Jc=null;for(var e=0;e<t.length;e++)(0,t[e])()}}function $U(t,e){var n=[],i={status:"pending",value:null,reason:null,then:function(a){n.push(a)}};return t.then(function(){i.status="fulfilled",i.value=e;for(var a=0;a<n.length;a++)(0,n[a])(e)},function(a){for(i.status="rejected",i.reason=a,a=0;a<n.length;a++)(0,n[a])(void 0)}),i}var nz=Qt.S;Qt.S=function(t,e){rL=Ta(),typeof e=="object"&&e!==null&&typeof e.then=="function"&&JU(t,e),nz!==null&&nz(t,e)};var Jl=Fr(null);function sT(){var t=Jl.current;return t!==null?t:Ge.pooledCache}function cy(t,e){e===null?Qe(Jl,Jl.current):Qe(Jl,e.pool)}function YI(){var t=sT();return t===null?null:{parent:Dn._currentValue,pool:t}}var gd=Error(ot(460)),lT=Error(ot(474)),ev=Error(ot(542)),Oy={then:function(){}};function iz(t){return t=t.status,t==="fulfilled"||t==="rejected"}function XI(t,e,n){switch(n=t[n],n===void 0?t.push(e):n!==e&&(e.then(Ro,Ro),e=n),e.status){case"fulfilled":return e.value;case"rejected":throw t=e.reason,rz(t),t;default:if(typeof e.status=="string")e.then(Ro,Ro);else{if(t=Ge,t!==null&&100<t.shellSuspendCounter)throw Error(ot(482));t=e,t.status="pending",t.then(function(i){if(e.status==="pending"){var a=e;a.status="fulfilled",a.value=i}},function(i){if(e.status==="pending"){var a=e;a.status="rejected",a.reason=i}})}switch(e.status){case"fulfilled":return e.value;case"rejected":throw t=e.reason,rz(t),t}throw $l=e,gd}}function Ql(t){try{var e=t._init;return e(t._payload)}catch(n){throw n!==null&&typeof n=="object"&&typeof n.then=="function"?($l=n,gd):n}}var $l=null;function az(){if($l===null)throw Error(ot(459));var t=$l;return $l=null,t}function rz(t){if(t===gd||t===ev)throw Error(ot(483))}var $c=null,Sh=0;function Zg(t){var e=Sh;return Sh+=1,$c===null&&($c=[]),XI($c,t,e)}function Gf(t,e){e=e.props.ref,t.ref=e!==void 0?e:null}function Wg(t,e){throw e.$$typeof===Fq?Error(ot(525)):(t=Object.prototype.toString.call(e),Error(ot(31,t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)))}function QI(t){function e(T,S){if(t){var R=T.deletions;R===null?(T.deletions=[S],T.flags|=16):R.push(S)}}function n(T,S){if(!t)return null;for(;S!==null;)e(T,S),S=S.sibling;return null}function i(T){for(var S=new Map;T!==null;)T.key!==null?S.set(T.key,T):S.set(T.index,T),T=T.sibling;return S}function a(T,S){return T=Ao(T,S),T.index=0,T.sibling=null,T}function r(T,S,R){return T.index=R,t?(R=T.alternate,R!==null?(R=R.index,R<S?(T.flags|=67108866,S):R):(T.flags|=67108866,S)):(T.flags|=1048576,S)}function l(T){return t&&T.alternate===null&&(T.flags|=67108866),T}function u(T,S,R,A){return S===null||S.tag!==6?(S=Ax(R,T.mode,A),S.return=T,S):(S=a(S,R),S.return=T,S)}function f(T,S,R,A){var M=R.type;return M===Bc?d(T,S,R.props.children,A,R.key):S!==null&&(S.elementType===M||typeof M=="object"&&M!==null&&M.$$typeof===vs&&Ql(M)===S.type)?(S=a(S,R.props),Gf(S,R),S.return=T,S):(S=uy(R.type,R.key,R.props,null,T.mode,A),Gf(S,R),S.return=T,S)}function h(T,S,R,A){return S===null||S.tag!==4||S.stateNode.containerInfo!==R.containerInfo||S.stateNode.implementation!==R.implementation?(S=Cx(R,T.mode,A),S.return=T,S):(S=a(S,R.children||[]),S.return=T,S)}function d(T,S,R,A,M){return S===null||S.tag!==7?(S=Wl(R,T.mode,A,M),S.return=T,S):(S=a(S,R),S.return=T,S)}function m(T,S,R){if(typeof S=="string"&&S!==""||typeof S=="number"||typeof S=="bigint")return S=Ax(""+S,T.mode,R),S.return=T,S;if(typeof S=="object"&&S!==null){switch(S.$$typeof){case Ug:return R=uy(S.type,S.key,S.props,null,T.mode,R),Gf(R,S),R.return=T,R;case Zf:return S=Cx(S,T.mode,R),S.return=T,S;case vs:return S=Ql(S),m(T,S,R)}if(Wf(S)||jf(S))return S=Wl(S,T.mode,R,null),S.return=T,S;if(typeof S.then=="function")return m(T,Zg(S),R);if(S.$$typeof===To)return m(T,Kg(T,S),R);Wg(T,S)}return null}function y(T,S,R,A){var M=S!==null?S.key:null;if(typeof R=="string"&&R!==""||typeof R=="number"||typeof R=="bigint")return M!==null?null:u(T,S,""+R,A);if(typeof R=="object"&&R!==null){switch(R.$$typeof){case Ug:return R.key===M?f(T,S,R,A):null;case Zf:return R.key===M?h(T,S,R,A):null;case vs:return R=Ql(R),y(T,S,R,A)}if(Wf(R)||jf(R))return M!==null?null:d(T,S,R,A,null);if(typeof R.then=="function")return y(T,S,Zg(R),A);if(R.$$typeof===To)return y(T,S,Kg(T,R),A);Wg(T,R)}return null}function g(T,S,R,A,M){if(typeof A=="string"&&A!==""||typeof A=="number"||typeof A=="bigint")return T=T.get(R)||null,u(S,T,""+A,M);if(typeof A=="object"&&A!==null){switch(A.$$typeof){case Ug:return T=T.get(A.key===null?R:A.key)||null,f(S,T,A,M);case Zf:return T=T.get(A.key===null?R:A.key)||null,h(S,T,A,M);case vs:return A=Ql(A),g(T,S,R,A,M)}if(Wf(A)||jf(A))return T=T.get(R)||null,d(S,T,A,M,null);if(typeof A.then=="function")return g(T,S,R,Zg(A),M);if(A.$$typeof===To)return g(T,S,R,Kg(S,A),M);Wg(S,A)}return null}function b(T,S,R,A){for(var M=null,z=null,I=S,L=S=0,H=null;I!==null&&L<R.length;L++){I.index>L?(H=I,I=null):H=I.sibling;var V=y(T,I,R[L],A);if(V===null){I===null&&(I=H);break}t&&I&&V.alternate===null&&e(T,I),S=r(V,S,L),z===null?M=V:z.sibling=V,z=V,I=H}if(L===R.length)return n(T,I),Re&&xo(T,L),M;if(I===null){for(;L<R.length;L++)I=m(T,R[L],A),I!==null&&(S=r(I,S,L),z===null?M=I:z.sibling=I,z=I);return Re&&xo(T,L),M}for(I=i(I);L<R.length;L++)H=g(I,T,L,R[L],A),H!==null&&(t&&H.alternate!==null&&I.delete(H.key===null?L:H.key),S=r(H,S,L),z===null?M=H:z.sibling=H,z=H);return t&&I.forEach(function(nt){return e(T,nt)}),Re&&xo(T,L),M}function w(T,S,R,A){if(R==null)throw Error(ot(151));for(var M=null,z=null,I=S,L=S=0,H=null,V=R.next();I!==null&&!V.done;L++,V=R.next()){I.index>L?(H=I,I=null):H=I.sibling;var nt=y(T,I,V.value,A);if(nt===null){I===null&&(I=H);break}t&&I&&nt.alternate===null&&e(T,I),S=r(nt,S,L),z===null?M=nt:z.sibling=nt,z=nt,I=H}if(V.done)return n(T,I),Re&&xo(T,L),M;if(I===null){for(;!V.done;L++,V=R.next())V=m(T,V.value,A),V!==null&&(S=r(V,S,L),z===null?M=V:z.sibling=V,z=V);return Re&&xo(T,L),M}for(I=i(I);!V.done;L++,V=R.next())V=g(I,T,L,V.value,A),V!==null&&(t&&V.alternate!==null&&I.delete(V.key===null?L:V.key),S=r(V,S,L),z===null?M=V:z.sibling=V,z=V);return t&&I.forEach(function(X){return e(T,X)}),Re&&xo(T,L),M}function E(T,S,R,A){if(typeof R=="object"&&R!==null&&R.type===Bc&&R.key===null&&(R=R.props.children),typeof R=="object"&&R!==null){switch(R.$$typeof){case Ug:t:{for(var M=R.key;S!==null;){if(S.key===M){if(M=R.type,M===Bc){if(S.tag===7){n(T,S.sibling),A=a(S,R.props.children),A.return=T,T=A;break t}}else if(S.elementType===M||typeof M=="object"&&M!==null&&M.$$typeof===vs&&Ql(M)===S.type){n(T,S.sibling),A=a(S,R.props),Gf(A,R),A.return=T,T=A;break t}n(T,S);break}else e(T,S);S=S.sibling}R.type===Bc?(A=Wl(R.props.children,T.mode,A,R.key),A.return=T,T=A):(A=uy(R.type,R.key,R.props,null,T.mode,A),Gf(A,R),A.return=T,T=A)}return l(T);case Zf:t:{for(M=R.key;S!==null;){if(S.key===M)if(S.tag===4&&S.stateNode.containerInfo===R.containerInfo&&S.stateNode.implementation===R.implementation){n(T,S.sibling),A=a(S,R.children||[]),A.return=T,T=A;break t}else{n(T,S);break}else e(T,S);S=S.sibling}A=Cx(R,T.mode,A),A.return=T,T=A}return l(T);case vs:return R=Ql(R),E(T,S,R,A)}if(Wf(R))return b(T,S,R,A);if(jf(R)){if(M=jf(R),typeof M!="function")throw Error(ot(150));return R=M.call(R),w(T,S,R,A)}if(typeof R.then=="function")return E(T,S,Zg(R),A);if(R.$$typeof===To)return E(T,S,Kg(T,R),A);Wg(T,R)}return typeof R=="string"&&R!==""||typeof R=="number"||typeof R=="bigint"?(R=""+R,S!==null&&S.tag===6?(n(T,S.sibling),A=a(S,R),A.return=T,T=A):(n(T,S),A=Ax(R,T.mode,A),A.return=T,T=A),l(T)):n(T,S)}return function(T,S,R,A){try{Sh=0;var M=E(T,S,R,A);return $c=null,M}catch(I){if(I===gd||I===ev)throw I;var z=xa(29,I,null,T.mode);return z.lanes=A,z.return=T,z}finally{}}}var iu=QI(!0),KI=QI(!1),bs=!1;function uT(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function gw(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function zs(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function Is(t,e,n){var i=t.updateQueue;if(i===null)return null;if(i=i.shared,Ie&2){var a=i.pending;return a===null?e.next=e:(e.next=a.next,a.next=e),i.pending=e,e=Ay(t),qI(t,null,n),e}return tv(t,i,e,n),Ay(t)}function rh(t,e,n){if(e=e.updateQueue,e!==null&&(e=e.shared,(n&4194048)!==0)){var i=e.lanes;i&=t.pendingLanes,n|=i,e.lanes=n,hI(t,n)}}function Ox(t,e){var n=t.updateQueue,i=t.alternate;if(i!==null&&(i=i.updateQueue,n===i)){var a=null,r=null;if(n=n.firstBaseUpdate,n!==null){do{var l={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};r===null?a=r=l:r=r.next=l,n=n.next}while(n!==null);r===null?a=r=e:r=r.next=e}else a=r=e;n={baseState:i.baseState,firstBaseUpdate:a,lastBaseUpdate:r,shared:i.shared,callbacks:i.callbacks},t.updateQueue=n;return}t=n.lastBaseUpdate,t===null?n.firstBaseUpdate=e:t.next=e,n.lastBaseUpdate=e}var yw=!1;function oh(){if(yw){var t=Jc;if(t!==null)throw t}}function sh(t,e,n,i){yw=!1;var a=t.updateQueue;bs=!1;var r=a.firstBaseUpdate,l=a.lastBaseUpdate,u=a.shared.pending;if(u!==null){a.shared.pending=null;var f=u,h=f.next;f.next=null,l===null?r=h:l.next=h,l=f;var d=t.alternate;d!==null&&(d=d.updateQueue,u=d.lastBaseUpdate,u!==l&&(u===null?d.firstBaseUpdate=h:u.next=h,d.lastBaseUpdate=f))}if(r!==null){var m=a.baseState;l=0,d=h=f=null,u=r;do{var y=u.lane&-536870913,g=y!==u.lane;if(g?(we&y)===y:(i&y)===y){y!==0&&y===rd&&(yw=!0),d!==null&&(d=d.next={lane:0,tag:u.tag,payload:u.payload,callback:null,next:null});t:{var b=t,w=u;y=e;var E=n;switch(w.tag){case 1:if(b=w.payload,typeof b=="function"){m=b.call(E,m,y);break t}m=b;break t;case 3:b.flags=b.flags&-65537|128;case 0:if(b=w.payload,y=typeof b=="function"?b.call(E,m,y):b,y==null)break t;m=Je({},m,y);break t;case 2:bs=!0}}y=u.callback,y!==null&&(t.flags|=64,g&&(t.flags|=8192),g=a.callbacks,g===null?a.callbacks=[y]:g.push(y))}else g={lane:y,tag:u.tag,payload:u.payload,callback:u.callback,next:null},d===null?(h=d=g,f=m):d=d.next=g,l|=y;if(u=u.next,u===null){if(u=a.shared.pending,u===null)break;g=u,u=g.next,g.next=null,a.lastBaseUpdate=g,a.shared.pending=null}}while(!0);d===null&&(f=m),a.baseState=f,a.firstBaseUpdate=h,a.lastBaseUpdate=d,r===null&&(a.shared.lanes=0),Us|=l,t.lanes=l,t.memoizedState=m}}function ZI(t,e){if(typeof t!="function")throw Error(ot(191,t));t.call(e)}function WI(t,e){var n=t.callbacks;if(n!==null)for(t.callbacks=null,t=0;t<n.length;t++)ZI(n[t],e)}var od=Fr(null),_y=Fr(0);function oz(t,e){t=No,Qe(_y,t),Qe(od,e),No=t|e.baseLanes}function vw(){Qe(_y,No),Qe(od,od.current)}function cT(){No=_y.current,ei(od),ei(_y)}var Ma=Fr(null),Za=null;function xs(t){var e=t.alternate;Qe(Rn,Rn.current&1),Qe(Ma,t),Za===null&&(e===null||od.current!==null||e.memoizedState!==null)&&(Za=t)}function bw(t){Qe(Rn,Rn.current),Qe(Ma,t),Za===null&&(Za=t)}function JI(t){t.tag===22?(Qe(Rn,Rn.current),Qe(Ma,t),Za===null&&(Za=t)):ws(t)}function ws(){Qe(Rn,Rn.current),Qe(Ma,Ma.current)}function Sa(t){ei(Ma),Za===t&&(Za=null),ei(Rn)}var Rn=Fr(0);function zy(t){for(var e=t;e!==null;){if(e.tag===13){var n=e.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||Hw(n)||Fw(n)))return e}else if(e.tag===19&&(e.memoizedProps.revealOrder==="forwards"||e.memoizedProps.revealOrder==="backwards"||e.memoizedProps.revealOrder==="unstable_legacy-backwards"||e.memoizedProps.revealOrder==="together")){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var _o=0,le=null,qe=null,Nn=null,Iy=!1,td=!1,au=!1,Ny=0,xh=0,ed=null,tV=0;function yn(){throw Error(ot(321))}function dT(t,e){if(e===null)return!1;for(var n=0;n<e.length&&n<t.length;n++)if(!Ca(t[n],e[n]))return!1;return!0}function fT(t,e,n,i,a,r){return _o=r,le=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,Qt.H=t===null||t.memoizedState===null?ON:TT,au=!1,r=n(i,a),au=!1,td&&(r=tN(e,n,i,a)),$I(t),r}function $I(t){Qt.H=wh;var e=qe!==null&&qe.next!==null;if(_o=0,Nn=qe=le=null,Iy=!1,xh=0,ed=null,e)throw Error(ot(300));t===null||Pn||(t=t.dependencies,t!==null&&My(t)&&(Pn=!0))}function tN(t,e,n,i){le=t;var a=0;do{if(td&&(ed=null),xh=0,td=!1,25<=a)throw Error(ot(301));if(a+=1,Nn=qe=null,t.updateQueue!=null){var r=t.updateQueue;r.lastEffect=null,r.events=null,r.stores=null,r.memoCache!=null&&(r.memoCache.index=0)}Qt.H=_N,r=e(n,i)}while(td);return r}function eV(){var t=Qt.H,e=t.useState()[0];return e=typeof e.then=="function"?Dh(e):e,t=t.useState()[0],(qe!==null?qe.memoizedState:null)!==t&&(le.flags|=1024),e}function hT(){var t=Ny!==0;return Ny=0,t}function pT(t,e,n){e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~n}function mT(t){if(Iy){for(t=t.memoizedState;t!==null;){var e=t.queue;e!==null&&(e.pending=null),t=t.next}Iy=!1}_o=0,Nn=qe=le=null,td=!1,xh=Ny=0,ed=null}function Pi(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Nn===null?le.memoizedState=Nn=t:Nn=Nn.next=t,Nn}function En(){if(qe===null){var t=le.alternate;t=t!==null?t.memoizedState:null}else t=qe.next;var e=Nn===null?le.memoizedState:Nn.next;if(e!==null)Nn=e,qe=t;else{if(t===null)throw le.alternate===null?Error(ot(467)):Error(ot(310));qe=t,t={memoizedState:qe.memoizedState,baseState:qe.baseState,baseQueue:qe.baseQueue,queue:qe.queue,next:null},Nn===null?le.memoizedState=Nn=t:Nn=Nn.next=t}return Nn}function nv(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Dh(t){var e=xh;return xh+=1,ed===null&&(ed=[]),t=XI(ed,t,e),e=le,(Nn===null?e.memoizedState:Nn.next)===null&&(e=e.alternate,Qt.H=e===null||e.memoizedState===null?ON:TT),t}function iv(t){if(t!==null&&typeof t=="object"){if(typeof t.then=="function")return Dh(t);if(t.$$typeof===To)return pi(t)}throw Error(ot(438,String(t)))}function gT(t){var e=null,n=le.updateQueue;if(n!==null&&(e=n.memoCache),e==null){var i=le.alternate;i!==null&&(i=i.updateQueue,i!==null&&(i=i.memoCache,i!=null&&(e={data:i.data.map(function(a){return a.slice()}),index:0})))}if(e==null&&(e={data:[],index:0}),n===null&&(n=nv(),le.updateQueue=n),n.memoCache=e,n=e.data[e.index],n===void 0)for(n=e.data[e.index]=Array(t),i=0;i<t;i++)n[i]=qq;return e.index++,n}function zo(t,e){return typeof e=="function"?e(t):e}function dy(t){var e=En();return yT(e,qe,t)}function yT(t,e,n){var i=t.queue;if(i===null)throw Error(ot(311));i.lastRenderedReducer=n;var a=t.baseQueue,r=i.pending;if(r!==null){if(a!==null){var l=a.next;a.next=r.next,r.next=l}e.baseQueue=a=r,i.pending=null}if(r=t.baseState,a===null)t.memoizedState=r;else{e=a.next;var u=l=null,f=null,h=e,d=!1;do{var m=h.lane&-536870913;if(m!==h.lane?(we&m)===m:(_o&m)===m){var y=h.revertLane;if(y===0)f!==null&&(f=f.next={lane:0,revertLane:0,gesture:null,action:h.action,hasEagerState:h.hasEagerState,eagerState:h.eagerState,next:null}),m===rd&&(d=!0);else if((_o&y)===y){h=h.next,y===rd&&(d=!0);continue}else m={lane:0,revertLane:h.revertLane,gesture:null,action:h.action,hasEagerState:h.hasEagerState,eagerState:h.eagerState,next:null},f===null?(u=f=m,l=r):f=f.next=m,le.lanes|=y,Us|=y;m=h.action,au&&n(r,m),r=h.hasEagerState?h.eagerState:n(r,m)}else y={lane:m,revertLane:h.revertLane,gesture:h.gesture,action:h.action,hasEagerState:h.hasEagerState,eagerState:h.eagerState,next:null},f===null?(u=f=y,l=r):f=f.next=y,le.lanes|=m,Us|=m;h=h.next}while(h!==null&&h!==e);if(f===null?l=r:f.next=u,!Ca(r,t.memoizedState)&&(Pn=!0,d&&(n=Jc,n!==null)))throw n;t.memoizedState=r,t.baseState=l,t.baseQueue=f,i.lastRenderedState=r}return a===null&&(i.lanes=0),[t.memoizedState,i.dispatch]}function _x(t){var e=En(),n=e.queue;if(n===null)throw Error(ot(311));n.lastRenderedReducer=t;var i=n.dispatch,a=n.pending,r=e.memoizedState;if(a!==null){n.pending=null;var l=a=a.next;do r=t(r,l.action),l=l.next;while(l!==a);Ca(r,e.memoizedState)||(Pn=!0),e.memoizedState=r,e.baseQueue===null&&(e.baseState=r),n.lastRenderedState=r}return[r,i]}function eN(t,e,n){var i=le,a=En(),r=Re;if(r){if(n===void 0)throw Error(ot(407));n=n()}else n=e();var l=!Ca((qe||a).memoizedState,n);if(l&&(a.memoizedState=n,Pn=!0),a=a.queue,vT(aN.bind(null,i,a,t),[t]),a.getSnapshot!==e||l||Nn!==null&&Nn.memoizedState.tag&1){if(i.flags|=2048,sd(9,{destroy:void 0},iN.bind(null,i,a,n,e),null),Ge===null)throw Error(ot(349));r||_o&127||nN(i,e,n)}return n}function nN(t,e,n){t.flags|=16384,t={getSnapshot:e,value:n},e=le.updateQueue,e===null?(e=nv(),le.updateQueue=e,e.stores=[t]):(n=e.stores,n===null?e.stores=[t]:n.push(t))}function iN(t,e,n,i){e.value=n,e.getSnapshot=i,rN(e)&&oN(t)}function aN(t,e,n){return n(function(){rN(e)&&oN(t)})}function rN(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!Ca(t,n)}catch{return!0}}function oN(t){var e=uu(t,2);e!==null&&Ji(e,t,2)}function Sw(t){var e=Pi();if(typeof t=="function"){var n=t;if(t=n(),au){Rs(!0);try{n()}finally{Rs(!1)}}}return e.memoizedState=e.baseState=t,e.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:zo,lastRenderedState:t},e}function sN(t,e,n,i){return t.baseState=n,yT(t,qe,typeof i=="function"?i:zo)}function nV(t,e,n,i,a){if(rv(t))throw Error(ot(485));if(t=e.action,t!==null){var r={payload:a,action:t,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(l){r.listeners.push(l)}};Qt.T!==null?n(!0):r.isTransition=!1,i(r),n=e.pending,n===null?(r.next=e.pending=r,lN(e,r)):(r.next=n.next,e.pending=n.next=r)}}function lN(t,e){var n=e.action,i=e.payload,a=t.state;if(e.isTransition){var r=Qt.T,l={};Qt.T=l;try{var u=n(a,i),f=Qt.S;f!==null&&f(l,u),sz(t,e,u)}catch(h){xw(t,e,h)}finally{r!==null&&l.types!==null&&(r.types=l.types),Qt.T=r}}else try{r=n(a,i),sz(t,e,r)}catch(h){xw(t,e,h)}}function sz(t,e,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(i){lz(t,e,i)},function(i){return xw(t,e,i)}):lz(t,e,n)}function lz(t,e,n){e.status="fulfilled",e.value=n,uN(e),t.state=n,e=t.pending,e!==null&&(n=e.next,n===e?t.pending=null:(n=n.next,e.next=n,lN(t,n)))}function xw(t,e,n){var i=t.pending;if(t.pending=null,i!==null){i=i.next;do e.status="rejected",e.reason=n,uN(e),e=e.next;while(e!==i)}t.action=null}function uN(t){t=t.listeners;for(var e=0;e<t.length;e++)(0,t[e])()}function cN(t,e){return e}function uz(t,e){if(Re){var n=Ge.formState;if(n!==null){t:{var i=le;if(Re){if(We){e:{for(var a=We,r=Ka;a.nodeType!==8;){if(!r){a=null;break e}if(a=Wa(a.nextSibling),a===null){a=null;break e}}r=a.data,a=r==="F!"||r==="F"?a:null}if(a){We=Wa(a.nextSibling),i=a.data==="F!";break t}}Fs(i)}i=!1}i&&(e=n[0])}}return n=Pi(),n.memoizedState=n.baseState=e,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:cN,lastRenderedState:e},n.queue=i,n=AN.bind(null,le,i),i.dispatch=n,i=Sw(!1),r=wT.bind(null,le,!1,i.queue),i=Pi(),a={state:e,dispatch:null,action:t,pending:null},i.queue=a,n=nV.bind(null,le,a,r,n),a.dispatch=n,i.memoizedState=t,[e,n,!1]}function cz(t){var e=En();return dN(e,qe,t)}function dN(t,e,n){if(e=yT(t,e,cN)[0],t=dy(zo)[0],typeof e=="object"&&e!==null&&typeof e.then=="function")try{var i=Dh(e)}catch(l){throw l===gd?ev:l}else i=e;e=En();var a=e.queue,r=a.dispatch;return n!==e.memoizedState&&(le.flags|=2048,sd(9,{destroy:void 0},iV.bind(null,a,n),null)),[i,r,t]}function iV(t,e){t.action=e}function dz(t){var e=En(),n=qe;if(n!==null)return dN(e,n,t);En(),e=e.memoizedState,n=En();var i=n.queue.dispatch;return n.memoizedState=t,[e,i,!1]}function sd(t,e,n,i){return t={tag:t,create:n,deps:i,inst:e,next:null},e=le.updateQueue,e===null&&(e=nv(),le.updateQueue=e),n=e.lastEffect,n===null?e.lastEffect=t.next=t:(i=n.next,n.next=t,t.next=i,e.lastEffect=t),t}function fN(){return En().memoizedState}function fy(t,e,n,i){var a=Pi();le.flags|=t,a.memoizedState=sd(1|e,{destroy:void 0},n,i===void 0?null:i)}function av(t,e,n,i){var a=En();i=i===void 0?null:i;var r=a.memoizedState.inst;qe!==null&&i!==null&&dT(i,qe.memoizedState.deps)?a.memoizedState=sd(e,r,n,i):(le.flags|=t,a.memoizedState=sd(1|e,r,n,i))}function fz(t,e){fy(8390656,8,t,e)}function vT(t,e){av(2048,8,t,e)}function aV(t){le.flags|=4;var e=le.updateQueue;if(e===null)e=nv(),le.updateQueue=e,e.events=[t];else{var n=e.events;n===null?e.events=[t]:n.push(t)}}function hN(t){var e=En().memoizedState;return aV({ref:e,nextImpl:t}),function(){if(Ie&2)throw Error(ot(440));return e.impl.apply(void 0,arguments)}}function pN(t,e){return av(4,2,t,e)}function mN(t,e){return av(4,4,t,e)}function gN(t,e){if(typeof e=="function"){t=t();var n=e(t);return function(){typeof n=="function"?n():e(null)}}if(e!=null)return t=t(),e.current=t,function(){e.current=null}}function yN(t,e,n){n=n!=null?n.concat([t]):null,av(4,4,gN.bind(null,e,t),n)}function bT(){}function vN(t,e){var n=En();e=e===void 0?null:e;var i=n.memoizedState;return e!==null&&dT(e,i[1])?i[0]:(n.memoizedState=[t,e],t)}function bN(t,e){var n=En();e=e===void 0?null:e;var i=n.memoizedState;if(e!==null&&dT(e,i[1]))return i[0];if(i=t(),au){Rs(!0);try{t()}finally{Rs(!1)}}return n.memoizedState=[i,e],i}function ST(t,e,n){return n===void 0||_o&1073741824&&!(we&261930)?t.memoizedState=e:(t.memoizedState=n,t=sL(),le.lanes|=t,Us|=t,n)}function SN(t,e,n,i){return Ca(n,e)?n:od.current!==null?(t=ST(t,n,i),Ca(t,e)||(Pn=!0),t):!(_o&42)||_o&1073741824&&!(we&261930)?(Pn=!0,t.memoizedState=n):(t=sL(),le.lanes|=t,Us|=t,e)}function xN(t,e,n,i,a){var r=Ne.p;Ne.p=r!==0&&8>r?r:8;var l=Qt.T,u={};Qt.T=u,wT(t,!1,e,n);try{var f=a(),h=Qt.S;if(h!==null&&h(u,f),f!==null&&typeof f=="object"&&typeof f.then=="function"){var d=$U(f,i);lh(t,e,d,Aa(t))}else lh(t,e,i,Aa(t))}catch(m){lh(t,e,{then:function(){},status:"rejected",reason:m},Aa())}finally{Ne.p=r,l!==null&&u.types!==null&&(l.types=u.types),Qt.T=l}}function rV(){}function ww(t,e,n,i){if(t.tag!==5)throw Error(ot(476));var a=wN(t).queue;xN(t,a,e,Zl,n===null?rV:function(){return TN(t),n(i)})}function wN(t){var e=t.memoizedState;if(e!==null)return e;e={memoizedState:Zl,baseState:Zl,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:zo,lastRenderedState:Zl},next:null};var n={};return e.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:zo,lastRenderedState:n},next:null},t.memoizedState=e,t=t.alternate,t!==null&&(t.memoizedState=e),e}function TN(t){var e=wN(t);e.next===null&&(e=t.alternate.memoizedState),lh(t,e.next.queue,{},Aa())}function xT(){return pi(Eh)}function RN(){return En().memoizedState}function EN(){return En().memoizedState}function oV(t){for(var e=t.return;e!==null;){switch(e.tag){case 24:case 3:var n=Aa();t=zs(n);var i=Is(e,t,n);i!==null&&(Ji(i,e,n),rh(i,e,n)),e={cache:oT()},t.payload=e;return}e=e.return}}function sV(t,e,n){var i=Aa();n={lane:i,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},rv(t)?CN(e,n):(n=nT(t,e,n,i),n!==null&&(Ji(n,t,i),MN(n,e,i)))}function AN(t,e,n){var i=Aa();lh(t,e,n,i)}function lh(t,e,n,i){var a={lane:i,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(rv(t))CN(e,a);else{var r=t.alternate;if(t.lanes===0&&(r===null||r.lanes===0)&&(r=e.lastRenderedReducer,r!==null))try{var l=e.lastRenderedState,u=r(l,n);if(a.hasEagerState=!0,a.eagerState=u,Ca(u,l))return tv(t,e,a,0),Ge===null&&$y(),!1}catch{}finally{}if(n=nT(t,e,a,i),n!==null)return Ji(n,t,i),MN(n,e,i),!0}return!1}function wT(t,e,n,i){if(i={lane:2,revertLane:zT(),gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},rv(t)){if(e)throw Error(ot(479))}else e=nT(t,n,i,2),e!==null&&Ji(e,t,2)}function rv(t){var e=t.alternate;return t===le||e!==null&&e===le}function CN(t,e){td=Iy=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function MN(t,e,n){if(n&4194048){var i=e.lanes;i&=t.pendingLanes,n|=i,e.lanes=n,hI(t,n)}}var wh={readContext:pi,use:iv,useCallback:yn,useContext:yn,useEffect:yn,useImperativeHandle:yn,useLayoutEffect:yn,useInsertionEffect:yn,useMemo:yn,useReducer:yn,useRef:yn,useState:yn,useDebugValue:yn,useDeferredValue:yn,useTransition:yn,useSyncExternalStore:yn,useId:yn,useHostTransitionStatus:yn,useFormState:yn,useActionState:yn,useOptimistic:yn,useMemoCache:yn,useCacheRefresh:yn};wh.useEffectEvent=yn;var ON={readContext:pi,use:iv,useCallback:function(t,e){return Pi().memoizedState=[t,e===void 0?null:e],t},useContext:pi,useEffect:fz,useImperativeHandle:function(t,e,n){n=n!=null?n.concat([t]):null,fy(4194308,4,gN.bind(null,e,t),n)},useLayoutEffect:function(t,e){return fy(4194308,4,t,e)},useInsertionEffect:function(t,e){fy(4,2,t,e)},useMemo:function(t,e){var n=Pi();e=e===void 0?null:e;var i=t();if(au){Rs(!0);try{t()}finally{Rs(!1)}}return n.memoizedState=[i,e],i},useReducer:function(t,e,n){var i=Pi();if(n!==void 0){var a=n(e);if(au){Rs(!0);try{n(e)}finally{Rs(!1)}}}else a=e;return i.memoizedState=i.baseState=a,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:a},i.queue=t,t=t.dispatch=sV.bind(null,le,t),[i.memoizedState,t]},useRef:function(t){var e=Pi();return t={current:t},e.memoizedState=t},useState:function(t){t=Sw(t);var e=t.queue,n=AN.bind(null,le,e);return e.dispatch=n,[t.memoizedState,n]},useDebugValue:bT,useDeferredValue:function(t,e){var n=Pi();return ST(n,t,e)},useTransition:function(){var t=Sw(!1);return t=xN.bind(null,le,t.queue,!0,!1),Pi().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,e,n){var i=le,a=Pi();if(Re){if(n===void 0)throw Error(ot(407));n=n()}else{if(n=e(),Ge===null)throw Error(ot(349));we&127||nN(i,e,n)}a.memoizedState=n;var r={value:n,getSnapshot:e};return a.queue=r,fz(aN.bind(null,i,r,t),[t]),i.flags|=2048,sd(9,{destroy:void 0},iN.bind(null,i,r,n,e),null),n},useId:function(){var t=Pi(),e=Ge.identifierPrefix;if(Re){var n=Pr,i=Dr;n=(i&~(1<<32-Ea(i)-1)).toString(32)+n,e="_"+e+"R_"+n,n=Ny++,0<n&&(e+="H"+n.toString(32)),e+="_"}else n=tV++,e="_"+e+"r_"+n.toString(32)+"_";return t.memoizedState=e},useHostTransitionStatus:xT,useFormState:uz,useActionState:uz,useOptimistic:function(t){var e=Pi();e.memoizedState=e.baseState=t;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return e.queue=n,e=wT.bind(null,le,!0,n),n.dispatch=e,[t,e]},useMemoCache:gT,useCacheRefresh:function(){return Pi().memoizedState=oV.bind(null,le)},useEffectEvent:function(t){var e=Pi(),n={impl:t};return e.memoizedState=n,function(){if(Ie&2)throw Error(ot(440));return n.impl.apply(void 0,arguments)}}},TT={readContext:pi,use:iv,useCallback:vN,useContext:pi,useEffect:vT,useImperativeHandle:yN,useInsertionEffect:pN,useLayoutEffect:mN,useMemo:bN,useReducer:dy,useRef:fN,useState:function(){return dy(zo)},useDebugValue:bT,useDeferredValue:function(t,e){var n=En();return SN(n,qe.memoizedState,t,e)},useTransition:function(){var t=dy(zo)[0],e=En().memoizedState;return[typeof t=="boolean"?t:Dh(t),e]},useSyncExternalStore:eN,useId:RN,useHostTransitionStatus:xT,useFormState:cz,useActionState:cz,useOptimistic:function(t,e){var n=En();return sN(n,qe,t,e)},useMemoCache:gT,useCacheRefresh:EN};TT.useEffectEvent=hN;var _N={readContext:pi,use:iv,useCallback:vN,useContext:pi,useEffect:vT,useImperativeHandle:yN,useInsertionEffect:pN,useLayoutEffect:mN,useMemo:bN,useReducer:_x,useRef:fN,useState:function(){return _x(zo)},useDebugValue:bT,useDeferredValue:function(t,e){var n=En();return qe===null?ST(n,t,e):SN(n,qe.memoizedState,t,e)},useTransition:function(){var t=_x(zo)[0],e=En().memoizedState;return[typeof t=="boolean"?t:Dh(t),e]},useSyncExternalStore:eN,useId:RN,useHostTransitionStatus:xT,useFormState:dz,useActionState:dz,useOptimistic:function(t,e){var n=En();return qe!==null?sN(n,qe,t,e):(n.baseState=t,[t,n.queue.dispatch])},useMemoCache:gT,useCacheRefresh:EN};_N.useEffectEvent=hN;function zx(t,e,n,i){e=t.memoizedState,n=n(i,e),n=n==null?e:Je({},e,n),t.memoizedState=n,t.lanes===0&&(t.updateQueue.baseState=n)}var Tw={enqueueSetState:function(t,e,n){t=t._reactInternals;var i=Aa(),a=zs(i);a.payload=e,n!=null&&(a.callback=n),e=Is(t,a,i),e!==null&&(Ji(e,t,i),rh(e,t,i))},enqueueReplaceState:function(t,e,n){t=t._reactInternals;var i=Aa(),a=zs(i);a.tag=1,a.payload=e,n!=null&&(a.callback=n),e=Is(t,a,i),e!==null&&(Ji(e,t,i),rh(e,t,i))},enqueueForceUpdate:function(t,e){t=t._reactInternals;var n=Aa(),i=zs(n);i.tag=2,e!=null&&(i.callback=e),e=Is(t,i,n),e!==null&&(Ji(e,t,n),rh(e,t,n))}};function hz(t,e,n,i,a,r,l){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(i,r,l):e.prototype&&e.prototype.isPureReactComponent?!yh(n,i)||!yh(a,r):!0}function pz(t,e,n,i){t=e.state,typeof e.componentWillReceiveProps=="function"&&e.componentWillReceiveProps(n,i),typeof e.UNSAFE_componentWillReceiveProps=="function"&&e.UNSAFE_componentWillReceiveProps(n,i),e.state!==t&&Tw.enqueueReplaceState(e,e.state,null)}function ru(t,e){var n=e;if("ref"in e){n={};for(var i in e)i!=="ref"&&(n[i]=e[i])}if(t=t.defaultProps){n===e&&(n=Je({},n));for(var a in t)n[a]===void 0&&(n[a]=t[a])}return n}function zN(t){Ey(t)}function IN(t){console.error(t)}function NN(t){Ey(t)}function Ly(t,e){try{var n=t.onUncaughtError;n(e.value,{componentStack:e.stack})}catch(i){setTimeout(function(){throw i})}}function mz(t,e,n){try{var i=t.onCaughtError;i(n.value,{componentStack:n.stack,errorBoundary:e.tag===1?e.stateNode:null})}catch(a){setTimeout(function(){throw a})}}function Rw(t,e,n){return n=zs(n),n.tag=3,n.payload={element:null},n.callback=function(){Ly(t,e)},n}function LN(t){return t=zs(t),t.tag=3,t}function DN(t,e,n,i){var a=n.type.getDerivedStateFromError;if(typeof a=="function"){var r=i.value;t.payload=function(){return a(r)},t.callback=function(){mz(e,n,i)}}var l=n.stateNode;l!==null&&typeof l.componentDidCatch=="function"&&(t.callback=function(){mz(e,n,i),typeof a!="function"&&(Ns===null?Ns=new Set([this]):Ns.add(this));var u=i.stack;this.componentDidCatch(i.value,{componentStack:u!==null?u:""})})}function lV(t,e,n,i,a){if(n.flags|=32768,i!==null&&typeof i=="object"&&typeof i.then=="function"){if(e=n.alternate,e!==null&&md(e,n,a,!0),n=Ma.current,n!==null){switch(n.tag){case 31:case 13:return Za===null?Fy():n.alternate===null&&vn===0&&(vn=3),n.flags&=-257,n.flags|=65536,n.lanes=a,i===Oy?n.flags|=16384:(e=n.updateQueue,e===null?n.updateQueue=new Set([i]):e.add(i),Vx(t,i,a)),!1;case 22:return n.flags|=65536,i===Oy?n.flags|=16384:(e=n.updateQueue,e===null?(e={transitions:null,markerInstances:null,retryQueue:new Set([i])},n.updateQueue=e):(n=e.retryQueue,n===null?e.retryQueue=new Set([i]):n.add(i)),Vx(t,i,a)),!1}throw Error(ot(435,n.tag))}return Vx(t,i,a),Fy(),!1}if(Re)return e=Ma.current,e!==null?(!(e.flags&65536)&&(e.flags|=256),e.flags|=65536,e.lanes=a,i!==dw&&(t=Error(ot(422),{cause:i}),bh(Qa(t,n)))):(i!==dw&&(e=Error(ot(423),{cause:i}),bh(Qa(e,n))),t=t.current.alternate,t.flags|=65536,a&=-a,t.lanes|=a,i=Qa(i,n),a=Rw(t.stateNode,i,a),Ox(t,a),vn!==4&&(vn=2)),!1;var r=Error(ot(520),{cause:i});if(r=Qa(r,n),dh===null?dh=[r]:dh.push(r),vn!==4&&(vn=2),e===null)return!0;i=Qa(i,n),n=e;do{switch(n.tag){case 3:return n.flags|=65536,t=a&-a,n.lanes|=t,t=Rw(n.stateNode,i,t),Ox(n,t),!1;case 1:if(e=n.type,r=n.stateNode,(n.flags&128)===0&&(typeof e.getDerivedStateFromError=="function"||r!==null&&typeof r.componentDidCatch=="function"&&(Ns===null||!Ns.has(r))))return n.flags|=65536,a&=-a,n.lanes|=a,a=LN(a),DN(a,t,n,i),Ox(n,a),!1}n=n.return}while(n!==null);return!1}var RT=Error(ot(461)),Pn=!1;function di(t,e,n,i){e.child=t===null?KI(e,null,n,i):iu(e,t.child,n,i)}function gz(t,e,n,i,a){n=n.render;var r=e.ref;if("ref"in i){var l={};for(var u in i)u!=="ref"&&(l[u]=i[u])}else l=i;return nu(e),i=fT(t,e,n,l,r,a),u=hT(),t!==null&&!Pn?(pT(t,e,a),Io(t,e,a)):(Re&&u&&aT(e),e.flags|=1,di(t,e,i,a),e.child)}function yz(t,e,n,i,a){if(t===null){var r=n.type;return typeof r=="function"&&!iT(r)&&r.defaultProps===void 0&&n.compare===null?(e.tag=15,e.type=r,PN(t,e,r,i,a)):(t=uy(n.type,null,i,e,e.mode,a),t.ref=e.ref,t.return=e,e.child=t)}if(r=t.child,!ET(t,a)){var l=r.memoizedProps;if(n=n.compare,n=n!==null?n:yh,n(l,i)&&t.ref===e.ref)return Io(t,e,a)}return e.flags|=1,t=Ao(r,i),t.ref=e.ref,t.return=e,e.child=t}function PN(t,e,n,i,a){if(t!==null){var r=t.memoizedProps;if(yh(r,i)&&t.ref===e.ref)if(Pn=!1,e.pendingProps=i=r,ET(t,a))t.flags&131072&&(Pn=!0);else return e.lanes=t.lanes,Io(t,e,a)}return Ew(t,e,n,i,a)}function BN(t,e,n,i){var a=i.children,r=t!==null?t.memoizedState:null;if(t===null&&e.stateNode===null&&(e.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.mode==="hidden"){if(e.flags&128){if(r=r!==null?r.baseLanes|n:n,t!==null){for(i=e.child=t.child,a=0;i!==null;)a=a|i.lanes|i.childLanes,i=i.sibling;i=a&~r}else i=0,e.child=null;return vz(t,e,r,n,i)}if(n&536870912)e.memoizedState={baseLanes:0,cachePool:null},t!==null&&cy(e,r!==null?r.cachePool:null),r!==null?oz(e,r):vw(),JI(e);else return i=e.lanes=536870912,vz(t,e,r!==null?r.baseLanes|n:n,n,i)}else r!==null?(cy(e,r.cachePool),oz(e,r),ws(e),e.memoizedState=null):(t!==null&&cy(e,null),vw(),ws(e));return di(t,e,a,n),e.child}function $f(t,e){return t!==null&&t.tag===22||e.stateNode!==null||(e.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),e.sibling}function vz(t,e,n,i,a){var r=sT();return r=r===null?null:{parent:Dn._currentValue,pool:r},e.memoizedState={baseLanes:n,cachePool:r},t!==null&&cy(e,null),vw(),JI(e),t!==null&&md(t,e,i,!0),e.childLanes=a,null}function hy(t,e){return e=Dy({mode:e.mode,children:e.children},t.mode),e.ref=t.ref,t.child=e,e.return=t,e}function bz(t,e,n){return iu(e,t.child,null,n),t=hy(e,e.pendingProps),t.flags|=2,Sa(e),e.memoizedState=null,t}function uV(t,e,n){var i=e.pendingProps,a=(e.flags&128)!==0;if(e.flags&=-129,t===null){if(Re){if(i.mode==="hidden")return t=hy(e,i),e.lanes=536870912,$f(null,t);if(bw(e),(t=We)?(t=OL(t,Ka),t=t!==null&&t.data==="&"?t:null,t!==null&&(e.memoizedState={dehydrated:t,treeContext:Hs!==null?{id:Dr,overflow:Pr}:null,retryLane:536870912,hydrationErrors:null},n=VI(t),n.return=e,e.child=n,hi=e,We=null)):t=null,t===null)throw Fs(e);return e.lanes=536870912,null}return hy(e,i)}var r=t.memoizedState;if(r!==null){var l=r.dehydrated;if(bw(e),a)if(e.flags&256)e.flags&=-257,e=bz(t,e,n);else if(e.memoizedState!==null)e.child=t.child,e.flags|=128,e=null;else throw Error(ot(558));else if(Pn||md(t,e,n,!1),a=(n&t.childLanes)!==0,Pn||a){if(i=Ge,i!==null&&(l=pI(i,n),l!==0&&l!==r.retryLane))throw r.retryLane=l,uu(t,l),Ji(i,t,l),RT;Fy(),e=bz(t,e,n)}else t=r.treeContext,We=Wa(l.nextSibling),hi=e,Re=!0,_s=null,Ka=!1,t!==null&&kI(e,t),e=hy(e,i),e.flags|=4096;return e}return t=Ao(t.child,{mode:i.mode,children:i.children}),t.ref=e.ref,e.child=t,t.return=e,t}function py(t,e){var n=e.ref;if(n===null)t!==null&&t.ref!==null&&(e.flags|=4194816);else{if(typeof n!="function"&&typeof n!="object")throw Error(ot(284));(t===null||t.ref!==n)&&(e.flags|=4194816)}}function Ew(t,e,n,i,a){return nu(e),n=fT(t,e,n,i,void 0,a),i=hT(),t!==null&&!Pn?(pT(t,e,a),Io(t,e,a)):(Re&&i&&aT(e),e.flags|=1,di(t,e,n,a),e.child)}function Sz(t,e,n,i,a,r){return nu(e),e.updateQueue=null,n=tN(e,i,n,a),$I(t),i=hT(),t!==null&&!Pn?(pT(t,e,r),Io(t,e,r)):(Re&&i&&aT(e),e.flags|=1,di(t,e,n,r),e.child)}function xz(t,e,n,i,a){if(nu(e),e.stateNode===null){var r=Gc,l=n.contextType;typeof l=="object"&&l!==null&&(r=pi(l)),r=new n(i,r),e.memoizedState=r.state!==null&&r.state!==void 0?r.state:null,r.updater=Tw,e.stateNode=r,r._reactInternals=e,r=e.stateNode,r.props=i,r.state=e.memoizedState,r.refs={},uT(e),l=n.contextType,r.context=typeof l=="object"&&l!==null?pi(l):Gc,r.state=e.memoizedState,l=n.getDerivedStateFromProps,typeof l=="function"&&(zx(e,n,l,i),r.state=e.memoizedState),typeof n.getDerivedStateFromProps=="function"||typeof r.getSnapshotBeforeUpdate=="function"||typeof r.UNSAFE_componentWillMount!="function"&&typeof r.componentWillMount!="function"||(l=r.state,typeof r.componentWillMount=="function"&&r.componentWillMount(),typeof r.UNSAFE_componentWillMount=="function"&&r.UNSAFE_componentWillMount(),l!==r.state&&Tw.enqueueReplaceState(r,r.state,null),sh(e,i,r,a),oh(),r.state=e.memoizedState),typeof r.componentDidMount=="function"&&(e.flags|=4194308),i=!0}else if(t===null){r=e.stateNode;var u=e.memoizedProps,f=ru(n,u);r.props=f;var h=r.context,d=n.contextType;l=Gc,typeof d=="object"&&d!==null&&(l=pi(d));var m=n.getDerivedStateFromProps;d=typeof m=="function"||typeof r.getSnapshotBeforeUpdate=="function",u=e.pendingProps!==u,d||typeof r.UNSAFE_componentWillReceiveProps!="function"&&typeof r.componentWillReceiveProps!="function"||(u||h!==l)&&pz(e,r,i,l),bs=!1;var y=e.memoizedState;r.state=y,sh(e,i,r,a),oh(),h=e.memoizedState,u||y!==h||bs?(typeof m=="function"&&(zx(e,n,m,i),h=e.memoizedState),(f=bs||hz(e,n,f,i,y,h,l))?(d||typeof r.UNSAFE_componentWillMount!="function"&&typeof r.componentWillMount!="function"||(typeof r.componentWillMount=="function"&&r.componentWillMount(),typeof r.UNSAFE_componentWillMount=="function"&&r.UNSAFE_componentWillMount()),typeof r.componentDidMount=="function"&&(e.flags|=4194308)):(typeof r.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=i,e.memoizedState=h),r.props=i,r.state=h,r.context=l,i=f):(typeof r.componentDidMount=="function"&&(e.flags|=4194308),i=!1)}else{r=e.stateNode,gw(t,e),l=e.memoizedProps,d=ru(n,l),r.props=d,m=e.pendingProps,y=r.context,h=n.contextType,f=Gc,typeof h=="object"&&h!==null&&(f=pi(h)),u=n.getDerivedStateFromProps,(h=typeof u=="function"||typeof r.getSnapshotBeforeUpdate=="function")||typeof r.UNSAFE_componentWillReceiveProps!="function"&&typeof r.componentWillReceiveProps!="function"||(l!==m||y!==f)&&pz(e,r,i,f),bs=!1,y=e.memoizedState,r.state=y,sh(e,i,r,a),oh();var g=e.memoizedState;l!==m||y!==g||bs||t!==null&&t.dependencies!==null&&My(t.dependencies)?(typeof u=="function"&&(zx(e,n,u,i),g=e.memoizedState),(d=bs||hz(e,n,d,i,y,g,f)||t!==null&&t.dependencies!==null&&My(t.dependencies))?(h||typeof r.UNSAFE_componentWillUpdate!="function"&&typeof r.componentWillUpdate!="function"||(typeof r.componentWillUpdate=="function"&&r.componentWillUpdate(i,g,f),typeof r.UNSAFE_componentWillUpdate=="function"&&r.UNSAFE_componentWillUpdate(i,g,f)),typeof r.componentDidUpdate=="function"&&(e.flags|=4),typeof r.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof r.componentDidUpdate!="function"||l===t.memoizedProps&&y===t.memoizedState||(e.flags|=4),typeof r.getSnapshotBeforeUpdate!="function"||l===t.memoizedProps&&y===t.memoizedState||(e.flags|=1024),e.memoizedProps=i,e.memoizedState=g),r.props=i,r.state=g,r.context=f,i=d):(typeof r.componentDidUpdate!="function"||l===t.memoizedProps&&y===t.memoizedState||(e.flags|=4),typeof r.getSnapshotBeforeUpdate!="function"||l===t.memoizedProps&&y===t.memoizedState||(e.flags|=1024),i=!1)}return r=i,py(t,e),i=(e.flags&128)!==0,r||i?(r=e.stateNode,n=i&&typeof n.getDerivedStateFromError!="function"?null:r.render(),e.flags|=1,t!==null&&i?(e.child=iu(e,t.child,null,a),e.child=iu(e,null,n,a)):di(t,e,n,a),e.memoizedState=r.state,t=e.child):t=Io(t,e,a),t}function wz(t,e,n,i){return eu(),e.flags|=256,di(t,e,n,i),e.child}var Ix={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Nx(t){return{baseLanes:t,cachePool:YI()}}function Lx(t,e,n){return t=t!==null?t.childLanes&~n:0,e&&(t|=wa),t}function HN(t,e,n){var i=e.pendingProps,a=!1,r=(e.flags&128)!==0,l;if((l=r)||(l=t!==null&&t.memoizedState===null?!1:(Rn.current&2)!==0),l&&(a=!0,e.flags&=-129),l=(e.flags&32)!==0,e.flags&=-33,t===null){if(Re){if(a?xs(e):ws(e),(t=We)?(t=OL(t,Ka),t=t!==null&&t.data!=="&"?t:null,t!==null&&(e.memoizedState={dehydrated:t,treeContext:Hs!==null?{id:Dr,overflow:Pr}:null,retryLane:536870912,hydrationErrors:null},n=VI(t),n.return=e,e.child=n,hi=e,We=null)):t=null,t===null)throw Fs(e);return Fw(t)?e.lanes=32:e.lanes=536870912,null}var u=i.children;return i=i.fallback,a?(ws(e),a=e.mode,u=Dy({mode:"hidden",children:u},a),i=Wl(i,a,n,null),u.return=e,i.return=e,u.sibling=i,e.child=u,i=e.child,i.memoizedState=Nx(n),i.childLanes=Lx(t,l,n),e.memoizedState=Ix,$f(null,i)):(xs(e),Aw(e,u))}var f=t.memoizedState;if(f!==null&&(u=f.dehydrated,u!==null)){if(r)e.flags&256?(xs(e),e.flags&=-257,e=Dx(t,e,n)):e.memoizedState!==null?(ws(e),e.child=t.child,e.flags|=128,e=null):(ws(e),u=i.fallback,a=e.mode,i=Dy({mode:"visible",children:i.children},a),u=Wl(u,a,n,null),u.flags|=2,i.return=e,u.return=e,i.sibling=u,e.child=i,iu(e,t.child,null,n),i=e.child,i.memoizedState=Nx(n),i.childLanes=Lx(t,l,n),e.memoizedState=Ix,e=$f(null,i));else if(xs(e),Fw(u)){if(l=u.nextSibling&&u.nextSibling.dataset,l)var h=l.dgst;l=h,i=Error(ot(419)),i.stack="",i.digest=l,bh({value:i,source:null,stack:null}),e=Dx(t,e,n)}else if(Pn||md(t,e,n,!1),l=(n&t.childLanes)!==0,Pn||l){if(l=Ge,l!==null&&(i=pI(l,n),i!==0&&i!==f.retryLane))throw f.retryLane=i,uu(t,i),Ji(l,t,i),RT;Hw(u)||Fy(),e=Dx(t,e,n)}else Hw(u)?(e.flags|=192,e.child=t.child,e=null):(t=f.treeContext,We=Wa(u.nextSibling),hi=e,Re=!0,_s=null,Ka=!1,t!==null&&kI(e,t),e=Aw(e,i.children),e.flags|=4096);return e}return a?(ws(e),u=i.fallback,a=e.mode,f=t.child,h=f.sibling,i=Ao(f,{mode:"hidden",children:i.children}),i.subtreeFlags=f.subtreeFlags&65011712,h!==null?u=Ao(h,u):(u=Wl(u,a,n,null),u.flags|=2),u.return=e,i.return=e,i.sibling=u,e.child=i,$f(null,i),i=e.child,u=t.child.memoizedState,u===null?u=Nx(n):(a=u.cachePool,a!==null?(f=Dn._currentValue,a=a.parent!==f?{parent:f,pool:f}:a):a=YI(),u={baseLanes:u.baseLanes|n,cachePool:a}),i.memoizedState=u,i.childLanes=Lx(t,l,n),e.memoizedState=Ix,$f(t.child,i)):(xs(e),n=t.child,t=n.sibling,n=Ao(n,{mode:"visible",children:i.children}),n.return=e,n.sibling=null,t!==null&&(l=e.deletions,l===null?(e.deletions=[t],e.flags|=16):l.push(t)),e.child=n,e.memoizedState=null,n)}function Aw(t,e){return e=Dy({mode:"visible",children:e},t.mode),e.return=t,t.child=e}function Dy(t,e){return t=xa(22,t,null,e),t.lanes=0,t}function Dx(t,e,n){return iu(e,t.child,null,n),t=Aw(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function Tz(t,e,n){t.lanes|=e;var i=t.alternate;i!==null&&(i.lanes|=e),hw(t.return,e,n)}function Px(t,e,n,i,a,r){var l=t.memoizedState;l===null?t.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:i,tail:n,tailMode:a,treeForkCount:r}:(l.isBackwards=e,l.rendering=null,l.renderingStartTime=0,l.last=i,l.tail=n,l.tailMode=a,l.treeForkCount=r)}function FN(t,e,n){var i=e.pendingProps,a=i.revealOrder,r=i.tail;i=i.children;var l=Rn.current,u=(l&2)!==0;if(u?(l=l&1|2,e.flags|=128):l&=1,Qe(Rn,l),di(t,e,i,n),i=Re?vh:0,!u&&t!==null&&t.flags&128)t:for(t=e.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&Tz(t,n,e);else if(t.tag===19)Tz(t,n,e);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break t;for(;t.sibling===null;){if(t.return===null||t.return===e)break t;t=t.return}t.sibling.return=t.return,t=t.sibling}switch(a){case"forwards":for(n=e.child,a=null;n!==null;)t=n.alternate,t!==null&&zy(t)===null&&(a=n),n=n.sibling;n=a,n===null?(a=e.child,e.child=null):(a=n.sibling,n.sibling=null),Px(e,!1,a,n,r,i);break;case"backwards":case"unstable_legacy-backwards":for(n=null,a=e.child,e.child=null;a!==null;){if(t=a.alternate,t!==null&&zy(t)===null){e.child=a;break}t=a.sibling,a.sibling=n,n=a,a=t}Px(e,!0,n,null,r,i);break;case"together":Px(e,!1,null,null,void 0,i);break;default:e.memoizedState=null}return e.child}function Io(t,e,n){if(t!==null&&(e.dependencies=t.dependencies),Us|=e.lanes,!(n&e.childLanes))if(t!==null){if(md(t,e,n,!1),(n&e.childLanes)===0)return null}else return null;if(t!==null&&e.child!==t.child)throw Error(ot(153));if(e.child!==null){for(t=e.child,n=Ao(t,t.pendingProps),e.child=n,n.return=e;t.sibling!==null;)t=t.sibling,n=n.sibling=Ao(t,t.pendingProps),n.return=e;n.sibling=null}return e.child}function ET(t,e){return t.lanes&e?!0:(t=t.dependencies,!!(t!==null&&My(t)))}function cV(t,e,n){switch(e.tag){case 3:xy(e,e.stateNode.containerInfo),Ss(e,Dn,t.memoizedState.cache),eu();break;case 27:case 5:tw(e);break;case 4:xy(e,e.stateNode.containerInfo);break;case 10:Ss(e,e.type,e.memoizedProps.value);break;case 31:if(e.memoizedState!==null)return e.flags|=128,bw(e),null;break;case 13:var i=e.memoizedState;if(i!==null)return i.dehydrated!==null?(xs(e),e.flags|=128,null):n&e.child.childLanes?HN(t,e,n):(xs(e),t=Io(t,e,n),t!==null?t.sibling:null);xs(e);break;case 19:var a=(t.flags&128)!==0;if(i=(n&e.childLanes)!==0,i||(md(t,e,n,!1),i=(n&e.childLanes)!==0),a){if(i)return FN(t,e,n);e.flags|=128}if(a=e.memoizedState,a!==null&&(a.rendering=null,a.tail=null,a.lastEffect=null),Qe(Rn,Rn.current),i)break;return null;case 22:return e.lanes=0,BN(t,e,n,e.pendingProps);case 24:Ss(e,Dn,t.memoizedState.cache)}return Io(t,e,n)}function qN(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps)Pn=!0;else{if(!ET(t,n)&&!(e.flags&128))return Pn=!1,cV(t,e,n);Pn=!!(t.flags&131072)}else Pn=!1,Re&&e.flags&1048576&&jI(e,vh,e.index);switch(e.lanes=0,e.tag){case 16:t:{var i=e.pendingProps;if(t=Ql(e.elementType),e.type=t,typeof t=="function")iT(t)?(i=ru(t,i),e.tag=1,e=xz(null,e,t,i,n)):(e.tag=0,e=Ew(null,e,t,i,n));else{if(t!=null){var a=t.$$typeof;if(a===jw){e.tag=11,e=gz(null,e,t,i,n);break t}else if(a===kw){e.tag=14,e=yz(null,e,t,i,n);break t}}throw e=Jx(t)||t,Error(ot(306,e,""))}}return e;case 0:return Ew(t,e,e.type,e.pendingProps,n);case 1:return i=e.type,a=ru(i,e.pendingProps),xz(t,e,i,a,n);case 3:t:{if(xy(e,e.stateNode.containerInfo),t===null)throw Error(ot(387));i=e.pendingProps;var r=e.memoizedState;a=r.element,gw(t,e),sh(e,i,null,n);var l=e.memoizedState;if(i=l.cache,Ss(e,Dn,i),i!==r.cache&&pw(e,[Dn],n,!0),oh(),i=l.element,r.isDehydrated)if(r={element:i,isDehydrated:!1,cache:l.cache},e.updateQueue.baseState=r,e.memoizedState=r,e.flags&256){e=wz(t,e,i,n);break t}else if(i!==a){a=Qa(Error(ot(424)),e),bh(a),e=wz(t,e,i,n);break t}else{switch(t=e.stateNode.containerInfo,t.nodeType){case 9:t=t.body;break;default:t=t.nodeName==="HTML"?t.ownerDocument.body:t}for(We=Wa(t.firstChild),hi=e,Re=!0,_s=null,Ka=!0,n=KI(e,null,i,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(eu(),i===a){e=Io(t,e,n);break t}di(t,e,i,n)}e=e.child}return e;case 26:return py(t,e),t===null?(n=Gz(e.type,null,e.pendingProps,null))?e.memoizedState=n:Re||(n=e.type,t=e.pendingProps,i=jy(Os.current).createElement(n),i[fi]=e,i[$i]=t,mi(i,n,t),ti(i),e.stateNode=i):e.memoizedState=Gz(e.type,t.memoizedProps,e.pendingProps,t.memoizedState),null;case 27:return tw(e),t===null&&Re&&(i=e.stateNode=_L(e.type,e.pendingProps,Os.current),hi=e,Ka=!0,a=We,js(e.type)?(qw=a,We=Wa(i.firstChild)):We=a),di(t,e,e.pendingProps.children,n),py(t,e),t===null&&(e.flags|=4194304),e.child;case 5:return t===null&&Re&&((a=i=We)&&(i=HV(i,e.type,e.pendingProps,Ka),i!==null?(e.stateNode=i,hi=e,We=Wa(i.firstChild),Ka=!1,a=!0):a=!1),a||Fs(e)),tw(e),a=e.type,r=e.pendingProps,l=t!==null?t.memoizedProps:null,i=r.children,Pw(a,r)?i=null:l!==null&&Pw(a,l)&&(e.flags|=32),e.memoizedState!==null&&(a=fT(t,e,eV,null,null,n),Eh._currentValue=a),py(t,e),di(t,e,i,n),e.child;case 6:return t===null&&Re&&((t=n=We)&&(n=FV(n,e.pendingProps,Ka),n!==null?(e.stateNode=n,hi=e,We=null,t=!0):t=!1),t||Fs(e)),null;case 13:return HN(t,e,n);case 4:return xy(e,e.stateNode.containerInfo),i=e.pendingProps,t===null?e.child=iu(e,null,i,n):di(t,e,i,n),e.child;case 11:return gz(t,e,e.type,e.pendingProps,n);case 7:return di(t,e,e.pendingProps,n),e.child;case 8:return di(t,e,e.pendingProps.children,n),e.child;case 12:return di(t,e,e.pendingProps.children,n),e.child;case 10:return i=e.pendingProps,Ss(e,e.type,i.value),di(t,e,i.children,n),e.child;case 9:return a=e.type._context,i=e.pendingProps.children,nu(e),a=pi(a),i=i(a),e.flags|=1,di(t,e,i,n),e.child;case 14:return yz(t,e,e.type,e.pendingProps,n);case 15:return PN(t,e,e.type,e.pendingProps,n);case 19:return FN(t,e,n);case 31:return uV(t,e,n);case 22:return BN(t,e,n,e.pendingProps);case 24:return nu(e),i=pi(Dn),t===null?(a=sT(),a===null&&(a=Ge,r=oT(),a.pooledCache=r,r.refCount++,r!==null&&(a.pooledCacheLanes|=n),a=r),e.memoizedState={parent:i,cache:a},uT(e),Ss(e,Dn,a)):(t.lanes&n&&(gw(t,e),sh(e,null,null,n),oh()),a=t.memoizedState,r=e.memoizedState,a.parent!==i?(a={parent:i,cache:i},e.memoizedState=a,e.lanes===0&&(e.memoizedState=e.updateQueue.baseState=a),Ss(e,Dn,i)):(i=r.cache,Ss(e,Dn,i),i!==a.cache&&pw(e,[Dn],n,!0))),di(t,e,e.pendingProps.children,n),e.child;case 29:throw e.pendingProps}throw Error(ot(156,e.tag))}function yo(t){t.flags|=4}function Bx(t,e,n,i,a){if((e=(t.mode&32)!==0)&&(e=!1),e){if(t.flags|=16777216,(a&335544128)===a)if(t.stateNode.complete)t.flags|=8192;else if(cL())t.flags|=8192;else throw $l=Oy,lT}else t.flags&=-16777217}function Rz(t,e){if(e.type!=="stylesheet"||e.state.loading&4)t.flags&=-16777217;else if(t.flags|=16777216,!NL(e))if(cL())t.flags|=8192;else throw $l=Oy,lT}function Jg(t,e){e!==null&&(t.flags|=4),t.flags&16384&&(e=t.tag!==22?dI():536870912,t.lanes|=e,ld|=e)}function Yf(t,e){if(!Re)switch(t.tailMode){case"hidden":e=t.tail;for(var n=null;e!==null;)e.alternate!==null&&(n=e),e=e.sibling;n===null?t.tail=null:n.sibling=null;break;case"collapsed":n=t.tail;for(var i=null;n!==null;)n.alternate!==null&&(i=n),n=n.sibling;i===null?e||t.tail===null?t.tail=null:t.tail.sibling=null:i.sibling=null}}function Ze(t){var e=t.alternate!==null&&t.alternate.child===t.child,n=0,i=0;if(e)for(var a=t.child;a!==null;)n|=a.lanes|a.childLanes,i|=a.subtreeFlags&65011712,i|=a.flags&65011712,a.return=t,a=a.sibling;else for(a=t.child;a!==null;)n|=a.lanes|a.childLanes,i|=a.subtreeFlags,i|=a.flags,a.return=t,a=a.sibling;return t.subtreeFlags|=i,t.childLanes=n,e}function dV(t,e,n){var i=e.pendingProps;switch(rT(e),e.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ze(e),null;case 1:return Ze(e),null;case 3:return n=e.stateNode,i=null,t!==null&&(i=t.memoizedState.cache),e.memoizedState.cache!==i&&(e.flags|=2048),Co(Dn),nd(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(t===null||t.child===null)&&(Nc(e)?yo(e):t===null||t.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,Mx())),Ze(e),null;case 26:var a=e.type,r=e.memoizedState;return t===null?(yo(e),r!==null?(Ze(e),Rz(e,r)):(Ze(e),Bx(e,a,null,i,n))):r?r!==t.memoizedState?(yo(e),Ze(e),Rz(e,r)):(Ze(e),e.flags&=-16777217):(t=t.memoizedProps,t!==i&&yo(e),Ze(e),Bx(e,a,t,i,n)),null;case 27:if(wy(e),n=Os.current,a=e.type,t!==null&&e.stateNode!=null)t.memoizedProps!==i&&yo(e);else{if(!i){if(e.stateNode===null)throw Error(ot(166));return Ze(e),null}t=Hr.current,Nc(e)?$_(e,t):(t=_L(a,i,n),e.stateNode=t,yo(e))}return Ze(e),null;case 5:if(wy(e),a=e.type,t!==null&&e.stateNode!=null)t.memoizedProps!==i&&yo(e);else{if(!i){if(e.stateNode===null)throw Error(ot(166));return Ze(e),null}if(r=Hr.current,Nc(e))$_(e,r);else{var l=jy(Os.current);switch(r){case 1:r=l.createElementNS("http://www.w3.org/2000/svg",a);break;case 2:r=l.createElementNS("http://www.w3.org/1998/Math/MathML",a);break;default:switch(a){case"svg":r=l.createElementNS("http://www.w3.org/2000/svg",a);break;case"math":r=l.createElementNS("http://www.w3.org/1998/Math/MathML",a);break;case"script":r=l.createElement("div"),r.innerHTML="<script><\/script>",r=r.removeChild(r.firstChild);break;case"select":r=typeof i.is=="string"?l.createElement("select",{is:i.is}):l.createElement("select"),i.multiple?r.multiple=!0:i.size&&(r.size=i.size);break;default:r=typeof i.is=="string"?l.createElement(a,{is:i.is}):l.createElement(a)}}r[fi]=e,r[$i]=i;t:for(l=e.child;l!==null;){if(l.tag===5||l.tag===6)r.appendChild(l.stateNode);else if(l.tag!==4&&l.tag!==27&&l.child!==null){l.child.return=l,l=l.child;continue}if(l===e)break t;for(;l.sibling===null;){if(l.return===null||l.return===e)break t;l=l.return}l.sibling.return=l.return,l=l.sibling}e.stateNode=r;t:switch(mi(r,a,i),a){case"button":case"input":case"select":case"textarea":i=!!i.autoFocus;break t;case"img":i=!0;break t;default:i=!1}i&&yo(e)}}return Ze(e),Bx(e,e.type,t===null?null:t.memoizedProps,e.pendingProps,n),null;case 6:if(t&&e.stateNode!=null)t.memoizedProps!==i&&yo(e);else{if(typeof i!="string"&&e.stateNode===null)throw Error(ot(166));if(t=Os.current,Nc(e)){if(t=e.stateNode,n=e.memoizedProps,i=null,a=hi,a!==null)switch(a.tag){case 27:case 5:i=a.memoizedProps}t[fi]=e,t=!!(t.nodeValue===n||i!==null&&i.suppressHydrationWarning===!0||AL(t.nodeValue,n)),t||Fs(e,!0)}else t=jy(t).createTextNode(i),t[fi]=e,e.stateNode=t}return Ze(e),null;case 31:if(n=e.memoizedState,t===null||t.memoizedState!==null){if(i=Nc(e),n!==null){if(t===null){if(!i)throw Error(ot(318));if(t=e.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(ot(557));t[fi]=e}else eu(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;Ze(e),t=!1}else n=Mx(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=n),t=!0;if(!t)return e.flags&256?(Sa(e),e):(Sa(e),null);if(e.flags&128)throw Error(ot(558))}return Ze(e),null;case 13:if(i=e.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(a=Nc(e),i!==null&&i.dehydrated!==null){if(t===null){if(!a)throw Error(ot(318));if(a=e.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(ot(317));a[fi]=e}else eu(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;Ze(e),a=!1}else a=Mx(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=a),a=!0;if(!a)return e.flags&256?(Sa(e),e):(Sa(e),null)}return Sa(e),e.flags&128?(e.lanes=n,e):(n=i!==null,t=t!==null&&t.memoizedState!==null,n&&(i=e.child,a=null,i.alternate!==null&&i.alternate.memoizedState!==null&&i.alternate.memoizedState.cachePool!==null&&(a=i.alternate.memoizedState.cachePool.pool),r=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(r=i.memoizedState.cachePool.pool),r!==a&&(i.flags|=2048)),n!==t&&n&&(e.child.flags|=8192),Jg(e,e.updateQueue),Ze(e),null);case 4:return nd(),t===null&&IT(e.stateNode.containerInfo),Ze(e),null;case 10:return Co(e.type),Ze(e),null;case 19:if(ei(Rn),i=e.memoizedState,i===null)return Ze(e),null;if(a=(e.flags&128)!==0,r=i.rendering,r===null)if(a)Yf(i,!1);else{if(vn!==0||t!==null&&t.flags&128)for(t=e.child;t!==null;){if(r=zy(t),r!==null){for(e.flags|=128,Yf(i,!1),t=r.updateQueue,e.updateQueue=t,Jg(e,t),e.subtreeFlags=0,t=n,n=e.child;n!==null;)UI(n,t),n=n.sibling;return Qe(Rn,Rn.current&1|2),Re&&xo(e,i.treeForkCount),e.child}t=t.sibling}i.tail!==null&&Ta()>By&&(e.flags|=128,a=!0,Yf(i,!1),e.lanes=4194304)}else{if(!a)if(t=zy(r),t!==null){if(e.flags|=128,a=!0,t=t.updateQueue,e.updateQueue=t,Jg(e,t),Yf(i,!0),i.tail===null&&i.tailMode==="hidden"&&!r.alternate&&!Re)return Ze(e),null}else 2*Ta()-i.renderingStartTime>By&&n!==536870912&&(e.flags|=128,a=!0,Yf(i,!1),e.lanes=4194304);i.isBackwards?(r.sibling=e.child,e.child=r):(t=i.last,t!==null?t.sibling=r:e.child=r,i.last=r)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=Ta(),t.sibling=null,n=Rn.current,Qe(Rn,a?n&1|2:n&1),Re&&xo(e,i.treeForkCount),t):(Ze(e),null);case 22:case 23:return Sa(e),cT(),i=e.memoizedState!==null,t!==null?t.memoizedState!==null!==i&&(e.flags|=8192):i&&(e.flags|=8192),i?n&536870912&&!(e.flags&128)&&(Ze(e),e.subtreeFlags&6&&(e.flags|=8192)):Ze(e),n=e.updateQueue,n!==null&&Jg(e,n.retryQueue),n=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(n=t.memoizedState.cachePool.pool),i=null,e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(i=e.memoizedState.cachePool.pool),i!==n&&(e.flags|=2048),t!==null&&ei(Jl),null;case 24:return n=null,t!==null&&(n=t.memoizedState.cache),e.memoizedState.cache!==n&&(e.flags|=2048),Co(Dn),Ze(e),null;case 25:return null;case 30:return null}throw Error(ot(156,e.tag))}function fV(t,e){switch(rT(e),e.tag){case 1:return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return Co(Dn),nd(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 26:case 27:case 5:return wy(e),null;case 31:if(e.memoizedState!==null){if(Sa(e),e.alternate===null)throw Error(ot(340));eu()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 13:if(Sa(e),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(ot(340));eu()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return ei(Rn),null;case 4:return nd(),null;case 10:return Co(e.type),null;case 22:case 23:return Sa(e),cT(),t!==null&&ei(Jl),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 24:return Co(Dn),null;case 25:return null;default:return null}}function UN(t,e){switch(rT(e),e.tag){case 3:Co(Dn),nd();break;case 26:case 27:case 5:wy(e);break;case 4:nd();break;case 31:e.memoizedState!==null&&Sa(e);break;case 13:Sa(e);break;case 19:ei(Rn);break;case 10:Co(e.type);break;case 22:case 23:Sa(e),cT(),t!==null&&ei(Jl);break;case 24:Co(Dn)}}function Ph(t,e){try{var n=e.updateQueue,i=n!==null?n.lastEffect:null;if(i!==null){var a=i.next;n=a;do{if((n.tag&t)===t){i=void 0;var r=n.create,l=n.inst;i=r(),l.destroy=i}n=n.next}while(n!==a)}}catch(u){Be(e,e.return,u)}}function qs(t,e,n){try{var i=e.updateQueue,a=i!==null?i.lastEffect:null;if(a!==null){var r=a.next;i=r;do{if((i.tag&t)===t){var l=i.inst,u=l.destroy;if(u!==void 0){l.destroy=void 0,a=e;var f=n,h=u;try{h()}catch(d){Be(a,f,d)}}}i=i.next}while(i!==r)}}catch(d){Be(e,e.return,d)}}function VN(t){var e=t.updateQueue;if(e!==null){var n=t.stateNode;try{WI(e,n)}catch(i){Be(t,t.return,i)}}}function jN(t,e,n){n.props=ru(t.type,t.memoizedProps),n.state=t.memoizedState;try{n.componentWillUnmount()}catch(i){Be(t,e,i)}}function uh(t,e){try{var n=t.ref;if(n!==null){switch(t.tag){case 26:case 27:case 5:var i=t.stateNode;break;case 30:i=t.stateNode;break;default:i=t.stateNode}typeof n=="function"?t.refCleanup=n(i):n.current=i}}catch(a){Be(t,e,a)}}function Br(t,e){var n=t.ref,i=t.refCleanup;if(n!==null)if(typeof i=="function")try{i()}catch(a){Be(t,e,a)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof n=="function")try{n(null)}catch(a){Be(t,e,a)}else n.current=null}function kN(t){var e=t.type,n=t.memoizedProps,i=t.stateNode;try{t:switch(e){case"button":case"input":case"select":case"textarea":n.autoFocus&&i.focus();break t;case"img":n.src?i.src=n.src:n.srcSet&&(i.srcset=n.srcSet)}}catch(a){Be(t,t.return,a)}}function Hx(t,e,n){try{var i=t.stateNode;IV(i,t.type,n,e),i[$i]=e}catch(a){Be(t,t.return,a)}}function GN(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&js(t.type)||t.tag===4}function Fx(t){t:for(;;){for(;t.sibling===null;){if(t.return===null||GN(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.tag===27&&js(t.type)||t.flags&2||t.child===null||t.tag===4)continue t;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Cw(t,e,n){var i=t.tag;if(i===5||i===6)t=t.stateNode,e?(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n).insertBefore(t,e):(e=n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,e.appendChild(t),n=n._reactRootContainer,n!=null||e.onclick!==null||(e.onclick=Ro));else if(i!==4&&(i===27&&js(t.type)&&(n=t.stateNode,e=null),t=t.child,t!==null))for(Cw(t,e,n),t=t.sibling;t!==null;)Cw(t,e,n),t=t.sibling}function Py(t,e,n){var i=t.tag;if(i===5||i===6)t=t.stateNode,e?n.insertBefore(t,e):n.appendChild(t);else if(i!==4&&(i===27&&js(t.type)&&(n=t.stateNode),t=t.child,t!==null))for(Py(t,e,n),t=t.sibling;t!==null;)Py(t,e,n),t=t.sibling}function YN(t){var e=t.stateNode,n=t.memoizedProps;try{for(var i=t.type,a=e.attributes;a.length;)e.removeAttributeNode(a[0]);mi(e,i,n),e[fi]=t,e[$i]=n}catch(r){Be(t,t.return,r)}}var wo=!1,Ln=!1,qx=!1,Ez=typeof WeakSet=="function"?WeakSet:Set,$n=null;function hV(t,e){if(t=t.containerInfo,Lw=Xy,t=NI(t),tT(t)){if("selectionStart"in t)var n={start:t.selectionStart,end:t.selectionEnd};else t:{n=(n=t.ownerDocument)&&n.defaultView||window;var i=n.getSelection&&n.getSelection();if(i&&i.rangeCount!==0){n=i.anchorNode;var a=i.anchorOffset,r=i.focusNode;i=i.focusOffset;try{n.nodeType,r.nodeType}catch{n=null;break t}var l=0,u=-1,f=-1,h=0,d=0,m=t,y=null;e:for(;;){for(var g;m!==n||a!==0&&m.nodeType!==3||(u=l+a),m!==r||i!==0&&m.nodeType!==3||(f=l+i),m.nodeType===3&&(l+=m.nodeValue.length),(g=m.firstChild)!==null;)y=m,m=g;for(;;){if(m===t)break e;if(y===n&&++h===a&&(u=l),y===r&&++d===i&&(f=l),(g=m.nextSibling)!==null)break;m=y,y=m.parentNode}m=g}n=u===-1||f===-1?null:{start:u,end:f}}else n=null}n=n||{start:0,end:0}}else n=null;for(Dw={focusedElem:t,selectionRange:n},Xy=!1,$n=e;$n!==null;)if(e=$n,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,$n=t;else for(;$n!==null;){switch(e=$n,r=e.alternate,t=e.flags,e.tag){case 0:if(t&4&&(t=e.updateQueue,t=t!==null?t.events:null,t!==null))for(n=0;n<t.length;n++)a=t[n],a.ref.impl=a.nextImpl;break;case 11:case 15:break;case 1:if(t&1024&&r!==null){t=void 0,n=e,a=r.memoizedProps,r=r.memoizedState,i=n.stateNode;try{var b=ru(n.type,a);t=i.getSnapshotBeforeUpdate(b,r),i.__reactInternalSnapshotBeforeUpdate=t}catch(w){Be(n,n.return,w)}}break;case 3:if(t&1024){if(t=e.stateNode.containerInfo,n=t.nodeType,n===9)Bw(t);else if(n===1)switch(t.nodeName){case"HEAD":case"HTML":case"BODY":Bw(t);break;default:t.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if(t&1024)throw Error(ot(163))}if(t=e.sibling,t!==null){t.return=e.return,$n=t;break}$n=e.return}}function XN(t,e,n){var i=n.flags;switch(n.tag){case 0:case 11:case 15:bo(t,n),i&4&&Ph(5,n);break;case 1:if(bo(t,n),i&4)if(t=n.stateNode,e===null)try{t.componentDidMount()}catch(l){Be(n,n.return,l)}else{var a=ru(n.type,e.memoizedProps);e=e.memoizedState;try{t.componentDidUpdate(a,e,t.__reactInternalSnapshotBeforeUpdate)}catch(l){Be(n,n.return,l)}}i&64&&VN(n),i&512&&uh(n,n.return);break;case 3:if(bo(t,n),i&64&&(t=n.updateQueue,t!==null)){if(e=null,n.child!==null)switch(n.child.tag){case 27:case 5:e=n.child.stateNode;break;case 1:e=n.child.stateNode}try{WI(t,e)}catch(l){Be(n,n.return,l)}}break;case 27:e===null&&i&4&&YN(n);case 26:case 5:bo(t,n),e===null&&i&4&&kN(n),i&512&&uh(n,n.return);break;case 12:bo(t,n);break;case 31:bo(t,n),i&4&&ZN(t,n);break;case 13:bo(t,n),i&4&&WN(t,n),i&64&&(t=n.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(n=wV.bind(null,n),qV(t,n))));break;case 22:if(i=n.memoizedState!==null||wo,!i){e=e!==null&&e.memoizedState!==null||Ln,a=wo;var r=Ln;wo=i,(Ln=e)&&!r?So(t,n,(n.subtreeFlags&8772)!==0):bo(t,n),wo=a,Ln=r}break;case 30:break;default:bo(t,n)}}function QN(t){var e=t.alternate;e!==null&&(t.alternate=null,QN(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&Qw(e)),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}var rn=null,Zi=!1;function vo(t,e,n){for(n=n.child;n!==null;)KN(t,e,n),n=n.sibling}function KN(t,e,n){if(Ra&&typeof Ra.onCommitFiberUnmount=="function")try{Ra.onCommitFiberUnmount(Oh,n)}catch{}switch(n.tag){case 26:Ln||Br(n,e),vo(t,e,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:Ln||Br(n,e);var i=rn,a=Zi;js(n.type)&&(rn=n.stateNode,Zi=!1),vo(t,e,n),hh(n.stateNode),rn=i,Zi=a;break;case 5:Ln||Br(n,e);case 6:if(i=rn,a=Zi,rn=null,vo(t,e,n),rn=i,Zi=a,rn!==null)if(Zi)try{(rn.nodeType===9?rn.body:rn.nodeName==="HTML"?rn.ownerDocument.body:rn).removeChild(n.stateNode)}catch(r){Be(n,e,r)}else try{rn.removeChild(n.stateNode)}catch(r){Be(n,e,r)}break;case 18:rn!==null&&(Zi?(t=rn,qz(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,n.stateNode),fd(t)):qz(rn,n.stateNode));break;case 4:i=rn,a=Zi,rn=n.stateNode.containerInfo,Zi=!0,vo(t,e,n),rn=i,Zi=a;break;case 0:case 11:case 14:case 15:qs(2,n,e),Ln||qs(4,n,e),vo(t,e,n);break;case 1:Ln||(Br(n,e),i=n.stateNode,typeof i.componentWillUnmount=="function"&&jN(n,e,i)),vo(t,e,n);break;case 21:vo(t,e,n);break;case 22:Ln=(i=Ln)||n.memoizedState!==null,vo(t,e,n),Ln=i;break;default:vo(t,e,n)}}function ZN(t,e){if(e.memoizedState===null&&(t=e.alternate,t!==null&&(t=t.memoizedState,t!==null))){t=t.dehydrated;try{fd(t)}catch(n){Be(e,e.return,n)}}}function WN(t,e){if(e.memoizedState===null&&(t=e.alternate,t!==null&&(t=t.memoizedState,t!==null&&(t=t.dehydrated,t!==null))))try{fd(t)}catch(n){Be(e,e.return,n)}}function pV(t){switch(t.tag){case 31:case 13:case 19:var e=t.stateNode;return e===null&&(e=t.stateNode=new Ez),e;case 22:return t=t.stateNode,e=t._retryCache,e===null&&(e=t._retryCache=new Ez),e;default:throw Error(ot(435,t.tag))}}function $g(t,e){var n=pV(t);e.forEach(function(i){if(!n.has(i)){n.add(i);var a=TV.bind(null,t,i);i.then(a,a)}})}function Qi(t,e){var n=e.deletions;if(n!==null)for(var i=0;i<n.length;i++){var a=n[i],r=t,l=e,u=l;t:for(;u!==null;){switch(u.tag){case 27:if(js(u.type)){rn=u.stateNode,Zi=!1;break t}break;case 5:rn=u.stateNode,Zi=!1;break t;case 3:case 4:rn=u.stateNode.containerInfo,Zi=!0;break t}u=u.return}if(rn===null)throw Error(ot(160));KN(r,l,a),rn=null,Zi=!1,r=a.alternate,r!==null&&(r.return=null),a.return=null}if(e.subtreeFlags&13886)for(e=e.child;e!==null;)JN(e,t),e=e.sibling}var mr=null;function JN(t,e){var n=t.alternate,i=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:Qi(e,t),Ki(t),i&4&&(qs(3,t,t.return),Ph(3,t),qs(5,t,t.return));break;case 1:Qi(e,t),Ki(t),i&512&&(Ln||n===null||Br(n,n.return)),i&64&&wo&&(t=t.updateQueue,t!==null&&(i=t.callbacks,i!==null&&(n=t.shared.hiddenCallbacks,t.shared.hiddenCallbacks=n===null?i:n.concat(i))));break;case 26:var a=mr;if(Qi(e,t),Ki(t),i&512&&(Ln||n===null||Br(n,n.return)),i&4){var r=n!==null?n.memoizedState:null;if(i=t.memoizedState,n===null)if(i===null)if(t.stateNode===null){t:{i=t.type,n=t.memoizedProps,a=a.ownerDocument||a;e:switch(i){case"title":r=a.getElementsByTagName("title")[0],(!r||r[Ih]||r[fi]||r.namespaceURI==="http://www.w3.org/2000/svg"||r.hasAttribute("itemprop"))&&(r=a.createElement(i),a.head.insertBefore(r,a.querySelector("head > title"))),mi(r,i,n),r[fi]=t,ti(r),i=r;break t;case"link":var l=Xz("link","href",a).get(i+(n.href||""));if(l){for(var u=0;u<l.length;u++)if(r=l[u],r.getAttribute("href")===(n.href==null||n.href===""?null:n.href)&&r.getAttribute("rel")===(n.rel==null?null:n.rel)&&r.getAttribute("title")===(n.title==null?null:n.title)&&r.getAttribute("crossorigin")===(n.crossOrigin==null?null:n.crossOrigin)){l.splice(u,1);break e}}r=a.createElement(i),mi(r,i,n),a.head.appendChild(r);break;case"meta":if(l=Xz("meta","content",a).get(i+(n.content||""))){for(u=0;u<l.length;u++)if(r=l[u],r.getAttribute("content")===(n.content==null?null:""+n.content)&&r.getAttribute("name")===(n.name==null?null:n.name)&&r.getAttribute("property")===(n.property==null?null:n.property)&&r.getAttribute("http-equiv")===(n.httpEquiv==null?null:n.httpEquiv)&&r.getAttribute("charset")===(n.charSet==null?null:n.charSet)){l.splice(u,1);break e}}r=a.createElement(i),mi(r,i,n),a.head.appendChild(r);break;default:throw Error(ot(468,i))}r[fi]=t,ti(r),i=r}t.stateNode=i}else Qz(a,t.type,t.stateNode);else t.stateNode=Yz(a,i,t.memoizedProps);else r!==i?(r===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):r.count--,i===null?Qz(a,t.type,t.stateNode):Yz(a,i,t.memoizedProps)):i===null&&t.stateNode!==null&&Hx(t,t.memoizedProps,n.memoizedProps)}break;case 27:Qi(e,t),Ki(t),i&512&&(Ln||n===null||Br(n,n.return)),n!==null&&i&4&&Hx(t,t.memoizedProps,n.memoizedProps);break;case 5:if(Qi(e,t),Ki(t),i&512&&(Ln||n===null||Br(n,n.return)),t.flags&32){a=t.stateNode;try{ad(a,"")}catch(b){Be(t,t.return,b)}}i&4&&t.stateNode!=null&&(a=t.memoizedProps,Hx(t,a,n!==null?n.memoizedProps:a)),i&1024&&(qx=!0);break;case 6:if(Qi(e,t),Ki(t),i&4){if(t.stateNode===null)throw Error(ot(162));i=t.memoizedProps,n=t.stateNode;try{n.nodeValue=i}catch(b){Be(t,t.return,b)}}break;case 3:if(yy=null,a=mr,mr=ky(e.containerInfo),Qi(e,t),mr=a,Ki(t),i&4&&n!==null&&n.memoizedState.isDehydrated)try{fd(e.containerInfo)}catch(b){Be(t,t.return,b)}qx&&(qx=!1,$N(t));break;case 4:i=mr,mr=ky(t.stateNode.containerInfo),Qi(e,t),Ki(t),mr=i;break;case 12:Qi(e,t),Ki(t);break;case 31:Qi(e,t),Ki(t),i&4&&(i=t.updateQueue,i!==null&&(t.updateQueue=null,$g(t,i)));break;case 13:Qi(e,t),Ki(t),t.child.flags&8192&&t.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(ov=Ta()),i&4&&(i=t.updateQueue,i!==null&&(t.updateQueue=null,$g(t,i)));break;case 22:a=t.memoizedState!==null;var f=n!==null&&n.memoizedState!==null,h=wo,d=Ln;if(wo=h||a,Ln=d||f,Qi(e,t),Ln=d,wo=h,Ki(t),i&8192)t:for(e=t.stateNode,e._visibility=a?e._visibility&-2:e._visibility|1,a&&(n===null||f||wo||Ln||Kl(t)),n=null,e=t;;){if(e.tag===5||e.tag===26){if(n===null){f=n=e;try{if(r=f.stateNode,a)l=r.style,typeof l.setProperty=="function"?l.setProperty("display","none","important"):l.display="none";else{u=f.stateNode;var m=f.memoizedProps.style,y=m!=null&&m.hasOwnProperty("display")?m.display:null;u.style.display=y==null||typeof y=="boolean"?"":(""+y).trim()}}catch(b){Be(f,f.return,b)}}}else if(e.tag===6){if(n===null){f=e;try{f.stateNode.nodeValue=a?"":f.memoizedProps}catch(b){Be(f,f.return,b)}}}else if(e.tag===18){if(n===null){f=e;try{var g=f.stateNode;a?Uz(g,!0):Uz(f.stateNode,!1)}catch(b){Be(f,f.return,b)}}}else if((e.tag!==22&&e.tag!==23||e.memoizedState===null||e===t)&&e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break t;for(;e.sibling===null;){if(e.return===null||e.return===t)break t;n===e&&(n=null),e=e.return}n===e&&(n=null),e.sibling.return=e.return,e=e.sibling}i&4&&(i=t.updateQueue,i!==null&&(n=i.retryQueue,n!==null&&(i.retryQueue=null,$g(t,n))));break;case 19:Qi(e,t),Ki(t),i&4&&(i=t.updateQueue,i!==null&&(t.updateQueue=null,$g(t,i)));break;case 30:break;case 21:break;default:Qi(e,t),Ki(t)}}function Ki(t){var e=t.flags;if(e&2){try{for(var n,i=t.return;i!==null;){if(GN(i)){n=i;break}i=i.return}if(n==null)throw Error(ot(160));switch(n.tag){case 27:var a=n.stateNode,r=Fx(t);Py(t,r,a);break;case 5:var l=n.stateNode;n.flags&32&&(ad(l,""),n.flags&=-33);var u=Fx(t);Py(t,u,l);break;case 3:case 4:var f=n.stateNode.containerInfo,h=Fx(t);Cw(t,h,f);break;default:throw Error(ot(161))}}catch(d){Be(t,t.return,d)}t.flags&=-3}e&4096&&(t.flags&=-4097)}function $N(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var e=t;$N(e),e.tag===5&&e.flags&1024&&e.stateNode.reset(),t=t.sibling}}function bo(t,e){if(e.subtreeFlags&8772)for(e=e.child;e!==null;)XN(t,e.alternate,e),e=e.sibling}function Kl(t){for(t=t.child;t!==null;){var e=t;switch(e.tag){case 0:case 11:case 14:case 15:qs(4,e,e.return),Kl(e);break;case 1:Br(e,e.return);var n=e.stateNode;typeof n.componentWillUnmount=="function"&&jN(e,e.return,n),Kl(e);break;case 27:hh(e.stateNode);case 26:case 5:Br(e,e.return),Kl(e);break;case 22:e.memoizedState===null&&Kl(e);break;case 30:Kl(e);break;default:Kl(e)}t=t.sibling}}function So(t,e,n){for(n=n&&(e.subtreeFlags&8772)!==0,e=e.child;e!==null;){var i=e.alternate,a=t,r=e,l=r.flags;switch(r.tag){case 0:case 11:case 15:So(a,r,n),Ph(4,r);break;case 1:if(So(a,r,n),i=r,a=i.stateNode,typeof a.componentDidMount=="function")try{a.componentDidMount()}catch(h){Be(i,i.return,h)}if(i=r,a=i.updateQueue,a!==null){var u=i.stateNode;try{var f=a.shared.hiddenCallbacks;if(f!==null)for(a.shared.hiddenCallbacks=null,a=0;a<f.length;a++)ZI(f[a],u)}catch(h){Be(i,i.return,h)}}n&&l&64&&VN(r),uh(r,r.return);break;case 27:YN(r);case 26:case 5:So(a,r,n),n&&i===null&&l&4&&kN(r),uh(r,r.return);break;case 12:So(a,r,n);break;case 31:So(a,r,n),n&&l&4&&ZN(a,r);break;case 13:So(a,r,n),n&&l&4&&WN(a,r);break;case 22:r.memoizedState===null&&So(a,r,n),uh(r,r.return);break;case 30:break;default:So(a,r,n)}e=e.sibling}}function AT(t,e){var n=null;t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(n=t.memoizedState.cachePool.pool),t=null,e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(t=e.memoizedState.cachePool.pool),t!==n&&(t!=null&&t.refCount++,n!=null&&Lh(n))}function CT(t,e){t=null,e.alternate!==null&&(t=e.alternate.memoizedState.cache),e=e.memoizedState.cache,e!==t&&(e.refCount++,t!=null&&Lh(t))}function pr(t,e,n,i){if(e.subtreeFlags&10256)for(e=e.child;e!==null;)tL(t,e,n,i),e=e.sibling}function tL(t,e,n,i){var a=e.flags;switch(e.tag){case 0:case 11:case 15:pr(t,e,n,i),a&2048&&Ph(9,e);break;case 1:pr(t,e,n,i);break;case 3:pr(t,e,n,i),a&2048&&(t=null,e.alternate!==null&&(t=e.alternate.memoizedState.cache),e=e.memoizedState.cache,e!==t&&(e.refCount++,t!=null&&Lh(t)));break;case 12:if(a&2048){pr(t,e,n,i),t=e.stateNode;try{var r=e.memoizedProps,l=r.id,u=r.onPostCommit;typeof u=="function"&&u(l,e.alternate===null?"mount":"update",t.passiveEffectDuration,-0)}catch(f){Be(e,e.return,f)}}else pr(t,e,n,i);break;case 31:pr(t,e,n,i);break;case 13:pr(t,e,n,i);break;case 23:break;case 22:r=e.stateNode,l=e.alternate,e.memoizedState!==null?r._visibility&2?pr(t,e,n,i):ch(t,e):r._visibility&2?pr(t,e,n,i):(r._visibility|=2,Dc(t,e,n,i,(e.subtreeFlags&10256)!==0||!1)),a&2048&&AT(l,e);break;case 24:pr(t,e,n,i),a&2048&&CT(e.alternate,e);break;default:pr(t,e,n,i)}}function Dc(t,e,n,i,a){for(a=a&&((e.subtreeFlags&10256)!==0||!1),e=e.child;e!==null;){var r=t,l=e,u=n,f=i,h=l.flags;switch(l.tag){case 0:case 11:case 15:Dc(r,l,u,f,a),Ph(8,l);break;case 23:break;case 22:var d=l.stateNode;l.memoizedState!==null?d._visibility&2?Dc(r,l,u,f,a):ch(r,l):(d._visibility|=2,Dc(r,l,u,f,a)),a&&h&2048&&AT(l.alternate,l);break;case 24:Dc(r,l,u,f,a),a&&h&2048&&CT(l.alternate,l);break;default:Dc(r,l,u,f,a)}e=e.sibling}}function ch(t,e){if(e.subtreeFlags&10256)for(e=e.child;e!==null;){var n=t,i=e,a=i.flags;switch(i.tag){case 22:ch(n,i),a&2048&&AT(i.alternate,i);break;case 24:ch(n,i),a&2048&&CT(i.alternate,i);break;default:ch(n,i)}e=e.sibling}}var th=8192;function Lc(t,e,n){if(t.subtreeFlags&th)for(t=t.child;t!==null;)eL(t,e,n),t=t.sibling}function eL(t,e,n){switch(t.tag){case 26:Lc(t,e,n),t.flags&th&&t.memoizedState!==null&&JV(n,mr,t.memoizedState,t.memoizedProps);break;case 5:Lc(t,e,n);break;case 3:case 4:var i=mr;mr=ky(t.stateNode.containerInfo),Lc(t,e,n),mr=i;break;case 22:t.memoizedState===null&&(i=t.alternate,i!==null&&i.memoizedState!==null?(i=th,th=16777216,Lc(t,e,n),th=i):Lc(t,e,n));break;default:Lc(t,e,n)}}function nL(t){var e=t.alternate;if(e!==null&&(t=e.child,t!==null)){e.child=null;do e=t.sibling,t.sibling=null,t=e;while(t!==null)}}function Xf(t){var e=t.deletions;if(t.flags&16){if(e!==null)for(var n=0;n<e.length;n++){var i=e[n];$n=i,aL(i,t)}nL(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)iL(t),t=t.sibling}function iL(t){switch(t.tag){case 0:case 11:case 15:Xf(t),t.flags&2048&&qs(9,t,t.return);break;case 3:Xf(t);break;case 12:Xf(t);break;case 22:var e=t.stateNode;t.memoizedState!==null&&e._visibility&2&&(t.return===null||t.return.tag!==13)?(e._visibility&=-3,my(t)):Xf(t);break;default:Xf(t)}}function my(t){var e=t.deletions;if(t.flags&16){if(e!==null)for(var n=0;n<e.length;n++){var i=e[n];$n=i,aL(i,t)}nL(t)}for(t=t.child;t!==null;){switch(e=t,e.tag){case 0:case 11:case 15:qs(8,e,e.return),my(e);break;case 22:n=e.stateNode,n._visibility&2&&(n._visibility&=-3,my(e));break;default:my(e)}t=t.sibling}}function aL(t,e){for(;$n!==null;){var n=$n;switch(n.tag){case 0:case 11:case 15:qs(8,n,e);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var i=n.memoizedState.cachePool.pool;i!=null&&i.refCount++}break;case 24:Lh(n.memoizedState.cache)}if(i=n.child,i!==null)i.return=n,$n=i;else t:for(n=t;$n!==null;){i=$n;var a=i.sibling,r=i.return;if(QN(i),i===n){$n=null;break t}if(a!==null){a.return=r,$n=a;break t}$n=r}}}var mV={getCacheForType:function(t){var e=pi(Dn),n=e.data.get(t);return n===void 0&&(n=t(),e.data.set(t,n)),n},cacheSignal:function(){return pi(Dn).controller.signal}},gV=typeof WeakMap=="function"?WeakMap:Map,Ie=0,Ge=null,be=null,we=0,Pe=0,ba=null,As=!1,yd=!1,MT=!1,No=0,vn=0,Us=0,tu=0,OT=0,wa=0,ld=0,dh=null,Wi=null,Mw=!1,ov=0,rL=0,By=1/0,Hy=null,Ns=null,Gn=0,Ls=null,ud=null,Mo=0,Ow=0,_w=null,oL=null,fh=0,zw=null;function Aa(){return Ie&2&&we!==0?we&-we:Qt.T!==null?zT():mI()}function sL(){if(wa===0)if(!(we&536870912)||Re){var t=jg;jg<<=1,!(jg&3932160)&&(jg=262144),wa=t}else wa=536870912;return t=Ma.current,t!==null&&(t.flags|=32),wa}function Ji(t,e,n){(t===Ge&&(Pe===2||Pe===9)||t.cancelPendingCommit!==null)&&(cd(t,0),Cs(t,we,wa,!1)),zh(t,n),(!(Ie&2)||t!==Ge)&&(t===Ge&&(!(Ie&2)&&(tu|=n),vn===4&&Cs(t,we,wa,!1)),qr(t))}function lL(t,e,n){if(Ie&6)throw Error(ot(327));var i=!n&&(e&127)===0&&(e&t.expiredLanes)===0||_h(t,e),a=i?bV(t,e):Ux(t,e,!0),r=i;do{if(a===0){yd&&!i&&Cs(t,e,0,!1);break}else{if(n=t.current.alternate,r&&!yV(n)){a=Ux(t,e,!1),r=!1;continue}if(a===2){if(r=e,t.errorRecoveryDisabledLanes&r)var l=0;else l=t.pendingLanes&-536870913,l=l!==0?l:l&536870912?536870912:0;if(l!==0){e=l;t:{var u=t;a=dh;var f=u.current.memoizedState.isDehydrated;if(f&&(cd(u,l).flags|=256),l=Ux(u,l,!1),l!==2){if(MT&&!f){u.errorRecoveryDisabledLanes|=r,tu|=r,a=4;break t}r=Wi,Wi=a,r!==null&&(Wi===null?Wi=r:Wi.push.apply(Wi,r))}a=l}if(r=!1,a!==2)continue}}if(a===1){cd(t,0),Cs(t,e,0,!0);break}t:{switch(i=t,r=a,r){case 0:case 1:throw Error(ot(345));case 4:if((e&4194048)!==e)break;case 6:Cs(i,e,wa,!As);break t;case 2:Wi=null;break;case 3:case 5:break;default:throw Error(ot(329))}if((e&62914560)===e&&(a=ov+300-Ta(),10<a)){if(Cs(i,e,wa,!As),Ky(i,0,!0)!==0)break t;Mo=e,i.timeoutHandle=ML(Az.bind(null,i,n,Wi,Hy,Mw,e,wa,tu,ld,As,r,"Throttled",-0,0),a);break t}Az(i,n,Wi,Hy,Mw,e,wa,tu,ld,As,r,null,-0,0)}}break}while(!0);qr(t)}function Az(t,e,n,i,a,r,l,u,f,h,d,m,y,g){if(t.timeoutHandle=-1,m=e.subtreeFlags,m&8192||(m&16785408)===16785408){m={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Ro},eL(e,r,m);var b=(r&62914560)===r?ov-Ta():(r&4194048)===r?rL-Ta():0;if(b=$V(m,b),b!==null){Mo=r,t.cancelPendingCommit=b(Mz.bind(null,t,e,r,n,i,a,l,u,f,d,m,null,y,g)),Cs(t,r,l,!h);return}}Mz(t,e,r,n,i,a,l,u,f)}function yV(t){for(var e=t;;){var n=e.tag;if((n===0||n===11||n===15)&&e.flags&16384&&(n=e.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var i=0;i<n.length;i++){var a=n[i],r=a.getSnapshot;a=a.value;try{if(!Ca(r(),a))return!1}catch{return!1}}if(n=e.child,e.subtreeFlags&16384&&n!==null)n.return=e,e=n;else{if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return!0;e=e.return}e.sibling.return=e.return,e=e.sibling}}return!0}function Cs(t,e,n,i){e&=~OT,e&=~tu,t.suspendedLanes|=e,t.pingedLanes&=~e,i&&(t.warmLanes|=e),i=t.expirationTimes;for(var a=e;0<a;){var r=31-Ea(a),l=1<<r;i[r]=-1,a&=~l}n!==0&&fI(t,n,e)}function sv(){return Ie&6?!0:(Bh(0,!1),!1)}function _T(){if(be!==null){if(Pe===0)var t=be.return;else t=be,Eo=cu=null,mT(t),$c=null,Sh=0,t=be;for(;t!==null;)UN(t.alternate,t),t=t.return;be=null}}function cd(t,e){var n=t.timeoutHandle;n!==-1&&(t.timeoutHandle=-1,DV(n)),n=t.cancelPendingCommit,n!==null&&(t.cancelPendingCommit=null,n()),Mo=0,_T(),Ge=t,be=n=Ao(t.current,null),we=e,Pe=0,ba=null,As=!1,yd=_h(t,e),MT=!1,ld=wa=OT=tu=Us=vn=0,Wi=dh=null,Mw=!1,e&8&&(e|=e&32);var i=t.entangledLanes;if(i!==0)for(t=t.entanglements,i&=e;0<i;){var a=31-Ea(i),r=1<<a;e|=t[a],i&=~r}return No=e,$y(),n}function uL(t,e){le=null,Qt.H=wh,e===gd||e===ev?(e=az(),Pe=3):e===lT?(e=az(),Pe=4):Pe=e===RT?8:e!==null&&typeof e=="object"&&typeof e.then=="function"?6:1,ba=e,be===null&&(vn=1,Ly(t,Qa(e,t.current)))}function cL(){var t=Ma.current;return t===null?!0:(we&4194048)===we?Za===null:(we&62914560)===we||we&536870912?t===Za:!1}function dL(){var t=Qt.H;return Qt.H=wh,t===null?wh:t}function fL(){var t=Qt.A;return Qt.A=mV,t}function Fy(){vn=4,As||(we&4194048)!==we&&Ma.current!==null||(yd=!0),!(Us&134217727)&&!(tu&134217727)||Ge===null||Cs(Ge,we,wa,!1)}function Ux(t,e,n){var i=Ie;Ie|=2;var a=dL(),r=fL();(Ge!==t||we!==e)&&(Hy=null,cd(t,e)),e=!1;var l=vn;t:do try{if(Pe!==0&&be!==null){var u=be,f=ba;switch(Pe){case 8:_T(),l=6;break t;case 3:case 2:case 9:case 6:Ma.current===null&&(e=!0);var h=Pe;if(Pe=0,ba=null,Qc(t,u,f,h),n&&yd){l=0;break t}break;default:h=Pe,Pe=0,ba=null,Qc(t,u,f,h)}}vV(),l=vn;break}catch(d){uL(t,d)}while(!0);return e&&t.shellSuspendCounter++,Eo=cu=null,Ie=i,Qt.H=a,Qt.A=r,be===null&&(Ge=null,we=0,$y()),l}function vV(){for(;be!==null;)hL(be)}function bV(t,e){var n=Ie;Ie|=2;var i=dL(),a=fL();Ge!==t||we!==e?(Hy=null,By=Ta()+500,cd(t,e)):yd=_h(t,e);t:do try{if(Pe!==0&&be!==null){e=be;var r=ba;e:switch(Pe){case 1:Pe=0,ba=null,Qc(t,e,r,1);break;case 2:case 9:if(iz(r)){Pe=0,ba=null,Cz(e);break}e=function(){Pe!==2&&Pe!==9||Ge!==t||(Pe=7),qr(t)},r.then(e,e);break t;case 3:Pe=7;break t;case 4:Pe=5;break t;case 7:iz(r)?(Pe=0,ba=null,Cz(e)):(Pe=0,ba=null,Qc(t,e,r,7));break;case 5:var l=null;switch(be.tag){case 26:l=be.memoizedState;case 5:case 27:var u=be;if(l?NL(l):u.stateNode.complete){Pe=0,ba=null;var f=u.sibling;if(f!==null)be=f;else{var h=u.return;h!==null?(be=h,lv(h)):be=null}break e}}Pe=0,ba=null,Qc(t,e,r,5);break;case 6:Pe=0,ba=null,Qc(t,e,r,6);break;case 8:_T(),vn=6;break t;default:throw Error(ot(462))}}SV();break}catch(d){uL(t,d)}while(!0);return Eo=cu=null,Qt.H=i,Qt.A=a,Ie=n,be!==null?0:(Ge=null,we=0,$y(),vn)}function SV(){for(;be!==null&&!jq();)hL(be)}function hL(t){var e=qN(t.alternate,t,No);t.memoizedProps=t.pendingProps,e===null?lv(t):be=e}function Cz(t){var e=t,n=e.alternate;switch(e.tag){case 15:case 0:e=Sz(n,e,e.pendingProps,e.type,void 0,we);break;case 11:e=Sz(n,e,e.pendingProps,e.type.render,e.ref,we);break;case 5:mT(e);default:UN(n,e),e=be=UI(e,No),e=qN(n,e,No)}t.memoizedProps=t.pendingProps,e===null?lv(t):be=e}function Qc(t,e,n,i){Eo=cu=null,mT(e),$c=null,Sh=0;var a=e.return;try{if(lV(t,a,e,n,we)){vn=1,Ly(t,Qa(n,t.current)),be=null;return}}catch(r){if(a!==null)throw be=a,r;vn=1,Ly(t,Qa(n,t.current)),be=null;return}e.flags&32768?(Re||i===1?t=!0:yd||we&536870912?t=!1:(As=t=!0,(i===2||i===9||i===3||i===6)&&(i=Ma.current,i!==null&&i.tag===13&&(i.flags|=16384))),pL(e,t)):lv(e)}function lv(t){var e=t;do{if(e.flags&32768){pL(e,As);return}t=e.return;var n=dV(e.alternate,e,No);if(n!==null){be=n;return}if(e=e.sibling,e!==null){be=e;return}be=e=t}while(e!==null);vn===0&&(vn=5)}function pL(t,e){do{var n=fV(t.alternate,t);if(n!==null){n.flags&=32767,be=n;return}if(n=t.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!e&&(t=t.sibling,t!==null)){be=t;return}be=t=n}while(t!==null);vn=6,be=null}function Mz(t,e,n,i,a,r,l,u,f){t.cancelPendingCommit=null;do uv();while(Gn!==0);if(Ie&6)throw Error(ot(327));if(e!==null){if(e===t.current)throw Error(ot(177));if(r=e.lanes|e.childLanes,r|=eT,$q(t,n,r,l,u,f),t===Ge&&(be=Ge=null,we=0),ud=e,Ls=t,Mo=n,Ow=r,_w=a,oL=i,e.subtreeFlags&10256||e.flags&10256?(t.callbackNode=null,t.callbackPriority=0,RV(Ty,function(){return bL(),null})):(t.callbackNode=null,t.callbackPriority=0),i=(e.flags&13878)!==0,e.subtreeFlags&13878||i){i=Qt.T,Qt.T=null,a=Ne.p,Ne.p=2,l=Ie,Ie|=4;try{hV(t,e,n)}finally{Ie=l,Ne.p=a,Qt.T=i}}Gn=1,mL(),gL(),yL()}}function mL(){if(Gn===1){Gn=0;var t=Ls,e=ud,n=(e.flags&13878)!==0;if(e.subtreeFlags&13878||n){n=Qt.T,Qt.T=null;var i=Ne.p;Ne.p=2;var a=Ie;Ie|=4;try{JN(e,t);var r=Dw,l=NI(t.containerInfo),u=r.focusedElem,f=r.selectionRange;if(l!==u&&u&&u.ownerDocument&&II(u.ownerDocument.documentElement,u)){if(f!==null&&tT(u)){var h=f.start,d=f.end;if(d===void 0&&(d=h),"selectionStart"in u)u.selectionStart=h,u.selectionEnd=Math.min(d,u.value.length);else{var m=u.ownerDocument||document,y=m&&m.defaultView||window;if(y.getSelection){var g=y.getSelection(),b=u.textContent.length,w=Math.min(f.start,b),E=f.end===void 0?w:Math.min(f.end,b);!g.extend&&w>E&&(l=E,E=w,w=l);var T=Z_(u,w),S=Z_(u,E);if(T&&S&&(g.rangeCount!==1||g.anchorNode!==T.node||g.anchorOffset!==T.offset||g.focusNode!==S.node||g.focusOffset!==S.offset)){var R=m.createRange();R.setStart(T.node,T.offset),g.removeAllRanges(),w>E?(g.addRange(R),g.extend(S.node,S.offset)):(R.setEnd(S.node,S.offset),g.addRange(R))}}}}for(m=[],g=u;g=g.parentNode;)g.nodeType===1&&m.push({element:g,left:g.scrollLeft,top:g.scrollTop});for(typeof u.focus=="function"&&u.focus(),u=0;u<m.length;u++){var A=m[u];A.element.scrollLeft=A.left,A.element.scrollTop=A.top}}Xy=!!Lw,Dw=Lw=null}finally{Ie=a,Ne.p=i,Qt.T=n}}t.current=e,Gn=2}}function gL(){if(Gn===2){Gn=0;var t=Ls,e=ud,n=(e.flags&8772)!==0;if(e.subtreeFlags&8772||n){n=Qt.T,Qt.T=null;var i=Ne.p;Ne.p=2;var a=Ie;Ie|=4;try{XN(t,e.alternate,e)}finally{Ie=a,Ne.p=i,Qt.T=n}}Gn=3}}function yL(){if(Gn===4||Gn===3){Gn=0,kq();var t=Ls,e=ud,n=Mo,i=oL;e.subtreeFlags&10256||e.flags&10256?Gn=5:(Gn=0,ud=Ls=null,vL(t,t.pendingLanes));var a=t.pendingLanes;if(a===0&&(Ns=null),Xw(n),e=e.stateNode,Ra&&typeof Ra.onCommitFiberRoot=="function")try{Ra.onCommitFiberRoot(Oh,e,void 0,(e.current.flags&128)===128)}catch{}if(i!==null){e=Qt.T,a=Ne.p,Ne.p=2,Qt.T=null;try{for(var r=t.onRecoverableError,l=0;l<i.length;l++){var u=i[l];r(u.value,{componentStack:u.stack})}}finally{Qt.T=e,Ne.p=a}}Mo&3&&uv(),qr(t),a=t.pendingLanes,n&261930&&a&42?t===zw?fh++:(fh=0,zw=t):fh=0,Bh(0,!1)}}function vL(t,e){(t.pooledCacheLanes&=e)===0&&(e=t.pooledCache,e!=null&&(t.pooledCache=null,Lh(e)))}function uv(){return mL(),gL(),yL(),bL()}function bL(){if(Gn!==5)return!1;var t=Ls,e=Ow;Ow=0;var n=Xw(Mo),i=Qt.T,a=Ne.p;try{Ne.p=32>n?32:n,Qt.T=null,n=_w,_w=null;var r=Ls,l=Mo;if(Gn=0,ud=Ls=null,Mo=0,Ie&6)throw Error(ot(331));var u=Ie;if(Ie|=4,iL(r.current),tL(r,r.current,l,n),Ie=u,Bh(0,!1),Ra&&typeof Ra.onPostCommitFiberRoot=="function")try{Ra.onPostCommitFiberRoot(Oh,r)}catch{}return!0}finally{Ne.p=a,Qt.T=i,vL(t,e)}}function Oz(t,e,n){e=Qa(n,e),e=Rw(t.stateNode,e,2),t=Is(t,e,2),t!==null&&(zh(t,2),qr(t))}function Be(t,e,n){if(t.tag===3)Oz(t,t,n);else for(;e!==null;){if(e.tag===3){Oz(e,t,n);break}else if(e.tag===1){var i=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof i.componentDidCatch=="function"&&(Ns===null||!Ns.has(i))){t=Qa(n,t),n=LN(2),i=Is(e,n,2),i!==null&&(DN(n,i,e,t),zh(i,2),qr(i));break}}e=e.return}}function Vx(t,e,n){var i=t.pingCache;if(i===null){i=t.pingCache=new gV;var a=new Set;i.set(e,a)}else a=i.get(e),a===void 0&&(a=new Set,i.set(e,a));a.has(n)||(MT=!0,a.add(n),t=xV.bind(null,t,e,n),e.then(t,t))}function xV(t,e,n){var i=t.pingCache;i!==null&&i.delete(e),t.pingedLanes|=t.suspendedLanes&n,t.warmLanes&=~n,Ge===t&&(we&n)===n&&(vn===4||vn===3&&(we&62914560)===we&&300>Ta()-ov?!(Ie&2)&&cd(t,0):OT|=n,ld===we&&(ld=0)),qr(t)}function SL(t,e){e===0&&(e=dI()),t=uu(t,e),t!==null&&(zh(t,e),qr(t))}function wV(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),SL(t,n)}function TV(t,e){var n=0;switch(t.tag){case 31:case 13:var i=t.stateNode,a=t.memoizedState;a!==null&&(n=a.retryLane);break;case 19:i=t.stateNode;break;case 22:i=t.stateNode._retryCache;break;default:throw Error(ot(314))}i!==null&&i.delete(e),SL(t,n)}function RV(t,e){return Gw(t,e)}var qy=null,Pc=null,Iw=!1,Uy=!1,jx=!1,Ms=0;function qr(t){t!==Pc&&t.next===null&&(Pc===null?qy=Pc=t:Pc=Pc.next=t),Uy=!0,Iw||(Iw=!0,AV())}function Bh(t,e){if(!jx&&Uy){jx=!0;do for(var n=!1,i=qy;i!==null;){if(!e)if(t!==0){var a=i.pendingLanes;if(a===0)var r=0;else{var l=i.suspendedLanes,u=i.pingedLanes;r=(1<<31-Ea(42|t)+1)-1,r&=a&~(l&~u),r=r&201326741?r&201326741|1:r?r|2:0}r!==0&&(n=!0,_z(i,r))}else r=we,r=Ky(i,i===Ge?r:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),!(r&3)||_h(i,r)||(n=!0,_z(i,r));i=i.next}while(n);jx=!1}}function EV(){xL()}function xL(){Uy=Iw=!1;var t=0;Ms!==0&&LV()&&(t=Ms);for(var e=Ta(),n=null,i=qy;i!==null;){var a=i.next,r=wL(i,e);r===0?(i.next=null,n===null?qy=a:n.next=a,a===null&&(Pc=n)):(n=i,(t!==0||r&3)&&(Uy=!0)),i=a}Gn!==0&&Gn!==5||Bh(t,!1),Ms!==0&&(Ms=0)}function wL(t,e){for(var n=t.suspendedLanes,i=t.pingedLanes,a=t.expirationTimes,r=t.pendingLanes&-62914561;0<r;){var l=31-Ea(r),u=1<<l,f=a[l];f===-1?(!(u&n)||u&i)&&(a[l]=Jq(u,e)):f<=e&&(t.expiredLanes|=u),r&=~u}if(e=Ge,n=we,n=Ky(t,t===e?n:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),i=t.callbackNode,n===0||t===e&&(Pe===2||Pe===9)||t.cancelPendingCommit!==null)return i!==null&&i!==null&&vx(i),t.callbackNode=null,t.callbackPriority=0;if(!(n&3)||_h(t,n)){if(e=n&-n,e===t.callbackPriority)return e;switch(i!==null&&vx(i),Xw(n)){case 2:case 8:n=uI;break;case 32:n=Ty;break;case 268435456:n=cI;break;default:n=Ty}return i=TL.bind(null,t),n=Gw(n,i),t.callbackPriority=e,t.callbackNode=n,e}return i!==null&&i!==null&&vx(i),t.callbackPriority=2,t.callbackNode=null,2}function TL(t,e){if(Gn!==0&&Gn!==5)return t.callbackNode=null,t.callbackPriority=0,null;var n=t.callbackNode;if(uv()&&t.callbackNode!==n)return null;var i=we;return i=Ky(t,t===Ge?i:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),i===0?null:(lL(t,i,e),wL(t,Ta()),t.callbackNode!=null&&t.callbackNode===n?TL.bind(null,t):null)}function _z(t,e){if(uv())return null;lL(t,e,!0)}function AV(){PV(function(){Ie&6?Gw(lI,EV):xL()})}function zT(){if(Ms===0){var t=rd;t===0&&(t=Vg,Vg<<=1,!(Vg&261888)&&(Vg=256)),Ms=t}return Ms}function zz(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:oy(""+t)}function Iz(t,e){var n=e.ownerDocument.createElement("input");return n.name=e.name,n.value=e.value,t.id&&n.setAttribute("form",t.id),e.parentNode.insertBefore(n,e),t=new FormData(t),n.parentNode.removeChild(n),t}function CV(t,e,n,i,a){if(e==="submit"&&n&&n.stateNode===a){var r=zz((a[$i]||null).action),l=i.submitter;l&&(e=(e=l[$i]||null)?zz(e.formAction):l.getAttribute("formAction"),e!==null&&(r=e,l=null));var u=new Zy("action","action",null,i,a);t.push({event:u,listeners:[{instance:null,listener:function(){if(i.defaultPrevented){if(Ms!==0){var f=l?Iz(a,l):new FormData(a);ww(n,{pending:!0,data:f,method:a.method,action:r},null,f)}}else typeof r=="function"&&(u.preventDefault(),f=l?Iz(a,l):new FormData(a),ww(n,{pending:!0,data:f,method:a.method,action:r},r,f))},currentTarget:a}]})}}for(ty=0;ty<cw.length;ty++)ey=cw[ty],Nz=ey.toLowerCase(),Lz=ey[0].toUpperCase()+ey.slice(1),gr(Nz,"on"+Lz);var ey,Nz,Lz,ty;gr(DI,"onAnimationEnd");gr(PI,"onAnimationIteration");gr(BI,"onAnimationStart");gr("dblclick","onDoubleClick");gr("focusin","onFocus");gr("focusout","onBlur");gr(GU,"onTransitionRun");gr(YU,"onTransitionStart");gr(XU,"onTransitionCancel");gr(HI,"onTransitionEnd");id("onMouseEnter",["mouseout","mouseover"]);id("onMouseLeave",["mouseout","mouseover"]);id("onPointerEnter",["pointerout","pointerover"]);id("onPointerLeave",["pointerout","pointerover"]);ou("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));ou("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));ou("onBeforeInput",["compositionend","keypress","textInput","paste"]);ou("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));ou("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));ou("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Th="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),MV=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Th));function RL(t,e){e=(e&4)!==0;for(var n=0;n<t.length;n++){var i=t[n],a=i.event;i=i.listeners;t:{var r=void 0;if(e)for(var l=i.length-1;0<=l;l--){var u=i[l],f=u.instance,h=u.currentTarget;if(u=u.listener,f!==r&&a.isPropagationStopped())break t;r=u,a.currentTarget=h;try{r(a)}catch(d){Ey(d)}a.currentTarget=null,r=f}else for(l=0;l<i.length;l++){if(u=i[l],f=u.instance,h=u.currentTarget,u=u.listener,f!==r&&a.isPropagationStopped())break t;r=u,a.currentTarget=h;try{r(a)}catch(d){Ey(d)}a.currentTarget=null,r=f}}}}function ve(t,e){var n=e[nw];n===void 0&&(n=e[nw]=new Set);var i=t+"__bubble";n.has(i)||(EL(e,t,2,!1),n.add(i))}function kx(t,e,n){var i=0;e&&(i|=4),EL(n,t,i,e)}var ny="_reactListening"+Math.random().toString(36).slice(2);function IT(t){if(!t[ny]){t[ny]=!0,gI.forEach(function(n){n!=="selectionchange"&&(MV.has(n)||kx(n,!1,t),kx(n,!0,t))});var e=t.nodeType===9?t:t.ownerDocument;e===null||e[ny]||(e[ny]=!0,kx("selectionchange",!1,e))}}function EL(t,e,n,i){switch(HL(e)){case 2:var a=n8;break;case 8:a=i8;break;default:a=PT}n=a.bind(null,e,n,t),a=void 0,!sw||e!=="touchstart"&&e!=="touchmove"&&e!=="wheel"||(a=!0),i?a!==void 0?t.addEventListener(e,n,{capture:!0,passive:a}):t.addEventListener(e,n,!0):a!==void 0?t.addEventListener(e,n,{passive:a}):t.addEventListener(e,n,!1)}function Gx(t,e,n,i,a){var r=i;if(!(e&1)&&!(e&2)&&i!==null)t:for(;;){if(i===null)return;var l=i.tag;if(l===3||l===4){var u=i.stateNode.containerInfo;if(u===a)break;if(l===4)for(l=i.return;l!==null;){var f=l.tag;if((f===3||f===4)&&l.stateNode.containerInfo===a)return;l=l.return}for(;u!==null;){if(l=Fc(u),l===null)return;if(f=l.tag,f===5||f===6||f===26||f===27){i=r=l;continue t}u=u.parentNode}}i=i.return}RI(function(){var h=r,d=Zw(n),m=[];t:{var y=FI.get(t);if(y!==void 0){var g=Zy,b=t;switch(t){case"keypress":if(ly(n)===0)break t;case"keydown":case"keyup":g=TU;break;case"focusin":b="focus",g=Tx;break;case"focusout":b="blur",g=Tx;break;case"beforeblur":case"afterblur":g=Tx;break;case"click":if(n.button===2)break t;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":g=U_;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":g=dU;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":g=AU;break;case DI:case PI:case BI:g=pU;break;case HI:g=MU;break;case"scroll":case"scrollend":g=uU;break;case"wheel":g=_U;break;case"copy":case"cut":case"paste":g=gU;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":g=j_;break;case"toggle":case"beforetoggle":g=IU}var w=(e&4)!==0,E=!w&&(t==="scroll"||t==="scrollend"),T=w?y!==null?y+"Capture":null:y;w=[];for(var S=h,R;S!==null;){var A=S;if(R=A.stateNode,A=A.tag,A!==5&&A!==26&&A!==27||R===null||T===null||(A=mh(S,T),A!=null&&w.push(Rh(S,A,R))),E)break;S=S.return}0<w.length&&(y=new g(y,b,null,n,d),m.push({event:y,listeners:w}))}}if(!(e&7)){t:{if(y=t==="mouseover"||t==="pointerover",g=t==="mouseout"||t==="pointerout",y&&n!==ow&&(b=n.relatedTarget||n.fromElement)&&(Fc(b)||b[hd]))break t;if((g||y)&&(y=d.window===d?d:(y=d.ownerDocument)?y.defaultView||y.parentWindow:window,g?(b=n.relatedTarget||n.toElement,g=h,b=b?Fc(b):null,b!==null&&(E=Mh(b),w=b.tag,b!==E||w!==5&&w!==27&&w!==6)&&(b=null)):(g=null,b=h),g!==b)){if(w=U_,A="onMouseLeave",T="onMouseEnter",S="mouse",(t==="pointerout"||t==="pointerover")&&(w=j_,A="onPointerLeave",T="onPointerEnter",S="pointer"),E=g==null?y:Jf(g),R=b==null?y:Jf(b),y=new w(A,S+"leave",g,n,d),y.target=E,y.relatedTarget=R,A=null,Fc(d)===h&&(w=new w(T,S+"enter",b,n,d),w.target=R,w.relatedTarget=E,A=w),E=A,g&&b)e:{for(w=OV,T=g,S=b,R=0,A=T;A;A=w(A))R++;A=0;for(var M=S;M;M=w(M))A++;for(;0<R-A;)T=w(T),R--;for(;0<A-R;)S=w(S),A--;for(;R--;){if(T===S||S!==null&&T===S.alternate){w=T;break e}T=w(T),S=w(S)}w=null}else w=null;g!==null&&Dz(m,y,g,w,!1),b!==null&&E!==null&&Dz(m,E,b,w,!0)}}t:{if(y=h?Jf(h):window,g=y.nodeName&&y.nodeName.toLowerCase(),g==="select"||g==="input"&&y.type==="file")var z=X_;else if(Y_(y))if(_I)z=VU;else{z=qU;var I=FU}else g=y.nodeName,!g||g.toLowerCase()!=="input"||y.type!=="checkbox"&&y.type!=="radio"?h&&Kw(h.elementType)&&(z=X_):z=UU;if(z&&(z=z(t,h))){OI(m,z,n,d);break t}I&&I(t,y,h),t==="focusout"&&h&&y.type==="number"&&h.memoizedProps.value!=null&&rw(y,"number",y.value)}switch(I=h?Jf(h):window,t){case"focusin":(Y_(I)||I.contentEditable==="true")&&(Vc=I,lw=h,ih=null);break;case"focusout":ih=lw=Vc=null;break;case"mousedown":uw=!0;break;case"contextmenu":case"mouseup":case"dragend":uw=!1,W_(m,n,d);break;case"selectionchange":if(kU)break;case"keydown":case"keyup":W_(m,n,d)}var L;if($w)t:{switch(t){case"compositionstart":var H="onCompositionStart";break t;case"compositionend":H="onCompositionEnd";break t;case"compositionupdate":H="onCompositionUpdate";break t}H=void 0}else Uc?CI(t,n)&&(H="onCompositionEnd"):t==="keydown"&&n.keyCode===229&&(H="onCompositionStart");H&&(AI&&n.locale!=="ko"&&(Uc||H!=="onCompositionStart"?H==="onCompositionEnd"&&Uc&&(L=EI()):(Es=d,Ww="value"in Es?Es.value:Es.textContent,Uc=!0)),I=Vy(h,H),0<I.length&&(H=new V_(H,t,null,n,d),m.push({event:H,listeners:I}),L?H.data=L:(L=MI(n),L!==null&&(H.data=L)))),(L=LU?DU(t,n):PU(t,n))&&(H=Vy(h,"onBeforeInput"),0<H.length&&(I=new V_("onBeforeInput","beforeinput",null,n,d),m.push({event:I,listeners:H}),I.data=L)),CV(m,t,h,n,d)}RL(m,e)})}function Rh(t,e,n){return{instance:t,listener:e,currentTarget:n}}function Vy(t,e){for(var n=e+"Capture",i=[];t!==null;){var a=t,r=a.stateNode;if(a=a.tag,a!==5&&a!==26&&a!==27||r===null||(a=mh(t,n),a!=null&&i.unshift(Rh(t,a,r)),a=mh(t,e),a!=null&&i.push(Rh(t,a,r))),t.tag===3)return i;t=t.return}return[]}function OV(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function Dz(t,e,n,i,a){for(var r=e._reactName,l=[];n!==null&&n!==i;){var u=n,f=u.alternate,h=u.stateNode;if(u=u.tag,f!==null&&f===i)break;u!==5&&u!==26&&u!==27||h===null||(f=h,a?(h=mh(n,r),h!=null&&l.unshift(Rh(n,h,f))):a||(h=mh(n,r),h!=null&&l.push(Rh(n,h,f)))),n=n.return}l.length!==0&&t.push({event:e,listeners:l})}var _V=/\r\n?/g,zV=/\u0000|\uFFFD/g;function Pz(t){return(typeof t=="string"?t:""+t).replace(_V,`
|
|
20
|
+
`).replace(zV,"")}function AL(t,e){return e=Pz(e),Pz(t)===e}function Fe(t,e,n,i,a,r){switch(n){case"children":typeof i=="string"?e==="body"||e==="textarea"&&i===""||ad(t,i):(typeof i=="number"||typeof i=="bigint")&&e!=="body"&&ad(t,""+i);break;case"className":Gg(t,"class",i);break;case"tabIndex":Gg(t,"tabindex",i);break;case"dir":case"role":case"viewBox":case"width":case"height":Gg(t,n,i);break;case"style":TI(t,i,r);break;case"data":if(e!=="object"){Gg(t,"data",i);break}case"src":case"href":if(i===""&&(e!=="a"||n!=="href")){t.removeAttribute(n);break}if(i==null||typeof i=="function"||typeof i=="symbol"||typeof i=="boolean"){t.removeAttribute(n);break}i=oy(""+i),t.setAttribute(n,i);break;case"action":case"formAction":if(typeof i=="function"){t.setAttribute(n,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof r=="function"&&(n==="formAction"?(e!=="input"&&Fe(t,e,"name",a.name,a,null),Fe(t,e,"formEncType",a.formEncType,a,null),Fe(t,e,"formMethod",a.formMethod,a,null),Fe(t,e,"formTarget",a.formTarget,a,null)):(Fe(t,e,"encType",a.encType,a,null),Fe(t,e,"method",a.method,a,null),Fe(t,e,"target",a.target,a,null)));if(i==null||typeof i=="symbol"||typeof i=="boolean"){t.removeAttribute(n);break}i=oy(""+i),t.setAttribute(n,i);break;case"onClick":i!=null&&(t.onclick=Ro);break;case"onScroll":i!=null&&ve("scroll",t);break;case"onScrollEnd":i!=null&&ve("scrollend",t);break;case"dangerouslySetInnerHTML":if(i!=null){if(typeof i!="object"||!("__html"in i))throw Error(ot(61));if(n=i.__html,n!=null){if(a.children!=null)throw Error(ot(60));t.innerHTML=n}}break;case"multiple":t.multiple=i&&typeof i!="function"&&typeof i!="symbol";break;case"muted":t.muted=i&&typeof i!="function"&&typeof i!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(i==null||typeof i=="function"||typeof i=="boolean"||typeof i=="symbol"){t.removeAttribute("xlink:href");break}n=oy(""+i),t.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",n);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":i!=null&&typeof i!="function"&&typeof i!="symbol"?t.setAttribute(n,""+i):t.removeAttribute(n);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":i&&typeof i!="function"&&typeof i!="symbol"?t.setAttribute(n,""):t.removeAttribute(n);break;case"capture":case"download":i===!0?t.setAttribute(n,""):i!==!1&&i!=null&&typeof i!="function"&&typeof i!="symbol"?t.setAttribute(n,i):t.removeAttribute(n);break;case"cols":case"rows":case"size":case"span":i!=null&&typeof i!="function"&&typeof i!="symbol"&&!isNaN(i)&&1<=i?t.setAttribute(n,i):t.removeAttribute(n);break;case"rowSpan":case"start":i==null||typeof i=="function"||typeof i=="symbol"||isNaN(i)?t.removeAttribute(n):t.setAttribute(n,i);break;case"popover":ve("beforetoggle",t),ve("toggle",t),ry(t,"popover",i);break;case"xlinkActuate":go(t,"http://www.w3.org/1999/xlink","xlink:actuate",i);break;case"xlinkArcrole":go(t,"http://www.w3.org/1999/xlink","xlink:arcrole",i);break;case"xlinkRole":go(t,"http://www.w3.org/1999/xlink","xlink:role",i);break;case"xlinkShow":go(t,"http://www.w3.org/1999/xlink","xlink:show",i);break;case"xlinkTitle":go(t,"http://www.w3.org/1999/xlink","xlink:title",i);break;case"xlinkType":go(t,"http://www.w3.org/1999/xlink","xlink:type",i);break;case"xmlBase":go(t,"http://www.w3.org/XML/1998/namespace","xml:base",i);break;case"xmlLang":go(t,"http://www.w3.org/XML/1998/namespace","xml:lang",i);break;case"xmlSpace":go(t,"http://www.w3.org/XML/1998/namespace","xml:space",i);break;case"is":ry(t,"is",i);break;case"innerText":case"textContent":break;default:(!(2<n.length)||n[0]!=="o"&&n[0]!=="O"||n[1]!=="n"&&n[1]!=="N")&&(n=sU.get(n)||n,ry(t,n,i))}}function Nw(t,e,n,i,a,r){switch(n){case"style":TI(t,i,r);break;case"dangerouslySetInnerHTML":if(i!=null){if(typeof i!="object"||!("__html"in i))throw Error(ot(61));if(n=i.__html,n!=null){if(a.children!=null)throw Error(ot(60));t.innerHTML=n}}break;case"children":typeof i=="string"?ad(t,i):(typeof i=="number"||typeof i=="bigint")&&ad(t,""+i);break;case"onScroll":i!=null&&ve("scroll",t);break;case"onScrollEnd":i!=null&&ve("scrollend",t);break;case"onClick":i!=null&&(t.onclick=Ro);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!yI.hasOwnProperty(n))t:{if(n[0]==="o"&&n[1]==="n"&&(a=n.endsWith("Capture"),e=n.slice(2,a?n.length-7:void 0),r=t[$i]||null,r=r!=null?r[n]:null,typeof r=="function"&&t.removeEventListener(e,r,a),typeof i=="function")){typeof r!="function"&&r!==null&&(n in t?t[n]=null:t.hasAttribute(n)&&t.removeAttribute(n)),t.addEventListener(e,i,a);break t}n in t?t[n]=i:i===!0?t.setAttribute(n,""):ry(t,n,i)}}}function mi(t,e,n){switch(e){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":ve("error",t),ve("load",t);var i=!1,a=!1,r;for(r in n)if(n.hasOwnProperty(r)){var l=n[r];if(l!=null)switch(r){case"src":i=!0;break;case"srcSet":a=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(ot(137,e));default:Fe(t,e,r,l,n,null)}}a&&Fe(t,e,"srcSet",n.srcSet,n,null),i&&Fe(t,e,"src",n.src,n,null);return;case"input":ve("invalid",t);var u=r=l=a=null,f=null,h=null;for(i in n)if(n.hasOwnProperty(i)){var d=n[i];if(d!=null)switch(i){case"name":a=d;break;case"type":l=d;break;case"checked":f=d;break;case"defaultChecked":h=d;break;case"value":r=d;break;case"defaultValue":u=d;break;case"children":case"dangerouslySetInnerHTML":if(d!=null)throw Error(ot(137,e));break;default:Fe(t,e,i,d,n,null)}}SI(t,r,u,f,h,l,a,!1);return;case"select":ve("invalid",t),i=l=r=null;for(a in n)if(n.hasOwnProperty(a)&&(u=n[a],u!=null))switch(a){case"value":r=u;break;case"defaultValue":l=u;break;case"multiple":i=u;default:Fe(t,e,a,u,n,null)}e=r,n=l,t.multiple=!!i,e!=null?Zc(t,!!i,e,!1):n!=null&&Zc(t,!!i,n,!0);return;case"textarea":ve("invalid",t),r=a=i=null;for(l in n)if(n.hasOwnProperty(l)&&(u=n[l],u!=null))switch(l){case"value":i=u;break;case"defaultValue":a=u;break;case"children":r=u;break;case"dangerouslySetInnerHTML":if(u!=null)throw Error(ot(91));break;default:Fe(t,e,l,u,n,null)}wI(t,i,a,r);return;case"option":for(f in n)if(n.hasOwnProperty(f)&&(i=n[f],i!=null))switch(f){case"selected":t.selected=i&&typeof i!="function"&&typeof i!="symbol";break;default:Fe(t,e,f,i,n,null)}return;case"dialog":ve("beforetoggle",t),ve("toggle",t),ve("cancel",t),ve("close",t);break;case"iframe":case"object":ve("load",t);break;case"video":case"audio":for(i=0;i<Th.length;i++)ve(Th[i],t);break;case"image":ve("error",t),ve("load",t);break;case"details":ve("toggle",t);break;case"embed":case"source":case"link":ve("error",t),ve("load",t);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(h in n)if(n.hasOwnProperty(h)&&(i=n[h],i!=null))switch(h){case"children":case"dangerouslySetInnerHTML":throw Error(ot(137,e));default:Fe(t,e,h,i,n,null)}return;default:if(Kw(e)){for(d in n)n.hasOwnProperty(d)&&(i=n[d],i!==void 0&&Nw(t,e,d,i,n,void 0));return}}for(u in n)n.hasOwnProperty(u)&&(i=n[u],i!=null&&Fe(t,e,u,i,n,null))}function IV(t,e,n,i){switch(e){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var a=null,r=null,l=null,u=null,f=null,h=null,d=null;for(g in n){var m=n[g];if(n.hasOwnProperty(g)&&m!=null)switch(g){case"checked":break;case"value":break;case"defaultValue":f=m;default:i.hasOwnProperty(g)||Fe(t,e,g,null,i,m)}}for(var y in i){var g=i[y];if(m=n[y],i.hasOwnProperty(y)&&(g!=null||m!=null))switch(y){case"type":r=g;break;case"name":a=g;break;case"checked":h=g;break;case"defaultChecked":d=g;break;case"value":l=g;break;case"defaultValue":u=g;break;case"children":case"dangerouslySetInnerHTML":if(g!=null)throw Error(ot(137,e));break;default:g!==m&&Fe(t,e,y,g,i,m)}}aw(t,l,u,f,h,d,r,a);return;case"select":g=l=u=y=null;for(r in n)if(f=n[r],n.hasOwnProperty(r)&&f!=null)switch(r){case"value":break;case"multiple":g=f;default:i.hasOwnProperty(r)||Fe(t,e,r,null,i,f)}for(a in i)if(r=i[a],f=n[a],i.hasOwnProperty(a)&&(r!=null||f!=null))switch(a){case"value":y=r;break;case"defaultValue":u=r;break;case"multiple":l=r;default:r!==f&&Fe(t,e,a,r,i,f)}e=u,n=l,i=g,y!=null?Zc(t,!!n,y,!1):!!i!=!!n&&(e!=null?Zc(t,!!n,e,!0):Zc(t,!!n,n?[]:"",!1));return;case"textarea":g=y=null;for(u in n)if(a=n[u],n.hasOwnProperty(u)&&a!=null&&!i.hasOwnProperty(u))switch(u){case"value":break;case"children":break;default:Fe(t,e,u,null,i,a)}for(l in i)if(a=i[l],r=n[l],i.hasOwnProperty(l)&&(a!=null||r!=null))switch(l){case"value":y=a;break;case"defaultValue":g=a;break;case"children":break;case"dangerouslySetInnerHTML":if(a!=null)throw Error(ot(91));break;default:a!==r&&Fe(t,e,l,a,i,r)}xI(t,y,g);return;case"option":for(var b in n)if(y=n[b],n.hasOwnProperty(b)&&y!=null&&!i.hasOwnProperty(b))switch(b){case"selected":t.selected=!1;break;default:Fe(t,e,b,null,i,y)}for(f in i)if(y=i[f],g=n[f],i.hasOwnProperty(f)&&y!==g&&(y!=null||g!=null))switch(f){case"selected":t.selected=y&&typeof y!="function"&&typeof y!="symbol";break;default:Fe(t,e,f,y,i,g)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var w in n)y=n[w],n.hasOwnProperty(w)&&y!=null&&!i.hasOwnProperty(w)&&Fe(t,e,w,null,i,y);for(h in i)if(y=i[h],g=n[h],i.hasOwnProperty(h)&&y!==g&&(y!=null||g!=null))switch(h){case"children":case"dangerouslySetInnerHTML":if(y!=null)throw Error(ot(137,e));break;default:Fe(t,e,h,y,i,g)}return;default:if(Kw(e)){for(var E in n)y=n[E],n.hasOwnProperty(E)&&y!==void 0&&!i.hasOwnProperty(E)&&Nw(t,e,E,void 0,i,y);for(d in i)y=i[d],g=n[d],!i.hasOwnProperty(d)||y===g||y===void 0&&g===void 0||Nw(t,e,d,y,i,g);return}}for(var T in n)y=n[T],n.hasOwnProperty(T)&&y!=null&&!i.hasOwnProperty(T)&&Fe(t,e,T,null,i,y);for(m in i)y=i[m],g=n[m],!i.hasOwnProperty(m)||y===g||y==null&&g==null||Fe(t,e,m,y,i,g)}function Bz(t){switch(t){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function NV(){if(typeof performance.getEntriesByType=="function"){for(var t=0,e=0,n=performance.getEntriesByType("resource"),i=0;i<n.length;i++){var a=n[i],r=a.transferSize,l=a.initiatorType,u=a.duration;if(r&&u&&Bz(l)){for(l=0,u=a.responseEnd,i+=1;i<n.length;i++){var f=n[i],h=f.startTime;if(h>u)break;var d=f.transferSize,m=f.initiatorType;d&&Bz(m)&&(f=f.responseEnd,l+=d*(f<u?1:(u-h)/(f-h)))}if(--i,e+=8*(r+l)/(a.duration/1e3),t++,10<t)break}}if(0<t)return e/t/1e6}return navigator.connection&&(t=navigator.connection.downlink,typeof t=="number")?t:5}var Lw=null,Dw=null;function jy(t){return t.nodeType===9?t:t.ownerDocument}function Hz(t){switch(t){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function CL(t,e){if(t===0)switch(e){case"svg":return 1;case"math":return 2;default:return 0}return t===1&&e==="foreignObject"?0:t}function Pw(t,e){return t==="textarea"||t==="noscript"||typeof e.children=="string"||typeof e.children=="number"||typeof e.children=="bigint"||typeof e.dangerouslySetInnerHTML=="object"&&e.dangerouslySetInnerHTML!==null&&e.dangerouslySetInnerHTML.__html!=null}var Yx=null;function LV(){var t=window.event;return t&&t.type==="popstate"?t===Yx?!1:(Yx=t,!0):(Yx=null,!1)}var ML=typeof setTimeout=="function"?setTimeout:void 0,DV=typeof clearTimeout=="function"?clearTimeout:void 0,Fz=typeof Promise=="function"?Promise:void 0,PV=typeof queueMicrotask=="function"?queueMicrotask:typeof Fz<"u"?function(t){return Fz.resolve(null).then(t).catch(BV)}:ML;function BV(t){setTimeout(function(){throw t})}function js(t){return t==="head"}function qz(t,e){var n=e,i=0;do{var a=n.nextSibling;if(t.removeChild(n),a&&a.nodeType===8)if(n=a.data,n==="/$"||n==="/&"){if(i===0){t.removeChild(a),fd(e);return}i--}else if(n==="$"||n==="$?"||n==="$~"||n==="$!"||n==="&")i++;else if(n==="html")hh(t.ownerDocument.documentElement);else if(n==="head"){n=t.ownerDocument.head,hh(n);for(var r=n.firstChild;r;){var l=r.nextSibling,u=r.nodeName;r[Ih]||u==="SCRIPT"||u==="STYLE"||u==="LINK"&&r.rel.toLowerCase()==="stylesheet"||n.removeChild(r),r=l}}else n==="body"&&hh(t.ownerDocument.body);n=a}while(n);fd(e)}function Uz(t,e){var n=t;t=0;do{var i=n.nextSibling;if(n.nodeType===1?e?(n._stashedDisplay=n.style.display,n.style.display="none"):(n.style.display=n._stashedDisplay||"",n.getAttribute("style")===""&&n.removeAttribute("style")):n.nodeType===3&&(e?(n._stashedText=n.nodeValue,n.nodeValue=""):n.nodeValue=n._stashedText||""),i&&i.nodeType===8)if(n=i.data,n==="/$"){if(t===0)break;t--}else n!=="$"&&n!=="$?"&&n!=="$~"&&n!=="$!"||t++;n=i}while(n)}function Bw(t){var e=t.firstChild;for(e&&e.nodeType===10&&(e=e.nextSibling);e;){var n=e;switch(e=e.nextSibling,n.nodeName){case"HTML":case"HEAD":case"BODY":Bw(n),Qw(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}t.removeChild(n)}}function HV(t,e,n,i){for(;t.nodeType===1;){var a=n;if(t.nodeName.toLowerCase()!==e.toLowerCase()){if(!i&&(t.nodeName!=="INPUT"||t.type!=="hidden"))break}else if(i){if(!t[Ih])switch(e){case"meta":if(!t.hasAttribute("itemprop"))break;return t;case"link":if(r=t.getAttribute("rel"),r==="stylesheet"&&t.hasAttribute("data-precedence"))break;if(r!==a.rel||t.getAttribute("href")!==(a.href==null||a.href===""?null:a.href)||t.getAttribute("crossorigin")!==(a.crossOrigin==null?null:a.crossOrigin)||t.getAttribute("title")!==(a.title==null?null:a.title))break;return t;case"style":if(t.hasAttribute("data-precedence"))break;return t;case"script":if(r=t.getAttribute("src"),(r!==(a.src==null?null:a.src)||t.getAttribute("type")!==(a.type==null?null:a.type)||t.getAttribute("crossorigin")!==(a.crossOrigin==null?null:a.crossOrigin))&&r&&t.hasAttribute("async")&&!t.hasAttribute("itemprop"))break;return t;default:return t}}else if(e==="input"&&t.type==="hidden"){var r=a.name==null?null:""+a.name;if(a.type==="hidden"&&t.getAttribute("name")===r)return t}else return t;if(t=Wa(t.nextSibling),t===null)break}return null}function FV(t,e,n){if(e==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!n||(t=Wa(t.nextSibling),t===null))return null;return t}function OL(t,e){for(;t.nodeType!==8;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!e||(t=Wa(t.nextSibling),t===null))return null;return t}function Hw(t){return t.data==="$?"||t.data==="$~"}function Fw(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState!=="loading"}function qV(t,e){var n=t.ownerDocument;if(t.data==="$~")t._reactRetry=e;else if(t.data!=="$?"||n.readyState!=="loading")e();else{var i=function(){e(),n.removeEventListener("DOMContentLoaded",i)};n.addEventListener("DOMContentLoaded",i),t._reactRetry=i}}function Wa(t){for(;t!=null;t=t.nextSibling){var e=t.nodeType;if(e===1||e===3)break;if(e===8){if(e=t.data,e==="$"||e==="$!"||e==="$?"||e==="$~"||e==="&"||e==="F!"||e==="F")break;if(e==="/$"||e==="/&")return null}}return t}var qw=null;function Vz(t){t=t.nextSibling;for(var e=0;t;){if(t.nodeType===8){var n=t.data;if(n==="/$"||n==="/&"){if(e===0)return Wa(t.nextSibling);e--}else n!=="$"&&n!=="$!"&&n!=="$?"&&n!=="$~"&&n!=="&"||e++}t=t.nextSibling}return null}function jz(t){t=t.previousSibling;for(var e=0;t;){if(t.nodeType===8){var n=t.data;if(n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"){if(e===0)return t;e--}else n!=="/$"&&n!=="/&"||e++}t=t.previousSibling}return null}function _L(t,e,n){switch(e=jy(n),t){case"html":if(t=e.documentElement,!t)throw Error(ot(452));return t;case"head":if(t=e.head,!t)throw Error(ot(453));return t;case"body":if(t=e.body,!t)throw Error(ot(454));return t;default:throw Error(ot(451))}}function hh(t){for(var e=t.attributes;e.length;)t.removeAttributeNode(e[0]);Qw(t)}var Ja=new Map,kz=new Set;function ky(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var Lo=Ne.d;Ne.d={f:UV,r:VV,D:jV,C:kV,L:GV,m:YV,X:QV,S:XV,M:KV};function UV(){var t=Lo.f(),e=sv();return t||e}function VV(t){var e=pd(t);e!==null&&e.tag===5&&e.type==="form"?TN(e):Lo.r(t)}var vd=typeof document>"u"?null:document;function zL(t,e,n){var i=vd;if(i&&typeof e=="string"&&e){var a=Xa(e);a='link[rel="'+t+'"][href="'+a+'"]',typeof n=="string"&&(a+='[crossorigin="'+n+'"]'),kz.has(a)||(kz.add(a),t={rel:t,crossOrigin:n,href:e},i.querySelector(a)===null&&(e=i.createElement("link"),mi(e,"link",t),ti(e),i.head.appendChild(e)))}}function jV(t){Lo.D(t),zL("dns-prefetch",t,null)}function kV(t,e){Lo.C(t,e),zL("preconnect",t,e)}function GV(t,e,n){Lo.L(t,e,n);var i=vd;if(i&&t&&e){var a='link[rel="preload"][as="'+Xa(e)+'"]';e==="image"&&n&&n.imageSrcSet?(a+='[imagesrcset="'+Xa(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(a+='[imagesizes="'+Xa(n.imageSizes)+'"]')):a+='[href="'+Xa(t)+'"]';var r=a;switch(e){case"style":r=dd(t);break;case"script":r=bd(t)}Ja.has(r)||(t=Je({rel:"preload",href:e==="image"&&n&&n.imageSrcSet?void 0:t,as:e},n),Ja.set(r,t),i.querySelector(a)!==null||e==="style"&&i.querySelector(Hh(r))||e==="script"&&i.querySelector(Fh(r))||(e=i.createElement("link"),mi(e,"link",t),ti(e),i.head.appendChild(e)))}}function YV(t,e){Lo.m(t,e);var n=vd;if(n&&t){var i=e&&typeof e.as=="string"?e.as:"script",a='link[rel="modulepreload"][as="'+Xa(i)+'"][href="'+Xa(t)+'"]',r=a;switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":r=bd(t)}if(!Ja.has(r)&&(t=Je({rel:"modulepreload",href:t},e),Ja.set(r,t),n.querySelector(a)===null)){switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(Fh(r)))return}i=n.createElement("link"),mi(i,"link",t),ti(i),n.head.appendChild(i)}}}function XV(t,e,n){Lo.S(t,e,n);var i=vd;if(i&&t){var a=Kc(i).hoistableStyles,r=dd(t);e=e||"default";var l=a.get(r);if(!l){var u={loading:0,preload:null};if(l=i.querySelector(Hh(r)))u.loading=5;else{t=Je({rel:"stylesheet",href:t,"data-precedence":e},n),(n=Ja.get(r))&&NT(t,n);var f=l=i.createElement("link");ti(f),mi(f,"link",t),f._p=new Promise(function(h,d){f.onload=h,f.onerror=d}),f.addEventListener("load",function(){u.loading|=1}),f.addEventListener("error",function(){u.loading|=2}),u.loading|=4,gy(l,e,i)}l={type:"stylesheet",instance:l,count:1,state:u},a.set(r,l)}}}function QV(t,e){Lo.X(t,e);var n=vd;if(n&&t){var i=Kc(n).hoistableScripts,a=bd(t),r=i.get(a);r||(r=n.querySelector(Fh(a)),r||(t=Je({src:t,async:!0},e),(e=Ja.get(a))&<(t,e),r=n.createElement("script"),ti(r),mi(r,"link",t),n.head.appendChild(r)),r={type:"script",instance:r,count:1,state:null},i.set(a,r))}}function KV(t,e){Lo.M(t,e);var n=vd;if(n&&t){var i=Kc(n).hoistableScripts,a=bd(t),r=i.get(a);r||(r=n.querySelector(Fh(a)),r||(t=Je({src:t,async:!0,type:"module"},e),(e=Ja.get(a))&<(t,e),r=n.createElement("script"),ti(r),mi(r,"link",t),n.head.appendChild(r)),r={type:"script",instance:r,count:1,state:null},i.set(a,r))}}function Gz(t,e,n,i){var a=(a=Os.current)?ky(a):null;if(!a)throw Error(ot(446));switch(t){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(e=dd(n.href),n=Kc(a).hoistableStyles,i=n.get(e),i||(i={type:"style",instance:null,count:0,state:null},n.set(e,i)),i):{type:"void",instance:null,count:0,state:null};case"link":if(n.rel==="stylesheet"&&typeof n.href=="string"&&typeof n.precedence=="string"){t=dd(n.href);var r=Kc(a).hoistableStyles,l=r.get(t);if(l||(a=a.ownerDocument||a,l={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},r.set(t,l),(r=a.querySelector(Hh(t)))&&!r._p&&(l.instance=r,l.state.loading=5),Ja.has(t)||(n={rel:"preload",as:"style",href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},Ja.set(t,n),r||ZV(a,t,n,l.state))),e&&i===null)throw Error(ot(528,""));return l}if(e&&i!==null)throw Error(ot(529,""));return null;case"script":return e=n.async,n=n.src,typeof n=="string"&&e&&typeof e!="function"&&typeof e!="symbol"?(e=bd(n),n=Kc(a).hoistableScripts,i=n.get(e),i||(i={type:"script",instance:null,count:0,state:null},n.set(e,i)),i):{type:"void",instance:null,count:0,state:null};default:throw Error(ot(444,t))}}function dd(t){return'href="'+Xa(t)+'"'}function Hh(t){return'link[rel="stylesheet"]['+t+"]"}function IL(t){return Je({},t,{"data-precedence":t.precedence,precedence:null})}function ZV(t,e,n,i){t.querySelector('link[rel="preload"][as="style"]['+e+"]")?i.loading=1:(e=t.createElement("link"),i.preload=e,e.addEventListener("load",function(){return i.loading|=1}),e.addEventListener("error",function(){return i.loading|=2}),mi(e,"link",n),ti(e),t.head.appendChild(e))}function bd(t){return'[src="'+Xa(t)+'"]'}function Fh(t){return"script[async]"+t}function Yz(t,e,n){if(e.count++,e.instance===null)switch(e.type){case"style":var i=t.querySelector('style[data-href~="'+Xa(n.href)+'"]');if(i)return e.instance=i,ti(i),i;var a=Je({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return i=(t.ownerDocument||t).createElement("style"),ti(i),mi(i,"style",a),gy(i,n.precedence,t),e.instance=i;case"stylesheet":a=dd(n.href);var r=t.querySelector(Hh(a));if(r)return e.state.loading|=4,e.instance=r,ti(r),r;i=IL(n),(a=Ja.get(a))&&NT(i,a),r=(t.ownerDocument||t).createElement("link"),ti(r);var l=r;return l._p=new Promise(function(u,f){l.onload=u,l.onerror=f}),mi(r,"link",i),e.state.loading|=4,gy(r,n.precedence,t),e.instance=r;case"script":return r=bd(n.src),(a=t.querySelector(Fh(r)))?(e.instance=a,ti(a),a):(i=n,(a=Ja.get(r))&&(i=Je({},n),LT(i,a)),t=t.ownerDocument||t,a=t.createElement("script"),ti(a),mi(a,"link",i),t.head.appendChild(a),e.instance=a);case"void":return null;default:throw Error(ot(443,e.type))}else e.type==="stylesheet"&&!(e.state.loading&4)&&(i=e.instance,e.state.loading|=4,gy(i,n.precedence,t));return e.instance}function gy(t,e,n){for(var i=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),a=i.length?i[i.length-1]:null,r=a,l=0;l<i.length;l++){var u=i[l];if(u.dataset.precedence===e)r=u;else if(r!==a)break}r?r.parentNode.insertBefore(t,r.nextSibling):(e=n.nodeType===9?n.head:n,e.insertBefore(t,e.firstChild))}function NT(t,e){t.crossOrigin==null&&(t.crossOrigin=e.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=e.referrerPolicy),t.title==null&&(t.title=e.title)}function LT(t,e){t.crossOrigin==null&&(t.crossOrigin=e.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=e.referrerPolicy),t.integrity==null&&(t.integrity=e.integrity)}var yy=null;function Xz(t,e,n){if(yy===null){var i=new Map,a=yy=new Map;a.set(n,i)}else a=yy,i=a.get(n),i||(i=new Map,a.set(n,i));if(i.has(t))return i;for(i.set(t,null),n=n.getElementsByTagName(t),a=0;a<n.length;a++){var r=n[a];if(!(r[Ih]||r[fi]||t==="link"&&r.getAttribute("rel")==="stylesheet")&&r.namespaceURI!=="http://www.w3.org/2000/svg"){var l=r.getAttribute(e)||"";l=t+l;var u=i.get(l);u?u.push(r):i.set(l,[r])}}return i}function Qz(t,e,n){t=t.ownerDocument||t,t.head.insertBefore(n,e==="title"?t.querySelector("head > title"):null)}function WV(t,e,n){if(n===1||e.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof e.precedence!="string"||typeof e.href!="string"||e.href==="")break;return!0;case"link":if(typeof e.rel!="string"||typeof e.href!="string"||e.href===""||e.onLoad||e.onError)break;switch(e.rel){case"stylesheet":return t=e.disabled,typeof e.precedence=="string"&&t==null;default:return!0}case"script":if(e.async&&typeof e.async!="function"&&typeof e.async!="symbol"&&!e.onLoad&&!e.onError&&e.src&&typeof e.src=="string")return!0}return!1}function NL(t){return!(t.type==="stylesheet"&&!(t.state.loading&3))}function JV(t,e,n,i){if(n.type==="stylesheet"&&(typeof i.media!="string"||matchMedia(i.media).matches!==!1)&&!(n.state.loading&4)){if(n.instance===null){var a=dd(i.href),r=e.querySelector(Hh(a));if(r){e=r._p,e!==null&&typeof e=="object"&&typeof e.then=="function"&&(t.count++,t=Gy.bind(t),e.then(t,t)),n.state.loading|=4,n.instance=r,ti(r);return}r=e.ownerDocument||e,i=IL(i),(a=Ja.get(a))&&NT(i,a),r=r.createElement("link"),ti(r);var l=r;l._p=new Promise(function(u,f){l.onload=u,l.onerror=f}),mi(r,"link",i),n.instance=r}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(n,e),(e=n.state.preload)&&!(n.state.loading&3)&&(t.count++,n=Gy.bind(t),e.addEventListener("load",n),e.addEventListener("error",n))}}var Xx=0;function $V(t,e){return t.stylesheets&&t.count===0&&vy(t,t.stylesheets),0<t.count||0<t.imgCount?function(n){var i=setTimeout(function(){if(t.stylesheets&&vy(t,t.stylesheets),t.unsuspend){var r=t.unsuspend;t.unsuspend=null,r()}},6e4+e);0<t.imgBytes&&Xx===0&&(Xx=62500*NV());var a=setTimeout(function(){if(t.waitingForImages=!1,t.count===0&&(t.stylesheets&&vy(t,t.stylesheets),t.unsuspend)){var r=t.unsuspend;t.unsuspend=null,r()}},(t.imgBytes>Xx?50:800)+e);return t.unsuspend=n,function(){t.unsuspend=null,clearTimeout(i),clearTimeout(a)}}:null}function Gy(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)vy(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var Yy=null;function vy(t,e){t.stylesheets=null,t.unsuspend!==null&&(t.count++,Yy=new Map,e.forEach(t8,t),Yy=null,Gy.call(t))}function t8(t,e){if(!(e.state.loading&4)){var n=Yy.get(t);if(n)var i=n.get(null);else{n=new Map,Yy.set(t,n);for(var a=t.querySelectorAll("link[data-precedence],style[data-precedence]"),r=0;r<a.length;r++){var l=a[r];(l.nodeName==="LINK"||l.getAttribute("media")!=="not all")&&(n.set(l.dataset.precedence,l),i=l)}i&&n.set(null,i)}a=e.instance,l=a.getAttribute("data-precedence"),r=n.get(l)||i,r===i&&n.set(null,a),n.set(l,a),this.count++,i=Gy.bind(this),a.addEventListener("load",i),a.addEventListener("error",i),r?r.parentNode.insertBefore(a,r.nextSibling):(t=t.nodeType===9?t.head:t,t.insertBefore(a,t.firstChild)),e.state.loading|=4}}var Eh={$$typeof:To,Provider:null,Consumer:null,_currentValue:Zl,_currentValue2:Zl,_threadCount:0};function e8(t,e,n,i,a,r,l,u,f){this.tag=1,this.containerInfo=t,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=bx(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=bx(0),this.hiddenUpdates=bx(null),this.identifierPrefix=i,this.onUncaughtError=a,this.onCaughtError=r,this.onRecoverableError=l,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=f,this.incompleteTransitions=new Map}function LL(t,e,n,i,a,r,l,u,f,h,d,m){return t=new e8(t,e,n,l,f,h,d,m,u),e=1,r===!0&&(e|=24),r=xa(3,null,null,e),t.current=r,r.stateNode=t,e=oT(),e.refCount++,t.pooledCache=e,e.refCount++,r.memoizedState={element:i,isDehydrated:n,cache:e},uT(r),t}function DL(t){return t?(t=Gc,t):Gc}function PL(t,e,n,i,a,r){a=DL(a),i.context===null?i.context=a:i.pendingContext=a,i=zs(e),i.payload={element:n},r=r===void 0?null:r,r!==null&&(i.callback=r),n=Is(t,i,e),n!==null&&(Ji(n,t,e),rh(n,t,e))}function Kz(t,e){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var n=t.retryLane;t.retryLane=n!==0&&n<e?n:e}}function DT(t,e){Kz(t,e),(t=t.alternate)&&Kz(t,e)}function BL(t){if(t.tag===13||t.tag===31){var e=uu(t,67108864);e!==null&&Ji(e,t,67108864),DT(t,67108864)}}function Zz(t){if(t.tag===13||t.tag===31){var e=Aa();e=Yw(e);var n=uu(t,e);n!==null&&Ji(n,t,e),DT(t,e)}}var Xy=!0;function n8(t,e,n,i){var a=Qt.T;Qt.T=null;var r=Ne.p;try{Ne.p=2,PT(t,e,n,i)}finally{Ne.p=r,Qt.T=a}}function i8(t,e,n,i){var a=Qt.T;Qt.T=null;var r=Ne.p;try{Ne.p=8,PT(t,e,n,i)}finally{Ne.p=r,Qt.T=a}}function PT(t,e,n,i){if(Xy){var a=Uw(i);if(a===null)Gx(t,e,i,Qy,n),Wz(t,i);else if(r8(a,t,e,n,i))i.stopPropagation();else if(Wz(t,i),e&4&&-1<a8.indexOf(t)){for(;a!==null;){var r=pd(a);if(r!==null)switch(r.tag){case 3:if(r=r.stateNode,r.current.memoizedState.isDehydrated){var l=Xl(r.pendingLanes);if(l!==0){var u=r;for(u.pendingLanes|=2,u.entangledLanes|=2;l;){var f=1<<31-Ea(l);u.entanglements[1]|=f,l&=~f}qr(r),!(Ie&6)&&(By=Ta()+500,Bh(0,!1))}}break;case 31:case 13:u=uu(r,2),u!==null&&Ji(u,r,2),sv(),DT(r,2)}if(r=Uw(i),r===null&&Gx(t,e,i,Qy,n),r===a)break;a=r}a!==null&&i.stopPropagation()}else Gx(t,e,i,null,n)}}function Uw(t){return t=Zw(t),BT(t)}var Qy=null;function BT(t){if(Qy=null,t=Fc(t),t!==null){var e=Mh(t);if(e===null)t=null;else{var n=e.tag;if(n===13){if(t=iI(e),t!==null)return t;t=null}else if(n===31){if(t=aI(e),t!==null)return t;t=null}else if(n===3){if(e.stateNode.current.memoizedState.isDehydrated)return e.tag===3?e.stateNode.containerInfo:null;t=null}else e!==t&&(t=null)}}return Qy=t,null}function HL(t){switch(t){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Gq()){case lI:return 2;case uI:return 8;case Ty:case Yq:return 32;case cI:return 268435456;default:return 32}default:return 32}}var Vw=!1,Ds=null,Ps=null,Bs=null,Ah=new Map,Ch=new Map,Ts=[],a8="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function Wz(t,e){switch(t){case"focusin":case"focusout":Ds=null;break;case"dragenter":case"dragleave":Ps=null;break;case"mouseover":case"mouseout":Bs=null;break;case"pointerover":case"pointerout":Ah.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ch.delete(e.pointerId)}}function Qf(t,e,n,i,a,r){return t===null||t.nativeEvent!==r?(t={blockedOn:e,domEventName:n,eventSystemFlags:i,nativeEvent:r,targetContainers:[a]},e!==null&&(e=pd(e),e!==null&&BL(e)),t):(t.eventSystemFlags|=i,e=t.targetContainers,a!==null&&e.indexOf(a)===-1&&e.push(a),t)}function r8(t,e,n,i,a){switch(e){case"focusin":return Ds=Qf(Ds,t,e,n,i,a),!0;case"dragenter":return Ps=Qf(Ps,t,e,n,i,a),!0;case"mouseover":return Bs=Qf(Bs,t,e,n,i,a),!0;case"pointerover":var r=a.pointerId;return Ah.set(r,Qf(Ah.get(r)||null,t,e,n,i,a)),!0;case"gotpointercapture":return r=a.pointerId,Ch.set(r,Qf(Ch.get(r)||null,t,e,n,i,a)),!0}return!1}function FL(t){var e=Fc(t.target);if(e!==null){var n=Mh(e);if(n!==null){if(e=n.tag,e===13){if(e=iI(n),e!==null){t.blockedOn=e,L_(t.priority,function(){Zz(n)});return}}else if(e===31){if(e=aI(n),e!==null){t.blockedOn=e,L_(t.priority,function(){Zz(n)});return}}else if(e===3&&n.stateNode.current.memoizedState.isDehydrated){t.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}t.blockedOn=null}function by(t){if(t.blockedOn!==null)return!1;for(var e=t.targetContainers;0<e.length;){var n=Uw(t.nativeEvent);if(n===null){n=t.nativeEvent;var i=new n.constructor(n.type,n);ow=i,n.target.dispatchEvent(i),ow=null}else return e=pd(n),e!==null&&BL(e),t.blockedOn=n,!1;e.shift()}return!0}function Jz(t,e,n){by(t)&&n.delete(e)}function o8(){Vw=!1,Ds!==null&&by(Ds)&&(Ds=null),Ps!==null&&by(Ps)&&(Ps=null),Bs!==null&&by(Bs)&&(Bs=null),Ah.forEach(Jz),Ch.forEach(Jz)}function iy(t,e){t.blockedOn===e&&(t.blockedOn=null,Vw||(Vw=!0,Yn.unstable_scheduleCallback(Yn.unstable_NormalPriority,o8)))}var ay=null;function $z(t){ay!==t&&(ay=t,Yn.unstable_scheduleCallback(Yn.unstable_NormalPriority,function(){ay===t&&(ay=null);for(var e=0;e<t.length;e+=3){var n=t[e],i=t[e+1],a=t[e+2];if(typeof i!="function"){if(BT(i||n)===null)continue;break}var r=pd(n);r!==null&&(t.splice(e,3),e-=3,ww(r,{pending:!0,data:a,method:n.method,action:i},i,a))}}))}function fd(t){function e(f){return iy(f,t)}Ds!==null&&iy(Ds,t),Ps!==null&&iy(Ps,t),Bs!==null&&iy(Bs,t),Ah.forEach(e),Ch.forEach(e);for(var n=0;n<Ts.length;n++){var i=Ts[n];i.blockedOn===t&&(i.blockedOn=null)}for(;0<Ts.length&&(n=Ts[0],n.blockedOn===null);)FL(n),n.blockedOn===null&&Ts.shift();if(n=(t.ownerDocument||t).$$reactFormReplay,n!=null)for(i=0;i<n.length;i+=3){var a=n[i],r=n[i+1],l=a[$i]||null;if(typeof r=="function")l||$z(n);else if(l){var u=null;if(r&&r.hasAttribute("formAction")){if(a=r,l=r[$i]||null)u=l.formAction;else if(BT(a)!==null)continue}else u=l.action;typeof u=="function"?n[i+1]=u:(n.splice(i,3),i-=3),$z(n)}}}function qL(){function t(r){r.canIntercept&&r.info==="react-transition"&&r.intercept({handler:function(){return new Promise(function(l){return a=l})},focusReset:"manual",scroll:"manual"})}function e(){a!==null&&(a(),a=null),i||setTimeout(n,20)}function n(){if(!i&&!navigation.transition){var r=navigation.currentEntry;r&&r.url!=null&&navigation.navigate(r.url,{state:r.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var i=!1,a=null;return navigation.addEventListener("navigate",t),navigation.addEventListener("navigatesuccess",e),navigation.addEventListener("navigateerror",e),setTimeout(n,100),function(){i=!0,navigation.removeEventListener("navigate",t),navigation.removeEventListener("navigatesuccess",e),navigation.removeEventListener("navigateerror",e),a!==null&&(a(),a=null)}}}function HT(t){this._internalRoot=t}cv.prototype.render=HT.prototype.render=function(t){var e=this._internalRoot;if(e===null)throw Error(ot(409));var n=e.current,i=Aa();PL(n,i,t,e,null,null)};cv.prototype.unmount=HT.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var e=t.containerInfo;PL(t.current,2,null,t,null,null),sv(),e[hd]=null}};function cv(t){this._internalRoot=t}cv.prototype.unstable_scheduleHydration=function(t){if(t){var e=mI();t={blockedOn:null,target:t,priority:e};for(var n=0;n<Ts.length&&e!==0&&e<Ts[n].priority;n++);Ts.splice(n,0,t),n===0&&FL(t)}};var tI=eI.version;if(tI!=="19.2.0")throw Error(ot(527,tI,"19.2.0"));Ne.findDOMNode=function(t){var e=t._reactInternals;if(e===void 0)throw typeof t.render=="function"?Error(ot(188)):(t=Object.keys(t).join(","),Error(ot(268,t)));return t=Hq(e),t=t!==null?rI(t):null,t=t===null?null:t.stateNode,t};var s8={bundleType:0,version:"19.2.0",rendererPackageName:"react-dom",currentDispatcherRef:Qt,reconcilerVersion:"19.2.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&(Kf=__REACT_DEVTOOLS_GLOBAL_HOOK__,!Kf.isDisabled&&Kf.supportsFiber))try{Oh=Kf.inject(s8),Ra=Kf}catch{}var Kf;dv.createRoot=function(t,e){if(!nI(t))throw Error(ot(299));var n=!1,i="",a=zN,r=IN,l=NN;return e!=null&&(e.unstable_strictMode===!0&&(n=!0),e.identifierPrefix!==void 0&&(i=e.identifierPrefix),e.onUncaughtError!==void 0&&(a=e.onUncaughtError),e.onCaughtError!==void 0&&(r=e.onCaughtError),e.onRecoverableError!==void 0&&(l=e.onRecoverableError)),e=LL(t,1,!1,null,null,n,i,null,a,r,l,qL),t[hd]=e.current,IT(t),new HT(e)};dv.hydrateRoot=function(t,e,n){if(!nI(t))throw Error(ot(299));var i=!1,a="",r=zN,l=IN,u=NN,f=null;return n!=null&&(n.unstable_strictMode===!0&&(i=!0),n.identifierPrefix!==void 0&&(a=n.identifierPrefix),n.onUncaughtError!==void 0&&(r=n.onUncaughtError),n.onCaughtError!==void 0&&(l=n.onCaughtError),n.onRecoverableError!==void 0&&(u=n.onRecoverableError),n.formState!==void 0&&(f=n.formState)),e=LL(t,1,!0,e,n??null,i,a,f,r,l,u,qL),e.context=DL(null),n=e.current,i=Aa(),i=Yw(i),a=zs(i),a.callback=null,Is(n,a,i),n=i,e.current.lanes=n,zh(e,n),qr(e),t[hd]=e.current,IT(t),new cv(e)};dv.version="19.2.0"});var kL=Ni((OQ,jL)=>{"use strict";function VL(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(VL)}catch(t){console.error(t)}}VL(),jL.exports=UL()});var H4=Ni((vrt,B4)=>{"use strict";(()=>{var t={296:(a,r,l)=>{var u=/^\s+|\s+$/g,f=/^[-+]0x[0-9a-f]+$/i,h=/^0b[01]+$/i,d=/^0o[0-7]+$/i,m=parseInt,y=typeof l.g=="object"&&l.g&&l.g.Object===Object&&l.g,g=typeof self=="object"&&self&&self.Object===Object&&self,b=y||g||Function("return this")(),w=Object.prototype.toString,E=Math.max,T=Math.min,S=function(){return b.Date.now()};function R(M){var z=typeof M;return!!M&&(z=="object"||z=="function")}function A(M){if(typeof M=="number")return M;if(function(L){return typeof L=="symbol"||function(H){return!!H&&typeof H=="object"}(L)&&w.call(L)=="[object Symbol]"}(M))return NaN;if(R(M)){var z=typeof M.valueOf=="function"?M.valueOf():M;M=R(z)?z+"":z}if(typeof M!="string")return M===0?M:+M;M=M.replace(u,"");var I=h.test(M);return I||d.test(M)?m(M.slice(2),I?2:8):f.test(M)?NaN:+M}a.exports=function(M,z,I){var L,H,V,nt,X,mt,lt=0,it=!1,yt=!1,xt=!0;if(typeof M!="function")throw new TypeError("Expected a function");function et(te){var ue=L,dt=H;return L=H=void 0,lt=te,nt=M.apply(dt,ue)}function gt(te){var ue=te-mt;return mt===void 0||ue>=z||ue<0||yt&&te-lt>=V}function Mt(){var te=S();if(gt(te))return Vt(te);X=setTimeout(Mt,function(ue){var dt=z-(ue-mt);return yt?T(dt,V-(ue-lt)):dt}(te))}function Vt(te){return X=void 0,xt&&L?et(te):(L=H=void 0,nt)}function Kt(){var te=S(),ue=gt(te);if(L=arguments,H=this,mt=te,ue){if(X===void 0)return function(dt){return lt=dt,X=setTimeout(Mt,z),it?et(dt):nt}(mt);if(yt)return X=setTimeout(Mt,z),et(mt)}return X===void 0&&(X=setTimeout(Mt,z)),nt}return z=A(z)||0,R(I)&&(it=!!I.leading,V=(yt="maxWait"in I)?E(A(I.maxWait)||0,z):V,xt="trailing"in I?!!I.trailing:xt),Kt.cancel=function(){X!==void 0&&clearTimeout(X),lt=0,L=mt=H=X=void 0},Kt.flush=function(){return X===void 0?nt:Vt(S())},Kt}},96:(a,r,l)=>{var u="Expected a function",f=NaN,h="[object Symbol]",d=/^\s+|\s+$/g,m=/^[-+]0x[0-9a-f]+$/i,y=/^0b[01]+$/i,g=/^0o[0-7]+$/i,b=parseInt,w=typeof l.g=="object"&&l.g&&l.g.Object===Object&&l.g,E=typeof self=="object"&&self&&self.Object===Object&&self,T=w||E||Function("return this")(),S=Object.prototype.toString,R=Math.max,A=Math.min,M=function(){return T.Date.now()};function z(L){var H=typeof L;return!!L&&(H=="object"||H=="function")}function I(L){if(typeof L=="number")return L;if(function(nt){return typeof nt=="symbol"||function(X){return!!X&&typeof X=="object"}(nt)&&S.call(nt)==h}(L))return f;if(z(L)){var H=typeof L.valueOf=="function"?L.valueOf():L;L=z(H)?H+"":H}if(typeof L!="string")return L===0?L:+L;L=L.replace(d,"");var V=y.test(L);return V||g.test(L)?b(L.slice(2),V?2:8):m.test(L)?f:+L}a.exports=function(L,H,V){var nt=!0,X=!0;if(typeof L!="function")throw new TypeError(u);return z(V)&&(nt="leading"in V?!!V.leading:nt,X="trailing"in V?!!V.trailing:X),function(mt,lt,it){var yt,xt,et,gt,Mt,Vt,Kt=0,te=!1,ue=!1,dt=!0;if(typeof mt!="function")throw new TypeError(u);function Ht(Zt){var fe=yt,Ft=xt;return yt=xt=void 0,Kt=Zt,gt=mt.apply(Ft,fe)}function ee(Zt){var fe=Zt-Vt;return Vt===void 0||fe>=lt||fe<0||ue&&Zt-Kt>=et}function Gt(){var Zt=M();if(ee(Zt))return re(Zt);Mt=setTimeout(Gt,function(fe){var Ft=lt-(fe-Vt);return ue?A(Ft,et-(fe-Kt)):Ft}(Zt))}function re(Zt){return Mt=void 0,dt&&yt?Ht(Zt):(yt=xt=void 0,gt)}function Ae(){var Zt=M(),fe=ee(Zt);if(yt=arguments,xt=this,Vt=Zt,fe){if(Mt===void 0)return function(Ft){return Kt=Ft,Mt=setTimeout(Gt,lt),te?Ht(Ft):gt}(Vt);if(ue)return Mt=setTimeout(Gt,lt),Ht(Vt)}return Mt===void 0&&(Mt=setTimeout(Gt,lt)),gt}return lt=I(lt)||0,z(it)&&(te=!!it.leading,et=(ue="maxWait"in it)?R(I(it.maxWait)||0,lt):et,dt="trailing"in it?!!it.trailing:dt),Ae.cancel=function(){Mt!==void 0&&clearTimeout(Mt),Kt=0,yt=Vt=xt=Mt=void 0},Ae.flush=function(){return Mt===void 0?gt:re(M())},Ae}(L,H,{leading:nt,maxWait:H,trailing:X})}},703:(a,r,l)=>{"use strict";var u=l(414);function f(){}function h(){}h.resetWarningCache=f,a.exports=function(){function d(g,b,w,E,T,S){if(S!==u){var R=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 R.name="Invariant Violation",R}}function m(){return d}d.isRequired=d;var y={array:d,bigint:d,bool:d,func:d,number:d,object:d,string:d,symbol:d,any:d,arrayOf:m,element:d,elementType:d,instanceOf:m,node:d,objectOf:m,oneOf:m,oneOfType:m,shape:m,exact:m,checkPropTypes:h,resetWarningCache:f};return y.PropTypes=y,y}},697:(a,r,l)=>{a.exports=l(703)()},414:a=>{"use strict";a.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"}},e={};function n(a){var r=e[a];if(r!==void 0)return r.exports;var l=e[a]={exports:{}};return t[a](l,l.exports,n),l.exports}n.n=a=>{var r=a&&a.__esModule?()=>a.default:()=>a;return n.d(r,{a:r}),r},n.d=(a,r)=>{for(var l in r)n.o(r,l)&&!n.o(a,l)&&Object.defineProperty(a,l,{enumerable:!0,get:r[l]})},n.g=function(){if(typeof globalThis=="object")return globalThis;try{return this||new Function("return this")()}catch{if(typeof window=="object")return window}}(),n.o=(a,r)=>Object.prototype.hasOwnProperty.call(a,r),n.r=a=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(a,"__esModule",{value:!0})};var i={};(()=>{"use strict";n.r(i),n.d(i,{LazyLoadComponent:()=>tn,LazyLoadImage:()=>wt,trackWindowScroll:()=>Vt});let a=ct();var r=n.n(a),l=n(697);let u=kl();var f=n.n(u);function h(){return typeof window<"u"&&"IntersectionObserver"in window&&"isIntersecting"in window.IntersectionObserverEntry.prototype}function d(U){return d=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(P){return typeof P}:function(P){return P&&typeof Symbol=="function"&&P.constructor===Symbol&&P!==Symbol.prototype?"symbol":typeof P},d(U)}function m(U,P){var Z=Object.keys(U);if(Object.getOwnPropertySymbols){var W=Object.getOwnPropertySymbols(U);P&&(W=W.filter(function(Lt){return Object.getOwnPropertyDescriptor(U,Lt).enumerable})),Z.push.apply(Z,W)}return Z}function y(U,P,Z){return(P=b(P))in U?Object.defineProperty(U,P,{value:Z,enumerable:!0,configurable:!0,writable:!0}):U[P]=Z,U}function g(U,P){for(var Z=0;Z<P.length;Z++){var W=P[Z];W.enumerable=W.enumerable||!1,W.configurable=!0,"value"in W&&(W.writable=!0),Object.defineProperty(U,b(W.key),W)}}function b(U){var P=function(Z,W){if(d(Z)!=="object"||Z===null)return Z;var Lt=Z[Symbol.toPrimitive];if(Lt!==void 0){var Yt=Lt.call(Z,"string");if(d(Yt)!=="object")return Yt;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(Z)}(U);return d(P)==="symbol"?P:String(P)}function w(U,P){return w=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(Z,W){return Z.__proto__=W,Z},w(U,P)}function E(U){return E=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(P){return P.__proto__||Object.getPrototypeOf(P)},E(U)}var T=function(U){U.forEach(function(P){P.isIntersecting&&P.target.onVisible()})},S={},R=function(U){(function(Y,at){if(typeof at!="function"&&at!==null)throw new TypeError("Super expression must either be null or a function");Y.prototype=Object.create(at&&at.prototype,{constructor:{value:Y,writable:!0,configurable:!0}}),Object.defineProperty(Y,"prototype",{writable:!1}),at&&w(Y,at)})(Pt,U);var P,Z,W,Lt,Yt=(W=Pt,Lt=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 Y,at=E(W);if(Lt){var At=E(this).constructor;Y=Reflect.construct(at,arguments,At)}else Y=at.apply(this,arguments);return function(Ct,Rt){if(Rt&&(d(Rt)==="object"||typeof Rt=="function"))return Rt;if(Rt!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return function(Ut){if(Ut===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return Ut}(Ct)}(this,Y)});function Pt(Y){var at;if(function(Ct,Rt){if(!(Ct instanceof Rt))throw new TypeError("Cannot call a class as a function")}(this,Pt),(at=Yt.call(this,Y)).supportsObserver=!Y.scrollPosition&&Y.useIntersectionObserver&&h(),at.supportsObserver){var At=Y.threshold;at.observer=function(Ct){return S[Ct]=S[Ct]||new IntersectionObserver(T,{rootMargin:Ct+"px"}),S[Ct]}(At)}return at}return P=Pt,Z=[{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 Y=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.props.scrollPosition,at=this.placeholder.getBoundingClientRect(),At=f().findDOMNode(this.placeholder).style,Ct=parseInt(At.getPropertyValue("margin-left"),10)||0,Rt=parseInt(At.getPropertyValue("margin-top"),10)||0;return{bottom:Y.y+at.bottom+Rt,left:Y.x+at.left+Ct,right:Y.x+at.right+Ct,top:Y.y+at.top+Rt}}},{key:"isPlaceholderInViewport",value:function(){if(typeof window>"u"||!this.placeholder)return!1;var Y=this.props,at=Y.scrollPosition,At=Y.threshold,Ct=this.getPlaceholderBoundingBox(at),Rt=at.y+window.innerHeight,Ut=at.x,G=at.x+window.innerWidth,Bt=at.y;return Bt-At<=Ct.bottom&&Rt+At>=Ct.top&&Ut-At<=Ct.right&&G+At>=Ct.left}},{key:"updateVisibility",value:function(){this.isPlaceholderInViewport()&&this.props.onVisible()}},{key:"render",value:function(){var Y=this,at=this.props,At=at.className,Ct=at.height,Rt=at.placeholder,Ut=at.style,G=at.width;if(Rt&&typeof Rt.type!="function")return r().cloneElement(Rt,{ref:function(he){return Y.placeholder=he}});var Bt=function(he){for(var Ue=1;Ue<arguments.length;Ue++){var Le=arguments[Ue]!=null?arguments[Ue]:{};Ue%2?m(Object(Le),!0).forEach(function(Ve){y(he,Ve,Le[Ve])}):Object.getOwnPropertyDescriptors?Object.defineProperties(he,Object.getOwnPropertyDescriptors(Le)):m(Object(Le)).forEach(function(Ve){Object.defineProperty(he,Ve,Object.getOwnPropertyDescriptor(Le,Ve))})}return he}({display:"inline-block"},Ut);return G!==void 0&&(Bt.width=G),Ct!==void 0&&(Bt.height=Ct),r().createElement("span",{className:At,ref:function(he){return Y.placeholder=he},style:Bt},Rt)}}],Z&&g(P.prototype,Z),Object.defineProperty(P,"prototype",{writable:!1}),Pt}(r().Component);R.propTypes={onVisible:l.PropTypes.func.isRequired,className:l.PropTypes.string,height:l.PropTypes.oneOfType([l.PropTypes.number,l.PropTypes.string]),placeholder:l.PropTypes.element,threshold:l.PropTypes.number,useIntersectionObserver:l.PropTypes.bool,scrollPosition:l.PropTypes.shape({x:l.PropTypes.number.isRequired,y:l.PropTypes.number.isRequired}),width:l.PropTypes.oneOfType([l.PropTypes.number,l.PropTypes.string])},R.defaultProps={className:"",placeholder:null,threshold:100,useIntersectionObserver:!0};let A=R;var M=n(296),z=n.n(M),I=n(96),L=n.n(I),H=function(U){var P=getComputedStyle(U,null);return P.getPropertyValue("overflow")+P.getPropertyValue("overflow-y")+P.getPropertyValue("overflow-x")};let V=function(U){if(!(U instanceof HTMLElement))return window;for(var P=U;P&&P instanceof HTMLElement;){if(/(scroll|auto)/.test(H(P)))return P;P=P.parentNode}return window};function nt(U){return nt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(P){return typeof P}:function(P){return P&&typeof Symbol=="function"&&P.constructor===Symbol&&P!==Symbol.prototype?"symbol":typeof P},nt(U)}var X=["delayMethod","delayTime"];function mt(){return mt=Object.assign?Object.assign.bind():function(U){for(var P=1;P<arguments.length;P++){var Z=arguments[P];for(var W in Z)Object.prototype.hasOwnProperty.call(Z,W)&&(U[W]=Z[W])}return U},mt.apply(this,arguments)}function lt(U,P){for(var Z=0;Z<P.length;Z++){var W=P[Z];W.enumerable=W.enumerable||!1,W.configurable=!0,"value"in W&&(W.writable=!0),Object.defineProperty(U,(Lt=function(Yt,Pt){if(nt(Yt)!=="object"||Yt===null)return Yt;var Y=Yt[Symbol.toPrimitive];if(Y!==void 0){var at=Y.call(Yt,"string");if(nt(at)!=="object")return at;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(Yt)}(W.key),nt(Lt)==="symbol"?Lt:String(Lt)),W)}var Lt}function it(U,P){return it=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(Z,W){return Z.__proto__=W,Z},it(U,P)}function yt(U,P){if(P&&(nt(P)==="object"||typeof P=="function"))return P;if(P!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return xt(U)}function xt(U){if(U===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return U}function et(U){return et=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(P){return P.__proto__||Object.getPrototypeOf(P)},et(U)}var gt=function(){return typeof window>"u"?0:window.scrollX||window.pageXOffset},Mt=function(){return typeof window>"u"?0:window.scrollY||window.pageYOffset};let Vt=function(U){var P=function(Z){(function(At,Ct){if(typeof Ct!="function"&&Ct!==null)throw new TypeError("Super expression must either be null or a function");At.prototype=Object.create(Ct&&Ct.prototype,{constructor:{value:At,writable:!0,configurable:!0}}),Object.defineProperty(At,"prototype",{writable:!1}),Ct&&it(At,Ct)})(at,Z);var W,Lt,Yt,Pt,Y=(Yt=at,Pt=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 At,Ct=et(Yt);if(Pt){var Rt=et(this).constructor;At=Reflect.construct(Ct,arguments,Rt)}else At=Ct.apply(this,arguments);return yt(this,At)});function at(At){var Ct;if(function(Ut,G){if(!(Ut instanceof G))throw new TypeError("Cannot call a class as a function")}(this,at),(Ct=Y.call(this,At)).useIntersectionObserver=At.useIntersectionObserver&&h(),Ct.useIntersectionObserver)return yt(Ct);var Rt=Ct.onChangeScroll.bind(xt(Ct));return At.delayMethod==="debounce"?Ct.delayedScroll=z()(Rt,At.delayTime):At.delayMethod==="throttle"&&(Ct.delayedScroll=L()(Rt,At.delayTime)),Ct.state={scrollPosition:{x:gt(),y:Mt()}},Ct.baseComponentRef=r().createRef(),Ct}return W=at,(Lt=[{key:"componentDidMount",value:function(){this.addListeners()}},{key:"componentWillUnmount",value:function(){this.removeListeners()}},{key:"componentDidUpdate",value:function(){typeof window>"u"||this.useIntersectionObserver||V(f().findDOMNode(this.baseComponentRef.current))!==this.scrollElement&&(this.removeListeners(),this.addListeners())}},{key:"addListeners",value:function(){typeof window>"u"||this.useIntersectionObserver||(this.scrollElement=V(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:gt(),y:Mt()}})}},{key:"render",value:function(){var At=this.props,Ct=(At.delayMethod,At.delayTime,function(Ut,G){if(Ut==null)return{};var Bt,he,Ue=function(Ve,An){if(Ve==null)return{};var Qn,Mi,Oi={},Ui=Object.keys(Ve);for(Mi=0;Mi<Ui.length;Mi++)Qn=Ui[Mi],An.indexOf(Qn)>=0||(Oi[Qn]=Ve[Qn]);return Oi}(Ut,G);if(Object.getOwnPropertySymbols){var Le=Object.getOwnPropertySymbols(Ut);for(he=0;he<Le.length;he++)Bt=Le[he],G.indexOf(Bt)>=0||Object.prototype.propertyIsEnumerable.call(Ut,Bt)&&(Ue[Bt]=Ut[Bt])}return Ue}(At,X)),Rt=this.useIntersectionObserver?null:this.state.scrollPosition;return r().createElement(U,mt({forwardRef:this.baseComponentRef,scrollPosition:Rt},Ct))}}])&<(W.prototype,Lt),Object.defineProperty(W,"prototype",{writable:!1}),at}(r().Component);return P.propTypes={delayMethod:l.PropTypes.oneOf(["debounce","throttle"]),delayTime:l.PropTypes.number,useIntersectionObserver:l.PropTypes.bool},P.defaultProps={delayMethod:"throttle",delayTime:300,useIntersectionObserver:!0},P};function Kt(U){return Kt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(P){return typeof P}:function(P){return P&&typeof Symbol=="function"&&P.constructor===Symbol&&P!==Symbol.prototype?"symbol":typeof P},Kt(U)}function te(U,P){for(var Z=0;Z<P.length;Z++){var W=P[Z];W.enumerable=W.enumerable||!1,W.configurable=!0,"value"in W&&(W.writable=!0),Object.defineProperty(U,(Lt=function(Yt,Pt){if(Kt(Yt)!=="object"||Yt===null)return Yt;var Y=Yt[Symbol.toPrimitive];if(Y!==void 0){var at=Y.call(Yt,"string");if(Kt(at)!=="object")return at;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(Yt)}(W.key),Kt(Lt)==="symbol"?Lt:String(Lt)),W)}var Lt}function ue(U,P){return ue=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(Z,W){return Z.__proto__=W,Z},ue(U,P)}function dt(U){return dt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(P){return P.__proto__||Object.getPrototypeOf(P)},dt(U)}var Ht=function(U){(function(Y,at){if(typeof at!="function"&&at!==null)throw new TypeError("Super expression must either be null or a function");Y.prototype=Object.create(at&&at.prototype,{constructor:{value:Y,writable:!0,configurable:!0}}),Object.defineProperty(Y,"prototype",{writable:!1}),at&&ue(Y,at)})(Pt,U);var P,Z,W,Lt,Yt=(W=Pt,Lt=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 Y,at=dt(W);if(Lt){var At=dt(this).constructor;Y=Reflect.construct(at,arguments,At)}else Y=at.apply(this,arguments);return function(Ct,Rt){if(Rt&&(Kt(Rt)==="object"||typeof Rt=="function"))return Rt;if(Rt!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return function(Ut){if(Ut===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return Ut}(Ct)}(this,Y)});function Pt(Y){return function(at,At){if(!(at instanceof At))throw new TypeError("Cannot call a class as a function")}(this,Pt),Yt.call(this,Y)}return P=Pt,(Z=[{key:"render",value:function(){return r().createElement(A,this.props)}}])&&te(P.prototype,Z),Object.defineProperty(P,"prototype",{writable:!1}),Pt}(r().Component);let ee=Vt(Ht);function Gt(U){return Gt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(P){return typeof P}:function(P){return P&&typeof Symbol=="function"&&P.constructor===Symbol&&P!==Symbol.prototype?"symbol":typeof P},Gt(U)}function re(U,P){for(var Z=0;Z<P.length;Z++){var W=P[Z];W.enumerable=W.enumerable||!1,W.configurable=!0,"value"in W&&(W.writable=!0),Object.defineProperty(U,(Lt=function(Yt,Pt){if(Gt(Yt)!=="object"||Yt===null)return Yt;var Y=Yt[Symbol.toPrimitive];if(Y!==void 0){var at=Y.call(Yt,"string");if(Gt(at)!=="object")return at;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(Yt)}(W.key),Gt(Lt)==="symbol"?Lt:String(Lt)),W)}var Lt}function Ae(U,P){return Ae=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(Z,W){return Z.__proto__=W,Z},Ae(U,P)}function Zt(U){if(U===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return U}function fe(U){return fe=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(P){return P.__proto__||Object.getPrototypeOf(P)},fe(U)}var Ft=function(U){(function(Y,at){if(typeof at!="function"&&at!==null)throw new TypeError("Super expression must either be null or a function");Y.prototype=Object.create(at&&at.prototype,{constructor:{value:Y,writable:!0,configurable:!0}}),Object.defineProperty(Y,"prototype",{writable:!1}),at&&Ae(Y,at)})(Pt,U);var P,Z,W,Lt,Yt=(W=Pt,Lt=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 Y,at=fe(W);if(Lt){var At=fe(this).constructor;Y=Reflect.construct(at,arguments,At)}else Y=at.apply(this,arguments);return function(Ct,Rt){if(Rt&&(Gt(Rt)==="object"||typeof Rt=="function"))return Rt;if(Rt!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Zt(Ct)}(this,Y)});function Pt(Y){var at;(function(G,Bt){if(!(G instanceof Bt))throw new TypeError("Cannot call a class as a function")})(this,Pt),at=Yt.call(this,Y);var At=Y.afterLoad,Ct=Y.beforeLoad,Rt=Y.scrollPosition,Ut=Y.visibleByDefault;return at.state={visible:Ut},Ut&&(Ct(),At()),at.onVisible=at.onVisible.bind(Zt(at)),at.isScrollTracked=!!(Rt&&Number.isFinite(Rt.x)&&Rt.x>=0&&Number.isFinite(Rt.y)&&Rt.y>=0),at}return P=Pt,(Z=[{key:"componentDidUpdate",value:function(Y,at){at.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 Y=this.props,at=Y.className,At=Y.delayMethod,Ct=Y.delayTime,Rt=Y.height,Ut=Y.placeholder,G=Y.scrollPosition,Bt=Y.style,he=Y.threshold,Ue=Y.useIntersectionObserver,Le=Y.width;return this.isScrollTracked||Ue&&h()?r().createElement(A,{className:at,height:Rt,onVisible:this.onVisible,placeholder:Ut,scrollPosition:G,style:Bt,threshold:he,useIntersectionObserver:Ue,width:Le}):r().createElement(ee,{className:at,delayMethod:At,delayTime:Ct,height:Rt,onVisible:this.onVisible,placeholder:Ut,style:Bt,threshold:he,width:Le})}}])&&re(P.prototype,Z),Object.defineProperty(P,"prototype",{writable:!1}),Pt}(r().Component);Ft.propTypes={afterLoad:l.PropTypes.func,beforeLoad:l.PropTypes.func,useIntersectionObserver:l.PropTypes.bool,visibleByDefault:l.PropTypes.bool},Ft.defaultProps={afterLoad:function(){return{}},beforeLoad:function(){return{}},useIntersectionObserver:!0,visibleByDefault:!1};let tn=Ft;function Jt(U){return Jt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(P){return typeof P}:function(P){return P&&typeof Symbol=="function"&&P.constructor===Symbol&&P!==Symbol.prototype?"symbol":typeof P},Jt(U)}var ze=["afterLoad","beforeLoad","delayMethod","delayTime","effect","placeholder","placeholderSrc","scrollPosition","threshold","useIntersectionObserver","visibleByDefault","wrapperClassName","wrapperProps"];function ri(U,P){var Z=Object.keys(U);if(Object.getOwnPropertySymbols){var W=Object.getOwnPropertySymbols(U);P&&(W=W.filter(function(Lt){return Object.getOwnPropertyDescriptor(U,Lt).enumerable})),Z.push.apply(Z,W)}return Z}function qn(U){for(var P=1;P<arguments.length;P++){var Z=arguments[P]!=null?arguments[P]:{};P%2?ri(Object(Z),!0).forEach(function(W){st(U,W,Z[W])}):Object.getOwnPropertyDescriptors?Object.defineProperties(U,Object.getOwnPropertyDescriptors(Z)):ri(Object(Z)).forEach(function(W){Object.defineProperty(U,W,Object.getOwnPropertyDescriptor(Z,W))})}return U}function st(U,P,Z){return(P=_(P))in U?Object.defineProperty(U,P,{value:Z,enumerable:!0,configurable:!0,writable:!0}):U[P]=Z,U}function Tt(){return Tt=Object.assign?Object.assign.bind():function(U){for(var P=1;P<arguments.length;P++){var Z=arguments[P];for(var W in Z)Object.prototype.hasOwnProperty.call(Z,W)&&(U[W]=Z[W])}return U},Tt.apply(this,arguments)}function qt(U,P){for(var Z=0;Z<P.length;Z++){var W=P[Z];W.enumerable=W.enumerable||!1,W.configurable=!0,"value"in W&&(W.writable=!0),Object.defineProperty(U,_(W.key),W)}}function _(U){var P=function(Z,W){if(Jt(Z)!=="object"||Z===null)return Z;var Lt=Z[Symbol.toPrimitive];if(Lt!==void 0){var Yt=Lt.call(Z,"string");if(Jt(Yt)!=="object")return Yt;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(Z)}(U);return Jt(P)==="symbol"?P:String(P)}function B(U,P){return B=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(Z,W){return Z.__proto__=W,Z},B(U,P)}function rt(U){return rt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(P){return P.__proto__||Object.getPrototypeOf(P)},rt(U)}var ft=function(U){(function(Y,at){if(typeof at!="function"&&at!==null)throw new TypeError("Super expression must either be null or a function");Y.prototype=Object.create(at&&at.prototype,{constructor:{value:Y,writable:!0,configurable:!0}}),Object.defineProperty(Y,"prototype",{writable:!1}),at&&B(Y,at)})(Pt,U);var P,Z,W,Lt,Yt=(W=Pt,Lt=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 Y,at=rt(W);if(Lt){var At=rt(this).constructor;Y=Reflect.construct(at,arguments,At)}else Y=at.apply(this,arguments);return function(Ct,Rt){if(Rt&&(Jt(Rt)==="object"||typeof Rt=="function"))return Rt;if(Rt!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return function(Ut){if(Ut===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return Ut}(Ct)}(this,Y)});function Pt(Y){var at;return function(At,Ct){if(!(At instanceof Ct))throw new TypeError("Cannot call a class as a function")}(this,Pt),(at=Yt.call(this,Y)).state={loaded:!1},at}return P=Pt,(Z=[{key:"onImageLoad",value:function(){var Y=this;return this.state.loaded?null:function(at){Y.props.onLoad(at),Y.props.afterLoad(),Y.setState({loaded:!0})}}},{key:"getImg",value:function(){var Y=this.props,at=(Y.afterLoad,Y.beforeLoad,Y.delayMethod,Y.delayTime,Y.effect,Y.placeholder,Y.placeholderSrc,Y.scrollPosition,Y.threshold,Y.useIntersectionObserver,Y.visibleByDefault,Y.wrapperClassName,Y.wrapperProps,function(At,Ct){if(At==null)return{};var Rt,Ut,G=function(he,Ue){if(he==null)return{};var Le,Ve,An={},Qn=Object.keys(he);for(Ve=0;Ve<Qn.length;Ve++)Le=Qn[Ve],Ue.indexOf(Le)>=0||(An[Le]=he[Le]);return An}(At,Ct);if(Object.getOwnPropertySymbols){var Bt=Object.getOwnPropertySymbols(At);for(Ut=0;Ut<Bt.length;Ut++)Rt=Bt[Ut],Ct.indexOf(Rt)>=0||Object.prototype.propertyIsEnumerable.call(At,Rt)&&(G[Rt]=At[Rt])}return G}(Y,ze));return r().createElement("img",Tt({},at,{onLoad:this.onImageLoad()}))}},{key:"getLazyLoadImage",value:function(){var Y=this.props,at=Y.beforeLoad,At=Y.className,Ct=Y.delayMethod,Rt=Y.delayTime,Ut=Y.height,G=Y.placeholder,Bt=Y.scrollPosition,he=Y.style,Ue=Y.threshold,Le=Y.useIntersectionObserver,Ve=Y.visibleByDefault,An=Y.width;return r().createElement(tn,{beforeLoad:at,className:At,delayMethod:Ct,delayTime:Rt,height:Ut,placeholder:G,scrollPosition:Bt,style:he,threshold:Ue,useIntersectionObserver:Le,visibleByDefault:Ve,width:An},this.getImg())}},{key:"getWrappedLazyLoadImage",value:function(Y){var at=this.props,At=at.effect,Ct=at.height,Rt=at.placeholderSrc,Ut=at.width,G=at.wrapperClassName,Bt=at.wrapperProps,he=this.state.loaded,Ue=he?" lazy-load-image-loaded":"",Le=he||!Rt?{}:{backgroundImage:"url(".concat(Rt,")"),backgroundSize:"100% 100%"};return r().createElement("span",Tt({className:G+" lazy-load-image-background "+At+Ue,style:qn(qn({},Le),{},{color:"transparent",display:"inline-block",height:Ct,width:Ut})},Bt),Y)}},{key:"render",value:function(){var Y=this.props,at=Y.effect,At=Y.placeholderSrc,Ct=Y.visibleByDefault,Rt=Y.wrapperClassName,Ut=Y.wrapperProps,G=this.getLazyLoadImage();return(at||At)&&!Ct||Rt||Ut?this.getWrappedLazyLoadImage(G):G}}])&&qt(P.prototype,Z),Object.defineProperty(P,"prototype",{writable:!1}),Pt}(r().Component);ft.propTypes={onLoad:l.PropTypes.func,afterLoad:l.PropTypes.func,beforeLoad:l.PropTypes.func,delayMethod:l.PropTypes.string,delayTime:l.PropTypes.number,effect:l.PropTypes.string,placeholderSrc:l.PropTypes.string,threshold:l.PropTypes.number,useIntersectionObserver:l.PropTypes.bool,visibleByDefault:l.PropTypes.bool,wrapperClassName:l.PropTypes.string,wrapperProps:l.PropTypes.object},ft.defaultProps={onLoad:function(){},afterLoad:function(){return{}},beforeLoad:function(){return{}},delayMethod:"throttle",delayTime:300,effect:"",placeholderSrc:null,threshold:100,useIntersectionObserver:!0,visibleByDefault:!1,wrapperClassName:""};let wt=ft})(),B4.exports=i})()});var eG={};h6(eG,{AnnotationContext:()=>Lk,AnnotationPageContext:()=>Dk,AnnotationStyleProvider:()=>P7,AtlasStoreProvider:()=>Ad,AtlasStoreReactContext:()=>mu,Auth:()=>Q1,AuthProvider:()=>Y1,AuthRContext:()=>Fl,AuthReactContext:()=>pO,AuthReactContextActions:()=>mO,CanvasAnnotations:()=>Tk,CanvasContext:()=>qa,CanvasPanel:()=>Xn,CanvasStrategyProvider:()=>ME,CanvasWorldObject:()=>_E,CollectionContext:()=>Pk,CombinedMetadata:()=>Rk,ComplexTimelineProvider:()=>UR,ContextBridge:()=>Np,ControlsReactContext:()=>hp,CreateCustomShape:()=>LE,CustomContextBridge:()=>h4,CustomContextBridgeProvider:()=>nk,DEFAULT_BEZIER:()=>Kp,DEFAULT_POLL_INTERVAL:()=>VE,DefaultEditingTools:()=>S4,EASING_PRESETS:()=>jE,EventEmitterProvider:()=>Xj,EventsProvider:()=>ek,Image:()=>D4,ImageService:()=>Ak,ImageServiceLoaderContext:()=>KD,InnerViewerProvider:()=>xO,LanguageProvider:()=>G7,LanguageString:()=>sP,LocaleString:()=>_a,ManifestContext:()=>D1,ManifestMetadata:()=>Mk,MediaPlayerProvider:()=>dp,Metadata:()=>Xp,PolygonSelector:()=>wk,RangeContext:()=>P1,ReactEmitterContext:()=>Gv,ReactEventContext:()=>Mu,ReactVaultContext:()=>hs,RegionHighlight:()=>xR,Render3DModelStrategy:()=>_R,RenderAccompanyingCanvas:()=>zR,RenderAnnotation:()=>yu,RenderAnnotationEditing:()=>gE,RenderAnnotationPage:()=>Ws,RenderAnnotationStrategy:()=>PR,RenderAudioStrategy:()=>FR,RenderComplexTimelineStrategy:()=>GR,RenderEmptyStrategy:()=>YR,RenderImageStrategy:()=>XR,RenderSvgEditorControls:()=>Nk,RenderTextualContentStrategy:()=>QR,RenderVideoStrategy:()=>ZR,RenderYouTubeStrategy:()=>WR,ResizeWorldItem:()=>bR,ResourceProvider:()=>Li,ResourceReactContext:()=>xf,SelectorControllerProvider:()=>bk,SequenceThumbnails:()=>zk,SimpleViewerProvider:()=>Z1,SimpleViewerReactContext:()=>Ec,SingleCanvasThumbnail:()=>FE,StrategyReactContext:()=>$s,ThumbnailFallbackImage:()=>wu,TranslationProvider:()=>k7,TransliterationProvider:()=>Y7,VaultProvider:()=>co,ViewerPresetContext:()=>xr,VirtualAnnotationProvider:()=>DR,VisibleCanvasReactContext:()=>Bl,annotationResponseToSelector:()=>tG,authDetailsForResource:()=>j1,buildTransitions:()=>GE,cachedParseCssToBoxStyleMap:()=>RS,convertBoxStyleToSelectorStyle:()=>O2,convertSelectorStyleToBoxStyle:()=>Fm,createAtlasStore:()=>dR,createAuthStateStore:()=>U1,createProbe:()=>V1,cubicBezierEasing:()=>Yd,defaultEmitter:()=>d4,defaultSvgTheme:()=>vP,emptyActions:()=>yE,emptyStrategy:()=>vE,expandTarget:()=>wn,findAllCanvasesInRange:()=>wg,findFirstCanvasFromRange:()=>ZM,findManifestSelectedRange:()=>oF,findSelectedRange:()=>B1,flattenAnnotationPageIds:()=>bE,formatTime:()=>Jv,get3dStrategy:()=>wE,getAtlasStoreByName:()=>pR,getComplexTimelineStrategy:()=>RE,getDefaultAnnotationStyles:()=>mR,getImageStrategy:()=>Up,getManifestSequence:()=>Tg,getParsedTargetSelector:()=>Pp,getRenderingStrategy:()=>kp,getSelectorTransformAttributes:()=>ss,getStepFromProgress:()=>YE,getTextualContentStrategy:()=>Vp,getVideoStrategy:()=>jp,getVisibleCanvasesFromCanvasId:()=>sF,hasAuth:()=>MF,interpolateRect:()=>kE,isBoxSelector:()=>L7,isImageApiSelector:()=>qm,isRectangle:()=>Rd,isSvgSelector:()=>ED,isValidCanvasFragment:()=>Um,makeAccessServiceRequest:()=>q1,makeAccessTokenRequest:()=>Cg,parseCssToBoxStyleMap:()=>SS,parseCssTransform:()=>wS,parseCssTransformOrigin:()=>xS,parseCssTransformStyle:()=>TS,parseRotation:()=>Vm,parseSelector:()=>so,parseSpecificResource:()=>ok,polygonToTarget:()=>Ed,requestToAnnotationResponse:()=>op,resolveSelectorStyle:()=>ls,seraliseSupportedSelector:()=>Kv,splitCanvasFragment:()=>Cl,svgThemes:()=>vk,targetIntersects:()=>Jk,unknownResponse:()=>Bp,unsupportedStrategy:()=>on,useAnnotation:()=>lp,useAnnotationPage:()=>wR,useAnnotationPageManager:()=>Fp,useAnnotationStyles:()=>sp,useAnnotationsAtTime:()=>Bk,useAtlasContextMenu:()=>Dp,useAtlasStore:()=>$e,useAuthActions:()=>gO,useAuthService:()=>yO,useAuthStore:()=>Tc,useAuthToken:()=>_F,useAuthTokens:()=>k1,useCanvas:()=>Wt,useCanvasChoices:()=>Hk,useCanvasClock:()=>Fk,useCanvasSequence:()=>H1,useCanvasStartTime:()=>fp,useCanvasSubset:()=>qk,useClosestLanguage:()=>uP,useCollection:()=>Uk,useComplexTimeline:()=>j7,useContextBridge:()=>Ip,useContextMenuStore:()=>b4,useCreateLocaleString:()=>X7,useCurrentAnnotationActions:()=>Vk,useCurrentAnnotationMetadata:()=>jk,useCurrentAnnotationRequest:()=>mE,useCurrentAnnotationTransition:()=>kk,useCurrentAuth:()=>OF,useCustomContextBridge:()=>zp,useDispatch:()=>IR,useEmitter:()=>uR,useEvent:()=>pu,useEventEmitter:()=>Op,useEventListener:()=>Gk,useExistingVault:()=>fo,useExternalCollection:()=>Yk,useExternalManifest:()=>L1,useExternalResource:()=>If,useIIIFLanguage:()=>u0,useImage:()=>q0,useImageService:()=>UE,useImageServiceLoader:()=>pp,useImageTile:()=>Xk,useIsAuthEnabled:()=>X1,useLoadImageService:()=>qp,useLocaleString:()=>cP,useManifest:()=>Tn,useMediaActions:()=>H7,useMediaElements:()=>F7,useMediaState:()=>B7,usePaintables:()=>xE,usePaintingAnnotations:()=>Go,usePolygonHelper:()=>JR,useRange:()=>Nf,useRemoteStylesheet:()=>yR,useRenderControls:()=>Bi,useRenderingStrategy:()=>AE,useRequestAnnotation:()=>NE,useResourceContext:()=>wi,useResourceEvents:()=>cp,useResources:()=>SE,useSearchService:()=>K1,useSelectorController:()=>PE,useSelectorEmitter:()=>Sk,useSelectorEvents:()=>DE,useSelectorHelper:()=>xk,useSimpleMediaPlayer:()=>vu,useSimpleViewer:()=>ql,useStaticRenderingStrategy:()=>Qk,useStrategy:()=>dn,useStyleHelper:()=>Kk,useStyles:()=>gu,useStylesheetStore:()=>CD,useSvgEditor:()=>$R,useSvgEditorControls:()=>qE,useThumbnail:()=>qo,useTranslations:()=>jR,useTransliteration:()=>VR,useVault:()=>ce,useVaultEffect:()=>BR,useVaultSelector:()=>_e,useViewerPreset:()=>mp,useViewportScroll:()=>Wk,useViewportTour:()=>Zk,useVirtualAnnotationPage:()=>NR,useVirtualAnnotationPageContext:()=>LR,useVisibleCanvases:()=>Hl});function vf(t){"@babel/helpers - typeof";return vf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},vf(t)}function m6(t,e){if(vf(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var i=n.call(t,e||"default");if(vf(i)!="object")return i;throw TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function g6(t){var e=m6(t,"string");return vf(e)=="symbol"?e:e+""}function kn(t,e,n){return(e=g6(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var y6=Object.create,A2=Object.defineProperty,v6=Object.getOwnPropertyDescriptor,b6=Object.getOwnPropertyNames,S6=Object.getPrototypeOf,x6=Object.prototype.hasOwnProperty,yS=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var w6=(t,e,n,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(var a=b6(e),r=0,l=a.length,u;r<l;r++)u=a[r],!x6.call(t,u)&&u!==n&&A2(t,u,{get:(f=>e[f]).bind(null,u),enumerable:!(i=v6(e,u))||i.enumerable});return t},vS=(t,e,n)=>(n=t==null?{}:y6(S6(t)),w6(e||!t||!t.__esModule?A2(n,"default",{value:t,enumerable:!0}):n,t));var T6=/^(-?(?:\d+|\d*\.\d+))(px|%)?$/,R6=/^(-?(?:\d+|\d*\.\d+))(deg|rad|turn)?$/,C2=/([a-zA-Z0-9]+)\(([^)]*)\)/g;function E6(t){if(t==="%")return"percent";if(!t||t==="px")return"pixel"}function ac(t){let e=T6.exec(t.trim());if(e)return{value:Number.parseFloat(e[1]),unit:E6(e[2])}}function A6(t){let[e,n=e]=t.trim().split(/\s+/),i=ac(e),a=ac(n);if(!i||!a)return;let r={x:i.value,y:a.value};return i.unit&&i.unit===a.unit?r.unit=i.unit:(i.unit&&(r.xUnit=i.unit),a.unit&&(r.yUnit=a.unit)),r}function C6(t){let e=R6.exec(t.trim());if(!e)return;let n=Number.parseFloat(e[1]),i=e[2]||"deg";return i==="rad"?n*180/Math.PI:i==="turn"?n*360:n}function bS(t,e){return t?{x:t.x+e.x,y:t.y+e.y,...t.unit&&t.unit===e.unit?{unit:t.unit}:{}}:e}function SS(t){let e={},n=t.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\s+/g," ").trim(),i=/([^{]+)\{([^}]+)\}/g,a;for(;(a=i.exec(n))!==null;){let r=a[1].trim(),l=a[2].trim(),u=r.match(/\.([a-zA-Z0-9_-]+)/);if(!u)continue;let f=u[1],h=l.split(";").filter(m=>m.trim()),d={};for(let m of h){let[y,g]=m.split(":").map(b=>b.trim());if(!(!y||!g))switch(y){case"background-color":d.backgroundColor=g;break;case"opacity":d.opacity=parseFloat(g);break;case"box-shadow":d.boxShadow=g;break;case"border-color":d.borderColor=g;break;case"border-width":d.borderWidth=g;break;case"border-style":d.borderStyle=g;break;case"outline-color":d.outlineColor=g;break;case"outline-width":d.outlineWidth=g;break;case"outline-offset":d.outlineOffset=g;break;case"outline-style":d.outlineStyle=g;break;case"border":d.border=g;break;case"outline":d.outline=g;break;case"background":d.background=g;break;case"transform":d.transform=g;break;case"transform-origin":d.transformOrigin=g;break}}e[f]=d}return e}function Fm(t){let e={};return t&&(t.fill&&(e.backgroundColor=t.fill,t.fillOpacity),t.stroke&&(e.borderColor=t.stroke),t.strokeWidth&&(e.borderWidth=t.strokeWidth)),e}function O2(t){let e={};if(t.backgroundColor&&(e.fill=t.backgroundColor),!e.fill&&t.background&&(e.fill=t.background),t.opacity!==void 0&&(e.fillOpacity=t.opacity),t.borderColor&&(e.stroke=t.borderColor),!e.stroke&&t.border){let n=t.border.split(" ").find(i=>i.startsWith("#")||i.startsWith("rgb")||i.match(/^[a-z]+$/i));n&&(e.stroke=n)}if(t.borderWidth&&(e.strokeWidth=t.borderWidth),!e.strokeWidth&&t.border){let n=t.border.split(" ").find(i=>i.match(/^\d+(?:px|em|rem|%)?$/));n&&(e.strokeWidth=n)}return e}function xS(t){if(t)return A6(t)}function wS(t){let e={};if(!t)return e;e.transform=t;let n;for(C2.lastIndex=0;(n=C2.exec(t))!==null;){let i=n[1].toLowerCase(),a=n[2].split(",").flatMap(r=>r.trim().split(/\s+/)).filter(Boolean);if(i==="rotate"){let r=C6(a[0]||"");r!==void 0&&(e.rotation=r);continue}if(i==="translatex"){let r=ac(a[0]||"");r&&(e.translate=bS(e.translate,{x:r.value,y:0,...r.unit?{unit:r.unit}:{}}));continue}if(i==="translatey"){let r=ac(a[0]||"");r&&(e.translate=bS(e.translate,{x:0,y:r.value,...r.unit?{unit:r.unit}:{}}));continue}if(i==="translate"){let r=ac(a[0]||""),l=ac(a[1]||"0");if(r&&l){let u={x:r.value,y:l.value};r.unit&&r.unit===l.unit?u.unit=r.unit:(r.unit&&(u.xUnit=r.unit),l.unit&&(u.yUnit=l.unit)),e.translate=bS(e.translate,u)}}}return e}function TS(t){let e=wS(t?.transform),n=xS(t?.transformOrigin);return t?.transformOrigin&&(e.transformOrigin=t.transformOrigin),n&&(e.rotationOrigin=n),e}function ss(t){let e=TS(t),n={};return e.rotation!==void 0&&(n.rotation=e.rotation),e.rotationOrigin&&(n.rotationOrigin=e.rotationOrigin),e.translate&&(n.translate=e.translate),(e.rotation!==void 0||e.rotationOrigin||e.translate||e.transform||e.transformOrigin)&&(n.transform=e),n}var M2=new Map;function RS(t,e){let n=M2.get(t);if(n?.css===e)return n.styleMap;let i=SS(e);return M2.set(t,{css:e,styleMap:Object.fromEntries(Object.entries(i).map(([a,r])=>[a,r]))}),i}function ls(t,e,n={}){if(!t||!e)return Fm(n||{});let i=Fm(n||{}),a=Object.entries(e);for(let[r,l]of a){if(!l)continue;let u=RS(r,l),f=Object.entries(u);for(let[h,d]of f)h===t&&Object.assign(i,d)}return i}function M6(t,e,n,i=1){return new N2(t,e,n).subdivide(i)}function O6(t,e,n,i,a=1){return new z6(new Float64Array([t.x,t.y,e.x,e.y,n.x,n.y,i.x,i.y])).subdivide(a)}function _6(t){return t.x*t.x+t.y*t.y}function bf(t){let e=.67;return t/(1-e+(e**4+.25*t*t)**.25)}function rc(t){let e=.39;return t*(1-e+Math.sqrt(e*e+.25*t*t))}var N2=class{constructor(t,e,n){kn(this,"start",void 0),kn(this,"control",void 0),kn(this,"end",void 0),this.start=t,this.control=e,this.end=n}eval(t){let e=1-t;return{x:this.start.x*e*e+2*this.control.x*e*t+this.end.x*t*t,y:this.start.y*e*e+2*this.control.y*e*t+this.end.y*t*t}}mapToBasic(){let{x:t,y:e}=this.start,{x:n,y:i}=this.control,{x:a,y:r}=this.end,l=2*n-t-a,u=2*i-e-r,f=(n-t)*l+(i-e)*u,h=(a-n)*l+(r-i)*u,d=(a-t)*u-(r-e)*l,m=f/d,y=h/d;return{x0:t,x2:a,scale:Math.abs(d)/(Math.hypot(l,u)*Math.abs(y-m)),cross:d}}subdivide(t){let e=this.mapToBasic(),n=bf(e.x0),i=bf(e.x2),a=.5*Math.abs(i-n)*Math.sqrt(e.scale/t),r=Math.ceil(a),l=rc(n),u=rc(i),f=[0];for(let h=1;h<r;h++){let d=(rc(n+(i-n)*h/r)-l)/(u-l);f.push(d)}return f.push(1),f.map(h=>this.eval(h))}},z6=class L2{constructor(e){kn(this,"c",void 0),this.c=e}weightsum(e,n,i,a){return{x:e*this.c[0]+n*this.c[2]+i*this.c[4]+a*this.c[6],y:e*this.c[1]+n*this.c[3]+i*this.c[5]+a*this.c[7]}}eval(e){let n=1-e,i=n*n*n,a=3*n*n*e,r=3*n*e*e,l=e*e*e;return this.weightsum(i,a,r,l)}deriv(e){let n=1-e,i=-3*n*n,a=3*e*e,r=-6*e*n-i,l=6*e*n-a;return this.weightsum(i,r,l,a)}midpoint_quadbez(){let e=this.weightsum(-.25,.75,.75,-.25);return new N2({x:this.c[0],y:this.c[1]},e,{x:this.c[6],y:this.c[7]})}subsegment(e,n){let i=new Float64Array(8),a=this.eval(e),r=this.eval(n);i[0]=a.x,i[1]=a.y;let l=(n-e)/3,u=this.deriv(e);i[2]=a.x+l*u.x,i[3]=a.y+l*u.y;let f=this.deriv(n);return i[4]=r.x-l*f.x,i[5]=r.y-l*f.y,i[6]=r.x,i[7]=r.y,new L2(i)}subdivide(e){let n=.1*e,i=e-n,a=Math.sqrt(i),r=_6(this.weightsum(1,-3,3,-1)),l=Math.ceil((r/(432*n*n))**(1/6)),u=[],f=0;for(let b=0;b<l;b++){let w=b/l,E=(b+1)/l,T=this.subsegment(w,E).midpoint_quadbez(),S=T.mapToBasic(),R=bf(S.x0),A=bf(S.x2),M=Math.sqrt(S.scale),z=Math.abs(A-R)*M;if(Math.sign(S.x0)!=Math.sign(S.x2)){let I=a/M,L=a*Math.abs(A-R)/bf(I);z=Math.max(z,L)}u.push({quad:T,a0:R,a2:A,val:z}),f+=z}let h=.5*f/a,d=Math.ceil(h),m=[{x:this.c[0],y:this.c[1]}],y=0,g=0;for(let b=1;b<d;b++){let w=f*b/d;for(;y+u[g].val<w;)y+=u[g].val,g++;let E=u[g].a0,T=u[g].a2,S=rc(E),R=rc(T),A=(rc(E+(T-E)*(w-y)/u[g].val)-S)/(R-S);m.push(u[g].quad.eval(A))}return m.push({x:this.c[6],y:this.c[7]}),m}},I6=function(){function t(e,n){var i=[],a=!0,r=!1,l=void 0;try{for(var u=e[Symbol.iterator](),f;!(a=(f=u.next()).done)&&(i.push(f.value),!(n&&i.length===n));a=!0);}catch(h){r=!0,l=h}finally{try{!a&&u.return&&u.return()}finally{if(r)throw l}}return i}return function(e,n){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,n);throw TypeError("Invalid attempt to destructure non-iterable instance")}}(),Sf=Math.PI*2,ES=function(t,e,n,i,a,r,l){var u=t.x,f=t.y;u*=e,f*=n;var h=i*u-a*f,d=a*u+i*f;return{x:h+r,y:d+l}},N6=function(t,e){var n=e===1.5707963267948966?.551915024494:e===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(e/4),i=Math.cos(t),a=Math.sin(t),r=Math.cos(t+e),l=Math.sin(t+e);return[{x:i-a*n,y:a+i*n},{x:r+l*n,y:l-r*n},{x:r,y:l}]},_2=function(t,e,n,i){var a=t*i-e*n<0?-1:1,r=t*n+e*i;return r>1&&(r=1),r<-1&&(r=-1),a*Math.acos(r)},L6=function(t,e,n,i,a,r,l,u,f,h,d,m){var y=a**2,g=r**2,b=d**2,w=m**2,E=y*g-y*w-g*b;E<0&&(E=0),E/=y*w+g*b,E=Math.sqrt(E)*(l===u?-1:1);var T=E*a/r*m,S=E*-r/a*d,R=h*T-f*S+(t+n)/2,A=f*T+h*S+(e+i)/2,M=(d-T)/a,z=(m-S)/r,I=(-d-T)/a,L=(-m-S)/r,H=_2(1,0,M,z),V=_2(M,z,I,L);return u===0&&V>0&&(V-=Sf),u===1&&V<0&&(V+=Sf),[R,A,H,V]},D6=function(t){var e=t.px,n=t.py,i=t.cx,a=t.cy,r=t.rx,l=t.ry,u=t.xAxisRotation,f=u===void 0?0:u,h=t.largeArcFlag,d=h===void 0?0:h,m=t.sweepFlag,y=m===void 0?0:m,g=[];if(r===0||l===0)return[];var b=Math.sin(f*Sf/360),w=Math.cos(f*Sf/360),E=w*(e-i)/2+b*(n-a)/2,T=-b*(e-i)/2+w*(n-a)/2;if(E===0&&T===0)return[];r=Math.abs(r),l=Math.abs(l);var S=E**2/r**2+T**2/l**2;S>1&&(r*=Math.sqrt(S),l*=Math.sqrt(S));var R=I6(L6(e,n,i,a,r,l,d,y,b,w,E,T),4),A=R[0],M=R[1],z=R[2],I=R[3],L=Math.abs(I)/(Sf/4);Math.abs(1-L)<1e-7&&(L=1);var H=Math.max(Math.ceil(L),1);I/=H;for(var V=0;V<H;V++)g.push(N6(z,I)),z+=I;return g.map(function(nt){var X=ES(nt[0],r,l,w,b,A,M),mt=X.x,lt=X.y,it=ES(nt[1],r,l,w,b,A,M),yt=it.x,xt=it.y,et=ES(nt[2],r,l,w,b,A,M);return{x1:mt,y1:lt,x2:yt,y2:xt,x:et.x,y:et.y}})},P6=yS((t,e)=>{e.exports=a;var n={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},i=/([astvzqmhlc])([^astvzqmhlc]*)/gi;function a(u){var f=[];return u.replace(i,function(h,d,m){var y=d.toLowerCase();for(m=l(m),y=="m"&&m.length>2&&(f.push([d].concat(m.splice(0,2))),y="l",d=d=="m"?"l":"L");;){if(m.length==n[y])return m.unshift(d),f.push(m);if(m.length<n[y])throw Error("malformed path data");f.push([d].concat(m.splice(0,n[y])))}}),f}var r=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/gi;function l(u){var f=u.match(r);return f?f.map(Number):[]}}),B6=yS((t,e)=>{e.exports=n;function n(i){var a=0,r=0,l=0,u=0;return i.map(function(f){f=f.slice();var h=f[0],d=h.toUpperCase();if(h!=d)switch(f[0]=d,h){case"a":f[6]+=l,f[7]+=u;break;case"v":f[1]+=u;break;case"h":f[1]+=l;break;default:for(var m=1;m<f.length;)f[m++]+=l,f[m++]+=u}switch(d){case"Z":l=a,u=r;break;case"H":l=f[1];break;case"V":u=f[1];break;case"M":l=a=f[1],u=r=f[2];break;default:l=f[f.length-2],u=f[f.length-1]}return f})}}),H6=vS(P6(),1),F6=vS(B6(),1);function q6(t){let e=(0,F6.default)((0,H6.default)(t)),n,i=0,a=0,r=0,l=0,u,f,h=0,d=0,m=[];for(let y=0;y<e.length;y++){let g=e[y],b=g[0];switch(b){case"M":i=g[1],a=g[2];break;case"H":g=["L",g[1],a];break;case"V":g=["L",i,g[1]];break;case"S":{let w=h,E=d;(n==="C"||n=="S")&&(w+=w-r,E+=E-l),g=["C",w,E,g[1],g[2],g[3],g[4]]}break;case"T":n==="Q"||n=="T"?(u=h*2-u,f=d*2-f):(u=h,f=d),g=["Q",u,f,g[1],g[2]];break;case"Q":u=g[1],f=g[2];break;case"A":{let w=D6({px:h,py:d,cx:g[6],cy:g[7],rx:g[1],ry:g[2],xAxisRotation:g[3],largeArcFlag:g[4],sweepFlag:g[5]});if(!w.length)continue;for(let[E,T]of w.entries())g=["C",T.x1,T.y1,T.x2,T.y2,T.x,T.y],E<w.length-1&&m.push(g);g=g}break;case"Z":g=["L",i,a];break}n=b,h=g[g.length-2],d=g[g.length-1],["C","Q","A"].indexOf(b)>-1?(r=g[g.length-4],l=g[g.length-3]):(r=h,l=d),m.push(g)}return m}var U6=/&?(xywh=)?(pixel:|percent:|pct:)?([0-9]+(?:\.[0-9]+)?),([0-9]+(?:\.[0-9]+)?),([0-9]+(?:\.[0-9]+)?),([0-9]+(?:\.[0-9]+)?)/,z2=/&?(t=)(npt:)?([0-9]+(\.[0-9]+)?)?(,([0-9]+(\.[0-9]+)?))?/,I2=/^rgba\((\d+),(\d+),(\d+),([0-9.]+)\)$/;function so(t,{domParser:e,svgPreprocessor:n,iiifRenderingHints:i,loadedStylesheets:a}={},{styleClass:r}={}){if(Array.isArray(t))return Fa(t.reduce((l,u)=>{let{selector:f,selectors:h,iiifRenderingHints:d}=so(u,{domParser:e,svgPreprocessor:n,iiifRenderingHints:i,loadedStylesheets:a},{styleClass:r});return f&&(l.selector?(!l.selector.temporal&&f.temporal&&(l.selector.temporal=f.temporal),!l.selector.spatial&&f.spatial&&(l.selector.spatial=f.spatial),!l.selector.svg&&f.svg&&(l.selector.svg=f.svg),!l.selector.svgShape&&f.svgShape&&(l.selector.svgShape=f.svgShape)):l.selector=f,l.selectors.push(...h)),d&&(l.iiifRenderingHints=l.iiifRenderingHints||{type:"ImageApiSelector"},Object.assign(l.iiifRenderingHints,d)),l},{selector:null,selectors:[],iiifRenderingHints:i}));if(!t)return Fa({selector:null,selectors:[],iiifRenderingHints:i});if(typeof t=="string"){let[l,u]=Cl(t);return u?so({type:"FragmentSelector",value:u},{svgPreprocessor:n,iiifRenderingHints:i,domParser:e,loadedStylesheets:a},{styleClass:r}):Fa({selector:null,selectors:[],iiifRenderingHints:i})}if(t.type){if(t.type==="PointSelector"&&(t.t||t.t===0)){let l={type:"TemporalSelector",temporal:{startTime:t.t}};return Fa({selector:l,selectors:[l],iiifRenderingHints:i})}if(t.type==="PointSelector"&&t.x&&t.y){let l={type:"PointSelector",spatial:{x:t.x,y:t.y}};return Fa({selector:l,selectors:[l],iiifRenderingHints:i})}}if(qm(t)){let l=[];if(t.region){let u=so({type:"FragmentSelector",value:"xywh="+t.region},{domParser:e,svgPreprocessor:n,iiifRenderingHints:i,loadedStylesheets:a},{styleClass:r});l.push(...u.selectors)}return Fa({selector:l[0],selectors:l,iiifRenderingHints:i?{...i,...t}:t})}if(t.type==="FragmentSelector"){let l=U6.exec(t.value);if(l){let f=ls(r,a),h={type:"BoxSelector",spatial:{unit:l[2]==="percent:"||l[2]==="pct:"?"percent":"pixel",x:Number.parseFloat(l[3]),y:Number.parseFloat(l[4]),width:Number.parseFloat(l[5]),height:Number.parseFloat(l[6])},boxStyle:f,...ss(f)},d=t.value.match(z2);if(d){let m=ls(r,a);h={type:"TemporalBoxSelector",spatial:h.spatial,temporal:{startTime:d[3]?Number.parseFloat(d[3]):0,endTime:d[6]?Number.parseFloat(d[6]):void 0},boxStyle:m,...ss(m)}}return Fa({selector:h,selectors:[h],iiifRenderingHints:i})}let u=t.value.match(z2);if(u){let f={type:"TemporalSelector",temporal:{startTime:u[3]?Number.parseFloat(u[3]):0,endTime:u[6]?Number.parseFloat(u[6]):void 0}};return Fa({selector:f,selectors:[f],iiifRenderingHints:i})}return Fa({selector:null,selectors:[],iiifRenderingHints:i})}if(t.type==="SvgSelector"&&"value"in t){e||(typeof window<"u"?e=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 l=[],u,f,h=n?.(t.value)??t.value,d;if(e){let g=e.parseFromString(t.value,"image/svg+xml").querySelector("svg");if(!g)return console.warn(`Illegal SVG selector: ${t.value}`),Fa({selector:null,selectors:[],iiifRenderingHints:i});let b=D2(g);b&&(l=b.points,d=b.shapeType,u=[Math.min(...l.map(w=>w[0])),Math.min(...l.map(w=>w[1])),Math.max(...l.map(w=>w[0])),Math.max(...l.map(w=>w[1]))],{style:f,svg:h}=k6(b.element)??{svg:h})}let m=ls(r,a,f),y={type:"SvgSelector",svg:h,svgShape:d,style:f,boxStyle:m,...ss(m),points:l.length?l:void 0,spatial:u?{unit:"pixel",x:u[0],y:u[1],width:u[2]-u[0],height:u[3]-u[1]}:void 0};return Fa({selector:y,selectors:[y],iiifRenderingHints:i})}return Fa({selector:null,selectors:[],iiifRenderingHints:i})}function V6(t){let e=t.map(i=>i[0]).reduce((i,a)=>(i[a]+=1,i),{C:0,Q:0,L:0,M:0}),n=new Set(t.map(i=>i[0]));if(e.C>0||e.Q>0)return"path";if(e.L>0&&(n.size===1||n.size===2&&n.has("M"))){if(e.L===4)return"rect";let i=t.slice(-1)[0];return t[0][0]==="M"&&i[0]==="L"&&i[1]==t[0][1]&&i[2]===t[0][2]||i[1]===0&&i[2]===0?"polygon":"polyline"}return"path"}function D2(t){for(let e of Array.from(t.children))switch(e?.tagName.toLowerCase()){case"g":{let n=D2(e);if(n)return n}continue;case"path":{let n=e.getAttribute("d");if(!n)continue;let i=q6(n);return{element:e,points:j6(i),shapeType:V6(i)}}case"circle":{let n=Number.parseFloat(e.getAttribute("cx")??"0"),i=Number.parseFloat(e.getAttribute("cy")??"0"),a=Number.parseFloat(e.getAttribute("r")??"0");if(!a)continue;let r=[];for(let l=0;l<=360;l+=12){let u=l*Math.PI/180;r.push([n+a*Math.cos(u),i+a*Math.sin(u)])}return{element:e,points:r,shapeType:"circle"}}case"ellipse":{let n=Number.parseFloat(e.getAttribute("cx")??"0"),i=Number.parseFloat(e.getAttribute("cy")??"0"),a=Number.parseFloat(e.getAttribute("rx")??"0"),r=Number.parseFloat(e.getAttribute("ry")??"0");if(!a&&!r)continue;let l=[];for(let u=0;u<=360;u+=12){let f=Math.tan(u/360*Math.PI),h=a*(1-f**2)/(1+f**2),d=r*2*f/(1+f**2);l.push([n+h,i+d])}return{element:e,points:l,shapeType:"ellipse"}}case"line":{let n=Number.parseFloat(e.getAttribute("x0")??"0"),i=Number.parseFloat(e.getAttribute("y0")??"0"),a=Number.parseFloat(e.getAttribute("x1")??"0"),r=Number.parseFloat(e.getAttribute("y1")??"0");if(n===a&&i===r)continue;return{element:e,points:[[n,i],[a,r]],shapeType:"polyline"}}case"polygon":case"polyline":{let n=e.getAttribute("points")?.split(" ").map(a=>a.split(",").map(Number.parseFloat))??[];if(!n.length)continue;let i="polyline";return e.tagName.toLowerCase()==="polygon"&&(n.push(n[0]),i="polygon"),{element:e,points:n,shapeType:i}}case"rect":{let n=Number.parseFloat(e.getAttribute("x")??"0"),i=Number.parseFloat(e.getAttribute("y")??"0"),a=Number.parseFloat(e.getAttribute("width")??"0"),r=Number.parseFloat(e.getAttribute("height")??"0");if(!a||!r)continue;return{element:e,points:[[n,i],[n+a,i],[n+a,i+r],[n,i+r],[n,i]],shapeType:"rect"}}default:continue}return null}function j6(t){let e=[];for(let n=0;n<t.length;n++){let i=e[e.length-1]??[0,0],a=t[n];switch(a[0]){case"M":case"L":e.push([a[1],a[2]]);continue;case"C":e.push(...O6({x:i[0],y:i[1]},{x:a[1],y:a[2]},{x:a[3],y:a[4]},{x:a[5],y:a[6]}).map(r=>[r.x,r.y]).slice(1));continue;case"Q":e.push(...M6({x:i[0],y:i[1]},{x:a[1],y:a[2]},{x:a[3],y:a[4]}).map(r=>[r.x,r.y]).slice(1));continue}}return e}function k6(t){let e={};if(t.hasAttribute("fill")?(e.fill=t.getAttribute("fill"),t.removeAttribute("fill")):t.style&&t.style.fill&&(e.fill=t.style.fill),e.fill){let i=I2.exec(e.fill);i&&(e.fillOpacity=Number.parseFloat(i[4]),e.fill=`rgb(${i[1]}, ${i[2]}, ${i[3]})`)}if(t.hasAttribute("fill-opacity")?(e.fillOpacity=Number.parseFloat(t.getAttribute("fill-opacity")),t.removeAttribute("fill-opacity")):t.style&&t.style.fillOpacity&&(e.fillOpacity=Number.parseFloat(t.style.fillOpacity)),t.hasAttribute("stroke")?(e.stroke=t.getAttribute("stroke"),t.removeAttribute("stroke")):t.style&&t.style.stroke&&(e.stroke=t.style.stroke),e.stroke){let i=I2.exec(e.stroke);i&&(e.strokeOpacity=Number.parseFloat(i[4]),e.stroke=`rgb(${i[1]}, ${i[2]}, ${i[3]})`)}t.hasAttribute("stroke-opacity")?(e.strokeOpacity=Number.parseFloat(t.getAttribute("stroke-opacity")),t.removeAttribute("stroke-opacity")):t.style&&t.style.strokeOpacity&&(e.strokeOpacity=Number.parseFloat(t.style.strokeOpacity)),t.hasAttribute("stroke-width")?(e.strokeWidth=t.getAttribute("stroke-width"),t.removeAttribute("stroke-width")):t.style&&t.style.strokeWidth&&(e.strokeWidth=t.style.strokeWidth),t.hasAttribute("stroke-dasharray")?(e.strokeDasharray=t.getAttribute("stroke-dasharray"),t.removeAttribute("stroke-dasharray")):t.style&&t.style.strokeDasharray&&(e.strokeDasharray=t.style.strokeDasharray);let n=t;for(;n.tagName.toLowerCase()!=="svg";)if(n=n.parentElement,n===null)throw Error("Could not find root SVG element");return{svg:n.outerHTML,style:Object.keys(e).length>0?e:void 0}}function qm(t){if(!t)return!1;let e=t.type||t["@type"];return e==="iiif:ImageApiSelector"||e==="ImageApiSelector"}function Cl(t){let[e,n]=t.split("#");return!n||!Um(n)?[t,""]:[e,n]}function Um(t){return t.includes("xywh=")||t.includes("t=")}function Fa(t){if(t.iiifRenderingHints){let e=t.iiifRenderingHints;if(e.rotation){let n=Vm(`${e.rotation}`);if(n)if(t.selectors.length)for(let i of t.selectors)i.rotation=n;else t.selectors.push({type:"RotationSelector",rotation:n})}}else delete t.iiifRenderingHints;return t}function Vm(t){let e=Number.parseFloat(t);return e&&t.startsWith("!")&&(e=360-e),e&&(e%=360),e===e&&e||0}function wn(t,e={}){if(Array.isArray(t))return wn(t[0],e);if(typeof t=="string"){let[n,i]=Cl(t);return i?wn({type:"SpecificResource",source:{id:n,type:e.typeMap&&e.typeMap[n]||e.defaultType||"Canvas"},selector:{type:"FragmentSelector",value:i}},e):{type:"SpecificResource",source:{id:n,type:e.typeMap&&e.typeMap[n]||e.defaultType||"Canvas"},selector:null,selectors:[]}}if(t.type==="Choice"||t.type==="List"||t.type==="Composite"||t.type==="Independents")return wn(t.items[0],e);if(!t.type&&"source"in t&&(t.type="SpecificResource"),t.type==="SpecificResource"){t.source.type==="Canvas"&&t.source.partOf&&typeof t.source.partOf=="string"&&(t.source.partOf=[{id:t.source.partOf,type:"Manifest"}]);let n=t.styleClass||e.styleClass,i={selector:null,selectors:[]};if(typeof t.source=="string"){let[,l]=Cl(t.source);if(l){let u=wn(t.source,{...e,styleClass:n});t.source=u.source,i={selector:u.selector,selectors:u.selectors}}}let{selector:a,selectors:r}=t.selector?so(t.selector,e,{styleClass:n}):i;return{type:"SpecificResource",source:t.source,selector:a,selectors:r}}if(t.id){t.type==="Canvas"&&t.partOf&&typeof t.partOf=="string"&&(t.partOf=[{id:t.partOf,type:"Manifest"}]);let[n,i]=Cl(t.id);return i?wn({type:"SpecificResource",source:{...t,id:n},selector:{type:"FragmentSelector",value:i}},e):{type:"SpecificResource",source:{...t,id:n},selector:null,selectors:[]}}return{type:"SpecificResource",source:t,selector:null,selectors:[]}}var _u=N(ct(),1);var oc=N(ct(),1),q2=N(tt(),1),X6={collection:void 0,manifest:void 0,range:void 0,canvas:void 0,annotation:void 0,annotationPage:void 0},xf=oc.default.createContext(X6),wi=()=>(0,oc.useContext)(xf);function Li({value:t,children:e}){let n=wi(),i=(0,oc.useMemo)(()=>({...n,...t}),[t,n]);return(0,q2.jsx)(xf.Provider,{value:i,children:e})}var U2=N(tt(),1);function qa({canvas:t,children:e}){return(0,U2.jsx)(Li,{value:{canvas:t},children:e})}var Sg=N(ct(),1);var j2={},V2=t=>{let e,n=new Set,i=(u,f)=>{let h=typeof u=="function"?u(e):u;if(!Object.is(h,e)){let d=e;e=f??(typeof h!="object"||!h)?h:Object.assign({},e,h),n.forEach(m=>m(e,d))}},a=()=>e,r={setState:i,getState:a,getInitialState:()=>l,subscribe:u=>(n.add(u),()=>n.delete(u)),destroy:()=>{(j2.env?j2.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."),n.clear()}},l=e=t(i,a,r);return r},km=t=>t?V2(t):V2;function Gm(t){return{all:t=t||new Map,on:function(e,n){var i=t.get(e);i?i.push(n):t.set(e,[n])},off:function(e,n){var i=t.get(e);i&&(n?i.splice(i.indexOf(n)>>>0,1):t.set(e,[]))},emit:function(e,n){var i=t.get(e);i&&i.slice().map(function(a){a(n)}),(i=t.get("*"))&&i.slice().map(function(a){a(e,n)})}}}function wf(t){"@babel/helpers - typeof";return wf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},wf(t)}function Q6(t,e){if(wf(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var i=n.call(t,e||"default");if(wf(i)!="object")return i;throw TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function K6(t){var e=Q6(t,"string");return wf(e)=="symbol"?e:e+""}function Ir(t,e,n){return(e=K6(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function lr(t){return Array.isArray(t)?t:t?[t]:[]}function ur(t){for(let e in t)(t[e]===void 0||t[e]===null)&&delete t[e];return t}function ma(t){return typeof t=="string"?!1:t&&!t.type&&"source"in t?(t.type="SpecificResource",!0):!!t&&t.type==="SpecificResource"}function Ym(...t){return e=>t.reduce((n,i)=>i(n),e)}var AS=["Collection","Manifest","Canvas","AnnotationPage","AnnotationCollection","Annotation","ContentResource","Range","Service","Selector","Agent"];function k2(t,e){if(t==null)throw Error("Null or undefined is not a valid entity.");if(Array.isArray(t))throw Error("Array is not a valid entity");if(typeof t!="object"){if(e)return e;throw Error(`${typeof t} is not a valid entity`)}if(typeof t.type=="string"){let n=AS.indexOf(t.type);if(n!==-1)return AS[n]}if(t.profile)return"Service";throw Error("Resource type is not known")}var CS=class G2{constructor(e,n={}){Ir(this,"traversals",void 0),Ir(this,"options",void 0),Ir(this,"_traverseManifest",Ym(this.traverseManifestItems.bind(this),this.traverseNavPlace.bind(this),this.traverseLinking.bind(this),this.traverseDescriptive.bind(this),this.traverseLinkedCanvases.bind(this),this.traverseManifestStructures.bind(this),this.traverseInlineAnnotationPages.bind(this))),Ir(this,"_traverseCanvas",Ym(this.traverseCanvasItems.bind(this),this.traverseLinking.bind(this),this.traverseDescriptive.bind(this),this.traverseLinkedCanvases.bind(this),this.traverseInlineAnnotationPages.bind(this))),Ir(this,"_traverseAnnotationPage",Ym(this.traverseAnnotationPageItems.bind(this),this.traverseLinking.bind(this),this.traverseDescriptive.bind(this))),Ir(this,"_traverseRange",Ym(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:[],...e},this.options={allowUndefinedReturn:!1,...n}}static all(e){return new G2({collection:[e],manifest:[e],canvas:[e],annotationCollection:[e],annotationPage:[e],annotation:[e],contentResource:[e],choice:[e],range:[e],service:[e],geoJson:[e],specificResource:[e],agent:[e]})}traverseDescriptive(e){return e.thumbnail&&(e.thumbnail=lr(e.thumbnail).map(n=>this.traverseType(n,{parent:e},this.traversals.contentResource))),e.provider&&(e.provider=e.provider.map(n=>this.traverseAgent(n,e))),e}traverseLinking(e){return e.seeAlso&&(e.seeAlso=lr(e.seeAlso).map(n=>this.traverseType(n,{parent:e},this.traversals.contentResource))),e.service&&(e.service=lr(e.service).map(n=>this.traverseService(n))),e.services&&(e.services=lr(e.services).map(n=>this.traverseService(n,e))),e.logo&&(e.logo=lr(e.logo).map(n=>this.traverseType(n,{parent:e},this.traversals.contentResource))),e.homepage&&(e.homepage=lr(e.homepage).map(n=>this.traverseType(n,{parent:e},this.traversals.contentResource))),e.partOf&&(e.partOf=e.partOf.map(n=>typeof n=="string"||!n.type?this.traverseType(n,{parent:e},this.traversals.contentResource):n.type==="Canvas"?this.traverseType(n,{parent:e},this.traversals.canvas):n.type==="AnnotationCollection"?this.traverseType(n,{parent:e},this.traversals.annotationCollection):n.type==="Collection"?this.traverseType(n,{parent:e},this.traversals.collection):this.traverseType(n,{parent:e},this.traversals.contentResource))),e.start&&(ma(e.start)?e.start=this.traverseSpecificResource(e.start,"Canvas",e):e.start=this.traverseType(e.start,{parent:e},this.traversals.canvas)),e.rendering&&(e.rendering=e.rendering.map(n=>this.traverseType(n,{parent:e},this.traversals.contentResource))),e.supplementary&&(e.supplementary=e.supplementary.map(n=>this.traverseType(n,{parent:e},this.traversals.contentResource))),e}traverseCollectionItems(e){return e.items&&e.items.map(n=>n.type==="Collection"?this.traverseCollection(n):this.traverseManifest(n)),e}traverseCollection(e,n){return this.traverseType(this.traverseDescriptive(this.traverseNavPlace(this.traverseInlineAnnotationPages(this.traverseLinking(this.traverseLinkedCanvases(this.traverseCollectionItems(e)))))),{parent:n},this.traversals.collection)}traverseGeoJson(e,n){return this.traverseType(e,{parent:n},this.traversals.geoJson)}traverseNavPlace(e){return e.navPlace&&(e.navPlace=this.traverseGeoJson(e.navPlace,e)),e}traverseManifestItems(e){return e.items&&(e.items=e.items.map(n=>this.traverseCanvas(n))),e}traverseManifestStructures(e){return e.structures&&(e.structures=e.structures.map(n=>this.traverseRange(n))),e}traverseManifest(e,n){return this.traverseType(this._traverseManifest(e),{parent:n},this.traversals.manifest)}traverseCanvasItems(e){return e.items=(e.items||[]).map(n=>this.traverseAnnotationPage(n,e)),e}traverseInlineAnnotationPages(e){return typeof e=="string"||!e||e.annotations&&(e.annotations=e.annotations.map(n=>this.traverseAnnotationPage(n,e))),e}traverseCanvas(e,n){return this.traverseType(this._traverseCanvas(e),{parent:n},this.traversals.canvas)}traverseAnnotationPageItems(e){return e.items&&(e.items=e.items.map(n=>this.traverseAnnotation(n,e))),e}traverseAnnotationPage(e,n){return this.traverseType(this._traverseAnnotationPage(e),{parent:n},this.traversals.annotationPage)}traverseAnnotationBody(e){return Array.isArray(e.body)?e.body=e.body.map(n=>this.traverseContentResource(n,e)):e.body&&(e.body=this.traverseContentResource(e.body,e)),e}traverseLinkedCanvases(e){return e.placeholderCanvas&&(e.placeholderCanvas=this.traverseCanvas(e.placeholderCanvas)),e.accompanyingCanvas&&(e.accompanyingCanvas=this.traverseCanvas(e.accompanyingCanvas)),e}traverseAnnotation(e,n){return this.traverseType(this.traverseLinking(this.traverseAnnotationBody(this.traverseDescriptive(e))),{parent:n},this.traversals.annotation)}traverseContentResourceLinking(e){return typeof e=="string"||!e||e&&e.service&&(e.service=lr(e.service||[]).map(n=>this.traverseService(n,e))),e}traverseContentResource(e,n){return e.type==="Choice"&&(e.items=e.items.map(i=>this.traverseContentResource(i,e))),ma(e)?this.traverseSpecificResource(e,"ContentResource"):this.traverseType(this.traverseInlineAnnotationPages(this.traverseContentResourceLinking(e)),{parent:n},this.traversals.contentResource)}traverseSpecificResource(e,n,i){let a=e.source;return typeof e.source=="string"&&(a={id:e.source,type:n||"unknown"}),this.traverseType({...e,source:n==="Canvas"||a.type==="Canvas"?this.traverseType(a,{parent:i},this.traversals.canvas):n==="ContentResource"?this.traverseContentResource(a,{parent:i}):this.traverseUnknown(a,{parent:i,typeHint:n})},{parent:i},this.traversals.specificResource)}traverseRangeRanges(e){return e.items&&(e.items=e.items.map(n=>typeof n=="string"?this.traverseCanvas({id:n,type:"Canvas"},e):ma(n)?this.traverseSpecificResource(n,"Canvas",e):n.type==="Manifest"?this.traverseManifest(n,e):this.traverseRange(n,e))),e}traverseRange(e,n){return this.traverseType(this._traverseRange(e),{parent:n},this.traversals.range)}traverseAgent(e,n){return this.traverseType(this.traverseDescriptive(this.traverseLinking(e)),{parent:n},this.traversals.agent)}traverseType(e,n,i){return i.reduce((a,r)=>{let l=r(a,n);return l===void 0&&!this.options.allowUndefinedReturn?a:l},e)}traverseService(e,n){let i=Object.assign({},e);return i&&i.service&&(i.service=lr(i.service).map(a=>this.traverseService(a))),this.traverseType(i,{parent:n},this.traversals.service)}traverseUnknown(e,{parent:n,typeHint:i}={}){let a=k2(e,i);switch(a){case"Collection":return this.traverseCollection(e,n);case"Manifest":return this.traverseManifest(e,n);case"Canvas":return this.traverseCanvas(e,n);case"AnnotationPage":return this.traverseAnnotationPage(e,n);case"Annotation":return this.traverseAnnotation(e,n);case"ContentResource":return this.traverseContentResource(e,n);case"Range":return this.traverseRange(e,n);case"Service":return this.traverseService(e,n);case"Agent":return this.traverseAgent(e,n);default:throw Error(`Unknown or unsupported resource type of ${a}`)}}};var MS="http://library.stanford.edu/iiif/image-api/compliance.html#level0",OS="http://library.stanford.edu/iiif/image-api/compliance.html#level1",_S="http://library.stanford.edu/iiif/image-api/compliance.html#level2",zS="http://library.stanford.edu/iiif/image-api/conformance.html#level0",IS="http://library.stanford.edu/iiif/image-api/conformance.html#level1",NS="http://library.stanford.edu/iiif/image-api/conformance.html#level2",LS="http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level0",DS="http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level1",PS="http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level2",BS="http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level0",HS="http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level1",FS="http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level2",qS="http://iiif.io/api/image/1/level0.json",US="http://iiif.io/api/image/1/profiles/level0.json",VS="http://iiif.io/api/image/1/level1.json",jS="http://iiif.io/api/image/1/profiles/level1.json",kS="http://iiif.io/api/image/1/level2.json",GS="http://iiif.io/api/image/1/profiles/level2.json",YS="http://iiif.io/api/image/2/level0.json",XS="http://iiif.io/api/image/2/profiles/level0.json",QS="http://iiif.io/api/image/2/level1.json",KS="http://iiif.io/api/image/2/profiles/level1.json",ZS="http://iiif.io/api/image/2/level2.json",WS="http://iiif.io/api/image/2/profiles/level2.json",JS="level0",$S="level1",t1="level2",e1="http://iiif.io/api/image/2/level0",n1="http://iiif.io/api/image/2/level1",i1="http://iiif.io/api/image/2/level2",sc=[i1,_S,NS,PS,FS,kS,GS,ZS,WS,t1],Xm=[...sc,n1,OS,IS,DS,HS,VS,jS,QS,KS,$S],a1=[e1,n1,i1,MS,OS,_S,zS,IS,NS,LS,DS,PS,BS,HS,FS,qS,US,VS,jS,kS,GS,YS,XS,QS,KS,ZS,WS,JS,$S,t1],r1=a1,o1=[e1,MS,zS,LS,BS,qS,US,YS,XS,JS],Y2={extraFormats:["jpg"],extraQualities:["default"],extraFeatures:["sizeByWhListed"]},X2={extraFormats:["jpg"],extraQualities:["default"],extraFeatures:["baseUriRedirect","cors","jsonldMediaType","regionByPx","regionSquare","sizeByWhListed","sizeByH","sizeByW","sizeByWh"]},Q2={extraFormats:["jpg","png"],extraQualities:["default"],extraFeatures:["baseUriRedirect","cors","jsonldMediaType","regionByPct","regionByPx","regionSquare","rotationBy90s","sizeByWhListed","sizeByConfinedWh","sizeByH","sizeByPct","sizeByW","sizeByWh"]};var K2=["sc:Collection","sc:Manifest","sc:Canvas","sc:AnnotationList","oa:Annotation","sc:Range","sc:Layer","sc:Sequence","oa:Choice","Service","ContentResource"];function Z6(t){if(t==null)throw Error("Null or undefined is not a valid entity.");if(Array.isArray(t))throw Error("Array is not a valid entity");if(typeof t!="object")throw Error(`${typeof t} is not a valid entity`);if(typeof t["@type"]=="string"){let e=K2.indexOf(t["@type"]);if(e!==-1)return K2[e]}if(t.profile)return"Service";if(t.format||t["@type"])return"ContentResource";throw Error("Resource type is not known")}var W6=class $2{constructor(e,n={}){Ir(this,"traversals",void 0),Ir(this,"options",void 0),this.traversals={collection:[],manifest:[],canvas:[],annotationList:[],sequence:[],annotation:[],contentResource:[],choice:[],range:[],service:[],layer:[],...e},this.options={convertPropsToArray:!0,mergeMemberProperties:!0,allowUndefinedReturn:!1,...n}}static all(e){return new $2({collection:[e],manifest:[e],canvas:[e],annotationList:[e],sequence:[e],annotation:[e],contentResource:[e],choice:[e],range:[e],service:[e],layer:[e]})}traverseCollection(e){return this.traverseType(this.traverseDescriptive(this.traverseLinking(this.traverseCollectionItems(e))),this.traversals.collection)}traverseCollectionItems(e){if(this.options.mergeMemberProperties){let n=[...(e.manifests||[]).map(r=>typeof r=="string"?{"@id":r,"@type":"sc:Manifest"}:(r["@type"]||(r["@type"]="sc:Manifest"),r)),...(e.collections||[]).map(r=>typeof r=="string"?{"@id":r,"@type":"sc:Collection"}:r),...e.members||[]],i=[],a=n.filter(r=>i.includes(r["@id"])?!1:(i.push(r["@id"]),!0));delete e.collections,delete e.manifests,e.members=a}return e.manifests&&(e.manifests=e.manifests.map(n=>{let i=n;return typeof n=="string"&&(i={"@id":n,"@type":"sc:Manifest"}),i["@type"]||(i["@type"]="sc:Manifest"),this.traverseManifest(i)})),e.collections&&(e.collections=e.collections.map(n=>this.traverseCollection(typeof n=="string"?{"@id":n,"@type":"sc:Collection"}:n))),e.members&&(e.members=e.members.map(n=>typeof n=="string"?n:n["@type"]==="sc:Collection"?this.traverseCollection(n):n["@type"]==="sc:Manifest"?this.traverseManifest(n):this.traverseUnknown(n))),e}traverseManifest(e){return this.traverseType(this.traverseDescriptive(this.traverseLinking(this.traverseManifestItems(e))),this.traversals.manifest)}traverseManifestItems(e){return e.sequences&&(e.sequences=e.sequences.map(n=>this.traverseSequence(n))),e.structures&&(e.structures=e.structures.map(n=>this.traverseRange(n))),e}traverseSequence(e){return this.traverseType(this.traverseDescriptive(this.traverseLinking(this.traverseSequenceItems(e))),this.traversals.sequence)}traverseSequenceItems(e){return e.canvases&&(e.canvases=e.canvases.map(n=>this.traverseCanvas(n))),e}traverseCanvas(e){return this.traverseType(this.traverseDescriptive(this.traverseLinking(this.traverseCanvasItems(e))),this.traversals.canvas)}traverseCanvasItems(e){return e.images&&(e.images=e.images.map(n=>(n.on&&n["@type"]!=="oa:Annotation"&&n["@type"]!=="Annotation"&&(n["@type"]="oa:Annotation"),this.traverseAnnotation(n)))),e.otherContent&&(e.otherContent=e.otherContent.map(n=>this.traverseAnnotationList(n))),e}traverseRange(e){return e["@type"]!=="sc:Range"&&(e["@type"]="sc:Range"),this.traverseType(this.traverseDescriptive(this.traverseLinking(this.traverseRangeItems(e))),this.traversals.range)}traverseRangeItems(e){if(this.options.mergeMemberProperties){let n=[...(e.ranges||[]).map(i=>typeof i=="string"?{"@id":i,"@type":"sc:Range"}:i),...(e.canvases||[]).map(i=>typeof i=="string"?{"@id":i,"@type":"sc:Canvas"}:i),...e.members||[]];delete e.ranges,delete e.canvases,e.members=n.length?n.map(i=>this.traverseUnknown(i)):void 0}return e}traverseAnnotationList(e){let n=typeof e=="string"?{"@id":e,"@type":"sc:AnnotationList"}:e;return this.traverseType(this.traverseDescriptive(this.traverseAnnotationListItems(n)),this.traversals.annotationList)}traverseAnnotationListItems(e){return e.resources&&(e.resources=e.resources.map(n=>this.traverseAnnotation(n))),e}traverseAnnotation(e){return this.traverseType(this.traverseDescriptive(this.traverseLinking(this.traverseAnnotationItems(e))),this.traversals.annotation)}traverseAnnotationItems(e){return e.resource&&(Array.isArray(e.resource)?e.resource=e.resource.map(n=>this.traverseContentResource(n)):e.resource=this.traverseContentResource(e.resource)),e.on,e}traverseLayer(e){return this.traverseType(this.traverseLinking(this.traverseLayerItems(e)),this.traversals.layer)}traverseLayerItems(e){return e.otherContent&&(e.otherContent=e.otherContent.map(n=>this.traverseAnnotationList(n))),e}traverseChoice(e){return this.traverseType(this.traverseChoiceItems(e),this.traversals.choice)}traverseChoiceItems(e){return e.default&&e.default!=="rdf:nil"&&(e.default=this.traverseContentResource(e.default)),e.item&&e.item!=="rdf:nil"&&(e.item=e.item.map(n=>this.traverseContentResource(n))),e}traverseService(e){return this.traverseType(this.traverseLinking(e),this.traversals.service)}traverseContentResource(e){return e["@type"]==="oa:Choice"?this.traverseChoice(e):this.traverseType(this.traverseDescriptive(this.traverseLinking(e)),this.traversals.contentResource)}traverseUnknown(e){if(!e["@type"]||typeof e=="string")return e;switch(Z6(e)){case"sc:Collection":return this.traverseCollection(e);case"sc:Manifest":return this.traverseManifest(e);case"sc:Canvas":return this.traverseCanvas(e);case"sc:Sequence":return this.traverseSequence(e);case"sc:Range":return this.traverseRange(e);case"oa:Annotation":return this.traverseAnnotation(e);case"sc:AnnotationList":return this.traverseAnnotationList(e);case"sc:Layer":return this.traverseLayer(e);case"Service":return this.traverseService(e);case"oa:Choice":return this.traverseChoice(e);case"ContentResource":return this.traverseContentResource(e)}return e.profile?this.traverseService(e):e}traverseImageResource(e){let n=Array.isArray(e),i=Array.isArray(e)?e:[e],a=[];for(let r of i)typeof r=="string"?a.push(this.traverseContentResource({"@id":r,"@type":"dctypes:Image"})):a.push(this.traverseContentResource(r));return!n&&!this.options.convertPropsToArray?a[0]:a}traverseDescriptive(e){return e.thumbnail&&(e.thumbnail=this.traverseImageResource(e.thumbnail)),e.logo&&(e.logo=this.traverseImageResource(e.logo)),e}traverseOneOrMoreServices(e){let n=Array.isArray(e),i=Array.isArray(e)?e:[e],a=[];for(let r of i)a.push(this.traverseService(r));return!n&&!this.options.convertPropsToArray?a[0]:a}traverseLinking(e){return e.related&&(e.related=this.traverseOneOrManyType(e.related,this.traversals.contentResource)),e.rendering&&(e.rendering=this.traverseOneOrManyType(e.rendering,this.traversals.contentResource)),e.service&&(e.service=this.traverseOneOrMoreServices(e.service)),e.seeAlso&&(e.seeAlso=this.traverseOneOrManyType(e.seeAlso,this.traversals.contentResource)),e.within&&(typeof e.within=="string"||(e.within=this.traverseOneOrManyType(e.within,this.traversals.contentResource))),e.startCanvas&&(typeof e.startCanvas=="string"?e.startCanvas=this.traverseType({"@id":e.startCanvas,"@type":"sc:Canvas"},this.traversals.canvas):e.startCanvas&&this.traverseType(e.startCanvas,this.traversals.canvas)),e.contentLayer&&(typeof e.contentLayer=="string"?e.contentLayer=this.traverseLayer({"@id":e.contentLayer,"@type":"sc:Layer"}):e.contentLayer=this.traverseLayer(e.contentLayer)),e}traverseOneOrManyType(e,n){if(!Array.isArray(e))if(this.options.convertPropsToArray)e=[e];else return this.traverseType(e,n);return e.map(i=>this.traverseType(i,n))}traverseType(e,n){return n.reduce((i,a)=>{let r=a(i);return r===void 0&&!this.options.allowUndefinedReturn?i:r},e)}},J6=["http://iiif.io/api/image/2/level1","http://iiif.io/api/image/2/level2","http://library.stanford.edu/iiif/image-api/compliance.html#level1","http://library.stanford.edu/iiif/image-api/compliance.html#level2","http://library.stanford.edu/iiif/image-api/conformance.html#level1","http://library.stanford.edu/iiif/image-api/conformance.html#level2","http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level1","http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level2","http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level1","http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level2","http://iiif.io/api/image/1/level1.json","http://iiif.io/api/image/1/profiles/level1.json","http://iiif.io/api/image/1/level2.json","http://iiif.io/api/image/1/profiles/level2.json","http://iiif.io/api/image/2/level1.json","http://iiif.io/api/image/2/profiles/level1.json","http://iiif.io/api/image/2/level2.json","http://iiif.io/api/image/2/profiles/level2.json","level1","level2"],l1={attributionLabel:"Attribution",lang:"none",providerId:"http://example.org/provider",providerName:""};function $6(t){if(typeof t=="string")return[t];if(!t)return[];let e=Array.isArray(t)?t:[t],n=[];for(let i of e){if(typeof i=="string"){n.push(i);continue}n.push({"@language":i["@language"]||i.language,"@value":i["@value"]||i.value})}return n}function Ml(t,e="none"){if(!t)return{none:[""]};let n=$6(t),i={};for(let a of n){if(typeof a=="string"){i[e]=i[e]?i[e]:[],i[e].push(a||"");continue}if(!a["@language"]){i[e]=i[e]?i[e]:[],i[e].push(a["@value"]||"");continue}let r=a["@language"];i[r]=i[r]?i[r]:[],i[r].push(a["@value"]||"")}return Object.keys(i).length===0?{none:[""]}:i}function tM(t){if(Array.isArray(t))return tM(t.find(e=>typeof e=="string"));if(sc.indexOf(t)!==-1)return"level2";if(J6.indexOf(t)!==-1)return"level1";if(r1.indexOf(t)!==-1)return"level0";if(typeof t=="string")return t}function tH(t){let e=Array.isArray(t)?t:[t];for(let n of e)switch(n){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 eH(t){switch(t){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 Z2(t){for(let e of["sc","oa","dcterms","dctypes","iiif"])if(t.startsWith(`${e}:`))return t.slice(e.length+1);return t}var nH=["Collection","Manifest","Annotation","AnnotationPage","Range","Service"];function c1(t){let e=t["@id"]||t.id,n=t["@type"]||t.type,i=t.profile||void 0,a=t["@context"]||void 0;if(i){let r=eH(i);if(r)return r}if(a){let r=tH(a);if(r)return r}if(n){if(Array.isArray(n)){if(n.indexOf("oa:CssStylesheet")!==-1)return"CssStylesheet";if(n.indexOf("cnt:ContentAsText")!==-1)return"TextualBody";n=n[0]}for(let r of["sc","oa","dcterms","dctypes","iiif"])if(n.startsWith(`${r}:`)){n=n.slice(r.length+1);break}switch(n){case"Layer":return"AnnotationCollection";case"AnnotationList":return"AnnotationPage";case"cnt:ContentAsText":return"TextualBody"}}if(n&&nH.indexOf(n)!==-1)return n;if(t.format){if(t.format.startsWith("image/"))return"Image";if(t.format.startsWith("text/")||t.format==="application/pdf")return"Text";if(t.format.startsWith("application/"))return"Dataset"}return e&&(e.endsWith(".jpg")||e.endsWith(".png")||e.endsWith(".jpeg"))?"Image":n||"unknown"}var iH=/^|["'\\>]http(s)?:\/\/(creativecommons.org|rightsstatements.org)\/[^"'\\<\n]+/gm;function aH(t){let e=t.match(iH);return e?e[0]:t}function rH(t,e="Rights/License",n="none"){let i=null,a=[],r=Array.isArray(t)?t:[t];for(let l of r){let u=l?aH(l):void 0;if(u&&(u.indexOf("creativecommons.org")!==-1||u.indexOf("rightsstatements.org")!==-1)){i=u.startsWith("https://")?`http://${u.slice(8)}`:u;continue}u&&a.push({label:{[n]:[e]},value:{[n]:[u]}})}return[i,a]}var oH=["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 sH(t){if(t){let e=Array.isArray(t)?t:[t],n=[];for(let i of e)i==="http://iiif.io/api/presentation/2/context.json"&&n.push("http://iiif.io/api/presentation/3/context.json"),oH.indexOf(i)===-1&&n.push(i);if(e.length)return n.length===1?n[0]:n}}function lH(t){return t?t.map(e=>({label:Ml(e.label),value:Ml(e.value)})):[]}var W2=0;function eM(t,e){let n=encodeURI(t.id||t["@id"]||"").trim();return n&&e?`${n}/${e}`:n||(W2++,`http://example.org/${t["@type"]}${e?`/${e}`:""}/${W2}`)}function lo(t){let e=[...t.behavior||[]];t.viewingHint&&e.push(t.viewingHint);let n;return Array.isArray(t.motivation)?n=t.motivation.map(Z2):t.motivation&&(n=Z2(t.motivation)),{"@context":t["@context"]?sH(t["@context"]):void 0,id:(t["@id"]||eM(t)).trim(),type:c1(t),behavior:e.length?e:void 0,height:t.height?t.height:void 0,width:t.width?t.width:void 0,motivation:n,viewingDirection:t.viewingDirection,profile:t.profile,format:t.format?t.format:void 0,duration:void 0,timeMode:void 0}}function uo(t){let[e,n]=rH(t.license),i=[...t.metadata?lH(t.metadata):[],...n];return{rights:e,metadata:i.length?i:void 0,label:t.label?Ml(t.label):void 0,requiredStatement:t.attribution?{label:Ml(l1.attributionLabel),value:Ml(t.attribution)}:void 0,navDate:t.navDate,summary:t.description?Ml(t.description):void 0,thumbnail:uH(t.thumbnail)}}function uH(t){return t&&(Array.isArray(t)?t:[t]).map(n=>typeof n=="string"?{id:n,type:"Image"}:(n.type==="unknown"&&(n.type="Image"),n))}function cH(t){if(!t.within)return;let e=Array.isArray(t.within)?t.within:[t.within],n=[];for(let i of e)if(typeof i=="string"){if(i)switch(t["@type"]){case"sc:Manifest":n.push({id:i,type:"Collection"});break}}else i["@id"]&&n.push({id:i["@id"],type:c1(i)});return n.length?n:void 0}function us(t){let e=t.related?Array.isArray(t.related)?t.related:[t.related]:[],n=t.contentLayer;return{provider:t.logo||e.length?[{id:l1.providerId,type:"Agent",homepage:e.length?[e[0]]:void 0,logo:t.logo?Array.isArray(t.logo)?t.logo:[t.logo]:void 0,label:Ml(l1.providerName)}]:void 0,partOf:cH(t),rendering:t.rendering,seeAlso:t.seeAlso,start:t.startCanvas,service:t.service?lr(t.service):void 0,supplementary:n?[n]:void 0}}function dH(t){return{chars:t.chars,format:t.format?t.format:void 0,language:t.language}}function s1(t,e){return t?typeof t=="string"?{id:t,type:e}:typeof t?.["@id"]=="string"?{id:t["@id"],type:e}:typeof t.id=="string"?{id:t.id,type:e}:null:null}function fH(t){let e={};if(t.first){let n=s1(t.first,"Collection");n&&(e.first=n)}if((t.total||t.total===0)&&(e.total=t.total),t.prev){let n=s1(t.prev,"Collection");n&&(e.prev=n)}if(t.next){let n=s1(t.next,"Collection");n&&(e.next=n)}return e}function hH(t){let e=[];for(let n of t){let i={...n};i.items&&i.items.length===0&&delete i.items,e.push(i)}return e}function pH(t){return ur({...lo(t),...uo(t),...us(t),...fH(t),items:hH(t.members)})}function mH(t){let e=[],n=[],i,a;for(let l of t.sequences||[])l.canvases.length&&e.push(...l.canvases),l.behavior&&n.push(...l.behavior),l.viewingDirection&&(a=l.viewingDirection),l.startCanvas&&(i=l.startCanvas);let r=lo(t);return n.length&&(r.behavior?r.behavior.push(...n):r.behavior=n),ur({...r,...uo(t),...us(t),viewingDirection:a,start:i,items:e,structures:gH(t.structures)})}function gH(t){if(!t)return t;let e=new Map;for(let i of t)e.set(i.id,i);let n=[];for(let i of t)if(i.items){let a=i.items.map(r=>typeof r=="string"?(n.push(r),e.get(r)||r):r&&r.id?(n.push(r.id),e.get(r.id)||r):r);i.items=a}return t.filter(i=>n.indexOf(i.id)===-1)}function yH(t){return ur({...lo(t),...uo(t),...us(t),annotations:t.otherContent&&t.otherContent.length?t.otherContent:void 0,items:t.images&&t.images.length?[{id:eM(t,"annotation-page"),type:"AnnotationPage",items:t.images}]:void 0})}function vH(t){return ur({...lo(t),...uo(t),...us(t),items:t.resources&&t.resources.length?t.resources:void 0})}function bH(t){return!t.canvases||t.canvases.length===0?{canvases:[],behavior:[]}:{canvases:t.canvases,behavior:t.viewingHint?[t.viewingHint]:[],viewingDirection:t.viewingDirection,startCanvas:t.startCanvas}}function SH(t){function e(n){if(Array.isArray(n)){if(n.length>1)return{type:"List",items:n.map(e)};n=n[0]}if(typeof n=="string")return encodeURI(n).trim();if("@type"in n){let i;if(typeof n.full=="string")i=n.full;else if(n.full["@type"]==="dctypes:Image")i={id:n.full["@id"],type:"Image"};else if(n.full["@type"]==="sc:Canvas")i={id:n.full["@id"],type:"Canvas"};else throw Error(`Unsupported source type on annotation: ${n.full["@type"]}`);return{type:"SpecificResource",source:i,selector:u1(n.selector)}}else return encodeURI(n["@id"]).trim()}return ur({...lo(t),...uo(t),...us(t),target:e(t.on),body:Array.isArray(t.resource)?t.resource.map(J2):J2(t.resource)})}function J2(t){return t.type==="Choice"?t:nM(t)}function nM(t){let e=t;return ur({...lo(e),...uo(e),...us(e),...dH(e)})}function xH(t){let e=[];return t.default&&t.default!=="rdf:nil"&&e.push(t.default),t.item&&t.item!=="rdf:nil"&&e.push(...t.item),ur({...lo(t),...uo(t),items:e})}function wH(t){return ur({...lo(t),...uo(t),...us(t),items:t.members})}function TH(t){let{"@id":e,"@type":n,"@context":i,profile:a,...r}=t,l={};return e&&(l["@id"]=e),l["@type"]=c1(t),l["@type"]==="unknown"&&(i&&i.length&&(l["@context"]=i),l["@type"]="Service"),a&&(l.profile=tM(a)),ur({...l,...r})}function RH(t){return ur({...lo(t),...uo(t),...us(t)})}var EH=new W6({collection:[pH],manifest:[mH],canvas:[yH],annotationList:[vH],sequence:[bH],annotation:[SH],contentResource:[nM],choice:[xH],range:[wH],service:[TH],layer:[RH]});function iM(t){return t&&t["@context"]&&(t["@context"]==="http://iiif.io/api/presentation/2/context.json"||Array.isArray(t["@context"])&&t["@context"].indexOf("http://iiif.io/api/presentation/2/context.json")!==-1||t["@context"]==="http://www.shared-canvas.org/ns/context.json")||t["@context"]==="http://iiif.io/api/image/2/context.json"||t["@id"]&&t["@type"]==="sc:Collection"||t["@id"]&&t["@type"]==="sc:Manifest"?(t["@context"]||(t["@context"]="http://iiif.io/api/presentation/2/context.json"),EH.traverseUnknown(t)):t}function u1(t){if((Array.isArray(t["@type"])&&t["@type"].includes("oa:SvgSelector")||t["@type"]=="oa:SvgSelector")&&("chars"in t||"value"in t))return{type:"SvgSelector",value:"chars"in t?t.chars:t.value};if(t["@type"]==="oa:FragmentSelector")return{type:"FragmentSelector",value:t.value};if(t["@type"]==="oa:Choice")return[u1(t.default),...(Array.isArray(t.item)?t.item:[t.item]).map(u1)];if(t["@type"]=="iiif:ImageApiSelector")return{type:"ImageApiSelector",region:"region"in t?t.region:void 0,rotation:"rotation"in t?t.rotation:void 0};throw Error(`Unsupported selector type: ${t["@type"]}`)}function fc(t,e){let n=e||"unknown";if(!t)return;if(typeof t=="string")return{id:t,type:n};if(ma(t))return fc(t.source,e);let i=n&&n!=="unknown"?n:t.type||t["@type"],a=t.id||t["@id"];if(i&&i.indexOf(":")!==-1&&(i=i.split(":").pop()),a&&i)return{id:a,type:i}}var uc={},mn="iiif-parser:hasPart",ga="iiif-parser:partOf",cc="iiif-parser:isExternal",Ua="__$UNSET$__",f1="__$UNWRAP$__",Nt=[];Object.freeze(Nt),Object.freeze(uc);function oM(t){if(t===uc||Object.keys(t).length===0)return!0;for(let e in t)return!1;return!0}function hc(t,e){if(e&&e["@explicit"]){let n={},i=Object.keys(e);for(let a of i)a===ga||a==="@explicit"||(oM(e[a])?n[a]=t[a]:n[a]=e[a]);return n}return t}function h1(t,e,n){let i=fc(e);if(!i)return[void 0,void 0];let a=t.requests[i.id],r=i.type||t.mapping[i.id];if(!r||a&&a.resourceUri&&(!t.entities[r]||!t.entities[r][a.resourceUri]))return[void 0,void 0];let l=t.entities[r][a?a.resourceUri:i.id];if(i.type&&!l)return h1(t,{id:i.id},n);if(l&&l[mn]){let u=l[mn].find(h=>n?h[ga]===n.id:h[ga]===l.id);return[hc(l,u),l]}return[l,l]}var sM={id:"https://iiif-parser/annotation-page",type:"AnnotationPage",behavior:Nt,label:null,thumbnail:Nt,summary:null,requiredStatement:null,metadata:Nt,rights:null,provider:Nt,items:Nt,seeAlso:Nt,homepage:Nt,rendering:Nt,service:Nt},lM={id:"https://iiif-parser/empty-canvas",type:"Canvas",label:null,behavior:Nt,thumbnail:Nt,accompanyingCanvas:null,placeholderCanvas:null,summary:null,requiredStatement:null,metadata:Nt,rights:null,navDate:null,provider:Nt,items:Nt,annotations:Nt,seeAlso:Nt,homepage:Nt,partOf:Nt,rendering:Nt,service:Nt,duration:0,height:0,width:0},uM={id:"https://iiif-parser/empty-collection",type:"Collection",label:null,viewingDirection:"left-to-right",behavior:Nt,thumbnail:Nt,accompanyingCanvas:null,placeholderCanvas:null,summary:null,requiredStatement:null,metadata:Nt,rights:null,navDate:null,provider:Nt,items:Nt,annotations:Nt,seeAlso:Nt,homepage:Nt,partOf:Nt,rendering:Nt,service:Nt,services:Nt},cM={id:"https://iiif-parser/empty-manifest",type:"Manifest",annotations:Nt,behavior:Nt,homepage:Nt,items:Nt,label:null,metadata:Nt,navDate:null,provider:Nt,partOf:Nt,accompanyingCanvas:null,placeholderCanvas:null,rendering:Nt,requiredStatement:null,rights:null,seeAlso:Nt,service:Nt,services:Nt,start:null,structures:Nt,summary:null,thumbnail:Nt,viewingDirection:"left-to-right"},dM={id:"https://iiif-parser/empty-canvas",type:"Range",label:null,behavior:Nt,thumbnail:Nt,accompanyingCanvas:null,placeholderCanvas:null,summary:null,requiredStatement:null,metadata:Nt,rights:null,navDate:null,provider:Nt,items:Nt,annotations:Nt,seeAlso:Nt,homepage:Nt,partOf:Nt,rendering:Nt,service:Nt,start:null,supplementary:null,viewingDirection:"left-to-right"},fM={id:"https://iiif-parser/empty-agent",type:"Agent",label:{},logo:Nt,seeAlso:Nt,homepage:Nt},hM={id:"https://iiif-parser/empty-service",type:"UnknownService"};function Qm(t){let[e,n]=(t||"").split("#");return!n||!AH(n)?[t||"",""]:[e,n]}function AH(t){return t.includes("xywh=")||t.includes("t=")}function Km(t,e={}){if(Array.isArray(t))return Km(t[0]);if(typeof t=="string"){let[n,i]=Qm(t);return i?{type:"SpecificResource",source:{id:n,type:e.typeHint||"Unknown"},selector:{type:"FragmentSelector",value:i}}:{type:"SpecificResource",source:{id:n,type:e.typeMap&&e.typeMap[n]||e.typeHint||"Unknown"}}}if(t.type==="Choice"||t.type==="List"||t.type==="Composite"||t.type==="Independents")return Km(t.items[0]);if(!t.type&&"source"in t&&(t.type="SpecificResource"),t.type==="SpecificResource"){t.source.type==="Canvas"&&t.source.partOf&&typeof t.source.partOf=="string"&&(t.source.partOf=[{id:t.source.partOf,type:"Manifest"}]);let n=typeof t.source=="string"?t.source:t.source.id,[,i]=Qm(n);if(i){let a=Km(n,e);a&&(t.selector=a.selector,t.source=a.source)}return t.selector?{...t,type:"SpecificResource",source:t.source,selector:t.selector}:{...t,type:"SpecificResource",source:t.source}}if(t.id){t.type==="Canvas"&&t.partOf&&typeof t.partOf=="string"&&(t.partOf=[{id:t.partOf,type:"Manifest"}]);let[n,i]=Qm(t.id);return i?{type:"SpecificResource",source:{...t,id:n},selector:{type:"FragmentSelector",value:i}}:{type:"SpecificResource",source:{...t,id:n}}}return{type:"SpecificResource",source:t}}function pM(){return{Collection:{},Manifest:{},Canvas:{},AnnotationPage:{},AnnotationCollection:{},Annotation:{},ContentResource:{},Range:{},Service:{},Selector:{},Agent:{}}}function mM(t,e){if(typeof t=="string")return{id:t,type:e};if(!t.id)throw Error(`Invalid resource does not have an ID (${JSON.stringify(t)}, ${e})`);return t}function CH(t,e){return(n,i)=>{let a=t[n]?t[n]:{};return(r,l)=>{let u=mM(r,i||n);return u&&u.id&&n?(a[u.id]=a[u.id]?Jm(a[u.id],u,{parent:l.parent,isTopLevel:e.id===u.id}):Jm({id:u.id,type:u.type},u,{parent:l.parent,isTopLevel:e.id===u.id}),{id:u.id,type:n==="ContentResource"?n:u.type}):u}}}function Wm(t,e,n){if(!e)return t;if(Array.isArray(t)){if(!Array.isArray(e))throw Error("Cannot merge array with non-array");let i=[...t];for(let a of e)if(a["@id"]&&!a.id&&(a.id=a["@id"]),a["@type"]&&!a.type&&(a.type=a["@type"]),a!=null)if(Array.isArray(a))i.push(a);else if(typeof a=="object"&&a.id&&a.type){let r=i.findIndex(l=>l.id===a.id&&l.type===a.type);r>=0&&(i[r]=Wm(i[r],a))}else t.indexOf(a)===-1&&i.push(a);return i}else if(typeof t=="object"){if(Array.isArray(e)||typeof e!="object")throw Error("Cannot merge object with non-object");let i={...t},a=[],r=[],l=Object.keys(t).filter(h=>h!==mn&&h!=="id"&&h!=="type"),u={},f={};for(let[h,d]of Object.entries(e)){if(h===mn||h==="id"||h==="type")continue;let m=i[h];m===d?r.push(h):m===Nt||!m?(a.push(h),i[h]=d):(m&&d&&(u[h]=m,f[h]=d),i[h]=Wm(m,d),i[h]===u[h]&&(r.push(h),delete u[h]))}if(n&&(n.parent&&n.parent.id||n.isTopLevel)){let h=[],d={};if(n.parent?d[ga]=n.parent.id:n.isTopLevel&&(d[ga]=t.id),i[mn]&&i[mn].length){let m=!(i[mn]||[]).find(g=>g["@explicit"]),y=a.length>0||r.length!==l.length;if(m&&y)for(let g of i[mn]){let b={...g},w=Object.keys(u);if(b){b["@explicit"]=!0;for(let E of l)E!==mn&&(b[E]=uc);for(let E of w)b[E]=u[E]}h.push(b)}else h.push(...i[mn]);if(y){let g=Object.keys(f);d["@explicit"]=!0;for(let b of a)d[b]=uc;for(let b of r)d[b]=uc;for(let b of g)d[b]=f[b]}}d.id=i.id,d.type=i.type,h.push(d),i[mn]=h}return i}else if(t)return t;return e}function Jm(t,e,n){if(typeof t=="string")return t;if(e.id!==t.id||e.type!==t.type){if(e.type==="ImageService3")return e;if(t.type==="ImageService3")return t;throw Error(`Can only merge entities with identical identifiers and type! ${e.type}(${e.id}) => ${t.type}(${t.id})`)}return Wm({...t},e,n)}function MH(t){return(e,n)=>i=>{let{id:a,type:r}=mM(i,n||e);if(a===void 0)throw Error("Found invalid entity without an ID.");return e==="ContentResource"||e==="Service"?t[a]=e:t[a]=r,i}}function OH(t){let e=Object.assign({},t);if(e["@id"]&&(e.id=e["@id"]),e["@type"]&&(e.type=e["@type"]),e.service){let n=[];e.service=Array.isArray(e.service)?e.service:[e.service];for(let i of e.service)n.push({id:i["@id"]||i.id,type:i["@type"]||i.type});e.service=n}return Object.assign({},hM,e)}function _H(t){return e=>{t.Service=t.Service?t.Service:{};let n=e.id||e["@id"],i=OH(e);return i&&i.id&&(t.Service[i.id]?t.Service[n]=Jm(t.Service[n],i):t.Service[n]=i),e}}function zH(t){let e=JSON.stringify(t),n=5381,i=e.length;for(;i;)n=n*33^e.charCodeAt(--i);let a=n>>>0,r=a.toString(16);return r.length%2?"0"+r:r}function d1(t){return e=>typeof e=="string"?{id:e,type:t}:e.id?e.type?e:{type:t,...e}:{id:`vault://${zH(e)}`,type:t,...e}}function lc(t){return e=>({...t,...e})}function Tf(t){return Array.isArray(t)?t:[t]}function IH(t){return t.body&&(t.body=Tf(t.body)),t.seeAlso&&(t.seeAlso=Tf(t.seeAlso)),t.audience&&(t.audience=Tf(t.audience)),t.accessibility&&(t.accessibility=Tf(t.accessibility)),t.motivation&&(t.motivation=Tf(t.motivation)),t}function gM(t,{typeHint:e,partOfTypeHint:n}={}){if(typeof t=="string"&&(t={id:t,type:e||"unknown"}),ma(t))return typeof t.source=="string"&&(t.source={id:t.source,type:e||"unknown"}),t.source.type==="Canvas"&&t.source.partOf&&typeof t.source.partOf=="string"&&(t.source.partOf=[{id:t.source.partOf,type:n||"Manifest"}]),t;let i,[a,r]=Qm(t.id);return t.id=a,r&&r&&(i={type:"FragmentSelector",value:r}),{type:"SpecificResource",source:t,selector:i}}function NH(t){let e=Object.assign({},t);return t&&t.items&&(e.items=t.items.map(n=>typeof n=="string"||n.type==="Canvas"?gM(n):n)),e}function LH(t){let e=Object.assign({},t);return e.start?(e.start=gM(e.start,{typeHint:"Canvas"}),e):t}function DH(t){let e=Object.assign({},t);return e.target?(e.target=Km(e.target,{typeHint:"Canvas"}),e):t}function yM(t){return t}function Zm(t){return t.items===void 0&&(t[cc]=!0),t}function p1(t){let e=iM(t),n=pM(),i={},a=CH(n,e),r=MH(i),l=new CS({collection:[Zm,lc(uM),r("Collection"),a("Collection")],manifest:[Zm,lc(cM),LH,r("Manifest"),a("Manifest")],canvas:[lc(lM),r("Canvas"),a("Canvas")],annotationPage:[Zm,d1("AnnotationPage"),lc(sM),r("AnnotationPage"),a("AnnotationPage")],annotation:[d1("Annotation"),IH,DH,r("Annotation"),a("Annotation")],contentResource:[d1("ContentResource"),r("ContentResource"),a("ContentResource")],range:[lc(dM),NH,r("Range","Canvas"),a("Range","Canvas")],agent:[lc(fM),r("Agent"),a("Agent")],specificResource:[yM],service:[_H(n)]}),u=l.traverseUnknown(e);return{entities:n,resource:u,mapping:i}}function vM(t){let e={};for(let[n,i]of t){if(n===f1&&i!==Ua)return i;i!==Ua&&i!=null&&(e[n]=i)}return e}function m1(t,e,n){if(!e.type||!e.id)throw Error("Unknown entity");if(!n[e.type])throw Error(`Serializer not found for ${e.type}`);function i(a,r,l=0){let u=n[a.type];if(!u)return Ua;if(l>20)throw Error("Circular reference: "+a.id+" "+a.type);let[f,h]=h1(t,a.type?a:a.id,r)||(a.id&&a.type?a:null);if(!f)return Ua;let d=u(f,t,{parent:r,isTopLevel:e.id===a.id,fullResource:h}),m=d.next();for(;!m.done;){let y=m.value,g=Ua;if(y)if(Array.isArray(y)){let b=[];for(let w of y)b.push(i(w,a,l+1));g=b}else g=i(y,a,l+1);m=d.next(g)}return m.value===Ua?Ua:vM(m.value)}return i(e)}function dc(t,{allowSourceString:e=!0,allowString:n=!1,allowedStringType:i}={}){let a=r=>{if(e&&r&&r.source&&typeof r.source!="string"){let l=Object.keys(r.source);if(r.source.id&&r.source.type&&l.length===2)return{...r,source:r.source.id}}return r};if(t){if(t.source&&t.source.partOf)return a(t);let r=Object.keys(t);if(r.length===2&&t.type&&t.source||r.length===3&&t.type&&t.source&&r.indexOf("selector")!==-1&&!t.selector)return n&&(!i||i===t.source.type)?t.source.id:t.source.type==="ContentResource"?{type:"SpecificResource",source:t.source.id}:t.source;if(t.selector&&!Array.isArray(t.selector)&&typeof t.selector!="string"&&t.selector.type==="FragmentSelector"){let l=`${t.source.id}#${t.selector.value}`;return n?l:{id:l,type:t.source.type}}}return a(t)}function Il(t){if(!t)return;let e=Object.keys(t);if(e.length!==0){if(e.length===1){let n=e[0];if(!n)return"";let i=(t[n]||[]).join("");return n==="@none"||n==="none"||n==="en"?i:{"@language":n,"@value":i}}return e.map(n=>({"@language":n,"@value":(t[n]||[]).join("")}))}}function bM(t){return Array.isArray(t)?t.map(e=>bM(e)):typeof t=="string"?t:t.type&&t.type==="Canvas"?t.id:t}function fs(t,e=!1){if(t)return t.length>1&&!e?t:t[0]||void 0}function PH(t){if(t){if(typeof t=="string")return{"@id":t};if("@id"in t){let e={...t};return delete e["@type"],e}return{"@context":"http://iiif.io/api/image/2/context.json","@id":t.id,profile:`http://iiif.io/api/image/2/profiles/${t.profile}.json`}}}function Ol(t,e){return[["@id",t.id],["@type",e],["format",t.format],["height",t.height],["width",t.width],["viewingDirection",t.viewingDirection==="left-to-right"?void 0:t.viewingDirection],["license",t.license?t.license:void 0]]}function*_l(t){let e=t.provider?yield t.provider[0]:void 0;return[["label",Il(t.label)],["metadata",t.metadata&&t.metadata.length?t.metadata.map(n=>({label:Il(n.label)||"",value:Il(n.value)||""})):void 0],["description",Il(t.summary)],["thumbnail",fs(yield t.thumbnail)],["navDate",t.navDate],["logo",e?fs(e.logo):void 0],["homepage",e?e.homepage:void 0],["attribution",t.requiredStatement?Il(t.requiredStatement.value):void 0]]}function*Rf(t){let e=t.start&&t.start.type&&t.start.type==="SpecificResource"?dc(t.start):t.start;return[["seeAlso",fs(yield t.seeAlso)],["service",fs((t.service||[]).map(PH))],["rendering",fs(yield t.rendering)],["startCanvas",e?e.id:void 0]]}function BH(t){return t.type==="SpecificResource"}function HH(t){return t&&t.type==="FragmentSelector"}function FH(t){if(t&&BH(t)){let e=t.id,n=t.selector?Array.isArray(t.selector)?t.selector[0]:t.selector:void 0;return HH(n)&&(e+="#"+n.value),e}return t?.id}var g1={Manifest:function*(t,e,{isTopLevel:n}){return[...n?[["@context","http://iiif.io/api/presentation/2/context.json"]]:[],...Ol(t,"sc:Manifest"),...yield*_l(t),...yield*Rf(t),["sequences",[{"@id":`${t.id}/sequence0`,"@type":"sc:Sequence",canvases:yield t.items}]],["structures",yield t.structures]]},Canvas:function*(t){let e=yield t.items,n=e[0];return[...Ol(t,"sc:Canvas"),...yield*_l(t),...yield*Rf(t),["images",n?[n.resources]:void 0],["annotations",t.annotations&&t.annotations.length?fs(yield t.annotations):void 0]]},AnnotationPage:function*(t){return[...Ol(t,"sc:AnnotationList"),...yield*_l(t),["resources",t.items&&t.items.length?fs(yield t.items):void 0]]},Annotation:function*(t){return[["@id",t.id],["@type","oa:Annotation"],["motivation","sc:painting"],["on",bM(t.target)],["resource",fs(yield t.body,!0)]]},ContentResource:function*(t){switch(t.type){case"Image":return[...Ol(t,"dctypes:Image"),...yield*_l(t),...yield*Rf(t)];case"Text":case"Dataset":default:return[...Ol(t,void 0),...yield*_l(t)]}},AnnotationCollection:function*(t){return[["@id",t.id],["@type","sc:Layer"],["label",Il(t.label)]]},Collection:function*(t){return[...Ol(t,"sc:Collection"),...yield*_l(t),...yield*Rf(t),["members",yield*t.items]]},Range:function*(t){let e=[],n=[];if(t.items)for(let i of t.items){let a=i.type==="SpecificResource"?i.source:i;if(a){let r=yield a;e.push({"@id":FH(i),"@type":a.type,label:r?r.label:void 0,within:t.id}),a.type==="Canvas"&&n.push(a.id)}}return[...Ol(t,"sc:Range"),...yield*_l(t),...yield*Rf(t),["canvases",n.length===e.length?n:void 0],["members",n.length===e.length?void 0:e]]}};function zl(t){return[["id",t.id?.startsWith("vault://")?void 0:t.id],["type",t.type],["format",t.format],["profile",t.profile],["height",t.height||void 0],["width",t.width||void 0],["duration",t.duration||void 0],["viewingDirection",t.viewingDirection==="left-to-right"?void 0:t.viewingDirection],["behavior",t.behavior&&t.behavior.length?t.behavior:void 0],["timeMode",t.timeMode],["motivation",Array.isArray(t.motivation)?t.motivation[0]:t.motivation],[mn,Ua]]}function In(t){if(t===Ua||!t||t.length===0)return;let e=t.filter(n=>n!==Ua);if(e.length!==0)return e}function SM(t){if(t&&t.type&&t.type==="ImageService2"){let{id:e,type:n,profile:i,...a}=t,r=typeof i=="string"?i:Array.isArray(i)?i.find(l=>typeof l=="string"):"";return{"@id":e,"@type":n,profile:r?r.startsWith("http")?r:`http://iiif.io/api/image/2/${r}.json`:"http://iiif.io/api/image/2/level0.json",...a}}return t}function aM(t){if(Array.isArray(t)||(t=t?[t]:[]),!(!t||t.length===0))return t.map(SM)}function*cs(t){return[["label",t.label],["metadata",In(t.metadata)],["summary",t.summary],["requiredStatement",t.requiredStatement],["rights",Array.isArray(t.rights)?t.rights[0]||void 0:t.rights||void 0],["navDate",t.navDate],["language",t.language],["thumbnail",In(yield t.thumbnail)],["placeholderCanvas",yield t.placeholderCanvas],["accompanyingCanvas",yield t.accompanyingCanvas],["provider",In(yield t.provider)]]}function*ds(t,e){let n=[];for(let i of t.partOf||[])i.type==="Manifest"&&e.type==="Manifest"||n.push(yield i);return[["seeAlso",In(yield t.seeAlso)],["service",In(aM(t.service))],["services",In(aM(t.services))],["rendering",In(yield t.rendering)],["supplementary",In(yield t.supplementary)],["homepage",In(yield t.homepage)],["logo",In(yield t.logo)],["partOf",In(n)],["start",t.start?dc(t.start):t.start]]}var y1={Manifest:function*(t,e,{isTopLevel:n}){if(!n)return[...zl(t),...yield*cs(t),["navPlace",t.navPlace]];let i="http://iiif.io/api/presentation/3/context.json";return(t.navPlace||rM(t))&&(i=["http://iiif.io/api/presentation/3/context.json","http://iiif.io/api/extension/navplace/context.json"]),[["@context",t["@context"]?t["@context"]:i],...zl(t),...yield*cs(t),...yield*ds(t),["items",yield t.items],["structures",In(yield t.structures)],["annotations",In(yield t.annotations)],["navPlace",t.navPlace]]},Canvas:function*(t,e,{parent:n}){return n&&n.type!=="Manifest"&&n.type!=="Canvas"?[["id",t.id]]:[...zl(t),...yield*cs(t),...yield*ds(t,n),["items",yield t.items],["annotations",In(yield t.annotations)],["navPlace",t.navPlace]]},Agent:function*(t){return[["id",t.id],["type","Agent"],["label",t.label],...yield*ds(t)]},AnnotationPage:function*(t){let e=Object.entries(t).map(([i,a])=>[i,Array.isArray(a)?In(a):a]).filter(([i,a])=>i!=="items"&&i!=="id"&&i!==mn&&i!==ga&&i!==cc),n=yield t.items;return[["id",t.id?.startsWith("vault://")?void 0:t.id],...e,...yield*ds(t),["items",n.length||t[cc]===!1?n:Ua]]},Service:function*(t){return[[f1,SM(t)]]},Annotation:function*(t){let e=Object.entries(t).map(([i,a])=>i==="motivation"?[i,Array.isArray(a)?a[0]:a]:i==="target"?[i,dc(a,{allowString:!0,allowSourceString:!0,allowedStringType:"Canvas"})]:[i,Array.isArray(a)?In(a):a]).filter(([i])=>i!=="body"&&i!==mn&&i!==cc),n;if(Array.isArray(t.body)){let i=[];for(let a of t.body)if(a&&ma(a)){let r={...a};a.source.type==="Canvas"?r.source=a.source:r.source=yield a.source,i.push(dc(r,{allowSourceString:!0}))}else i.push(yield a);n=i}else t.body&&ma(t.body)?(n={...t.body},n.source=yield t.body.source):n=yield t.body;return[...e,...yield*cs(t),...yield*ds(t),["body",n.length===1?n[0]:n]]},ContentResource:function*(t){return qH([...zl(t),...yield*cs(t),...yield*ds(t),["annotations",In(yield t.annotations)],["items",In(yield t.items)]],t)},AnnotationCollection:function*(t){return[["id",t.id],["type","AnnotationCollection"],["label",t.label]]},Collection:function*(t,e,{isTopLevel:n}){if(n){let i="http://iiif.io/api/presentation/3/context.json";return(t.navPlace||rM(t))&&(i=["http://iiif.io/api/extension/navplace/context.json","http://iiif.io/api/presentation/3/context.json"]),[["@context",i],...zl(t),...yield*cs(t),...yield*ds(t),["items",In(yield t.items)],["navPlace",t.navPlace]]}return[...zl(t),...yield*cs(t),["navPlace",t.navPlace]]},Range:function*(t){let e=[];for(let n of t.items)n.type==="Range"?e.push(yield n):n&&n.type==="SpecificResource"?e.push(dc(n)):e.push(n);return[...zl(t),...yield*cs(t),...yield*ds(t),["items",e],["annotations",In(yield t.annotations)],["navPlace",t.navPlace]]}};function qH(t,e){let n=Object.keys(e),i=t.map(([a])=>a);for(let a of n)a===mn||a===cc||i.indexOf(a)===-1&&e[a]!==void 0&&t.push([a,e[a]]);return t}function rM(t){if(!t.items||!Array.isArray(t.items))return!1;for(let e of t.items)if(e.navPlace)return!0;return!1}function xM(t,e){return ma(t)?typeof t.source=="string"?{...t,source:e}:{...t,source:{...t.source||{},id:e}}:{...t,id:e}}var Xe=function(t){return function(){let e={type:t,getType:()=>t,toString:()=>t};return(n,i)=>({...e,...n!==void 0&&{payload:n},...i!==void 0&&{meta:i}})}},$m="@iiif/IMPORT_ENTITIES",tg="@iiif/MODIFY_ENTITY_FIELD",eg="@iiif/REORDER_ENTITY_FIELD",ng="@iiif/MOVE_ENTITY",Ef="@iiif/MOVE_ENTITIES",ig="@iiif/ADD_REFERENCE",Af="@iiif/UPDATE_REFERENCE",ag="@iiif/CHANGE_REFERENCE_IDENTIFIER",rg="@iiif/REMOVE_REFERENCE",og="@iiif/ADD_METADATA",sg="@iiif/REMOVE_METADATA",Cf="@iiif/UPDATE_METADATA",lg="@iiif/REORDER_METADATA",ug=Xe($m)(),wM=Xe(tg)(),TM=Xe(eg)(),RM=Xe(ng)(),EM=Xe(Ef)(),AM=Xe(ig)(),CM=Xe(rg)(),MM=Xe(Af)(),OM=Xe(ag)(),_M=Xe(og)(),zM=Xe(Cf)(),IM=Xe(sg)(),NM=Xe(lg)(),Nl={importEntities:ug,modifyEntityField:wM,reorderEntityField:TM,addReference:AM,removeReference:CM,updateReference:MM,changeReferenceIdentifier:OM,addMetadata:_M,removeMetadata:IM,updateMetadata:zM,reorderMetadata:NM,moveEntity:RM,moveEntities:EM},cg="@iiif/ADD_MAPPING",dg="@iiif/ADD_MAPPINGS",v1=Xe(cg)(),b1=Xe(dg)();var pc="RESOURCE_ERROR",Mf="RESOURCE_LOADING",mc="RESOURCE_READY",fg="@iiif/REQUEST_RESOURCE",hg="@iiif/REQUEST_ERROR",pg="@iiif/REQUEST_MISMATCH",mg="@iiif/REQUEST_COMPLETE",gg="@iiif/REQUEST_OFFLINE_RESOURCE",S1=Xe(fg)(),Of=Xe(hg)(),x1=Xe(pg)(),w1=Xe(mg)(),UH=Xe(gg)();var gc="@iiif/BATCH",yg="@iiif/BATCH_IMPORT",yc=Xe(gc)(),VH=Xe(yg)();var T1="@iiif/SET_META_VALUE",R1="@iiif/SET_META_VALUE_DYNAMIC",E1="@iiif/UNSET_META_VALUE",A1={setMetaValue:Xe(T1)(),setMetaValueDynamic:Xe(R1)(),unsetMetaValue:Xe(E1)()};var jH=(t,e)=>{let{entities:n,resource:i,mapping:a}=p1(e);if(i.id===void 0)return[Of({id:t,message:"ID is not defined in resource."})];let r=[ug({entities:n}),b1({mapping:a})];return i.id!==t&&(r.push(v1({id:t,type:i.type})),r.push(x1({requestId:t,actualId:i.id}))),r.push(w1({id:t})),r},LM=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function kH(t,e){return!!(t===e||LM(t)&&LM(e))}function M1(t,e){if(!Array.isArray(t)||!Array.isArray(e))return t===e;if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(!kH(t[n],e[n]))return!1;return!0}function C1(t,e,n){let i=t.iiif.requests[e],a=t.iiif.mapping[e];if(!a||!t.iiif.entities[a][i.resourceUri])return;let r=t.iiif.entities[a][i.resourceUri];return r&&r[mn]?hc(r,r[mn].find(l=>n?l[ga]===n.id:l[ga]===r.id)):r}function GH(t){return t&&typeof t.then=="function"}function O1(t,e,{waitTimeout:n=30}={}){return(i,a,r)=>{let l=t.getStore(),u=l.getState(),f=u.iiif.requests[i];if(f){if(f.loadingState===mc){let d=C1(u,i);if(d)return d}switch(f.loadingState){case pc:break;case Mf:return(async()=>{let d,m=!1;try{let y=await Promise.race([new Promise((g,b)=>{m||(d=l.subscribe(()=>{let w=l.getState();if(w.iiif.requests[i].loadingState===pc){b();return}if(w.iiif.requests[i].loadingState===mc){let E=C1(w,i);E?g(E):b()}}))}),new Promise((g,b)=>setTimeout(()=>{m=!0,b()},n*60*1e3))]);if(d&&d(),y)return y}catch{d&&d()}})()}}t.dispatch(S1({id:i}));let h=d=>{if(!d)return;!d.id&&!d["@id"]&&(d["@type"]&&(d["@id"]=i),d.id=i);let m=jH(i,d);return t.dispatch(yc({actions:m})),C1(l.getState(),i)};try{let d=e(i,a);return GH(d)?(async()=>{try{let m=await d;return r&&(m=r(m)),h(m)}catch(m){throw t.dispatch(Of({id:i,message:m.toString()})),m}})():h(r?r(d):d)}catch(d){throw t.dispatch(Of({id:i,message:d.toString()})),d}}}function _1(){return{Collection:{},Manifest:{},Canvas:{},AnnotationPage:{},AnnotationCollection:{},Annotation:{},ContentResource:{},Range:{},Service:{},Selector:{},Agent:{}}}var vc={},YH=(t,e)=>(n,i,a)=>(a.dispatch=r=>(n(l=>t(l,r),!1,r),r),a.dispatchFromDevtools=!0,{dispatch:(...r)=>a.dispatch(...r),...e}),I1=new Map,vg=t=>{let e=I1.get(t);return e?Object.fromEntries(Object.entries(e.stores).map(([n,i])=>[n,i.getState()])):{}},XH=(t,e,n)=>{if(t===void 0)return{type:"untracked",connection:e.connect(n)};let i=I1.get(n.name);if(i)return{type:"tracked",store:t,...i};let a={connection:e.connect(n),stores:{}};return I1.set(n.name,a),{type:"tracked",store:t,...a}},QH=(t,e={})=>(n,i,a)=>{let{enabled:r,anonymousActionType:l,store:u,...f}=e,h;try{h=(r??(vc.env?vc.env.MODE:void 0)!=="production")&&window.__REDUX_DEVTOOLS_EXTENSION__}catch{}if(!h)return(vc.env?vc.env.MODE:void 0)!=="production"&&r&&console.warn("[zustand devtools middleware] Please install/enable Redux devtools extension"),t(n,i,a);let{connection:d,...m}=XH(u,h,f),y=!0;a.setState=(w,E,T)=>{let S=n(w,E);if(!y)return S;let R=T===void 0?{type:l||"anonymous"}:typeof T=="string"?{type:T}:T;return u===void 0?(d?.send(R,i()),S):(d?.send({...R,type:`${u}/${R.type}`},{...vg(f.name),[u]:a.getState()}),S)};let g=(...w)=>{let E=y;y=!1,n(...w),y=E},b=t(a.setState,i,a);if(m.type==="untracked"?d?.init(b):(m.stores[m.store]=a,d?.init(Object.fromEntries(Object.entries(m.stores).map(([w,E])=>[w,w===m.store?b:E.getState()])))),a.dispatchFromDevtools&&typeof a.dispatch=="function"){let w=!1,E=a.dispatch;a.dispatch=(...T)=>{(vc.env?vc.env.MODE:void 0)!=="production"&&T[0].type==="__setState"&&!w&&(console.warn('[zustand devtools middleware] "__setState" action type is reserved to set state from the devtools. Avoid using it.'),w=!0),E(...T)}}return d.subscribe(w=>{switch(w.type){case"ACTION":if(typeof w.payload!="string"){console.error("[zustand devtools middleware] Unsupported action format");return}return z1(w.payload,E=>{if(E.type==="__setState"){if(u===void 0){g(E.state);return}Object.keys(E.state).length!==1&&console.error(`
|
|
21
21
|
[zustand devtools middleware] Unsupported __setState action format.
|
|
22
22
|
When using 'store' option in devtools(), the 'state' should have only one key, which is a value of 'store' that was passed in devtools(),
|
|
23
23
|
and value of this only key should be a state object. Example: { "type": "__setState", "state": { "abc123Store": { "foo": "bar" } } }
|
|
24
|
-
`);let A=T.state[u];if(A==null)return;JSON.stringify(a.getState())!==JSON.stringify(A)&&v(A);return}a.dispatchFromDevtools&&typeof a.dispatch=="function"&&a.dispatch(T)});case"DISPATCH":switch(E.payload.type){case"RESET":return v(S),u===void 0?f?.init(a.getState()):f?.init(Fm(d.name));case"COMMIT":if(u===void 0){f?.init(a.getState());return}return f?.init(Fm(d.name));case"ROLLBACK":return s1(E.state,T=>{if(u===void 0){v(T),f?.init(a.getState());return}v(T[u]),f?.init(Fm(d.name))});case"JUMP_TO_STATE":case"JUMP_TO_ACTION":return s1(E.state,T=>{if(u===void 0){v(T);return}JSON.stringify(a.getState())!==JSON.stringify(T[u])&&v(T[u])});case"IMPORT_STATE":{let{nextLiftedState:T}=E.payload,A=T.computedStates.slice(-1)[0]?.state;if(!A)return;v(u===void 0?A:A[u]),f?.send(null,T);return}case"PAUSE_RECORDING":return g=!g}return}}),S},s1=(t,e)=>{let n;try{n=JSON.parse(t)}catch(i){console.error("[zustand devtools middleware] Could not parse the received json",i)}n!==void 0&&e(n)},H6=t=>(e,n,i)=>{let a=i.subscribe;return i.subscribe=(o,s,u)=>{let d=o;if(s){let p=u?.equalityFn||Object.is,f=o(i.getState());d=m=>{let g=o(m);if(!p(f,g)){let v=f;s(f=g,v)}},u?.fireImmediately&&s(f,f)}return a(d)},t(e,n,i)},U6=(t={},e)=>{switch(e.type){case Lm:return{...t,[e.payload.id]:e.payload.type};case Bm:return{...t,...e.payload.mapping};default:return t}};function ed(t,e,n,i){return!(!t[n]||!t[n][e]||!t[n][e][i]||!Array.isArray(t[n][e][i]))}function V6(t,e){let n={},i=[];for(let[a,o]of Object.entries(t||{})){i.push(a);let s=(e||{})[a];if(!s||s.length===0){n[a]=o;continue}n[a]=s}for(let[a,o]of Object.entries(e||{}))i.indexOf(a)===-1&&(n[a]=o);return n}function At(t){return t.payload||{}}function j6(t,e,n){if(!t[e]||!Array.isArray(t[e]))return null;let i=n.index===void 0?t[e].findIndex(a=>a?Du(a)?.id===n.id:!1):n.index;return i===-1?null:{entity:t[e][i],index:i}}function lM(t,e){if(!(!e?.id||!e?.type))return t[e.type]?.[e.id]}function Gm(t,e){return t===void 0?e:t}var sM=(t=l1(),e)=>{let n=(i,a)=>({...t,[At(e).type]:{...t[At(e).type],[At(e).id]:{...i,...a}}});switch(e.type){case Tm:{if(!t[At(e).type]||!t[At(e).type][At(e).id])return t;let i=t[At(e).type][At(e).id];return typeof i=="string"?t:n(i,{[At(e).key]:At(e).value})}case Cm:{if(!ed(t,At(e).id,At(e).type,At(e).key))return t;let i=t[At(e).type][At(e).id];if(typeof i=="string")return t;let a=Array.from(i[At(e).key]),[o]=a.splice(At(e).startIndex,1);return a.splice(At(e).endIndex,0,o),n(i,{[At(e).key]:a})}case Zf:{let i=At(e).subjects,a=At(e).from,o=At(e).to||a,s=lM(t,a),u=o?.key||a.key;if(!ed(t,a.id,a.type,a.key)||!ed(t,o.id,o.type,o.key))return t;let d=[],p=[];if(i.type==="slice"){let T=i.startIndex,A=i.length;d=Array.from(s[a.key]),p=d.splice(T,A)}else{let T=Array.from(s[a.key]);for(let A of i.items){let x=j6(s,a.key,A);x&&(p.push(x.entity),T[x.index]=null),d=T.filter(R=>R!==null)}}let f={...s,[a.key]:d},m={...t,[a.type]:{...t[a.type],[a.id]:f}},g=lM(m,o);if(!g)return t;let v=o?.index===void 0?g[u].length:o.index,S=Array.from(g[o.key]);S.splice(v,0,...p);let E={...g,[u]:S};return{...m,[o.type]:{...m[o.type],[o.id]:E}}}case wm:return sM(t,{type:Zf,payload:{subjects:{type:"list",items:[At(e).subject]},from:At(e).from,to:At(e).to}});case Om:{let{id:i,index:a,key:o,newIdentifier:s,reference:u,type:d}=At(e),p=t[d][i],f=Du(u);if(!p||!p[o]||!f||a<0)return t;let m=p[o],g=m[a],v=t[f.type]?.[f.id];if(!v||!g)return t;let S=Q2(g,s),E=Array.from(m);E.splice(Gm(a,E.length+1),1,S);let T=n(p,{[o]:E}),A={...v,id:s};A["iiif-parser:hasPart"]&&(A["iiif-parser:hasPart"]=A["iiif-parser:hasPart"].filter(R=>R["iiif-parser:partOf"]===i).map(R=>({...R,id:s})));let x={...T[f.type],[s]:A};return T[f.type]=x,T}case Rm:{let i=Object.keys(At(e).entities),a={...t};for(let o of i){let s=At(e).entities[o],u={...t[o]||{}},d=!1,p=Object.keys(s||{})||[];if(s&&p){for(let f of p)d=!0,u[f]=t[o][f]?V6(t[o][f],s[f]):s[f];d&&(a[o]=u)}}return a}case Mm:{if(!ed(t,At(e).id,At(e).type,At(e).key))return t;let i=t[At(e).type][At(e).id],a=Array.from(i[At(e).key]);return a.splice(Gm(At(e).index,a.length+1),0,At(e).reference),n(i,{[At(e).key]:a})}case Wf:case _m:{if(!ed(t,At(e).id,At(e).type,At(e).key))return t;let i=t[At(e).type][At(e).id],a=Array.from(i[At(e).key]),o=Gm(At(e).index,a.findIndex(s=>s&&s.id===At(e).reference.id));return o===-1||a[o]?.id!==At(e).reference.id?t:(e.type===Wf?a.splice(o,1,At(e).reference):a.splice(o,1),n(i,{[At(e).key]:a}))}case zm:{let i=t[At(e).type][At(e).id];if(!i)return t;let a=Array.from(i.metadata||[]),o=At(e);return a.splice(Gm(e.payload.beforeIndex,a.length+1),0,{label:o.label,value:o.label}),n(i,{metadata:a})}case Im:{let i=t[At(e).type][At(e).id];if(typeof i=="string"||!i)return t;let a=Array.from(i.metadata||[]),[o]=a.splice(At(e).startIndex,1);return a.splice(At(e).endIndex,0,o),n(i,{metadata:a})}case Jf:case Nm:{let i=t[At(e).type][At(e).id],a=Array.from(i.metadata||[]),o=At(e).atIndex;return o===void 0||o===-1||!a[o]?t:(e.type===Jf?a.splice(o,1,{label:At(e).label,value:At(e).value}):a.splice(o,1),n(i,{metadata:a}))}default:return t}},q6=(t={},e)=>{switch(e.type){case Pm:case jm:return{...t,[e.payload.id]:{requestUri:e.payload.id,loadingState:$f,uriMismatch:!1,resourceUri:e.payload.id}};case Um:return{...t,[e.payload.requestId]:{...t[e.payload.requestId]||{},uriMismatch:!0,resourceUri:e.payload.actualId},[e.payload.actualId]:{requestUri:e.payload.requestId,loadingState:t[e.payload.requestId].loadingState,uriMismatch:!0,resourceUri:e.payload.actualId}};case Hm:return{...t,[e.payload.id]:{...t[e.payload.id]||{},loadingState:Bu,error:e.payload.message}};case Vm:return{...t,[e.payload.id]:{...t[e.payload.id]||{},loadingState:Pu,error:void 0}}}return t},F6=(t={},e)=>{let{id:n,updateValue:i,value:a,meta:o,key:s}=e&&e.payload||{};switch(e.type){case t1:return{...t,[n]:{...t[n]||{},[o]:{...t[n]&&t[n][o]||{},[s]:a}}};case e1:return{...t,[n]:{...t[n]||{},[o]:{...t[n]&&t[n][o]||{},[s]:t[n]&&t[n][o]?i(t[n][o][s]):i(void 0)}}};case n1:return t[n]&&t[n][o]&&t[n][o][s]?{...t,[n]:{...t[n]||{},[o]:{...t[n]&&t[n][o]||{},[s]:void 0}}}:t;default:return t}};function uM(t={}){let e=Object.keys(t);return function(n={},i){let a=!1,o={};for(let s=0;s<e.length;s++){let u=e[s];o[u]=t[u](n[u],i),a=a||o[u]!==n[u]}return a?o:n}}function G6(t){return(e,n)=>n&&n.type===Hu?n.payload.actions.reduce(t,e):n&&n.type===qm?{...e,iiif:{...e.iiif,...n.payload.state}}:t(e,n)}var k6=uM({mapping:U6,entities:sM,requests:q6,meta:F6});function Y6(){return{iiif:{entities:l1(),meta:{},mapping:{},requests:{}}}}function cM(t={}){let{enableDevtools:e=!1,iiifStoreName:n="iiif",defaultState:i=Y6(),customReducers:a={}}=t,o=G6(uM({[n]:k6,...a}));return mm(H6((typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__?P6:(s,u)=>s)(L6(o,i),{enabled:e})))}function fi(t,e,n,i=!0){e[ju]=e[ju]||[],e[ju].push(t);let a=new Map;Object.defineProperty(e,t,{enumerable:i,get(){if(e[ls][t]===void 0)return;let o=e[ls][t];if(!o)return o;let s=n.get(e[ls][t],{parent:this.id?{id:this.id,type:this.type}:void 0});return a.has(s)||(a.clear(),a.set(s,ss(s,n))),a.get(s)},set(o){e[ls][t]!==o&&(this[rs]?n.modifyEntityField({id:this.id,type:this.type},t,hM(o)):this[ls][t]=o)}})}var ls=Symbol.for("_refs_"),rs=Symbol.for("_reactive_"),ju=Symbol.for("_defined_"),fM=Symbol.for("_parent_");function Q6(t,e=!1,n){let i={id:"",type:"unknown",[ju]:[],[ls]:{},[fM]:n||null,[rs]:null,is(a){return typeof a=="string"?this.id===a:a.id?a.id===this.id:!1},reactive(){if(!this[rs])return this[rs]=this.subscribe(()=>this.refresh(),!0),()=>{this.unreactive()}},refresh(){if(this.id){let a=this.unwrap();for(let o of Object.keys(a||{}))this[ju].includes(o)?this[ls][o]=a[o]:this[o]=a[o]}},unreactive(){this[rs]&&(this[rs](),this[rs]=null)},unwrap(){if(!this.id)throw Error("Invalid object");let a=this[fM];return t.get(this.id,{parent:a?{id:a,type:"unknown"}:void 0})},toPresentation3(){return t.toPresentation3(this.unwrap())},toPresentation2(){return t.toPresentation2(this.unwrap())},valueOf(){return this.unwrap()},toJSON(){let a=this;return{...a,items:a.items,annotations:a.annotations,structures:a.structures,seeAlso:a.seeAlso,service:a.service,services:a.services,rendering:a.rendering,partOf:a.partOf,start:a.start,supplementary:a.supplementary,homepage:a.homepage,thumbnail:a.thumbnail,placeholderCanvas:a.placeholderCanvas,accompanyingCanvas:a.accompanyingCanvas,provider:a.provider}},subscribe(a,o=!0){return t.subscribe(()=>this.id?t.get(this.id):null,a,o)}};return fi("items",i,t),fi("annotations",i,t),fi("structures",i,t),fi("seeAlso",i,t),fi("rendering",i,t),fi("partOf",i,t),fi("start",i,t,!1),fi("supplementary",i,t),fi("homepage",i,t),fi("thumbnail",i,t),fi("placeholderCanvas",i,t,!1),fi("accompanyingCanvas",i,t,!1),fi("provider",i,t),fi("body",i,t),fi("logo",i,t),i}function X6(t){return!!t[ju]}function hM(t){return Array.isArray(t)?t.map(e=>hM(e)):!t||!t.type?t:{id:t.id,type:t.type}}function ss(t,e,n=!1,i){if(Array.isArray(t))return t.map(u=>ss(u,e,n));if(!t||!t.type||!t.id)return t;let a=Q6(e,n),o=Object.create(a),s=Object.assign(o,t);return n&&s.reactive(),s}function dM(t){switch(t){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 t}var qu=class{constructor(t,e){Rn(this,"options",void 0),Rn(this,"store",void 0),Rn(this,"emitter",void 0),Rn(this,"isBatching",!1),Rn(this,"batchQueue",[]),Rn(this,"remoteFetcher",void 0),Rn(this,"staticFetcher",void 0),Rn(this,"defaultFetcher",n=>fetch(n).then(i=>{if(i.status===200)return i.json();{let a=Error(`${i.status} ${i.statusText}`);throw a.name="HTTPError",a}})),this.options=Object.assign({reducers:{},customFetcher:this.defaultFetcher,enableDevtools:!0},t||{}),this.store=e||cM({customReducers:this.options.reducers,defaultState:this.options.defaultState,enableDevtools:this.options.enableDevtools}),this.emitter=gm(),this.remoteFetcher=r1(this,this.options.customFetcher),this.staticFetcher=r1(this,(n,i)=>i)}batch(t){this.isBatching=!0;try{t(this),this.isBatching=!1,this.dispatch(Uu({actions:this.batchQueue}))}catch(e){throw this.batchQueue=[],this.isBatching=!1,e}this.batchQueue=[]}async asyncBatch(t){this.isBatching=!0;try{await t(this),this.isBatching=!1,this.dispatch(Uu({actions:this.batchQueue}))}catch(e){throw this.batchQueue=[],this.isBatching=!1,e}this.batchQueue=[]}modifyEntityField(t,e,n){this.dispatch(os.modifyEntityField({id:t.id,type:t.type,key:e,value:n}))}dispatch(t){if(this.isBatching)this.batchQueue.push(t);else{if(t.type===Hu){for(let i of t.payload.actions)this.emitter.emit(i.type,{action:i,state:this.store.getState()});this.store.dispatch(t);let n=this.getState();for(let i of t.payload.actions)this.emitter.emit(`after:${i.type}`,{action:i,state:n});return}this.emitter.emit(t.type,{action:t,state:this.store.getState()}),this.store.dispatch(t);let e=this.store.getState();this.emitter.emit(`after:${t.type}`,{action:t,state:e});return}}on(t,e){return this.emitter.on(t,e),()=>{this.emitter.off(t,e)}}serialize(t,e){return Yb(this.getState().iiif,t,e)}toPresentation2(t){return this.serialize(t,Qb)}toPresentation3(t){return this.serialize(t,Xb)}hydrate(t,e,n={}){return this.get(t,e,{...n,skipSelfReturn:!1})}get(t,e,n={}){typeof e!="string"&&(n=e||{},e=void 0);let{skipSelfReturn:i=!0}=n||{},a=n.parent?typeof n.parent=="string"?n.parent:n.parent.id:void 0;if(Array.isArray(t))return t.map(f=>this.get(f,n));let o=this.getState();if(Gi(t)&&!n.preserveSpecificResources&&(t=t.source),typeof t=="string"){let f=dM(e||o.iiif.mapping[t]);if(!f)return i?null:{id:t,type:"unknown"};t={id:t,type:f}}if(t&&t.partOf&&!a&&!n.skipPartOfCheck){let f=Array.isArray(t.partOf)?t.partOf[0]:t.partOf;f&&(typeof f=="string"&&(a=f),typeof f.id=="string"&&(a=f.id))}let s=dM(e||t?.type),u=t?.id,d=o.iiif.entities[s];if(!d){let f=o.iiif.requests[u];return f&&f.resourceUri!==u?this.get(f.resourceUri,n):i?null:t}let p=d[t.id];return p&&p[Ke]?Lu(p,p[Ke].find(f=>a?f[ki]===a:f[ki]===p.id)):d[t.id]||(i?null:t)}select(t){return t(this.getState())}getStore(){return this.store}getState(){return this.store.getState()}deep(t,e){if(t===void 0)return this.get(e,{skipSelfReturn:!1});if(typeof t=="function")try{let i=t(this.get(e,{skipSelfReturn:!1})),a=o=>this.deep(o,i);return a.size=Array.isArray(i)?i.length:1,a}catch{let i=a=>this.deep(a,void 0);return i.size=0,i}let n=i=>this.deep(i,t);return n.size=Array.isArray(t)?t.length:1,n}loadManifest(t,e,n){let i=typeof t=="string"?t:t.id;return this.load(i,e,n)}loadCollection(t,e,n){let i=typeof t=="string"?t:t.id;return this.load(i,e,n)}load(t,e,n){let i=typeof t=="string"?t:t.id;return e?Promise.resolve(this.staticFetcher(i,e,n)):Promise.resolve(this.remoteFetcher(i,{},n))}loadSync(t,e,n){let i=typeof t=="string"?t:t.id;return this.staticFetcher(i,e,n)}loadManifestSync(t,e,n){let i=typeof t=="string"?t:t.id;return this.loadSync(i,e,n)}loadCollectionSync(t,e,n){let i=typeof t=="string"?t:t.id;return this.loadSync(i,e,n)}areInputsEqual(t,e){return o1(t,e)}subscribe(t,e,n){return n===void 0&&(e===void 0||e===!1||e===!0)&&(n=e,e=t,t=i=>i),this.store.subscribe(t,i=>e(i,this),{equalityFn:o1,fireImmediately:!n})}async ensureLoaded(t){let e=typeof t=="string"?t:t.id;this.requestStatus(e)||await this.load(e)}requestStatus(t){return this.select(e=>e.iiif.requests[t])}getPaginationState(t){let e=typeof t=="string"?t:t.id;if(!e)return null;let n=this.getResourceMeta(e,"@vault/pagination");if(n?.state)return n.state;let i=this.get(t);if(i.first){let a={currentPage:null,currentPageIndex:null,isFetching:!1,isFullyLoaded:!1,next:i.first,page:1,pages:[],previous:null,totalItems:i.total,currentLength:0};return this.setMetaValue([e,"@vault/pagination","state"],a),a}return null}async loadNextPage(t,e){let n=typeof t=="string"?t:t.id;if(!n)return[null,null];let i=this.getPaginationState(t);if(!i||i.isFullyLoaded||!i.next)return[null,null];if(i.isFetching)return[i,null];let a=typeof i.next=="string"?i.next:i.next.id,o=i.currentPage,s={...i,isFetching:!0};this.setMetaValue([n,"@vault/pagination","state"],s);let u;try{u=await this.loadCollection(a,e,g=>{let{id:v,"@id":S,...E}=g||{};return S?{"@id":a,...E}:{id:a,...E}})}catch(g){let v={...i,isFetching:!1,error:g};return this.setMetaValue([n,"@vault/pagination","state"],v),[v,null]}if(!u){let g={...i,isFetching:!1,error:Error("Collection not found")};return this.setMetaValue([n,"@vault/pagination","state"],g),[g,null]}let d=this.get(n),p=[...d.items||[],...u.items||[]].map(g=>({id:g.id,type:g.type}));this.modifyEntityField({id:n,type:"Collection"},"items",p);let f=this.getPaginationState(t);if(!f)throw Error("Pagination state not found");let m={...f,isFetching:!1,error:null,currentPage:u.id,next:u.next?.id||null,currentPageIndex:f.pages.length,currentLength:p.length,pages:[...f.pages,{id:u.id,type:"Collection",startIndex:d.items.length,pageLength:u.items.length,order:typeof f.currentPageIndex=="number"?f.currentPageIndex+1:0}],isFullyLoaded:!u.next,previous:o,page:f.pages.length+1};return this.setMetaValue([n,"@vault/pagination","state"],m),[m,u]}getResourceMeta(t,e){let n=this.getState().iiif.meta[t];if(n)return e?n[e]:n}getObject(t,e,n={}){let{reactive:i,...a}=n;return ss(this.get(t,e,a),this,i)}async loadObject(t,e){return ss(await this.load(t,e),this)}async loadManifestObject(t,e){return ss(await this.loadManifest(t,e),this)}async loadCollectionObject(t,e){return ss(await this.loadCollection(t,e),this)}wrapObject(t){return ss(this.get(t,{skipSelfReturn:!1}),this)}isWrapped(t){return X6(t)}setMetaValue([t,e,n],i){this.dispatch(typeof i=="function"?i1.setMetaValueDynamic({id:t,meta:e,key:n,updateValue:i}):i1.setMetaValue({id:t,meta:e,key:n,value:i}))}};function pM(){return typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}function nd(t){let e=pM();try{let i=e.IIIF_VAULT;if(i)return i}catch{}let n=new qu(t);try{e.IIIF_VAULT=n}catch{}return n}var c1=_(Y(),1),Ur=km.default.createContext({vault:null,setVaultInstance:t=>{}});function Io({vault:t,vaultOptions:e,useGlobal:n,resources:i,children:a}){let[o,s]=(0,km.useState)(()=>t||(n?nd(e):e?new qu(e):new qu));return(0,c1.jsx)(Ur.Provider,{value:{vault:o,setVaultInstance:s},children:(0,c1.jsx)(ci,{value:i||{},children:a})})}var gM=_(nt(),1),yM=_(nt(),1);var mM=_(nt(),1),Vt=()=>{let{vault:t}=(0,mM.useContext)(Ur);if(t===null)throw new Error("Vault not found. Ensure you have your provider set up correctly.");return t};var Ym=_(nt(),1);function re(t,e=[]){let n=Vt(),[i,a]=(0,Ym.useState)(()=>t(n.getState(),n));return(0,Ym.useEffect)(()=>n.subscribe(o=>t(o,n),o=>{a(o)},!1),e),i}var us=yM.default.createContext([]);function cs(){let t=(0,gM.useContext)(us);return re(e=>t.map(n=>e.iiif.entities.Canvas[n]).filter(Boolean),[t])}var vM=_(nt(),1);function Do(t){let e=(0,vM.useContext)(Ur);return t||(e&&e.vault?e.vault:nd())}var SM=_(nt(),1);function on(t={},e=[]){let{id:n,selector:i}=t,a=ti(),o=Vt(),s=n||a.manifest,u=re(d=>s?d.iiif.entities.Manifest[s]:void 0,[s]);return(0,SM.useMemo)(()=>{if(u)return i?i(u):u},[u,i,...e])}var YM=_(nt(),1),tg=_(nt(),1);var Vr=_(nt(),1);function id(t,{noCache:e=!1}={}){let n=typeof t=="string"?t:t.id,i=Do(),[a,o]=(0,Vr.useState)(n),[s,u]=(0,Vr.useState)(void 0),d=(0,Vr.useMemo)(()=>i.get(n,{skipSelfReturn:!0})||void 0,[n,i]),[p,f]=(0,Vr.useState)(d);return(0,Vr.useEffect)(()=>{(async()=>{try{let m=d&&!e?d:await i.load(n),g=m?m.id||m["@id"]:null;m&&a!==g&&o(g),f(m)}catch(m){u(m)}})()},[n,e]),{isLoaded:!!p,id:a,requestId:n,error:s,resource:p,cached:!!(p&&p===d)}}function f1(t,e){let{id:n,isLoaded:i,error:a,resource:o,requestId:s,cached:u}=id(t,e);return{id:n,isLoaded:i,error:a,manifest:o,requestId:s,cached:u}}var bM=_(Y(),1);function d1({manifest:t,children:e}){return(0,bM.jsx)(ci,{value:{manifest:t},children:e})}var xM=_(Y(),1);function h1({range:t,children:e}){return(0,xM.jsx)(ci,{value:{range:t},children:e})}function EM(t,e){for(let n of e.items){if(n.type==="Canvas")return n;if(n.type==="SpecificResource")return n.source;if(n.type==="Range"){let i=EM(t,t.get(n));if(i)return i}}return null}function Qm(t,e){let n=[];for(let i of e.items)if(i.type==="SpecificResource"&&i.source?.type==="Canvas"&&(i.source.id.indexOf("#")!==-1?n.push({id:i.source.id.split("#")[0],type:"Canvas"}):n.push(i.source)),i.type==="Range"&&n.push(...Qm(t,t.get(i))),i.type==="SpecificResource"){let a=typeof i.source=="string"?i.source:i.source.id;n.push({id:a,type:"Canvas"})}return n}function K6(t,e,n){for(let i of e.structures){let a=p1(t,t.get(i),n);if(a)return a}return null}function p1(t,e,n){for(let i of e.items){let a=i?.source?.id?.split("#")[0];if(i.type==="SpecificResource"&&i.source===n||i.type==="SpecificResource"&&i.source?.type==="Canvas"&&n===a)return e;if(i.type==="Range"){let o=p1(t,t.get(i),n);if(o)return o}}return null}function Z6(t,e,n,i=!1){let a=e.behavior,o=n?t.get(n):null;if(!o)return[];let s=o.behavior,u=i?!1:a.includes("paged"),d=u?!1:a.includes("continuous"),p=u||d?!1:a.includes("individuals"),f=s.includes("facing-pages"),m=s.includes("non-paged");if(f||m||p||i)return[{id:o.id,type:"Canvas"}];let[g,v]=Xm(t,e);if(d)return g;let S=g.findIndex(E=>E.id===n);if(S===-1)return[];for(let E of v)if(E.includes(S))return E.map(T=>g[T]);return[{id:o.id,type:"Canvas"}]}function Xm(t,e,{disablePaging:n,skipNonPaged:i}={}){let a=e.behavior,o=a.includes("paged"),s=o?!1:a.includes("continuous"),u=o||s?!1:a.includes("individuals"),d=e.type==="Manifest"?e.items:Qm(t,e);if(s)return[d,[d.map((S,E)=>E)]];if(u||!o||n)return[d,d.map((S,E)=>[E])];let p=[],f=[],m=()=>{f.length&&(p.push([...f]),f=[])},g=0,v=!1;for(let S=0;S<d.length;S++){let E=t.get(d[S]);if(E.behavior.includes("non-paged")){S===g&&g++,i||(m(),p.push([S]),m());continue}if(S===g||E.behavior.includes("facing-pages")){f.length&&(v=!0),m(),p.push([S]),m();continue}if(f.push(S),v){m(),v=!1;continue}f.length>1&&m()}return f.length&&m(),[d,p]}var Ha=_(nt(),1);var AM=_(nt(),1);function ad(t={},e=[]){let{id:n,selector:i}=t,a=ti(),o=n||a.range,s=re(u=>o?u.iiif.entities.Range[o]:void 0,[o]);return(0,AM.useMemo)(()=>{if(s)return i?i(s):s},[s,i,...e])}function m1({startCanvas:t,disablePaging:e}){let n=Vt(),i=on(),a=ad(),[o,s]=(0,Ha.useState)(void 0),u=a||i;if(!u)throw new Error("Nothing selected");let[d,p]=(0,Ha.useMemo)(()=>Xm(n,u,{disablePaging:e}),[n,u,e]),f=(0,Ha.useRef)(p);if(f.current!==p){let T=f.current[o][0],A=p.findIndex(x=>x.includes(T));f.current=p,s(A)}let m=(0,Ha.useCallback)(E=>{let T=p.findIndex(A=>A.includes(E));s(T===-1?0:T)},[d,p]),g=(0,Ha.useCallback)(E=>{let T=d.findIndex(A=>A.id===E);T!==-1?m(T):s(0)},[d,p]),v=(0,Ha.useCallback)(()=>{s(E=>E>=p.length-1?E:E+1)},[p]),S=(0,Ha.useCallback)(()=>{s(E=>E<=0?0:E-1)},[p]);return typeof o>"u"&&(t?g(t):s(0)),{visibleItems:p[o]?.map(E=>d[E].id)||[],cursor:o,items:d,sequence:p,hasPrevious:o>0,hasNext:o<p.length-1,setSequenceIndex:s,setCanvasIndex:m,setCanvasId:g,next:v,previous:S}}var Va=_(nt(),1);var TM={},RM=t=>{let e,n=new Set,i=(f,m)=>{let g=typeof f=="function"?f(e):f;if(!Object.is(g,e)){let v=e;e=m??(typeof g!="object"||g===null)?g:Object.assign({},e,g),n.forEach(S=>S(e,v))}},a=()=>e,d={setState:i,getState:a,getInitialState:()=>p,subscribe:f=>(n.add(f),()=>n.delete(f)),destroy:()=>{(TM.env?TM.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."),n.clear()}},p=e=t(i,a,d);return d},Yi=t=>t?RM(t):RM;var BM=_(nt(),1),PM=_(IM(),1),Zm={},{useDebugValue:pH}=BM.default,{useSyncExternalStoreWithSelector:mH}=PM.default,DM=!1,gH=t=>t;function bt(t,e=gH,n){(Zm.env?Zm.env.MODE:void 0)!=="production"&&n&&!DM&&(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"),DM=!0);let i=mH(t.subscribe,t.getState,t.getServerState||t.getInitialState,e,n);return pH(i),i}var LM=t=>{(Zm.env?Zm.env.MODE:void 0)!=="production"&&typeof t!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");let e=typeof t=="function"?Yi(t):t,n=(i,a)=>bt(e,i,a);return Object.assign(n,e),n},Wm=t=>t?LM(t):LM;function yH(t){let e=t.service||t.services||[];for(let n of e)if(n.type==="AuthProbeService2")return!0;return!1}function Ua(t,e,n){let i=e.findIndex(s=>s.service.id===t);if(i===-1)return e;let a=[...e],o=n(a[i]);return o===a[i]?e:(a[i]=o,a)}var v1=()=>Yi((t,e)=>({currentAuth:-1,authItems:[],login:()=>{let n=e().authItems[e().currentAuth];if(!n||n.isPending||n.isLoggedIn)return;if(n.type!=="active")throw new Error("Cannot login to non-active service");let i=n.service.service.find(a=>a.type==="AuthAccessTokenService2");if(!i)throw new Error("Token service not found");t(()=>({authItems:Ua(n.id,e().authItems,a=>({...a,isPending:!0}))})),y1(n.service).then(()=>{Jm(i).then(a=>{let o=a.expiresIn,s=Date.now()+o*1e3;t(()=>({authItems:Ua(n.id,e().authItems,u=>({...u,isLoggedIn:!0,isPending:!1,session:{token:a.accessToken,expires:s}}))}))}).catch(a=>{t(()=>({authItems:Ua(n.id,e().authItems,o=>({...o,isLoggedIn:!1,isPending:!1,error:a.message}))}))})})},logout:()=>{let n=e().authItems[e().currentAuth];if(!n||n.isPending||!n.isLoggedIn)return;if(n.type!=="active")throw new Error("Cannot logout of non-active service");let i=n.service.service.find(s=>s.type==="AuthLogoutService2");if(!i)return;let a=`${i.id}?origin=${HM()}`,o=window.open(a);t(()=>({authItems:Ua(n.id,e().authItems,s=>({...s,isLoggedIn:!1,session:null,isPending:!1}))}))},nextAuth:()=>{let n=e().authItems.length,i=e().currentAuth+1;i>=n||t(()=>({currentAuth:i}))},previousAuth:()=>{let n=e().currentAuth-1;n<0||t(()=>({currentAuth:n}))},setAuth:n=>{n!==-1&&(n<0||n>=e().authItems.length)||t(()=>({currentAuth:n}))},addService:(n,i)=>{if(!n.service)return;let a=n.service.find(u=>u.type==="AuthAccessTokenService2"),o=n;if(e().authItems.find(u=>u.service.id===n.id)){t(()=>({authItems:Ua(n.id,e().authItems,u=>({...u,instances:u.instances+1}))}));return}if(t(()=>({currentAuth:o.profile==="active"?0:e().currentAuth,authItems:[{id:n.id,type:n.profile,service:n,probeId:i,canAuthenticate:!0,instances:1,isPending:!1,isLoggedIn:!1,session:null},...e().authItems]})),n.profile==="external"){if(!a)throw new Error("Token service not found");Jm(a).then(u=>{t(()=>({authItems:Ua(n.id,e().authItems,d=>({...d,isLoggedIn:!0,isPending:!1,session:{token:u.accessToken,expires:u.expiresIn}}))}))}).catch(u=>{t(()=>({authItems:Ua(n.id,e().authItems,d=>({...d,isLoggedIn:!1,isPending:!1,canAuthenticate:!1,error:u.message}))}))})}if(n.profile==="kiosk"){if(!a)throw new Error("Token service not found");t(()=>({authItems:Ua(n.id,e().authItems,u=>({...u,isPending:!0}))})),y1(o).then(()=>{Jm(a).then(u=>{t(()=>({authItems:Ua(n.id,e().authItems,d=>({...d,isLoggedIn:!0,isPending:!1,session:{token:u.accessToken,expires:u.expiresIn}}))}))}).catch(u=>{t(()=>({authItems:Ua(n.id,e().authItems,d=>({...d,isLoggedIn:!1,isPending:!1,error:u.message}))}))})})}n.profile},removeService:(n,i)=>{let a=e().currentAuth===e().authItems.findIndex(s=>s.service.id===n.id),o=e().currentAuth;if(a){let s=e().authItems.find(d=>d.service.id===n.id);s&&s.instances>1||(o=e().authItems.findIndex(p=>p.service.id!==n.id&&p.instances>0))}t(()=>({authItems:Ua(n.id,e().authItems,s=>({...s,instances:s.instances-1})),currentAuth:o}))}})),S1=(t,e)=>Yi((n,i)=>({service:t,status:t?"unknown":"success",shouldRedirect:!1,redirectResource:null,shouldSubstitute:!1,substituteResource:null,error:null,errorHeading:null,errorNote:null,shouldDisplayResource:!1,token:e||null,async probe(){if(!i().service)return;let a=i().service?.id;if(!a){n({status:"error",error:"Service ID not found",errorHeading:{en:["Service ID not found"]}});return}n({status:"probing"});let o=i().token;try{let s=await fetch(a,{headers:o?{Authorization:`Bearer ${i().token}`,Accept:"application/json"}:{Accept:"application/json"}}).then(u=>u.json());if(s.status===200)n({status:"success",shouldDisplayResource:!0,error:null,errorHeading:null,errorNote:null,shouldSubstitute:!1,shouldRedirect:!1});else if(s.status<400&&s.status>=300){if(!s.location)throw new Error("Redirect location not found");n({status:"error",shouldDisplayResource:!1,shouldRedirect:!0,redirectResource:s.location||null})}else if(s.status===401)n({status:"error",shouldDisplayResource:!1,shouldRedirect:!1,shouldSubstitute:!!s.substitute,substituteResource:s.substitute||null,error:"Unauthorized",errorHeading:s.heading||{en:["Unauthorized"]},errorNote:s.note||null});else throw new Error("Unknown error")}catch(s){n({status:"error",error:s.message,errorHeading:{en:["Unknown error"]}})}},setToken(a){n({token:a})}}));function b1(t){let e=t.service||t.services||[],n={hasAuth:!1,services:{}};for(let i of e)if(i.type==="AuthProbeService2"){n.services.probe=i,n.hasAuth=!0;let a=i.service.filter(o=>o.type==="AuthAccessService2");a[0]&&(n.services.access=a[0])}return n}async function Jm(t,{strict:e=!0}={}){return new Promise((n,i)=>{let a=Math.random().toString(36).substring(7),o=`${t.id}?messageId=${a}&origin=${window.location.origin}`,s=p=>{let f=p.data;if(f.messageId===a){if(e&&f.type!=="AuthAccessToken2"){u(),i("Invalid response, expected type=AuthAccessToken2");return}if(!f.accessToken){u(),i("Invalid response, expected accessToken");return}u(),n(f)}},u=()=>window.removeEventListener("message",s),d=document.createElement("iframe");d.src=o,d.style.display="none",document.body.appendChild(d),window.addEventListener("message",s)})}function HM(t){let e=window.location;if(t){let n=document.createElement("a");return n.href=t,n.protocol+"//"+n.hostname+(n.port?":"+n.port:"")}return e.protocol+"//"+e.hostname+(e.port?":"+e.port:"")}async function y1(t){let e=`${t.id}?origin=${HM()}`,n=window.open(e);if(!n)throw new Error("Failed to open window");return new Promise((i,a)=>{let o=setInterval(()=>{n.closed&&(clearInterval(o),i())},500)})}var Gu=_(nt(),1);function UM(t){let e=(0,Gu.useMemo)(()=>b1(t),[t]),n=x1(e.services.access?.id),i=(0,Gu.useMemo)(()=>S1(e.services.probe,n),[e.services.probe]),a=bt(i);return(0,Gu.useEffect)(()=>{a.status==="unknown"&&!n&&a.probe()},[e.services.probe,a.status]),(0,Gu.useEffect)(()=>{n&&(a.setToken(n),a.probe())},[n]),[t,a,e.hasAuth]}var od=_(Y(),1),fs=(0,Va.createContext)(null),VM=(0,Va.createContext)(null);VM.displayName="CurrentAuth";var jM=(0,Va.createContext)(null);jM.displayName="AuthActions";function A1({children:t}){let e=(0,Va.useMemo)(()=>v1(),[]);return(0,od.jsx)(fs.Provider,{value:e,children:t})}function R1(){return!!(0,Va.useContext)(fs)}function ku(){let t=(0,Va.useContext)(fs);if(!t)throw new Error("useAuthActions must be used within a AuthProvider");return t}function qM(){let t=ku();return bt(t,n=>({login:n.login,logout:n.logout,nextAuth:n.nextAuth,previousAuth:n.previousAuth,setAuth:n.setAuth,addService:n.addService,removeService:n.removeService}))}function vH(){let t=ku();return bt(t,e=>e)}function FM(t){let e=ku();return bt(e,i=>i.authItems.find(a=>a.service.id===t))}function x1(t){let e=ku();return bt(e,i=>i.authItems.find(a=>a.id===t)?.session?.token)}function SH(t){let e=ku();return bt(e,i=>{let a=i.authItems.find(o=>o.service.id===t);return!a||!a.isLoggedIn||!a.session?null:a.session?.token||null})}function bH(t){let e=qM(),n=FM(t.service.id);return(0,Va.useEffect)(()=>(e?.addService(t.service,t.probeId),()=>{e?.removeService(t.service,t.probeId)}),[t.service]),n?(n.error||!n.isLoggedIn,t.children):null}function E1(){return null}function T1(t){let[e,n,i]=UM(t.resource),a=t.fallbackComponent||E1,o=t.loadingComponent||E1,s=t.errorComponent||E1,u=n.service,d=null;if(!i||!u)return t.children(e);let p=u.service.filter(f=>f.type==="AuthAccessService2");n.status==="error"&&(d=(0,od.jsx)(s,{resource:t.resource,error:n.error||"",heading:n.errorHeading,note:n.errorNote,extra:t.extra})),(n.status==="unknown"||n.status==="probing")&&(d=(0,od.jsx)(o,{})),n.status==="success"&&(d=t.children(e));for(let f of p)d=(0,od.jsx)(bH,{service:f,probeId:u.id,children:d},f.id);return d}var rd=_(nt(),1);var xH=t=>t.id||t["@id"];function EH(t){return(Array.isArray(t.service)?t.service:[t.service]).find(n=>n.profile==="http://iiif.io/api/search/0/autocomplete"||n.profile==="http://iiif.io/api/search/1/autocomplete"||n.profile==="AutoCompleteService1")}var GM=t=>{let e;typeof t=="string"?e={"@context":"http://iiif.io/api/search/1/context.json",profile:"http://iiif.io/api/search/1/search","@id":t,id:t,service:[]}:e=t;let n=e?xH(e):void 0,i=null;return Yi((a,o)=>({service:e,resources:[],lastQuery:{},loading:!1,error:!1,highlight:null,hasSearch:!!e,hasAutocomplete:e?!!EH(e):!1,errorMessage:"",search(s,u={}){if(!n)throw new Error("No search service found.");i&&!i.signal.aborted&&i.abort(),i=new AbortController;let d=new URLSearchParams;s.q&&d.set("q",s.q),s.motivation&&d.set("motivation",s.motivation),s.date&&d.set("date",s.date),s.user&&d.set("user",s.user),a({loading:!0}),fetch(`${n}?${d.toString()}`,{signal:i.signal,headers:{"Content-Type":"application/json",Accept:"application/json",...u.headers||{}}}).then(async p=>{if(!i?.signal.aborted)if(p.ok){let f=await p.json();a({resources:f.resources,error:!1,errorMessage:""})}else a({resources:[],error:!0,errorMessage:p.statusText})})},clearSearch(){a({resources:[],error:!1,errorMessage:""})},highlightResult(s){let u=o().resources.find(d=>d["@id"]===s);a({highlight:u})},nextResult(){let s=o().resources,u=o().highlight;if(!u){a({highlight:s[0]||null});return}let d=s.findIndex(p=>p["@id"]===u["@id"]);if(d===-1){a({highlight:s[0]||null});return}a({highlight:s[d+1]||s[0]||null})},previousResult(){let s=o().resources,u=o().highlight;if(!u){a({highlight:s[s.length-1]||null});return}let d=s.findIndex(p=>p["@id"]===u["@id"]);if(d===-1){a({highlight:s[s.length-1]||null});return}if(d===0){a({highlight:s[s.length-1]||null});return}a({highlight:s[d-1]||s[s.length-1]||null})}}))};function C1(){let t=on();return t?t.service.find(e=>e.profile==="SearchService1"||e.profile==="http://iiif.io/api/search/1/search"):void 0}var $m=_(Y(),1),Yu=(0,rd.createContext)(null);Yu.displayName="Search";function kM(t){let e=C1();return t.store?(0,$m.jsx)(Yu.Provider,{value:t.store,children:t.children}):(0,$m.jsx)(AH,{service:e,children:t.children})}function AH({service:t,children:e}){let n=(0,rd.useMemo)(()=>GM(t),[t]);return(0,$m.jsx)(Yu.Provider,{value:n,children:e})}var Ei=_(Y(),1),ld=()=>{},Qu=(0,tg.createContext)({setCurrentCanvasId:ld,setCurrentCanvasIndex:ld,nextCanvas:ld,previousCanvas:ld,items:[],sequence:[],setSequenceIndex:ld,currentSequenceIndex:0,hasNext:!1,hasPrevious:!1});function QM(t){let e=on(),{cursor:n,visibleItems:i,next:a,sequence:o,items:s,setCanvasIndex:u,setCanvasId:d,previous:p,setSequenceIndex:f,hasNext:m,hasPrevious:g}=m1({startCanvas:t.startCanvas,disablePaging:t.pagingEnabled===!1}),v=(0,tg.useMemo)(()=>({sequence:o,items:s,setCurrentCanvasId:d,nextCanvas:a,previousCanvas:p,totalCanvases:s.length,setCurrentCanvasIndex:u,setSequenceIndex:f,currentSequenceIndex:n,hasNext:m,hasPrevious:g}),[o,s,d,a,p,s,u,f,n]);return e?i.length===0?null:(0,Ei.jsx)(Qu.Provider,{value:v,children:(0,Ei.jsx)(us.Provider,{value:i,children:(0,Ei.jsx)(ma,{canvas:i[0],children:t.children})})}):(console.warn("The manifest passed to the provider is not a valid IIIF manifest."),(0,Ei.jsx)("div",{children:"Sorry, something went wrong."}))}function w1(t){let e=Do(t.vault),n=f1(t.manifest);if(!n)return console.warn("The manifest passed to the provider is not a valid IIIF manifest."),(0,Ei.jsx)("div",{children:"Sorry, something went wrong."});if(n.error)return(0,Ei.jsx)("div",{children:n.error.toString()});if(!n.isLoaded)return(0,Ei.jsx)("div",{children:"Loading..."});let i=(0,Ei.jsx)(QM,{...t,children:t.children});return(0,Ei.jsx)(Io,{vault:e,children:(0,Ei.jsx)(d1,{manifest:n.id,children:(0,Ei.jsx)(A1,{children:(0,Ei.jsx)(kM,{children:t.rangeId?(0,Ei.jsx)(h1,{range:t.rangeId,children:i}):i})})})})}function ds(){return(0,YM.useContext)(Qu)}var Xu=(t,e,n)=>{let i=t.length,a=n||Tt(i);for(let o=0;o<i;o++)a[o]=o%5===0?t[o+1]<e[3]&&t[o+3]>e[1]&&t[o+2]<e[4]&&t[o+4]>e[2]?1:0:t[o];return a};function Tt(t,e,n){return new Float32Array(t,e,n)}var XM=(t,e,n)=>{let i=t[1]<=e[3]&&t[3]>=e[1]&&t[2]<=e[4]&&t[4]>=e[2],a=n||Tt(5);return i?(a[0]=1,a[1]=Math.max(t[1],e[1]),a[2]=Math.max(t[2],e[2]),a[3]=Math.min(t[3],e[3]),a[4]=Math.min(t[4],e[4]),a):(a[0]=0,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a)},KM=t=>t.length/5;var oo=(t,e,n)=>{let i=n||Tt(9);return i[0]=t[0]*e[0]+t[1]*e[3]+t[2]*e[6],i[1]=t[0]*e[1]+t[1]*e[4]+t[2]*e[7],i[2]=t[0]*e[2]+t[1]*e[5]+t[2]*e[8],i[3]=t[3]*e[0]+t[4]*e[3]+t[5]*e[6],i[4]=t[3]*e[1]+t[4]*e[4]+t[5]*e[7],i[5]=t[3]*e[2]+t[4]*e[5]+t[5]*e[8],i[6]=t[6]*e[0]+t[7]*e[3]+t[8]*e[6],i[7]=t[6]*e[1]+t[7]*e[4]+t[8]*e[7],i[8]=t[6]*e[2]+t[7]*e[5]+t[8]*e[8],i},Zt=class t{constructor(e){this.index=0,this.length=e,this.points=Tt(this.length)}static grid(e=1,n=1){return new t(5*e*n)}static point(e,n){let i=Tt(5);return i[0]=1,i[1]=e,i[2]=n,i[3]=e,i[4]=n,i}static positionPair(e){let n=Tt(5);return n[0]=1,n[1]=e.x1,n[2]=e.y1,n[3]=e.x2,n[4]=e.y2,n}static projection(e){return t.singleBox(e.width,e.height,e.x,e.y)}static singleBox(e,n,i=0,a=0){let o=Tt(5);return o[0]=1,o[1]=i,o[2]=a,o[3]=e+i,o[4]=n+a,o}row(e){return e(this)}addPoints(e,n,i,a){return this.points[this.index]=1,this.points[1+this.index]=e,this.points[2+this.index]=n,this.points[3+this.index]=i,this.points[4+this.index]=a,this.index+=5,this}addBox(e,n,i,a){return this.addPoints(e,n,e+i,n+a),this}build(){return this.points}};var ja=(t,e)=>{let n=t.length;for(let i=0;i<n;i++)t[i]=i%5===0?e[6]*t[i+1]+e[7]*t[i+2]+e[8]*t[i]:i%5%2===1?e[0]*t[i]+e[1]*t[i+1]+e[2]:e[3]*t[i-1]+e[4]*t[i]+e[5];return t},Lo=t=>{let e=Tt(9);return e[0]=t,e[4]=t,e[8]=1,e},ei=(t,e)=>{let n=Tt(9);return n[0]=1,n[2]=t,n[4]=1,n[5]=e,n[8]=1,n},Ku=(t,e,n)=>oo(ei((1-t)*e,(1-t)*n),Lo(t)),ro=(t,e,n)=>{let i=t.length,a=n&&n.length>=i?n.slice(0,i):Tt(i);for(let o=0;o<i;o++)a[o]=o%5===0?e[6]*t[o+1]+e[7]*t[o+2]+e[8]*t[o]:o%5%2===1?e[0]*t[o]+e[1]*t[o+1]+e[2]:e[3]*t[o-1]+e[4]*t[o]+e[5];return a};var nv=_(nt(),1),st=_(nt(),1),Ce=_(Y(),1);var Qi=_(nt(),1);function ZM(t,e){let n;return(...i)=>{window.clearTimeout(n),n=window.setTimeout(()=>t(...i),e)}}function M1({debounce:t,scroll:e,polyfill:n,offsetSize:i}={debounce:0,scroll:!1,offsetSize:!1}){let 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[o,s]=(0,Qi.useState)({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),u=(0,Qi.useRef)({element:null,scrollContainers:null,resizeObserver:null,lastBounds:o,orientationHandler:null}),d=t?typeof t=="number"?t:t.scroll:null,p=t?typeof t=="number"?t:t.resize:null,f=(0,Qi.useRef)(!1);(0,Qi.useEffect)(()=>(f.current=!0,()=>void(f.current=!1)));let[m,g,v]=(0,Qi.useMemo)(()=>{let A=()=>{if(!u.current.element)return;let{left:x,top:R,width:C,height:M,bottom:z,right:N,x:D,y:q}=u.current.element.getBoundingClientRect(),P={left:x,top:R,width:C,height:M,bottom:z,right:N,x:D,y:q};u.current.element instanceof HTMLElement&&i&&(P.height=u.current.element.offsetHeight,P.width=u.current.element.offsetWidth),Object.freeze(P),f.current&&!wH(u.current.lastBounds,P)&&s(u.current.lastBounds=P)};return[A,p?ZM(A,p):A,d?ZM(A,d):A]},[s,i,d,p]);function S(){u.current.scrollContainers&&(u.current.scrollContainers.forEach(A=>A.removeEventListener("scroll",v,!0)),u.current.scrollContainers=null),u.current.resizeObserver&&(u.current.resizeObserver.disconnect(),u.current.resizeObserver=null),u.current.orientationHandler&&("orientation"in screen&&"removeEventListener"in screen.orientation?screen.orientation.removeEventListener("change",u.current.orientationHandler):"onorientationchange"in window&&window.removeEventListener("orientationchange",u.current.orientationHandler))}function E(){u.current.element&&(u.current.resizeObserver=new a(v),u.current.resizeObserver.observe(u.current.element),e&&u.current.scrollContainers&&u.current.scrollContainers.forEach(A=>A.addEventListener("scroll",v,{capture:!0,passive:!0})),u.current.orientationHandler=()=>{v()},"orientation"in screen&&"addEventListener"in screen.orientation?screen.orientation.addEventListener("change",u.current.orientationHandler):"onorientationchange"in window&&window.addEventListener("orientationchange",u.current.orientationHandler))}let T=A=>{!A||A===u.current.element||(S(),u.current.element=A,u.current.scrollContainers=WM(A),E())};return TH(v,!!e),RH(g),(0,Qi.useEffect)(()=>{S(),E()},[e,v,g]),(0,Qi.useEffect)(()=>S,[]),[T,o,m]}function RH(t){(0,Qi.useEffect)(()=>{let e=t;return window.addEventListener("resize",e),()=>void window.removeEventListener("resize",e)},[t])}function TH(t,e){(0,Qi.useEffect)(()=>{if(e){let n=t;return window.addEventListener("scroll",n,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",n,!0)}},[t,e])}function WM(t){let e=[];if(!t||t===document.body)return e;let{overflow:n,overflowX:i,overflowY:a}=window.getComputedStyle(t);return[n,i,a].some(o=>o==="auto"||o==="scroll")&&e.push(t),[...e,...WM(t.parentElement)]}var CH=["x","y","top","bottom","left","right","width","height"],wH=(t,e)=>CH.every(n=>t[n]===e[n]);var vA=_(fO(),1);var OH=Object.defineProperty,_H=(t,e,n)=>e in t?OH(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,ag=(t,e,n)=>(_H(t,typeof e!="symbol"?e+"":e,n),n);function hs(t){return t.endsWith("info.json")?t:t.endsWith("/")?`${t}info.json`:`${t}/info.json`}var zH="http://library.stanford.edu/iiif/image-api/compliance.html#level0",mO="http://library.stanford.edu/iiif/image-api/compliance.html#level1",gO="http://library.stanford.edu/iiif/image-api/compliance.html#level2",NH="http://library.stanford.edu/iiif/image-api/conformance.html#level0",yO="http://library.stanford.edu/iiif/image-api/conformance.html#level1",vO="http://library.stanford.edu/iiif/image-api/conformance.html#level2",IH="http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level0",SO="http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level1",bO="http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level2",DH="http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level0",xO="http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level1",EO="http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level2",LH="http://iiif.io/api/image/1/level0.json",BH="http://iiif.io/api/image/1/profiles/level0.json",AO="http://iiif.io/api/image/1/level1.json",RO="http://iiif.io/api/image/1/profiles/level1.json",TO="http://iiif.io/api/image/1/level2.json",CO="http://iiif.io/api/image/1/profiles/level2.json",PH="http://iiif.io/api/image/2/level0.json",HH="http://iiif.io/api/image/2/profiles/level0.json",wO="http://iiif.io/api/image/2/level1.json",MO="http://iiif.io/api/image/2/profiles/level1.json",OO="http://iiif.io/api/image/2/level2.json",_O="http://iiif.io/api/image/2/profiles/level2.json",UH="level0",zO="level1",NO="level2",VH="http://iiif.io/api/image/2/level0",IO="http://iiif.io/api/image/2/level1",DO="http://iiif.io/api/image/2/level2",jH="https://iiif.io/api/image/1.1/compliance/#level0",LO="https://iiif.io/api/image/1.1/compliance/#level1",BO="https://iiif.io/api/image/1.1/compliance/#level2",PO=[DO,gO,vO,bO,EO,TO,CO,OO,_O,NO,BO],HO=[...PO,IO,mO,yO,SO,xO,AO,RO,wO,MO,zO,LO],qH=[VH,IO,DO,zH,mO,gO,NH,yO,vO,IH,SO,bO,DH,xO,EO,LH,BH,AO,RO,TO,CO,PH,HH,wO,MO,OO,_O,UH,zO,NO,jH,LO,BO];var FH={extraFormats:["jpg"],extraQualities:["default"],extraFeatures:["sizeByWhListed"]},GH={extraFormats:["jpg"],extraQualities:["default"],extraFeatures:["baseUriRedirect","cors","jsonldMediaType","regionByPx","regionSquare","sizeByWhListed","sizeByH","sizeByW","sizeByWh"]},kH={extraFormats:["jpg","png"],extraQualities:["default"],extraFeatures:["baseUriRedirect","cors","jsonldMediaType","regionByPct","regionByPx","regionSquare","rotationBy90s","sizeByWhListed","sizeByConfinedWh","sizeByH","sizeByPct","sizeByW","sizeByWh"]};function YH(t){return PO.indexOf(t)!==-1?kH:HO.indexOf(t)!==-1?GH:FH}function QH(t){let e=t?Array.isArray(t.profile)?t.profile:[t.profile]:[],n={extraQualities:[],extraFormats:[],extraFeatures:[]};for(let i of e)if(typeof i=="string"&&(i=YH(i)),!!i){if(i.formats)for(let a of i.formats)n.extraFormats.indexOf(a)===-1&&n.extraFormats.push(a);if(i.qualities)for(let a of i.qualities)n.extraQualities.indexOf(a)===-1&&n.extraQualities.push(a);if(i.supports)for(let a of i.supports)n.extraFeatures.indexOf(a)===-1&&n.extraFeatures.push(a);if(i.maxHeight&&(n.maxHeight=i.maxHeight),i.maxWidth&&(n.maxWidth=i.maxWidth),i.maxArea&&(n.maxArea=i.maxArea),i.extraFormats)for(let a of i.extraFormats)n.extraFormats.indexOf(a)===-1&&n.extraFormats.push(a);if(i.extraQualities)for(let a of i.extraQualities)n.extraQualities.indexOf(a)===-1&&n.extraQualities.push(a);if(i.extraFeatures)for(let a of i.extraFeatures)n.extraFeatures.indexOf(a)===-1&&n.extraFeatures.push(a);i.maxHeight&&(n.maxHeight=i.maxHeight),i.maxWidth&&(n.maxWidth=i.maxWidth),i.maxArea&&(n.maxArea=i.maxArea)}if(t.extraFormats)for(let i of t.extraFormats)n.extraFormats.indexOf(i)===-1&&n.extraFormats.push(i);if(t.extraFeatures)for(let i of t.extraFeatures)n.extraFeatures.indexOf(i)===-1&&n.extraFeatures.push(i);if(t.extraQualities)for(let i of t.extraQualities)n.extraQualities.indexOf(i)===-1&&n.extraQualities.push(i);return n}function XH(t){try{if(t==="full")return{full:!0};if(t==="square")return{square:!0};let e=t.startsWith("pct:"),n=t.substr(e?4:0).split(",").map(i=>parseFloat(i));return{x:n[0],y:n[1],w:n[2],h:n[3],percent:e}}catch{throw new Error("Expected 'full', 'square' or 'x,y,w,h'. Found "+t)}}function KH(t){let e={upscaled:!1,max:!1,confined:!1};if(t[0]==="^"&&(e.upscaled=!0,t=t.slice(1)),t==="max"||t==="full")return e.max=!0,e.serialiseAsFull=t==="full",e;if(t[0]==="!"&&(e.confined=!0,t=t.slice(1)),t[0]==="p")return e.percentScale=parseFloat(t.slice(4)),e;let n=t.split(",").map(i=>i.trim());return n.length&&typeof n[0]<"u"&&(n[0]!==""&&(e.width=parseInt(n[0],10)),typeof n[1]<"u"&&n[1]!==""?(e.height=parseInt(n[1],10),e.version=2):e.version=3),e}function ZH(t){let e={angle:0};if(t[0]==="!"&&(e.mirror=!0,t=t.substr(1)),e.angle=parseFloat(t)%360,Number.isNaN(e.angle))throw new Error(`Invalid rotation ${t}`);return e}function WH(t,e=""){let n=t.match(/^(([a-zA-Z]+):\/\/([^/]+))?((.*)+)/);if(!n)throw new Error(`Invalid or unknown input ${t}`);let i=n[2],a=n[3],o=n[4];if(o[0]==="/"&&(o=o.substring(1)),e.length>0){if(e[0]==="/"&&(e=e.substring(1)),e!==o.substring(0,e.length))throw new Error(`Path does not start with prefix (path: ${o}, prefix: ${e})`);o=o.substring(e.length)}return{scheme:i,server:a,path:o,prefix:e}}function JH(t,e=""){let{path:n,scheme:i,server:a,prefix:o}=WH(t,e),s=(n||"").split("/").reverse(),[u,d,p,f,...m]=s,g=m.reverse().filter(Boolean).join("/");if(s.length===1||u==="")return{type:"base",scheme:i,server:a,prefix:o,identifier:g};if(u==="info.json"){let[,...S]=s;return{type:"info",scheme:i,server:a,prefix:o,identifier:S.reverse().filter(Boolean).join("/")}}let v=(u||"").split(".");if(typeof v[1]>"u"||typeof v[0]>"u"||typeof f>"u"||typeof p>"u"||typeof d>"u")throw new Error("Invalid image request");return{type:"image",scheme:i,server:a,prefix:o,identifier:g,originalPath:n,region:XH(f),size:KH(p),rotation:ZH(d),quality:v[0],format:v[1]}}function $H(t){let e=JH(hs(t.id));if(e.type!=="info")throw new Error("Invalid service URL");let n=QH(t);return{identifier:e.identifier,originalPath:"",server:e.server,prefix:e.prefix,scheme:e.scheme,type:"image",quality:n.extraQualities.indexOf("default")===-1?n.extraQualities[0]:"default",region:{full:!0},size:{max:!0,upscaled:!1,confined:!1},format:"jpg",rotation:{angle:0}}}function tU(t,e,n){let i=n.length,a=[];for(let o=0;o<i;o++){let s=n[o];if(s){let u=s.width;a.push(t/u)}}return a}function eU(t,e,n){let i=n.length,a=[];for(let o=0;o<i;o++){let s=n[o];s&&a.push({width:Math.floor(t/s),height:Math.floor(e/s)})}return a}function Ze(t){if(t["@id"])return t["@id"];if(t.id)return t.id}function rg(t){if(!t||!t.profile||!Ze(t))return!1;let e=Array.isArray(t.profile)?t.profile:[t.profile];for(let n of e)if(typeof n=="string"&&qH.indexOf(n)!==-1)return!0;return!1}function nU(t){if(!rg(t))return!1;let e=Array.isArray(t.profile)?t.profile:[t.profile];for(let n of e)if(typeof n=="string"){if(HO.indexOf(n)!==-1)return!0}else{let i=[...n.supports||[],...n.extraFeatures||[]];if(i.indexOf("regionByPx")!==-1&&(i.indexOf("sizeByW")!==-1||i.indexOf("sizeByWh")!==-1))return!0}return!1}function og(t,e){if(e&&e.profile){let n=e.profile;if(n){let i=Array.isArray(n)?n:[n];return i.includes(`level${t}`)||i.includes(`http://iiif.io/api/image/2/level${t}.json`)||i.includes(`http://iiif.io/api/image/1/level${t}.json`)||i.includes(`http://iiif.io/api/image/1/profiles/level${t}.json`)}}return!1}function U1(t){return rg(t)?og(0,t)?0:og(1,t)?1:og(2,t)?2:null:null}function UO(t){return(t["@context"]?Array.isArray(t["@context"])?t["@context"]:[t["@context"]]:[]).indexOf("http://iiif.io/api/image/3/context.json")!==-1}function iU(t){if(!nU(t))return[];let e=[],n=Array.isArray(t.profile)?t.profile:[t.profile],i=n.length;for(let a=0;a<i;a++){let o=n[a];if(o&&typeof o!="string"&&(o.maxHeight||o.maxWidth))return[{id:Ze(t),type:"variable",minWidth:0,minHeight:0,maxHeight:o.maxHeight||o.maxWidth,maxWidth:o.maxWidth||o.maxHeight,level:U1(t),version:t["@context"]==="http://iiif.io/api/image/3/context.json"?3:2}]}if(t.tiles){let a=t.tiles.length;for(let o=0;o<a;o++){let s=t.tiles[o];s&&(s.height||s.width)&&e.push({id:Ze(t),type:"variable",minHeight:0,minWidth:0,maxHeight:s.height||s.width,maxWidth:s.width,level:U1(t),version:UO(t)?3:2})}}return e}function dO(t){let e=/^.*\/(full)\/(((\d+),(\d+)?)|max)\/(\d+)\/default\.(jpg|png|jpeg)$/,n=t.match(e);if(n&&n[4]&&n[5]){let i=n[1],a=parseInt(n[4],10),o=parseInt(n[5],10),s=n[7];if((i==="max"||i==="full")&&a&&o&&s)return{type:"fixed",id:t,height:o,width:a}}return{type:"unknown",id:t}}function aU(t){if(t["@type"])return t["@type"];if(t.type)return t.type}function oU(t){if(typeof t=="string")return dO(t);let e=aU(t);if(e!=="Image"&&e!=="sc:Image")return null;let n=t,i=Ze(n);return i?i&&n.width&&n.height?{id:i,type:"fixed",width:n.width,height:n.height,unsafe:!0}:dO(i):null}function rU(t){return rg(t)?(t&&t.sizes?t.sizes:[]).map(e=>({id:Ze(t),type:"fixed-service",height:e.height,width:e.width,level:U1(t),version:UO(t)?3:2})):[]}function hO(t){let e=[],n=t.length;for(let i=0;i<n;i++){let a=t[i];if(!a)continue;let o=rU(a);o.length&&e.push(...o);let s=iU(a);s.length&&e.push(...s)}return e}function VO(t){let e=t.service?Array.isArray(t.service)?t.service:[t.service]:[],n=e.length,i=[];for(let a=0;a<n;a++)rg(e[a])&&i.push(e[a]);return i}function lU(t,e=!0,n){let i=[],a=oU(t);if(a===null)return i;let o=t;if(i.push(a),e&&o&&o.width&&o.height){let s=[],u=VO(o);for(let d of u){let p={id:Ze(d),width:o.width,height:o.height};if(n.canLoadSync(p)){let f=n.loadServiceSync(p);f&&(f.height||(f.height=o.height),f.width||(f.width=o.width),s.push(...hO([f])))}}if(s.length)return i.push(...s),i}return o.service&&i.push(...hO(o.service)),i}function sU({x:t=0,y:e=0,w:n,h:i,full:a,square:o,percent:s}){if(a)return"full";if(o)return"square";if(typeof n>"u"||typeof i>"u")throw new Error("RegionParameter: invalid region");let u=`${t},${e},${n},${i}`;return s?`pct:${u}`:u}function uU({max:t,percentScale:e,upscaled:n,confined:i,width:a,height:o,serialiseAsFull:s,version:u}){let d=[];return n&&d.push("^"),t?(d.push(s?"full":"max"),d.join("")):(i&&d.push("!"),e&&d.push(`pct:${e}`),a&&d.push(`${a}`),d.push(","),o&&u===3&&d.push(`${o}`),d.join(""))}function cU(t){return`${t.mirror?"!":""}${(t.angle||0)%360}`}function fU(t,e){let n=t.prefix.startsWith("/")?t.prefix.substr(1):t.prefix,i=`${t.scheme}://${t.server}/${n?`${n}/`:""}${t.identifier}`;if(t.type==="base")return i;if(t.type==="info")return`${i}/info.json`;let{size:a}=t,{region:o,rotation:s,format:u,quality:d}=t;if(e){let p=e["@context"]?Array.isArray(e["@context"])?e["@context"]:[e["@context"]]:[],f=e.profile,m=p.indexOf("http://iiif.io/api/image/2/context.json")!==-1||f==="level2",g=p.indexOf("http://iiif.io/api/image/3/context.json")!==-1;if((a.width===e.width&&!a.height||a.height===e.height&&!a.width||a.width===e.width&&a.height===e.height)&&(a={...a,max:!0}),m&&(a.max&&!a.serialiseAsFull&&(a={...a,serialiseAsFull:!0}),!a.max&&a.width&&a.height&&(a={...a,height:void 0}),a={...a,version:2}),g){if(a.max&&a.serialiseAsFull&&(a={...a,serialiseAsFull:!1}),a.width&&!a.height&&e.width&&e.height){let v=e.height/e.width;a={...a,height:Math.ceil(a.width*v)}}a={...a,version:3}}}return[i,sU(o),uU(a),cU(s),`${d}.${u}`].filter(Boolean).join("/")}function H1(t,e,n){let i=$H({"@context":t.version===3?"http://iiif.io/api/image/3/context.json":"http://iiif.io/api/image/2/context.json",id:hs(Ze(t)),profile:t.level===null||typeof t.level>"u"?"level0":`level${t.level}`,type:t.version===3?"ImageService3":"ImageService2"});if(i.type!=="image")throw new Error("Invalid service");return i.size.max=!1,i.size.width=e,i.size.height=n,{id:fU(i),type:"fixed",width:e,height:n||t.height/(t.width||1)*e,unsafe:t.width>e}}function Ju(t){let e=t.replace(/(https?:\/\/)?(www.)?/i,"");return e.indexOf("/")!==-1?e.split("/")[0]:e}function dU(t,e,n){let i=t.width?t.width:t.maxWidth;return n.height<=t.maxHeight&&n.width<=t.maxWidth&&n.height>=t.minHeight&&n.width>=t.minWidth&&(!e||Math.abs(n.width-i)<Math.abs(e.width-i))}function hU(t,e){let n=[],i=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},t),a=(f,m=0)=>i.explain?n.push(new Array(m).fill(0).map(g=>" ").join("")+f().trim()):void 0,o=[],s=[],u=null;a(()=>`Using configuration: ${JSON.stringify(i,null,2)}`);let d=(f,m)=>{if(a(()=>"Swapping choice",3),dU(i,m,f)){if(i.preferFixedSize&&f.unsafe){a(()=>`We found an image that was marked as unsafe, but it was the best size. (${f.id})`,4),s.push(f);return}i.returnAllOptions&&m&&s.push(m),a(()=>`We found a new image that was the best size. (${f.id})`,4),u=f}else i.returnAllOptions&&s.push(f)};a(()=>`The input shows we have ${e.length} list(s) of candidates to choose from.`);let p=e.length;for(let f=0;f<p;f++){let m=e[f]();a(()=>`Candidate group ${f}: ${JSON.stringify(m,null,2)}`,1);let g=m.length;a(()=>`Checking candidate list number ${f} and found ${g} potential ways of creating image(s)`,1);for(let v=0;v<g;v++){let S=m[v];if(a(()=>`-> Checking candidate ${v}`,1),S.type==="unknown"&&i.atAnyCost&&(a(()=>`We've found an unknown image type, adding this to the "last resort" list`,2),o.push(S)),S.type==="fixed"&&(S.unsafe?(a(()=>`We've found an unsafe fixed image type, adding this to the "last resort" list`,2),o.push(S)):(a(()=>"We've found a fixed size image, checking if it matches the request",2),d(S,u))),S.type==="fixed-service")if(i.unsafeImageService){a(()=>"Checking for an image from the tile source, without calculating the right height and width (unsafeImageService)",2);let E=H1(S,i.width,i.height);d(E,u)}else{a(()=>"Checking for an image from the tile source 3",2);let E=H1(S,S.width,S.height);d(E,u)}if(S.type==="variable"&&S.maxWidth){let E=H1({id:S.id,type:"fixed-service",width:S.maxWidth,height:S.maxWidth,level:S.level,version:S.version},S.maxWidth);d(E,u)}}if(u&&!i.returnAllOptions){if(u.unsafe||i.allowUnsafe)continue;a(()=>`We found a match in choice list number ${f}, no searching any more`);break}}return i.atAnyCost&&s.length===0?(a(()=>u?`We found an image! ${u.id} of type ${u.type}`:'We found no images, but "atAnyCost" is set, so returning that'),{best:u||o[0]||null,fallback:o.slice(1),log:n}):i.returnAllOptions?(a(()=>"Returning all options that we have found"),{best:(i.atAnyCost?u||s[0]||o[0]:u||s[0])||null,fallback:[...s,...o],log:n}):(a(()=>"Returning the best image that we found, and a fallback"),{best:u||s[0]||null,fallback:u?s:s.slice(1),log:n})}function pU(t,e,n){let i=t>e?t:e,a=n.length,o=[];for(let s=0;s<a;s++){let u=n[s];if(!u||u.scaleFactors.length===0)continue;let d=u.scaleFactors[0];if(!d)continue;let p=i/d,f=[d];for(;p>=u.width;)d=d*2,f.push(d),p=p/2;o.push({...u,scaleFactors:f})}return o}function mU(t,e){if(t.length!==e.length)return!1;if(t.length===0&&e.length===0)return!0;let n=t.length,i=!0;for(let o=0;o<n;o++){let s=t[o],u=e[o];if(s.width!==u.width||s.height!==u.height){i=!1;break}}if(i)return!0;let a=0;for(let o=0;o<n;o++)for(let s=0;s<n;s++)if(t[o].width===e[s].width&&t[o].height===e[s].height){a++;break}return a===n}function pO(t){return og(0,t)}var jO=class{constructor(t={}){ag(this,"config",{verificationsRequired:1,approximateServices:!1,enableFetching:!0,disableThrottling:!1}),ag(this,"fetchingCount",0),ag(this,"imageServices",{}),ag(this,"knownImageServers",{}),this.config=Object.assign(this.config,t)}setConfig(t){Object.assign(this.config,t)}sample(t,e,n=!0){let i=Ju(Ze(t)),a=hs(Ze(t)),o=this.knownImageServers[i];return this.imageServices[a]=Object.assign(t,{real:!0}),!o&&t.tiles&&!pO(t)?(this.knownImageServers[i]={verifications:0,malformed:!1,root:i,preLoaded:n,sampledId:Ze(t),verified:!1,server:null,result:{context:t["@context"]||[],sampledProfile:t.profile,resourceServiceRatio:e&&t.height?e.height/t.height:1,sampledSizes:t.sizes||[],sizeRatios:tU(t.width,t.height,t.sizes||[]),sampledTiles:t.tiles||[]}},!0):this.verify(t)}preLoad(t,e=!0){this.knownImageServers[t.root]=t,e&&(this.knownImageServers[t.root].malformed=!1,this.knownImageServers[t.root].verifications=this.config.verificationsRequired)}predict(t,e=!1,n=!1){let i=t?.source,a=Ju(Ze(t)),o=this.knownImageServers[a],s=hs(Ze(t));return this.imageServices[s]?this.imageServices[s]||null:!this.config.approximateServices||!o||!o.result||!(i?.height||t.height)||!(i?.width||t.width)||!n&&(o.malformed||o.verifications<this.config.verificationsRequired)||pO(t.source)?null:(this.imageServices[s]||(this.imageServices[s]={"@context":o.result.context,"@id":Ze(t),id:Ze(t),protocol:"http://iiif.io/api/image",tiles:i?.tiles||pU(t.width,t.height,o.result.sampledTiles),sizes:i?.sizes||eU(Math.round(t.width/o.result.resourceServiceRatio),Math.round(t.height/o.result.resourceServiceRatio),o.result.sizeRatios),profile:i?.profile||o.result.sampledProfile,height:i?.height||t.height,width:i?.width||t.width,real:!1}),this.imageServices[s]||null)}async getThumbnailFromResource(t,e,n=!0,i=[]){let a=t?await this.getImageCandidates(t,n):[];return hU(e,[()=>i,()=>a])}async getImageCandidates(t,e=!0){let n=t;if(e&&n&&n.height&&n.width){let i=VO(n);for(let a of i){let o={id:Ze(a),width:a.width?a.width:n.width,height:a.height?a.height:n.height,source:a};await this.loadService(o)}}return lU(t,e,this)}async verify(t){let e=this.predict(t,!1,!0),n=await this.fetchService(Ze(t));if(!e)return!1;let i=e.height===n.height&&e.width===n.width&&e["@context"]===n["@context"]&&mU(e.sizes||[],n.sizes||[]);if(i){let a=Ju(Ze(t)),o=this.knownImageServers[a];o&&(o.verifications+=1,o.verifications>=this.config.verificationsRequired&&(o.verified=!0))}return i}canLoadSync(t){let e=typeof t=="string"?t:Ze(t),n=hs(e);if(this.imageServices[n])return!0;let i=this.knownImageServers[Ju(e)];return!!(i&&!i.malformed&&i.verifications>=this.config.verificationsRequired)}async markAsMalformed(t){return this.knownImageServers[Ju(Ze(t))].malformed=!0,this.loadService(t,!0)}async fetchService(t,e=!1){let n=hs(t),i=this.imageServices[n];if(i&&(!e||i.real))return i;if(!this.config.enableFetching)throw new Error("Fetching is not enabled");let a=await this.fetch(n).then(o=>o.json());return!a.id&&a["@id"]&&(a.id=a["@id"]),a.id!==t&&(a.id=t,a["@id"]&&(a["@id"]=t)),this.imageServices[n]=Object.assign(a,{real:!0}),this.imageServices[n]}async fetch(t,e){return fetch(t,e)}async loadService(t,e=!1){if(!this.config.disableThrottling){let a=!0;for(;a;)if(this.fetchingCount>=this.config.verificationsRequired)await new Promise(o=>setTimeout(o,500));else{a=!1;break}}let n=this.knownImageServers[Ju(Ze(t))];if(n&&!n.malformed&&!e){await n.result;let a=this.loadServiceSync(t);if(a)return a}this.fetchingCount++;let i=await this.fetchService(Ze(t),e);return this.fetchingCount--,i.real&&this.sample(i,t),i}loadServiceSync(t){let e=hs(Ze(t));return this.imageServices[e]?this.imageServices[e]:this.config.approximateServices?this.predict(t):null}},cY=new jO;var lg={},Po={get(t){return t},setMetaValue([t,e,n],i){let a=Po.getResourceMeta(t,e),o=a?a[n]:void 0,s=typeof i=="function"?i(o):i;lg[t]={...lg[t]||{},[e]:{...(lg[t]||{})[e]||{},[n]:s}}},getResourceMeta:(t,e)=>{let n=lg[t];if(n)return e?n[e]:n},async load(t){let e=typeof t=="string"?t:t.id;return fetch(e).then(n=>n.json())},subscribe(t){return()=>{}},requestStatus(t){}};function gU(t){try{if(t==="full")return{full:!0};if(t==="square")return{square:!0};let e=t.startsWith("pct:"),n=t.substr(e?4:0).split(","),i=n.map(a=>parseFloat(a));return{x:i[0],y:i[1],w:i[2],h:i[3],percent:e}}catch{throw Error("Expected 'full', 'square' or 'x,y,w,h'. Found "+t)}}function yU(t){let e={upscaled:!1,max:!1,confined:!1};if(t[0]==="^"&&(e.upscaled=!0,t=t.slice(1)),t==="max"||t==="full")return e.max=!0,e.serialiseAsFull=t==="full",e;if(t[0]==="!"&&(e.confined=!0,t=t.slice(1)),t[0]==="p")return e.percentScale=parseFloat(t.slice(4)),e;let n=t.split(",").map(i=>i.trim());return n.length&&(n[0]!==""&&(e.width=parseInt(n[0],10)),n[1]!==""&&(e.height=parseInt(n[1],10))),e}function vU(t){let e={angle:0};if(t[0]==="!"&&(e.mirror=!0,t=t.substr(1)),e.angle=parseFloat(t)%360,Number.isNaN(e.angle))throw Error(`Invalid rotation ${t}`);return e}function SU(t,e=""){let n=t.match(/^(([a-zA-Z]+):\/\/([^/]+))?((.*)+)/);if(!n)throw Error(`Invalid or unknown input ${t}`);let i=n[2],a=n[3],o=n[4];if(o[0]==="/"&&(o=o.substring(1)),e.length>0){if(e[0]==="/"&&(e=e.substring(1)),e!==o.substring(0,e.length))throw Error(`Path does not start with prefix (path: ${o}, prefix: ${e})`);o=o.substring(e.length)}return{scheme:i,server:a,path:o,prefix:e}}function bU(t,e=""){let{path:n,scheme:i,server:a,prefix:o}=SU(t,e),s=n.split("/").reverse(),[u,d,p,f,...m]=s,g=m.reverse().filter(Boolean).join("/");if(s.length===1||u==="")return{type:"base",scheme:i,server:a,prefix:o,identifier:g};if(u==="info.json"){let[,...E]=s;return{type:"info",scheme:i,server:a,prefix:o,identifier:E.reverse().filter(Boolean).join("/")}}if(i===void 0||a===void 0||n===void 0||f===void 0||p===void 0||d===void 0||u===void 0)throw Error("Invalid image service URL");let[v="",S=""]=u.split(".");return{type:"image",scheme:i,server:a,prefix:o,identifier:g,originalPath:n,region:gU(f),size:yU(p),rotation:vU(d),quality:v,format:S}}function xU(t){return Ou.indexOf(t)!==-1?b2:vm.indexOf(t)!==-1?S2:v2}function EU(t){let e=t?Array.isArray(t.profile)?t.profile:[t.profile]:[],n={extraQualities:[],extraFormats:[],extraFeatures:[]};for(let i of e)if(typeof i=="string"&&(i=xU(i)),!!i){if(i.formats)for(let a of i.formats)n.extraFormats.indexOf(a)===-1&&n.extraFormats.push(a);if(i.qualities)for(let a of i.qualities)n.extraQualities.indexOf(a)===-1&&n.extraQualities.push(a);if(i.supports)for(let a of i.supports)n.extraFeatures.indexOf(a)===-1&&n.extraFeatures.push(a);if(i.maxHeight&&(n.maxHeight=i.maxHeight),i.maxWidth&&(n.maxWidth=i.maxWidth),i.maxArea&&(n.maxArea=i.maxArea),i.extraFormats)for(let a of i.extraFormats)n.extraFormats.indexOf(a)===-1&&n.extraFormats.push(a);if(i.extraQualities)for(let a of i.extraQualities)n.extraQualities.indexOf(a)===-1&&n.extraQualities.push(a);if(i.extraFeatures)for(let a of i.extraFeatures)n.extraFeatures.indexOf(a)===-1&&n.extraFeatures.push(a);i.maxHeight&&(n.maxHeight=i.maxHeight),i.maxWidth&&(n.maxWidth=i.maxWidth),i.maxArea&&(n.maxArea=i.maxArea)}if(t.extraFormats)for(let i of t.extraFormats)n.extraFormats.indexOf(i)===-1&&n.extraFormats.push(i);if(t.extraFeatures)for(let i of t.extraFeatures)n.extraFeatures.indexOf(i)===-1&&n.extraFeatures.push(i);if(t.extraQualities)for(let i of t.extraQualities)n.extraQualities.indexOf(i)===-1&&n.extraQualities.push(i);return n}function V1(t){let e=Array.isArray(t.profile)?t.profile:[t.profile];for(let n of e)if(typeof n=="string"&&Pb.indexOf(n)!==-1)return!0;return!1}function Re(t){if(t["@id"])return t["@id"];if(t.id)return t.id}function dd(t){if(!t||!t.profile||!Re(t))return!1;let e=Array.isArray(t.profile)?t.profile:[t.profile];for(let n of e)if(typeof n=="string"&&Lb.indexOf(n)!==-1)return!0;return!1}function qO(t){if(!dd(t))return!1;let e=Array.isArray(t.profile)?t.profile:[t.profile];for(let n of e)if(typeof n=="string"){if(vm.indexOf(n)!==-1)return!0}else{let i=[...n.supports||[],...n.extraFeatures||[]];if(i.indexOf("regionByPx")!==-1&&(i.indexOf("sizeByW")!==-1||i.indexOf("sizeByWh")!==-1))return!0}return!1}function AU({x:t=0,y:e=0,w:n,h:i,full:a,square:o,percent:s}){if(a)return"full";if(o)return"square";if(n===void 0||i===void 0)throw Error("RegionParameter: invalid region");let u=`${t},${e},${n},${i}`;return s?`pct:${u}`:u}function RU({max:t,percentScale:e,upscaled:n,confined:i,width:a,height:o,serialiseAsFull:s,version:u}){let d=[];return n&&d.push("^"),t?(d.push(s?"full":"max"),d.join("")):(i&&d.push("!"),e&&d.push(`pct:${e}`),a&&d.push(`${a}`),d.push(","),o&&u===3&&d.push(`${o}`),d.join(""))}function TU(t){return`${t.mirror?"!":""}${(t.angle||0)%360}`}function sg(t,e){let n=t.prefix.startsWith("/")?t.prefix.substring(1):t.prefix,i=`${t.scheme}://${t.server}/${n?`${n}/`:""}${t.identifier}`;if(t.type==="base")return i;if(t.type==="info")return`${i}/info.json`;let{size:a}=t,{region:o,rotation:s,format:u,quality:d}=t;if(e){let p=e["@context"]?Array.isArray(e["@context"])?e["@context"]:[e["@context"]]:[],f=p.indexOf("http://iiif.io/api/image/2/context.json")!==-1,m=p.indexOf("http://iiif.io/api/image/3/context.json")!==-1;if((a.width===e.width&&!a.height||a.height===e.height&&!a.width||a.width===e.width&&a.height===e.height)&&(a={...a,max:!0}),f&&(a.max&&!a.serialiseAsFull&&(a={...a,serialiseAsFull:!0}),!a.max&&a.width&&a.height&&(a={...a,height:void 0}),a={...a,version:2}),m){if(a.max&&a.serialiseAsFull&&(a={...a,serialiseAsFull:!1}),a.width&&!a.height&&e.width&&e.height){let g=e.height/e.width;a={...a,height:Math.ceil(a.width*g)}}a={...a,version:3}}}return[i,AU(o),RU(a),TU(s),`${d}.${u}`].filter(Boolean).join("/")}function qr(t){return t.endsWith("info.json")?t:t.endsWith("/")?`${t}info.json`:`${t}/info.json`}function ug(t){let e=bU(qr(t.id));if(e.type!=="info")throw Error("Invalid service URL");let n=EU(t);return{identifier:e.identifier,originalPath:"",server:e.server,prefix:e.prefix,scheme:e.scheme,type:"image",quality:n.extraQualities.indexOf("default")===-1?n.extraQualities[0]:"default",region:{full:!0},size:{max:!0,upscaled:!1,confined:!1},format:"jpg",rotation:{angle:0}}}function FO(t,e,n){let i=n.length,a=[];for(let o=0;o<i;o++){let s=n[o];if(!s)continue;let u=s.width;a.push(t/u)}return a}function GO(t,e,n){let i=n.length,a=[];for(let o=0;o<i;o++){let s=n[o];s&&a.push({width:Math.floor(t/s),height:Math.floor(e/s)})}return a}function $u(t,e){if(e&&e.profile){let n=e.profile;if(n){let i=Array.isArray(n)?n:[n];if(i.includes(`level${t}`)||i.includes(`http://iiif.io/api/image/2/level${t}.json`)||i.includes(`http://iiif.io/api/image/1/level${t}.json`)||i.includes(`http://iiif.io/api/image/1/profiles/level${t}.json`))return!0;if(t===2){for(let a of i)if(Ou.includes(a))return!0}if(t===1){for(let a of i)if(vm.includes(a))return!0}if(t===0){for(let a of i)if(Pb.includes(a))return!0}}}return!1}function cg(t){return dd(t)?$u(2,t)?2:$u(1,t)?1:$u(0,t)?0:null:null}function Fr(t){let e=t.service?Array.isArray(t.service)?t.service:[t.service]:[],n=e.length,i=[];for(let a=0;a<n;a++)dd(e[a])&&i.push(e[a]);return i}function kO(t){if(t["@type"])return t["@type"];if(t.type)return t.type}function ps(t){let e=t.replace(/(https?:\/\/)?(www.)?/i,"");return e.indexOf("/")===-1?e:e.split("/")[0]}function YO(t,e,n){let i=t>e?t:e,a=n.length,o=[];for(let s=0;s<a;s++){let u=n[s];if(!u||u.scaleFactors.length===0)continue;let d=u.scaleFactors[0];if(!d)continue;let p=i/d,f=[d];for(;p>=u.width;)d*=2,f.push(d),p/=2;o.push({...u,scaleFactors:f})}return o}function fg(t,e,n){let i=ug({"@context":t.version===3?"http://iiif.io/api/image/3/context.json":"http://iiif.io/api/image/2/context.json",id:qr(Re(t)),profile:t.level===null||t.level===void 0?"level0":`level${t.level}`,type:t.version===3?"ImageService3":"ImageService2"});if(i.type!=="image")throw Error("Invalid service");return i.size.max=!1,i.size.width=e,i.size.height=n,{id:sg(i),type:"fixed",width:e,height:n||t.height/(t.width||1)*e,unsafe:t.width>e}}function QO(t,e,n){let i=t.width?t.width:t.maxWidth;return n.height<=t.maxHeight&&n.width<=t.maxWidth&&n.height>=t.minHeight&&n.width>=t.minWidth&&(!e||Math.abs(n.width-i)<Math.abs(e.width-i))}function XO(t,e){let n=[],i=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},t),a=(f,m=0)=>i.explain?n.push(Array(m).fill(0).map(g=>" ").join("")+f().trim()):void 0,o=[],s=[],u=null;a(()=>`Using configuration: ${JSON.stringify(i,null,2)}`);let d=(f,m)=>{if(a(()=>"Swapping choice",3),QO(i,m,f)){if(i.preferFixedSize&&f.unsafe){a(()=>`We found an image that was marked as unsafe, but it was the best size. (${f.id})`,4),s.push(f);return}i.returnAllOptions&&m&&s.push(m),a(()=>`We found a new image that was the best size. (${f.id})`,4),u=f}else i.returnAllOptions&&s.push(f)};a(()=>`The input shows we have ${e.length} list(s) of candidates to choose from.`);let p=e.length;for(let f=0;f<p;f++){let m=e[f]();a(()=>`Candidate group ${f}: ${JSON.stringify(m,null,2)}`,1);let g=m.length;a(()=>`Checking candidate list number ${f} and found ${g} potential ways of creating image(s)`,1);for(let v=0;v<g;v++){let S=m[v];a(()=>`-> Checking candidate ${v}`,1),S.type==="unknown"&&i.atAnyCost&&(a(()=>`We've found an unknown image type, adding this to the "last resort" list`,2),o.push(S)),S.type==="fixed"&&(S.unsafe?(a(()=>`We've found an unsafe fixed image type, adding this to the "last resort" list`,2),o.push(S)):(a(()=>"We've found a fixed size image, checking if it matches the request",2),d(S,u))),S.type==="fixed-service"&&(i.unsafeImageService?(a(()=>"Checking for an image from the tile source, without calculating the right height and width (unsafeImageService)",2),d(fg(S,i.width,i.height),u)):(a(()=>"Checking for an image from the tile source 3",2),d(fg(S,S.width,S.height),u))),S.type==="variable"&&S.maxWidth&&d(fg({id:S.id,type:"fixed-service",width:S.maxWidth,height:S.maxWidth,level:S.level,version:S.version},S.maxWidth),u)}if(u&&!i.returnAllOptions){if(u.unsafe||i.allowUnsafe)continue;a(()=>`We found a match in choice list number ${f}, no searching any more`);break}}return i.atAnyCost&&s.length===0?(a(()=>u?`We found an image! ${u.id} of type ${u.type}`:'We found no images, but "atAnyCost" is set, so returning that'),{best:u||o[0]||null,fallback:o.slice(1),log:n}):i.returnAllOptions?(a(()=>"Returning all options that we have found"),{best:(i.atAnyCost?u||s[0]||o[0]:u||s[0])||null,fallback:[...s,...o],log:n}):(a(()=>"Returning the best image that we found, and a fallback"),{best:u||s[0]||null,fallback:u?s:s.slice(1),log:n})}function F1(t){return(t["@context"]?Array.isArray(t["@context"])?t["@context"]:[t["@context"]]:[]).indexOf("http://iiif.io/api/image/3/context.json")!==-1}function KO(t){return dd(t)?(t&&t.sizes?t.sizes:[]).map(e=>({id:Re(t),type:"fixed-service",height:e.height,width:e.width,level:cg(t),version:F1(t)?3:2})):[]}function ZO(t){if(!qO(t))return[];let e=[],n=Array.isArray(t.profile)?t.profile:[t.profile],i=n.length;for(let a=0;a<i;a++){let o=n[a];if(o&&typeof o!="string"&&(o.maxHeight||o.maxWidth))return[{id:Re(t),type:"variable",minWidth:0,minHeight:0,maxHeight:o.maxHeight||o.maxWidth,maxWidth:o.maxWidth||o.maxHeight,level:cg(t),version:t["@context"]==="http://iiif.io/api/image/3/context.json"?3:2}]}if(t.tiles){let a=t.tiles.length;for(let o=0;o<a;o++){let s=t.tiles[o];s&&(s.height||s.width)&&e.push({id:Re(t),type:"variable",minHeight:0,minWidth:0,maxHeight:s.height||s.width,maxWidth:s.width,level:cg(t),version:F1(t)?3:2})}}return e}function j1(t){let e=[],n=t.length;for(let i=0;i<n;i++){let a=t[i];if(!a)continue;let o=KO(a);o.length&&e.push(...o);let s=ZO(a);s.length&&e.push(...s)}return e}function q1(t){let e=t.match(/^.*\/(full)\/(((\d+),(\d+)?)|max)\/(\d+)\/default\.(jpg|png|jpeg)$/);if(e&&e[4]&&e[5]){let n=e[1],i=parseInt(e[4],10),a=parseInt(e[5],10),o=e[7];if((n==="max"||n==="full")&&i&&a&&o)return{type:"fixed",id:t,height:a,width:i}}return{type:"unknown",id:t}}function hd(t){if(typeof t=="string")return q1(t);let e=kO(t);if(e!=="Image"&&e!=="sc:Image")return null;let n=t,i=Re(n);return i?i&&n.width&&n.height?{id:i,type:"fixed",width:n.width,height:n.height,unsafe:!0}:q1(i):null}function WO(t,e=!0,n){let i=[],a=hd(t);if(a===null)return i;let o=t;if(i.push(a),e&&o&&o.width&&o.height){let s=[],u=Fr(o);for(let d of u){let p={id:Re(d),width:o.width,height:o.height};if(n.canLoadSync(p)){let f=n.loadServiceSync(p);f&&(f.height||(f.height=o.height),f.width||(f.width=o.width),s.push(...j1([f])))}}if(s.length)return i.push(...s),i}return o.service&&i.push(...j1(o.service)),i}function JO(t,e){if(t.length!==e.length)return!1;if(t.length===0&&e.length===0)return!0;let n=t.length,i=!0;for(let o=0;o<n;o++){let s=t[o],u=e[o];if(s.width!==u.width||s.height!==u.height){i=!1;break}}if(i)return!0;let a=0;for(let o=0;o<n;o++)for(let s=0;s<n;s++)if(t[o].width===e[s].width&&t[o].height===e[s].height){a++;break}return a===n}var tc=class{constructor(t={}){Rn(this,"config",{verificationsRequired:1,approximateServices:!1,enableFetching:!0,disableThrottling:!1}),Rn(this,"fetchingCount",0),Rn(this,"imageServices",{}),Rn(this,"knownImageServers",{}),this.config=Object.assign(this.config,t)}setConfig(t){Object.assign(this.config,t)}sample(t,e,n=!0){let i=ps(Re(t)),a=qr(Re(t)),o=this.knownImageServers[i];return this.imageServices[a]=Object.assign(t,{real:!0}),!o&&t.tiles&&!V1(t)?(this.knownImageServers[i]={verifications:0,malformed:!1,root:i,preLoaded:n,sampledId:Re(t),verified:!1,server:null,result:{context:t["@context"]||[],sampledProfile:t.profile,resourceServiceRatio:e&&t.height?e.height/t.height:1,sampledSizes:t.sizes||[],sizeRatios:FO(t.width,t.height,t.sizes||[]),sampledTiles:t.tiles||[]}},!0):this.verify(t)}preLoad(t,e=!0){this.knownImageServers[t.root]=t,e&&(this.knownImageServers[t.root].malformed=!1,this.knownImageServers[t.root].verifications=this.config.verificationsRequired)}predict(t,e=!1,n=!1){let i=t?.source,a=ps(Re(t)),o=this.knownImageServers[a],s=qr(Re(t));return this.imageServices[s]?this.imageServices[s]||null:!this.config.approximateServices||!o||!o.result||!(i?.height||t.height)||!(i?.width||t.width)||!n&&(o.malformed||o.verifications<this.config.verificationsRequired)||t.source&&V1(t.source)?null:(this.imageServices[s]||(this.imageServices[s]={"@context":o.result.context,"@id":Re(t),id:Re(t),protocol:"http://iiif.io/api/image",tiles:i?.tiles||YO(t.width,t.height,o.result.sampledTiles),sizes:i?.sizes||GO(Math.round(t.width/o.result.resourceServiceRatio),Math.round(t.height/o.result.resourceServiceRatio),o.result.sizeRatios),profile:i?.profile||o.result.sampledProfile,height:i?.height||t.height,width:i?.width||t.width,real:!1}),this.imageServices[s]||null)}async getThumbnailFromResource(t,e,n=!0,i=[]){let a=t?await this.getImageCandidates(t,n):[];return XO(e,[()=>i,()=>a])}async getImageCandidates(t,e=!0){let n=t;if(e&&n&&n.height&&n.width){let i=Fr(n);for(let a of i){let o={id:Re(a),width:a.width?a.width:n.width,height:a.height?a.height:n.height,source:a};await this.loadService(o)}}return WO(t,e,this)}async verify(t){let e=this.predict(t,!1,!0),n=await this.fetchService(Re(t));if(!e)return!1;let i=e.height===n.height&&e.width===n.width&&e["@context"]===n["@context"]&&JO(e.sizes||[],n.sizes||[]);if(i){let a=ps(Re(t)),o=this.knownImageServers[a];o&&(o.verifications+=1,o.verifications>=this.config.verificationsRequired&&(o.verified=!0))}return i}canLoadSync(t){let e=typeof t=="string"?t:Re(t),n=qr(e);if(this.imageServices[n])return!0;let i=this.knownImageServers[ps(e)];return!!(i&&!i.malformed&&i.verifications>=this.config.verificationsRequired)}async markAsMalformed(t){return this.knownImageServers[ps(Re(t))].malformed=!0,this.loadService(t,!0)}async fetchService(t,e=!1){let n=qr(t),i=this.imageServices[n];if(i&&(!e||i.real))return i;if(!this.config.enableFetching)throw Error("Fetching is not enabled");let a=await this.fetch(n).then(o=>o.json());return!a.id&&a["@id"]&&(a.id=a["@id"]),a.id!==t&&(a.id=t,a["@id"]&&(a["@id"]=t)),this.imageServices[n]=Object.assign(a,{real:!0}),this.imageServices[n]}async fetch(t,e){return fetch(t,e)}async loadService(t,e=!1){if(!this.config.disableThrottling){let a=!0;for(;a;)if(this.fetchingCount>=this.config.verificationsRequired)await new Promise(o=>setTimeout(o,500));else{a=!1;break}}let n=this.knownImageServers[ps(Re(t))];if(n&&!n.malformed&&!e){await n.result;let a=this.loadServiceSync(t);if(a)return a}this.fetchingCount++;let i=await this.fetchService(Re(t),e);return this.fetchingCount--,i.real&&this.sample(i,t),i}loadServiceSync(t){let e=qr(Re(t));return this.imageServices[e]?this.imageServices[e]:this.config.approximateServices?this.predict(t):null}};function $O(t={}){let e=t.events||gm(),n=t.loader||new tc;return{store:mm((i,a)=>({loaded:{},loadServiceSync:(o,s,u)=>{let d=o.id||o["@id"],p=a().loaded[d];if(p&&p.status==="done")return p.service;if(p&&p.status==="loading")return null;if(p&&p.status==="error")throw Error("Failed to load image service");let f={id:Re(o),width:o.width||s?.width||0,height:o.height||s?.height||0,source:o},m=n.loadServiceSync(f);return m?(i(g=>({loaded:{...g.loaded,[d]:{status:"done",service:m,real:!0}}})),e.emit("image-service.loaded",{id:d,service:m})):u&&a().loadService(o,s).then(()=>{}),m},loadService:async(o,s)=>{let u=o.id||o["@id"],d=a().loaded[u];if(d&&d.status==="done")return d.service;if(d&&d.status==="loading")return new Promise((p,f)=>{let m=g=>{g.id===u&&(e.off("image-service.loaded",m),p(g.service||o))};e.on("image-service.loaded",m)});if(d&&d.status==="error"&&!s?.force)throw Error("Failed to load image service");e.emit("image-service.loading",{id:u});try{let p={id:Re(o),width:o.width||0,height:o.height||0,source:o},f=await n.loadService(p,s?.force);return i(m=>({loaded:{...m.loaded,[u]:{status:"done",service:f,real:f.real}}})),e.emit("image-service.loaded",{id:u,service:f}),f}catch(p){throw e.emit("image-service.error",{id:u,error:p}),p}}})),events:e}}var G1=$O();var t_=new tc;function k1(t=Po,e={}){let n=e.imageServiceLoader||t_;async function i(a,o,s=!1,u=[],d){let p=()=>n.getThumbnailFromResource(void 0,o,s,u);if(!a)return await n.getThumbnailFromResource(void 0,o,s,u);if(typeof a=="string"){let m=hd(a);return m&&u.push(m),await n.getThumbnailFromResource(void 0,o,s,u)}let f=t.get(a,{skipSelfReturn:!1});if(typeof f=="string")return{best:hd(f),fallback:[],log:[]};if(!f)return await p();switch(await(async m=>{if(m&&m.thumbnail&&m.thumbnail.length){let g=t.get(m.thumbnail[0]),v=await n.getImageCandidates(g,s);v&&v.length&&u.push(...v)}})(f),f.type){case"Annotation":{let m=Array.isArray(f.body)?f.body:[f.body],g=t.get(m[0]);return d&&!g.width&&(g.width=d.width,g.height=d.height),await n.getThumbnailFromResource(g,o,s,u)}case"Canvas":{let m=f;return i(m.items[0],o,s,u,{width:m.width,height:m.height})}case"AnnotationPage":return i(f.items[0],o,s,u,d);case"Choice":{let m=f;return!m.items||m.items[0]?await p():i(m.items[0],o,s,u,d)}case"Collection":{let m=f.items[0];return m?i(m,o,s,u,d):await p()}case"Manifest":{let m=f.items[0];return m?i(m,o,s,u,d):await p()}case"SpecificResource":case"Image":case"Dataset":case"Sound":case"Text":case"TextualBody":case"Video":return d&&!f.width&&(f.width=d.width,f.height=d.height),n.getThumbnailFromResource(f,o,s,u)}return await p()}return{getBestThumbnailAtSize:i}}var W8=Object.create,zI=Object.defineProperty,J8=Object.getOwnPropertyDescriptor,$8=Object.getOwnPropertyNames,tj=Object.getPrototypeOf,ej=Object.prototype.hasOwnProperty,Sh=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),nj=(t,e,n,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(var a=$8(e),o=0,s=a.length,u;o<s;o++)u=a[o],!ej.call(t,u)&&u!==n&&zI(t,u,{get:(d=>e[d]).bind(null,u),enumerable:!(i=J8(e,u))||i.enumerable});return t},ij=(t,e,n)=>(n=t==null?{}:W8(tj(t)),nj(e||!t||!t.__esModule?zI(n,"default",{value:t,enumerable:!0}):n,t)),iv="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.onContextMenu".split(".");function aj(){return iv.reduce((t,e)=>(t[e]=[],t),{})}var Fc=iv.reduce((t,e)=>(t[e.slice(2).toLowerCase()]=e,t[e]=e,t),{}),av=(t=21)=>{let e="",n=crypto.getRandomValues(new Uint8Array(t));for(;t--;)e+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[n[t]&63];return e};function yh(t){"@babel/helpers - typeof";return yh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},yh(t)}function oj(t,e){if(yh(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var i=n.call(t,e||"default");if(yh(i)!="object")return i;throw TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function rj(t){var e=oj(t,"string");return yh(e)=="symbol"?e:e+""}function O(t,e,n){return(e=rj(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var mo=class{get crop(){return this._crop}set crop(t){this._crop=t}getObjectsAt(t){return[]}getAllPointsAt(t,e,n){return[]}getScheduledUpdates(t,e){return[]}constructor(){O(this,"__id",void 0),O(this,"__revision",0),O(this,"__host",void 0),O(this,"__onCreate",void 0),O(this,"__parent",void 0),O(this,"__owner",{value:void 0}),O(this,"__state",{}),O(this,"eventHandlers",void 0),O(this,"scale",1),O(this,"layers",[]),O(this,"time",[]),O(this,"_crop",void 0),O(this,"cropData",void 0),O(this,"id",void 0),O(this,"addEventListener",(t,e,n)=>{let i=Fc[t];if(!this.eventHandlers[i])throw Error(`Unknown event ${i}`);this.eventHandlers[i].indexOf(e)===-1&&this.eventHandlers[i].push(e)}),O(this,"removeEventListener",(t,e)=>{let n=Fc[t];if(!this.eventHandlers[n]){console.warn(`Unknown event ${n}`);return}this.eventHandlers[n].indexOf(e)!==-1&&(this.eventHandlers[n]=this.eventHandlers[n].filter(i=>i!==e))}),this.id=this.__id=av(),this.eventHandlers=aj()}dispatchEvent(t,e){let n=this.eventHandlers[t],i=n?n.length:0,a=!1;if(i)for(let o=0;o<i;o++)try{n[o]?.(e),a=!0}catch(s){console.error(t,s)}return a}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(t,e){ja(this.points,ei(t,e))}atScale(t){ja(this.points,Ku(t,this.x,this.y)),this.scale*=t}transform(t){ja(this.points,t)}applyProps(t){this.__revision++}appendChild(t){}removeChild(t){}insertBefore(t,e){}hideInstance(){}},Sl=class SA extends mo{constructor(e){if(super(),O(this,"type","spacial-content"),O(this,"id",void 0),O(this,"uri",void 0),O(this,"display",void 0),O(this,"points",void 0),O(this,"priority",void 0),O(this,"style",{opacity:1}),!e)this.id="",this.uri="",this.display={x:0,y:0,scale:1,width:0,height:0,points:Tt(5)},this.points=Tt(5);else{let n=e.scale||1;this.id=e.id||e.uri,this.uri=e.uri,this.points=Zt.singleBox(e.width,e.height,e.x,e.y),this.display={x:0,y:0,scale:n,width:e.width/n,height:e.height/n,points:Zt.singleBox(e.width/n,e.height/n),rotation:e?.rotation}}}applyProps(e){let n=e.display?e.display.width:e.target.width,i=e.target.width/n;if(this.id=e.id||e.uri,this.uri=e.uri,this.points.set(Zt.singleBox(e.target.width,e.target.height,e.target.x,e.target.y)),e.style&&e.style.opacity!==void 0&&(this.style.opacity=e.style.opacity),e.crop){this.cropData=e.crop;let a=Zt.singleBox(e.crop.width,e.crop.height,e.crop.x,e.crop.y);ja(a,ei(-e.crop.x,-e.crop.y)),this.crop?this.crop.set(a):this.crop=Tt(a)}e.display?(this.display.scale=i,this.display.width=e.display.width,this.display.height=e.display.height,this.display.rotation=e.display.rotation,this.display.points=Zt.singleBox(e.display.width,e.display.height)):(this.display.scale=i,this.display.width=e.target.width/i,this.display.height=e.target.height/i,this.display.points=Zt.singleBox(e.target.width/i,e.target.height/i))}getAllPointsAt(e,n,i){return[[this,this.crop||this.points,n]]}static fromSvg(e,n,i,a){return SA.fromImage("data:image/svg+xml;base64,"+btoa(e),n,i,a)}static fromImage(e,n,i,a){let o=new SA;return o.applyProps({uri:e,id:a,display:i,target:n}),o}getImageUrl(){return this.uri}},bA=class extends mo{constructor(t){if(super(),O(this,"type","spacial-content"),O(this,"id",void 0),O(this,"uri",void 0),O(this,"display",void 0),O(this,"points",void 0),O(this,"getTexture",void 0),this.getTexture=()=>({source:void 0,hash:-1}),!t)this.id="",this.uri="",this.display={x:0,y:0,scale:1,width:0,height:0,points:Tt(5)},this.points=Tt(5);else{let e=t.scale||1;this.id=t.id||t.uri,this.uri=t.uri,this.points=Zt.singleBox(t.width,t.height),this.display={x:0,y:0,scale:e,width:t.width/e,height:t.height/e,points:e===1?this.points:Zt.singleBox(t.width/e,t.height/e)}}}applyProps(t){let e=t.display?t.display.width:t.target.width,n=t.target.width/e;this.id=t.id,this.points.set(Zt.singleBox(t.target.width,t.target.height)),this.display.scale=n,this.display.width=t.target.width/n,this.display.height=t.target.height/n,this.getTexture=t.getTexture,this.display.points=n===1?this.points:Zt.singleBox(t.target.width/n,t.target.height/n)}getAllPointsAt(t,e,n){return[[this,this.points,e]]}};function lj(t,e,n=1){let i=e.length;if(i===0)throw Error("No resources passed in.");let a=0,o=1/0;for(let s=0;s<i&&!(!e[s]||!e[s].display);s++){let u=xA(e[s].display.scale,t/(n||1));u<o&&(o=u,a=s)}return a}function xA(t,e){return Math.abs(t-e)}function Wy(t,e){let n=xA(t.x,e.x),i=xA(t.y,e.y);return Math.sqrt(n**2+i**2)}function sj(t){let e=t.length;return t.indexOf("/info.json")===e-10?t.slice(0,-10):t}function Py(t,e,n){return Math.min(Math.max(t,e),n)}var vh=class NI extends mo{constructor(e){super(),O(this,"id",void 0),O(this,"type","spacial-content"),O(this,"display",void 0),O(this,"tileWidth",void 0),O(this,"style",{opacity:1}),O(this,"points",void 0),O(this,"service",void 0),O(this,"format","jpg"),O(this,"crop2",void 0),O(this,"version3",void 0),O(this,"tileUrl",void 0),this.tileUrl=sj(e.url),this.id=e.id||`${this.tileUrl}--${e.scaleFactor}`,this.points=e.displayPoints?e.displayPoints:ro(e.points,Lo(e.scaleFactor)),this.tileWidth=e.tileWidth,this.version3=e.version3,this.display={x:0,y:0,width:e.width/e.scaleFactor,height:e.height/e.scaleFactor,points:e.points,scale:e.scaleFactor},e.format&&(this.format=e.format)}applyProps(e){if(e.style&&e.style.opacity!==void 0&&(this.style.opacity=e.style.opacity),e.service!==this.service&&(this.service=e.service),e.format?this.format=e.format:this.format="jpg",e.version3!==void 0&&(this.version3=e.version3),e.crop){this.cropData=e.crop;let n=Tt([...this.points]),i=n.length/5,a=e.crop.x||0,o=e.crop.y||0,s=e.crop.x+e.crop.width,u=e.crop.y+e.crop.height;for(let d=0;d<i;d++){let p=d*5;n[p+1]<s&&n[p+3]>a&&n[p+2]<u&&n[p+4]>o?(n[p+1]=Py(n[p+1],a,s),n[p+3]=Py(n[p+3],a,s),n[p+2]=Py(n[p+2],o,u),n[p+4]=Py(n[p+4],o,u)):n[p]=0}ja(n,ei(-e.crop.x,-e.crop.y)),this.crop?this.crop.set(n):this.crop=n}}static fromTile(e,n,i,a,o,s,u,d){i.height=i.height?i.height:i.width;let p=u?Math.floor(n.width/a):Math.ceil(n.width/a),f=u?Math.floor(n.height/a):Math.ceil(n.height/a),m=Math.ceil(p/i.width),g=Math.ceil(f/i.height),v=Zt.grid(m,g),S=Zt.grid(m,g),E=o&&o["@context"]?Array.isArray(o["@context"])?o["@context"]:[o["@context"]]:[],T=d===void 0?E.indexOf("http://iiif.io/api/image/3/context.json")!==-1:d;for(let x=0;x<g;x++)for(let R=0;R<m;R++){let C=R*i.width,M=x*i.height;S.addPoints(C*a,M*a,R===m-1?n.width:(C+i.width)*a,x===g-1?n.height:(M+i.height)*a),v.addPoints(C,M,R===m-1?p:C+i.width,x===g-1?f:M+i.height)}let A=new NI({url:e,scaleFactor:a,points:v.build(),displayPoints:S.build(),width:n.width,height:n.height,tileWidth:i.width,format:s,version3:T});return A.applyProps({service:o}),A}getImageUrl(e){let n=this.points.slice(e*5,e*5+5),i=n[3]-n[1],a=n[4]-n[2],o=Math.ceil(i/this.display.scale),s=Math.ceil(a/this.display.scale),u=`${o>this.tileWidth?this.tileWidth:o},`;return this.version3&&(u+=`${s>this.tileWidth?this.tileWidth:s}`),`${this.tileUrl}/${n[1]},${n[2]},${i},${a}/${u}/0/default.${this.format||"jpg"}`}getAllPointsAt(e,n,i){let a=Xu(this.crop||this.points,e);return[[this,a,n]]}transform(e){ja(this.points,e)}getScheduledUpdates(e,n){return[]}},uj=class extends mo{constructor(...t){super(...t),O(this,"type","spacial-content")}getAllPointsAt(t,e,n){return[[this,this.points,e]]}},cj=class extends uj{constructor(t){super(),O(this,"id",void 0),O(this,"display",void 0),O(this,"points",void 0),O(this,"images",[]),O(this,"allImages",[]),O(this,"scaleFactors",[]),O(this,"aggregateBuffer",Tt(9)),O(this,"lazyLoader",void 0),O(this,"isFullyLoaded",!1),O(this,"maxScaleFactor",0),O(this,"renderOptions",void 0),O(this,"_scheduleSortByScales",!1),O(this,"_sortByScales",()=>{this._scheduleSortByScales=!1,this.allImages.sort((n,i)=>i.display.width-n.display.width),this.images=[];let e=.1;for(let n of this.allImages)if(!(n.display.width<this.renderOptions.minSize&&n.display.height<this.renderOptions.minSize&&!n.priority)&&!(n instanceof Sl&&(n.display.width>this.renderOptions.maxImageSize||n.display.height>this.renderOptions.maxImageSize)&&!n.priority)){if(Math.abs(n.display.scale-e)<.25||n.priority){let i=this.images.pop();i&&(i instanceof Sl||i.priority)?(n.priority&&this.images.push(n),this.images.push(i)):n&&this.images.push(n)}else n&&this.images.push(n);e=n.display.scale}this.images.length===0&&(this.images=[...this.allImages]),this.scaleFactors=this.images.map(n=>n.display.scale),this.maxScaleFactor=Math.max(...this.scaleFactors)}),O(this,"loadFullResource",async()=>{if(!this.isFullyLoaded&&this.lazyLoader){this.isFullyLoaded=!0;let e=await this.lazyLoader();this.addImages(e)}}),O(this,"fallback",[this.loadFullResource]),this.id=t.id,this.points=Zt.singleBox(t.width,t.height),this.lazyLoader=t.loadFullImages,t.loadFullImages||(this.isFullyLoaded=!0),this.display={x:0,y:0,points:Zt.singleBox(t.width,t.height),height:t.height,width:t.width,scale:1},this.renderOptions={renderSmallestFallback:!0,renderLayers:3,minSize:255,maxImageSize:2048,quality:1.5,...t.renderOptions||{}},this.addImages(t.images)}applyProps(t){t.renderSmallestFallback!==void 0&&t.renderSmallestFallback!==this.renderOptions.renderSmallestFallback&&(this.renderOptions.renderSmallestFallback=t.renderSmallestFallback),t.renderLayers!==void 0&&t.renderLayers!==this.renderOptions.renderLayers&&(this.renderOptions.renderLayers=t.renderLayers),t.minSize!==void 0&&t.minSize!==this.renderOptions.minSize&&(this.renderOptions.minSize=t.minSize),t.maxImageSize!==void 0&&t.maxImageSize!==this.renderOptions.maxImageSize&&(this.renderOptions.maxImageSize=t.maxImageSize),t.quality!==void 0&&t.quality!==this.renderOptions.quality&&(this.renderOptions.quality=t.quality)}appendChild(t){this.addImages([t])}removeChild(t){this.images.indexOf(t)!==-1&&(this.images=this.images.filter(e=>e!==t),this.sortByScales())}insertBefore(t,e){this.addImages([t])}hideInstance(){}addImages(t){for(let e of t)e.__parent=this,e.__owner=this.__owner;this.allImages.push(...t.filter(Boolean)),this.sortByScales()}sortByScales(){this._scheduleSortByScales=!0}getScheduledUpdates(t,e){return this._scheduleSortByScales?[this._sortByScales]:this.isFullyLoaded?[]:e>1/this.maxScaleFactor?this.fallback:[]}getAllPointsAt(t,e,n){if(this.images.length===0)return[];let i=lj(1/(n||1)/(window.devicePixelRatio||1),this.images,this.renderOptions.quality),a=this.images.length,o=e?oo(e,ei(this.x,this.y)):ei(this.x,this.y);if(i!==this.images.length-1&&this.images[i+1]){let s=[];for(let p=a-1;p>=i;p--)s.push(p);let u=s[0];this.renderOptions.renderLayers&&(s=s.slice(-Math.min(s.length,this.renderOptions.renderLayers))),this.renderOptions.renderSmallestFallback&&s.indexOf(u)===-1&&s.unshift(u);let d=[];for(let p=0;p<s.length;p++)d.push(...this.images[s[p]].getAllPointsAt(t,o,n));return d}return this.images[i].getAllPointsAt(t,o,n)}};function Hy(t,e,n,i,a){let o=Math.PI/180*a,s=Math.cos(o),u=Math.sin(o);return[s*(n-t)+u*(i-e)+t,s*(i-e)-u*(n-t)+e]}var RA=class II extends mo{constructor(e,n){super(),O(this,"id",void 0),O(this,"type","world-object"),O(this,"scale",void 0),O(this,"layers",void 0),O(this,"points",void 0),O(this,"worldPoints",void 0),O(this,"intersectionBuffer",Tt(5)),O(this,"aggregateBuffer",Tt(9)),O(this,"invertedBuffer",Tt(9)),O(this,"rotation",0),O(this,"filteredPointsBuffer",void 0),O(this,"_updatedList",[]),O(this,"geometry",void 0);let{x:i=0,y:a=0}=n||{};e?(this.id=e.id||"",this.scale=1,this.layers=e.layers,this.points=Tt([1,i,a,i+e.width,a+e.height]),this.worldPoints=Tt([1,i,a,i+e.width,a+e.height]),this.filteredPointsBuffer=Tt(e.layers.length*5)):(this.id="",this.scale=1,this.layers=[],this.points=Tt(5),this.worldPoints=Tt(5),this.filteredPointsBuffer=Tt(5))}static createWithProps(e){let n=new II;return n.applyProps(e),n}applyProps(e){let n=e.x||0,i=e.y||0;this.id=e.id;let a=e.scale===void 0?this.scale:e.scale;this.points[0]=1,this.points[1]=n,this.points[2]=i,this.points[3]=n+e.width,this.points[4]=i+e.height,this.rotation=e.rotation||0,this.worldPoints[3]=this.worldPoints[1]+e.width,this.worldPoints[4]=this.worldPoints[2]+e.height,e.scale&&e.scale!==1&&this.atScale(a),this.scale=a}appendChild(e){e.points[0]===0&&e.points.set(this.points),e.__owner.value=this,this.addLayers([e])}removeChild(e){this.layers=this.layers.filter(n=>n!==e),this.filteredPointsBuffer=Tt(this.layers.length*5)}insertBefore(e,n){let i=this.layers.indexOf(n);if(i===-1||this.layers.indexOf(e)!==-1)return;let a=this.layers.slice(0,i),o=this.layers.slice(i);this.layers=[...a,e,...o]}hideInstance(){console.warn("hideInstance: not yet implemented")}getObjectsAt(e,n){if(this.rotation&&(e=this.applyRotation(e)),Xu(this.points,e,this.filteredPointsBuffer)[0]===0)return[];let i=this.layers.length,a=[];for(let o=0;o<i;o++){let s=this.layers[o];if(n&&s.isShape){let u=ro(s.points,ei(this.x,this.y));if(!s.intersects([e[1]-u[1],e[2]-u[2]]))continue}if(Xu(ro(s.points,ei(this.x,this.y)),e,this.filteredPointsBuffer)[0]!==0&&a.push(s),n){let u=s;a.push(...u.getObjectsAt(e,n))}}return a}applyRotation(e){if(this.rotation){let n={x:e[1],y:e[2]},i={x:e[1],y:e[4]},a={x:e[3],y:e[2]},o={x:e[3],y:e[4]},s=this.points[1]+(this.points[3]-this.points[1])/2,u=this.points[2]+(this.points[4]-this.points[2])/2,[d,p]=Hy(s,u,n.x,n.y,this.rotation),[f,m]=Hy(s,u,i.x,i.y,this.rotation),[g,v]=Hy(s,u,a.x,a.y,this.rotation),[S,E]=Hy(s,u,o.x,o.y,this.rotation),T=Math.min(d,f,g,S),A=Math.max(d,f,g,S),x=Math.min(p,m,v,E),R=Math.max(p,m,v,E);return Tt([e[0],T,x,A,R])}return e}getAllPointsAt(e,n,i){let a=oo(ei(this.x,this.y),Lo(this.scale),this.aggregateBuffer);this.rotation&&(e=this.applyRotation(e));let o=XM(e,this.points,this.intersectionBuffer),s=this.layers.length,u=[],d=ro(o,oo(Lo(1/this.scale),ei(-this.x,-this.y),this.invertedBuffer)),p=n?oo(n,a,this.aggregateBuffer):a,f=i*this.scale;for(let m=0;m<s;m++)u.push(...this.layers[m].getAllPointsAt(d,p,f));return u}addLayers(e){let n=[];for(let i of e)this.layers.indexOf(i)===-1&&(n.push(i),i.points.length===5&&(i.points[1]<this.worldPoints[1]/this.scale||i.points[2]<this.worldPoints[2]/this.scale||i.points[3]>this.worldPoints[3]/this.scale||i.points[4]>this.worldPoints[4]/this.scale)&&(i.crop=i.crop||Tt([1,Math.max(this.worldPoints[1]/this.scale,i.points[1]),Math.max(this.worldPoints[2]/this.scale,i.points[2]),Math.min(this.worldPoints[3]/this.scale,i.points[3]),Math.min(this.worldPoints[4]/this.scale,i.points[4])])));this.layers=this.layers.concat(n),this.filteredPointsBuffer=Tt(this.layers.length*5)}getScheduledUpdates(e,n){let i=this.layers.length;this._updatedList=[];let a=n*this.scale;for(let o=0;o<i;o++){let s=this.layers[o].getScheduledUpdates(e,a);s&&this._updatedList.push(...s)}return this._updatedList}},ov=class DI extends mo{get x(){return 0}get y(){return 0}get width(){return this._width}get height(){return this._height}constructor(e=0,n=0,i=100,a="left-to-right"){super(),O(this,"id","world"),O(this,"_width",void 0),O(this,"_height",void 0),O(this,"aspectRatio",void 0),O(this,"viewingDirection",void 0),O(this,"aggregateBuffer",Tt(9)),O(this,"isDirty",!1),O(this,"zones",[]),O(this,"filteredPointsBuffer",void 0),O(this,"selectedZone",void 0),O(this,"triggerQueue",[]),O(this,"activatedEvents",[]),O(this,"_updatedList",[]),O(this,"translationBuffer",Tt(9)),O(this,"needsRecalculate",!0),O(this,"emptyPaintables",[]),O(this,"renderOrder",[]),O(this,"points",void 0),O(this,"objects",[]),O(this,"subscriptions",[]),O(this,"_propagateEventTargets",[]),O(this,"_alreadyFlushed",[]),this._width=e,this._height=n,this.aspectRatio=Number.isNaN(e/n)?1:e/n,this.viewingDirection=a,this.points=Tt(i*5),this.filteredPointsBuffer=Tt(i*5)}static withProps(e){let n=new DI;return n.applyProps(e),n}applyProps(e){e.width!==void 0&&e.height!==void 0&&(e.width!==this._width||e.height!==this._height)&&this.resize(e.width,e.height),e.viewingDirection!==this.viewingDirection&&(this.viewingDirection=e.viewingDirection,this.triggerRepaint())}propagateTouchEvent(e,n,i){let a=[];for(let o of i)if(o.x&&o.y){let s=Zt.singleBox(1,1,o.x,o.y);a.push(this.getObjectsAt(s,!0).reverse())}return a.map(o=>this.propagateEvent(e,n,o,{bubbles:!0,cancelable:!0}))}propagatePointerEvent(e,n,i,a,o={}){let s=Zt.singleBox(1,1,i,a),u=this.getObjectsAt(s,!0).reverse();return this.propagateEvent(e,n,u,o)}propagateEvent(e,n,i,{bubbles:a=!1,cancelable:o=!1}={}){n.atlasTarget=this,this._propagateEventTargets.length=1,this._propagateEventTargets[0]=this;let s=!1;n.stopPropagation=()=>{s=!0};let u=i.length;for(let f=u-1;f>=0;f--){this._propagateEventTargets.unshift(i[f][0]);let m=i[f][1].length;if(m)for(let g=0;g<m;g++)this._propagateEventTargets.unshift(i[f][1][g])}let d=this._propagateEventTargets.length,p=!1;for(let f=0;f<d&&(n.atlasTarget=this._propagateEventTargets[f],n.atlasWorld=this,p=this._propagateEventTargets[f].dispatchEvent(e,n)||p,!s);f++);return p&&this.triggerRepaint(),this._propagateEventTargets}appendChild(e){let n=this.appendWorldObject(e);this.renderOrder.push(n/5)}removeChild(e){let n=this.objects.indexOf(e);if(n===-1){for(let i of this.objects)if(i&&i.id===e.id){this.removeChild(i);return}return}this.objects[n]=null,this.renderOrder=this.renderOrder.filter(i=>i!==n),this.points[n*5]=0,this.triggerRepaint(),this.needsRecalculate=!0}insertBefore(e,n){let i=this.objects.indexOf(n);if(i===-1)return;let a=this.appendWorldObject(e);this.renderOrder.splice(i-1,0,a/5)}hideInstance(){}asWorldObject(){return null}addZone(e){this.zones.push(e)}selectZone(e){if(typeof e=="string"){let n=this.zones.length;for(let i=0;i<n;i++)if(this.zones[i].id===e){this.selectedZone=i,this.trigger("zone-changed");return}}else this.zones[e]&&(this.selectedZone=e,this.trigger("zone-changed"))}deselectZone(){this.selectedZone=void 0}getActiveZone(){if(this.selectedZone)return this.zones[this.selectedZone]}hasActiveZone(){return this.selectedZone!==void 0}checkResizeInternalBuffer(){if(KM(this.points)===this.objects.length){let e=this.points,n=Tt(this.points.length*2);n.set(e,0),this.points=n}}appendWorldObject(e){this.checkResizeInternalBuffer();let n=this.objects.length*5,i=e.points;return e.points=this.points.subarray(this.objects.length*5,this.objects.length*5+5),e.points[1]=i[1],e.points[2]=i[2],e.points[3]=i[3],e.points[4]=i[4],this.objects.push(e),this.filteredPointsBuffer=Tt(this.objects.length*5),this.needsRecalculate=!0,this.triggerRepaint(),n}recalculateWorldSize(){let e=!1;if(this.needsRecalculate){let n=new Int32Array(this.objects.length),i=new Int32Array(this.objects.length),a=this.renderOrder.length;for(let u=0;u<a;u++){let d=this.renderOrder[u];this.objects[d]&&(n[u]=this.points[d*5+3],i[u]=this.points[d*5+4])}let o=Math.max(...n);o!==this._width&&(this._width=o,e=!0);let s=Math.max(...i);s!==this._height&&(this._height=s,e=!0),e&&this.trigger("recalculate-world-size",{width:o,height:s}),this.needsRecalculate=!1}return e}addObjectAt(e,n){n.width&&!n.height?n.height=n.width/e.width*e.height:n.height&&!n.width&&(n.width=n.height/e.height*e.width),(!n||!n.width||!n.height)&&(n.width=e.width,n.height=e.height);let{width:i,x:a,y:o}=n,s=i/e.width;this.checkResizeInternalBuffer(),this.points.set(Zt.singleBox(e.width,e.height,0,0),this.objects.length*5);let u=new RA(e);return u.points=this.points.subarray(this.objects.length*5,this.objects.length*5+5),this.objects.push(u),this.scaleWorldObject(this.objects.length-1,s),this.translateWorldObject(this.objects.length-1,a,o),this.filteredPointsBuffer=Tt(this.points.length*2),this.triggerRepaint(),this.needsRecalculate=!0,u}scaleWorldObject(e,n){ja(this.points.subarray(e*5,e*5+5),Ku(n,this.points[e*5+1],this.points[e*5+2]));let i=this.objects[e];i&&(i.atScale(n),this.triggerRepaint())}translateWorldObject(e,n,i){ja(this.points.subarray(e*5,e*5+5),ei(n,i));let a=this.objects[e];a&&(a.translate(n,i),this.triggerRepaint())}resize(e,n){return this._width=e,this._height=n,this.aspectRatio=e/n,this.triggerRepaint(),this}getObjects(){return this.objects}getPoints(){return this.points}getPointsFromViewer(e,n){let i=Zt.singleBox(e.width,e.height,e.x,e.y);return this.getPointsAt(i,n,e.scale)}addLayoutSubscriber(e){return this.subscriptions.push(e),()=>{this.subscriptions.splice(this.subscriptions.indexOf(e),1)}}getScheduledUpdates(e,n){let i=Xu(this.points,e,this.filteredPointsBuffer),a=this.objects.length;this._updatedList=[];for(let o=0;o<a;o++)if(i[o*5]!==0){if(!this.objects[o])continue;this._updatedList.push(...this.objects[o].getScheduledUpdates(e,n))}return this._updatedList}getObjectsAt(e,n=!1){let i=this.getActiveZone(),a=Xu(this.points,e,this.filteredPointsBuffer),o=this.renderOrder.length,s=[];for(let u=0;u<o;u++){let d=this.renderOrder[u];if(a[d*5]!==0){let p=this.objects[d];if(!p||i&&i.objects.indexOf(p)===-1)continue;if(p.type!=="world-object"){s.push([p,[p]]);continue}n?s.push([p,p.getObjectsAt(e,n)]):s.push([p,this.emptyPaintables])}}return s}getPointsAt(e,n,i=1){let a=this.getObjectsAt(e),o=oo(Lo(i),ei(-e[1],-e[2]),this.translationBuffer),s=n?oo(n,o,this.aggregateBuffer):o,u=a.length,d=[];for(let p=0;p<u;p++)a[p]&&d.push(...a[p][0].getAllPointsAt(e,s,i));return d}flushSubscriptions(){if(this.triggerQueue.length){this._alreadyFlushed=[];let e=this.triggerQueue.length;for(let n=0;n<e;n++){if(this._alreadyFlushed.indexOf(this.triggerQueue[n][0])!==-1)continue;this.triggerQueue[n][1]===void 0&&this._alreadyFlushed.push(this.triggerQueue[n][0]);let i=this.subscriptions.length;for(let a=0;a<i;a++)this.subscriptions[a].apply(null,this.triggerQueue[n])}this.triggerQueue=[]}}trigger(e,n){this.triggerQueue.push([e,n])}triggerEventActivation(){this.trigger("event-activation")}triggerRepaint(){this.trigger("repaint")}gotoRegion(e){this.trigger("goto-region",e)}goHome(e=!1,n){this.trigger("go-home",{immediate:e,paddingPx:n})}zoomTo(e,n,i){this.trigger("zoom-to",{point:n,factor:e,stream:i})}zoomIn(e){this.trigger("zoom-to",{point:e,factor:.5})}zoomOut(e){this.trigger("zoom-to",{point:e,factor:2})}constraintBounds(e){this.trigger("constrain-bounds",{immediate:e})}};var Uy=/([0-9]+(px|em)\s+)+(solid)\s+(.*)/g,Vy={},fj=["backgroundColor","opacity","boxShadow","borderColor","borderWidth","borderStyle","outlineColor","outlineWidth","outlineOffset","outlineStyle"],ph=class extends mo{constructor(){super(),O(this,"id",void 0),O(this,"type","spacial-content"),O(this,"points",void 0),O(this,"hoverEvents",!1),O(this,"activeEvents",!1),O(this,"display",{x:0,y:0,scale:1,width:-1,height:-1,points:Tt(5)}),O(this,"_parsed",{border:{id:null,match:[]},outline:{id:null,match:[]}}),O(this,"hovering",void 0),O(this,"pressing",void 0),O(this,"props",{}),O(this,"addHover",()=>{this.hovering=!0,this.__revision++}),O(this,"removeHover",()=>{this.hovering=!1,this.pressing=!1,this.__revision++}),O(this,"addPress",()=>{this.pressing=!0,this.__revision++}),O(this,"removePress",()=>{this.pressing=!1,this.__revision++}),this.id=av(12),this.points=Tt(5)}getAllPointsAt(t,e){return[[this,this.points,e]]}applyProps(t={}){let e=!1;if(t.interactive!==this.props.interactive&&(e=!0,this.props.interactive=t.interactive),t.style){let n=t.border||t.style.border;if(n!==this._parsed.border.id)if(!n)this._parsed.border.id=null,this._parsed.border.match=[];else{let i=Vy[n]||Uy.exec(n)||Uy.exec(n);i&&(this._parsed.border.id=n,this._parsed.border.match=Vy[n]=i)}if(this._parsed.border.id&&(t.style.borderWidth=this._parsed.border.match[1],t.style.borderStyle="solid",t.style.borderColor=this._parsed.border.match[4]),t.style.outline!==this._parsed.outline.id)if(!t.style.outline)this._parsed.outline.id=null,this._parsed.outline.match=[];else{let i=Vy[t.style.outline]||Uy.exec(t.style.outline)||Uy.exec(t.style.outline);i&&(this._parsed.outline.id=t.style.outline,this._parsed.outline.match=Vy[t.style.outline]=i)}this._parsed.outline.id&&(t.style.outlineWidth=this._parsed.outline.match[1],t.style.outlineStyle="solid",t.style.outlineColor=this._parsed.outline.match[4]),this.props.style=t.style,t.backgroundColor&&!this.props.style.backgroundColor&&(this.props.style.backgroundColor=t.backgroundColor,e=!0),t.style.background&&!this.props.style.backgroundColor&&(this.props.style.backgroundColor=t.style.background,e=!0);for(let i of fj)if(this.props.style[i]!==t.style[i]){e=!0;break}t.style[":hover"]!==this.props.hoverStyles&&(this.props.hoverStyles=t.style[":hover"],this.hoverEvents||(this.hoverEvents=!0,this.addEventListener("pointerenter",this.addHover),this.addEventListener("pointerleave",this.removeHover)),e=!0),t.style[":active"]!==this.props.pressStyles&&(this.props.pressStyles=t.style[":active"],this.activeEvents||(this.activeEvents=!0,this.addEventListener("mousedown",this.addPress),this.addEventListener("mouseup",this.removePress)),e=!0)}t.href!==this.props.href&&(this.props.href=t.href,e=!0),t.hrefTarget!==this.props.hrefTarget&&(this.props.hrefTarget=t.hrefTarget,e=!0),t.title!==this.props.title&&(this.props.title=t.title,e=!0),t.className!==this.props.className&&(this.props.className=t.className,t.className&&!this.hoverEvents&&(this.hoverEvents=!0,this.addEventListener("pointerenter",this.addHover),this.addEventListener("pointerleave",this.removeHover)),t.className&&!this.activeEvents&&(this.activeEvents=!0,this.addEventListener("mousedown",this.addPress),this.addEventListener("mouseup",this.removePress)),e=!0),t.relativeSize!==this.props.relativeSize&&(this.props.relativeSize=t.relativeSize,e=!0),t.relativeStyle!==this.props.relativeStyle&&(this.props.relativeStyle=t.relativeStyle,e=!0),t.html!==this.props.html&&(this.props.html=t.html,e=!0),t.target&&(t.target.width!==this.display.width||t.target.height!==this.display.height||t.target.x!==this.points[1]||t.target.y!==this.points[2])&&(e=!0,this.points=Zt.singleBox(t.target.width,t.target.height,t.target.x,t.target.y),this.display.points=Zt.singleBox(t.target.width,t.target.height,t.target.x,t.target.y),this.display.width=t.target.width,this.display.height=t.target.height),e&&this.__revision++}},Xy=class extends mo{constructor(){super(),O(this,"type","spacial-content"),O(this,"id",void 0),O(this,"points",void 0),O(this,"color","#000"),O(this,"backgroundColor",void 0),O(this,"hovering",void 0),O(this,"pressing",void 0),O(this,"text",""),O(this,"display",{x:0,y:0,scale:1,width:100,height:100,points:Tt(5)}),O(this,"className",void 0),O(this,"html",void 0),O(this,"interactive",!1),O(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=Tt(5)}getAllPointsAt(t,e){return[[this,this.points,e]]}applyProps({id:t,target:e,text:n,color:i,backgroundColor:a,fontSize:o=18,interactive:s,fontFamily:u="Arial, sans-serif",...d}){d.font=`${o}px ${u}`,this.interactive=s||!1,n!==void 0&&(this.text=n||""),i&&(this.color=i),a&&(this.backgroundColor=a),t&&(this.id=t),e&&(this.points=Zt.singleBox(e.width,e.height,e.x,e.y),this.display.points=this.points,this.display.width=e.width,this.display.height=e.height),this.props={...this.props,...d},this.__revision++}},qe=Math.pow,jy=Math.sqrt,fh=Math.sin,yI=Math.cos,mh=Math.PI,Jy=1.70158,qy=Jy*1.525,vI=Jy+1,SI=2*mh/3,bI=2*mh/4.5,Fy=function(t){let e=7.5625,n=2.75;return t<1/n?e*t*t:t<2/n?e*(t-=1.5/n)*t+.75:t<2.5/n?e*(t-=2.25/n)*t+.9375:e*(t-=2.625/n)*t+.984375},ir={linear:t=>t,easeInQuad:function(t){return t*t},easeOutQuad:function(t){return 1-(1-t)*(1-t)},easeInOutQuad:function(t){return t<.5?2*t*t:1-qe(-2*t+2,2)/2},easeInCubic:function(t){return t*t*t},easeOutCubic:function(t){return 1-qe(1-t,3)},easeInOutCubic:function(t){return t<.5?4*t*t*t:1-qe(-2*t+2,3)/2},easeInQuart:function(t){return t*t*t*t},easeOutQuart:function(t){return 1-qe(1-t,4)},easeInOutQuart:function(t){return t<.5?8*t*t*t*t:1-qe(-2*t+2,4)/2},easeInQuint:function(t){return t*t*t*t*t},easeOutQuint:function(t){return 1-qe(1-t,5)},easeInOutQuint:function(t){return t<.5?16*t*t*t*t*t:1-qe(-2*t+2,5)/2},easeInSine:function(t){return 1-yI(t*mh/2)},easeOutSine:function(t){return fh(t*mh/2)},easeInOutSine:function(t){return-(yI(mh*t)-1)/2},easeInExpo:function(t){return t===0?0:qe(2,10*t-10)},easeOutExpo:function(t){return t===1?1:1-qe(2,-10*t)},easeInOutExpo:function(t){return t===0?0:t===1?1:t<.5?qe(2,20*t-10)/2:(2-qe(2,-20*t+10))/2},easeInCirc:function(t){return 1-jy(1-qe(t,2))},easeOutCirc:function(t){return jy(1-qe(t-1,2))},easeInOutCirc:function(t){return t<.5?(1-jy(1-qe(2*t,2)))/2:(jy(1-qe(-2*t+2,2))+1)/2},easeInBack:function(t){return vI*t*t*t-Jy*t*t},easeOutBack:function(t){return 1+vI*qe(t-1,3)+Jy*qe(t-1,2)},easeInOutBack:function(t){return t<.5?qe(2*t,2)*((qy+1)*2*t-qy)/2:(qe(2*t-2,2)*((qy+1)*(t*2-2)+qy)+2)/2},easeInElastic:function(t){return t===0?0:t===1?1:-qe(2,10*t-10)*fh((t*10-10.75)*SI)},easeOutElastic:function(t){return t===0?0:t===1?1:qe(2,-10*t)*fh((t*10-.75)*SI)+1},easeInOutElastic:function(t){return t===0?0:t===1?1:t<.5?-(qe(2,20*t-10)*fh((20*t-11.125)*bI))/2:qe(2,-20*t+10)*fh((20*t-11.125)*bI)/2+1},easeInBounce:function(t){return 1-Fy(1-t)},easeOutBounce:Fy,easeInOutBounce:function(t){return t<.5?(1-Fy(1-2*t))/2:(1+Fy(2*t-1))/2}},dj=class{constructor(t){O(this,"runtime",void 0),O(this,"pendingTransition",void 0),O(this,"lastZoomTo",null),O(this,"isConstraining",!1),O(this,"lastGoToRegion",null),this.runtime=t,this.pendingTransition={from:Tt(5),to:Tt(5),elapsed_time:0,done:!0,total_time:0,timingFunction:ir.easeInOutQuad,constrain:!1}}hasPending(){return!this.pendingTransition.done}getPendingTransition(){return this.pendingTransition}getPendingFrom(){return this.pendingTransition.from}customTransition(t){t(this.pendingTransition)}stopTransition(){this.pendingTransition.from=Tt(this.runtime.target),this.pendingTransition.to=Tt(this.runtime.target),this.pendingTransition.done=!0,this.pendingTransition.elapsed_time=0,this.pendingTransition.total_time=0}runTransition(t,e){if(!this.pendingTransition.done){let n=this.pendingTransition,i=n.total_time===0?0:(n.elapsed_time+e)/n.total_time,a=n.total_time===0?1:i===0?0:n.timingFunction(i);t[1]=n.from[1]+(n.to[1]-n.from[1])*a,t[2]=n.from[2]+(n.to[2]-n.from[2])*a,t[3]=n.from[3]+(n.to[3]-n.from[3])*a,t[4]=n.from[4]+(n.to[4]-n.from[4])*a,this.pendingTransition.elapsed_time+=e,this.pendingTransition.elapsed_time>=this.pendingTransition.total_time&&(this.pendingTransition.done=!0,this.pendingTransition.callback?.(),this.pendingTransition.constrain&&this.constrainBounds({transition:{duration:this.pendingTransition.total_time===0?0:500,easing:ir.easeOutExpo}}))}}resumeTransition(){this.lastZoomTo&&this.zoomTo(this.lastZoomTo.factor,this.lastZoomTo.options),this.isConstraining&&this.constrainBounds(),this.lastGoToRegion&&this.goToRegion(this.lastGoToRegion.target,this.lastGoToRegion.options)}zoomTo(t,e={}){let{origin:n,stream:i=!1,transition:a}=e;this.lastZoomTo={factor:t,options:e};let o=this.runtime.getZoomedPosition(t,{origin:n}),s=Math.abs(1-t);this.applyTransition(o,a,{duration:2e3*s,easing:ir.easeOutExpo,constrain:!0,callback:()=>{this.lastZoomTo=null}},{stream:!1})}constrainBounds({transition:t,panPadding:e=0}={}){this.isConstraining=!0;let[n,i]=this.runtime.constrainBounds(this.runtime.target,{panPadding:e});n&&(this.applyTransition(i,t,{duration:500,easing:ir.easeOutQuart,constrain:!1,callback:()=>{this.isConstraining=!1}}),this.runtime.updateNextFrame())}applyTransition(t,e,n,{stream:i}={}){this.pendingTransition.from=Tt(this.runtime.target),this.pendingTransition.to=t,i||(this.pendingTransition.elapsed_time=0),this.pendingTransition.done=!1,this.pendingTransition.total_time=e?.duration===void 0?n?.duration===void 0?1e3:n.duration:e.duration,this.pendingTransition.constrain=e?.constrain===void 0?n?.constrain===void 0?!1:n.constrain:e.constrain,this.pendingTransition.timingFunction=e?.easing||n?.easing||ir.easeInOutSine}goToRegion(t,{transition:e}={}){this.lastGoToRegion={target:t,options:{transition:e}};let n=this.runtime.clampRegion(t);this.applyTransition(Zt.singleBox(n.width,n.height,n.x,n.y),e,{duration:1e3,easing:ir.easeOutExpo,constrain:!0,callback:()=>{this.lastGoToRegion=null}}),this.runtime.updateNextFrame()}};Number.MIN_VALUE+1;var rv=class{get x(){return this.target[1]}set x(t){this.target[1]=t}get y(){return this.target[2]}set y(t){this.target[2]=t}get x2(){return this.target[3]}set x2(t){this.target[3]=t}get y2(){return this.target[4]}set y2(t){this.target[4]=t}get width(){return this.target[3]-this.target[1]}set width(t){this.target[3]=this.target[1]+t}get height(){return this.target[4]-this.target[2]}set height(t){this.target[4]=this.target[2]=t}constructor(t,e,n,i=[],a){O(this,"id",av()),O(this,"ready",!1),O(this,"renderer",void 0),O(this,"world",void 0),O(this,"target",void 0),O(this,"homePosition",void 0),O(this,"manualHomePosition",void 0),O(this,"manualFocalPosition",void 0),O(this,"focalPosition",void 0),O(this,"homePaddingPx",void 0),O(this,"transitionManager",void 0),O(this,"aggregate",void 0),O(this,"transformBuffer",Tt(500)),O(this,"lastTarget",Tt(5)),O(this,"zoomBuffer",Tt(5)),O(this,"logNextRender",!1),O(this,"pendingUpdate",!0),O(this,"isCommitting",!1),O(this,"firstRender",!0),O(this,"lastTime",void 0),O(this,"stopId",void 0),O(this,"mode","explore"),O(this,"controllers",[]),O(this,"controllersRunning",!1),O(this,"controllerStopFunctions",[]),O(this,"maxScaleFactor",1),O(this,"_viewerToWorld",{x:0,y:0}),O(this,"_lastGoodScale",1),O(this,"_canvasWidth",0),O(this,"_canvasHeight",0),O(this,"hooks",{useFrame:[],useBeforeFrame:[],useAfterPaint:[],useAfterFrame:[]}),O(this,"fpsLimit",void 0),O(this,"options",void 0),O(this,"hookOptions",{filters:{grayscale:0,contrast:0,brightness:0,saturate:0,sepia:0,invert:0,hueRotate:0,blur:0}}),O(this,"_viewport",{x:0,y:0,width:0,height:0}),O(this,"setViewport",s=>{let u=Math.round(s.x===void 0?this.target[1]:s.x),d=Math.round(s.y===void 0?this.target[2]:s.y);s.width?this.target[3]=u+s.width:this.target[3]=this.target[3]-this.target[1]+u,s.height?this.target[4]=d+s.height:this.target[4]=this.target[4]-this.target[2]+d,Math.abs(this.target[1]-u)>.01&&(this.target[1]=u),Math.abs(this.target[2]-d)>.01&&(this.target[2]=d),this.pendingUpdate=!0}),O(this,"render",s=>{let u=s-this.lastTime;if(this.isCommitting||this.fpsLimit&&u<1e3/this.fpsLimit){this.stopId=window.requestAnimationFrame(this.render);return}this.lastTime=s,this.world.flushSubscriptions(),this.stopId=window.requestAnimationFrame(this.render),this.hook("useFrame",u);let d=this.pendingUpdate,p=this.renderer.pendingUpdate();if(this.transitionManager.hasPending()&&(this.transitionManager.runTransition(this.target,u),this.pendingUpdate=!0,this.updateControllerPosition()),!this.firstRender&&!d&&!p&&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 f=this.getScaleFactor(),m=this.renderer.getPointsAt(this.world,this.target,this.aggregate,f),g=m.length;for(let E=0;E<g;E++){let T=m[E][0],A=m[E][1],x=m[E][2],R=x?ro(A,x,this.transformBuffer):A;this.renderer.prepareLayer(T,T.__parent&&x?ro(T.__parent.crop||T.__parent.points,x):R);let C=R.length/5;for(let M=0;M<C;M++){let z=M*5;R[z]!==0&&(this.renderer.paint(T,M,R[z+1],R[z+2],R[z+3]-R[z+1],R[z+4]-R[z+2]),this.hook("useAfterPaint",T))}this.renderer.finishLayer(T,A)}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 v=this.world.getScheduledUpdates(this.target,f),S=v.length;if(S>0)for(let E=0;E<S;E++){let T=v[S-E-1]();T?T.then(()=>{this.pendingUpdate=!0}):this.pendingUpdate=!0}}),this.renderer=t,this.world=e,this.options={maxOverZoom:1,maxUnderZoom:1,visibilityRatio:1.5,...a||{}},this.target=Zt.projection(n),this.manualHomePosition=!1,this.pendingUpdate=!0,this.homePosition=Zt.projection(this.world),this.manualFocalPosition=!1,this.focalPosition=this.target,this.updateFocalPosition(),this.transitionManager=new dj(this),this.aggregate=Lo(1),this.world.addLayoutSubscriber(s=>{s==="repaint"&&(this.pendingUpdate=!0),s==="recalculate-world-size"&&(this.manualHomePosition||(this.setHomePosition(),this.goHome()),this.updateFocalPosition())}),this.lastTime=performance.now(),this.controllers=i,this.render(this.lastTime),this.startControllers(),this.homePaddingPx=void 0;let o=this.getRendererScreenPosition();this._canvasWidth=o?.width||0,this._canvasHeight=o?.height||0}setHomePosition(t){this.homePosition.set(Zt.projection(t||this.world)),this.pendingUpdate=!0}setHomePaddingPx(t){t==null?this.homePaddingPx=void 0:this.homePaddingPx=t,this.pendingUpdate=!0}getHomePaddingPx(){return this.homePaddingPx}startControllers(){if(!this.controllersRunning){for(let t of this.controllers)this.controllerStopFunctions.push(t.start(this));this.controllersRunning=!0}}stopControllers(){if(this.controllersRunning){for(let t of this.controllerStopFunctions)t();this.controllersRunning=!1,this.controllerStopFunctions=[]}}updateControllerPosition(){for(let t of this.controllers)t.updatePosition(this.x,this.y,this.width,this.height)}triggerResize(){this.renderer.triggerResize&&this.renderer.triggerResize();let t=this.getRendererScreenPosition();t&&(this._canvasWidth=t.width,this._canvasHeight=t.height),this.pendingUpdate=!0}addController(t){this.controllers.push(t),this.controllersRunning&&t.start(this),this.pendingUpdate=!0}cover(){return this.goHome({cover:!0})}getRendererScreenPosition(){return this.renderer.getRendererScreenPosition()}updateRendererScreenPosition(){this.pendingUpdate=!0,this.renderer.resize()}setOptions(t){this.options={...this.options,...t}}getHomeTarget(t={}){let e=this.getRendererScreenPosition(),n=e?.width||this._canvasWidth||this.width,i=e?.height||this._canvasHeight||this.height;e&&(this._canvasWidth=e.width,this._canvasHeight=e.height);let a=t.paddingPx===void 0?this.homePaddingPx:t.paddingPx,o={left:0,right:0,top:0,bottom:0};typeof a=="number"?o.left=o.right=o.top=o.bottom=a:a&&(o.left=a.left||0,o.right=a.right||0,o.top=a.top||0,o.bottom=a.bottom||0);let s=Math.max(1,n-o.left-o.right),u=s/Math.max(1,i-o.top-o.bottom),d=t.position?{x:t.position[1],y:t.position[2],width:t.position[3]-t.position[1],height:t.position[4]-t.position[2]}:{x:this.homePosition[1],y:this.homePosition[2],width:this.homePosition[3]-this.homePosition[1],height:this.homePosition[4]-this.homePosition[2]},p=d.width/d.height,f=t.cover?p<u:p>u,m=d.width,g=d.height,v=d.x,S=d.y;f?(m=d.width,g=d.width/u,v=d.x,S=d.y-(g-d.height)/2):(g=d.height,m=d.height*u,v=d.x-(m-d.width)/2,S=d.y);let E=m/s,T=o.left*E,A=o.right*E,x=o.top*E,R=o.bottom*E;return{x:v-T,y:S-x,width:m+T+A,height:g+x+R}}getHomeTargetStrand(t={}){let e=this.getHomeTarget(t);return Zt.singleBox(e.width,e.height,e.x,e.y)}goHome(t={}){if(this.world.width<=0||this.world.height<=0)return;let e=this.getHomeTarget(t);this.target[1]=Math.round(e.x),this.target[2]=Math.round(e.y),this.target[3]=Math.round(e.x+e.width),this.target[4]=Math.round(e.y+e.height);let n=t.paddingPx===void 0?this.homePaddingPx:t.paddingPx,i=n?{ref:!0,homePaddingPx:n}:{ref:!0};this.constrainBounds(this.target,i),this.updateControllerPosition()}resize(t,e,n,i){this.transitionManager.hasPending()&&this.transitionManager.stopTransition(),this.updateFocalPosition(t-e,n-i);let a=e/t,o=i/n;this.target[3]=this.target[1]+(this.target[3]-this.target[1])*a,this.target[4]=this.target[2]+(this.target[4]-this.target[2])*o,this.goHome({position:this.focalPosition}),this.renderer.resize(e,i),this.pendingUpdate=!0,this.transitionManager.resumeTransition()}updateFocalPosition(t,e){if(!this.manualFocalPosition){let n=this.width,i=this.height,a=Math.min(n,i),o=this.x+0,s=this.y+0;if(n<i){let u=this.height-this.width;this.focalPosition=Zt.projection({x:o,y:s+u/2,width:a-0,height:a-0}),this.pendingUpdate=!0}else{let u=this.width-this.height;this.focalPosition=Zt.projection({x:o+u/2,y:s,width:a-0,height:a-0}),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(t,{panPadding:e=0,ref:n=!1,homePaddingPx:i}={}){let{minX:a,maxX:o,minY:s,maxY:u}=this.getBounds({target:t,padding:e,homePaddingPx:i}),d=!1,p=n?t:Tt(t),f=Math.round(t[3]-t[1]),m=Math.round(t[4]-t[2]);return a>t[1]&&(d=!0,p[1]=a,p[3]=a+f),s>t[2]&&(d=!0,p[2]=s,p[4]=s+m),o<t[1]&&(d=!0,p[1]=o,p[3]=o+f),u<t[2]&&(d=!0,p[2]=u,p[4]=u+m),[d,p]}getBounds(t){let e=t.target||this.target,n=t.padding,i=this.options.visibilityRatio,a=Math.abs(1-i),o=0,s=0,u=0,d=0;if(t.homePaddingPx){let C=this.getScaleFactor(!1);typeof t.homePaddingPx=="number"?o=s=u=d=t.homePaddingPx/C:(o=t.homePaddingPx.left?t.homePaddingPx.left/C:0,s=t.homePaddingPx.right?t.homePaddingPx.right/C:0,u=t.homePaddingPx.top?t.homePaddingPx.top/C:0,d=t.homePaddingPx.bottom?t.homePaddingPx.bottom/C:0)}if(this.world.hasActiveZone()){let C=this.world.getActiveZone();if(C){let M=e[3]-e[1]<C.points[3]-C.points[1],z=e[4]-e[2]<C.points[4]-C.points[2];return{minX:M?C.points[1]-n:C.points[1]+(C.points[3]-C.points[1])/2-(e[3]-e[1])/2,maxX:z?C.points[2]-n:C.points[2]+(C.points[4]-C.points[2])/2-(e[4]-e[2])/2,minY:M?C.points[3]+n:C.points[1]+(C.points[3]-C.points[1])/2-(e[3]-e[1])/2,maxY:z?C.points[4]+n:C.points[2]+(C.points[4]-C.points[2])/2-(e[4]-e[2])/2}}}let p=e[3]-e[1],f=this.world.width+o+s,m=-p*a-o,g=f-p-m,v=e[4]-e[2],S=this.world.height+u+d,E=-v*a-u,T=S-v-E,A=Math.round(Math.max(m,g)),x=Math.round(Math.min(m,g)),R=Math.round(Math.max(E,T));return{minX:x,maxX:A,minY:Math.round(Math.min(E,T)),maxY:R}}getScaleFactor(t=!1){let e=this.renderer.getScale(this.target[3]-this.target[1],this.target[4]-this.target[2],t);return e===0?this._lastGoodScale:(this._lastGoodScale=e,e)}getZoomedPosition(t,{origin:e,fromPos:n}){let i=n?{width:n[3]-n[1],height:n[4]-n[2]}:void 0,a=i?this.renderer.getScale(i.width,i.height):this.getScaleFactor(),o=i?i.width:this.width,s=i?i.height:this.height,u=this.getRendererScreenPosition()?.width,d=this.world.width,p=u?u/d:1,f=this.options.maxUnderZoom,m=Math.max(p||1,this.options.maxOverZoom),g=1/t,v=a*g;if(g<1){let E=o*a,T=s*a;this.world.width/E>this.world.height/T?this.world.width*v<~~(o*a)*f&&(t=this.world.width*a/(o*a*f)):this.world.height*v<~~(s*a)*f&&(t=this.world.height*a/(s*a*f))}else v>m&&(t=a/m);let S=ro(this.target,Ku(t,e?e.x:this.target[1]+(this.target[3]-this.target[1])/2,e?e.y:this.target[2]+(this.target[4]-this.target[2])/2),this.zoomBuffer);return this.constrainBounds(S,{ref:!0,panPadding:100}),S}clampRegion({x:t,y:e,width:n,height:i,padding:a=0}){let o=this.width,s=this.height,u=n/o<i/s,d=t-a,p=e-a,f=n+a*2,m=i+a*2;if(u){let v=m/s*o;return{x:d-(v-f)/2,y:p,width:v,height:m}}let g=f/o*s;return{x:d,y:p-(g-m)/2,width:f,height:g}}viewerToWorld(t,e){let n=this.getScaleFactor();return this._viewerToWorld.x=this.target[1]+t/n,this._viewerToWorld.y=this.target[2]+e/n,this._viewerToWorld}worldToViewer(t,e,n,i){let a=Zt.singleBox(n,i,t,e);return ja(a,oo(Lo(this.getScaleFactor()),ei(-this.target[1],-this.target[2]))),{x:a[1],y:a[2],width:a[3]-a[1],height:a[4]-a[2],strand:a}}setScale(t,e){ja(this.target,Ku(t,e?e.x:this.target[1]+(this.target[3]-this.target[1])/2,e?e.y:this.target[2]+(this.target[4]-this.target[2])/2)),this.pendingUpdate=!0}syncTo(t){let e=this.target;return this.target=t.target,this.pendingUpdate=!0,()=>{this.target=e}}stop(){return this.stopId!==void 0&&(window.cancelAnimationFrame(this.stopId),this.stopId=void 0),()=>{this.render(performance.now())}}reset(){this.renderer.reset()}selectZone(t){this.world.selectZone(t),this.pendingUpdate=!0}deselectZone(){this.world.deselectZone(),this.pendingUpdate=!0}hook(t,e){let n=this.hooks[t].length;if(n!==0)for(let i=0;i<n;i++)this.hooks[t][i](e)}registerHook(t,e){return this.hooks[t].push(e),()=>{this.hooks[t]=this.hooks[t].filter(n=>n!==e)}}updateNextFrame(){this.pendingUpdate=!0}},Gy=/([0-9]+(px|em)\s+)+(solid)\s+(.*)/g,ky={},hj=["backgroundColor","opacity","boxShadow","borderColor","borderWidth","borderStyle","outlineColor","outlineWidth","outlineOffset","outlineStyle"],LI=class extends mo{constructor(){super(),O(this,"id",void 0),O(this,"type","spacial-content"),O(this,"isShape",!0),O(this,"points",void 0),O(this,"hoverEvents",!1),O(this,"activeEvents",!1),O(this,"display",{x:0,y:0,scale:1,width:-1,height:-1,points:Tt(5)}),O(this,"boundingBox",null),O(this,"_parsed",{border:{id:null,match:[]},outline:{id:null,match:[]}}),O(this,"hovering",void 0),O(this,"pressing",void 0),O(this,"props",{}),O(this,"shape",{type:"none"}),O(this,"addHover",()=>{this.hovering=!0,this.__revision++}),O(this,"removeHover",()=>{this.hovering=!1,this.pressing=!1,this.__revision++}),O(this,"addPress",()=>{this.pressing=!0,this.__revision++}),O(this,"removePress",()=>{this.pressing=!1,this.__revision++}),this.id=av(12),this.points=Tt(5),this.shape={type:"none"}}updateBoundingBox(){if(this.shape.type==="none")return;let t=this.shape.points;if(this.shape.points.length>2){let e=Math.min(...t.map(o=>o[0])),n=Math.min(...t.map(o=>o[1])),i=Math.max(0,...t.map(o=>o[0])),a=Math.max(0,...t.map(o=>o[1]));this.boundingBox={x:e,y:n,width:i-e,height:a-n};return}this.boundingBox=null}intersects(t){if(!t||this.shape.type==="none")return!1;let[e,n]=t,i=this.shape.points,a=this.boundingBox;if(a||(this.updateBoundingBox(),a=this.boundingBox),!a||e<a.x||e>a.x+a.width||n<a.y||n>a.height+a.y)return!1;let o=!1;for(let s=0,u=i.length-1;s<i.length;u=s++)i[s][1]>n!=i[u][1]>n&&e<(i[u][0]-i[s][0])*(n-i[s][1])/(i[u][1]-i[s][1])+i[s][0]&&(o=!o);return o}getAllPointsAt(t,e){return t[3]-t[1]===1&&t[4]-t[2]===1?this.intersects([t[1],t[2]])?[[this,this.points,e]]:[]:[[this,this.points,e]]}applyProps(t={}){let e=!1;if(t.points)if(this.shape.type!=="polygon"||this.shape.points.length!==t.points.length)this.shape={type:"polygon",points:t.points,open:t.open},this.updateBoundingBox();else{let n=!1,i=t.points.length;for(let a=0;a<i;a++)if(t.points[a][0]!==this.shape.points[a][0]||t.points[a][1]!==this.shape.points[a][1]){n=!0;break}n&&(this.shape={type:"polygon",points:t.points,open:t.open},this.updateBoundingBox())}if(t.interactive!==this.props.interactive&&(e=!0,this.props.interactive=t.interactive),(t.open||t.open===!1)&&(e=!0,this.shape.open=t.open),t.style){let n=t.border||t.style.border;if(n!==this._parsed.border.id)if(!n)this._parsed.border.id=null,this._parsed.border.match=[];else{let i=ky[n]||Gy.exec(n)||Gy.exec(n);i&&(this._parsed.border.id=n,this._parsed.border.match=ky[n]=i)}if(this._parsed.border.id&&(t.style.borderWidth=this._parsed.border.match[1],t.style.borderStyle="solid",t.style.borderColor=this._parsed.border.match[4]),t.style.outline!==this._parsed.outline.id)if(!t.style.outline)this._parsed.outline.id=null,this._parsed.outline.match=[];else{let i=ky[t.style.outline]||Gy.exec(t.style.outline)||Gy.exec(t.style.outline);i&&(this._parsed.outline.id=t.style.outline,this._parsed.outline.match=ky[t.style.outline]=i)}this._parsed.outline.id&&(t.style.outlineWidth=this._parsed.outline.match[1],t.style.outlineStyle="solid",t.style.outlineColor=this._parsed.outline.match[4]),this.props.style=t.style,t.backgroundColor&&!this.props.style.backgroundColor&&(this.props.style.backgroundColor=t.backgroundColor,e=!0),t.style.background&&!this.props.style.backgroundColor&&(this.props.style.backgroundColor=t.style.background,e=!0);for(let i of hj)if(this.props.style[i]!==t.style[i]){e=!0;break}t.style[":hover"]!==this.props.hoverStyles&&(this.props.hoverStyles=t.style[":hover"],this.hoverEvents||(this.hoverEvents=!0,this.addEventListener("pointerenter",this.addHover),this.addEventListener("pointerleave",this.removeHover)),e=!0),t.style[":active"]!==this.props.pressStyles&&(this.props.pressStyles=t.style[":active"],this.activeEvents||(this.activeEvents=!0,this.addEventListener("mousedown",this.addPress),this.addEventListener("mouseup",this.removePress)),e=!0)}t.href!==this.props.href&&(this.props.href=t.href,e=!0),t.hrefTarget!==this.props.hrefTarget&&(this.props.hrefTarget=t.hrefTarget,e=!0),t.title!==this.props.title&&(this.props.title=t.title,e=!0),t.className!==this.props.className&&(this.props.className=t.className,t.className&&!this.hoverEvents&&(this.hoverEvents=!0,this.addEventListener("pointerenter",this.addHover),this.addEventListener("pointerleave",this.removeHover)),t.className&&!this.activeEvents&&(this.activeEvents=!0,this.addEventListener("mousedown",this.addPress),this.addEventListener("mouseup",this.removePress)),e=!0),t.relativeSize!==this.props.relativeSize&&(this.props.relativeSize=t.relativeSize,e=!0),t.relativeStyle!==this.props.relativeStyle&&(this.props.relativeStyle=t.relativeStyle,e=!0),t.html!==this.props.html&&(this.props.html=t.html,e=!0),t.target&&(t.target.width!==this.display.width||t.target.height!==this.display.height||t.target.x!==this.points[1]||t.target.y!==this.points[2])&&(e=!0,this.points=Zt.singleBox(t.target.width,t.target.height,t.target.x,t.target.y),this.display.points=Zt.singleBox(t.target.width,t.target.height,t.target.x,t.target.y),this.display.width=t.target.width,this.display.height=t.target.height),e&&this.__revision++}},dh=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,$y=typeof AbortController=="function"?AbortController:class{constructor(){this.signal=new BI}abort(t=Error("This operation was aborted")){this.signal.reason=this.signal.reason||t,this.signal.aborted=!0,this.signal.dispatchEvent({type:"abort",target:this.signal})}},pj=typeof AbortSignal=="function",mj=typeof $y.AbortSignal=="function",BI=pj?AbortSignal:mj?$y.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(e=>e(t),this))}onabort(){}addEventListener(t,e){t==="abort"&&this._listeners.push(e)}removeEventListener(t,e){t==="abort"&&(this._listeners=this._listeners.filter(n=>n!==e))}},TA=new Set,gA=(t,e)=>{let n=`LRU_CACHE_OPTION_${t}`;lv(n)&&CA(n,`${t} option`,`options.${e}`,sv)},yA=(t,e)=>{let n=`LRU_CACHE_METHOD_${t}`;if(lv(n)){let{prototype:i}=sv,{get:a}=Object.getOwnPropertyDescriptor(i,t);CA(n,`${t} method`,`cache.${e}()`,a)}},gj=(t,e)=>{let n=`LRU_CACHE_PROPERTY_${t}`;if(lv(n)){let{prototype:i}=sv,{get:a}=Object.getOwnPropertyDescriptor(i,t);CA(n,`${t} property`,`cache.${e}`,a)}},PI=(...t)=>{typeof process=="object"&&process&&typeof process.emitWarning=="function"?process.emitWarning(...t):console.error(...t)},lv=t=>!TA.has(t),CA=(t,e,n,i)=>{TA.add(t),PI(`The ${e} is deprecated. Please use ${n} instead.`,"DeprecationWarning",t,i)},yl=t=>t&&t===Math.floor(t)&&t>0&&isFinite(t),HI=t=>yl(t)?t<=2**8?Uint8Array:t<=2**16?Uint16Array:t<=2**32?Uint32Array:t<=2**53-1?Ky:null:null,Ky=class extends Array{constructor(t){super(t),this.fill(0)}},yj=class{constructor(t){if(t===0)return[];this.heap=new(HI(t))(t),this.length=0}push(t){this.heap[this.length++]=t}pop(){return this.heap[--this.length]}},sv=class EA{constructor(e={}){let{max:n=0,ttl:i,ttlResolution:a=1,ttlAutopurge:o,updateAgeOnGet:s,updateAgeOnHas:u,allowStale:d,dispose:p,disposeAfter:f,noDisposeOnSet:m,noUpdateTTL:g,maxSize:v=0,maxEntrySize:S=0,sizeCalculation:E,fetchMethod:T,fetchContext:A,noDeleteOnFetchRejection:x,noDeleteOnStaleGet:R,allowStaleOnFetchRejection:C,allowStaleOnFetchAbort:M,ignoreFetchAbort:z}=e,{length:N,maxAge:D,stale:q}=e instanceof EA?{}:e;if(n!==0&&!yl(n))throw TypeError("max option must be a nonnegative integer");let P=n?HI(n):Array;if(!P)throw Error("invalid max value: "+n);if(this.max=n,this.maxSize=v,this.maxEntrySize=S||this.maxSize,this.sizeCalculation=E||N,this.sizeCalculation){if(!this.maxSize&&!this.maxEntrySize)throw TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw TypeError("sizeCalculation set to non-function")}if(this.fetchMethod=T||null,this.fetchMethod&&typeof this.fetchMethod!="function")throw TypeError("fetchMethod must be a function if specified");if(this.fetchContext=A,!this.fetchMethod&&A!==void 0)throw TypeError("cannot set fetchContext without fetchMethod");if(this.keyMap=new Map,this.keyList=Array(n).fill(null),this.valList=Array(n).fill(null),this.next=new P(n),this.prev=new P(n),this.head=0,this.tail=0,this.free=new yj(n),this.initialFill=1,this.size=0,typeof p=="function"&&(this.dispose=p),typeof f=="function"?(this.disposeAfter=f,this.disposed=[]):(this.disposeAfter=null,this.disposed=null),this.noDisposeOnSet=!!m,this.noUpdateTTL=!!g,this.noDeleteOnFetchRejection=!!x,this.allowStaleOnFetchRejection=!!C,this.allowStaleOnFetchAbort=!!M,this.ignoreFetchAbort=!!z,this.maxEntrySize!==0){if(this.maxSize!==0&&!yl(this.maxSize))throw TypeError("maxSize must be a positive integer if specified");if(!yl(this.maxEntrySize))throw TypeError("maxEntrySize must be a positive integer if specified");this.initializeSizeTracking()}if(this.allowStale=!!d||!!q,this.noDeleteOnStaleGet=!!R,this.updateAgeOnGet=!!s,this.updateAgeOnHas=!!u,this.ttlResolution=yl(a)||a===0?a:1,this.ttlAutopurge=!!o,this.ttl=i||D||0,this.ttl){if(!yl(this.ttl))throw TypeError("ttl must be a positive integer if specified");this.initializeTTLTracking()}if(this.max===0&&this.ttl===0&&this.maxSize===0)throw TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.max&&!this.maxSize){let U="LRU_CACHE_UNBOUNDED";lv(U)&&(TA.add(U),PI("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",U,EA))}q&&gA("stale","allowStale"),D&&gA("maxAge","ttl"),N&&gA("length","sizeCalculation")}getRemainingTTL(e){return this.has(e,{updateAgeOnHas:!1})?1/0:0}initializeTTLTracking(){this.ttls=new Ky(this.max),this.starts=new Ky(this.max),this.setItemTTL=(i,a,o=dh.now())=>{if(this.starts[i]=a===0?0:o,this.ttls[i]=a,a!==0&&this.ttlAutopurge){let s=setTimeout(()=>{this.isStale(i)&&this.delete(this.keyList[i])},a+1);s.unref&&s.unref()}},this.updateItemAge=i=>{this.starts[i]=this.ttls[i]===0?0:dh.now()},this.statusTTL=(i,a)=>{i&&(i.ttl=this.ttls[a],i.start=this.starts[a],i.now=e||n(),i.remainingTTL=i.now+i.ttl-i.start)};let e=0,n=()=>{let i=dh.now();if(this.ttlResolution>0){e=i;let a=setTimeout(()=>e=0,this.ttlResolution);a.unref&&a.unref()}return i};this.getRemainingTTL=i=>{let a=this.keyMap.get(i);return a===void 0?0:this.ttls[a]===0||this.starts[a]===0?1/0:this.starts[a]+this.ttls[a]-(e||n())},this.isStale=i=>this.ttls[i]!==0&&this.starts[i]!==0&&(e||n())-this.starts[i]>this.ttls[i]}updateItemAge(e){}statusTTL(e,n){}setItemTTL(e,n,i){}isStale(e){return!1}initializeSizeTracking(){this.calculatedSize=0,this.sizes=new Ky(this.max),this.removeItemSize=e=>{this.calculatedSize-=this.sizes[e],this.sizes[e]=0},this.requireSize=(e,n,i,a)=>{if(this.isBackgroundFetch(n))return 0;if(!yl(i))if(a){if(typeof a!="function")throw TypeError("sizeCalculation must be a function");if(i=a(n,e),!yl(i))throw TypeError("sizeCalculation return invalid (expect positive integer)")}else throw TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return i},this.addItemSize=(e,n,i)=>{if(this.sizes[e]=n,this.maxSize){let a=this.maxSize-this.sizes[e];for(;this.calculatedSize>a;)this.evict(!0)}this.calculatedSize+=this.sizes[e],i&&(i.entrySize=n,i.totalCalculatedSize=this.calculatedSize)}}removeItemSize(e){}addItemSize(e,n){}requireSize(e,n,i,a){if(i||a)throw TypeError("cannot set size without setting maxSize or maxEntrySize on cache")}*indexes({allowStale:e=this.allowStale}={}){if(this.size)for(let n=this.tail;!(!this.isValidIndex(n)||((e||!this.isStale(n))&&(yield n),n===this.head));)n=this.prev[n]}*rindexes({allowStale:e=this.allowStale}={}){if(this.size)for(let n=this.head;!(!this.isValidIndex(n)||((e||!this.isStale(n))&&(yield n),n===this.tail));)n=this.next[n]}isValidIndex(e){return e!==void 0&&this.keyMap.get(this.keyList[e])===e}*entries(){for(let e of this.indexes())this.valList[e]!==void 0&&this.keyList[e]!==void 0&&!this.isBackgroundFetch(this.valList[e])&&(yield[this.keyList[e],this.valList[e]])}*rentries(){for(let e of this.rindexes())this.valList[e]!==void 0&&this.keyList[e]!==void 0&&!this.isBackgroundFetch(this.valList[e])&&(yield[this.keyList[e],this.valList[e]])}*keys(){for(let e of this.indexes())this.keyList[e]!==void 0&&!this.isBackgroundFetch(this.valList[e])&&(yield this.keyList[e])}*rkeys(){for(let e of this.rindexes())this.keyList[e]!==void 0&&!this.isBackgroundFetch(this.valList[e])&&(yield this.keyList[e])}*values(){for(let e of this.indexes())this.valList[e]!==void 0&&!this.isBackgroundFetch(this.valList[e])&&(yield this.valList[e])}*rvalues(){for(let e of this.rindexes())this.valList[e]!==void 0&&!this.isBackgroundFetch(this.valList[e])&&(yield this.valList[e])}[Symbol.iterator](){return this.entries()}find(e,n){for(let i of this.indexes()){let a=this.valList[i],o=this.isBackgroundFetch(a)?a.__staleWhileFetching:a;if(o!==void 0&&e(o,this.keyList[i],this))return this.get(this.keyList[i],n)}}forEach(e,n=this){for(let i of this.indexes()){let a=this.valList[i],o=this.isBackgroundFetch(a)?a.__staleWhileFetching:a;o!==void 0&&e.call(n,o,this.keyList[i],this)}}rforEach(e,n=this){for(let i of this.rindexes()){let a=this.valList[i],o=this.isBackgroundFetch(a)?a.__staleWhileFetching:a;o!==void 0&&e.call(n,o,this.keyList[i],this)}}get prune(){return yA("prune","purgeStale"),this.purgeStale}purgeStale(){let e=!1;for(let n of this.rindexes({allowStale:!0}))this.isStale(n)&&(this.delete(this.keyList[n]),e=!0);return e}dump(){let e=[];for(let n of this.indexes({allowStale:!0})){let i=this.keyList[n],a=this.valList[n],o=this.isBackgroundFetch(a)?a.__staleWhileFetching:a;if(o===void 0)continue;let s={value:o};if(this.ttls){s.ttl=this.ttls[n];let u=dh.now()-this.starts[n];s.start=Math.floor(Date.now()-u)}this.sizes&&(s.size=this.sizes[n]),e.unshift([i,s])}return e}load(e){this.clear();for(let[n,i]of e){if(i.start){let a=Date.now()-i.start;i.start=dh.now()-a}this.set(n,i.value,i)}}dispose(e,n,i){}set(e,n,{ttl:i=this.ttl,start:a,noDisposeOnSet:o=this.noDisposeOnSet,size:s=0,sizeCalculation:u=this.sizeCalculation,noUpdateTTL:d=this.noUpdateTTL,status:p}={}){if(s=this.requireSize(e,n,s,u),this.maxEntrySize&&s>this.maxEntrySize)return p&&(p.set="miss",p.maxEntrySizeExceeded=!0),this.delete(e),this;let f=this.size===0?void 0:this.keyMap.get(e);if(f===void 0)f=this.newIndex(),this.keyList[f]=e,this.valList[f]=n,this.keyMap.set(e,f),this.next[this.tail]=f,this.prev[f]=this.tail,this.tail=f,this.size++,this.addItemSize(f,s,p),p&&(p.set="add"),d=!1;else{this.moveToTail(f);let m=this.valList[f];if(n!==m){if(this.isBackgroundFetch(m)?m.__abortController.abort(Error("replaced")):o||(this.dispose(m,e,"set"),this.disposeAfter&&this.disposed.push([m,e,"set"])),this.removeItemSize(f),this.valList[f]=n,this.addItemSize(f,s,p),p){p.set="replace";let g=m&&this.isBackgroundFetch(m)?m.__staleWhileFetching:m;g!==void 0&&(p.oldValue=g)}}else p&&(p.set="update")}if(i!==0&&this.ttl===0&&!this.ttls&&this.initializeTTLTracking(),d||this.setItemTTL(f,i,a),this.statusTTL(p,f),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.initialFill++:this.free.pop()}pop(){if(this.size){let e=this.valList[this.head];return this.evict(!0),e}}evict(e){let n=this.head,i=this.keyList[n],a=this.valList[n];return this.isBackgroundFetch(a)?a.__abortController.abort(Error("evicted")):(this.dispose(a,i,"evict"),this.disposeAfter&&this.disposed.push([a,i,"evict"])),this.removeItemSize(n),e&&(this.keyList[n]=null,this.valList[n]=null,this.free.push(n)),this.head=this.next[n],this.keyMap.delete(i),this.size--,n}has(e,{updateAgeOnHas:n=this.updateAgeOnHas,status:i}={}){let a=this.keyMap.get(e);if(a!==void 0)if(this.isStale(a))i&&(i.has="stale",this.statusTTL(i,a));else return n&&this.updateItemAge(a),i&&(i.has="hit"),this.statusTTL(i,a),!0;else i&&(i.has="miss");return!1}peek(e,{allowStale:n=this.allowStale}={}){let i=this.keyMap.get(e);if(i!==void 0&&(n||!this.isStale(i))){let a=this.valList[i];return this.isBackgroundFetch(a)?a.__staleWhileFetching:a}}backgroundFetch(e,n,i,a){let o=n===void 0?void 0:this.valList[n];if(this.isBackgroundFetch(o))return o;let s=new $y;i.signal&&i.signal.addEventListener("abort",()=>s.abort(i.signal.reason));let u={signal:s.signal,options:i,context:a},d=(v,S=!1)=>{let{aborted:E}=s.signal,T=i.ignoreFetchAbort&&v!==void 0;return i.status&&(E&&!S?(i.status.fetchAborted=!0,i.status.fetchError=s.signal.reason,T&&(i.status.fetchAbortIgnored=!0)):i.status.fetchResolved=!0),E&&!T&&!S?f(s.signal.reason):(this.valList[n]===g&&(v===void 0?g.__staleWhileFetching?this.valList[n]=g.__staleWhileFetching:this.delete(e):(i.status&&(i.status.fetchUpdated=!0),this.set(e,v,u.options))),v)},p=v=>(i.status&&(i.status.fetchRejected=!0,i.status.fetchError=v),f(v)),f=v=>{let{aborted:S}=s.signal,E=S&&i.allowStaleOnFetchAbort,T=E||i.allowStaleOnFetchRejection,A=T||i.noDeleteOnFetchRejection;if(this.valList[n]===g&&(!A||g.__staleWhileFetching===void 0?this.delete(e):E||(this.valList[n]=g.__staleWhileFetching)),T)return i.status&&g.__staleWhileFetching!==void 0&&(i.status.returnedStale=!0),g.__staleWhileFetching;if(g.__returned===g)throw v},m=(v,S)=>{this.fetchMethod(e,o,u).then(E=>v(E),S),s.signal.addEventListener("abort",()=>{(!i.ignoreFetchAbort||i.allowStaleOnFetchAbort)&&(v(),i.allowStaleOnFetchAbort&&(v=E=>d(E,!0)))})};i.status&&(i.status.fetchDispatched=!0);let g=new Promise(m).then(d,p);return g.__abortController=s,g.__staleWhileFetching=o,g.__returned=null,n===void 0?(this.set(e,g,{...u.options,status:void 0}),n=this.keyMap.get(e)):this.valList[n]=g,g}isBackgroundFetch(e){return e&&typeof e=="object"&&typeof e.then=="function"&&Object.prototype.hasOwnProperty.call(e,"__staleWhileFetching")&&Object.prototype.hasOwnProperty.call(e,"__returned")&&(e.__returned===e||e.__returned===null)}async fetch(e,{allowStale:n=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:a=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:s=this.noDisposeOnSet,size:u=0,sizeCalculation:d=this.sizeCalculation,noUpdateTTL:p=this.noUpdateTTL,noDeleteOnFetchRejection:f=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:m=this.allowStaleOnFetchRejection,ignoreFetchAbort:g=this.ignoreFetchAbort,allowStaleOnFetchAbort:v=this.allowStaleOnFetchAbort,fetchContext:S=this.fetchContext,forceRefresh:E=!1,status:T,signal:A}={}){if(!this.fetchMethod)return T&&(T.fetch="get"),this.get(e,{allowStale:n,updateAgeOnGet:i,noDeleteOnStaleGet:a,status:T});let x={allowStale:n,updateAgeOnGet:i,noDeleteOnStaleGet:a,ttl:o,noDisposeOnSet:s,size:u,sizeCalculation:d,noUpdateTTL:p,noDeleteOnFetchRejection:f,allowStaleOnFetchRejection:m,allowStaleOnFetchAbort:v,ignoreFetchAbort:g,status:T,signal:A},R=this.keyMap.get(e);if(R===void 0){T&&(T.fetch="miss");let C=this.backgroundFetch(e,R,x,S);return C.__returned=C}else{let C=this.valList[R];if(this.isBackgroundFetch(C)){let q=n&&C.__staleWhileFetching!==void 0;return T&&(T.fetch="inflight",q&&(T.returnedStale=!0)),q?C.__staleWhileFetching:C.__returned=C}let M=this.isStale(R);if(!E&&!M)return T&&(T.fetch="hit"),this.moveToTail(R),i&&this.updateItemAge(R),this.statusTTL(T,R),C;let z=this.backgroundFetch(e,R,x,S),N=z.__staleWhileFetching!==void 0,D=N&&n;return T&&(T.fetch=N&&M?"stale":"refresh",D&&M&&(T.returnedStale=!0)),D?z.__staleWhileFetching:z.__returned=z}}get(e,{allowStale:n=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:a=this.noDeleteOnStaleGet,status:o}={}){let s=this.keyMap.get(e);if(s!==void 0){let u=this.valList[s],d=this.isBackgroundFetch(u);return this.statusTTL(o,s),this.isStale(s)?(o&&(o.get="stale"),d?(o&&(o.returnedStale=n&&u.__staleWhileFetching!==void 0),n?u.__staleWhileFetching:void 0):(a||this.delete(e),o&&(o.returnedStale=n),n?u:void 0)):(o&&(o.get="hit"),d?u.__staleWhileFetching:(this.moveToTail(s),i&&this.updateItemAge(s),u))}else o&&(o.get="miss")}connect(e,n){this.prev[n]=e,this.next[e]=n}moveToTail(e){e!==this.tail&&(e===this.head?this.head=this.next[e]:this.connect(this.prev[e],this.next[e]),this.connect(this.tail,e),this.tail=e)}get del(){return yA("del","delete"),this.delete}delete(e){let n=!1;if(this.size!==0){let i=this.keyMap.get(e);if(i!==void 0)if(n=!0,this.size===1)this.clear();else{this.removeItemSize(i);let a=this.valList[i];this.isBackgroundFetch(a)?a.__abortController.abort(Error("deleted")):(this.dispose(a,e,"delete"),this.disposeAfter&&this.disposed.push([a,e,"delete"])),this.keyMap.delete(e),this.keyList[i]=null,this.valList[i]=null,i===this.tail?this.tail=this.prev[i]:i===this.head?this.head=this.next[i]:(this.next[this.prev[i]]=this.next[i],this.prev[this.next[i]]=this.prev[i]),this.size--,this.free.push(i)}}if(this.disposed)for(;this.disposed.length;)this.disposeAfter(...this.disposed.shift());return n}clear(){for(let e of this.rindexes({allowStale:!0})){let n=this.valList[e];if(this.isBackgroundFetch(n))n.__abortController.abort(Error("deleted"));else{let i=this.keyList[e];this.dispose(n,i,"delete"),this.disposeAfter&&this.disposed.push([n,i,"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 yA("reset","clear"),this.clear}get length(){return gj("length","size"),this.size}static get AbortController(){return $y}static get AbortSignal(){return BI}},vj=sv,xI=/(-?[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,EI={},Sj=typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes("firefox"),Yy={},bj=class{constructor(t,e){O(this,"canvas",void 0),O(this,"ctx",void 0),O(this,"options",void 0),O(this,"imagesPending",0),O(this,"imagesLoaded",0),O(this,"imageIdsLoaded",[]),O(this,"frameIsRendering",!1),O(this,"pendingDrawCall",!1),O(this,"firstMeaningfulPaint",!1),O(this,"parallelTasks",8),O(this,"frameTasks",0),O(this,"loadingQueueOrdered",!0),O(this,"loadingQueue",[]),O(this,"currentTask",Promise.resolve()),O(this,"tasksRunning",0),O(this,"stats",void 0),O(this,"averageJobTime",64),O(this,"lastKnownScale",1),O(this,"visible",[]),O(this,"previousVisible",[]),O(this,"rendererPosition",void 0),O(this,"dpi",void 0),O(this,"drawCalls",[]),O(this,"lastPaintedObject",void 0),O(this,"hostCache",void 0),O(this,"invalidated",[]),O(this,"_worker",()=>{if(this.loadingQueue.length){let n=this.loadingQueue.pop();n&&(this.tasksRunning++,this.frameTasks++,this.currentTask=n.task().then(()=>{this.tasksRunning--}).catch(()=>{this.tasksRunning--}))}}),O(this,"_scheduled",0),O(this,"_doWork",()=>{this.loadingQueue.length===0&&this.tasksRunning===0&&this._scheduled&&(clearInterval(this._scheduled),this._scheduled=0);let n=this.parallelTasks||1;!this.firstMeaningfulPaint&&this.loadingQueue.length&&(n=this.loadingQueue.length);for(let i=0;i<=n;i++)this._worker()}),this.canvas=t,this.rendererPosition=t.getBoundingClientRect(),this.ctx=t.getContext("2d",{alpha:!0}),this.ctx.imageSmoothingEnabled=!0,this.options=e||{},this.canvas.style.transition="opacity .3s",this.dpi=e?.dpi||1,this.hostCache=e?.lruCache?new vj({maxSize:1024*512*512,dispose:(n,i,a)=>{this.invalidated.push(i),n.width=0,n.height=0},sizeCalculation:(n,i)=>n.width*n.height}):{store:{},get(n){return this.store[n]},set(n,i){this.store[n]=i}}}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(t){if(this.clearTransform(),this.lastPaintedObject=void 0,this.frameIsRendering=!1,this.imagesPending=Math.max(0,this.imagesPending-this.imagesLoaded),this.imagesLoaded=0,this.loadingQueueOrdered||(this.loadingQueue=this.loadingQueue.sort((e,n)=>e.network&&e.scale===n.scale?n.distance-e.distance:e.scale<n.scale?-1:1),this.loadingQueueOrdered=!0),this.previousVisible=this.visible,this.pendingDrawCall=!!this.drawCalls.length,this.pendingDrawCall)for(let e=0;e<this.drawCalls.length;e++){let n=this.drawCalls.shift();n&&n()}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(t,e,n){if(Number.isNaN(t)||Number.isNaN(e))return this.lastKnownScale;let i=this.getCanvasDims(),a=i.width/t,o=i.height/e,s=(a<o?o:a)*(n&&this.dpi||1);return Number.isNaN(s)||(this.lastKnownScale=s),this.lastKnownScale}beforeFrame(t,e,n,i){this.options.debug&&this.stats&&this.stats.begin(),this.frameIsRendering=!0,this.visible=[],this.options.beforeFrame&&this.options.beforeFrame(e);let a=this.getCanvasDims();if(this.ctx.globalAlpha=1,this.canvas.dataset.background==="transparent"?this.ctx.clearRect(0,0,a.width,a.height):(this.ctx.fillStyle=this.canvas.dataset.background??"rgb(0, 0, 0)",this.ctx.fillRect(0,0,a.width,a.height)),i.enableFilters&&(i.filters.brightness||i.filters.contrast||i.filters.grayscale||i.filters.invert||i.filters.sepia||i.filters.saturate||i.filters.hueRotate||i.filters.blur)){let o="";i.filters.brightness&&(o+=`brightness(${~~(100+i.filters.brightness*100)}%) `),i.filters.contrast&&(o+=`contrast(${~~(100+i.filters.contrast*100)}%) `),i.filters.grayscale&&(o+=`grayscale(${~~(i.filters.grayscale*100)}%) `),i.filters.invert&&(o+=`invert(${~~(i.filters.invert*100)}%) `),i.filters.sepia&&(o+=`sepia(${~~(i.filters.sepia*100)}%) `),i.filters.saturate&&(o+=`saturate(${~~(100+i.filters.saturate*100)}%) `),i.filters.hueRotate&&(o+=`hue-rotate(${i.filters.hueRotate}deg) `),i.filters.blur&&(o+=`blur(${i.filters.blur}px) `),this.ctx.filter!==o&&(this.ctx.filter=o)}else this.ctx.filter="none"}applyTransform(t,e,n,i,a){let o=t.__owner.value;if(o&&o.rotation){this.ctx.save();let s=e+i/2,u=n+a/2;this.ctx.translate(s,u),this.ctx.rotate(o.rotation*Math.PI/180),this.ctx.translate(-s,-u),this.lastPaintedObject=o}}clearTransform(){this.lastPaintedObject&&(this.lastPaintedObject.rotation&&this.ctx.restore(),this.lastPaintedObject=void 0)}paint(t,e,n,i,a,o){let s=this.ctx.globalAlpha;if(t instanceof Sl||t instanceof vh){if(t.display.rotation){this.ctx.save();let p=n+a/2,f=i+o/2;t.crop&&(p-=t.crop[e*5+1],f-=t.crop[e*5+2]),this.ctx.translate(p,f),this.ctx.rotate(t.display.rotation*Math.PI/180),this.ctx.translate(-p,-f)}if(this.visible.push(t),typeof t.style&&t.style.opacity!=="undefined"){if(!t.style.opacity)return;this.ctx.globalAlpha=t.style.opacity}try{let p=t.__host.canvas,f=this.getCanvasDims();if((p.indices.indexOf(e)===-1||this.invalidated.indexOf(p.canvases[e])!==-1)&&this.schedulePaintToCanvas(p,t,e,Wy({x:n+a/2,y:i+a/2},{x:f.width/2,y:f.height/2})),!this.firstMeaningfulPaint)return;let m=this.hostCache.get(p.canvases[e]);if(m)if(t.crop&&t.cropData){if(t.crop[e*5]){let g=[t.crop[e*5+1]/t.display.scale-t.display.points[e*5+1],t.crop[e*5+2]/t.display.scale-t.display.points[e*5+2],1+(t.crop[e*5+3]-t.crop[e*5+1])/t.display.scale,1+(t.crop[e*5+4]-t.crop[e*5+2])/t.display.scale];g[0]+=t.cropData.x/t.display.scale,g[1]+=t.cropData.y/t.display.scale;let v=t.x*this.lastKnownScale,S=t.y*this.lastKnownScale,E=[n+v,i+S,a,o];E[0]+=v,E[1]+=S,this.ctx.drawImage(m,g[0],g[1],g[2],g[3],E[0],E[1],E[2]+1,E[3]+1)}}else Sj?this.ctx.drawImage(m,0,0,t.display.points[e*5+3]-t.display.points[e*5+1],t.display.points[e*5+4]-t.display.points[e*5+2],n,i,a+1,o+1):this.ctx.drawImage(m,0,0,t.display.points[e*5+3]-t.display.points[e*5+1],t.display.points[e*5+4]-t.display.points[e*5+2],n,i,a+Number.MIN_VALUE+.5,o+Number.MIN_VALUE+.5)}catch{}t.display.rotation&&this.ctx.restore()}let u=t instanceof ph&&this.options.box,d=t instanceof LI&&this.options.polygon;if((u||d)&&!t.props.className&&!t.props.html&&!t.props.href){if(this.visible.push(t),t.props.style){let p=Object.assign({},t.props.style||{},t.hovering?t.props.hoverStyles:{},t.pressing?t.props.pressStyles:{}),f=t.props.relativeStyle?1:a/t.width;p.opacity!==void 0&&(this.ctx.globalAlpha=p.opacity);let m=0;p.borderWidth!==void 0&&(m=parseInt(p.borderWidth,10)*f);let g=0;p.outlineWidth!==void 0&&(g=parseInt(p.outlineWidth,10)*f);let v=0;if(p.outlineOffset!==void 0&&(v=parseInt(p.outlineOffset,10)*f),p.borderColor&&(this.ctx.strokeStyle=p.borderColor),p.boxShadow){let S=p.boxShadow.split(/,(?![^(]*\))/);for(let E of S){let T=EI[E]||xI.exec(E)||xI.exec(E);EI[E]=T,T&&(this.ctx.save(),this.ctx.shadowOffsetX=parseInt(T[1])*this.dpi*f,this.ctx.shadowOffsetY=parseInt(T[3])*this.dpi*f,this.ctx.shadowBlur=parseInt(T[5])*this.dpi*f,this.ctx.shadowColor=T[9],this.ctx.fillStyle="rgba(0,0,0,1)",this.ctx.fillRect(n+m,i+m,a,o),this.ctx.restore())}}if(this.ctx.fillStyle=p.backgroundColor||"transparent",this.ctx.lineWidth=m,d){let S=t.shape,E=S.points||[],T=E.length;this.ctx.beginPath();for(let A=0;A<T;A++)this.ctx.lineTo(n+E[A][0]*this.lastKnownScale,i+E[A][1]*this.lastKnownScale);S.open||this.ctx.closePath(),m&&this.ctx.stroke(),S.open||this.ctx.fill()}else m&&this.ctx.strokeRect(n+m/2,i+m/2,a+m,o+m),this.ctx.fillRect(n+m,i+m,a,o);g&&(p.outlineColor&&(this.ctx.strokeStyle=p.outlineColor),this.ctx.lineWidth=g,this.ctx.strokeRect(n-g/2-v,i-g/2-v,a+m*2+g+v*2,o+m*2+g+v*2))}this.ctx.globalAlpha=s}}loadImage(t,e,n,i=!1){if(Yy[t]&&Yy[t].naturalWidth>0){e(Yy[t]);return}try{let a=!1;i||setTimeout(()=>{a||this.loadImage(t,e,n,!0)},3e3);let o=document.createElement("img");o.decoding="auto",o.onload=function(){a=!0,e(o),Yy[t]=o,o.onload=null},this.options.crossOrigin&&(o.crossOrigin="anonymous"),o.src=t,o.complete&&o.onload({}),o.width}catch(a){console.log("image error",a),n(a)}}schedulePaintToCanvas(t,e,n,i){this.imagesPending++,t.indices.push(n);let a=`${e.id}--${e.display.scale}-${n}`,o=this.invalidated.indexOf(a);o!==-1&&this.invalidated.splice(o,1),t.canvases[n]=a,e.__host.canvas.loading=!0,this.loadingQueueOrdered=!1,this.loadingQueue.push({id:a,scale:e.display.scale,network:!0,distance:i,task:()=>new Promise(s=>{if(this.visible.indexOf(e)===-1){this.imagesPending--,t.indices.splice(t.indices.indexOf(n),1),s();return}let u=e.getImageUrl(n);this.loadImage(u,d=>{this.loadingQueue.push({id:a,scale:e.display.scale,distance:i,task:()=>new Promise(p=>{this.imageIdsLoaded.includes(a)||(this.imagesLoaded++,this.imageIdsLoaded.push(a)),t.loaded.push(n),t.loaded.length===t.indices.length&&(t.loading=!1);let f=e.display.points.slice(n*5,n*5+5),m=document.createElement("canvas"),g=m.getContext("2d");m.width=f[3]-f[1],m.height=f[4]-f[2],this.hostCache.set(t.canvases[n],m),this.drawCalls.push(()=>{g.drawImage(d,0,0,f[3]-f[1],f[4]-f[2]),p()})})}),s()},d=>{this.imagesPending--,t.indices.splice(t.indices.indexOf(n),1),s()})})})}afterPaintLayer(t,e){}prepareLayer(t,e){t.__owner.value&&(t.cropData&&this.lastKnownScale*(1/t.display.scale),this.applyTransform(t,e[1],e[2],e[3]-e[1],e[4]-e[2])),(!t.__host||!t.__host.canvas)&&(t instanceof Sl||t instanceof vh)&&this.createImageHost(t)}finishLayer(){this.lastPaintedObject&&this.clearTransform()}createImageHost(t){t.__host=t.__host?t.__host:{},t.__host.canvas={canvas:void 0,canvases:[],indices:[],loaded:[],loading:!1}}getPointsAt(t,e,n,i){return t.getPointsAt(e,n,i)}getViewportBounds(t,e,n){let i=t.getActiveZone();if(i){let a=e[3]-e[1]<i.points[3]-i.points[1],o=e[4]-e[2]<i.points[4]-i.points[2];return{x1:a?i.points[1]-n:i.points[1]+(i.points[3]-i.points[1])/2-(e[3]-e[1])/2,y1:o?i.points[2]-n:i.points[2]+(i.points[4]-i.points[2])/2-(e[4]-e[2])/2,x2:a?i.points[3]+n:i.points[1]+(i.points[3]-i.points[1])/2-(e[3]-e[1])/2,y2:o?i.points[4]+n:i.points[2]+(i.points[4]-i.points[2])/2-(e[4]-e[2])/2}}return null}pendingUpdate(){let t=!this.pendingDrawCall&&this.drawCalls.length===0&&this.imagesPending===0&&this.loadingQueue.length===0&&this.tasksRunning===0;return!t&&this.visible.length===0&&setTimeout(()=>{this.canvas.style.opacity="1",this.firstMeaningfulPaint=!0},500),!this.firstMeaningfulPaint&&t&&this.visible.length?(this.canvas.style.opacity="1",this.firstMeaningfulPaint=t,!0):this.options.debug?!0:!t}getRendererScreenPosition(){return this.rendererPosition}reset(){this.loadingQueue=[],this.drawCalls=[]}},UI=class{constructor(t){O(this,"renderers",[]),O(this,"length",void 0);for(let e of t)e&&this.renderers.push(e);this.length=this.renderers.length}afterFrame(t,e,n,i){for(let a=0;a<this.length;a++)this.renderers[a].afterFrame(t,e,n,i)}afterPaintLayer(t,e){for(let n=0;n<this.length;n++)this.renderers[n].afterPaintLayer(t,e)}beforeFrame(t,e,n,i){for(let a=0;a<this.length;a++)this.renderers[a].beforeFrame(t,e,n,i)}triggerResize(){for(let t=0;t<this.length;t++){let e=this.renderers[t];e.triggerResize&&e.triggerResize()}}getPointsAt(t,e,n,i){return this.renderers[0].getPointsAt(t,e,n,i)}getScale(t,e){return this.renderers[0].getScale(t,e)}getViewportBounds(t,e,n){return this.renderers[0].getViewportBounds(t,e,n)}getRendererScreenPosition(){return this.renderers[0].getRendererScreenPosition()}isReady(){for(let t=0;t<this.length;t++)if(!this.renderers[t].isReady())return!1;return!0}paint(t,e,n,i,a,o){for(let s=0;s<this.length;s++)this.renderers[s].paint(t,e,n,i,a,o)}pendingUpdate(){for(let t=0;t<this.length;t++)if(this.renderers[t].pendingUpdate())return!0;return!1}prepareLayer(t,e){for(let n=0;n<this.length;n++)this.renderers[n].prepareLayer(t,e)}finishLayer(t,e){for(let n=0;n<this.length;n++)this.renderers[n].finishLayer(t,e)}resize(t,e){for(let n=0;n<this.length;n++)this.renderers[n].resize(t,e)}reset(){for(let t=0;t<this.length;t++)this.renderers[t].reset()}},xj=class{constructor(t){O(this,"canvas",void 0),O(this,"context",void 0),O(this,"heightRatio",1),O(this,"widthRatio",1),O(this,"target",new Float32Array(5)),O(this,"initialWidth",void 0),O(this,"initialHeight",void 0),O(this,"bounds",void 0),O(this,"aggregate",void 0),O(this,"delta",0),O(this,"renderNextFrame",!0),this.canvas=t,this.initialWidth=t.width,this.initialHeight=t.height,this.context=t.getContext("2d"),this.context.globalAlpha=.5,this.aggregate=Lo(1)}isReady(){return!0}resize(){this.initialWidth=this.canvas.width,this.initialHeight=this.canvas.height,this.renderNextFrame=!0}afterFrame(t,e,n){if(this.renderNextFrame){this.context.clearRect(0,0,this.canvas.width,this.canvas.height);let i=this.initialWidth/t.width,a=this.initialHeight/t.height,o=this.widthRatio>this.heightRatio?i:a;if(this.target=n,this.bounds){let s=t.getPointsAt(this.bounds,this.aggregate,o);for(let[u,d]of s)if(u instanceof Sl&&u.__host.canvas){let p=d.length/5;for(let f=0;f<p;f++)u.__host.canvas.canvases[f]&&(d[f+1]*o,d[f+2]*o,(d[f+3]-d[f+1])*o,(d[f+4]-d[f+2])*o)}}t.getPoints().forEach((s,u,d)=>{if(u%5==0&&s){let p={x1:d[u+1]*o,y1:d[u+2]*o,x2:d[u+3]*o,y2:d[u+4]*o,width:(d[u+3]-d[u+1])*o,height:(d[u+4]-d[u+2])*o};this.context.strokeStyle="red",this.context.strokeRect(p.x1,p.y1,p.width,p.height)}}),n&&(this.context.strokeStyle="red",this.context.lineWidth=window.devicePixelRatio||1,this.context.strokeRect(n[1]*o,n[2]*o,(n[3]-n[1])*o,(n[4]-n[2])*o))}}getActiveZone(t){return null}getPointsAt(t,e,n,i){return t.getPointsAt(e,n,i)}getScale(t,e){return 1}beforeFrame(t,e){this.bounds=Zt.singleBox(t.width,t.height)}drawImage(){}afterPaintLayer(t,e){}paint(t,e,n,i,a,o){this.renderNextFrame=!0}prepareLayer(t){}pendingUpdate(){return!1}hasActiveZone(){return!1}getViewportBounds(t,e,n){return null}getRendererScreenPosition(){return this.canvas.getBoundingClientRect()}finishLayer(){}reset(){}};var Ej=Sh((t,e)=>{var n=!1,i,a,o,s,u,d,p,f,m,g,v,S,E,T,A;function x(){if(!n){n=!0;var C=navigator.userAgent,M=/(?:MSIE.(\d+\.\d+))|(?:(?:Firefox|GranParadiso|Iceweasel).(\d+\.\d+))|(?:Opera(?:.+Version.|.)(\d+\.\d+))|(?:AppleWebKit.(\d+(?:\.\d+)?))|(?:Trident\/\d+\.\d+.*rv:(\d+\.\d+))/.exec(C),z=/(Mac OS X)|(Windows)|(Linux)/.exec(C);if(S=/\b(iPhone|iP[ao]d)/.exec(C),E=/\b(iP[ao]d)/.exec(C),g=/Android/i.exec(C),T=/FBAN\/\w+;/i.exec(C),A=/Mobile/i.exec(C),v=!!/Win64/.exec(C),M){i=M[1]?parseFloat(M[1]):M[5]?parseFloat(M[5]):NaN,i&&document&&document.documentMode&&(i=document.documentMode);var N=/(?:Trident\/(\d+.\d+))/.exec(C);d=N?parseFloat(N[1])+4:i,a=M[2]?parseFloat(M[2]):NaN,o=M[3]?parseFloat(M[3]):NaN,s=M[4]?parseFloat(M[4]):NaN,s?(M=/(?:Chrome\/(\d+\.\d+))/.exec(C),u=M&&M[1]?parseFloat(M[1]):NaN):u=NaN}else i=a=o=u=s=NaN;if(z){if(z[1]){var D=/(?:Mac OS X (\d+(?:[._]\d+)?))/.exec(C);p=D?parseFloat(D[1].replace("_",".")):!0}else p=!1;f=!!z[2],m=!!z[3]}else p=f=m=!1}}var R={ie:function(){return x()||i},ieCompatibilityMode:function(){return x()||d>i},ie64:function(){return R.ie()&&v},firefox:function(){return x()||a},opera:function(){return x()||o},webkit:function(){return x()||s},safari:function(){return R.webkit()},chrome:function(){return x()||u},windows:function(){return x()||f},osx:function(){return x()||p},linux:function(){return x()||m},iphone:function(){return x()||S},mobile:function(){return x()||S||E||g||A},nativeApp:function(){return x()||T},android:function(){return x()||g},ipad:function(){return x()||E}};e.exports=R}),Aj=Sh((t,e)=>{var n=!!(typeof window<"u"&&window.document&&window.document.createElement);e.exports={canUseDOM:n,canUseWorkers:typeof Worker<"u",canUseEventListeners:n&&!!(window.addEventListener||window.attachEvent),canUseViewport:n&&!!window.screen,isInWorker:!n}}),Rj=Sh((t,e)=>{var n=Aj(),i;n.canUseDOM&&(i=document.implementation&&document.implementation.hasFeature&&document.implementation.hasFeature("","")!==!0);function a(o,s){if(!n.canUseDOM||s&&!("addEventListener"in document))return!1;var u="on"+o,d=u in document;if(!d){var p=document.createElement("div");p.setAttribute(u,"return;"),d=typeof p[u]=="function"}return!d&&i&&o==="wheel"&&(d=document.implementation.hasFeature("Events.wheel","3.0")),d}e.exports=a}),Tj=Sh((t,e)=>{var n=Ej(),i=Rj(),a=10,o=40,s=800;function u(d){var p=0,f=0,m=0,g=0;return"detail"in d&&(f=d.detail),"wheelDelta"in d&&(f=-d.wheelDelta/120),"wheelDeltaY"in d&&(f=-d.wheelDeltaY/120),"wheelDeltaX"in d&&(p=-d.wheelDeltaX/120),"axis"in d&&d.axis===d.HORIZONTAL_AXIS&&(p=f,f=0),m=p*a,g=f*a,"deltaY"in d&&(g=d.deltaY),"deltaX"in d&&(m=d.deltaX),(m||g)&&d.deltaMode&&(d.deltaMode==1?(m*=o,g*=o):(m*=s,g*=s)),m&&!p&&(p=m<1?-1:1),g&&!f&&(f=g<1?-1:1),{spinX:p,spinY:f,pixelX:m,pixelY:g}}u.getEventType=function(){return n.firefox()?"DOMMouseScroll":i("wheel")?"wheel":"mousewheel"},e.exports=u}),Cj=ij(Sh((t,e)=>{e.exports=Tj()})(),1),AI="scroll",wj={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:!0,ignoreSingleFingerTouch:!1,enablePanOnWait:!1,requireMetaKeyForWheelZoom:!1,panOnWaitDelay:40,onPanInSketchMode:()=>{},parentElement:null},VI=(t={})=>({start:function(e){let{zoomWheelConstant:n,enableWheel:i,enableClickToZoom:a,ignoreSingleFingerTouch:o,enablePanOnWait:s,panOnWaitDelay:u,parentElement:d,requireMetaKeyForWheelZoom:p}={...wj,...t},f={pointerStart:{x:0,y:0},isPressing:!1,mousemoveBuffer:Tt(5),multiTouch:{distance:0}};e.world.activatedEvents.push("onMouseUp","onMouseDown","onMouseMove","onTouchStart","onTouchEnd","onTouchMove","onContextMenu");function m(){E=0,A="",R(),R(void 0,"notice"),T=0}function g(){e.world.constraintBounds(),m()}function v(P){if(P.which>1){f.isPressing=!1;return}e.mode==="explore"&&(P.preventDefault(),f.pointerStart.x=P.atlas.x,f.pointerStart.y=P.atlas.y,e.transitionManager.stopTransition(),f.isPressing=!0)}function S(){m(),f.isPressing&&(e.mode==="explore"&&e.world.constraintBounds(),f.isPressing=!1)}let E=0,T=0,A="";function x(P){if(e.mode==="explore"){if(P.atlasTouches.length===1&&(T=performance.now(),o==0&&P.preventDefault(),f.pointerStart.x=P.atlasTouches[0].x,f.pointerStart.y=P.atlasTouches[0].y),P.atlasTouches.length===2){A="gesture",P.preventDefault();let U=P.atlasTouches[0].x,J=P.atlasTouches[1].x;f.pointerStart.x=(U+J)/2;let at=P.atlasTouches[0].y,X=P.atlasTouches[1].y;f.pointerStart.y=(at+X)/2,E=Wy({x:P.touches[0].clientX,y:P.touches[0].clientY},{x:P.touches[1].clientX,y:P.touches[1].clientY})}e.transitionManager.stopTransition(),f.isPressing=!0}}function R(P,U="intent"){d&&(d.dataset[U]=P)}function C(P){let U=null,J=null,at=0;if(f.isPressing&&P.touches.length===2&&(U=(P.touches[0].clientX+P.touches[1].clientX)/2,J=(P.touches[0].clientY+P.touches[1].clientY)/2,at=Wy({x:P.touches[0].clientX,y:P.touches[0].clientY},{x:P.touches[1].clientX,y:P.touches[1].clientY})),R(A),f.isPressing&&P.touches.length===1){if(s&&(performance.now()-T<u&&A==""&&(A=AI),A==""&&(A="pan")),R(A),A==""&&o==1||A==AI){R("require-two-finger","notice");return}let X=P.touches[0];U=X.clientX,J=X.clientY}if(U!==null&&J!==null){let X=e.getRendererScreenPosition();if(X){let{x:tt,y:ut}=e.viewerToWorld(U-X.x,J-X.y),xt=at&&E?at/E:1;e.transitionManager.customTransition(lt=>{lt.from=Tt(e.target),lt.to=ro(lt.from,oo(ei(f.pointerStart.x-tt,f.pointerStart.y-ut),Ku(1/xt,tt,ut)),f.mousemoveBuffer),lt.elapsed_time=0,lt.total_time=0,lt.timingFunction=ir.easeInOutExpo,lt.done=!1})}E=at}A=="pan"&&P.preventDefault()}function M(P){if(f.isPressing){let U=e.getRendererScreenPosition();if(U){let{x:J,y:at}=e.viewerToWorld(P.clientX-U.x,P.clientY-U.y);e.transitionManager.customTransition(X=>{X.from=Tt(e.target),X.to=ro(X.from,ei(f.pointerStart.x-J,f.pointerStart.y-at),f.mousemoveBuffer),X.elapsed_time=0,X.total_time=0,X.timingFunction=ir.easeInOutExpo,X.done=!1})}}}function z(P){e.mode==="explore"&&e.world.zoomIn(P.atlas)}function N(P){let U=1+(0,Cj.default)(P).spinY/n;e.world.zoomTo(U,P.atlas,!0)}function D(P){return p&&P.metaKey==0?(R("meta-required","notice"),P.stopPropagation(),!1):!0}e.world.addEventListener("mouseup",g),e.world.addEventListener("touchend",g),e.world.addEventListener("touchstart",x),e.world.addEventListener("mousedown",v),window.addEventListener("touchend",S),window.addEventListener("mouseup",S),window.addEventListener("mousemove",M),d&&d.addEventListener("touchmove",C),a&&(e.world.activatedEvents.push("onClick"),e.world.addEventListener("click",z)),i&&(e.world.activatedEvents.push("onWheel"),p&&d?.addEventListener("wheel",D,{passive:!0,capture:!0}),e.world.addEventListener("wheel",N));let q=e.world.addLayoutSubscriber((P,U)=>{if(P==="zone-changed"&&e.transitionManager.constrainBounds({transition:{duration:0}}),P==="zoom-to"&&U&&e.transitionManager.zoomTo(U.factor,{origin:U.point,stream:U.stream}),P==="go-home"){let J=U.immediate?{duration:0}:void 0,at=U?.paddingPx===void 0?e.homePaddingPx:U.paddingPx,X=e.getHomeTargetStrand({paddingPx:at});e.transitionManager.applyTransition(X,J,{duration:1e3,easing:ir.easeOutExpo,constrain:!0},{stream:!1}),e.updateNextFrame()}if(P==="goto-region"&&U){let J=U.immediate?{duration:0}:{};if(U.paddingPx!==void 0){let at=e.getScaleFactor(!1);if(typeof U.paddingPx=="number"){let X=U.paddingPx/at,tt={x:U.x,y:U.y,width:U.width,height:U.height,padding:X};e.transitionManager.goToRegion(tt,{transition:J})}else{let X=U.paddingPx.left?U.paddingPx.left/at:0,tt=U.paddingPx.right?U.paddingPx.right/at:0,ut=U.paddingPx.top?U.paddingPx.top/at:0,xt=U.paddingPx.bottom?U.paddingPx.bottom/at:0,lt={x:U.x-X,y:U.y-ut,width:U.width+X+tt,height:U.height+ut+xt};e.transitionManager.goToRegion(lt,{transition:J})}}else e.transitionManager.goToRegion(U,{transition:J})}P==="constrain-bounds"&&e.transitionManager.constrainBounds({transition:U?.immediate?{duration:0}:void 0})});return()=>{e.world.removeEventListener("mouseup",g),e.world.removeEventListener("touchend",g),e.world.removeEventListener("touchstart",x),e.world.removeEventListener("mousedown",v),window.removeEventListener("touchend",S),window.removeEventListener("mouseup",S),e.world.removeEventListener("mousemove",M),d&&(d.removeEventListener("touchmove",M),d.removeEventListener("wheel",D,{passive:!0,capture:!0})),a&&e.world.removeEventListener("click",z),i&&e.world.removeEventListener("wheel",N),q()}},updatePosition(){}}),Gc=st.default.createContext("explore");Gc.displayName="Mode";var Mj=()=>(0,st.useContext)(Gc);var uv=st.default.createContext(null);uv.displayName="Atlas";var cv=st.default.createContext(null);cv.displayName="Bounds";var tv;if(typeof performance=="object"&&typeof performance.now=="function"){let t=performance;tv=()=>t.now()}else{let t=Date,e=t.now();tv=()=>t.now()-e}var RI=typeof vA.default=="function"?vA.default:null;function TI(t,e){t&&t.appendChild&&e&&t.appendChild(e)}function jI(t,e){t&&t.removeChild&&e&&t.removeChild(e)}function Oj(t,e){return jI(t.world,e)}function _j(t,e,n){return qI(t.world,e,n)}function qI(t,e,n){t&&t instanceof rv&&(t=t.world),t&&t.insertBefore&&t.insertBefore(e,n)}function FI(t,e,n){if(n&&(t.applyProps&&t.applyProps(n),t instanceof mo))for(let i of iv){let a=i.slice(2).toLowerCase();n[i]!==e[i]&&(e[i]&&t.removeEventListener(a,e[i]),t.addEventListener(a,n[i]))}}function GI(t,e){let n=Object.keys(e),i=!1;for(let a of n)if(iv.indexOf(a)!==-1){let o=Fc[a];if(o){if(t.activatedEvents.indexOf(o)!==-1)continue;i=!0,t.activatedEvents.push(o)}}i&&t.triggerEventActivation()}var ev=new Map,CI={};function zj(t,{args:e=[],...n},i,a,o){if(!(i instanceof rv)&&o){let d=p=>p.return?d(p.return):p.stateNode&&p.stateNode.containerInfo;i=d(o)}let s,u=i.world;switch(t){case"world":s=ov.withProps({width:n.width,height:n.height,viewingDirection:"left-to-right"}),s.activatedEvents=u.activatedEvents,s.eventHandlers=u.eventHandlers,s.subscriptions=u.subscriptions,s.triggerEventActivation(),u=s;break;case"box":s=new ph;break;case"shape":s=new LI;break;case"worldObject":case"world-object":s=new RA;break;case"worldImage":case"world-image":s=new Sl;break;case"texture":s=new bA;break;case"compositeImage":case"composite-image":s=new cj({id:n.id,width:n.width,height:n.height,images:[],renderOptions:n.renderOptions});break;case"tiledImage":case"tiled-image":s=vh.fromTile(n.uri,n.display,n.tile,n.scaleFactor,void 0,n.format,n.useFloorCalc,n.version3);break;case"paragraph":s=new Xy,s.text=n.children;break;default:return}return GI(u,n),FI(s,{},n),s}function Nj(t,e){if(e instanceof ov)t.world=e;else if(e instanceof RA)t.world.appendChild(e);else if(e)throw Error("Invalid root")}var Qy=0,vl=RI?RI({unstable_now:tv,now:tv,createInstance:zj,removeChild:jI,appendChild:TI,appendInitialChild:TI,insertBefore:qI,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:Nj,removeChildFromContainer:Oj,createTextInstance(){},insertInContainerBefore:_j,prepareUpdate(t,e,n,i,a){return GI(a.world,i),i},commitUpdate(t,e,n,i,a){let o=i,s=n;typeof o=="string"&&(o=n),t.applyProps&&o&&FI(t,s,o)},finalizeInitialChildren(t){return t?.__handlers},getChildHostContext(){return CI},getRootHostContext(){return CI},prepareForCommit(t){return t.isCommitting=!0,null},preparePortalMount(){},hideInstance(t){t&&t.points&&(t.points[0]=0)},unhideInstance(t,e){t&&t.points&&(t.points[0]=1)},getPublicInstance(t){return t},hideTextInstance(){throw Error("Text is not allowed in the react-three-fibre tree. You may have extraneous whitespace between components.")},resetAfterCommit(t){t.isCommitting=!1,t.pendingUpdate=!0,t.world&&t.world.needsRecalculate&&(t.world.recalculateWorldSize(),t.world.triggerRepaint())},shouldSetTextContent(){return!1},clearContainer(){return!1},supportsHydration:!1,supportsPersistence:!1,detachDeletedInstance(t){},afterActiveInstanceBlur(){},beforeActiveInstanceBlur(){},getCurrentEventPriority(){return 32},getInstanceFromNode(t){throw Error("Not implemented")},getInstanceFromScope(t){throw Error("Not implemented")},prepareScopeUpdate(t,e){throw Error("Not implemented")},logRecoverableError(){},requestPostPaintCallback(){},rendererPackageName:"@atlas-viewer/atlas",rendererVersion:st.version,shouldAttemptEagerTransition:()=>!1,trackSchedulerEvent:()=>{},resolveEventType:()=>null,resolveEventTimeStamp:()=>-1.1,maySuspendCommit:()=>!1,preloadInstance:()=>!0,startSuspendingCommit(){},suspendInstance(){},waitForCommitToBeReady:()=>null,NotPendingTransition:null,setCurrentUpdatePriority(t){Qy=t},getCurrentUpdatePriority(){return Qy},resolveUpdatePriority(){if(Qy!==0)return Qy;switch(typeof window<"u"&&window.event?.type){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return 2;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return 8;default:return 32}},resetFormInstance(){}}):null;vl&&vl.injectIntoDevTools();function wA(t,e){let n=ev.get(t);if(n){if(!vl)return;vl.updateContainer(null,n,null,()=>{ev.delete(t),e&&e(t)})}}var wI={render(t,e){let n=ev.get(e);if(vl)if(n)vl.updateContainer(t,n,null);else{let i=vl.createContainer(e,0,null,!1,null,"",()=>{},null);vl.updateContainer(t,i,null),ev.set(e,i)}},unmountComponentAtNode(t,e){wA(t,e)}},gh=typeof window<"u"&&(window.document?.createElement||window.navigator?.product==="ReactNative")?nv.useLayoutEffect:nv.useEffect,Ij=st.default.memo(({children:t,setIsReady:e,onCreated:n,bounds:i,preset:a,mode:o="explore"})=>{let s=(0,st.useCallback)(function(u){let d=(0,st.useRef)(!1),p=()=>{e(!0)};return(0,st.useEffect)(()=>{if(a&&!d.current){a.runtime.goHome();let f=n&&n(a);f&&f.then?f.then(p):p();return}return()=>{}},[]),(0,st.useEffect)(()=>{d.current=!0},[]),u.children},[a]);return gh(()=>{if(a){let u=a.runtime;o!==u.mode&&(u.mode=o),wI.render((0,Ce.jsx)(st.default.StrictMode,{children:(0,Ce.jsx)(s,{children:(0,Ce.jsx)(cv.Provider,{value:i,children:(0,Ce.jsx)(Gc.Provider,{value:o,children:(0,Ce.jsx)(uv.Provider,{value:a,children:t})})})})}),u)}},[a,o,t]),gh(()=>{if(a){let u=a.runtime;return()=>{wI.unmountComponentAtNode(u)}}return()=>{}},[a]),null}),Dj=class{constructor(t,e){O(this,"canvas",void 0),O(this,"gl",void 0),O(this,"program",void 0),O(this,"fragmentShader",void 0),O(this,"vertexShader",void 0),O(this,"rectBuffer",void 0),O(this,"fragmentShaderSource",`
|
|
24
|
+
`);let T=E.state[u];if(T==null)return;JSON.stringify(a.getState())!==JSON.stringify(T)&&g(T);return}a.dispatchFromDevtools&&typeof a.dispatch=="function"&&a.dispatch(E)});case"DISPATCH":switch(w.payload.type){case"RESET":return g(b),u===void 0?d?.init(a.getState()):d?.init(vg(f.name));case"COMMIT":if(u===void 0){d?.init(a.getState());return}return d?.init(vg(f.name));case"ROLLBACK":return z1(w.state,E=>{if(u===void 0){g(E),d?.init(a.getState());return}g(E[u]),d?.init(vg(f.name))});case"JUMP_TO_STATE":case"JUMP_TO_ACTION":return z1(w.state,E=>{if(u===void 0){g(E);return}JSON.stringify(a.getState())!==JSON.stringify(E[u])&&g(E[u])});case"IMPORT_STATE":{let{nextLiftedState:E}=w.payload,T=E.computedStates.slice(-1)[0]?.state;if(!T)return;g(u===void 0?T:T[u]),d?.send(null,E);return}case"PAUSE_RECORDING":return y=!y}return}}),b},z1=(t,e)=>{let n;try{n=JSON.parse(t)}catch(i){console.error("[zustand devtools middleware] Could not parse the received json",i)}n!==void 0&&e(n)},KH=t=>(e,n,i)=>{let a=i.subscribe;return i.subscribe=(r,l,u)=>{let f=r;if(l){let h=u?.equalityFn||Object.is,d=r(i.getState());f=m=>{let y=r(m);if(!h(d,y)){let g=d;l(d=y,g)}},u?.fireImmediately&&l(d,d)}return a(f)},t(e,n,i)},ZH=(t={},e)=>{switch(e.type){case cg:return{...t,[e.payload.id]:e.payload.type};case dg:return{...t,...e.payload.mapping};default:return t}};function _f(t,e,n,i){return!(!t[n]||!t[n][e]||!t[n][e][i]||!Array.isArray(t[n][e][i]))}function WH(t,e){let n={},i=[];for(let[a,r]of Object.entries(t||{})){i.push(a);let l=(e||{})[a];if(!l||l.length===0){n[a]=r;continue}n[a]=l}for(let[a,r]of Object.entries(e||{}))i.indexOf(a)===-1&&(n[a]=r);return n}function Dt(t){return t.payload||{}}function JH(t,e,n){if(!t[e]||!Array.isArray(t[e]))return null;let i=n.index===void 0?t[e].findIndex(a=>a?fc(a)?.id===n.id:!1):n.index;return i===-1?null:{entity:t[e][i],index:i}}function DM(t,e){if(!(!e?.id||!e?.type))return t[e.type]?.[e.id]}function bg(t,e){return t===void 0?e:t}var PM=(t=_1(),e)=>{let n=(i,a)=>({...t,[Dt(e).type]:{...t[Dt(e).type],[Dt(e).id]:{...i,...a}}});switch(e.type){case tg:{if(!t[Dt(e).type]||!t[Dt(e).type][Dt(e).id])return t;let i=t[Dt(e).type][Dt(e).id];return typeof i=="string"?t:n(i,{[Dt(e).key]:Dt(e).value})}case eg:{if(!_f(t,Dt(e).id,Dt(e).type,Dt(e).key))return t;let i=t[Dt(e).type][Dt(e).id];if(typeof i=="string")return t;let a=Array.from(i[Dt(e).key]),[r]=a.splice(Dt(e).startIndex,1);return a.splice(Dt(e).endIndex,0,r),n(i,{[Dt(e).key]:a})}case Ef:{let i=Dt(e).subjects,a=Dt(e).from,r=Dt(e).to||a,l=DM(t,a),u=r?.key||a.key;if(!_f(t,a.id,a.type,a.key)||!_f(t,r.id,r.type,r.key))return t;let f=[],h=[];if(i.type==="slice"){let E=i.startIndex,T=i.length;f=Array.from(l[a.key]),h=f.splice(E,T)}else{let E=Array.from(l[a.key]);for(let T of i.items){let S=JH(l,a.key,T);S&&(h.push(S.entity),E[S.index]=null),f=E.filter(R=>R!==null)}}let d={...l,[a.key]:f},m={...t,[a.type]:{...t[a.type],[a.id]:d}},y=DM(m,r);if(!y)return t;let g=r?.index===void 0?y[u].length:r.index,b=Array.from(y[r.key]);b.splice(g,0,...h);let w={...y,[u]:b};return{...m,[r.type]:{...m[r.type],[r.id]:w}}}case ng:return PM(t,{type:Ef,payload:{subjects:{type:"list",items:[Dt(e).subject]},from:Dt(e).from,to:Dt(e).to}});case ag:{let{id:i,index:a,key:r,newIdentifier:l,reference:u,type:f}=Dt(e),h=t[f][i],d=fc(u);if(!h||!h[r]||!d||a<0)return t;let m=h[r],y=m[a],g=t[d.type]?.[d.id];if(!g||!y)return t;let b=xM(y,l),w=Array.from(m);w.splice(bg(a,w.length+1),1,b);let E=n(h,{[r]:w}),T={...g,id:l};T["iiif-parser:hasPart"]&&(T["iiif-parser:hasPart"]=T["iiif-parser:hasPart"].filter(R=>R["iiif-parser:partOf"]===i).map(R=>({...R,id:l})));let S={...E[d.type],[l]:T};return E[d.type]=S,E}case $m:{let i=Object.keys(Dt(e).entities),a={...t};for(let r of i){let l=Dt(e).entities[r],u={...t[r]||{}},f=!1,h=Object.keys(l||{})||[];if(l&&h){for(let d of h)f=!0,u[d]=t[r][d]?WH(t[r][d],l[d]):l[d];f&&(a[r]=u)}}return a}case ig:{if(!_f(t,Dt(e).id,Dt(e).type,Dt(e).key))return t;let i=t[Dt(e).type][Dt(e).id],a=Array.from(i[Dt(e).key]);return a.splice(bg(Dt(e).index,a.length+1),0,Dt(e).reference),n(i,{[Dt(e).key]:a})}case Af:case rg:{if(!_f(t,Dt(e).id,Dt(e).type,Dt(e).key))return t;let i=t[Dt(e).type][Dt(e).id],a=Array.from(i[Dt(e).key]),r=bg(Dt(e).index,a.findIndex(l=>l&&l.id===Dt(e).reference.id));return r===-1||a[r]?.id!==Dt(e).reference.id?t:(e.type===Af?a.splice(r,1,Dt(e).reference):a.splice(r,1),n(i,{[Dt(e).key]:a}))}case og:{let i=t[Dt(e).type][Dt(e).id];if(!i)return t;let a=Array.from(i.metadata||[]),r=Dt(e);return a.splice(bg(e.payload.beforeIndex,a.length+1),0,{label:r.label,value:r.label}),n(i,{metadata:a})}case lg:{let i=t[Dt(e).type][Dt(e).id];if(typeof i=="string"||!i)return t;let a=Array.from(i.metadata||[]),[r]=a.splice(Dt(e).startIndex,1);return a.splice(Dt(e).endIndex,0,r),n(i,{metadata:a})}case Cf:case sg:{let i=t[Dt(e).type][Dt(e).id],a=Array.from(i.metadata||[]),r=Dt(e).atIndex;return r===void 0||r===-1||!a[r]?t:(e.type===Cf?a.splice(r,1,{label:Dt(e).label,value:Dt(e).value}):a.splice(r,1),n(i,{metadata:a}))}default:return t}},$H=(t={},e)=>{switch(e.type){case fg:case gg:return{...t,[e.payload.id]:{requestUri:e.payload.id,loadingState:Mf,uriMismatch:!1,resourceUri:e.payload.id}};case pg:return{...t,[e.payload.requestId]:{...t[e.payload.requestId]||{},uriMismatch:!0,resourceUri:e.payload.actualId},[e.payload.actualId]:{requestUri:e.payload.requestId,loadingState:t[e.payload.requestId].loadingState,uriMismatch:!0,resourceUri:e.payload.actualId}};case hg:return{...t,[e.payload.id]:{...t[e.payload.id]||{},loadingState:pc,error:e.payload.message}};case mg:return{...t,[e.payload.id]:{...t[e.payload.id]||{},loadingState:mc,error:void 0}}}return t},tF=(t={},e)=>{let{id:n,updateValue:i,value:a,meta:r,key:l}=e&&e.payload||{};switch(e.type){case T1:return{...t,[n]:{...t[n]||{},[r]:{...t[n]&&t[n][r]||{},[l]:a}}};case R1:return{...t,[n]:{...t[n]||{},[r]:{...t[n]&&t[n][r]||{},[l]:t[n]&&t[n][r]?i(t[n][r][l]):i(void 0)}}};case E1:return t[n]&&t[n][r]&&t[n][r][l]?{...t,[n]:{...t[n]||{},[r]:{...t[n]&&t[n][r]||{},[l]:void 0}}}:t;default:return t}};function BM(t={}){let e=Object.keys(t);return function(n={},i){let a=!1,r={};for(let l=0;l<e.length;l++){let u=e[l];r[u]=t[u](n[u],i),a=a||r[u]!==n[u]}return a?r:n}}function eF(t){return(e,n)=>n&&n.type===gc?n.payload.actions.reduce(t,e):n&&n.type===yg?{...e,iiif:{...e.iiif,...n.payload.state}}:t(e,n)}var nF=BM({mapping:ZH,entities:PM,requests:$H,meta:tF});function iF(){return{iiif:{entities:_1(),meta:{},mapping:{},requests:{}}}}function HM(t={}){let{enableDevtools:e=!1,iiifStoreName:n="iiif",defaultState:i=iF(),customReducers:a={}}=t,r=eF(BM({[n]:nF,...a}));return km(KH((typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__?QH:(l,u)=>l)(YH(r,i),{enabled:e})))}function Di(t,e,n,i=!0){e[bc]=e[bc]||[],e[bc].push(t);let a=new Map;Object.defineProperty(e,t,{enumerable:i,get(){if(e[Dl][t]===void 0)return;let r=e[Dl][t];if(!r)return r;let l=n.get(e[Dl][t],{parent:this.id?{id:this.id,type:this.type}:void 0});return a.has(l)||(a.clear(),a.set(l,Pl(l,n))),a.get(l)},set(r){e[Dl][t]!==r&&(this[Ll]?n.modifyEntityField({id:this.id,type:this.type},t,UM(r)):this[Dl][t]=r)}})}var Dl=Symbol.for("_refs_"),Ll=Symbol.for("_reactive_"),bc=Symbol.for("_defined_"),FM=Symbol.for("_parent_");function aF(t,e=!1,n){let i={id:"",type:"unknown",[bc]:[],[Dl]:{},[FM]:n||null,[Ll]:null,is(a){return typeof a=="string"?this.id===a:a.id?a.id===this.id:!1},reactive(){if(!this[Ll])return this[Ll]=this.subscribe(()=>this.refresh(),!0),()=>{this.unreactive()}},refresh(){if(this.id){let a=this.unwrap();for(let r of Object.keys(a||{}))this[bc].includes(r)?this[Dl][r]=a[r]:this[r]=a[r]}},unreactive(){this[Ll]&&(this[Ll](),this[Ll]=null)},unwrap(){if(!this.id)throw Error("Invalid object");let a=this[FM];return t.get(this.id,{parent:a?{id:a,type:"unknown"}:void 0})},toPresentation3(){return t.toPresentation3(this.unwrap())},toPresentation2(){return t.toPresentation2(this.unwrap())},valueOf(){return this.unwrap()},toJSON(){let a=this;return{...a,items:a.items,annotations:a.annotations,structures:a.structures,seeAlso:a.seeAlso,service:a.service,services:a.services,rendering:a.rendering,partOf:a.partOf,start:a.start,supplementary:a.supplementary,homepage:a.homepage,thumbnail:a.thumbnail,placeholderCanvas:a.placeholderCanvas,accompanyingCanvas:a.accompanyingCanvas,provider:a.provider}},subscribe(a,r=!0){return t.subscribe(()=>this.id?t.get(this.id):null,a,r)}};return Di("items",i,t),Di("annotations",i,t),Di("structures",i,t),Di("seeAlso",i,t),Di("rendering",i,t),Di("partOf",i,t),Di("start",i,t,!1),Di("supplementary",i,t),Di("homepage",i,t),Di("thumbnail",i,t),Di("placeholderCanvas",i,t,!1),Di("accompanyingCanvas",i,t,!1),Di("provider",i,t),Di("body",i,t),Di("logo",i,t),i}function rF(t){return!!t[bc]}function UM(t){return Array.isArray(t)?t.map(e=>UM(e)):!t||!t.type?t:{id:t.id,type:t.type}}function Pl(t,e,n=!1,i){if(Array.isArray(t))return t.map(u=>Pl(u,e,n));if(!t||!t.type||!t.id)return t;let a=aF(e,n),r=Object.create(a),l=Object.assign(r,t);return n&&l.reactive(),l}function qM(t){switch(t){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 t}var Sc=class{constructor(t,e){kn(this,"options",void 0),kn(this,"store",void 0),kn(this,"emitter",void 0),kn(this,"isBatching",!1),kn(this,"batchQueue",[]),kn(this,"remoteFetcher",void 0),kn(this,"staticFetcher",void 0),kn(this,"defaultFetcher",n=>fetch(n).then(i=>{if(i.status===200)return i.json();{let a=Error(`${i.status} ${i.statusText}`);throw a.name="HTTPError",a}})),this.options=Object.assign({reducers:{},customFetcher:this.defaultFetcher,enableDevtools:!0},t||{}),this.store=e||HM({customReducers:this.options.reducers,defaultState:this.options.defaultState,enableDevtools:this.options.enableDevtools}),this.emitter=Gm(),this.remoteFetcher=O1(this,this.options.customFetcher),this.staticFetcher=O1(this,(n,i)=>i)}batch(t){this.isBatching=!0;try{t(this),this.isBatching=!1,this.dispatch(yc({actions:this.batchQueue}))}catch(e){throw this.batchQueue=[],this.isBatching=!1,e}this.batchQueue=[]}async asyncBatch(t){this.isBatching=!0;try{await t(this),this.isBatching=!1,this.dispatch(yc({actions:this.batchQueue}))}catch(e){throw this.batchQueue=[],this.isBatching=!1,e}this.batchQueue=[]}modifyEntityField(t,e,n){this.dispatch(Nl.modifyEntityField({id:t.id,type:t.type,key:e,value:n}))}dispatch(t){if(this.isBatching)this.batchQueue.push(t);else{if(t.type===gc){for(let i of t.payload.actions)this.emitter.emit(i.type,{action:i,state:this.store.getState()});this.store.dispatch(t);let n=this.getState();for(let i of t.payload.actions)this.emitter.emit(`after:${i.type}`,{action:i,state:n});return}this.emitter.emit(t.type,{action:t,state:this.store.getState()}),this.store.dispatch(t);let e=this.store.getState();this.emitter.emit(`after:${t.type}`,{action:t,state:e});return}}on(t,e){return this.emitter.on(t,e),()=>{this.emitter.off(t,e)}}serialize(t,e){return m1(this.getState().iiif,t,e)}toPresentation2(t){return this.serialize(t,g1)}toPresentation3(t){return this.serialize(t,y1)}hydrate(t,e,n={}){return this.get(t,e,{...n,skipSelfReturn:!1})}get(t,e,n={}){typeof e!="string"&&(n=e||{},e=void 0);let{skipSelfReturn:i=!0}=n||{},a=n.parent?typeof n.parent=="string"?n.parent:n.parent.id:void 0;if(Array.isArray(t))return t.map(d=>this.get(d,n));let r=this.getState();if(ma(t)&&!n.preserveSpecificResources&&(t=t.source),typeof t=="string"){let d=qM(e||r.iiif.mapping[t]);if(!d)return i?null:{id:t,type:"unknown"};t={id:t,type:d}}if(t&&t.partOf&&!a&&!n.skipPartOfCheck){let d=Array.isArray(t.partOf)?t.partOf[0]:t.partOf;d&&(typeof d=="string"&&(a=d),typeof d.id=="string"&&(a=d.id))}let l=qM(e||t?.type),u=t?.id,f=r.iiif.entities[l];if(!f){let d=r.iiif.requests[u];return d&&d.resourceUri!==u?this.get(d.resourceUri,n):i?null:t}let h=f[t.id];return h&&h[mn]?hc(h,h[mn].find(d=>a?d[ga]===a:d[ga]===h.id)):f[t.id]||(i?null:t)}select(t){return t(this.getState())}getStore(){return this.store}getState(){return this.store.getState()}deep(t,e){if(t===void 0)return this.get(e,{skipSelfReturn:!1});if(typeof t=="function")try{let i=t(this.get(e,{skipSelfReturn:!1})),a=r=>this.deep(r,i);return a.size=Array.isArray(i)?i.length:1,a}catch{let i=a=>this.deep(a,void 0);return i.size=0,i}let n=i=>this.deep(i,t);return n.size=Array.isArray(t)?t.length:1,n}loadManifest(t,e,n){let i=typeof t=="string"?t:t.id;return this.load(i,e,n)}loadCollection(t,e,n){let i=typeof t=="string"?t:t.id;return this.load(i,e,n)}load(t,e,n){let i=typeof t=="string"?t:t.id;return e?Promise.resolve(this.staticFetcher(i,e,n)):Promise.resolve(this.remoteFetcher(i,{},n))}loadSync(t,e,n){let i=typeof t=="string"?t:t.id;return this.staticFetcher(i,e,n)}loadManifestSync(t,e,n){let i=typeof t=="string"?t:t.id;return this.loadSync(i,e,n)}loadCollectionSync(t,e,n){let i=typeof t=="string"?t:t.id;return this.loadSync(i,e,n)}areInputsEqual(t,e){return M1(t,e)}subscribe(t,e,n){return n===void 0&&(e===void 0||e===!1||e===!0)&&(n=e,e=t,t=i=>i),this.store.subscribe(t,i=>e(i,this),{equalityFn:M1,fireImmediately:!n})}async ensureLoaded(t){let e=typeof t=="string"?t:t.id;this.requestStatus(e)||await this.load(e)}requestStatus(t){return this.select(e=>e.iiif.requests[t])}getPaginationState(t){let e=typeof t=="string"?t:t.id;if(!e)return null;let n=this.getResourceMeta(e,"@vault/pagination");if(n?.state)return n.state;let i=this.get(t);if(i.first){let a={currentPage:null,currentPageIndex:null,isFetching:!1,isFullyLoaded:!1,next:i.first,page:1,pages:[],previous:null,totalItems:i.total,currentLength:0};return this.setMetaValue([e,"@vault/pagination","state"],a),a}return null}async loadNextPage(t,e){let n=typeof t=="string"?t:t.id;if(!n)return[null,null];let i=this.getPaginationState(t);if(!i||i.isFullyLoaded||!i.next)return[null,null];if(i.isFetching)return[i,null];let a=typeof i.next=="string"?i.next:i.next.id,r=i.currentPage,l={...i,isFetching:!0};this.setMetaValue([n,"@vault/pagination","state"],l);let u;try{u=await this.loadCollection(a,e,y=>{let{id:g,"@id":b,...w}=y||{};return b?{"@id":a,...w}:{id:a,...w}})}catch(y){let g={...i,isFetching:!1,error:y};return this.setMetaValue([n,"@vault/pagination","state"],g),[g,null]}if(!u){let y={...i,isFetching:!1,error:Error("Collection not found")};return this.setMetaValue([n,"@vault/pagination","state"],y),[y,null]}let f=this.get(n),h=[...f.items||[],...u.items||[]].map(y=>({id:y.id,type:y.type}));this.modifyEntityField({id:n,type:"Collection"},"items",h);let d=this.getPaginationState(t);if(!d)throw Error("Pagination state not found");let m={...d,isFetching:!1,error:null,currentPage:u.id,next:u.next?.id||null,currentPageIndex:d.pages.length,currentLength:h.length,pages:[...d.pages,{id:u.id,type:"Collection",startIndex:f.items.length,pageLength:u.items.length,order:typeof d.currentPageIndex=="number"?d.currentPageIndex+1:0}],isFullyLoaded:!u.next,previous:r,page:d.pages.length+1};return this.setMetaValue([n,"@vault/pagination","state"],m),[m,u]}getResourceMeta(t,e){let n=this.getState().iiif.meta[t];if(n)return e?n[e]:n}getObject(t,e,n={}){let{reactive:i,...a}=n;return Pl(this.get(t,e,a),this,i)}async loadObject(t,e){return Pl(await this.load(t,e),this)}async loadManifestObject(t,e){return Pl(await this.loadManifest(t,e),this)}async loadCollectionObject(t,e){return Pl(await this.loadCollection(t,e),this)}wrapObject(t){return Pl(this.get(t,{skipSelfReturn:!1}),this)}isWrapped(t){return rF(t)}setMetaValue([t,e,n],i){this.dispatch(typeof i=="function"?A1.setMetaValueDynamic({id:t,meta:e,key:n,updateValue:i}):A1.setMetaValue({id:t,meta:e,key:n,value:i}))}};function VM(){return typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}function zf(t){let e=VM();try{let i=e.IIIF_VAULT;if(i)return i}catch{}let n=new Sc(t);try{e.IIIF_VAULT=n}catch{}return n}var N1=N(tt(),1),hs=Sg.default.createContext({vault:null,setVaultInstance:t=>{}});function co({vault:t,vaultOptions:e,useGlobal:n,resources:i,children:a}){let[r,l]=(0,Sg.useState)(()=>t||(n?zf(e):e?new Sc(e):new Sc));return(0,N1.jsx)(hs.Provider,{value:{vault:r,setVaultInstance:l},children:(0,N1.jsx)(Li,{value:i||{},children:a})})}var kM=N(ct(),1),GM=N(ct(),1);var jM=N(ct(),1),ce=()=>{let{vault:t}=(0,jM.useContext)(hs);if(t===null)throw new Error("Vault not found. Ensure you have your provider set up correctly.");return t};var xg=N(ct(),1);function _e(t,e=[]){let n=ce(),[i,a]=(0,xg.useState)(()=>t(n.getState(),n));return(0,xg.useEffect)(()=>n.subscribe(r=>t(r,n),r=>{a(r)},!1),e),i}var Bl=GM.default.createContext([]);function Hl(){let t=(0,kM.useContext)(Bl);return _e(e=>t.map(n=>e.iiif.entities.Canvas[n]).filter(Boolean),[t])}var YM=N(ct(),1);function fo(t){let e=(0,YM.useContext)(hs);return t||(e&&e.vault?e.vault:zf())}var XM=N(ct(),1);function Tn(t={},e=[]){let{id:n,selector:i}=t,a=wi(),r=ce(),l=n||a.manifest,u=_e(f=>l?f.iiif.entities.Manifest[l]:void 0,[l]);return(0,XM.useMemo)(()=>{if(u)return i?i(u):u},[u,i,...e])}var SO=N(ct(),1),Og=N(ct(),1);var ps=N(ct(),1);function If(t,{noCache:e=!1}={}){let n=typeof t=="string"?t:t.id,i=fo(),[a,r]=(0,ps.useState)(n),[l,u]=(0,ps.useState)(void 0),f=(0,ps.useMemo)(()=>i.get(n,{skipSelfReturn:!0})||void 0,[n,i]),[h,d]=(0,ps.useState)(f);return(0,ps.useEffect)(()=>{(async()=>{try{let m=f&&!e?f:await i.load(n),y=m?m.id||m["@id"]:null;m&&a!==y&&r(y),d(m)}catch(m){u(m)}})()},[n,e]),{isLoaded:!!h,id:a,requestId:n,error:l,resource:h,cached:!!(h&&h===f)}}function L1(t,e){let{id:n,isLoaded:i,error:a,resource:r,requestId:l,cached:u}=If(t,e);return{id:n,isLoaded:i,error:a,manifest:r,requestId:l,cached:u}}var QM=N(tt(),1);function D1({manifest:t,children:e}){return(0,QM.jsx)(Li,{value:{manifest:t},children:e})}var KM=N(tt(),1);function P1({range:t,children:e}){return(0,KM.jsx)(Li,{value:{range:t},children:e})}function ZM(t,e){for(let n of e.items){if(n.type==="Canvas")return n;if(n.type==="SpecificResource")return n.source;if(n.type==="Range"){let i=ZM(t,t.get(n));if(i)return i}}return null}function wg(t,e){let n=[];for(let i of e.items)if(i.type==="SpecificResource"&&i.source?.type==="Canvas"&&(i.source.id.indexOf("#")!==-1?n.push({id:i.source.id.split("#")[0],type:"Canvas"}):n.push(i.source)),i.type==="Range"&&n.push(...wg(t,t.get(i))),i.type==="SpecificResource"){let a=typeof i.source=="string"?i.source:i.source.id;n.push({id:a,type:"Canvas"})}return n}function oF(t,e,n){for(let i of e.structures){let a=B1(t,t.get(i),n);if(a)return a}return null}function B1(t,e,n){for(let i of e.items){let a=i?.source?.id?.split("#")[0];if(i.type==="SpecificResource"&&i.source===n||i.type==="SpecificResource"&&i.source?.type==="Canvas"&&n===a)return e;if(i.type==="Range"){let r=B1(t,t.get(i),n);if(r)return r}}return null}function sF(t,e,n,i=!1){let a=e.behavior,r=n?t.get(n):null;if(!r)return[];let l=r.behavior,u=i?!1:a.includes("paged"),f=u?!1:a.includes("continuous"),h=u||f?!1:a.includes("individuals"),d=l.includes("facing-pages"),m=l.includes("non-paged");if(d||m||h||i)return[{id:r.id,type:"Canvas"}];let[y,g]=Tg(t,e);if(f)return y;let b=y.findIndex(w=>w.id===n);if(b===-1)return[];for(let w of g)if(w.includes(b))return w.map(E=>y[E]);return[{id:r.id,type:"Canvas"}]}function Tg(t,e,{disablePaging:n,skipNonPaged:i}={}){let a=e.behavior,r=a.includes("paged"),l=r?!1:a.includes("continuous"),u=r||l?!1:a.includes("individuals"),f=e.type==="Manifest"?e.items:wg(t,e);if(l)return[f,[f.map((b,w)=>w)]];if(u||!r||n)return[f,f.map((b,w)=>[w])];let h=[],d=[],m=()=>{d.length&&(h.push([...d]),d=[])},y=0,g=!1;for(let b=0;b<f.length;b++){let w=t.get(f[b]);if(w.behavior.includes("non-paged")){b===y&&y++,i||(m(),h.push([b]),m());continue}if(b===y||w.behavior.includes("facing-pages")){d.length&&(g=!0),m(),h.push([b]),m();continue}if(d.push(b),g){m(),g=!1;continue}d.length>1&&m()}return d.length&&m(),[f,h]}var cr=N(ct(),1);var WM=N(ct(),1);function Nf(t={},e=[]){let{id:n,selector:i}=t,a=wi(),r=n||a.range,l=_e(u=>r?u.iiif.entities.Range[r]:void 0,[r]);return(0,WM.useMemo)(()=>{if(l)return i?i(l):l},[l,i,...e])}function H1({startCanvas:t,disablePaging:e}){let n=ce(),i=Tn(),a=Nf(),[r,l]=(0,cr.useState)(void 0),u=a||i;if(!u)throw new Error("Nothing selected");let[f,h]=(0,cr.useMemo)(()=>Tg(n,u,{disablePaging:e}),[n,u,e]),d=(0,cr.useRef)(h);if(d.current!==h){let E=d.current[r][0],T=h.findIndex(S=>S.includes(E));d.current=h,l(T)}let m=(0,cr.useCallback)(w=>{let E=h.findIndex(T=>T.includes(w));l(E===-1?0:E)},[f,h]),y=(0,cr.useCallback)(w=>{let E=f.findIndex(T=>T.id===w);E!==-1?m(E):l(0)},[f,h]),g=(0,cr.useCallback)(()=>{l(w=>w>=h.length-1?w:w+1)},[h]),b=(0,cr.useCallback)(()=>{l(w=>w<=0?0:w-1)},[h]);return typeof r>"u"&&(t?y(t):l(0)),{visibleItems:h[r]?.map(w=>f[w].id)||[],cursor:r,items:f,sequence:h,hasPrevious:r>0,hasNext:r<h.length-1,setSequenceIndex:l,setCanvasIndex:m,setCanvasId:y,next:g,previous:b}}var fr=N(ct(),1);var $M={},JM=t=>{let e,n=new Set,i=(d,m)=>{let y=typeof d=="function"?d(e):d;if(!Object.is(y,e)){let g=e;e=m??(typeof y!="object"||y===null)?y:Object.assign({},e,y),n.forEach(b=>b(e,g))}},a=()=>e,f={setState:i,getState:a,getInitialState:()=>h,subscribe:d=>(n.add(d),()=>n.delete(d)),destroy:()=>{($M.env?$M.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."),n.clear()}},h=e=t(i,a,f);return f},ya=t=>t?JM(t):JM;var cO=N(ct(),1),dO=N(sO(),1),Eg={},{useDebugValue:EF}=cO.default,{useSyncExternalStoreWithSelector:AF}=dO.default,lO=!1,CF=t=>t;function zt(t,e=CF,n){(Eg.env?Eg.env.MODE:void 0)!=="production"&&n&&!lO&&(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"),lO=!0);let i=AF(t.subscribe,t.getState,t.getServerState||t.getInitialState,e,n);return EF(i),i}var uO=t=>{(Eg.env?Eg.env.MODE:void 0)!=="production"&&typeof t!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");let e=typeof t=="function"?ya(t):t,n=(i,a)=>zt(e,i,a);return Object.assign(n,e),n},Ag=t=>t?uO(t):uO;function MF(t){let e=t.service||t.services||[];for(let n of e)if(n.type==="AuthProbeService2")return!0;return!1}function dr(t,e,n){let i=e.findIndex(l=>l.service.id===t);if(i===-1)return e;let a=[...e],r=n(a[i]);return r===a[i]?e:(a[i]=r,a)}var U1=()=>ya((t,e)=>({currentAuth:-1,authItems:[],login:()=>{let n=e().authItems[e().currentAuth];if(!n||n.isPending||n.isLoggedIn)return;if(n.type!=="active")throw new Error("Cannot login to non-active service");let i=n.service.service.find(a=>a.type==="AuthAccessTokenService2");if(!i)throw new Error("Token service not found");t(()=>({authItems:dr(n.id,e().authItems,a=>({...a,isPending:!0}))})),q1(n.service).then(()=>{Cg(i).then(a=>{let r=a.expiresIn,l=Date.now()+r*1e3;t(()=>({authItems:dr(n.id,e().authItems,u=>({...u,isLoggedIn:!0,isPending:!1,session:{token:a.accessToken,expires:l}}))}))}).catch(a=>{t(()=>({authItems:dr(n.id,e().authItems,r=>({...r,isLoggedIn:!1,isPending:!1,error:a.message}))}))})})},logout:()=>{let n=e().authItems[e().currentAuth];if(!n||n.isPending||!n.isLoggedIn)return;if(n.type!=="active")throw new Error("Cannot logout of non-active service");let i=n.service.service.find(l=>l.type==="AuthLogoutService2");if(!i)return;let a=`${i.id}?origin=${fO()}`,r=window.open(a);t(()=>({authItems:dr(n.id,e().authItems,l=>({...l,isLoggedIn:!1,session:null,isPending:!1}))}))},nextAuth:()=>{let n=e().authItems.length,i=e().currentAuth+1;i>=n||t(()=>({currentAuth:i}))},previousAuth:()=>{let n=e().currentAuth-1;n<0||t(()=>({currentAuth:n}))},setAuth:n=>{n!==-1&&(n<0||n>=e().authItems.length)||t(()=>({currentAuth:n}))},addService:(n,i)=>{if(!n.service)return;let a=n.service.find(u=>u.type==="AuthAccessTokenService2"),r=n;if(e().authItems.find(u=>u.service.id===n.id)){t(()=>({authItems:dr(n.id,e().authItems,u=>({...u,instances:u.instances+1}))}));return}if(t(()=>({currentAuth:r.profile==="active"?0:e().currentAuth,authItems:[{id:n.id,type:n.profile,service:n,probeId:i,canAuthenticate:!0,instances:1,isPending:!1,isLoggedIn:!1,session:null},...e().authItems]})),n.profile==="external"){if(!a)throw new Error("Token service not found");Cg(a).then(u=>{t(()=>({authItems:dr(n.id,e().authItems,f=>({...f,isLoggedIn:!0,isPending:!1,session:{token:u.accessToken,expires:u.expiresIn}}))}))}).catch(u=>{t(()=>({authItems:dr(n.id,e().authItems,f=>({...f,isLoggedIn:!1,isPending:!1,canAuthenticate:!1,error:u.message}))}))})}if(n.profile==="kiosk"){if(!a)throw new Error("Token service not found");t(()=>({authItems:dr(n.id,e().authItems,u=>({...u,isPending:!0}))})),q1(r).then(()=>{Cg(a).then(u=>{t(()=>({authItems:dr(n.id,e().authItems,f=>({...f,isLoggedIn:!0,isPending:!1,session:{token:u.accessToken,expires:u.expiresIn}}))}))}).catch(u=>{t(()=>({authItems:dr(n.id,e().authItems,f=>({...f,isLoggedIn:!1,isPending:!1,error:u.message}))}))})})}n.profile},removeService:(n,i)=>{let a=e().currentAuth===e().authItems.findIndex(l=>l.service.id===n.id),r=e().currentAuth;if(a){let l=e().authItems.find(f=>f.service.id===n.id);l&&l.instances>1||(r=e().authItems.findIndex(h=>h.service.id!==n.id&&h.instances>0))}t(()=>({authItems:dr(n.id,e().authItems,l=>({...l,instances:l.instances-1})),currentAuth:r}))}})),V1=(t,e)=>ya((n,i)=>({service:t,status:t?"unknown":"success",shouldRedirect:!1,redirectResource:null,shouldSubstitute:!1,substituteResource:null,error:null,errorHeading:null,errorNote:null,shouldDisplayResource:!1,token:e||null,async probe(){if(!i().service)return;let a=i().service?.id;if(!a){n({status:"error",error:"Service ID not found",errorHeading:{en:["Service ID not found"]}});return}n({status:"probing"});let r=i().token;try{let l=await fetch(a,{headers:r?{Authorization:`Bearer ${i().token}`,Accept:"application/json"}:{Accept:"application/json"}}).then(u=>u.json());if(l.status===200)n({status:"success",shouldDisplayResource:!0,error:null,errorHeading:null,errorNote:null,shouldSubstitute:!1,shouldRedirect:!1});else if(l.status<400&&l.status>=300){if(!l.location)throw new Error("Redirect location not found");n({status:"error",shouldDisplayResource:!1,shouldRedirect:!0,redirectResource:l.location||null})}else if(l.status===401)n({status:"error",shouldDisplayResource:!1,shouldRedirect:!1,shouldSubstitute:!!l.substitute,substituteResource:l.substitute||null,error:"Unauthorized",errorHeading:l.heading||{en:["Unauthorized"]},errorNote:l.note||null});else throw new Error("Unknown error")}catch(l){n({status:"error",error:l.message,errorHeading:{en:["Unknown error"]}})}},setToken(a){n({token:a})}}));function j1(t){let e=t.service||t.services||[],n={hasAuth:!1,services:{}};for(let i of e)if(i.type==="AuthProbeService2"){n.services.probe=i,n.hasAuth=!0;let a=i.service.filter(r=>r.type==="AuthAccessService2");a[0]&&(n.services.access=a[0])}return n}async function Cg(t,{strict:e=!0}={}){return new Promise((n,i)=>{let a=Math.random().toString(36).substring(7),r=`${t.id}?messageId=${a}&origin=${window.location.origin}`,l=h=>{let d=h.data;if(d.messageId===a){if(e&&d.type!=="AuthAccessToken2"){u(),i("Invalid response, expected type=AuthAccessToken2");return}if(!d.accessToken){u(),i("Invalid response, expected accessToken");return}u(),n(d)}},u=()=>window.removeEventListener("message",l),f=document.createElement("iframe");f.src=r,f.style.display="none",document.body.appendChild(f),window.addEventListener("message",l)})}function fO(t){let e=window.location;if(t){let n=document.createElement("a");return n.href=t,n.protocol+"//"+n.hostname+(n.port?":"+n.port:"")}return e.protocol+"//"+e.hostname+(e.port?":"+e.port:"")}async function q1(t){let e=`${t.id}?origin=${fO()}`,n=window.open(e);if(!n)throw new Error("Failed to open window");return new Promise((i,a)=>{let r=setInterval(()=>{n.closed&&(clearInterval(r),i())},500)})}var wc=N(ct(),1);function hO(t){let e=(0,wc.useMemo)(()=>j1(t),[t]),n=k1(e.services.access?.id),i=(0,wc.useMemo)(()=>V1(e.services.probe,n),[e.services.probe]),a=zt(i);return(0,wc.useEffect)(()=>{a.status==="unknown"&&!n&&a.probe()},[e.services.probe,a.status]),(0,wc.useEffect)(()=>{n&&(a.setToken(n),a.probe())},[n]),[t,a,e.hasAuth]}var Lf=N(tt(),1),Fl=(0,fr.createContext)(null),pO=(0,fr.createContext)(null);pO.displayName="CurrentAuth";var mO=(0,fr.createContext)(null);mO.displayName="AuthActions";function Y1({children:t}){let e=(0,fr.useMemo)(()=>U1(),[]);return(0,Lf.jsx)(Fl.Provider,{value:e,children:t})}function X1(){return!!(0,fr.useContext)(Fl)}function Tc(){let t=(0,fr.useContext)(Fl);if(!t)throw new Error("useAuthActions must be used within a AuthProvider");return t}function gO(){let t=Tc();return zt(t,n=>({login:n.login,logout:n.logout,nextAuth:n.nextAuth,previousAuth:n.previousAuth,setAuth:n.setAuth,addService:n.addService,removeService:n.removeService}))}function OF(){let t=Tc();return zt(t,e=>e)}function yO(t){let e=Tc();return zt(e,i=>i.authItems.find(a=>a.service.id===t))}function k1(t){let e=Tc();return zt(e,i=>i.authItems.find(a=>a.id===t)?.session?.token)}function _F(t){let e=Tc();return zt(e,i=>{let a=i.authItems.find(r=>r.service.id===t);return!a||!a.isLoggedIn||!a.session?null:a.session?.token||null})}function zF(t){let e=gO(),n=yO(t.service.id);return(0,fr.useEffect)(()=>(e?.addService(t.service,t.probeId),()=>{e?.removeService(t.service,t.probeId)}),[t.service]),n?(n.error||!n.isLoggedIn,t.children):null}function G1(){return null}function Q1(t){let[e,n,i]=hO(t.resource),a=t.fallbackComponent||G1,r=t.loadingComponent||G1,l=t.errorComponent||G1,u=n.service,f=null;if(!i||!u)return t.children(e);let h=u.service.filter(d=>d.type==="AuthAccessService2");n.status==="error"&&(f=(0,Lf.jsx)(l,{resource:t.resource,error:n.error||"",heading:n.errorHeading,note:n.errorNote,extra:t.extra})),(n.status==="unknown"||n.status==="probing")&&(f=(0,Lf.jsx)(r,{})),n.status==="success"&&(f=t.children(e));for(let d of h)f=(0,Lf.jsx)(zF,{service:d,probeId:u.id,children:f},d.id);return f}var Df=N(ct(),1);var IF=t=>t.id||t["@id"];function NF(t){return(Array.isArray(t.service)?t.service:[t.service]).find(n=>n.profile==="http://iiif.io/api/search/0/autocomplete"||n.profile==="http://iiif.io/api/search/1/autocomplete"||n.profile==="AutoCompleteService1")}var vO=t=>{let e;typeof t=="string"?e={"@context":"http://iiif.io/api/search/1/context.json",profile:"http://iiif.io/api/search/1/search","@id":t,id:t,service:[]}:e=t;let n=e?IF(e):void 0,i=null;return ya((a,r)=>({service:e,resources:[],lastQuery:{},loading:!1,error:!1,highlight:null,hasSearch:!!e,hasAutocomplete:e?!!NF(e):!1,errorMessage:"",search(l,u={}){if(!n)throw new Error("No search service found.");i&&!i.signal.aborted&&i.abort(),i=new AbortController;let f=new URLSearchParams;l.q&&f.set("q",l.q),l.motivation&&f.set("motivation",l.motivation),l.date&&f.set("date",l.date),l.user&&f.set("user",l.user),a({loading:!0}),fetch(`${n}?${f.toString()}`,{signal:i.signal,headers:{"Content-Type":"application/json",Accept:"application/json",...u.headers||{}}}).then(async h=>{if(!i?.signal.aborted)if(h.ok){let d=await h.json();a({resources:d.resources,error:!1,errorMessage:""})}else a({resources:[],error:!0,errorMessage:h.statusText})})},clearSearch(){a({resources:[],error:!1,errorMessage:""})},highlightResult(l){let u=r().resources.find(f=>f["@id"]===l);a({highlight:u})},nextResult(){let l=r().resources,u=r().highlight;if(!u){a({highlight:l[0]||null});return}let f=l.findIndex(h=>h["@id"]===u["@id"]);if(f===-1){a({highlight:l[0]||null});return}a({highlight:l[f+1]||l[0]||null})},previousResult(){let l=r().resources,u=r().highlight;if(!u){a({highlight:l[l.length-1]||null});return}let f=l.findIndex(h=>h["@id"]===u["@id"]);if(f===-1){a({highlight:l[l.length-1]||null});return}if(f===0){a({highlight:l[l.length-1]||null});return}a({highlight:l[f-1]||l[l.length-1]||null})}}))};function K1(){let t=Tn();return t?t.service.find(e=>e.profile==="SearchService1"||e.profile==="http://iiif.io/api/search/1/search"):void 0}var Mg=N(tt(),1),Rc=(0,Df.createContext)(null);Rc.displayName="Search";function bO(t){let e=K1();return t.store?(0,Mg.jsx)(Rc.Provider,{value:t.store,children:t.children}):(0,Mg.jsx)(LF,{service:e,children:t.children})}function LF({service:t,children:e}){let n=(0,Df.useMemo)(()=>vO(t),[t]);return(0,Mg.jsx)(Rc.Provider,{value:n,children:e})}var Yi=N(tt(),1),Pf=()=>{},Ec=(0,Og.createContext)({setCurrentCanvasId:Pf,setCurrentCanvasIndex:Pf,nextCanvas:Pf,previousCanvas:Pf,items:[],sequence:[],setSequenceIndex:Pf,currentSequenceIndex:0,hasNext:!1,hasPrevious:!1});function xO(t){let e=Tn(),{cursor:n,visibleItems:i,next:a,sequence:r,items:l,setCanvasIndex:u,setCanvasId:f,previous:h,setSequenceIndex:d,hasNext:m,hasPrevious:y}=H1({startCanvas:t.startCanvas,disablePaging:t.pagingEnabled===!1}),g=(0,Og.useMemo)(()=>({sequence:r,items:l,setCurrentCanvasId:f,nextCanvas:a,previousCanvas:h,totalCanvases:l.length,setCurrentCanvasIndex:u,setSequenceIndex:d,currentSequenceIndex:n,hasNext:m,hasPrevious:y}),[r,l,f,a,h,l,u,d,n]);return e?i.length===0?null:(0,Yi.jsx)(Ec.Provider,{value:g,children:(0,Yi.jsx)(Bl.Provider,{value:i,children:(0,Yi.jsx)(qa,{canvas:i[0],children:t.children})})}):(console.warn("The manifest passed to the provider is not a valid IIIF manifest."),(0,Yi.jsx)("div",{children:"Sorry, something went wrong."}))}function Z1(t){let e=fo(t.vault),n=L1(t.manifest);if(!n)return console.warn("The manifest passed to the provider is not a valid IIIF manifest."),(0,Yi.jsx)("div",{children:"Sorry, something went wrong."});if(n.error)return(0,Yi.jsx)("div",{children:n.error.toString()});if(!n.isLoaded)return(0,Yi.jsx)("div",{children:"Loading..."});let i=(0,Yi.jsx)(xO,{...t,children:t.children});return(0,Yi.jsx)(co,{vault:e,children:(0,Yi.jsx)(D1,{manifest:n.id,children:(0,Yi.jsx)(Y1,{children:(0,Yi.jsx)(bO,{children:t.rangeId?(0,Yi.jsx)(P1,{range:t.rangeId,children:i}):i})})})})}function ql(){return(0,SO.useContext)(Ec)}var Ac=(t,e,n)=>{let i=t.length,a=n||It(i);for(let r=0;r<i;r++)a[r]=r%5===0?t[r+1]<e[3]&&t[r+3]>e[1]&&t[r+2]<e[4]&&t[r+4]>e[2]?1:0:t[r];return a};function It(t,e,n){return new Float32Array(t,e,n)}var wO=(t,e,n)=>{let i=t[1]<=e[3]&&t[3]>=e[1]&&t[2]<=e[4]&&t[4]>=e[2],a=n||It(5);return i?(a[0]=1,a[1]=Math.max(t[1],e[1]),a[2]=Math.max(t[2],e[2]),a[3]=Math.min(t[3],e[3]),a[4]=Math.min(t[4],e[4]),a):(a[0]=0,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a)},TO=t=>t.length/5;var Nr=(t,e,n)=>{let i=n||It(9);return i[0]=t[0]*e[0]+t[1]*e[3]+t[2]*e[6],i[1]=t[0]*e[1]+t[1]*e[4]+t[2]*e[7],i[2]=t[0]*e[2]+t[1]*e[5]+t[2]*e[8],i[3]=t[3]*e[0]+t[4]*e[3]+t[5]*e[6],i[4]=t[3]*e[1]+t[4]*e[4]+t[5]*e[7],i[5]=t[3]*e[2]+t[4]*e[5]+t[5]*e[8],i[6]=t[6]*e[0]+t[7]*e[3]+t[8]*e[6],i[7]=t[6]*e[1]+t[7]*e[4]+t[8]*e[7],i[8]=t[6]*e[2]+t[7]*e[5]+t[8]*e[8],i},de=class t{constructor(e){this.index=0,this.length=e,this.points=It(this.length)}static grid(e=1,n=1){return new t(5*e*n)}static point(e,n){let i=It(5);return i[0]=1,i[1]=e,i[2]=n,i[3]=e,i[4]=n,i}static positionPair(e){let n=It(5);return n[0]=1,n[1]=e.x1,n[2]=e.y1,n[3]=e.x2,n[4]=e.y2,n}static projection(e){return t.singleBox(e.width,e.height,e.x,e.y)}static singleBox(e,n,i=0,a=0){let r=It(5);return r[0]=1,r[1]=i,r[2]=a,r[3]=e+i,r[4]=n+a,r}row(e){return e(this)}addPoints(e,n,i,a){return this.points[this.index]=1,this.points[1+this.index]=e,this.points[2+this.index]=n,this.points[3+this.index]=i,this.points[4+this.index]=a,this.index+=5,this}addBox(e,n,i,a){return this.addPoints(e,n,e+i,n+a),this}build(){return this.points}};var hr=(t,e)=>{let n=t.length;for(let i=0;i<n;i++)t[i]=i%5===0?e[6]*t[i+1]+e[7]*t[i+2]+e[8]*t[i]:i%5%2===1?e[0]*t[i]+e[1]*t[i+1]+e[2]:e[3]*t[i-1]+e[4]*t[i]+e[5];return t},ho=t=>{let e=It(9);return e[0]=t,e[4]=t,e[8]=1,e},ci=(t,e)=>{let n=It(9);return n[0]=1,n[2]=t,n[4]=1,n[5]=e,n[8]=1,n},Ul=(t,e,n)=>Nr(ci((1-t)*e,(1-t)*n),ho(t)),Xi=(t,e,n)=>{let i=t.length,a=n&&n.length>=i?n.slice(0,i):It(i);for(let r=0;r<i;r++)a[r]=r%5===0?e[6]*t[r+1]+e[7]*t[r+2]+e[8]*t[r]:r%5%2===1?e[0]*t[r]+e[1]*t[r+1]+e[2]:e[3]*t[r-1]+e[4]*t[r]+e[5];return a};var DF=Object.defineProperty,PF=(t,e,n)=>e in t?DF(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,_g=(t,e,n)=>(PF(t,typeof e!="symbol"?e+"":e,n),n);function Vl(t){return t.endsWith("info.json")?t:t.endsWith("/")?`${t}info.json`:`${t}/info.json`}var BF="http://library.stanford.edu/iiif/image-api/compliance.html#level0",CO="http://library.stanford.edu/iiif/image-api/compliance.html#level1",MO="http://library.stanford.edu/iiif/image-api/compliance.html#level2",HF="http://library.stanford.edu/iiif/image-api/conformance.html#level0",OO="http://library.stanford.edu/iiif/image-api/conformance.html#level1",_O="http://library.stanford.edu/iiif/image-api/conformance.html#level2",FF="http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level0",zO="http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level1",IO="http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level2",qF="http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level0",NO="http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level1",LO="http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level2",UF="http://iiif.io/api/image/1/level0.json",VF="http://iiif.io/api/image/1/profiles/level0.json",DO="http://iiif.io/api/image/1/level1.json",PO="http://iiif.io/api/image/1/profiles/level1.json",BO="http://iiif.io/api/image/1/level2.json",HO="http://iiif.io/api/image/1/profiles/level2.json",jF="http://iiif.io/api/image/2/level0.json",kF="http://iiif.io/api/image/2/profiles/level0.json",FO="http://iiif.io/api/image/2/level1.json",qO="http://iiif.io/api/image/2/profiles/level1.json",UO="http://iiif.io/api/image/2/level2.json",VO="http://iiif.io/api/image/2/profiles/level2.json",GF="level0",jO="level1",kO="level2",YF="http://iiif.io/api/image/2/level0",GO="http://iiif.io/api/image/2/level1",YO="http://iiif.io/api/image/2/level2",XF="https://iiif.io/api/image/1.1/compliance/#level0",XO="https://iiif.io/api/image/1.1/compliance/#level1",QO="https://iiif.io/api/image/1.1/compliance/#level2",KO=[YO,MO,_O,IO,LO,BO,HO,UO,VO,kO,QO],ZO=[...KO,GO,CO,OO,zO,NO,DO,PO,FO,qO,jO,XO],QF=[YF,GO,YO,BF,CO,MO,HF,OO,_O,FF,zO,IO,qF,NO,LO,UF,VF,DO,PO,BO,HO,jF,kF,FO,qO,UO,VO,GF,jO,kO,XF,XO,QO];var KF={extraFormats:["jpg"],extraQualities:["default"],extraFeatures:["sizeByWhListed"]},ZF={extraFormats:["jpg"],extraQualities:["default"],extraFeatures:["baseUriRedirect","cors","jsonldMediaType","regionByPx","regionSquare","sizeByWhListed","sizeByH","sizeByW","sizeByWh"]},WF={extraFormats:["jpg","png"],extraQualities:["default"],extraFeatures:["baseUriRedirect","cors","jsonldMediaType","regionByPct","regionByPx","regionSquare","rotationBy90s","sizeByWhListed","sizeByConfinedWh","sizeByH","sizeByPct","sizeByW","sizeByWh"]};function JF(t){return KO.indexOf(t)!==-1?WF:ZO.indexOf(t)!==-1?ZF:KF}function $F(t){let e=t?Array.isArray(t.profile)?t.profile:[t.profile]:[],n={extraQualities:[],extraFormats:[],extraFeatures:[]};for(let i of e)if(typeof i=="string"&&(i=JF(i)),!!i){if(i.formats)for(let a of i.formats)n.extraFormats.indexOf(a)===-1&&n.extraFormats.push(a);if(i.qualities)for(let a of i.qualities)n.extraQualities.indexOf(a)===-1&&n.extraQualities.push(a);if(i.supports)for(let a of i.supports)n.extraFeatures.indexOf(a)===-1&&n.extraFeatures.push(a);if(i.maxHeight&&(n.maxHeight=i.maxHeight),i.maxWidth&&(n.maxWidth=i.maxWidth),i.maxArea&&(n.maxArea=i.maxArea),i.extraFormats)for(let a of i.extraFormats)n.extraFormats.indexOf(a)===-1&&n.extraFormats.push(a);if(i.extraQualities)for(let a of i.extraQualities)n.extraQualities.indexOf(a)===-1&&n.extraQualities.push(a);if(i.extraFeatures)for(let a of i.extraFeatures)n.extraFeatures.indexOf(a)===-1&&n.extraFeatures.push(a);i.maxHeight&&(n.maxHeight=i.maxHeight),i.maxWidth&&(n.maxWidth=i.maxWidth),i.maxArea&&(n.maxArea=i.maxArea)}if(t.extraFormats)for(let i of t.extraFormats)n.extraFormats.indexOf(i)===-1&&n.extraFormats.push(i);if(t.extraFeatures)for(let i of t.extraFeatures)n.extraFeatures.indexOf(i)===-1&&n.extraFeatures.push(i);if(t.extraQualities)for(let i of t.extraQualities)n.extraQualities.indexOf(i)===-1&&n.extraQualities.push(i);return n}function tq(t){try{if(t==="full")return{full:!0};if(t==="square")return{square:!0};let e=t.startsWith("pct:"),n=t.substr(e?4:0).split(",").map(i=>parseFloat(i));return{x:n[0],y:n[1],w:n[2],h:n[3],percent:e}}catch{throw new Error("Expected 'full', 'square' or 'x,y,w,h'. Found "+t)}}function eq(t){let e={upscaled:!1,max:!1,confined:!1};if(t[0]==="^"&&(e.upscaled=!0,t=t.slice(1)),t==="max"||t==="full")return e.max=!0,e.serialiseAsFull=t==="full",e;if(t[0]==="!"&&(e.confined=!0,t=t.slice(1)),t[0]==="p")return e.percentScale=parseFloat(t.slice(4)),e;let n=t.split(",").map(i=>i.trim());return n.length&&typeof n[0]<"u"&&(n[0]!==""&&(e.width=parseInt(n[0],10)),typeof n[1]<"u"&&n[1]!==""?(e.height=parseInt(n[1],10),e.version=2):e.version=3),e}function nq(t){let e={angle:0};if(t[0]==="!"&&(e.mirror=!0,t=t.substr(1)),e.angle=parseFloat(t)%360,Number.isNaN(e.angle))throw new Error(`Invalid rotation ${t}`);return e}function iq(t,e=""){let n=t.match(/^(([a-zA-Z]+):\/\/([^/]+))?((.*)+)/);if(!n)throw new Error(`Invalid or unknown input ${t}`);let i=n[2],a=n[3],r=n[4];if(r[0]==="/"&&(r=r.substring(1)),e.length>0){if(e[0]==="/"&&(e=e.substring(1)),e!==r.substring(0,e.length))throw new Error(`Path does not start with prefix (path: ${r}, prefix: ${e})`);r=r.substring(e.length)}return{scheme:i,server:a,path:r,prefix:e}}function aq(t,e=""){let{path:n,scheme:i,server:a,prefix:r}=iq(t,e),l=(n||"").split("/").reverse(),[u,f,h,d,...m]=l,y=m.reverse().filter(Boolean).join("/");if(l.length===1||u==="")return{type:"base",scheme:i,server:a,prefix:r,identifier:y};if(u==="info.json"){let[,...b]=l;return{type:"info",scheme:i,server:a,prefix:r,identifier:b.reverse().filter(Boolean).join("/")}}let g=(u||"").split(".");if(typeof g[1]>"u"||typeof g[0]>"u"||typeof d>"u"||typeof h>"u"||typeof f>"u")throw new Error("Invalid image request");return{type:"image",scheme:i,server:a,prefix:r,identifier:y,originalPath:n,region:tq(d),size:eq(h),rotation:nq(f),quality:g[0],format:g[1]}}function rq(t){let e=aq(Vl(t.id));if(e.type!=="info")throw new Error("Invalid service URL");let n=$F(t);return{identifier:e.identifier,originalPath:"",server:e.server,prefix:e.prefix,scheme:e.scheme,type:"image",quality:n.extraQualities.indexOf("default")===-1?n.extraQualities[0]:"default",region:{full:!0},size:{max:!0,upscaled:!1,confined:!1},format:"jpg",rotation:{angle:0}}}function oq(t,e,n){let i=n.length,a=[];for(let r=0;r<i;r++){let l=n[r];if(l){let u=l.width;a.push(t/u)}}return a}function sq(t,e,n){let i=n.length,a=[];for(let r=0;r<i;r++){let l=n[r];l&&a.push({width:Math.floor(t/l),height:Math.floor(e/l)})}return a}function gn(t){if(t["@id"])return t["@id"];if(t.id)return t.id}function Ig(t){if(!t||!t.profile||!gn(t))return!1;let e=Array.isArray(t.profile)?t.profile:[t.profile];for(let n of e)if(typeof n=="string"&&QF.indexOf(n)!==-1)return!0;return!1}function lq(t){if(!Ig(t))return!1;let e=Array.isArray(t.profile)?t.profile:[t.profile];for(let n of e)if(typeof n=="string"){if(ZO.indexOf(n)!==-1)return!0}else{let i=[...n.supports||[],...n.extraFeatures||[]];if(i.indexOf("regionByPx")!==-1&&(i.indexOf("sizeByW")!==-1||i.indexOf("sizeByWh")!==-1))return!0}return!1}function zg(t,e){if(e&&e.profile){let n=e.profile;if(n){let i=Array.isArray(n)?n:[n];return i.includes(`level${t}`)||i.includes(`http://iiif.io/api/image/2/level${t}.json`)||i.includes(`http://iiif.io/api/image/1/level${t}.json`)||i.includes(`http://iiif.io/api/image/1/profiles/level${t}.json`)}}return!1}function J1(t){return Ig(t)?zg(0,t)?0:zg(1,t)?1:zg(2,t)?2:null:null}function WO(t){return(t["@context"]?Array.isArray(t["@context"])?t["@context"]:[t["@context"]]:[]).indexOf("http://iiif.io/api/image/3/context.json")!==-1}function uq(t){if(!lq(t))return[];let e=[],n=Array.isArray(t.profile)?t.profile:[t.profile],i=n.length;for(let a=0;a<i;a++){let r=n[a];if(r&&typeof r!="string"&&(r.maxHeight||r.maxWidth))return[{id:gn(t),type:"variable",minWidth:0,minHeight:0,maxHeight:r.maxHeight||r.maxWidth,maxWidth:r.maxWidth||r.maxHeight,level:J1(t),version:t["@context"]==="http://iiif.io/api/image/3/context.json"?3:2}]}if(t.tiles){let a=t.tiles.length;for(let r=0;r<a;r++){let l=t.tiles[r];l&&(l.height||l.width)&&e.push({id:gn(t),type:"variable",minHeight:0,minWidth:0,maxHeight:l.height||l.width,maxWidth:l.width,level:J1(t),version:WO(t)?3:2})}}return e}function RO(t){let e=/^.*\/(full)\/(((\d+),(\d+)?)|max)\/(\d+)\/default\.(jpg|png|jpeg)$/,n=t.match(e);if(n&&n[4]&&n[5]){let i=n[1],a=parseInt(n[4],10),r=parseInt(n[5],10),l=n[7];if((i==="max"||i==="full")&&a&&r&&l)return{type:"fixed",id:t,height:r,width:a}}return{type:"unknown",id:t}}function cq(t){if(t["@type"])return t["@type"];if(t.type)return t.type}function dq(t){if(typeof t=="string")return RO(t);let e=cq(t);if(e!=="Image"&&e!=="sc:Image")return null;let n=t,i=gn(n);return i?i&&n.width&&n.height?{id:i,type:"fixed",width:n.width,height:n.height,unsafe:!0}:RO(i):null}function fq(t){return Ig(t)?(t&&t.sizes?t.sizes:[]).map(e=>({id:gn(t),type:"fixed-service",height:e.height,width:e.width,level:J1(t),version:WO(t)?3:2})):[]}function EO(t){let e=[],n=t.length;for(let i=0;i<n;i++){let a=t[i];if(!a)continue;let r=fq(a);r.length&&e.push(...r);let l=uq(a);l.length&&e.push(...l)}return e}function JO(t){let e=t.service?Array.isArray(t.service)?t.service:[t.service]:[],n=e.length,i=[];for(let a=0;a<n;a++)Ig(e[a])&&i.push(e[a]);return i}function hq(t,e=!0,n){let i=[],a=dq(t);if(a===null)return i;let r=t;if(i.push(a),e&&r&&r.width&&r.height){let l=[],u=JO(r);for(let f of u){let h={id:gn(f),width:r.width,height:r.height};if(n.canLoadSync(h)){let d=n.loadServiceSync(h);d&&(d.height||(d.height=r.height),d.width||(d.width=r.width),l.push(...EO([d])))}}if(l.length)return i.push(...l),i}return r.service&&i.push(...EO(r.service)),i}function pq({x:t=0,y:e=0,w:n,h:i,full:a,square:r,percent:l}){if(a)return"full";if(r)return"square";if(typeof n>"u"||typeof i>"u")throw new Error("RegionParameter: invalid region");let u=`${t},${e},${n},${i}`;return l?`pct:${u}`:u}function mq({max:t,percentScale:e,upscaled:n,confined:i,width:a,height:r,serialiseAsFull:l,version:u}){let f=[];return n&&f.push("^"),t?(f.push(l?"full":"max"),f.join("")):(i&&f.push("!"),e&&f.push(`pct:${e}`),a&&f.push(`${a}`),f.push(","),r&&u===3&&f.push(`${r}`),f.join(""))}function gq(t){return`${t.mirror?"!":""}${(t.angle||0)%360}`}function yq(t,e){let n=t.prefix.startsWith("/")?t.prefix.substr(1):t.prefix,i=`${t.scheme}://${t.server}/${n?`${n}/`:""}${t.identifier}`;if(t.type==="base")return i;if(t.type==="info")return`${i}/info.json`;let{size:a}=t,{region:r,rotation:l,format:u,quality:f}=t;if(e){let h=e["@context"]?Array.isArray(e["@context"])?e["@context"]:[e["@context"]]:[],d=e.profile,m=h.indexOf("http://iiif.io/api/image/2/context.json")!==-1||d==="level2",y=h.indexOf("http://iiif.io/api/image/3/context.json")!==-1;if((a.width===e.width&&!a.height||a.height===e.height&&!a.width||a.width===e.width&&a.height===e.height)&&(a={...a,max:!0}),m&&(a.max&&!a.serialiseAsFull&&(a={...a,serialiseAsFull:!0}),!a.max&&a.width&&a.height&&(a={...a,height:void 0}),a={...a,version:2}),y){if(a.max&&a.serialiseAsFull&&(a={...a,serialiseAsFull:!1}),a.width&&!a.height&&e.width&&e.height){let g=e.height/e.width;a={...a,height:Math.ceil(a.width*g)}}a={...a,version:3}}}return[i,pq(r),mq(a),gq(l),`${f}.${u}`].filter(Boolean).join("/")}function W1(t,e,n){let i=rq({"@context":t.version===3?"http://iiif.io/api/image/3/context.json":"http://iiif.io/api/image/2/context.json",id:Vl(gn(t)),profile:t.level===null||typeof t.level>"u"?"level0":`level${t.level}`,type:t.version===3?"ImageService3":"ImageService2"});if(i.type!=="image")throw new Error("Invalid service");return i.size.max=!1,i.size.width=e,i.size.height=n,{id:yq(i),type:"fixed",width:e,height:n||t.height/(t.width||1)*e,unsafe:t.width>e}}function Cc(t){let e=t.replace(/(https?:\/\/)?(www.)?/i,"");return e.indexOf("/")!==-1?e.split("/")[0]:e}function vq(t,e,n){let i=t.width?t.width:t.maxWidth;return n.height<=t.maxHeight&&n.width<=t.maxWidth&&n.height>=t.minHeight&&n.width>=t.minWidth&&(!e||Math.abs(n.width-i)<Math.abs(e.width-i))}function bq(t,e){let n=[],i=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},t),a=(d,m=0)=>i.explain?n.push(new Array(m).fill(0).map(y=>" ").join("")+d().trim()):void 0,r=[],l=[],u=null;a(()=>`Using configuration: ${JSON.stringify(i,null,2)}`);let f=(d,m)=>{if(a(()=>"Swapping choice",3),vq(i,m,d)){if(i.preferFixedSize&&d.unsafe){a(()=>`We found an image that was marked as unsafe, but it was the best size. (${d.id})`,4),l.push(d);return}i.returnAllOptions&&m&&l.push(m),a(()=>`We found a new image that was the best size. (${d.id})`,4),u=d}else i.returnAllOptions&&l.push(d)};a(()=>`The input shows we have ${e.length} list(s) of candidates to choose from.`);let h=e.length;for(let d=0;d<h;d++){let m=e[d]();a(()=>`Candidate group ${d}: ${JSON.stringify(m,null,2)}`,1);let y=m.length;a(()=>`Checking candidate list number ${d} and found ${y} potential ways of creating image(s)`,1);for(let g=0;g<y;g++){let b=m[g];if(a(()=>`-> Checking candidate ${g}`,1),b.type==="unknown"&&i.atAnyCost&&(a(()=>`We've found an unknown image type, adding this to the "last resort" list`,2),r.push(b)),b.type==="fixed"&&(b.unsafe?(a(()=>`We've found an unsafe fixed image type, adding this to the "last resort" list`,2),r.push(b)):(a(()=>"We've found a fixed size image, checking if it matches the request",2),f(b,u))),b.type==="fixed-service")if(i.unsafeImageService){a(()=>"Checking for an image from the tile source, without calculating the right height and width (unsafeImageService)",2);let w=W1(b,i.width,i.height);f(w,u)}else{a(()=>"Checking for an image from the tile source 3",2);let w=W1(b,b.width,b.height);f(w,u)}if(b.type==="variable"&&b.maxWidth){let w=W1({id:b.id,type:"fixed-service",width:b.maxWidth,height:b.maxWidth,level:b.level,version:b.version},b.maxWidth);f(w,u)}}if(u&&!i.returnAllOptions){if(u.unsafe||i.allowUnsafe)continue;a(()=>`We found a match in choice list number ${d}, no searching any more`);break}}return i.atAnyCost&&l.length===0?(a(()=>u?`We found an image! ${u.id} of type ${u.type}`:'We found no images, but "atAnyCost" is set, so returning that'),{best:u||r[0]||null,fallback:r.slice(1),log:n}):i.returnAllOptions?(a(()=>"Returning all options that we have found"),{best:(i.atAnyCost?u||l[0]||r[0]:u||l[0])||null,fallback:[...l,...r],log:n}):(a(()=>"Returning the best image that we found, and a fallback"),{best:u||l[0]||null,fallback:u?l:l.slice(1),log:n})}function Sq(t,e,n){let i=t>e?t:e,a=n.length,r=[];for(let l=0;l<a;l++){let u=n[l];if(!u||u.scaleFactors.length===0)continue;let f=u.scaleFactors[0];if(!f)continue;let h=i/f,d=[f];for(;h>=u.width;)f=f*2,d.push(f),h=h/2;r.push({...u,scaleFactors:d})}return r}function xq(t,e){if(t.length!==e.length)return!1;if(t.length===0&&e.length===0)return!0;let n=t.length,i=!0;for(let r=0;r<n;r++){let l=t[r],u=e[r];if(l.width!==u.width||l.height!==u.height){i=!1;break}}if(i)return!0;let a=0;for(let r=0;r<n;r++)for(let l=0;l<n;l++)if(t[r].width===e[l].width&&t[r].height===e[l].height){a++;break}return a===n}function AO(t){return zg(0,t)}var $O=class{constructor(t={}){_g(this,"config",{verificationsRequired:1,approximateServices:!1,enableFetching:!0,disableThrottling:!1}),_g(this,"fetchingCount",0),_g(this,"imageServices",{}),_g(this,"knownImageServers",{}),this.config=Object.assign(this.config,t)}setConfig(t){Object.assign(this.config,t)}sample(t,e,n=!0){let i=Cc(gn(t)),a=Vl(gn(t)),r=this.knownImageServers[i];return this.imageServices[a]=Object.assign(t,{real:!0}),!r&&t.tiles&&!AO(t)?(this.knownImageServers[i]={verifications:0,malformed:!1,root:i,preLoaded:n,sampledId:gn(t),verified:!1,server:null,result:{context:t["@context"]||[],sampledProfile:t.profile,resourceServiceRatio:e&&t.height?e.height/t.height:1,sampledSizes:t.sizes||[],sizeRatios:oq(t.width,t.height,t.sizes||[]),sampledTiles:t.tiles||[]}},!0):this.verify(t)}preLoad(t,e=!0){this.knownImageServers[t.root]=t,e&&(this.knownImageServers[t.root].malformed=!1,this.knownImageServers[t.root].verifications=this.config.verificationsRequired)}predict(t,e=!1,n=!1){let i=t?.source,a=Cc(gn(t)),r=this.knownImageServers[a],l=Vl(gn(t));return this.imageServices[l]?this.imageServices[l]||null:!this.config.approximateServices||!r||!r.result||!(i?.height||t.height)||!(i?.width||t.width)||!n&&(r.malformed||r.verifications<this.config.verificationsRequired)||AO(t.source)?null:(this.imageServices[l]||(this.imageServices[l]={"@context":r.result.context,"@id":gn(t),id:gn(t),protocol:"http://iiif.io/api/image",tiles:i?.tiles||Sq(t.width,t.height,r.result.sampledTiles),sizes:i?.sizes||sq(Math.round(t.width/r.result.resourceServiceRatio),Math.round(t.height/r.result.resourceServiceRatio),r.result.sizeRatios),profile:i?.profile||r.result.sampledProfile,height:i?.height||t.height,width:i?.width||t.width,real:!1}),this.imageServices[l]||null)}async getThumbnailFromResource(t,e,n=!0,i=[]){let a=t?await this.getImageCandidates(t,n):[];return bq(e,[()=>i,()=>a])}async getImageCandidates(t,e=!0){let n=t;if(e&&n&&n.height&&n.width){let i=JO(n);for(let a of i){let r={id:gn(a),width:a.width?a.width:n.width,height:a.height?a.height:n.height,source:a};await this.loadService(r)}}return hq(t,e,this)}async verify(t){let e=this.predict(t,!1,!0),n=await this.fetchService(gn(t));if(!e)return!1;let i=e.height===n.height&&e.width===n.width&&e["@context"]===n["@context"]&&xq(e.sizes||[],n.sizes||[]);if(i){let a=Cc(gn(t)),r=this.knownImageServers[a];r&&(r.verifications+=1,r.verifications>=this.config.verificationsRequired&&(r.verified=!0))}return i}canLoadSync(t){let e=typeof t=="string"?t:gn(t),n=Vl(e);if(this.imageServices[n])return!0;let i=this.knownImageServers[Cc(e)];return!!(i&&!i.malformed&&i.verifications>=this.config.verificationsRequired)}async markAsMalformed(t){return this.knownImageServers[Cc(gn(t))].malformed=!0,this.loadService(t,!0)}async fetchService(t,e=!1){let n=Vl(t),i=this.imageServices[n];if(i&&(!e||i.real))return i;if(!this.config.enableFetching)throw new Error("Fetching is not enabled");let a=await this.fetch(n).then(r=>r.json());return!a.id&&a["@id"]&&(a.id=a["@id"]),a.id!==t&&(a.id=t,a["@id"]&&(a["@id"]=t)),this.imageServices[n]=Object.assign(a,{real:!0}),this.imageServices[n]}async fetch(t,e){return fetch(t,e)}async loadService(t,e=!1){if(!this.config.disableThrottling){let a=!0;for(;a;)if(this.fetchingCount>=this.config.verificationsRequired)await new Promise(r=>setTimeout(r,500));else{a=!1;break}}let n=this.knownImageServers[Cc(gn(t))];if(n&&!n.malformed&&!e){await n.result;let a=this.loadServiceSync(t);if(a)return a}this.fetchingCount++;let i=await this.fetchService(gn(t),e);return this.fetchingCount--,i.real&&this.sample(i,t),i}loadServiceSync(t){let e=Vl(gn(t));return this.imageServices[e]?this.imageServices[e]:this.config.approximateServices?this.predict(t):null}},nQ=new $O;var Ng={},po={get(t){return t},setMetaValue([t,e,n],i){let a=po.getResourceMeta(t,e),r=a?a[n]:void 0,l=typeof i=="function"?i(r):i;Ng[t]={...Ng[t]||{},[e]:{...(Ng[t]||{})[e]||{},[n]:l}}},getResourceMeta:(t,e)=>{let n=Ng[t];if(n)return e?n[e]:n},async load(t){let e=typeof t=="string"?t:t.id;return fetch(e).then(n=>n.json())},subscribe(t){return()=>{}},requestStatus(t){}};function wq(t){try{if(t==="full")return{full:!0};if(t==="square")return{square:!0};let e=t.startsWith("pct:"),n=t.substr(e?4:0).split(","),i=n.map(a=>parseFloat(a));return{x:i[0],y:i[1],w:i[2],h:i[3],percent:e}}catch{throw Error("Expected 'full', 'square' or 'x,y,w,h'. Found "+t)}}function Tq(t){let e={upscaled:!1,max:!1,confined:!1};if(t[0]==="^"&&(e.upscaled=!0,t=t.slice(1)),t==="max"||t==="full")return e.max=!0,e.serialiseAsFull=t==="full",e;if(t[0]==="!"&&(e.confined=!0,t=t.slice(1)),t[0]==="p")return e.percentScale=parseFloat(t.slice(4)),e;let n=t.split(",").map(i=>i.trim());return n.length&&(n[0]!==""&&(e.width=parseInt(n[0],10)),n[1]!==""&&(e.height=parseInt(n[1],10))),e}function Rq(t){let e={angle:0};if(t[0]==="!"&&(e.mirror=!0,t=t.substr(1)),e.angle=parseFloat(t)%360,Number.isNaN(e.angle))throw Error(`Invalid rotation ${t}`);return e}function Eq(t,e=""){let n=t.match(/^(([a-zA-Z]+):\/\/([^/]+))?((.*)+)/);if(!n)throw Error(`Invalid or unknown input ${t}`);let i=n[2],a=n[3],r=n[4];if(r[0]==="/"&&(r=r.substring(1)),e.length>0){if(e[0]==="/"&&(e=e.substring(1)),e!==r.substring(0,e.length))throw Error(`Path does not start with prefix (path: ${r}, prefix: ${e})`);r=r.substring(e.length)}return{scheme:i,server:a,path:r,prefix:e}}function Aq(t,e=""){let{path:n,scheme:i,server:a,prefix:r}=Eq(t,e),l=n.split("/").reverse(),[u,f,h,d,...m]=l,y=m.reverse().filter(Boolean).join("/");if(l.length===1||u==="")return{type:"base",scheme:i,server:a,prefix:r,identifier:y};if(u==="info.json"){let[,...w]=l;return{type:"info",scheme:i,server:a,prefix:r,identifier:w.reverse().filter(Boolean).join("/")}}if(i===void 0||a===void 0||n===void 0||d===void 0||h===void 0||f===void 0||u===void 0)throw Error("Invalid image service URL");let[g="",b=""]=u.split(".");return{type:"image",scheme:i,server:a,prefix:r,identifier:y,originalPath:n,region:wq(d),size:Tq(h),rotation:Rq(f),quality:g,format:b}}function Cq(t){return sc.indexOf(t)!==-1?Q2:Xm.indexOf(t)!==-1?X2:Y2}function Mq(t){let e=t?Array.isArray(t.profile)?t.profile:[t.profile]:[],n={extraQualities:[],extraFormats:[],extraFeatures:[]};for(let i of e)if(typeof i=="string"&&(i=Cq(i)),!!i){if(i.formats)for(let a of i.formats)n.extraFormats.indexOf(a)===-1&&n.extraFormats.push(a);if(i.qualities)for(let a of i.qualities)n.extraQualities.indexOf(a)===-1&&n.extraQualities.push(a);if(i.supports)for(let a of i.supports)n.extraFeatures.indexOf(a)===-1&&n.extraFeatures.push(a);if(i.maxHeight&&(n.maxHeight=i.maxHeight),i.maxWidth&&(n.maxWidth=i.maxWidth),i.maxArea&&(n.maxArea=i.maxArea),i.extraFormats)for(let a of i.extraFormats)n.extraFormats.indexOf(a)===-1&&n.extraFormats.push(a);if(i.extraQualities)for(let a of i.extraQualities)n.extraQualities.indexOf(a)===-1&&n.extraQualities.push(a);if(i.extraFeatures)for(let a of i.extraFeatures)n.extraFeatures.indexOf(a)===-1&&n.extraFeatures.push(a);i.maxHeight&&(n.maxHeight=i.maxHeight),i.maxWidth&&(n.maxWidth=i.maxWidth),i.maxArea&&(n.maxArea=i.maxArea)}if(t.extraFormats)for(let i of t.extraFormats)n.extraFormats.indexOf(i)===-1&&n.extraFormats.push(i);if(t.extraFeatures)for(let i of t.extraFeatures)n.extraFeatures.indexOf(i)===-1&&n.extraFeatures.push(i);if(t.extraQualities)for(let i of t.extraQualities)n.extraQualities.indexOf(i)===-1&&n.extraQualities.push(i);return n}function $1(t){let e=Array.isArray(t.profile)?t.profile:[t.profile];for(let n of e)if(typeof n=="string"&&o1.indexOf(n)!==-1)return!0;return!1}function ke(t){if(t["@id"])return t["@id"];if(t.id)return t.id}function Bf(t){if(!t||!t.profile||!ke(t))return!1;let e=Array.isArray(t.profile)?t.profile:[t.profile];for(let n of e)if(typeof n=="string"&&a1.indexOf(n)!==-1)return!0;return!1}function t_(t){if(!Bf(t))return!1;let e=Array.isArray(t.profile)?t.profile:[t.profile];for(let n of e)if(typeof n=="string"){if(Xm.indexOf(n)!==-1)return!0}else{let i=[...n.supports||[],...n.extraFeatures||[]];if(i.indexOf("regionByPx")!==-1&&(i.indexOf("sizeByW")!==-1||i.indexOf("sizeByWh")!==-1))return!0}return!1}function Oq({x:t=0,y:e=0,w:n,h:i,full:a,square:r,percent:l}){if(a)return"full";if(r)return"square";if(n===void 0||i===void 0)throw Error("RegionParameter: invalid region");let u=`${t},${e},${n},${i}`;return l?`pct:${u}`:u}function _q({max:t,percentScale:e,upscaled:n,confined:i,width:a,height:r,serialiseAsFull:l,version:u}){let f=[];return n&&f.push("^"),t?(f.push(l?"full":"max"),f.join("")):(i&&f.push("!"),e&&f.push(`pct:${e}`),a&&f.push(`${a}`),f.push(","),r&&u===3&&f.push(`${r}`),f.join(""))}function zq(t){return`${t.mirror?"!":""}${(t.angle||0)%360}`}function Lg(t,e){let n=t.prefix.startsWith("/")?t.prefix.substring(1):t.prefix,i=`${t.scheme}://${t.server}/${n?`${n}/`:""}${t.identifier}`;if(t.type==="base")return i;if(t.type==="info")return`${i}/info.json`;let{size:a}=t,{region:r,rotation:l,format:u,quality:f}=t;if(e){let h=e["@context"]?Array.isArray(e["@context"])?e["@context"]:[e["@context"]]:[],d=h.indexOf("http://iiif.io/api/image/2/context.json")!==-1,m=h.indexOf("http://iiif.io/api/image/3/context.json")!==-1;if((a.width===e.width&&!a.height||a.height===e.height&&!a.width||a.width===e.width&&a.height===e.height)&&(a={...a,max:!0}),d&&(a.max&&!a.serialiseAsFull&&(a={...a,serialiseAsFull:!0}),!a.max&&a.width&&a.height&&(a={...a,height:void 0}),a={...a,version:2}),m){if(a.max&&a.serialiseAsFull&&(a={...a,serialiseAsFull:!1}),a.width&&!a.height&&e.width&&e.height){let y=e.height/e.width;a={...a,height:Math.ceil(a.width*y)}}a={...a,version:3}}}return[i,Oq(r),_q(a),zq(l),`${f}.${u}`].filter(Boolean).join("/")}function ms(t){return t.endsWith("info.json")?t:t.endsWith("/")?`${t}info.json`:`${t}/info.json`}function Dg(t){let e=Aq(ms(t.id));if(e.type!=="info")throw Error("Invalid service URL");let n=Mq(t);return{identifier:e.identifier,originalPath:"",server:e.server,prefix:e.prefix,scheme:e.scheme,type:"image",quality:n.extraQualities.indexOf("default")===-1?n.extraQualities[0]:"default",region:{full:!0},size:{max:!0,upscaled:!1,confined:!1},format:"jpg",rotation:{angle:0}}}function e_(t,e,n){let i=n.length,a=[];for(let r=0;r<i;r++){let l=n[r];if(!l)continue;let u=l.width;a.push(t/u)}return a}function n_(t,e,n){let i=n.length,a=[];for(let r=0;r<i;r++){let l=n[r];l&&a.push({width:Math.floor(t/l),height:Math.floor(e/l)})}return a}function Mc(t,e){if(e&&e.profile){let n=e.profile;if(n){let i=Array.isArray(n)?n:[n];if(i.includes(`level${t}`)||i.includes(`http://iiif.io/api/image/2/level${t}.json`)||i.includes(`http://iiif.io/api/image/1/level${t}.json`)||i.includes(`http://iiif.io/api/image/1/profiles/level${t}.json`))return!0;if(t===2){for(let a of i)if(sc.includes(a))return!0}if(t===1){for(let a of i)if(Xm.includes(a))return!0}if(t===0){for(let a of i)if(o1.includes(a))return!0}}}return!1}function Pg(t){return Bf(t)?Mc(2,t)?2:Mc(1,t)?1:Mc(0,t)?0:null:null}function gs(t){let e=t.service?Array.isArray(t.service)?t.service:[t.service]:[],n=e.length,i=[];for(let a=0;a<n;a++)Bf(e[a])&&i.push(e[a]);return i}function i_(t){if(t["@type"])return t["@type"];if(t.type)return t.type}function jl(t){let e=t.replace(/(https?:\/\/)?(www.)?/i,"");return e.indexOf("/")===-1?e:e.split("/")[0]}function a_(t,e,n){let i=t>e?t:e,a=n.length,r=[];for(let l=0;l<a;l++){let u=n[l];if(!u||u.scaleFactors.length===0)continue;let f=u.scaleFactors[0];if(!f)continue;let h=i/f,d=[f];for(;h>=u.width;)f*=2,d.push(f),h/=2;r.push({...u,scaleFactors:d})}return r}function Bg(t,e,n){let i=Dg({"@context":t.version===3?"http://iiif.io/api/image/3/context.json":"http://iiif.io/api/image/2/context.json",id:ms(ke(t)),profile:t.level===null||t.level===void 0?"level0":`level${t.level}`,type:t.version===3?"ImageService3":"ImageService2"});if(i.type!=="image")throw Error("Invalid service");return i.size.max=!1,i.size.width=e,i.size.height=n,{id:Lg(i),type:"fixed",width:e,height:n||t.height/(t.width||1)*e,unsafe:t.width>e}}function r_(t,e,n){let i=t.width?t.width:t.maxWidth;return n.height<=t.maxHeight&&n.width<=t.maxWidth&&n.height>=t.minHeight&&n.width>=t.minWidth&&(!e||Math.abs(n.width-i)<Math.abs(e.width-i))}function o_(t,e){let n=[],i=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},t),a=(d,m=0)=>i.explain?n.push(Array(m).fill(0).map(y=>" ").join("")+d().trim()):void 0,r=[],l=[],u=null;a(()=>`Using configuration: ${JSON.stringify(i,null,2)}`);let f=(d,m)=>{if(a(()=>"Swapping choice",3),r_(i,m,d)){if(i.preferFixedSize&&d.unsafe){a(()=>`We found an image that was marked as unsafe, but it was the best size. (${d.id})`,4),l.push(d);return}i.returnAllOptions&&m&&l.push(m),a(()=>`We found a new image that was the best size. (${d.id})`,4),u=d}else i.returnAllOptions&&l.push(d)};a(()=>`The input shows we have ${e.length} list(s) of candidates to choose from.`);let h=e.length;for(let d=0;d<h;d++){let m=e[d]();a(()=>`Candidate group ${d}: ${JSON.stringify(m,null,2)}`,1);let y=m.length;a(()=>`Checking candidate list number ${d} and found ${y} potential ways of creating image(s)`,1);for(let g=0;g<y;g++){let b=m[g];a(()=>`-> Checking candidate ${g}`,1),b.type==="unknown"&&i.atAnyCost&&(a(()=>`We've found an unknown image type, adding this to the "last resort" list`,2),r.push(b)),b.type==="fixed"&&(b.unsafe?(a(()=>`We've found an unsafe fixed image type, adding this to the "last resort" list`,2),r.push(b)):(a(()=>"We've found a fixed size image, checking if it matches the request",2),f(b,u))),b.type==="fixed-service"&&(i.unsafeImageService?(a(()=>"Checking for an image from the tile source, without calculating the right height and width (unsafeImageService)",2),f(Bg(b,i.width,i.height),u)):(a(()=>"Checking for an image from the tile source 3",2),f(Bg(b,b.width,b.height),u))),b.type==="variable"&&b.maxWidth&&f(Bg({id:b.id,type:"fixed-service",width:b.maxWidth,height:b.maxWidth,level:b.level,version:b.version},b.maxWidth),u)}if(u&&!i.returnAllOptions){if(u.unsafe||i.allowUnsafe)continue;a(()=>`We found a match in choice list number ${d}, no searching any more`);break}}return i.atAnyCost&&l.length===0?(a(()=>u?`We found an image! ${u.id} of type ${u.type}`:'We found no images, but "atAnyCost" is set, so returning that'),{best:u||r[0]||null,fallback:r.slice(1),log:n}):i.returnAllOptions?(a(()=>"Returning all options that we have found"),{best:(i.atAnyCost?u||l[0]||r[0]:u||l[0])||null,fallback:[...l,...r],log:n}):(a(()=>"Returning the best image that we found, and a fallback"),{best:u||l[0]||null,fallback:u?l:l.slice(1),log:n})}function nx(t){return(t["@context"]?Array.isArray(t["@context"])?t["@context"]:[t["@context"]]:[]).indexOf("http://iiif.io/api/image/3/context.json")!==-1}function s_(t){return Bf(t)?(t&&t.sizes?t.sizes:[]).map(e=>({id:ke(t),type:"fixed-service",height:e.height,width:e.width,level:Pg(t),version:nx(t)?3:2})):[]}function l_(t){if(!t_(t))return[];let e=[],n=Array.isArray(t.profile)?t.profile:[t.profile],i=n.length;for(let a=0;a<i;a++){let r=n[a];if(r&&typeof r!="string"&&(r.maxHeight||r.maxWidth))return[{id:ke(t),type:"variable",minWidth:0,minHeight:0,maxHeight:r.maxHeight||r.maxWidth,maxWidth:r.maxWidth||r.maxHeight,level:Pg(t),version:t["@context"]==="http://iiif.io/api/image/3/context.json"?3:2}]}if(t.tiles){let a=t.tiles.length;for(let r=0;r<a;r++){let l=t.tiles[r];l&&(l.height||l.width)&&e.push({id:ke(t),type:"variable",minHeight:0,minWidth:0,maxHeight:l.height||l.width,maxWidth:l.width,level:Pg(t),version:nx(t)?3:2})}}return e}function tx(t){let e=[],n=t.length;for(let i=0;i<n;i++){let a=t[i];if(!a)continue;let r=s_(a);r.length&&e.push(...r);let l=l_(a);l.length&&e.push(...l)}return e}function ex(t){let e=t.match(/^.*\/(full)\/(((\d+),(\d+)?)|max)\/(\d+)\/default\.(jpg|png|jpeg)$/);if(e&&e[4]&&e[5]){let n=e[1],i=parseInt(e[4],10),a=parseInt(e[5],10),r=e[7];if((n==="max"||n==="full")&&i&&a&&r)return{type:"fixed",id:t,height:a,width:i}}return{type:"unknown",id:t}}function Hf(t){if(typeof t=="string")return ex(t);let e=i_(t);if(e!=="Image"&&e!=="sc:Image")return null;let n=t,i=ke(n);return i?i&&n.width&&n.height?{id:i,type:"fixed",width:n.width,height:n.height,unsafe:!0}:ex(i):null}function u_(t,e=!0,n){let i=[],a=Hf(t);if(a===null)return i;let r=t;if(i.push(a),e&&r&&r.width&&r.height){let l=[],u=gs(r);for(let f of u){let h={id:ke(f),width:r.width,height:r.height};if(n.canLoadSync(h)){let d=n.loadServiceSync(h);d&&(d.height||(d.height=r.height),d.width||(d.width=r.width),l.push(...tx([d])))}}if(l.length)return i.push(...l),i}return r.service&&i.push(...tx(r.service)),i}function c_(t,e){if(t.length!==e.length)return!1;if(t.length===0&&e.length===0)return!0;let n=t.length,i=!0;for(let r=0;r<n;r++){let l=t[r],u=e[r];if(l.width!==u.width||l.height!==u.height){i=!1;break}}if(i)return!0;let a=0;for(let r=0;r<n;r++)for(let l=0;l<n;l++)if(t[r].width===e[l].width&&t[r].height===e[l].height){a++;break}return a===n}var Oc=class{constructor(t={}){kn(this,"config",{verificationsRequired:1,approximateServices:!1,enableFetching:!0,disableThrottling:!1}),kn(this,"fetchingCount",0),kn(this,"imageServices",{}),kn(this,"knownImageServers",{}),this.config=Object.assign(this.config,t)}setConfig(t){Object.assign(this.config,t)}sample(t,e,n=!0){let i=jl(ke(t)),a=ms(ke(t)),r=this.knownImageServers[i];return this.imageServices[a]=Object.assign(t,{real:!0}),!r&&t.tiles&&!$1(t)?(this.knownImageServers[i]={verifications:0,malformed:!1,root:i,preLoaded:n,sampledId:ke(t),verified:!1,server:null,result:{context:t["@context"]||[],sampledProfile:t.profile,resourceServiceRatio:e&&t.height?e.height/t.height:1,sampledSizes:t.sizes||[],sizeRatios:e_(t.width,t.height,t.sizes||[]),sampledTiles:t.tiles||[]}},!0):this.verify(t)}preLoad(t,e=!0){this.knownImageServers[t.root]=t,e&&(this.knownImageServers[t.root].malformed=!1,this.knownImageServers[t.root].verifications=this.config.verificationsRequired)}predict(t,e=!1,n=!1){let i=t?.source,a=jl(ke(t)),r=this.knownImageServers[a],l=ms(ke(t));return this.imageServices[l]?this.imageServices[l]||null:!this.config.approximateServices||!r||!r.result||!(i?.height||t.height)||!(i?.width||t.width)||!n&&(r.malformed||r.verifications<this.config.verificationsRequired)||t.source&&$1(t.source)?null:(this.imageServices[l]||(this.imageServices[l]={"@context":r.result.context,"@id":ke(t),id:ke(t),protocol:"http://iiif.io/api/image",tiles:i?.tiles||a_(t.width,t.height,r.result.sampledTiles),sizes:i?.sizes||n_(Math.round(t.width/r.result.resourceServiceRatio),Math.round(t.height/r.result.resourceServiceRatio),r.result.sizeRatios),profile:i?.profile||r.result.sampledProfile,height:i?.height||t.height,width:i?.width||t.width,real:!1}),this.imageServices[l]||null)}async getThumbnailFromResource(t,e,n=!0,i=[]){let a=t?await this.getImageCandidates(t,n):[];return o_(e,[()=>i,()=>a])}async getImageCandidates(t,e=!0){let n=t;if(e&&n&&n.height&&n.width){let i=gs(n);for(let a of i){let r={id:ke(a),width:a.width?a.width:n.width,height:a.height?a.height:n.height,source:a};await this.loadService(r)}}return u_(t,e,this)}async verify(t){let e=this.predict(t,!1,!0),n=await this.fetchService(ke(t));if(!e)return!1;let i=e.height===n.height&&e.width===n.width&&e["@context"]===n["@context"]&&c_(e.sizes||[],n.sizes||[]);if(i){let a=jl(ke(t)),r=this.knownImageServers[a];r&&(r.verifications+=1,r.verifications>=this.config.verificationsRequired&&(r.verified=!0))}return i}canLoadSync(t){let e=typeof t=="string"?t:ke(t),n=ms(e);if(this.imageServices[n])return!0;let i=this.knownImageServers[jl(e)];return!!(i&&!i.malformed&&i.verifications>=this.config.verificationsRequired)}async markAsMalformed(t){return this.knownImageServers[jl(ke(t))].malformed=!0,this.loadService(t,!0)}async fetchService(t,e=!1){let n=ms(t),i=this.imageServices[n];if(i&&(!e||i.real))return i;if(!this.config.enableFetching)throw Error("Fetching is not enabled");let a=await this.fetch(n).then(r=>r.json());return!a.id&&a["@id"]&&(a.id=a["@id"]),a.id!==t&&(a.id=t,a["@id"]&&(a["@id"]=t)),this.imageServices[n]=Object.assign(a,{real:!0}),this.imageServices[n]}async fetch(t,e){return fetch(t,e)}async loadService(t,e=!1){if(!this.config.disableThrottling){let a=!0;for(;a;)if(this.fetchingCount>=this.config.verificationsRequired)await new Promise(r=>setTimeout(r,500));else{a=!1;break}}let n=this.knownImageServers[jl(ke(t))];if(n&&!n.malformed&&!e){await n.result;let a=this.loadServiceSync(t);if(a)return a}this.fetchingCount++;let i=await this.fetchService(ke(t),e);return this.fetchingCount--,i.real&&this.sample(i,t),i}loadServiceSync(t){let e=ms(ke(t));return this.imageServices[e]?this.imageServices[e]:this.config.approximateServices?this.predict(t):null}};function d_(t={}){let e=t.events||Gm(),n=t.loader||new Oc;return{store:km((i,a)=>({loaded:{},loadServiceSync:(r,l,u)=>{let f=r.id||r["@id"],h=a().loaded[f];if(h&&h.status==="done")return h.service;if(h&&h.status==="loading")return null;if(h&&h.status==="error")throw Error("Failed to load image service");let d={id:ke(r),width:r.width||l?.width||0,height:r.height||l?.height||0,source:r},m=n.loadServiceSync(d);return m?(i(y=>({loaded:{...y.loaded,[f]:{status:"done",service:m,real:!0}}})),e.emit("image-service.loaded",{id:f,service:m})):u&&a().loadService(r,l).then(()=>{}),m},loadService:async(r,l)=>{let u=r.id||r["@id"],f=a().loaded[u];if(f&&f.status==="done")return f.service;if(f&&f.status==="loading")return new Promise((h,d)=>{let m=y=>{y.id===u&&(e.off("image-service.loaded",m),h(y.service||r))};e.on("image-service.loaded",m)});if(f&&f.status==="error"&&!l?.force)throw Error("Failed to load image service");e.emit("image-service.loading",{id:u});try{let h={id:ke(r),width:r.width||0,height:r.height||0,source:r},d=await n.loadService(h,l?.force);return i(m=>({loaded:{...m.loaded,[u]:{status:"done",service:d,real:d.real}}})),e.emit("image-service.loaded",{id:u,service:d}),d}catch(h){throw e.emit("image-service.error",{id:u,error:h}),h}}})),events:e}}var ix=d_();var f_=new Oc;function ax(t=po,e={}){let n=e.imageServiceLoader||f_;async function i(a,r,l=!1,u=[],f){let h=()=>n.getThumbnailFromResource(void 0,r,l,u);if(!a)return await n.getThumbnailFromResource(void 0,r,l,u);if(typeof a=="string"){let m=Hf(a);return m&&u.push(m),await n.getThumbnailFromResource(void 0,r,l,u)}let d=t.get(a,{skipSelfReturn:!1});if(typeof d=="string")return{best:Hf(d),fallback:[],log:[]};if(!d)return await h();switch(await(async m=>{if(m&&m.thumbnail&&m.thumbnail.length){let y=t.get(m.thumbnail[0]),g=await n.getImageCandidates(y,l);g&&g.length&&u.push(...g)}})(d),d.type){case"Annotation":{let m=Array.isArray(d.body)?d.body:[d.body],y=t.get(m[0]);return f&&!y.width&&(y.width=f.width,y.height=f.height),await n.getThumbnailFromResource(y,r,l,u)}case"Canvas":{let m=d;return i(m.items[0],r,l,u,{width:m.width,height:m.height})}case"AnnotationPage":return i(d.items[0],r,l,u,f);case"Choice":{let m=d;return!m.items||m.items[0]?await h():i(m.items[0],r,l,u,f)}case"Collection":{let m=d.items[0];return m?i(m,r,l,u,f):await h()}case"Manifest":{let m=d.items[0];return m?i(m,r,l,u,f):await h()}case"SpecificResource":case"Image":case"Dataset":case"Sound":case"Text":case"TextualBody":case"Video":return f&&!d.width&&(d.width=f.width,d.height=f.height),n.getThumbnailFromResource(d,r,l,u)}return await h()}return{getBestThumbnailAtSize:i}}var Dv=N(ct(),1),k=N(ct(),1);var va=N(ct(),1);function h_(t,e){let n;return(...i)=>{window.clearTimeout(n),n=window.setTimeout(()=>t(...i),e)}}function rx({debounce:t,scroll:e,polyfill:n,offsetSize:i}={debounce:0,scroll:!1,offsetSize:!1}){let 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[r,l]=(0,va.useState)({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),u=(0,va.useRef)({element:null,scrollContainers:null,resizeObserver:null,lastBounds:r,orientationHandler:null}),f=t?typeof t=="number"?t:t.scroll:null,h=t?typeof t=="number"?t:t.resize:null,d=(0,va.useRef)(!1);(0,va.useEffect)(()=>(d.current=!0,()=>void(d.current=!1)));let[m,y,g]=(0,va.useMemo)(()=>{let T=()=>{if(!u.current.element)return;let{left:S,top:R,width:A,height:M,bottom:z,right:I,x:L,y:H}=u.current.element.getBoundingClientRect(),V={left:S,top:R,width:A,height:M,bottom:z,right:I,x:L,y:H};u.current.element instanceof HTMLElement&&i&&(V.height=u.current.element.offsetHeight,V.width=u.current.element.offsetWidth),Object.freeze(V),d.current&&!Dq(u.current.lastBounds,V)&&l(u.current.lastBounds=V)};return[T,h?h_(T,h):T,f?h_(T,f):T]},[l,i,f,h]);function b(){u.current.scrollContainers&&(u.current.scrollContainers.forEach(T=>T.removeEventListener("scroll",g,!0)),u.current.scrollContainers=null),u.current.resizeObserver&&(u.current.resizeObserver.disconnect(),u.current.resizeObserver=null),u.current.orientationHandler&&("orientation"in screen&&"removeEventListener"in screen.orientation?screen.orientation.removeEventListener("change",u.current.orientationHandler):"onorientationchange"in window&&window.removeEventListener("orientationchange",u.current.orientationHandler))}function w(){u.current.element&&(u.current.resizeObserver=new a(g),u.current.resizeObserver.observe(u.current.element),e&&u.current.scrollContainers&&u.current.scrollContainers.forEach(T=>T.addEventListener("scroll",g,{capture:!0,passive:!0})),u.current.orientationHandler=()=>{g()},"orientation"in screen&&"addEventListener"in screen.orientation?screen.orientation.addEventListener("change",u.current.orientationHandler):"onorientationchange"in window&&window.addEventListener("orientationchange",u.current.orientationHandler))}let E=T=>{!T||T===u.current.element||(b(),u.current.element=T,u.current.scrollContainers=p_(T),w())};return Nq(g,!!e),Iq(y),(0,va.useEffect)(()=>{b(),w()},[e,g,y]),(0,va.useEffect)(()=>b,[]),[E,r,m]}function Iq(t){(0,va.useEffect)(()=>{let e=t;return window.addEventListener("resize",e),()=>void window.removeEventListener("resize",e)},[t])}function Nq(t,e){(0,va.useEffect)(()=>{if(e){let n=t;return window.addEventListener("scroll",n,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",n,!0)}},[t,e])}function p_(t){let e=[];if(!t||t===document.body)return e;let{overflow:n,overflowX:i,overflowY:a}=window.getComputedStyle(t);return[n,i,a].some(r=>r==="auto"||r==="scroll")&&e.push(t),[...e,...p_(t.parentElement)]}var Lq=["x","y","top","bottom","left","right","width","height"],Dq=(t,e)=>Lq.every(n=>t[n]===e[n]);var K=N(tt(),1),Vh=N(M_(),1),l8=Object.create,S3=Object.defineProperty,u8=Object.getOwnPropertyDescriptor,c8=Object.getOwnPropertyNames,d8=Object.getPrototypeOf,f8=Object.prototype.hasOwnProperty,Wh=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),h8=(t,e,n,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(var a=c8(e),r=0,l=a.length,u;r<l;r++)u=a[r],!f8.call(t,u)&&u!==n&&S3(t,u,{get:(f=>e[f]).bind(null,u),enumerable:!(i=u8(e,u))||i.enumerable});return t},x3=(t,e,n)=>(n=t==null?{}:l8(d8(t)),h8(e||!t||!t.__esModule?S3(n,"default",{value:t,enumerable:!0}):n,t)),Pv="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.onContextMenu".split(".");function p8(){return Pv.reduce((t,e)=>(t[e]=[],t),{})}var xd=Pv.reduce((t,e)=>(t[e.slice(2).toLowerCase()]=e,t[e]=e,t),{});function m8(t,e,n=1){let i=e.length;if(i===0)throw Error("No resources passed in.");let a=0,r=1/0;for(let l=0;l<i&&!(!e[l]||!e[l].display);l++){let u=XT(e[l].display.scale,t/(n||1));u<r&&(r=u,a=l)}return a}function XT(t,e){return Math.abs(t-e)}function Gh(t,e){let n=XT(t.x,e.x),i=XT(t.y,e.y);return Math.sqrt(n**2+i**2)}function g8(t){let e=t.length;return t.indexOf("/info.json")===e-10?t.slice(0,-10):t}function Qh(t){"@babel/helpers - typeof";return Qh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Qh(t)}function y8(t,e){if(Qh(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var i=n.call(t,e||"default");if(Qh(i)!="object")return i;throw TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function v8(t){var e=y8(t,"string");return Qh(e)=="symbol"?e:e+""}function C(t,e,n){return(e=v8(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var nR=class Rv{constructor(e,n,i){C(this,"element",void 0),C(this,"runtime",void 0),C(this,"unsubscribe",void 0),C(this,"activatedEvents",[]),C(this,"eventHandlers",[]),C(this,"bounds",void 0),C(this,"listening",void 0),C(this,"pointerMoveEvent",void 0),C(this,"pointerEventState",{isClicking:!1,isDragging:!1,isPressed:!1,mousedOver:[],itemsBeingDragged:[],mouseDownStart:{x:0,y:0},lastTouches:[]}),C(this,"options",void 0),C(this,"_realPointerMove",r=>{this.pointerMoveEvent=r}),C(this,"onWheelEvent",r=>{r.preventDefault(),this.onPointerEvent(r)}),C(this,"onContextMenu",r=>{r.preventDefault();let l="onContextMenu";if(this.runtime.world.activatedEvents.indexOf(l)!==-1){let{x:u,y:f}=this.runtime.viewerToWorld(r.clientX-this.bounds.left,r.clientY-this.bounds.top);this.assignToEvent(r,u,f),this.runtime.world.propagatePointerEvent(l,r,u,f)}}),C(this,"onTouchEvent",r=>{let l=xd[r.type],u=[],f=r.touches.length;for(let h=0;h<f;h++){let d=r.touches.item(h);if(!d)continue;let{x:m,y}=this.runtime.viewerToWorld(d.clientX-this.bounds.left,d.clientY-this.bounds.top),g={id:d.identifier,x:m,y};u.push(g)}u.length&&this.assignToEvent(r,u[0].x,u[0].y),l!=="onTouchEnd"&&l!=="onTouchCancel"?(this.pointerEventState.lastTouches=u,r.atlasTouches=u,this.runtime.world.propagateTouchEvent(l,r,u)):(r.atlasTouches=[],this.runtime.world.propagateTouchEvent(l,r,this.pointerEventState.lastTouches),this.pointerEventState.lastTouches=[])}),C(this,"onPointerEvent",r=>{if(r.button===2)return;let l=xd[r.type];if(l&&this.runtime.world.activatedEvents.indexOf(l)!==-1){let{x:u,y:f}=this.runtime.viewerToWorld(r.clientX-this.bounds.left,r.clientY-this.bounds.top);this.assignToEvent(r,u,f),this.runtime.world.propagatePointerEvent(l,r,u,f)}}),C(this,"onPointerDown",r=>{r.button!==2&&(this.pointerEventState.isPressed=!0,this.pointerEventState.isClicking=!0,this.pointerEventState.mouseDownStart.x=r.clientX,this.pointerEventState.mouseDownStart.y=r.clientY,setTimeout(()=>{this.runtime&&(this.pointerEventState.isClicking=!1)},250),setTimeout(()=>{if(this.runtime&&this.pointerEventState.isPressed&&!this.pointerEventState.isDragging){let l=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",r,l.x,l.y)}},800),this.onPointerEvent(r))}),C(this,"onPointerUp",r=>{if(r.button!==2){if(this.pointerEventState.isClicking){let{x:l,y:u}=this.runtime.viewerToWorld(r.clientX-this.bounds.left,r.clientY-this.bounds.top);this.assignToEvent(r,l,u),this.runtime.world.propagatePointerEvent("onClick",r,l,u)}if(this.pointerEventState.isDragging){for(let l of this.pointerEventState.itemsBeingDragged)l.dispatchEvent("onDragEnd",r);this.pointerEventState.isDragging=!1}this.pointerEventState.isClicking=!1,this.pointerEventState.isPressed=!1,this.pointerEventState.itemsBeingDragged=[],this.onPointerEvent(r)}}),C(this,"onPointerMove",r=>{this.pointerMoveEvent=void 0;let{x:l,y:u}=this.runtime.viewerToWorld(r.clientX-this.bounds.left,r.clientY-this.bounds.top);if(Number.isNaN(l)||Number.isNaN(u))return;this.assignToEvent(r,l,u),this.runtime.world.propagatePointerEvent("onPointerMove",r,l,u);let f=this.runtime.world.propagatePointerEvent("onMouseMove",r,l,u),h=[],d=[];for(let m of f)h.push(m.id),d.push(m),this.pointerEventState.mousedOver.indexOf(m)===-1&&(m.dispatchEvent("onMouseEnter",r),m.dispatchEvent("onPointerEnter",r),m.dispatchEvent("onMouseOver",r),m.dispatchEvent("onPointerOver",r));for(let m of this.pointerEventState.mousedOver)h.indexOf(m.id)===-1&&(m.dispatchEvent("onMouseLeave",r),m.dispatchEvent("onPointerLeave",r),m.dispatchEvent("onMouseOut",r),m.dispatchEvent("onPointerOut",r));if(this.pointerEventState.isDragging)for(let m of this.pointerEventState.itemsBeingDragged)m.dispatchEvent("onDrag",r);if(this.pointerEventState.isPressed&&!this.pointerEventState.isDragging&&Gh(this.pointerEventState.mouseDownStart,{x:r.clientX,y:r.clientY})>50){let m=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",{...r,atlas:{x:m.x,y:m.y}},m.x,m.y)}this.pointerEventState.mousedOver=d}),this.element=e,this.runtime=n,this.unsubscribe=n.world.addLayoutSubscriber(this.layoutSubscriber.bind(this)),this.bounds=e.getBoundingClientRect(),this.listening=!1,this.options={simulationRate:0,...i||{}};let a=0;n.registerHook("useFrame",r=>{a+=r,a>this.options.simulationRate&&this.pointerMoveEvent&&(a=0,n.updateNextFrame())}),n.registerHook("useBeforeFrame",()=>{this.pointerMoveEvent&&this.onPointerMove(this.pointerMoveEvent)}),this.activateEvents()}updateBounds(){this.bounds=this.element.getBoundingClientRect(),this.runtime.updateRendererScreenPosition()}layoutSubscriber(e){e==="event-activation"&&this.listening==0&&this.activateEvents()}assignToEvent(e,n,i){Rv.eventPool.atlas.x=n,Rv.eventPool.atlas.y=i,e.atlas=Rv.eventPool.atlas}activateEvents(){this.listening=!0,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("contextmenu",this.onContextMenu),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(e){return e.startsWith("on")?e.slice(2).toLowerCase():e.toLowerCase()}stop(){this.listening=!1,this.element.removeEventListener("pointermove",this._realPointerMove),this.element.removeEventListener("pointerup",this.onPointerUp),this.element.removeEventListener("pointerdown",this.onPointerDown),this.element.removeEventListener("mousedown",this.onPointerEvent),this.element.removeEventListener("mouseup",this.onPointerEvent),this.element.removeEventListener("pointercancel",this.onPointerEvent),this.element.removeEventListener("wheel",this.onWheelEvent),this.element.removeEventListener("touchstart",this.onTouchEvent),this.element.removeEventListener("touchcancel",this.onTouchEvent),this.element.removeEventListener("touchend",this.onTouchEvent),this.element.removeEventListener("touchmove",this.onTouchEvent),this.unsubscribe();for(let[e,n]of this.eventHandlers)this.element.removeEventListener(this.normalizeEventName(e),n)}};C(nR,"eventPool",{atlas:{x:0,y:0}});var qh=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Ov=typeof AbortController=="function"?AbortController:class{constructor(){this.signal=new w3}abort(t=Error("This operation was aborted")){this.signal.reason=this.signal.reason||t,this.signal.aborted=!0,this.signal.dispatchEvent({type:"abort",target:this.signal})}},b8=typeof AbortSignal=="function",S8=typeof Ov.AbortSignal=="function",w3=b8?AbortSignal:S8?Ov.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(e=>e(t),this))}onabort(){}addEventListener(t,e){t==="abort"&&this._listeners.push(e)}removeEventListener(t,e){t==="abort"&&(this._listeners=this._listeners.filter(n=>n!==e))}},iR=new Set,FT=(t,e)=>{let n=`LRU_CACHE_OPTION_${t}`;Bv(n)&&aR(n,`${t} option`,`options.${e}`,Hv)},qT=(t,e)=>{let n=`LRU_CACHE_METHOD_${t}`;if(Bv(n)){let{prototype:i}=Hv,{get:a}=Object.getOwnPropertyDescriptor(i,t);aR(n,`${t} method`,`cache.${e}()`,a)}},x8=(t,e)=>{let n=`LRU_CACHE_PROPERTY_${t}`;if(Bv(n)){let{prototype:i}=Hv,{get:a}=Object.getOwnPropertyDescriptor(i,t);aR(n,`${t} property`,`cache.${e}`,a)}},T3=(...t)=>{typeof process=="object"&&process&&typeof process.emitWarning=="function"?process.emitWarning(...t):console.error(...t)},Bv=t=>!iR.has(t),aR=(t,e,n,i)=>{iR.add(t),T3(`The ${e} is deprecated. Please use ${n} instead.`,"DeprecationWarning",t,i)},Ys=t=>t&&t===Math.floor(t)&&t>0&&isFinite(t),R3=t=>Ys(t)?t<=2**8?Uint8Array:t<=2**16?Uint16Array:t<=2**32?Uint32Array:t<=2**53-1?Ev:null:null,Ev=class extends Array{constructor(t){super(t),this.fill(0)}},w8=class{constructor(t){if(t===0)return[];this.heap=new(R3(t))(t),this.length=0}push(t){this.heap[this.length++]=t}pop(){return this.heap[--this.length]}},Hv=class QT{constructor(e={}){let{max:n=0,ttl:i,ttlResolution:a=1,ttlAutopurge:r,updateAgeOnGet:l,updateAgeOnHas:u,allowStale:f,dispose:h,disposeAfter:d,noDisposeOnSet:m,noUpdateTTL:y,maxSize:g=0,maxEntrySize:b=0,sizeCalculation:w,fetchMethod:E,fetchContext:T,noDeleteOnFetchRejection:S,noDeleteOnStaleGet:R,allowStaleOnFetchRejection:A,allowStaleOnFetchAbort:M,ignoreFetchAbort:z}=e,{length:I,maxAge:L,stale:H}=e instanceof QT?{}:e;if(n!==0&&!Ys(n))throw TypeError("max option must be a nonnegative integer");let V=n?R3(n):Array;if(!V)throw Error("invalid max value: "+n);if(this.max=n,this.maxSize=g,this.maxEntrySize=b||this.maxSize,this.sizeCalculation=w||I,this.sizeCalculation){if(!this.maxSize&&!this.maxEntrySize)throw TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw TypeError("sizeCalculation set to non-function")}if(this.fetchMethod=E||null,this.fetchMethod&&typeof this.fetchMethod!="function")throw TypeError("fetchMethod must be a function if specified");if(this.fetchContext=T,!this.fetchMethod&&T!==void 0)throw TypeError("cannot set fetchContext without fetchMethod");if(this.keyMap=new Map,this.keyList=Array(n).fill(null),this.valList=Array(n).fill(null),this.next=new V(n),this.prev=new V(n),this.head=0,this.tail=0,this.free=new w8(n),this.initialFill=1,this.size=0,typeof h=="function"&&(this.dispose=h),typeof d=="function"?(this.disposeAfter=d,this.disposed=[]):(this.disposeAfter=null,this.disposed=null),this.noDisposeOnSet=!!m,this.noUpdateTTL=!!y,this.noDeleteOnFetchRejection=!!S,this.allowStaleOnFetchRejection=!!A,this.allowStaleOnFetchAbort=!!M,this.ignoreFetchAbort=!!z,this.maxEntrySize!==0){if(this.maxSize!==0&&!Ys(this.maxSize))throw TypeError("maxSize must be a positive integer if specified");if(!Ys(this.maxEntrySize))throw TypeError("maxEntrySize must be a positive integer if specified");this.initializeSizeTracking()}if(this.allowStale=!!f||!!H,this.noDeleteOnStaleGet=!!R,this.updateAgeOnGet=!!l,this.updateAgeOnHas=!!u,this.ttlResolution=Ys(a)||a===0?a:1,this.ttlAutopurge=!!r,this.ttl=i||L||0,this.ttl){if(!Ys(this.ttl))throw TypeError("ttl must be a positive integer if specified");this.initializeTTLTracking()}if(this.max===0&&this.ttl===0&&this.maxSize===0)throw TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.max&&!this.maxSize){let nt="LRU_CACHE_UNBOUNDED";Bv(nt)&&(iR.add(nt),T3("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",nt,QT))}H&&FT("stale","allowStale"),L&&FT("maxAge","ttl"),I&&FT("length","sizeCalculation")}getRemainingTTL(e){return this.has(e,{updateAgeOnHas:!1})?1/0:0}initializeTTLTracking(){this.ttls=new Ev(this.max),this.starts=new Ev(this.max),this.setItemTTL=(i,a,r=qh.now())=>{if(this.starts[i]=a===0?0:r,this.ttls[i]=a,a!==0&&this.ttlAutopurge){let l=setTimeout(()=>{this.isStale(i)&&this.delete(this.keyList[i])},a+1);l.unref&&l.unref()}},this.updateItemAge=i=>{this.starts[i]=this.ttls[i]===0?0:qh.now()},this.statusTTL=(i,a)=>{i&&(i.ttl=this.ttls[a],i.start=this.starts[a],i.now=e||n(),i.remainingTTL=i.now+i.ttl-i.start)};let e=0,n=()=>{let i=qh.now();if(this.ttlResolution>0){e=i;let a=setTimeout(()=>e=0,this.ttlResolution);a.unref&&a.unref()}return i};this.getRemainingTTL=i=>{let a=this.keyMap.get(i);return a===void 0?0:this.ttls[a]===0||this.starts[a]===0?1/0:this.starts[a]+this.ttls[a]-(e||n())},this.isStale=i=>this.ttls[i]!==0&&this.starts[i]!==0&&(e||n())-this.starts[i]>this.ttls[i]}updateItemAge(e){}statusTTL(e,n){}setItemTTL(e,n,i){}isStale(e){return!1}initializeSizeTracking(){this.calculatedSize=0,this.sizes=new Ev(this.max),this.removeItemSize=e=>{this.calculatedSize-=this.sizes[e],this.sizes[e]=0},this.requireSize=(e,n,i,a)=>{if(this.isBackgroundFetch(n))return 0;if(!Ys(i))if(a){if(typeof a!="function")throw TypeError("sizeCalculation must be a function");if(i=a(n,e),!Ys(i))throw TypeError("sizeCalculation return invalid (expect positive integer)")}else throw TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return i},this.addItemSize=(e,n,i)=>{if(this.sizes[e]=n,this.maxSize){let a=this.maxSize-this.sizes[e];for(;this.calculatedSize>a;)this.evict(!0)}this.calculatedSize+=this.sizes[e],i&&(i.entrySize=n,i.totalCalculatedSize=this.calculatedSize)}}removeItemSize(e){}addItemSize(e,n){}requireSize(e,n,i,a){if(i||a)throw TypeError("cannot set size without setting maxSize or maxEntrySize on cache")}*indexes({allowStale:e=this.allowStale}={}){if(this.size)for(let n=this.tail;!(!this.isValidIndex(n)||((e||!this.isStale(n))&&(yield n),n===this.head));)n=this.prev[n]}*rindexes({allowStale:e=this.allowStale}={}){if(this.size)for(let n=this.head;!(!this.isValidIndex(n)||((e||!this.isStale(n))&&(yield n),n===this.tail));)n=this.next[n]}isValidIndex(e){return e!==void 0&&this.keyMap.get(this.keyList[e])===e}*entries(){for(let e of this.indexes())this.valList[e]!==void 0&&this.keyList[e]!==void 0&&!this.isBackgroundFetch(this.valList[e])&&(yield[this.keyList[e],this.valList[e]])}*rentries(){for(let e of this.rindexes())this.valList[e]!==void 0&&this.keyList[e]!==void 0&&!this.isBackgroundFetch(this.valList[e])&&(yield[this.keyList[e],this.valList[e]])}*keys(){for(let e of this.indexes())this.keyList[e]!==void 0&&!this.isBackgroundFetch(this.valList[e])&&(yield this.keyList[e])}*rkeys(){for(let e of this.rindexes())this.keyList[e]!==void 0&&!this.isBackgroundFetch(this.valList[e])&&(yield this.keyList[e])}*values(){for(let e of this.indexes())this.valList[e]!==void 0&&!this.isBackgroundFetch(this.valList[e])&&(yield this.valList[e])}*rvalues(){for(let e of this.rindexes())this.valList[e]!==void 0&&!this.isBackgroundFetch(this.valList[e])&&(yield this.valList[e])}[Symbol.iterator](){return this.entries()}find(e,n){for(let i of this.indexes()){let a=this.valList[i],r=this.isBackgroundFetch(a)?a.__staleWhileFetching:a;if(r!==void 0&&e(r,this.keyList[i],this))return this.get(this.keyList[i],n)}}forEach(e,n=this){for(let i of this.indexes()){let a=this.valList[i],r=this.isBackgroundFetch(a)?a.__staleWhileFetching:a;r!==void 0&&e.call(n,r,this.keyList[i],this)}}rforEach(e,n=this){for(let i of this.rindexes()){let a=this.valList[i],r=this.isBackgroundFetch(a)?a.__staleWhileFetching:a;r!==void 0&&e.call(n,r,this.keyList[i],this)}}get prune(){return qT("prune","purgeStale"),this.purgeStale}purgeStale(){let e=!1;for(let n of this.rindexes({allowStale:!0}))this.isStale(n)&&(this.delete(this.keyList[n]),e=!0);return e}dump(){let e=[];for(let n of this.indexes({allowStale:!0})){let i=this.keyList[n],a=this.valList[n],r=this.isBackgroundFetch(a)?a.__staleWhileFetching:a;if(r===void 0)continue;let l={value:r};if(this.ttls){l.ttl=this.ttls[n];let u=qh.now()-this.starts[n];l.start=Math.floor(Date.now()-u)}this.sizes&&(l.size=this.sizes[n]),e.unshift([i,l])}return e}load(e){this.clear();for(let[n,i]of e){if(i.start){let a=Date.now()-i.start;i.start=qh.now()-a}this.set(n,i.value,i)}}dispose(e,n,i){}set(e,n,{ttl:i=this.ttl,start:a,noDisposeOnSet:r=this.noDisposeOnSet,size:l=0,sizeCalculation:u=this.sizeCalculation,noUpdateTTL:f=this.noUpdateTTL,status:h}={}){if(l=this.requireSize(e,n,l,u),this.maxEntrySize&&l>this.maxEntrySize)return h&&(h.set="miss",h.maxEntrySizeExceeded=!0),this.delete(e),this;let d=this.size===0?void 0:this.keyMap.get(e);if(d===void 0)d=this.newIndex(),this.keyList[d]=e,this.valList[d]=n,this.keyMap.set(e,d),this.next[this.tail]=d,this.prev[d]=this.tail,this.tail=d,this.size++,this.addItemSize(d,l,h),h&&(h.set="add"),f=!1;else{this.moveToTail(d);let m=this.valList[d];if(n!==m){if(this.isBackgroundFetch(m)?m.__abortController.abort(Error("replaced")):r||(this.dispose(m,e,"set"),this.disposeAfter&&this.disposed.push([m,e,"set"])),this.removeItemSize(d),this.valList[d]=n,this.addItemSize(d,l,h),h){h.set="replace";let y=m&&this.isBackgroundFetch(m)?m.__staleWhileFetching:m;y!==void 0&&(h.oldValue=y)}}else h&&(h.set="update")}if(i!==0&&this.ttl===0&&!this.ttls&&this.initializeTTLTracking(),f||this.setItemTTL(d,i,a),this.statusTTL(h,d),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.initialFill++:this.free.pop()}pop(){if(this.size){let e=this.valList[this.head];return this.evict(!0),e}}evict(e){let n=this.head,i=this.keyList[n],a=this.valList[n];return this.isBackgroundFetch(a)?a.__abortController.abort(Error("evicted")):(this.dispose(a,i,"evict"),this.disposeAfter&&this.disposed.push([a,i,"evict"])),this.removeItemSize(n),e&&(this.keyList[n]=null,this.valList[n]=null,this.free.push(n)),this.head=this.next[n],this.keyMap.delete(i),this.size--,n}has(e,{updateAgeOnHas:n=this.updateAgeOnHas,status:i}={}){let a=this.keyMap.get(e);if(a!==void 0)if(this.isStale(a))i&&(i.has="stale",this.statusTTL(i,a));else return n&&this.updateItemAge(a),i&&(i.has="hit"),this.statusTTL(i,a),!0;else i&&(i.has="miss");return!1}peek(e,{allowStale:n=this.allowStale}={}){let i=this.keyMap.get(e);if(i!==void 0&&(n||!this.isStale(i))){let a=this.valList[i];return this.isBackgroundFetch(a)?a.__staleWhileFetching:a}}backgroundFetch(e,n,i,a){let r=n===void 0?void 0:this.valList[n];if(this.isBackgroundFetch(r))return r;let l=new Ov;i.signal&&i.signal.addEventListener("abort",()=>l.abort(i.signal.reason));let u={signal:l.signal,options:i,context:a},f=(g,b=!1)=>{let{aborted:w}=l.signal,E=i.ignoreFetchAbort&&g!==void 0;return i.status&&(w&&!b?(i.status.fetchAborted=!0,i.status.fetchError=l.signal.reason,E&&(i.status.fetchAbortIgnored=!0)):i.status.fetchResolved=!0),w&&!E&&!b?d(l.signal.reason):(this.valList[n]===y&&(g===void 0?y.__staleWhileFetching?this.valList[n]=y.__staleWhileFetching:this.delete(e):(i.status&&(i.status.fetchUpdated=!0),this.set(e,g,u.options))),g)},h=g=>(i.status&&(i.status.fetchRejected=!0,i.status.fetchError=g),d(g)),d=g=>{let{aborted:b}=l.signal,w=b&&i.allowStaleOnFetchAbort,E=w||i.allowStaleOnFetchRejection,T=E||i.noDeleteOnFetchRejection;if(this.valList[n]===y&&(!T||y.__staleWhileFetching===void 0?this.delete(e):w||(this.valList[n]=y.__staleWhileFetching)),E)return i.status&&y.__staleWhileFetching!==void 0&&(i.status.returnedStale=!0),y.__staleWhileFetching;if(y.__returned===y)throw g},m=(g,b)=>{this.fetchMethod(e,r,u).then(w=>g(w),b),l.signal.addEventListener("abort",()=>{(!i.ignoreFetchAbort||i.allowStaleOnFetchAbort)&&(g(),i.allowStaleOnFetchAbort&&(g=w=>f(w,!0)))})};i.status&&(i.status.fetchDispatched=!0);let y=new Promise(m).then(f,h);return y.__abortController=l,y.__staleWhileFetching=r,y.__returned=null,n===void 0?(this.set(e,y,{...u.options,status:void 0}),n=this.keyMap.get(e)):this.valList[n]=y,y}isBackgroundFetch(e){return e&&typeof e=="object"&&typeof e.then=="function"&&Object.prototype.hasOwnProperty.call(e,"__staleWhileFetching")&&Object.prototype.hasOwnProperty.call(e,"__returned")&&(e.__returned===e||e.__returned===null)}async fetch(e,{allowStale:n=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:a=this.noDeleteOnStaleGet,ttl:r=this.ttl,noDisposeOnSet:l=this.noDisposeOnSet,size:u=0,sizeCalculation:f=this.sizeCalculation,noUpdateTTL:h=this.noUpdateTTL,noDeleteOnFetchRejection:d=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:m=this.allowStaleOnFetchRejection,ignoreFetchAbort:y=this.ignoreFetchAbort,allowStaleOnFetchAbort:g=this.allowStaleOnFetchAbort,fetchContext:b=this.fetchContext,forceRefresh:w=!1,status:E,signal:T}={}){if(!this.fetchMethod)return E&&(E.fetch="get"),this.get(e,{allowStale:n,updateAgeOnGet:i,noDeleteOnStaleGet:a,status:E});let S={allowStale:n,updateAgeOnGet:i,noDeleteOnStaleGet:a,ttl:r,noDisposeOnSet:l,size:u,sizeCalculation:f,noUpdateTTL:h,noDeleteOnFetchRejection:d,allowStaleOnFetchRejection:m,allowStaleOnFetchAbort:g,ignoreFetchAbort:y,status:E,signal:T},R=this.keyMap.get(e);if(R===void 0){E&&(E.fetch="miss");let A=this.backgroundFetch(e,R,S,b);return A.__returned=A}else{let A=this.valList[R];if(this.isBackgroundFetch(A)){let H=n&&A.__staleWhileFetching!==void 0;return E&&(E.fetch="inflight",H&&(E.returnedStale=!0)),H?A.__staleWhileFetching:A.__returned=A}let M=this.isStale(R);if(!w&&!M)return E&&(E.fetch="hit"),this.moveToTail(R),i&&this.updateItemAge(R),this.statusTTL(E,R),A;let z=this.backgroundFetch(e,R,S,b),I=z.__staleWhileFetching!==void 0,L=I&&n;return E&&(E.fetch=I&&M?"stale":"refresh",L&&M&&(E.returnedStale=!0)),L?z.__staleWhileFetching:z.__returned=z}}get(e,{allowStale:n=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:a=this.noDeleteOnStaleGet,status:r}={}){let l=this.keyMap.get(e);if(l!==void 0){let u=this.valList[l],f=this.isBackgroundFetch(u);return this.statusTTL(r,l),this.isStale(l)?(r&&(r.get="stale"),f?(r&&(r.returnedStale=n&&u.__staleWhileFetching!==void 0),n?u.__staleWhileFetching:void 0):(a||this.delete(e),r&&(r.returnedStale=n),n?u:void 0)):(r&&(r.get="hit"),f?u.__staleWhileFetching:(this.moveToTail(l),i&&this.updateItemAge(l),u))}else r&&(r.get="miss")}connect(e,n){this.prev[n]=e,this.next[e]=n}moveToTail(e){e!==this.tail&&(e===this.head?this.head=this.next[e]:this.connect(this.prev[e],this.next[e]),this.connect(this.tail,e),this.tail=e)}get del(){return qT("del","delete"),this.delete}delete(e){let n=!1;if(this.size!==0){let i=this.keyMap.get(e);if(i!==void 0)if(n=!0,this.size===1)this.clear();else{this.removeItemSize(i);let a=this.valList[i];this.isBackgroundFetch(a)?a.__abortController.abort(Error("deleted")):(this.dispose(a,e,"delete"),this.disposeAfter&&this.disposed.push([a,e,"delete"])),this.keyMap.delete(e),this.keyList[i]=null,this.valList[i]=null,i===this.tail?this.tail=this.prev[i]:i===this.head?this.head=this.next[i]:(this.next[this.prev[i]]=this.next[i],this.prev[this.next[i]]=this.prev[i]),this.size--,this.free.push(i)}}if(this.disposed)for(;this.disposed.length;)this.disposeAfter(...this.disposed.shift());return n}clear(){for(let e of this.rindexes({allowStale:!0})){let n=this.valList[e];if(this.isBackgroundFetch(n))n.__abortController.abort(Error("deleted"));else{let i=this.keyList[e];this.dispose(n,i,"delete"),this.disposeAfter&&this.disposed.push([n,i,"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 qT("reset","clear"),this.clear}get length(){return x8("length","size"),this.size}static get AbortController(){return Ov}static get AbortSignal(){return w3}},T8=Hv,Fv=(t=21)=>{let e="",n=crypto.getRandomValues(new Uint8Array(t));for(;t--;)e+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[n[t]&63];return e},kr=class{get crop(){return this._crop}set crop(t){this._crop=t}getObjectsAt(t){return[]}getAllPointsAt(t,e,n){return[]}getScheduledUpdates(t,e){return[]}constructor(){C(this,"__id",void 0),C(this,"__revision",0),C(this,"__host",void 0),C(this,"__onCreate",void 0),C(this,"__parent",void 0),C(this,"__owner",{value:void 0}),C(this,"__state",{}),C(this,"eventHandlers",void 0),C(this,"scale",1),C(this,"layers",[]),C(this,"time",[]),C(this,"_crop",void 0),C(this,"cropData",void 0),C(this,"id",void 0),C(this,"addEventListener",(t,e,n)=>{let i=xd[t];if(!this.eventHandlers[i])throw Error(`Unknown event ${i}`);this.eventHandlers[i].indexOf(e)===-1&&this.eventHandlers[i].push(e)}),C(this,"removeEventListener",(t,e)=>{let n=xd[t];if(!this.eventHandlers[n]){console.warn(`Unknown event ${n}`);return}this.eventHandlers[n].indexOf(e)!==-1&&(this.eventHandlers[n]=this.eventHandlers[n].filter(i=>i!==e))}),this.id=this.__id=Fv(),this.eventHandlers=p8()}dispatchEvent(t,e){let n=this.eventHandlers[t],i=n?n.length:0,a=!1;if(i)for(let r=0;r<i;r++)try{n[r]?.(e),a=!0}catch(l){console.error(t,l)}return a}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(t,e){hr(this.points,ci(t,e))}atScale(t){hr(this.points,Ul(t,this.x,this.y)),this.scale*=t}transform(t){hr(this.points,t)}applyProps(t){this.__revision++}appendChild(t){}removeChild(t){}insertBefore(t,e){}hideInstance(){}},fv=/([0-9]+(px|em)\s+)+(solid)\s+(.*)/g,hv={},R8=["backgroundColor","opacity","boxShadow","borderColor","borderWidth","borderStyle","outlineColor","outlineWidth","outlineOffset","outlineStyle"],Sd=class extends kr{constructor(){super(),C(this,"id",void 0),C(this,"type","spacial-content"),C(this,"points",void 0),C(this,"hoverEvents",!1),C(this,"activeEvents",!1),C(this,"display",{x:0,y:0,scale:1,width:-1,height:-1,points:It(5)}),C(this,"_parsed",{border:{id:null,match:[]},outline:{id:null,match:[]}}),C(this,"hovering",void 0),C(this,"pressing",void 0),C(this,"props",{}),C(this,"addHover",()=>{this.hovering=!0,this.__revision++}),C(this,"removeHover",()=>{this.hovering=!1,this.pressing=!1,this.__revision++}),C(this,"addPress",()=>{this.pressing=!0,this.__revision++}),C(this,"removePress",()=>{this.pressing=!1,this.__revision++}),this.id=Fv(12),this.points=It(5)}getAllPointsAt(t,e){return[[this,this.points,e]]}applyProps(t={}){let e=!1;if(t.interactive!==this.props.interactive&&(e=!0,this.props.interactive=t.interactive),t.style){let n=t.border||t.style.border;if(n!==this._parsed.border.id)if(!n)this._parsed.border.id=null,this._parsed.border.match=[];else{let i=hv[n]||fv.exec(n)||fv.exec(n);i&&(this._parsed.border.id=n,this._parsed.border.match=hv[n]=i)}if(this._parsed.border.id&&(t.style.borderWidth=this._parsed.border.match[1],t.style.borderStyle="solid",t.style.borderColor=this._parsed.border.match[4]),t.style.outline!==this._parsed.outline.id)if(!t.style.outline)this._parsed.outline.id=null,this._parsed.outline.match=[];else{let i=hv[t.style.outline]||fv.exec(t.style.outline)||fv.exec(t.style.outline);i&&(this._parsed.outline.id=t.style.outline,this._parsed.outline.match=hv[t.style.outline]=i)}this._parsed.outline.id&&(t.style.outlineWidth=this._parsed.outline.match[1],t.style.outlineStyle="solid",t.style.outlineColor=this._parsed.outline.match[4]),this.props.style=t.style,t.backgroundColor&&!this.props.style.backgroundColor&&(this.props.style.backgroundColor=t.backgroundColor,e=!0),t.style.background&&!this.props.style.backgroundColor&&(this.props.style.backgroundColor=t.style.background,e=!0);for(let i of R8)if(this.props.style[i]!==t.style[i]){e=!0;break}t.style[":hover"]!==this.props.hoverStyles&&(this.props.hoverStyles=t.style[":hover"],this.hoverEvents||(this.hoverEvents=!0,this.addEventListener("pointerenter",this.addHover),this.addEventListener("pointerleave",this.removeHover)),e=!0),t.style[":active"]!==this.props.pressStyles&&(this.props.pressStyles=t.style[":active"],this.activeEvents||(this.activeEvents=!0,this.addEventListener("mousedown",this.addPress),this.addEventListener("mouseup",this.removePress)),e=!0)}t.href!==this.props.href&&(this.props.href=t.href,e=!0),t.hrefTarget!==this.props.hrefTarget&&(this.props.hrefTarget=t.hrefTarget,e=!0),t.title!==this.props.title&&(this.props.title=t.title,e=!0),t.className!==this.props.className&&(this.props.className=t.className,t.className&&!this.hoverEvents&&(this.hoverEvents=!0,this.addEventListener("pointerenter",this.addHover),this.addEventListener("pointerleave",this.removeHover)),t.className&&!this.activeEvents&&(this.activeEvents=!0,this.addEventListener("mousedown",this.addPress),this.addEventListener("mouseup",this.removePress)),e=!0),t.relativeSize!==this.props.relativeSize&&(this.props.relativeSize=t.relativeSize,e=!0),t.relativeStyle!==this.props.relativeStyle&&(this.props.relativeStyle=t.relativeStyle,e=!0),t.html!==this.props.html&&(this.props.html=t.html,e=!0),t.target&&(t.target.width!==this.display.width||t.target.height!==this.display.height||t.target.x!==this.points[1]||t.target.y!==this.points[2])&&(e=!0,this.points=de.singleBox(t.target.width,t.target.height,t.target.x,t.target.y),this.display.points=de.singleBox(t.target.width,t.target.height,t.target.x,t.target.y),this.display.width=t.target.width,this.display.height=t.target.height),e&&this.__revision++}},pv=/([0-9]+(px|em)\s+)+(solid)\s+(.*)/g,mv={},E8=["backgroundColor","opacity","boxShadow","borderColor","borderWidth","borderStyle","outlineColor","outlineWidth","outlineOffset","outlineStyle"],rR=class extends kr{constructor(){super(),C(this,"id",void 0),C(this,"type","spacial-content"),C(this,"isShape",!0),C(this,"points",void 0),C(this,"hoverEvents",!1),C(this,"activeEvents",!1),C(this,"display",{x:0,y:0,scale:1,width:-1,height:-1,points:It(5)}),C(this,"boundingBox",null),C(this,"_parsed",{border:{id:null,match:[]},outline:{id:null,match:[]}}),C(this,"hovering",void 0),C(this,"pressing",void 0),C(this,"props",{}),C(this,"shape",{type:"none"}),C(this,"addHover",()=>{this.hovering=!0,this.__revision++}),C(this,"removeHover",()=>{this.hovering=!1,this.pressing=!1,this.__revision++}),C(this,"addPress",()=>{this.pressing=!0,this.__revision++}),C(this,"removePress",()=>{this.pressing=!1,this.__revision++}),this.id=Fv(12),this.points=It(5),this.shape={type:"none"}}updateBoundingBox(){if(this.shape.type==="none")return;let t=this.shape.points;if(this.shape.points.length>2){let e=Math.min(...t.map(r=>r[0])),n=Math.min(...t.map(r=>r[1])),i=Math.max(0,...t.map(r=>r[0])),a=Math.max(0,...t.map(r=>r[1]));this.boundingBox={x:e,y:n,width:i-e,height:a-n};return}this.boundingBox=null}intersects(t){if(!t||this.shape.type==="none")return!1;let[e,n]=t,i=this.shape.points,a=this.boundingBox;if(a||(this.updateBoundingBox(),a=this.boundingBox),!a||e<a.x||e>a.x+a.width||n<a.y||n>a.height+a.y)return!1;let r=!1;for(let l=0,u=i.length-1;l<i.length;u=l++)i[l][1]>n!=i[u][1]>n&&e<(i[u][0]-i[l][0])*(n-i[l][1])/(i[u][1]-i[l][1])+i[l][0]&&(r=!r);return r}getAllPointsAt(t,e){return t[3]-t[1]===1&&t[4]-t[2]===1?this.intersects([t[1],t[2]])?[[this,this.points,e]]:[]:[[this,this.points,e]]}applyProps(t={}){let e=!1;if(t.points)if(this.shape.type!=="polygon"||this.shape.points.length!==t.points.length)this.shape={type:"polygon",points:t.points,open:t.open},this.updateBoundingBox();else{let n=!1,i=t.points.length;for(let a=0;a<i;a++)if(t.points[a][0]!==this.shape.points[a][0]||t.points[a][1]!==this.shape.points[a][1]){n=!0;break}n&&(this.shape={type:"polygon",points:t.points,open:t.open},this.updateBoundingBox())}if(t.interactive!==this.props.interactive&&(e=!0,this.props.interactive=t.interactive),(t.open||t.open===!1)&&(e=!0,this.shape.open=t.open),t.style){let n=t.border||t.style.border;if(n!==this._parsed.border.id)if(!n)this._parsed.border.id=null,this._parsed.border.match=[];else{let i=mv[n]||pv.exec(n)||pv.exec(n);i&&(this._parsed.border.id=n,this._parsed.border.match=mv[n]=i)}if(this._parsed.border.id&&(t.style.borderWidth=this._parsed.border.match[1],t.style.borderStyle="solid",t.style.borderColor=this._parsed.border.match[4]),t.style.outline!==this._parsed.outline.id)if(!t.style.outline)this._parsed.outline.id=null,this._parsed.outline.match=[];else{let i=mv[t.style.outline]||pv.exec(t.style.outline)||pv.exec(t.style.outline);i&&(this._parsed.outline.id=t.style.outline,this._parsed.outline.match=mv[t.style.outline]=i)}this._parsed.outline.id&&(t.style.outlineWidth=this._parsed.outline.match[1],t.style.outlineStyle="solid",t.style.outlineColor=this._parsed.outline.match[4]),this.props.style=t.style,t.backgroundColor&&!this.props.style.backgroundColor&&(this.props.style.backgroundColor=t.backgroundColor,e=!0),t.style.background&&!this.props.style.backgroundColor&&(this.props.style.backgroundColor=t.style.background,e=!0);for(let i of E8)if(this.props.style[i]!==t.style[i]){e=!0;break}t.style[":hover"]!==this.props.hoverStyles&&(this.props.hoverStyles=t.style[":hover"],this.hoverEvents||(this.hoverEvents=!0,this.addEventListener("pointerenter",this.addHover),this.addEventListener("pointerleave",this.removeHover)),e=!0),t.style[":active"]!==this.props.pressStyles&&(this.props.pressStyles=t.style[":active"],this.activeEvents||(this.activeEvents=!0,this.addEventListener("mousedown",this.addPress),this.addEventListener("mouseup",this.removePress)),e=!0)}t.href!==this.props.href&&(this.props.href=t.href,e=!0),t.hrefTarget!==this.props.hrefTarget&&(this.props.hrefTarget=t.hrefTarget,e=!0),t.title!==this.props.title&&(this.props.title=t.title,e=!0),t.className!==this.props.className&&(this.props.className=t.className,t.className&&!this.hoverEvents&&(this.hoverEvents=!0,this.addEventListener("pointerenter",this.addHover),this.addEventListener("pointerleave",this.removeHover)),t.className&&!this.activeEvents&&(this.activeEvents=!0,this.addEventListener("mousedown",this.addPress),this.addEventListener("mouseup",this.removePress)),e=!0),t.relativeSize!==this.props.relativeSize&&(this.props.relativeSize=t.relativeSize,e=!0),t.relativeStyle!==this.props.relativeStyle&&(this.props.relativeStyle=t.relativeStyle,e=!0),t.html!==this.props.html&&(this.props.html=t.html,e=!0),t.target&&(t.target.width!==this.display.width||t.target.height!==this.display.height||t.target.x!==this.points[1]||t.target.y!==this.points[2])&&(e=!0,this.points=de.singleBox(t.target.width,t.target.height,t.target.x,t.target.y),this.display.points=de.singleBox(t.target.width,t.target.height,t.target.x,t.target.y),this.display.width=t.target.width,this.display.height=t.target.height),e&&this.__revision++}},gi=class KT extends kr{constructor(e){if(super(),C(this,"type","spacial-content"),C(this,"id",void 0),C(this,"uri",void 0),C(this,"display",void 0),C(this,"points",void 0),C(this,"priority",void 0),C(this,"style",{opacity:1}),!e)this.id="",this.uri="",this.display={x:0,y:0,scale:1,width:0,height:0,points:It(5)},this.points=It(5);else{let n=e.scale||1;this.id=e.id||e.uri,this.uri=e.uri,this.points=de.singleBox(e.width,e.height,e.x,e.y),this.display={x:0,y:0,scale:n,width:e.width/n,height:e.height/n,points:de.singleBox(e.width/n,e.height/n),rotation:e?.rotation}}}applyProps(e){let n=e.display?e.display.width:e.target.width,i=e.target.width/n;if(this.id=e.id||e.uri,this.uri=e.uri,this.points.set(de.singleBox(e.target.width,e.target.height,e.target.x,e.target.y)),e.style&&e.style.opacity!==void 0&&(this.style.opacity=e.style.opacity),e.crop){this.cropData=e.crop;let a=de.singleBox(e.crop.width,e.crop.height,e.crop.x,e.crop.y);hr(a,ci(-e.crop.x,-e.crop.y)),this.crop?this.crop.set(a):this.crop=It(a)}e.display?(this.display.scale=i,this.display.width=e.display.width,this.display.height=e.display.height,this.display.rotation=e.display.rotation,this.display.points=de.singleBox(e.display.width,e.display.height)):(this.display.scale=i,this.display.width=e.target.width/i,this.display.height=e.target.height/i,this.display.points=de.singleBox(e.target.width/i,e.target.height/i))}getAllPointsAt(e,n,i){return[[this,this.crop||this.points,n]]}static fromSvg(e,n,i,a){return KT.fromImage("data:image/svg+xml;base64,"+btoa(e),n,i,a)}static fromImage(e,n,i,a){let r=new KT;return r.applyProps({uri:e,id:a,display:i,target:n}),r}getImageUrl(){return this.uri}};function gv(t,e,n){return Math.min(Math.max(t,e),n)}var Ri=class E3 extends kr{constructor(e){super(),C(this,"id",void 0),C(this,"type","spacial-content"),C(this,"display",void 0),C(this,"tileWidth",void 0),C(this,"tileHeight",void 0),C(this,"columns",void 0),C(this,"rows",void 0),C(this,"style",{opacity:1}),C(this,"points",void 0),C(this,"service",void 0),C(this,"format","jpg"),C(this,"crop2",void 0),C(this,"version3",void 0),C(this,"tileUrl",void 0),this.tileUrl=g8(e.url),this.id=e.id||`${this.tileUrl}--${e.scaleFactor}--${e.tileWidth}x${e.tileHeight}`,this.points=e.displayPoints?e.displayPoints:Xi(e.points,ho(e.scaleFactor)),this.tileWidth=e.tileWidth,this.tileHeight=e.tileHeight,this.columns=e.columns,this.rows=e.rows,this.version3=e.version3,this.display={x:0,y:0,width:e.width/e.scaleFactor,height:e.height/e.scaleFactor,points:e.points,scale:e.scaleFactor},e.format&&(this.format=e.format)}applyProps(e){if(e.style&&e.style.opacity!==void 0&&(this.style.opacity=e.style.opacity),e.service!==this.service&&(this.service=e.service),e.format?this.format=e.format:this.format="jpg",e.version3!==void 0&&(this.version3=e.version3),e.crop){this.cropData=e.crop;let n=It([...this.points]),i=n.length/5,a=e.crop.x||0,r=e.crop.y||0,l=e.crop.x+e.crop.width,u=e.crop.y+e.crop.height;for(let f=0;f<i;f++){let h=f*5;n[h+1]<l&&n[h+3]>a&&n[h+2]<u&&n[h+4]>r?(n[h+1]=gv(n[h+1],a,l),n[h+3]=gv(n[h+3],a,l),n[h+2]=gv(n[h+2],r,u),n[h+4]=gv(n[h+4],r,u)):n[h]=0}hr(n,ci(-e.crop.x,-e.crop.y)),this.crop?this.crop.set(n):this.crop=n}}static fromTile(e,n,i,a,r,l,u,f){let h=i.height?i.height:i.width,d=u?Math.floor(n.width/a):Math.ceil(n.width/a),m=u?Math.floor(n.height/a):Math.ceil(n.height/a),y=Math.ceil(d/i.width),g=Math.ceil(m/h),b=de.grid(y,g),w=de.grid(y,g),E=r&&r["@context"]?Array.isArray(r["@context"])?r["@context"]:[r["@context"]]:[],T=f===void 0?E.indexOf("http://iiif.io/api/image/3/context.json")!==-1:f;for(let R=0;R<g;R++)for(let A=0;A<y;A++){let M=A*i.width,z=R*h;w.addPoints(M*a,z*a,A===y-1?n.width:(M+i.width)*a,R===g-1?n.height:(z+h)*a),b.addPoints(M,z,A===y-1?d:M+i.width,R===g-1?m:z+h)}let S=new E3({url:e,scaleFactor:a,points:b.build(),displayPoints:w.build(),width:n.width,height:n.height,tileWidth:i.width,tileHeight:h,columns:y,rows:g,format:l,version3:T});return S.applyProps({service:r}),S}getImageUrl(e){let n=this.points.slice(e*5,e*5+5),i=n[3]-n[1],a=n[4]-n[2],r=Math.ceil(i/this.display.scale),l=Math.ceil(a/this.display.scale),u=`${r>this.tileWidth?this.tileWidth:r},`;return this.version3&&(u+=`${l>this.tileHeight?this.tileHeight:l}`),`${this.tileUrl}/${n[1]},${n[2]},${i},${a}/${u}/0/default.${this.format||"jpg"}`}getAllPointsAt(e,n,i){let a=Ac(this.crop||this.points,e);return[[this,a,n]]}transform(e){hr(this.points,e)}getScheduledUpdates(e,n){return[]}};function A3(t,e,n){if(!e||e[0]===0)return null;let i=t[3]-t[1],a=t[4]-t[2],r=e[3]-e[1],l=e[4]-e[2],u=i<r,f=a<l,h=e[1]+r/2-i/2,d=e[2]+l/2-a/2;return{minX:u?e[1]-n:h,maxX:u?e[3]-i+n:h,minY:f?e[2]-n:d,maxY:f?e[4]-a+n:d}}function C3(t){if(!t.enableFilters||!t.filters.brightness&&!t.filters.contrast&&!t.filters.grayscale&&!t.filters.invert&&!t.filters.sepia&&!t.filters.saturate&&!t.filters.hueRotate&&!t.filters.blur)return"none";let e="";return t.filters.brightness&&(e+=`brightness(${~~(100+t.filters.brightness*100)}%) `),t.filters.contrast&&(e+=`contrast(${~~(100+t.filters.contrast*100)}%) `),t.filters.grayscale&&(e+=`grayscale(${~~(t.filters.grayscale*100)}%) `),t.filters.invert&&(e+=`invert(${~~(t.filters.invert*100)}%) `),t.filters.sepia&&(e+=`sepia(${~~(t.filters.sepia*100)}%) `),t.filters.saturate&&(e+=`saturate(${~~(100+t.filters.saturate*100)}%) `),t.filters.hueRotate&&(e+=`hue-rotate(${t.filters.hueRotate}deg) `),t.filters.blur&&(e+=`blur(${t.filters.blur}px) `),e.trim()}function M3(t,e,n){return Math.max(e,Math.min(n,t))}function A8(){if(typeof navigator>"u")return;let t=navigator;return t.connection||t.mozConnection||t.webkitConnection}function C8(t){let e=10;return typeof navigator<"u"&&typeof navigator.hardwareConcurrency=="number"&&(e=M3(Math.round(navigator.hardwareConcurrency*.75),4,10)),t?.saveData?3:t?.effectiveType==="slow-2g"||t?.effectiveType==="2g"?2:t?.effectiveType==="3g"?Math.min(e,4):e}function M8(t,e){return e?.saveData||e?.effectiveType==="slow-2g"||e?.effectiveType==="2g"?0:e?.effectiveType==="3g"?2:Math.min(t+2,12)}function O3(t={}){let e=A8(),n=C8(e),i=typeof t.maxConcurrentRequests=="number"?Math.max(1,Math.floor(t.maxConcurrentRequests)):n;return{maxConcurrentRequests:i,maxPrefetchPerFrame:typeof t.maxPrefetchPerFrame=="number"?Math.max(0,Math.floor(t.maxPrefetchPerFrame)):M8(i,e),timeoutMs:typeof t.timeoutMs=="number"?Math.max(250,Math.floor(t.timeoutMs)):8e3,maxAttempts:typeof t.maxAttempts=="number"?Math.max(1,Math.floor(t.maxAttempts)):3,baseDelayMs:typeof t.baseDelayMs=="number"?Math.max(0,Math.floor(t.baseDelayMs)):250,maxDelayMs:typeof t.maxDelayMs=="number"?Math.max(0,Math.floor(t.maxDelayMs)):3e3,jitterRatio:typeof t.jitterRatio=="number"?M3(t.jitterRatio,0,1):.2,errorRetryIntervalMs:typeof t.errorRetryIntervalMs=="number"?Math.max(0,Math.floor(t.errorRetryIntervalMs)):3e4,revealDelayFrames:typeof t.revealDelayFrames=="number"?Math.max(0,Math.floor(t.revealDelayFrames)):1,revealBatchWindowFrames:typeof t.revealBatchWindowFrames=="number"?Math.max(0,Math.floor(t.revealBatchWindowFrames)):1,skipFadeIfLoadedWithinMs:typeof t.skipFadeIfLoadedWithinMs=="number"?Math.max(0,Math.floor(t.skipFadeIfLoadedWithinMs)):120}}function _3(t,e,n=Math.random){let i=Math.max(1,Math.floor(e)),a=t.baseDelayMs*2**(i-1),r=Math.min(t.maxDelayMs,a),l=r*t.jitterRatio;return l?Math.max(0,Math.floor(r+(n()*2-1)*l)):r}var z3=class extends Error{constructor(t="Image request cancelled",e=!0){super(t),C(this,"silent",void 0),this.name="ImageRequestCancelledError",this.silent=e}};function I3(t){return t instanceof z3}var GL=0;function O8(t){return GL+=1,`${GL}:${t}`}function N3(t){return Error(`Image load timeout: ${t}`)}function YL(t,e){let n,i=document.createElement("img");i.decoding="async",e.crossOrigin&&(i.crossOrigin=e.crossOrigin);let a=!1;return{promise:new Promise((r,l)=>{let u=()=>{n&&clearTimeout(n),i.onload=null,i.onerror=null};i.onload=()=>{a||(a=!0,u(),r(i))},i.onerror=f=>{a||(a=!0,u(),l(f))},n=setTimeout(()=>{a||(a=!0,u(),l(N3(t)))},e.timeoutMs),i.src=t,i.complete&&i.naturalWidth>0&&(a=!0,u(),r(i))}),abort:()=>{a||(a=!0,n&&clearTimeout(n),i.onload=null,i.onerror=null,i.src="")}}}var L3=class{constructor(t){C(this,"timeoutMs",void 0),C(this,"crossOrigin",void 0),C(this,"useFetch",void 0),C(this,"cache",void 0),C(this,"inFlight",new Map),C(this,"knownConsumers",new Map),this.timeoutMs=t.timeoutMs,this.crossOrigin=t.crossOrigin,this.useFetch=!!t.useFetch&&typeof fetch<"u"&&typeof AbortController<"u",this.cache=t.cache||new Map}acquire(t,e){let n=this.cache.get(t);if(n&&n.naturalWidth>0)return{requestKey:`cached:${t}`,promise:Promise.resolve(n),release:()=>{}};let i=this.inFlight.get(t);i||(i={url:t,requestKey:O8(t),consumers:new Set,promise:Promise.resolve(document.createElement("img")),settled:!1,cancelled:!1,silentCancellation:!0},i.promise=this.createRequest(i).then(r=>(i.settled=!0,this.cache.set(t,r),r)).catch(r=>{throw i.settled=!0,i.cancelled?new z3("Image request cancelled",i.silentCancellation):r}).finally(()=>{i&&i.consumers.size===0&&this.inFlight.delete(t)}),this.inFlight.set(t,i)),i.consumers.add(e);let a=this.knownConsumers.get(e)||new Set;return a.add(t),this.knownConsumers.set(e,a),{requestKey:i.requestKey,promise:i.promise,release:r=>{this.release(t,e,r)}}}release(t,e,n={}){let i=this.knownConsumers.get(e);i&&(i.delete(t),i.size===0&&this.knownConsumers.delete(e));let a=this.inFlight.get(t);if(a&&(a.consumers.delete(e),n.silent===!1&&(a.silentCancellation=!1),!(a.consumers.size>0))){if(!a.settled){a.cancelled=!0,a.abortController&&a.abortController.abort(),a.abortDomImage&&a.abortDomImage();return}this.inFlight.delete(t)}}releaseConsumer(t,e={}){let n=this.knownConsumers.get(t);if(n)for(let i of[...n])this.release(i,t,e)}cancelAll(t={}){let e=[...this.knownConsumers.keys()];for(let n of e)this.releaseConsumer(n,t)}async createRequest(t){if(this.useFetch){let i=new AbortController;t.abortController=i;let a=setTimeout(()=>{i.abort(N3(t.url))},this.timeoutMs);try{let r=this.crossOrigin==="use-credentials"?"include":"same-origin",l=await fetch(t.url,{signal:i.signal,credentials:r});if(!l.ok)throw Error(`Image request failed (${l.status}): ${t.url}`);let u=await l.blob(),f=URL.createObjectURL(u);try{let{promise:h,abort:d}=YL(f,{timeoutMs:this.timeoutMs,crossOrigin:void 0});return t.abortDomImage=d,await h}finally{URL.revokeObjectURL(f)}}finally{clearTimeout(a)}}let{promise:e,abort:n}=YL(t.url,{timeoutMs:this.timeoutMs,crossOrigin:this.crossOrigin});return t.abortDomImage=n,e}},XL=/(-?[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,QL={},_8=typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes("firefox"),z8=new Map,yv=class{constructor(t,e){C(this,"canvas",void 0),C(this,"ctx",void 0),C(this,"options",void 0),C(this,"imagesPending",0),C(this,"imagesLoaded",0),C(this,"imageIdsLoaded",[]),C(this,"frameIsRendering",!1),C(this,"pendingDrawCall",!1),C(this,"firstMeaningfulPaint",!1),C(this,"parallelTasks",6),C(this,"maxPrefetchPerFrame",8),C(this,"imageLoadingConfig",void 0),C(this,"imageRequestPool",void 0),C(this,"frameTasks",0),C(this,"loadingQueueOrdered",!0),C(this,"loadingQueue",[]),C(this,"currentTask",Promise.resolve()),C(this,"tasksRunning",0),C(this,"inFlightImageLoads",new Map),C(this,"requiredTileKeys",new Set),C(this,"requiredPrefetchTileKeys",new Set),C(this,"requestGeneration",0),C(this,"frameCounter",0),C(this,"pendingTileReveals",new Map),C(this,"stats",void 0),C(this,"averageJobTime",64),C(this,"lastKnownScale",1),C(this,"visible",[]),C(this,"previousVisible",[]),C(this,"rendererPosition",void 0),C(this,"dpi",void 0),C(this,"drawCalls",[]),C(this,"lastPaintedObject",void 0),C(this,"hostCache",void 0),C(this,"invalidated",[]),C(this,"fallbackRevealTimeout",null),C(this,"framePrefetchCount",0),C(this,"hasTilesFading",!1),C(this,"hasActiveLayerClip",!1),C(this,"_worker",()=>{if(this.loadingQueue.length&&this.tasksRunning<this.parallelTasks&&this.frameTasks<this.parallelTasks){let n=this.loadingQueue.pop();n&&(this.tasksRunning++,this.frameTasks++,this.currentTask=n.task().then(()=>{this.tasksRunning--}).catch(()=>{this.tasksRunning--}))}}),C(this,"_scheduled",0),C(this,"_doWork",()=>{this.loadingQueue.length===0&&this.tasksRunning===0&&this._scheduled&&(clearInterval(this._scheduled),this._scheduled=0);let n=this.parallelTasks||1;!this.firstMeaningfulPaint&&this.loadingQueue.length&&(n=this.loadingQueue.length);for(let i=0;i<n;i++)this._worker()}),this.canvas=t,this.rendererPosition=t.getBoundingClientRect(),this.ctx=t.getContext("2d",{alpha:!0}),this.ctx.imageSmoothingEnabled=!0,this.options=e||{},this.imageLoadingConfig=O3(this.options.imageLoading),this.parallelTasks=this.imageLoadingConfig.maxConcurrentRequests,this.maxPrefetchPerFrame=this.imageLoadingConfig.maxPrefetchPerFrame,this.imageRequestPool=new L3({timeoutMs:this.imageLoadingConfig.timeoutMs,crossOrigin:this.options.crossOrigin?"anonymous":void 0,useFetch:!!this.options.crossOrigin,cache:z8}),this.canvas.style.transition="opacity .3s",this.dpi=e?.dpi||1,this.options.readiness==="immediate"&&(this.firstMeaningfulPaint=!0,this.canvas.style.opacity="1"),this.hostCache=e?.lruCache?new T8({maxSize:1024*512*512,dispose:(n,i,a)=>{this.invalidated.push(i),n.width=0,n.height=0},sizeCalculation:(n,i)=>n.width*n.height}):{store:{},get(n){return this.store[n]},set(n,i){this.store[n]=i}}}getCanvasDims(){return{width:this.canvas.width/this.dpi,height:this.canvas.height/this.dpi}}resize(){this.rendererPosition=this.canvas.getBoundingClientRect()}getCompositeOwner(t){let e=t?.__parent;return e&&e.renderOptions?e:void 0}compareCompositeLoadPriority(t,e){let n=this.getCompositeOwner(t),i=this.getCompositeOwner(e);return!n||n!==i?0:(t?.display.scale||0)-(e?.display.scale||0)}isReady(){return this.firstMeaningfulPaint}afterFrame(t){if(this.clearTransform(),this.lastPaintedObject=void 0,this.frameIsRendering=!1,this.imagesPending=this.loadingQueue.length+this.tasksRunning+this.inFlightImageLoads.size+this.pendingTileReveals.size,this.imagesLoaded=0,this.loadingQueueOrdered||(this.loadingQueue=this.loadingQueue.sort((e,n)=>{let i=this.compareCompositeLoadPriority(e.paint,n.paint);return i===0?e.network&&n.network&&e.scale===n.scale?n.distance-e.distance:e.scale-n.scale:i}),this.loadingQueueOrdered=!0),this.scheduleSingleImageLookahead(t),this.previousVisible=this.visible,this.pruneStaleTileWork(),this.pendingDrawCall=!!this.drawCalls.length,this.pendingDrawCall)for(let e=0;e<this.drawCalls.length;e++){let n=this.drawCalls.shift();n&&n()}this.doOffscreenWork(),this.options.debug&&this.stats&&this.stats.end()}doOffscreenWork(){this.frameTasks=0,this.loadingQueue.length&&(this._worker(),this.loadingQueue.length&&this.tasksRunning<this.parallelTasks&&(this._scheduled||(this._scheduled=setInterval(this._doWork,0))))}getScale(t,e,n){if(Number.isNaN(t)||Number.isNaN(e))return this.lastKnownScale;let i=this.getCanvasDims(),a=i.width/t,r=i.height/e,l=(a<r?r:a)*(n&&this.dpi||1);return Number.isNaN(l)||(this.lastKnownScale=l),this.lastKnownScale}beforeFrame(t,e,n,i){this.options.debug&&this.stats&&this.stats.begin(),this.frameIsRendering=!0,this.frameCounter+=1,this.visible=[],this.framePrefetchCount=0,this.hasTilesFading=!1,this.requiredTileKeys.clear(),this.requiredPrefetchTileKeys.clear(),this.flushTileRevealBatch(),this.options.beforeFrame&&this.options.beforeFrame(e);let a=this.getCanvasDims();this.ctx.globalAlpha=1,this.canvas.dataset.background==="transparent"?this.ctx.clearRect(0,0,a.width,a.height):(this.ctx.fillStyle=this.canvas.dataset.background??"rgb(0, 0, 0)",this.ctx.fillRect(0,0,a.width,a.height));let r=C3(i);this.ctx.filter!==r&&(this.ctx.filter=r)}applyTransform(t,e,n,i,a){let r=t.__owner.value;if(r&&r.rotation){this.ctx.save();let l=e+i/2,u=n+a/2;this.ctx.translate(l,u),this.ctx.rotate(r.rotation*Math.PI/180),this.ctx.translate(-l,-u),this.lastPaintedObject=r}}clearTransform(){this.lastPaintedObject&&(this.lastPaintedObject.rotation&&this.ctx.restore(),this.lastPaintedObject=void 0)}getTileKey(t,e){return`${t.id}::${t.display.scale}::${e}`}nextRequestKey(t){return this.requestGeneration+=1,`${t}::${this.requestGeneration}`}markTileRequired(t,e){if(e){this.requiredPrefetchTileKeys.add(t);return}this.requiredTileKeys.add(t)}isTileRequired(t){return this.requiredTileKeys.has(t)||this.requiredPrefetchTileKeys.has(t)}shouldSkipFade(t,e=performance.now()){return t?.requestedAt?e-t.requestedAt<=this.imageLoadingConfig.skipFadeIfLoadedWithinMs:!1}enqueueTileReveal(t,e,n){let i=performance.now();if(this.imageLoadingConfig.revealDelayFrames===0&&this.imageLoadingConfig.revealBatchWindowFrames===0){let a=this.getTileState(e,n);this.setTileState(e,n,{...a,loadedAt:i,skipFade:this.shouldSkipFade(a,i)});return}this.pendingTileReveals.set(t,{imageBuffer:e,index:n,queuedFrame:this.frameCounter})}flushTileRevealBatch(){if(this.pendingTileReveals.size===0)return;let t=this.imageLoadingConfig.revealDelayFrames,e=this.imageLoadingConfig.revealBatchWindowFrames,n=performance.now(),i=[...this.pendingTileReveals.entries()].sort((r,l)=>r[1].queuedFrame-l[1].queuedFrame),a=0;for(;a<i.length;){let r=i[a];if(this.frameCounter-r[1].queuedFrame<t)break;let l=r[1].queuedFrame+e;for(;a<i.length&&i[a][1].queuedFrame<=l;){let[u,f]=i[a],h=this.getTileState(f.imageBuffer,f.index);h.state==="decoded"&&!h.loadedAt&&this.setTileState(f.imageBuffer,f.index,{...h,loadedAt:n,skipFade:this.shouldSkipFade(h,n)}),this.pendingTileReveals.delete(u),a+=1}}}emitImageError(t){this.options.onImageError&&this.options.onImageError({renderer:"canvas",...t})}releaseInFlightTileLoad(t,e={}){let n=this.inFlightImageLoads.get(t);n&&(n.release(e),this.inFlightImageLoads.delete(t))}pruneStaleTileWork(){let t=[];for(let n of this.loadingQueue){if(!n.tileKey||this.isTileRequired(n.tileKey)){t.push(n);continue}if(n.paint&&typeof n.index=="number"){let i=this.ensureImageBuffer(n.paint),a=this.getTileState(i,n.index);a.lastRequestKey===n.requestKey&&(a.state==="queued"||a.state==="loading")&&this.setTileState(i,n.index,{...a,state:"idle",cancelledAt:performance.now()})}n.tileKey&&this.pendingTileReveals.delete(n.tileKey)}this.loadingQueue=t;let e=[];for(let[n,i]of this.inFlightImageLoads.entries()){if(this.isTileRequired(n))continue;e.push(n);let a=this.getTileState(i.imageBuffer,i.index);a.lastRequestKey===i.requestKey&&a.state==="loading"&&this.setTileState(i.imageBuffer,i.index,{...a,state:"idle",cancelledAt:performance.now()}),this.pendingTileReveals.delete(n)}for(let n of e)this.releaseInFlightTileLoad(n,{silent:!0})}ensureImageBuffer(t){(!t.__host||!t.__host.canvas)&&this.createImageHost(t);let e=t.__host.canvas;return e.tiles||(e.tiles={}),e.indices||(e.indices=[]),e.loaded||(e.loaded=[]),e.canvases||(e.canvases=[]),e}getTileState(t,e){return t.tiles||(t.tiles={}),t.tiles[e]||(t.tiles[e]={state:"idle"},this.syncBufferState(t)),t.tiles[e]}setTileState(t,e,n){t.tiles||(t.tiles={}),t.tiles[e]=n,this.syncBufferState(t)}syncBufferState(t){let e=[],n=[],i=t.tiles||{},a=Object.keys(i);for(let r=0;r<a.length;r++){let l=parseInt(a[r],10),u=i[l].state;(u==="queued"||u==="loading")&&e.push(l),u==="decoded"&&n.push(l)}t.indices=e,t.loaded=n,t.loading=e.length>0}getCompositeRenderOptions(t){return t.__parent?.renderOptions}shouldClipLayerToBounds(t){return t instanceof gi||t instanceof Ri?!!this.getCompositeRenderOptions(t)?.clipToBounds:!1}getBoundsFromPoints(t){let e=1/0,n=1/0,i=-1/0,a=-1/0;for(let r=0;r<t.length;r+=5)t[r]&&(e=Math.min(e,t[r+1]),n=Math.min(n,t[r+2]),i=Math.max(i,t[r+3]),a=Math.max(a,t[r+4]));if(!(!Number.isFinite(e)||!Number.isFinite(n)||!Number.isFinite(i)||!Number.isFinite(a))&&!(i<=e||a<=n))return{x:e,y:n,width:i-e,height:a-n}}getLayerPolicy(t){return this.getCompositeRenderOptions(t)?.layerPolicy||"fallback-only"}isLayerActive(t){let e=t.__parent;return!e||this.getLayerPolicy(t)==="always-blend"?!0:typeof e.isImageActive=="function"?!!e.isImageActive(t):!0}getPrefetchRadius(t){let e=this.getCompositeRenderOptions(t);return e?typeof e.prefetchRadius=="number"?Math.max(0,e.prefetchRadius):e.loadingBias==="speed"?2:e.loadingBias==="data"?0:1:0}getFadeAlpha(t,e,n){if(e?.skipFade)return 1;if(e?.state==="decoded"&&!e.loadedAt&&(this.imageLoadingConfig.revealDelayFrames>0||this.imageLoadingConfig.revealBatchWindowFrames>0))return 0;let i=this.getCompositeRenderOptions(t);if(!i||!i.fadeInMs||i.fadeInMs<=0)return 1;let a=performance.now(),r=1;if(n&&i.fadeOnLayerChange&&i.layerPolicy!=="active-only"){let l=t.__parent;if(l&&typeof l.getImageActivatedAt=="function"){let u=l.getImageActivatedAt(t);typeof u=="number"&&(r=Math.min(r,Math.max(0,Math.min(1,(a-u)/i.fadeInMs))))}}return e?.loadedAt&&(n||i.fadeFallbackTiles)&&(r=Math.min(r,Math.max(0,Math.min(1,(a-e.loadedAt)/i.fadeInMs)))),r}schedulePrefetchNeighbours(t,e,n,i){if(!(e instanceof Ri)||this.framePrefetchCount>=this.maxPrefetchPerFrame||this.getCompositeRenderOptions(e)?.loadingBias==="data")return;let a=this.getPrefetchRadius(e);if(a<=0)return;let r=e.columns,l=e.rows;if(!r||!l)return;let u=n%r,f=Math.floor(n/r);for(let h=1;h<=a;h++)for(let d=-h;d<=h;d++)for(let m=-h;m<=h;m++){if(Math.max(Math.abs(m),Math.abs(d))!==h)continue;let y=u+m,g=f+d;if(y<0||g<0||y>=r||g>=l)continue;let b=g*r+y,w=this.getTileKey(e,b);if(this.markTileRequired(w,!0),this.schedulePaintToCanvas(t,e,b,i+h*1e3,!0)&&(this.framePrefetchCount++,this.framePrefetchCount>=this.maxPrefetchPerFrame))return}}scheduleSingleImageLookahead(t){if(this.maxPrefetchPerFrame<=0||this.framePrefetchCount>=this.maxPrefetchPerFrame||t.hasActiveZone())return;let e=1/0,n=-1/0,i=new Set;for(let y=0;y<this.visible.length;y++){let g=this.visible[y].__owner?.value;!g||g.type!=="world-object"||g.points[0]===0||(i.add(g),e=Math.min(e,g.points[2]),n=Math.max(n,g.points[4]))}if(!Number.isFinite(e)||!Number.isFinite(n))return;let a=n-e;if(a<=0)return;let r=a*1.5,l=n+r,u=e-r,f,h,d=t.getObjects();for(let y=0;y<d.length;y++){let g=d[y];if(!g||g.type!=="world-object"||g.points[0]===0||i.has(g))continue;let b=g.points[2],w=g.points[4],E=b>=n&&b<=l,T=w<=e&&w>=u;if(!E&&!T)continue;let S;for(let R=0;R<g.layers.length;R++){let A=g.layers[R];if(A instanceof gi){S=A;break}}if(S){if(E){let R=b-n;(!f||R<f.distance)&&(f={image:S,distance:R})}if(T){let R=e-w;(!h||R<h.distance)&&(h={image:S,distance:R})}}}let m=[f,h].filter(Boolean);for(let y of m){if(this.framePrefetchCount>=this.maxPrefetchPerFrame)break;let g=this.ensureImageBuffer(y.image);this.schedulePaintToCanvas(g,y.image,0,1e4+y.distance,!0)&&this.framePrefetchCount++}}paint(t,e,n,i,a,r){let l=this.ctx.globalAlpha,u=typeof t.__zoneVisibilityAlpha=="number"?t.__zoneVisibilityAlpha:1;if(t instanceof gi||t instanceof Ri){let d=t.display.rotation||0,m=d!==0;try{if(m){this.ctx.save();let L=n+a/2,H=i+r/2;t.crop&&(L-=t.crop[e*5+1],H-=t.crop[e*5+2]),this.ctx.translate(L,H),this.ctx.rotate(d*Math.PI/180),this.ctx.translate(-L,-H)}let y=this.options.paintImages!==!1,g=this.options.shouldPaintImage?this.options.shouldPaintImage(t,e):!0;if(!y||!g)return;this.visible.push(t);let b=(t.style?.opacity===void 0?1:t.style.opacity)*u;if(!b)return;this.ctx.globalAlpha=l*b;let w=this.ensureImageBuffer(t),E=this.getTileState(w,e);E.lastUsedAt=performance.now(),this.setTileState(w,e,E);let T=this.getTileKey(t,e);this.markTileRequired(T,!1);let S=this.isLayerActive(t),R=this.getCanvasDims(),A=Gh({x:n+a/2,y:i+r/2},{x:R.width/2,y:R.height/2}),M=this.invalidated.indexOf(w.canvases[e])!==-1,z=this.hostCache.get(w.canvases[e]),I=!!z&&!M;if(M&&this.setTileState(w,e,{...E,state:"idle"}),(M||!I||E.state==="idle"||E.state==="error")&&S&&(this.schedulePaintToCanvas(w,t,e,A,!1),this.schedulePrefetchNeighbours(w,t,e,A)),!this.firstMeaningfulPaint)return;if(z&&!M){let L=this.getFadeAlpha(t,E,S);if(L<1&&(this.hasTilesFading=!0),this.ctx.globalAlpha=l*b*L,t.crop&&t.cropData){if(t.crop[e*5]){let H=[t.crop[e*5+1]/t.display.scale-t.display.points[e*5+1],t.crop[e*5+2]/t.display.scale-t.display.points[e*5+2],1+(t.crop[e*5+3]-t.crop[e*5+1])/t.display.scale,1+(t.crop[e*5+4]-t.crop[e*5+2])/t.display.scale];H[0]+=t.cropData.x/t.display.scale,H[1]+=t.cropData.y/t.display.scale;let V=t.x*this.lastKnownScale,nt=t.y*this.lastKnownScale,X=[n+V,i+nt,a,r];X[0]+=V,X[1]+=nt,this.ctx.drawImage(z,H[0],H[1],H[2],H[3],X[0],X[1],X[2]+1,X[3]+1)}}else _8?this.ctx.drawImage(z,0,0,t.display.points[e*5+3]-t.display.points[e*5+1],t.display.points[e*5+4]-t.display.points[e*5+2],n,i,a+1,r+1):this.ctx.drawImage(z,0,0,t.display.points[e*5+3]-t.display.points[e*5+1],t.display.points[e*5+4]-t.display.points[e*5+2],n,i,a+Number.MIN_VALUE+.5,r+Number.MIN_VALUE+.5)}}catch{}finally{m&&this.ctx.restore(),this.ctx.globalAlpha=l}}let f=t instanceof Sd&&this.options.box,h=t instanceof rR&&this.options.polygon;if((f||h)&&!t.props.className&&!t.props.html&&!t.props.href){if(this.visible.push(t),t.props.style){let d=Object.assign({},t.props.style||{},t.hovering?t.props.hoverStyles:{},t.pressing?t.props.pressStyles:{}),m=t.props.relativeStyle?1:a/t.width,y=d.opacity===void 0?1:d.opacity;this.ctx.globalAlpha=l*y*u;let g=0;d.borderWidth!==void 0&&(g=parseInt(d.borderWidth,10)*m);let b=0;d.outlineWidth!==void 0&&(b=parseInt(d.outlineWidth,10)*m);let w=0;if(d.outlineOffset!==void 0&&(w=parseInt(d.outlineOffset,10)*m),d.borderColor&&(this.ctx.strokeStyle=d.borderColor),d.boxShadow){let E=d.boxShadow.split(/,(?![^(]*\))/);for(let T of E){let S=QL[T]||XL.exec(T)||XL.exec(T);QL[T]=S,S&&(this.ctx.save(),this.ctx.shadowOffsetX=parseInt(S[1])*this.dpi*m,this.ctx.shadowOffsetY=parseInt(S[3])*this.dpi*m,this.ctx.shadowBlur=parseInt(S[5])*this.dpi*m,this.ctx.shadowColor=S[9],this.ctx.fillStyle="rgba(0,0,0,1)",this.ctx.fillRect(n+g,i+g,a,r),this.ctx.restore())}}if(this.ctx.fillStyle=d.backgroundColor||"transparent",this.ctx.lineWidth=g,h){let E=t.shape,T=E.points||[],S=T.length;this.ctx.beginPath();for(let R=0;R<S;R++)this.ctx.lineTo(n+T[R][0]*this.lastKnownScale,i+T[R][1]*this.lastKnownScale);E.open||this.ctx.closePath(),g&&this.ctx.stroke(),E.open||this.ctx.fill()}else g&&this.ctx.strokeRect(n+g/2,i+g/2,a+g,r+g),this.ctx.fillRect(n+g,i+g,a,r);b&&(d.outlineColor&&(this.ctx.strokeStyle=d.outlineColor),this.ctx.lineWidth=b,this.ctx.strokeRect(n-b/2-w,i-b/2-w,a+g*2+b+w*2,r+g*2+b+w*2))}this.ctx.globalAlpha=l}}schedulePaintToCanvas(t,e,n,i,a=!1){let r=this.getTileState(t,n),l=performance.now(),u=this.getTileKey(e,n);if(this.markTileRequired(u,a),this.pendingTileReveals.delete(u),r.nextRetryAt&&r.nextRetryAt>l||r.state==="queued"||r.state==="loading"||r.state==="decoded")return!1;let f=`${e.id}--${e.display.scale}-${n}`,h=this.nextRequestKey(u);t.canvases[n]=f;let d=this.invalidated.indexOf(f);return d!==-1&&this.invalidated.splice(d,1),this.setTileState(t,n,{...r,state:"queued",requestedAt:l,error:void 0,lastRequestKey:h,cancelledAt:void 0,skipFade:!1}),this.loadingQueueOrdered=!1,this.loadingQueue.push({id:f,scale:e.display.scale,kind:"network",tileKey:u,requestKey:h,network:!0,distance:i,paint:e,index:n,prefetch:a,task:async()=>{let m=this.getTileState(t,n);if(m.lastRequestKey!==h||m.state!=="queued"&&m.state!=="loading")return;let y=this.visible.indexOf(e)!==-1,g=this.previousVisible.indexOf(e)!==-1;if(!a&&!y&&!g){this.setTileState(t,n,{...m,state:"idle",cancelledAt:performance.now()}),this.pendingTileReveals.delete(u);return}let b=e.getImageUrl(n);this.setTileState(t,n,{...m,state:"loading",url:b,requestedAt:m.requestedAt||performance.now(),error:void 0});try{let w=`${u}::${h}`,E=this.imageRequestPool.acquire(b,w);this.inFlightImageLoads.set(u,{tileKey:u,requestKey:h,url:b,consumerId:w,paint:e,imageBuffer:t,index:n,release:E.release});let T=await E.promise;this.releaseInFlightTileLoad(u,{silent:!0});let S=this.getTileState(t,n);if(S.lastRequestKey!==h||S.state!=="loading")return;this.loadingQueueOrdered=!1,this.loadingQueue.push({id:`${f}--decode`,scale:e.display.scale,kind:"decode",tileKey:u,requestKey:h,distance:i,paint:e,index:n,prefetch:a,task:()=>new Promise(R=>{let A=this.getTileState(t,n);if(A.lastRequestKey!==h||A.state!=="loading"){R();return}let M=e.display.points.slice(n*5,n*5+5),z=document.createElement("canvas"),I=z.getContext("2d");z.width=M[3]-M[1],z.height=M[4]-M[2],this.hostCache.set(t.canvases[n],z),this.drawCalls.push(()=>{let L=this.getTileState(t,n);if(L.lastRequestKey!==h||L.state!=="loading"){R();return}I.drawImage(T,0,0,M[3]-M[1],M[4]-M[2]);let H=this.getTileState(t,n);this.setTileState(t,n,{...H,state:"decoded",loadedAt:void 0,error:void 0,attempts:0,nextRetryAt:void 0}),this.enqueueTileReveal(u,t,n),this.imagesLoaded++,R()})})})}catch(w){if(this.releaseInFlightTileLoad(u,{silent:!0}),I3(w)){let A=this.getTileState(t,n);A.lastRequestKey===h&&this.setTileState(t,n,{...A,state:"idle",cancelledAt:performance.now()}),this.pendingTileReveals.delete(u);return}let E=this.getTileState(t,n);if(E.lastRequestKey!==h)return;let T=(E.attempts||0)+1,S=T<this.imageLoadingConfig.maxAttempts,R=S?performance.now()+_3(this.imageLoadingConfig,T):performance.now()+this.imageLoadingConfig.errorRetryIntervalMs;this.setTileState(t,n,{...E,state:S?"idle":"error",error:w,attempts:T,nextRetryAt:R}),this.pendingTileReveals.delete(u),this.emitImageError({severity:"recoverable",imageUrl:b,contentId:e.id,tileIndex:n,attempt:T,maxAttempts:this.imageLoadingConfig.maxAttempts,willRetry:S,nextRetryAt:R,error:w})}}}),!0}afterPaintLayer(t,e){}prepareLayer(t,e){if(this.hasActiveLayerClip=!1,t.__owner.value&&(t.cropData&&this.lastKnownScale*(1/t.display.scale),this.applyTransform(t,e[1],e[2],e[3]-e[1],e[4]-e[2])),this.shouldClipLayerToBounds(t)){let n=this.getBoundsFromPoints(e);n&&(this.ctx.save(),this.ctx.beginPath(),this.ctx.rect(n.x,n.y,n.width,n.height),this.ctx.clip(),this.hasActiveLayerClip=!0)}(!t.__host||!t.__host.canvas)&&(t instanceof gi||t instanceof Ri)&&this.createImageHost(t)}finishLayer(){this.hasActiveLayerClip&&(this.ctx.restore(),this.hasActiveLayerClip=!1),this.lastPaintedObject&&this.clearTransform()}createImageHost(t){t.__host=t.__host?t.__host:{},t.__host.canvas={canvas:void 0,canvases:[],tiles:{},indices:[],loaded:[],loading:!1}}getPointsAt(t,e,n,i){return t.getPointsAt(e,n,i)}getViewportBounds(t,e,n){let i=t.getActiveZone();if(i){i.recalculateBounds();let a=A3(e,i.points,n);if(a){let r=e[3]-e[1],l=e[4]-e[2];return{x1:a.minX,y1:a.minY,x2:a.maxX+r,y2:a.maxY+l}}}return null}pendingUpdate(){this.imagesPending=this.loadingQueue.length+this.tasksRunning+this.inFlightImageLoads.size+this.pendingTileReveals.size;let t=!this.pendingDrawCall&&this.drawCalls.length===0&&this.loadingQueue.length===0&&this.tasksRunning===0&&this.inFlightImageLoads.size===0&&this.pendingTileReveals.size===0;return!t&&this.visible.length===0&&this.options.readiness!=="immediate"&&this.fallbackRevealTimeout===null&&(this.fallbackRevealTimeout=setTimeout(()=>{this.canvas.style.opacity="1",this.firstMeaningfulPaint=!0,this.fallbackRevealTimeout=null},500)),!this.firstMeaningfulPaint&&t&&(this.visible.length||this.options.readiness==="immediate")?(this.canvas.style.opacity="1",this.firstMeaningfulPaint=t,!0):this.options.debug||this.hasTilesFading?!0:!t}getRendererScreenPosition(){return this.rendererPosition}resetReadyState(){this.options.readiness!=="immediate"&&(this.firstMeaningfulPaint=!1,this.fallbackRevealTimeout&&(clearTimeout(this.fallbackRevealTimeout),this.fallbackRevealTimeout=null))}reset(){this.loadingQueue=[],this.drawCalls=[],this._scheduled&&(clearInterval(this._scheduled),this._scheduled=0);for(let t of[...this.inFlightImageLoads.keys()])this.releaseInFlightTileLoad(t,{silent:!0});this.imageRequestPool.cancelAll({silent:!0}),this.inFlightImageLoads.clear(),this.requiredTileKeys.clear(),this.requiredPrefetchTileKeys.clear(),this.pendingTileReveals.clear(),this.requestGeneration+=1,this.frameCounter=0,this.fallbackRevealTimeout&&(clearTimeout(this.fallbackRevealTimeout),this.fallbackRevealTimeout=null),this.imagesPending=0,this.imagesLoaded=0,this.hasTilesFading=!1}},D3=class{constructor(t){C(this,"renderers",[]),C(this,"length",void 0);for(let e of t)e&&this.renderers.push(e);this.length=this.renderers.length}afterFrame(t,e,n,i){for(let a=0;a<this.length;a++)this.renderers[a].afterFrame(t,e,n,i)}afterPaintLayer(t,e){for(let n=0;n<this.length;n++)this.renderers[n].afterPaintLayer(t,e)}beforeFrame(t,e,n,i){for(let a=0;a<this.length;a++)this.renderers[a].beforeFrame(t,e,n,i)}triggerResize(){for(let t=0;t<this.length;t++){let e=this.renderers[t];e.triggerResize&&e.triggerResize()}}getPointsAt(t,e,n,i){return this.renderers[0].getPointsAt(t,e,n,i)}getScale(t,e){return this.renderers[0].getScale(t,e)}getViewportBounds(t,e,n){return this.renderers[0].getViewportBounds(t,e,n)}getRendererScreenPosition(){return this.renderers[0].getRendererScreenPosition()}isReady(){for(let t=0;t<this.length;t++)if(!this.renderers[t].isReady())return!1;return!0}paint(t,e,n,i,a,r){for(let l=0;l<this.length;l++)this.renderers[l].paint(t,e,n,i,a,r)}pendingUpdate(){for(let t=0;t<this.length;t++)if(this.renderers[t].pendingUpdate())return!0;return!1}prepareLayer(t,e){for(let n=0;n<this.length;n++)this.renderers[n].prepareLayer(t,e)}finishLayer(t,e){for(let n=0;n<this.length;n++)this.renderers[n].finishLayer(t,e)}resize(t,e){for(let n=0;n<this.length;n++)this.renderers[n].resize(t,e)}reset(){for(let t=0;t<this.length;t++)this.renderers[t].reset()}resetReadyState(){for(let t=0;t<this.length;t++)this.renderers[t].resetReadyState&&this.renderers[t].resetReadyState()}},I8=class extends kr{constructor(...t){super(...t),C(this,"type","spacial-content")}getAllPointsAt(t,e,n){return[[this,this.points,e]]}},oR=class extends I8{constructor(t){super(),C(this,"id",void 0),C(this,"display",void 0),C(this,"points",void 0),C(this,"images",[]),C(this,"allImages",[]),C(this,"scaleFactors",[]),C(this,"aggregateBuffer",It(9)),C(this,"lazyLoader",void 0),C(this,"isFullyLoaded",!1),C(this,"isLoadingFullResource",!1),C(this,"maxScaleFactor",0),C(this,"layerSelection",new WeakMap),C(this,"layerSelectionFrame",0),C(this,"renderOptions",void 0),C(this,"_scheduleSortByScales",!1),C(this,"_sortByScales",()=>{this._scheduleSortByScales=!1,this.allImages.sort((n,i)=>i.display.width-n.display.width),this.images=[];let e=.1;for(let n of this.allImages)if(!(n.display.width<this.renderOptions.minSize&&n.display.height<this.renderOptions.minSize&&!n.priority)&&!(n instanceof gi&&(n.display.width>this.renderOptions.maxImageSize||n.display.height>this.renderOptions.maxImageSize)&&!n.priority)){if(Math.abs(n.display.scale-e)<.25||n.priority){let i=this.images.pop();i&&(i instanceof gi||i.priority)?(n.priority&&this.images.push(n),this.images.push(i)):n&&this.images.push(n)}else n&&this.images.push(n);e=n.display.scale}this.images.length===0&&(this.images=[...this.allImages]),this.scaleFactors=this.images.map(n=>n.display.scale),this.maxScaleFactor=this.scaleFactors.length?Math.max(...this.scaleFactors):0}),C(this,"loadFullResource",async()=>{if(!(this.isFullyLoaded||this.isLoadingFullResource)&&this.lazyLoader){this.isLoadingFullResource=!0;try{let e=await this.lazyLoader();this.addImages(e||[]),this.isFullyLoaded=!0}finally{this.isLoadingFullResource=!1}}}),C(this,"fallback",[this.loadFullResource]),this.id=t.id,this.points=de.singleBox(t.width,t.height),this.lazyLoader=t.loadFullImages,t.loadFullImages||(this.isFullyLoaded=!0),this.display={x:0,y:0,points:de.singleBox(t.width,t.height),height:t.height,width:t.width,scale:1},this.renderOptions={renderSmallestFallback:!0,renderLayers:2,minSize:255,maxImageSize:2048,quality:1.3,useDevicePixelRatio:!0,layerPolicy:"always-blend",loadingBias:"balanced",prefetchRadius:1,fadeInMs:300,fadeFallbackTiles:!1,fadeOnLayerChange:!1,clipToBounds:!1,...t.renderOptions||{}},this.addImages(t.images)}applyProps(t){let e=!1;t.renderSmallestFallback!==void 0&&t.renderSmallestFallback!==this.renderOptions.renderSmallestFallback&&(this.renderOptions.renderSmallestFallback=t.renderSmallestFallback),t.renderLayers!==void 0&&t.renderLayers!==this.renderOptions.renderLayers&&(this.renderOptions.renderLayers=t.renderLayers),t.minSize!==void 0&&t.minSize!==this.renderOptions.minSize&&(this.renderOptions.minSize=t.minSize,e=!0),t.maxImageSize!==void 0&&t.maxImageSize!==this.renderOptions.maxImageSize&&(this.renderOptions.maxImageSize=t.maxImageSize,e=!0),t.quality!==void 0&&t.quality!==this.renderOptions.quality&&(this.renderOptions.quality=t.quality),t.useDevicePixelRatio!==void 0&&t.useDevicePixelRatio!==this.renderOptions.useDevicePixelRatio&&(this.renderOptions.useDevicePixelRatio=t.useDevicePixelRatio),t.layerPolicy!==void 0&&t.layerPolicy!==this.renderOptions.layerPolicy&&(this.renderOptions.layerPolicy=t.layerPolicy),t.loadingBias!==void 0&&t.loadingBias!==this.renderOptions.loadingBias&&(this.renderOptions.loadingBias=t.loadingBias),t.prefetchRadius!==void 0&&t.prefetchRadius!==this.renderOptions.prefetchRadius&&(this.renderOptions.prefetchRadius=t.prefetchRadius),t.fadeInMs!==void 0&&t.fadeInMs!==this.renderOptions.fadeInMs&&(this.renderOptions.fadeInMs=t.fadeInMs),t.fadeFallbackTiles!==void 0&&t.fadeFallbackTiles!==this.renderOptions.fadeFallbackTiles&&(this.renderOptions.fadeFallbackTiles=t.fadeFallbackTiles),t.fadeOnLayerChange!==void 0&&t.fadeOnLayerChange!==this.renderOptions.fadeOnLayerChange&&(this.renderOptions.fadeOnLayerChange=t.fadeOnLayerChange),t.clipToBounds!==void 0&&t.clipToBounds!==this.renderOptions.clipToBounds&&(this.renderOptions.clipToBounds=t.clipToBounds),e&&this.sortByScales()}appendChild(t){this.addImages([t])}removeChild(t){if(this.images.indexOf(t)===-1&&this.allImages.indexOf(t)===-1)return;let e=this.getImageDedupeKey(t);this.images=this.images.filter(n=>n!==t&&this.getImageDedupeKey(n)!==e),this.allImages=this.allImages.filter(n=>n!==t&&this.getImageDedupeKey(n)!==e),this.sortByScales()}insertBefore(t,e){this.addImages([t])}hideInstance(){}addImages(t){let e=new Set(this.allImages),n=new Set(this.allImages.map(i=>this.getImageDedupeKey(i)));for(let i of t){if(!i||e.has(i))continue;let a=this.getImageDedupeKey(i);n.has(a)||(i.__parent=this,i.__owner=this.__owner,this.allImages.push(i),e.add(i),n.add(a))}this.sortByScales()}getImageDedupeKey(t){return`${t.id}::${t.display.scale}`}sortByScales(){this._scheduleSortByScales=!0}getScheduledUpdates(t,e){return this._scheduleSortByScales?[this._sortByScales]:this.isFullyLoaded?[]:e>1/this.maxScaleFactor?this.fallback:[]}getAllPointsAt(t,e,n){if(this.images.length===0)return[];let i=this.renderOptions.useDevicePixelRatio&&typeof window<"u"&&window.devicePixelRatio||1,a=m8(1/(n||1)/i,this.images,this.renderOptions.quality),r=this.images.length,l=e?Nr(e,ci(this.x,this.y)):ci(this.x,this.y),u=[a];if(a!==this.images.length-1&&this.images[a+1]){u=[];for(let b=r-1;b>=a;b--)u.push(b);let g=u[0];this.renderOptions.renderLayers&&(u=u.slice(-Math.min(u.length,this.renderOptions.renderLayers))),this.renderOptions.renderSmallestFallback&&u.indexOf(g)===-1&&u.unshift(g)}u.sort((g,b)=>{let w=this.images[g],E=this.images[b],T=w?w.display.scale:0;return(E?E.display.scale:0)-T});let f=new Set;switch(this.renderOptions.layerPolicy){case"always-blend":for(let g of u)f.add(g);break;case"active-only":f.add(a),u=[a];break;case"fallback-only":default:f.add(a),this.renderOptions.renderSmallestFallback&&u.length&&f.add(u[0]);break}let h=new Set;for(let g of f){let b=this.images[g];b&&h.add(b)}this.layerSelectionFrame+=1;let d=this.getNow(),m=d-Math.max(0,this.renderOptions.fadeInMs);for(let g of this.allImages){let b=this.layerSelection.get(g);if(!h.has(g)){this.layerSelection.set(g,{active:!1,frame:this.layerSelectionFrame});continue}let w=!!b&&b.frame===this.layerSelectionFrame-1,E=w&&b.active;this.layerSelection.set(g,{active:!0,frame:this.layerSelectionFrame,activatedAt:E&&typeof b.activatedAt=="number"?b.activatedAt:w?d:m})}let y=[];for(let g=0;g<u.length;g++){let b=u[g],w=this.images[b];y.push(...w.getAllPointsAt(t,l,n))}return y}isImageActive(t){let e=this.layerSelection.get(t);return!!e&&e.frame===this.layerSelectionFrame&&e.active}getImageActivatedAt(t){let e=this.layerSelection.get(t);if(!(!e||e.frame!==this.layerSelectionFrame||!e.active))return e.activatedAt}getNow(){return typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now()}},_v=class extends kr{constructor(t){if(super(),C(this,"type","spacial-content"),C(this,"id",void 0),C(this,"uri",void 0),C(this,"display",void 0),C(this,"points",void 0),C(this,"getTexture",void 0),this.getTexture=()=>({source:void 0,hash:-1}),!t)this.id="",this.uri="",this.display={x:0,y:0,scale:1,width:0,height:0,points:It(5)},this.points=It(5);else{let e=t.scale||1;this.id=t.id||t.uri,this.uri=t.uri,this.points=de.singleBox(t.width,t.height),this.display={x:0,y:0,scale:e,width:t.width/e,height:t.height/e,points:e===1?this.points:de.singleBox(t.width/e,t.height/e)}}}applyProps(t){let e=t.display?t.display.width:t.target.width,n=t.target.width/e;this.id=t.id,this.points.set(de.singleBox(t.target.width,t.target.height)),this.display.scale=n,this.display.width=t.target.width/n,this.display.height=t.target.height/n,this.getTexture=t.getTexture,this.display.points=n===1?this.points:de.singleBox(t.target.width/n,t.target.height/n)}getAllPointsAt(t,e,n){return[[this,this.points,e]]}},vv=85.05112878;function yr(t,e){if(!Number.isFinite(t))throw Error(`${e} must be a finite number`)}function KL(t,e){if(yr(t,e),t<=0)throw Error(`${e} must be greater than 0`)}function N8(t){if(!Number.isFinite(t))throw Error("Latitude must be a finite number");return t>vv?vv:t<-vv?-vv:t}function zv(t){if(yr(t.west,"Map bounds west"),yr(t.south,"Map bounds south"),yr(t.east,"Map bounds east"),yr(t.north,"Map bounds north"),t.west<-180||t.west>180)throw Error("Map bounds west must be within [-180, 180]");if(t.east<-180||t.east>180)throw Error("Map bounds east must be within [-180, 180]");if(t.south<-90||t.south>90)throw Error("Map bounds south must be within [-90, 90]");if(t.north<-90||t.north>90)throw Error("Map bounds north must be within [-90, 90]");if(t.west>=t.east)throw Error("Map bounds must satisfy west < east (antimeridian crossing is not supported)");if(t.south>=t.north)throw Error("Map bounds must satisfy south < north");return t}function Av(t){if(!Number.isFinite(t))throw Error("Longitude must be a finite number");return(t+180)/360}function Cv(t){let e=N8(t)*Math.PI/180;return(1-Math.log(Math.tan(e)+1/Math.cos(e))/Math.PI)/2}function P3(t){if(!Number.isFinite(t))throw Error("Mercator X must be a finite number");return t*360-180}function B3(t){if(!Number.isFinite(t))throw Error("Mercator Y must be a finite number");let e=Math.PI*(1-2*t);return 180/Math.PI*Math.atan(Math.sinh(e))}function ZL(t,e){return Av(t)*2**e}function WL(t,e){return Cv(t)*2**e}function JL(t,e){return P3(t/2**e)}function $L(t,e){return B3(t/2**e)}function L8(t){let e=zv(t.bounds);KL(t.width,"Map world width"),KL(t.height,"Map world height");let n=Av(e.west),i=Av(e.east),a=Cv(e.north),r=Cv(e.south),l=i-n,u=r-a;if(!(l>0))throw Error("Map bounds produce an invalid mercator X span");if(!(u>0))throw Error("Map bounds produce an invalid mercator Y span");let f=(d,m)=>{let y=Av(d),g=Cv(m);return{x:(y-n)/l*t.width,y:(g-a)/u*t.height}},h=(d,m)=>{yr(d,"World x"),yr(m,"World y");let y=n+d/t.width*l,g=a+m/t.height*u;return{lng:P3(y),lat:B3(g)}};return{lngLatToWorld:f,worldToLngLat:h,lngLatBoundsToWorldRect:d=>{zv(d);let m=f(d.west,d.north),y=f(d.east,d.south);return{x:m.x,y:m.y,width:y.x-m.x,height:y.y-m.y}},worldRectToLngLatBounds:d=>{yr(d.x,"World rect x"),yr(d.y,"World rect y"),yr(d.width,"World rect width"),yr(d.height,"World rect height");let m=h(d.x,d.y),y=h(d.x+d.width,d.y+d.height);return{west:m.lng,south:y.lat,east:y.lng,north:m.lat}},projectRing:d=>{let m=[];for(let[y,g]of d){let b=f(y,g);m.push([b.x,b.y])}return m}}}var H3="https://tile.openstreetmap.org/{z}/{x}/{y}.png";function D8(t){if(t.s)return t.s;let e=t.subdomains||[];if(e.length!==0)return e[Math.abs(t.x+t.y+t.z)%e.length]}function P8(t,e){let n=D8(e)||"";return t.replace(/\{z\}/g,`${e.z}`).replace(/\{x\}/g,`${e.x}`).replace(/\{y\}/g,`${e.y}`).replace(/\{s\}/g,n)}function B8(t,e){let n=t||H3;return typeof n=="function"?n(e):P8(n,e)}function ks(t,e,n){return Math.min(n,Math.max(e,t))}function H8(t){zv(t.bounds);let e=Math.max(0,Math.floor(t.zoom)),n=2**e,i=n-1,a=ZL(t.bounds.west,e),r=ZL(t.bounds.east,e),l=WL(t.bounds.north,e),u=WL(t.bounds.south,e),f=ks(a,0,n),h=ks(r,0,n),d=ks(l,0,n),m=ks(u,0,n),y=Math.max(1e-9,h-f),g=Math.max(1e-9,m-d),b=ks(Math.floor(a),0,i),w=ks(Math.ceil(r)-1,0,i),E=ks(Math.floor(l),0,i),T=ks(Math.ceil(u)-1,0,i),S=Math.max(1,w-b+1),R=Math.max(1,T-E+1);return{columns:S,rows:R,count:S*R,minTileX:b,maxTileX:w,minTileY:E,maxTileY:T,westTile:f,eastTile:h,northTile:d,southTile:m,tileSpanX:y,tileSpanY:g}}function F8(t){zv(t.bounds);let e=Math.max(0,Math.floor(t.zoom)),n=L8({bounds:t.bounds,width:t.worldWidth,height:t.worldHeight}),i=H8({bounds:t.bounds,zoom:e}),a=typeof t.maxTiles=="number"?t.maxTiles:1/0;if(i.count>a)throw Error(`Map tile grid too large at zoom ${e}: ${i.count} tiles exceeds the configured max (${a})`);let r=[],l=[];for(let u=i.minTileY;u<=i.maxTileY;u++)for(let f=i.minTileX;f<=i.maxTileX;f++){let h=JL(f,e),d=JL(f+1,e),m=$L(u,e),y=$L(u+1,e),g=n.lngLatToWorld(h,m),b=n.lngLatToWorld(d,y);r.push(1,g.x,g.y,b.x,b.y),l.push({x:f,y:u,z:e})}return{points:It(r.length?r:[0]),tiles:l,columns:i.columns,rows:i.rows,count:i.count,minTileX:i.minTileX,maxTileX:i.maxTileX,minTileY:i.minTileY,maxTileY:i.maxTileY}}var q8=class extends Ri{constructor(t){let e=t.scaleFactor||1,n=t.tileSize||256,i=t.tileSource||t.tileUrlTemplate||H3,a=F8({bounds:t.bounds,zoom:t.zoom,worldWidth:t.worldWidth,worldHeight:t.worldHeight}),r=t.id||`map-tiled-image-z${t.zoom}-${t.worldWidth}x${t.worldHeight}-${a.minTileX}:${a.maxTileX}-${a.minTileY}:${a.maxTileY}`;super({id:r,url:"map://tile-source",scaleFactor:e,points:a.points,displayPoints:a.points,tileWidth:n,tileHeight:n,width:t.worldWidth,height:t.worldHeight,columns:a.columns,rows:a.rows,format:"png",version3:!1}),C(this,"zoom",void 0),C(this,"bounds",void 0),C(this,"worldWidth",void 0),C(this,"worldHeight",void 0),C(this,"tileSize",void 0),C(this,"tileSource",void 0),C(this,"subdomains",void 0),C(this,"tileCoordinates",void 0),C(this,"minTileX",void 0),C(this,"maxTileX",void 0),C(this,"minTileY",void 0),C(this,"maxTileY",void 0),this.zoom=Math.max(0,Math.floor(t.zoom)),this.bounds={...t.bounds},this.worldWidth=t.worldWidth,this.worldHeight=t.worldHeight,this.tileSize=n,this.tileSource=i,this.subdomains=[...t.subdomains||[]],this.tileCoordinates=a.tiles,this.minTileX=a.minTileX,this.maxTileX=a.maxTileX,this.minTileY=a.minTileY,this.maxTileY=a.maxTileY}getImageUrl(t){let e=this.tileCoordinates[t];return e?B8(this.tileSource,{z:e.z,x:e.x,y:e.y,tileSize:this.tileSize,subdomains:this.subdomains}):""}},U8=class{constructor(t){C(this,"canvas",void 0),C(this,"context",void 0),C(this,"heightRatio",1),C(this,"widthRatio",1),C(this,"target",new Float32Array(5)),C(this,"initialWidth",void 0),C(this,"initialHeight",void 0),C(this,"bounds",void 0),C(this,"aggregate",void 0),C(this,"delta",0),C(this,"renderNextFrame",!0),this.canvas=t,this.initialWidth=t.width,this.initialHeight=t.height,this.context=t.getContext("2d"),this.context.globalAlpha=.5,this.aggregate=ho(1)}isReady(){return!0}resize(){this.initialWidth=this.canvas.width,this.initialHeight=this.canvas.height,this.renderNextFrame=!0}afterFrame(t,e,n){if(this.renderNextFrame){this.context.clearRect(0,0,this.canvas.width,this.canvas.height);let i=this.initialWidth/t.width,a=this.initialHeight/t.height,r=this.widthRatio>this.heightRatio?i:a;if(this.target=n,this.bounds){let l=t.getPointsAt(this.bounds,this.aggregate,r);for(let[u,f]of l)if(u instanceof gi&&u.__host.canvas){let h=f.length/5;for(let d=0;d<h;d++)u.__host.canvas.canvases[d]&&(f[d+1]*r,f[d+2]*r,(f[d+3]-f[d+1])*r,(f[d+4]-f[d+2])*r)}}t.getPoints().forEach((l,u,f)=>{if(u%5==0&&l){let h={x1:f[u+1]*r,y1:f[u+2]*r,x2:f[u+3]*r,y2:f[u+4]*r,width:(f[u+3]-f[u+1])*r,height:(f[u+4]-f[u+2])*r};this.context.strokeStyle="red",this.context.strokeRect(h.x1,h.y1,h.width,h.height)}}),n&&(this.context.strokeStyle="red",this.context.lineWidth=window.devicePixelRatio||1,this.context.strokeRect(n[1]*r,n[2]*r,(n[3]-n[1])*r,(n[4]-n[2])*r))}}getActiveZone(t){return null}getPointsAt(t,e,n,i){return t.getPointsAt(e,n,i)}getScale(t,e){return 1}beforeFrame(t,e){this.bounds=de.singleBox(t.width,t.height)}drawImage(){}afterPaintLayer(t,e){}paint(t,e,n,i,a,r){this.renderNextFrame=!0}prepareLayer(t){}pendingUpdate(){return!1}hasActiveZone(){return!1}getViewportBounds(t,e,n){return null}getRendererScreenPosition(){return this.canvas.getBoundingClientRect()}finishLayer(){}reset(){}};function bv(t,e,n,i,a){let r=Math.PI/180*a,l=Math.cos(r),u=Math.sin(r);return[l*(n-t)+u*(i-e)+t,l*(i-e)-u*(n-t)+e]}var Do=class F3 extends kr{constructor(e,n){super(),C(this,"id",void 0),C(this,"type","world-object"),C(this,"scale",void 0),C(this,"layers",void 0),C(this,"points",void 0),C(this,"worldPoints",void 0),C(this,"intersectionBuffer",It(5)),C(this,"aggregateBuffer",It(9)),C(this,"invertedBuffer",It(9)),C(this,"rotation",0),C(this,"filteredPointsBuffer",void 0),C(this,"_updatedList",[]),C(this,"geometry",void 0);let{x:i=0,y:a=0}=n||{};e?(this.id=e.id||"",this.scale=1,this.layers=e.layers,this.points=It([1,i,a,i+e.width,a+e.height]),this.worldPoints=It([1,i,a,i+e.width,a+e.height]),this.filteredPointsBuffer=It(e.layers.length*5)):(this.id="",this.scale=1,this.layers=[],this.points=It(5),this.worldPoints=It(5),this.filteredPointsBuffer=It(5))}static createWithProps(e){let n=new F3;return n.applyProps(e),n}applyProps(e){let n=e.x||0,i=e.y||0;e.id!==void 0&&(this.id=e.id);let a=e.scale===void 0?this.scale:e.scale;this.points[0]=1,this.points[1]=n,this.points[2]=i,this.points[3]=n+e.width,this.points[4]=i+e.height,this.rotation=e.rotation||0,this.worldPoints[3]=this.worldPoints[1]+e.width,this.worldPoints[4]=this.worldPoints[2]+e.height,e.scale&&e.scale!==1&&this.atScale(a),this.scale=a}appendChild(e){e.points[0]===0&&e.points.set(this.points),e.__owner.value=this,this.addLayers([e])}removeChild(e){this.layers=this.layers.filter(n=>n!==e),this.filteredPointsBuffer=It(this.layers.length*5)}insertBefore(e,n){let i=this.layers.indexOf(n);if(i===-1||this.layers.indexOf(e)!==-1)return;let a=this.layers.slice(0,i),r=this.layers.slice(i);this.layers=[...a,e,...r]}hideInstance(){console.warn("hideInstance: not yet implemented")}getObjectsAt(e,n){if(this.rotation&&(e=this.applyRotation(e)),Ac(this.points,e,this.filteredPointsBuffer)[0]===0)return[];let i=this.layers.length,a=[];for(let r=0;r<i;r++){let l=this.layers[r];if(n&&l.isShape){let u=Xi(l.points,ci(this.x,this.y));if(!l.intersects([e[1]-u[1],e[2]-u[2]]))continue}if(Ac(Xi(l.points,ci(this.x,this.y)),e,this.filteredPointsBuffer)[0]!==0&&a.push(l),n){let u=l;a.push(...u.getObjectsAt(e,n))}}return a}applyRotation(e){if(this.rotation){let n={x:e[1],y:e[2]},i={x:e[1],y:e[4]},a={x:e[3],y:e[2]},r={x:e[3],y:e[4]},l=this.points[1]+(this.points[3]-this.points[1])/2,u=this.points[2]+(this.points[4]-this.points[2])/2,[f,h]=bv(l,u,n.x,n.y,this.rotation),[d,m]=bv(l,u,i.x,i.y,this.rotation),[y,g]=bv(l,u,a.x,a.y,this.rotation),[b,w]=bv(l,u,r.x,r.y,this.rotation),E=Math.min(f,d,y,b),T=Math.max(f,d,y,b),S=Math.min(h,m,g,w),R=Math.max(h,m,g,w);return It([e[0],E,S,T,R])}return e}getAllPointsAt(e,n,i){let a=Nr(ci(this.x,this.y),ho(this.scale),this.aggregateBuffer);this.rotation&&(e=this.applyRotation(e));let r=wO(e,this.points,this.intersectionBuffer),l=this.layers.length,u=[],f=Xi(r,Nr(ho(1/this.scale),ci(-this.x,-this.y),this.invertedBuffer)),h=n?Nr(n,a,this.aggregateBuffer):a,d=i*this.scale;for(let m=0;m<l;m++)u.push(...this.layers[m].getAllPointsAt(f,h,d));return u}addLayers(e){let n=[];for(let i of e)this.layers.indexOf(i)===-1&&(n.push(i),i.points.length===5&&(i.points[1]<this.worldPoints[1]/this.scale||i.points[2]<this.worldPoints[2]/this.scale||i.points[3]>this.worldPoints[3]/this.scale||i.points[4]>this.worldPoints[4]/this.scale)&&(i.crop=i.crop||It([1,Math.max(this.worldPoints[1]/this.scale,i.points[1]),Math.max(this.worldPoints[2]/this.scale,i.points[2]),Math.min(this.worldPoints[3]/this.scale,i.points[3]),Math.min(this.worldPoints[4]/this.scale,i.points[4])])));this.layers=this.layers.concat(n),this.filteredPointsBuffer=It(this.layers.length*5)}getScheduledUpdates(e,n){let i=this.layers.length;this._updatedList=[];let a=n*this.scale;for(let r=0;r<i;r++){let l=this.layers[r].getScheduledUpdates(e,a);l&&this._updatedList.push(...l)}return this._updatedList}},fu=class q3 extends kr{get x(){return 0}get y(){return 0}get width(){return this._width}get height(){return this._height}constructor(e=0,n=0,i=100,a="left-to-right"){super(),C(this,"id","world"),C(this,"_width",void 0),C(this,"_height",void 0),C(this,"aspectRatio",void 0),C(this,"viewingDirection",void 0),C(this,"aggregateBuffer",It(9)),C(this,"isDirty",!1),C(this,"zones",[]),C(this,"filteredPointsBuffer",void 0),C(this,"selectedZone",void 0),C(this,"triggerQueue",[]),C(this,"activatedEvents",[]),C(this,"_updatedList",[]),C(this,"translationBuffer",It(9)),C(this,"needsRecalculate",!0),C(this,"emptyPaintables",[]),C(this,"renderOrder",[]),C(this,"debugSubscribers",new Set),C(this,"zoneVisibilityFadeDurationMs",220),C(this,"zoneOutsideOpacity",.2),C(this,"zoneVisibilityFade",void 0),C(this,"points",void 0),C(this,"objects",[]),C(this,"subscriptions",[]),C(this,"_propagateEventTargets",[]),C(this,"_alreadyFlushed",[]),this._width=e,this._height=n,this.aspectRatio=Number.isNaN(e/n)?1:e/n,this.viewingDirection=a,this.points=It(i*5),this.filteredPointsBuffer=It(i*5)}static withProps(e){let n=new q3;return n.applyProps(e),n}applyProps(e){e.width!==void 0&&e.height!==void 0&&(e.width!==this._width||e.height!==this._height)&&this.resize(e.width,e.height),e.viewingDirection!==this.viewingDirection&&(this.viewingDirection=e.viewingDirection,this.triggerRepaint())}propagateTouchEvent(e,n,i){let a=[];for(let r of i)if(r.x&&r.y){let l=de.singleBox(1,1,r.x,r.y);a.push(this.getObjectsAt(l,!0).reverse())}return this.emitDebug({type:"touch",at:performance.now(),event:e,touches:i.length}),a.map(r=>this.propagateEvent(e,n,r,{bubbles:!0,cancelable:!0}))}propagatePointerEvent(e,n,i,a,r={}){let l=de.singleBox(1,1,i,a),u=this.getObjectsAt(l,!0).reverse(),f=this.propagateEvent(e,n,u,r);return this.emitDebug({type:"pointer",at:performance.now(),event:e,x:i,y:a,targets:f.length}),f}propagateEvent(e,n,i,{bubbles:a=!1,cancelable:r=!1}={}){n.atlasTarget=this,this._propagateEventTargets.length=1,this._propagateEventTargets[0]=this;let l=!1;n.stopPropagation=()=>{l=!0};let u=i.length;for(let d=u-1;d>=0;d--){this._propagateEventTargets.unshift(i[d][0]);let m=i[d][1].length;if(m)for(let y=0;y<m;y++)this._propagateEventTargets.unshift(i[d][1][y])}let f=this._propagateEventTargets.length,h=!1;for(let d=0;d<f&&(n.atlasTarget=this._propagateEventTargets[d],n.atlasWorld=this,h=this._propagateEventTargets[d].dispatchEvent(e,n)||h,!l);d++);return h&&this.triggerRepaint(),this._propagateEventTargets}appendChild(e){let n=this.appendWorldObject(e);this.renderOrder.push(n/5)}removeChild(e){let n=this.objects.indexOf(e);if(n===-1){for(let i of this.objects)if(i&&i.id===e.id){this.removeChild(i);return}return}this.objects[n]=null,this.renderOrder=this.renderOrder.filter(i=>i!==n),this.points[n*5]=0;for(let i of this.zones){let a=i.objects.indexOf(e);a!==-1&&(i.objects.splice(a,1),i.recalculateBounds())}this.triggerRepaint(),this.needsRecalculate=!0}insertBefore(e,n){let i=this.objects.indexOf(n);if(i===-1)return;let a=this.appendWorldObject(e);this.renderOrder.splice(i-1,0,a/5)}hideInstance(){}asWorldObject(){return null}addZone(e){this.zones.push(e)}removeZone(e){let n=this.zones.indexOf(e);if(n!==-1&&(this.zones.splice(n,1),this.selectedZone!==void 0)){if(this.selectedZone===n){this.selectedZone=void 0,this.trigger("zone-changed");return}this.selectedZone>n&&--this.selectedZone}}getZoneById(e){for(let n of this.zones)if(n.id===e)return n}hasZone(e){return this.getZoneById(e)!==void 0}selectZone(e){if(typeof e=="string"){let n=this.getZoneById(e);n&&(this.selectedZone=this.zones.indexOf(n),this.zoneVisibilityFade={zoneId:n.id,startedAt:performance.now()},this.trigger("zone-changed"))}else this.zones[e]&&(this.selectedZone=e,this.zoneVisibilityFade={zoneId:this.zones[e].id,startedAt:performance.now()},this.trigger("zone-changed"))}deselectZone(){this.selectedZone=void 0,this.zoneVisibilityFade=void 0,this.trigger("zone-changed")}getActiveZone(){if(this.selectedZone!==void 0)return this.zones[this.selectedZone]}hasActiveZone(){return this.selectedZone!==void 0}checkResizeInternalBuffer(){if(TO(this.points)===this.objects.length){let e=this.points,n=It(this.points.length*2);n.set(e,0),this.points=n}}appendWorldObject(e){this.checkResizeInternalBuffer();let n=this.objects.length*5,i=e.points;return e.points=this.points.subarray(this.objects.length*5,this.objects.length*5+5),e.points[1]=i[1],e.points[2]=i[2],e.points[3]=i[3],e.points[4]=i[4],this.objects.push(e),this.filteredPointsBuffer=It(this.objects.length*5),this.needsRecalculate=!0,this.triggerRepaint(),n}recalculateWorldSize(){let e=!1;if(this.needsRecalculate){let n=new Int32Array(this.objects.length),i=new Int32Array(this.objects.length),a=this.renderOrder.length;for(let u=0;u<a;u++){let f=this.renderOrder[u];this.objects[f]&&(n[u]=this.points[f*5+3],i[u]=this.points[f*5+4])}let r=Math.max(...n);r!==this._width&&(this._width=r,e=!0);let l=Math.max(...i);l!==this._height&&(this._height=l,e=!0),e&&this.trigger("recalculate-world-size",{width:r,height:l}),this.needsRecalculate=!1}return e}addObjectAt(e,n){n.width&&!n.height?n.height=n.width/e.width*e.height:n.height&&!n.width&&(n.width=n.height/e.height*e.width),(!n||!n.width||!n.height)&&(n.width=e.width,n.height=e.height);let{width:i,x:a,y:r}=n,l=i/e.width;this.checkResizeInternalBuffer(),this.points.set(de.singleBox(e.width,e.height,0,0),this.objects.length*5);let u=new Do(e);return u.points=this.points.subarray(this.objects.length*5,this.objects.length*5+5),this.objects.push(u),this.scaleWorldObject(this.objects.length-1,l),this.translateWorldObject(this.objects.length-1,a,r),this.filteredPointsBuffer=It(this.points.length*2),this.triggerRepaint(),this.needsRecalculate=!0,u}scaleWorldObject(e,n){hr(this.points.subarray(e*5,e*5+5),Ul(n,this.points[e*5+1],this.points[e*5+2]));let i=this.objects[e];i&&(i.atScale(n),this.triggerRepaint())}translateWorldObject(e,n,i){hr(this.points.subarray(e*5,e*5+5),ci(n,i));let a=this.objects[e];a&&(a.translate(n,i),this.triggerRepaint())}resize(e,n){return this._width=e,this._height=n,this.aspectRatio=e/n,this.triggerRepaint(),this}getObjects(){return this.objects}getPoints(){return this.points}getPointsFromViewer(e,n){let i=de.singleBox(e.width,e.height,e.x,e.y);return this.getPointsAt(i,n,e.scale)}addLayoutSubscriber(e){return this.subscriptions.push(e),()=>{this.subscriptions.splice(this.subscriptions.indexOf(e),1)}}getScheduledUpdates(e,n){let i=Ac(this.points,e,this.filteredPointsBuffer),a=this.objects.length;this._updatedList=[];for(let r=0;r<a;r++)if(i[r*5]!==0){if(!this.objects[r])continue;this._updatedList.push(...this.objects[r].getScheduledUpdates(e,n))}return this._updatedList}isZoneOutsideVisibilityFading(e){return!!(this.zoneVisibilityFade&&this.zoneVisibilityFade.zoneId===e.id&&performance.now()-this.zoneVisibilityFade.startedAt<this.zoneVisibilityFadeDurationMs)}getZoneOutsideVisibility(e){let n=this.zoneOutsideOpacity;if(!this.zoneVisibilityFade||this.zoneVisibilityFade.zoneId!==e.id)return n;let i=performance.now()-this.zoneVisibilityFade.startedAt;return i>=this.zoneVisibilityFadeDurationMs?n:1-Math.max(0,Math.min(1,i/this.zoneVisibilityFadeDurationMs))*(1-n)}getObjectsAt(e,n=!1,i=!1){let a=this.getActiveZone(),r=a&&i?this.getZoneOutsideVisibility(a)>0:!1,l=Ac(this.points,e,this.filteredPointsBuffer),u=this.renderOrder.length,f=[];for(let h=0;h<u;h++){let d=this.renderOrder[h];if(l[d*5]!==0){let m=this.objects[d],y=!a||a.objects.indexOf(m)!==-1;if(!m||!y&&!r)continue;if(m.type!=="world-object"){f.push([m,[m]]);continue}n?f.push([m,m.getObjectsAt(e,n)]):f.push([m,this.emptyPaintables])}}return f}getPointsAt(e,n,i=1){let a=this.getActiveZone(),r=a?this.getZoneOutsideVisibility(a):0,l=this.getObjectsAt(e,!1,!0),u=Nr(ho(i),ci(-e[1],-e[2]),this.translationBuffer),f=n?Nr(n,u,this.aggregateBuffer):u,h=l.length,d=[];for(let m=0;m<h;m++)if(l[m]){let y=l[m][0],g=y.getAllPointsAt(e,f,i),b=!a||a.objects.indexOf(y)!==-1?1:r;for(let w=0;w<g.length;w++)g[w][0].__zoneVisibilityAlpha=b;d.push(...g)}return a&&this.isZoneOutsideVisibilityFading(a)&&this.triggerRepaint(),d}flushSubscriptions(){if(this.triggerQueue.length){this._alreadyFlushed=[];let e=this.triggerQueue.length;for(let n=0;n<e;n++){if(this._alreadyFlushed.indexOf(this.triggerQueue[n][0])!==-1)continue;this.triggerQueue[n][1]===void 0&&this._alreadyFlushed.push(this.triggerQueue[n][0]);let i=this.subscriptions.length;for(let a=0;a<i;a++)this.subscriptions[a].apply(null,this.triggerQueue[n])}this.triggerQueue=[]}}trigger(e,n){this.emitDebug({type:"trigger",at:performance.now(),event:e,data:n}),this.triggerQueue.push([e,n])}triggerEventActivation(){this.trigger("event-activation")}triggerRepaint(){this.trigger("repaint")}gotoRegion(e){this.trigger("goto-region",e)}goHome(e=!1,n){this.trigger("go-home",{immediate:e,paddingPx:n})}zoomTo(e,n,i){this.trigger("zoom-to",{point:n,factor:e,stream:i})}zoomIn(e){this.trigger("zoom-to",{point:e,factor:.5})}zoomOut(e){this.trigger("zoom-to",{point:e,factor:2})}constraintBounds(e){this.trigger("constrain-bounds",{immediate:e})}hasPendingAnimation(){return!!(this.zoneVisibilityFade&&performance.now()-this.zoneVisibilityFade.startedAt<this.zoneVisibilityFadeDurationMs)}addDebugSubscriber(e){return this.debugSubscribers.add(e),()=>{this.removeDebugSubscriber(e)}}removeDebugSubscriber(e){this.debugSubscribers.delete(e)}emitDebug(e){if(this.debugSubscribers.size!==0)for(let n of this.debugSubscribers)n(e)}};var V8={background:"rgba(15, 23, 42, 0.7)",objectFill:"rgba(56, 189, 248, 0.22)",objectStroke:"rgba(56, 189, 248, 0.62)",viewportFill:"rgba(251, 191, 36, 0.22)",viewportStroke:"rgba(250, 204, 21, 1)",viewportLineWidth:2};function UT(t){if(!(typeof t!="number"||!Number.isFinite(t)))return Math.floor(t)}function j8(t,e){if(!t||e<=1)return null;let n=UT(t.total),i=UT(t.before),a=UT(t.after),r=n===void 0?i!==void 0||a!==void 0?Math.max(1,Math.max(0,i||0)+Math.max(0,a||0)+1):9:Math.max(1,n),l=i===void 0?void 0:Math.max(0,i),u=a===void 0?void 0:Math.max(0,a);l===void 0&&u===void 0?(l=Math.floor((r-1)/2),u=r-l-1):l===void 0?l=Math.max(0,r-(u||0)-1):u===void 0&&(u=Math.max(0,r-l-1));let f=l+u+1;return f!==r&&(r=f),r=Math.max(1,Math.min(e,r)),l=Math.min(l,r-1),u=r-l-1,{total:r,before:l,after:u}}function k8(t){let e=[];for(let n=0;n<t.zones.length;n++){let i=t.zones[n];i.recalculateBounds(),i.points[0]!==0&&e.push({zone:i,minX:i.points[1],minY:i.points[2],maxX:i.points[3],maxY:i.points[4]})}return e.sort((n,i)=>n.minY===i.minY?n.minX===i.minX?(n.zone?.id||"").localeCompare(i.zone?.id||""):n.minX-i.minX:n.minY-i.minY),e}function U3(t,e){let n=j8(e.zoneWindow,t.zones.length);if(!n)return null;let i=k8(t);if(i.length<=n.total)return i;let a=Y8(i,e.target)-n.before,r=a+n.total-1;return a<0&&(a=0,r=n.total-1),r>=i.length&&(r=i.length-1,a=Math.max(0,r-n.total+1)),i.slice(a,r+1)}function G8(t){if(!t)return null;if(Array.isArray(t)||ArrayBuffer.isView(t)){let e=t;return e[0]===0?null:{x:(e[1]+e[3])/2,y:(e[2]+e[4])/2}}return{x:t.x+t.width/2,y:t.y+t.height/2}}function Y8(t,e){if(t.length===0)return 0;let n=G8(e);if(!n)return 0;for(let r=0;r<t.length;r++){let l=t[r];if(n.x>=l.minX&&n.x<=l.maxX&&n.y>=l.minY&&n.y<=l.maxY)return r}let i=0,a=1/0;for(let r=0;r<t.length;r++){let l=t[r],u=(l.minY+l.maxY)/2,f=Math.abs(n.y-u);f<a&&(a=f,i=r)}return i}function X8(t){if(t.length===0)return null;let e=t[0].minX,n=t[0].minY,i=t[0].maxX,a=t[0].maxY;for(let r=1;r<t.length;r++){let l=t[r];e=Math.min(e,l.minX),n=Math.min(n,l.minY),i=Math.max(i,l.maxX),a=Math.max(a,l.maxY)}return{x:e,y:n,width:Math.max(1,i-e),height:Math.max(1,a-n)}}function ZT(t,e,n,i,a=0,r=0){let l=Math.max(1,t),u=Math.max(1,e),f=Math.min(n/l,i/u),h=l*f,d=u*f;return{scale:f,offsetX:(n-h)/2,offsetY:(i-d)/2,worldX:a,worldY:r,worldWidth:l,worldHeight:u}}function V3(t,e={}){let n=t.getActiveZone();if(n&&(n.recalculateBounds(),n.points[0]!==0))return{x:n.points[1],y:n.points[2],width:Math.max(1,n.points[3]-n.points[1]),height:Math.max(1,n.points[4]-n.points[2])};let i=U3(t,e);if(i&&i.length>0){let a=X8(i);if(a)return a}return{x:0,y:0,width:Math.max(1,t.width),height:Math.max(1,t.height)}}function Q8(t,e={}){let n=t.getActiveZone();if(n)return n.recalculateBounds(),n.points[0]===0?new Set:new Set([n.id]);let i=U3(t,e);if(!i)return null;let a=new Set;for(let r of i)a.add(r.zone.id);return a}function K8(t,e,n){if(!t.scale||!Number.isFinite(t.scale))return{x:t.worldX,y:t.worldY};let i=t.worldX+(e-t.offsetX)/t.scale,a=t.worldY+(n-t.offsetY)/t.scale;return{x:Math.max(t.worldX,Math.min(t.worldX+t.worldWidth,i)),y:Math.max(t.worldY,Math.min(t.worldY+t.worldHeight,a))}}var Z8=class extends U8{constructor(t,e={}){super(t),C(this,"style",void 0),C(this,"maxRects",void 0),C(this,"minVisibleRectSize",void 0),C(this,"drawFallbackBoxes",void 0),C(this,"zoneWindow",void 0),C(this,"sharedCanvasRenderer",void 0),C(this,"onRequestRender",void 0),C(this,"onDebugEvent",void 0),C(this,"baseCanvas",void 0),C(this,"baseContext",void 0),C(this,"worldTarget",de.singleBox(1,1,0,0)),C(this,"previewImageCache",new Map),C(this,"worldLayerDirty",!0),C(this,"lastWorldWidth",0),C(this,"lastWorldHeight",0),C(this,"lastTargetX",NaN),C(this,"lastTargetY",NaN),C(this,"lastTargetX2",NaN),C(this,"lastTargetY2",NaN),C(this,"lastRegionX",NaN),C(this,"lastRegionY",NaN),C(this,"lastRegionWidth",NaN),C(this,"lastRegionHeight",NaN),C(this,"worldLayerInvalidationVersion",0),C(this,"sharedCanvasResourcesPending",!1),this.style={...V8,...e.style||{}},this.maxRects=Math.max(100,e.maxRects||5e3),this.minVisibleRectSize=Math.max(1,e.minVisibleRectSize||1),this.drawFallbackBoxes=e.drawFallbackBoxes!==!1,this.zoneWindow=e.zoneWindow,this.sharedCanvasRenderer=e.sharedCanvasRenderer,this.onRequestRender=e.onRequestRender,this.onDebugEvent=e.onDebugEvent,this.context.globalAlpha=1,this.context.imageSmoothingEnabled=!1,this.baseCanvas=document.createElement("canvas"),this.baseContext=this.baseCanvas.getContext("2d"),this.baseContext.imageSmoothingEnabled=!0,this.syncBaseLayerCanvas()}emitDebugEvent(t){this.onDebugEvent&&this.onDebugEvent(t)}requestRender(t){this.onRequestRender&&(this.emitDebugEvent({type:"render-request-forwarded",reason:t}),this.onRequestRender())}invalidateWorldLayer(t="manual"){this.worldLayerInvalidationVersion++,this.worldLayerDirty=!0,this.renderNextFrame=!0,this.emitDebugEvent({type:"world-layer-invalidated",reason:t}),this.requestRender(t)}resize(){super.resize(),this.syncBaseLayerCanvas(),this.invalidateWorldLayer("resize")}beforeFrame(t){(t.width!==this.lastWorldWidth||t.height!==this.lastWorldHeight)&&(this.lastWorldWidth=t.width,this.lastWorldHeight=t.height,this.invalidateWorldLayer("world-size-changed"))}paint(){this.renderNextFrame=!0}pendingUpdate(){return this.renderNextFrame||this.worldLayerDirty}afterFrame(t,e,n){let i=this.worldLayerInvalidationVersion;if(this.canvas.width<=0||this.canvas.height<=0){this.emitDebugEvent({type:"frame-skipped-zero-size-canvas",canvasWidth:this.canvas.width,canvasHeight:this.canvas.height,baseCanvasWidth:this.baseCanvas.width,baseCanvasHeight:this.baseCanvas.height}),this.renderNextFrame=!0;return}let a=V3(t,{target:n,zoneWindow:this.zoneWindow});this.hasRegionChanged(a)&&(this.worldLayerDirty=!0);let r=this.hasViewportChanged(n);if(this.renderNextFrame||this.worldLayerDirty||r){if((this.baseCanvas.width!==this.canvas.width||this.baseCanvas.height!==this.canvas.height)&&(this.syncBaseLayerCanvas(),this.worldLayerDirty=!0),this.baseCanvas.width<=0||this.baseCanvas.height<=0){this.emitDebugEvent({type:"frame-skipped-zero-size-canvas",canvasWidth:this.canvas.width,canvasHeight:this.canvas.height,baseCanvasWidth:this.baseCanvas.width,baseCanvasHeight:this.baseCanvas.height}),this.renderNextFrame=!0;return}if(this.worldLayerDirty){let l=this.worldLayerInvalidationVersion;this.sharedCanvasResourcesPending=!1,this.emitDebugEvent({type:"world-layer-render-start",region:a});try{this.renderWorldLayer(t,a)}finally{this.emitDebugEvent({type:"world-layer-render-end",region:a})}this.worldLayerDirty=this.sharedCanvasResourcesPending||l!==this.worldLayerInvalidationVersion}this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.context.drawImage(this.baseCanvas,0,0),this.renderViewportBox(n,a),this.lastTargetX=n[1],this.lastTargetY=n[2],this.lastTargetX2=n[3],this.lastTargetY2=n[4],this.lastRegionX=a.x,this.lastRegionY=a.y,this.lastRegionWidth=a.width,this.lastRegionHeight=a.height,this.renderNextFrame=this.sharedCanvasResourcesPending||i!==this.worldLayerInvalidationVersion}}hasViewportChanged(t){return this.lastTargetX!==t[1]||this.lastTargetY!==t[2]||this.lastTargetX2!==t[3]||this.lastTargetY2!==t[4]}hasRegionChanged(t){return this.lastRegionX!==t.x||this.lastRegionY!==t.y||this.lastRegionWidth!==t.width||this.lastRegionHeight!==t.height}syncBaseLayerCanvas(){this.baseCanvas.width=this.canvas.width,this.baseCanvas.height=this.canvas.height}shouldClipImagePaintToBounds(t){return t instanceof gi||t instanceof Ri?!!t.__parent?.renderOptions?.clipToBounds:!1}getBoundsFromPoints(t){let e=1/0,n=1/0,i=-1/0,a=-1/0;for(let r=0;r<t.length;r+=5)t[r]&&(e=Math.min(e,t[r+1]),n=Math.min(n,t[r+2]),i=Math.max(i,t[r+3]),a=Math.max(a,t[r+4]));if(!(!Number.isFinite(e)||!Number.isFinite(n)||!Number.isFinite(i)||!Number.isFinite(a))&&!(i<=e||a<=n))return{x:e,y:n,width:i-e,height:a-n}}getLayerClipBounds(t,e,n){if(!this.shouldClipImagePaintToBounds(t))return;let i=t.__parent,a=i?.crop||i?.points;if(!a)return;let r=e?Xi(a,e):a,l=this.getBoundsFromPoints(r);if(l)return{x:l.x+n.offsetX,y:l.y+n.offsetY,width:l.width,height:l.height}}renderWorldLayer(t,e){let n=this.baseContext;n.clearRect(0,0,this.baseCanvas.width,this.baseCanvas.height),n.fillStyle=this.style.background,n.fillRect(0,0,this.baseCanvas.width,this.baseCanvas.height);let i=t.getActiveZone(),a=ZT(e.width,e.height,this.baseCanvas.width,this.baseCanvas.height,e.x,e.y);this.worldTarget[1]=e.x,this.worldTarget[2]=e.y,this.worldTarget[3]=e.x+e.width,this.worldTarget[4]=e.y+e.height;let r=t.getPointsAt(this.worldTarget,this.aggregate,a.scale),l=0;for(let u=0;u<r.length&&!(l>=this.maxRects);u++){let f=r[u][0],h=r[u][1],d=r[u][2],m=d?Xi(h,d):h,y=m.length/5,g=this.getLayerClipBounds(f,d,a);g&&(n.save(),n.beginPath(),n.rect(g.x,g.y,g.width,g.height),n.clip());try{for(let b=0;b<y&&!(l>=this.maxRects);b++){let w=b*5;if(m[w]===0)continue;if(i){let A=f?.__owner?.value;if(!A||i.objects.indexOf(A)===-1)continue}let E=m[w+1]+a.offsetX,T=m[w+2]+a.offsetY,S=Math.max(this.minVisibleRectSize,m[w+3]-m[w+1]),R=Math.max(this.minVisibleRectSize,m[w+4]-m[w+2]);f instanceof rR?this.renderGeometry(n,f,E,T,a.scale):f instanceof Sd?this.renderBox(n,f,E,T,S,R,a.scale):this.renderImagePaint(n,f,b,E,T,S,R)||this.drawFallbackBoxes&&this.renderFallbackBox(n,E,T,S,R),l++}}finally{g&&n.restore()}}}renderFallbackBox(t,e,n,i,a){let r=Math.round(e),l=Math.round(n),u=Math.max(1,Math.round(i)),f=Math.max(1,Math.round(a));t.fillStyle=this.style.objectFill,t.strokeStyle=this.style.objectStroke,t.lineWidth=1,t.fillRect(r,l,u,f),u>2&&f>2&&t.strokeRect(r+.5,l+.5,u-1,f-1)}renderImagePaint(t,e,n,i,a,r,l){if(r<=0||l<=0)return!1;let u;if(e instanceof _v)u=e.getTexture()?.source;else if(e instanceof gi||e instanceof Ri){let d=this.renderSharedCanvasImage(t,e,n,i,a,r,l);if(d!==null)return d;if(typeof e.getImageUrl!="function")return!1;let m=e.getImageUrl(n);u=this.getLoadedPreviewImage(m)}if(!u)return!1;let f=Math.max(1,Math.round(r)),h=Math.max(1,Math.round(l));return t.drawImage(u,Math.round(i),Math.round(a),f,h),!0}ensureSharedCanvasImageBuffer(t){return t.__host?.canvas||this.sharedCanvasRenderer?.createImageHost?.(t),t.__host||(t.__host={}),t.__host.canvas||(t.__host.canvas={canvases:[],tiles:{}}),t.__host.canvas.canvases||(t.__host.canvas.canvases=[]),t.__host.canvas.tiles||(t.__host.canvas.tiles={}),t.__host.canvas}drawSharedCanvasTile(t,e,n,i,a,r,l,u){let f=Math.max(1,Math.round(l)),h=Math.max(1,Math.round(u));if(e.crop&&e.cropData){let g=n*5;if(!e.crop[g])return!1;let b=e.crop[g+1]/e.display.scale-e.display.points[g+1]+e.cropData.x/e.display.scale,w=e.crop[g+2]/e.display.scale-e.display.points[g+2]+e.cropData.y/e.display.scale,E=1+(e.crop[g+3]-e.crop[g+1])/e.display.scale,T=1+(e.crop[g+4]-e.crop[g+2])/e.display.scale;return t.drawImage(i,b,w,E,T,Math.round(a),Math.round(r),f,h),!0}let d=n*5,m=e.display.points[d+3]-e.display.points[d+1],y=e.display.points[d+4]-e.display.points[d+2];return t.drawImage(i,0,0,m,y,Math.round(a),Math.round(r),f,h),!0}renderSharedCanvasImage(t,e,n,i,a,r,l){let u=this.sharedCanvasRenderer;if(!u?.hostCache)return null;let f=this.ensureSharedCanvasImageBuffer(e),h=f.canvases?.[n],d=!!h&&!!u.invalidated?.includes(h),m=h&&!d?u.hostCache.get(h):void 0;if(m)return this.drawSharedCanvasTile(t,e,n,m,i,a,r,l);let y=f.tiles?.[n],g=Math.hypot(i+r/2-this.baseCanvas.width/2,a+l/2-this.baseCanvas.height/2);return(u.schedulePaintToCanvas?.(f,e,n,g,!1)||y?.state==="queued"||y?.state==="loading"||y?.state==="decoded")&&(this.sharedCanvasResourcesPending=!0),!1}getLoadedPreviewImage(t){let e=this.previewImageCache.get(t);if(e){if(e.status==="loading"&&e.image.complete){if(e.image.naturalWidth>0&&e.image.naturalHeight>0)return e.status="loaded",this.emitDebugEvent({type:"preview-image-loaded",imageUrl:t,cached:!0}),this.invalidateWorldLayer("preview-image-loaded"),e.image;e.status="error",this.emitDebugEvent({type:"preview-image-error",imageUrl:t});return}return e.status==="loaded"?e.image:void 0}let n=new Image,i={image:n,status:"loading"};return this.previewImageCache.set(t,i),this.emitDebugEvent({type:"preview-image-requested",imageUrl:t}),n.onload=()=>{i.status==="loading"&&(i.status="loaded",this.emitDebugEvent({type:"preview-image-loaded",imageUrl:t,cached:!1}),this.invalidateWorldLayer("preview-image-loaded"))},n.onerror=()=>{i.status==="loading"&&(i.status="error",this.emitDebugEvent({type:"preview-image-error",imageUrl:t}))},n.src=t,n.complete&&(n.naturalWidth>0&&n.naturalHeight>0?(i.status="loaded",this.emitDebugEvent({type:"preview-image-loaded",imageUrl:t,cached:!0}),this.invalidateWorldLayer("preview-image-loaded")):(i.status="error",this.emitDebugEvent({type:"preview-image-error",imageUrl:t}))),i.status==="loaded"?n:void 0}renderBox(t,e,n,i,a,r,l){let u=e.props?.style;if(!u){this.renderFallbackBox(t,n,i,a,r);return}let f=u.backgroundColor||this.style.objectFill,h=u.borderColor||this.style.objectStroke,d=u.borderWidth?parseInt(u.borderWidth,10):0,m=Math.max(0,d*(e.props?.relativeStyle?1:l));t.globalAlpha=typeof u.opacity=="number"?u.opacity:1,t.fillStyle=f,t.fillRect(Math.round(n),Math.round(i),Math.max(1,Math.round(a)),Math.max(1,Math.round(r))),m>0&&(t.strokeStyle=h,t.lineWidth=Math.max(1,m),t.strokeRect(Math.round(n)+t.lineWidth/2,Math.round(i)+t.lineWidth/2,Math.max(1,Math.round(a))-t.lineWidth,Math.max(1,Math.round(r))-t.lineWidth)),t.globalAlpha=1}renderGeometry(t,e,n,i,a){let r=e.shape;if(r.type!=="polygon"||r.points.length===0)return;let l=e.props?.style||{},u=l.backgroundColor||this.style.objectFill,f=l.borderColor||this.style.objectStroke,h=l.borderWidth?parseInt(l.borderWidth,10):0,d=Math.max(0,h*(e.props?.relativeStyle?1:a));t.globalAlpha=typeof l.opacity=="number"?l.opacity:1,t.beginPath();for(let m=0;m<r.points.length;m++){let y=n+r.points[m][0]*a,g=i+r.points[m][1]*a;m===0?t.moveTo(y,g):t.lineTo(y,g)}r.open||(t.closePath(),t.fillStyle=u,t.fill()),(d>0||r.open)&&(t.strokeStyle=f,t.lineWidth=Math.max(1,d||1),t.stroke()),t.globalAlpha=1}renderViewportBox(t,e){let n=ZT(e.width,e.height,this.canvas.width,this.canvas.height,e.x,e.y),i=(t[1]-n.worldX)*n.scale+n.offsetX,a=(t[2]-n.worldY)*n.scale+n.offsetY,r=(t[3]-t[1])*n.scale,l=(t[4]-t[2])*n.scale,u=Math.round(i),f=Math.round(a),h=Math.max(1,Math.round(r)),d=Math.max(1,Math.round(l));this.context.fillStyle=this.style.viewportFill,this.context.fillRect(u,f,h,d),this.context.strokeStyle=this.style.viewportStroke,this.context.lineWidth=Math.max(1,this.style.viewportLineWidth),this.context.strokeRect(u+.5,f+.5,Math.max(1,h-1),Math.max(1,d-1))}},jh=class extends kr{constructor(){super(),C(this,"type","spacial-content"),C(this,"id",void 0),C(this,"points",void 0),C(this,"color","#000"),C(this,"backgroundColor",void 0),C(this,"hovering",void 0),C(this,"pressing",void 0),C(this,"text",""),C(this,"display",{x:0,y:0,scale:1,width:100,height:100,points:It(5)}),C(this,"className",void 0),C(this,"html",void 0),C(this,"interactive",!1),C(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=It(5)}getAllPointsAt(t,e){return[[this,this.points,e]]}applyProps({id:t,target:e,text:n,color:i,backgroundColor:a,fontSize:r=18,interactive:l,fontFamily:u="Arial, sans-serif",...f}){f.font=`${r}px ${u}`,this.interactive=l||!1,n!==void 0&&(this.text=n||""),i&&(this.color=i),a&&(this.backgroundColor=a),t&&(this.id=t),e&&(this.points=de.singleBox(e.width,e.height,e.x,e.y),this.display.points=this.points,this.display.width=e.width,this.display.height=e.height),this.props={...this.props,...f},this.__revision++}};function WT(t,e){let n=e?t:JSON.stringify(t),i=5381,a=n.length;for(;a;)i=i*33^n.charCodeAt(--a);let r=(i>>>0).toString(16);return r.length%2?"0"+r:r}var j3=class{constructor(t){C(this,"$element",void 0),C(this,"stylesheetClasses",void 0),C(this,"activeStylesheetClasses",void 0),C(this,"sheetsDidUpdate",void 0),C(this,"sheetPrefix",void 0),C(this,"stylesheetEntries",void 0),this.sheetPrefix=t?.sheetPrefix||"a-",this.$element=document.createElement("style"),this.stylesheetClasses=[],this.activeStylesheetClasses=[],this.sheetsDidUpdate=!1,this.stylesheetEntries={}}getElement(){return this.$element}addStylesheet(t){let e=t.replace(/\s\s+/g," ").replace(/: /g,":").replace(/; /g,";").trim(),n=this.sheetPrefix+WT(e,!0);return this.stylesheetClasses.indexOf(n)===-1&&(this.stylesheetClasses.push(n),this.activeStylesheetClasses.push(n),this.stylesheetEntries[n]=e,this.sheetsDidUpdate=!0),n}removeStylesheet(t){let e=this.sheetPrefix+WT(t,!0);this.stylesheetClasses.indexOf(e)&&(this.stylesheetClasses=this.stylesheetClasses.filter(n=>n!==e)),this.sheetsDidUpdate=!0}clearClasses(){this.activeStylesheetClasses=[]}didUpdateActive(){if(this.activeStylesheetClasses.length){for(let t of this.activeStylesheetClasses)if(this.stylesheetClasses.indexOf(t)===-1)return!0;for(let t of this.stylesheetClasses)if(this.activeStylesheetClasses.indexOf(t)===-1)return!0}return!1}updateSheet(){(this.sheetsDidUpdate||this.didUpdateActive())&&(this.$element.innerText=this.activeStylesheetClasses.map(t=>`.${t}{${this.stylesheetEntries[t]}}`).join(""),this.sheetsDidUpdate=!1,this.stylesheetClasses=[...this.activeStylesheetClasses])}},k3=class{constructor(t,e){C(this,"htmlContainer",void 0),C(this,"visible",[]),C(this,"previousVisible",[]),C(this,"htmlIds",[]),C(this,"firstMeaningfulPaint",!1),C(this,"rendererPosition",void 0),C(this,"stylesheet",void 0),C(this,"options",void 0),C(this,"paintTx",1),C(this,"zIndex",0),C(this,"classes",void 0),this.htmlContainer=t,this.htmlContainer.innerHTML="",this.rendererPosition=this.htmlContainer.getBoundingClientRect(),this.options={triggerResize:()=>{},box:!1,text:!1,sheetPrefix:"",inlineStyles:!1,background:"",...e||{}},this.stylesheet=new j3({sheetPrefix:this.options.sheetPrefix}),this.options.inlineStyles||this.htmlContainer.appendChild(this.stylesheet.getElement()),this.options.background&&this.htmlContainer.classList.add(this.stylesheet.addStylesheet(`
|
|
25
|
+
background: ${this.options.background};
|
|
26
|
+
`)),this.classes={hostClassName:this.stylesheet.addStylesheet(`
|
|
27
|
+
position: absolute;
|
|
28
|
+
transform-origin: 0px 0px;
|
|
29
|
+
`),interactive:this.stylesheet.addStylesheet("pointer-events: all"),nonInteractive:this.stylesheet.addStylesheet("pointer-events: none")},this.stylesheet.updateSheet()}createHtmlHost(t){if(this.htmlContainer&&(t instanceof jh&&this.options.text||this.options.box||t.props.className||t.props.html||t.props.href)){let e=document.createElement(t.props.href?"a":"div");if(t.props.href){e.style.display="block",e.href=t.props.href;let n=t.props.hrefTarget||"_blank";e.target=n,n!=="_self"&&(e.rel="noopener noreferrer")}e.title=t.props.title||"",this.options.inlineStyles?(e.style.display="block",e.style.position="absolute",e.style.overflow="hidden",e.style.transformOrigin="0px 0px"):e.classList.add(this.classes.hostClassName),t.__host={element:e,revision:null,relative:!1},this.updateHtmlHost(t,t.width,t.height),t.__onCreate&&t.__onCreate()}}triggerResize(){this.options.triggerResize()}updateHtmlHost(t,e,n){if(t.__revision!==t.__host.revision){let i=t.__host.element,a=[this.classes.hostClassName];if(t.props.interactive?this.options.inlineStyles?i.style.pointerEvents="all":a.push(this.classes.interactive):this.options.inlineStyles?i.style.pointerEvents="none":a.push(this.classes.nonInteractive),t.props.href){i.style.display="block",i.href=t.props.href;let l=t.props.hrefTarget||"_blank";i.target=l,l==="_self"?i.rel="":i.rel="noopener noreferrer"}else i.href&&i.removeAttribute("href");if(t.props.title&&(i.title=t.props.title||""),t.props.className&&(a.push(t.props.className),t.hovering&&a.push(`${t.props.className}--hover`),t.pressing&&a.push(`${t.props.className}--active`)),t.props.relativeStyle?(i.style.width=`${e||t.width}px`,i.style.height=`${n||t.height}px`):(i.style.width=`${t.width}px`,i.style.height=`${t.height}px`),t.props.style){Object.assign(i.style,t.props.style||{},t.hovering&&t.props.hoverStyles||{},t.pressing&&t.props.pressStyles||{});return}if(this.options.text&&t instanceof jh){t.text&&(i.innerText=t.text),t.backgroundColor&&(i.style.backgroundColor=t.backgroundColor),t.color&&(i.style.color=t.color),t.props.font&&(i.style.font=t.props.font),t.props.textAlign&&(i.style.textAlign=t.props.textAlign),t.__host.revision=t.__revision;let l=a.join(" ");i.className=l,i.part=l}t instanceof Sd&&(this.options.box||t.props.className||t.props.html)&&(t.props.backgroundColor&&(i.style.backgroundColor=t.props.backgroundColor),t.props.border!==i.style.border&&(i.style.border=t.props.border));let r=a.join(" ");i.className=r,i.part=r}}afterFrame(t,e,n){this.stylesheet.updateSheet();for(let i of this.previousVisible)this.visible.indexOf(i)===-1&&this.htmlContainer&&i.__id&&this.htmlIds.indexOf(i.__id)!==-1&&this.htmlContainer.removeChild(i.__host.element);this.previousVisible=this.visible}afterPaintLayer(t,e){}beforeFrame(t,e,n){this.stylesheet.clearClasses(),this.paintTx++,this.zIndex=0,this.visible=[]}getPointsAt(t,e,n,i){return t.getPointsAt(e,n,i)}getScale(t,e){let n=this.rendererPosition.width/t,i=this.rendererPosition.height/e;return n<i?i:n}getViewportBounds(t,e,n){return null}isReady(){return!0}paint(t,e,n,i,a,r){if(this.zIndex++,(this.options.text&&t instanceof jh||t instanceof Sd&&(this.options.box||t.props.className||t.props.html))&&t.__host&&t.__host.tx!==this.paintTx&&(this.visible.push(t),t.__host.tx=this.paintTx,this.htmlContainer)){this.updateHtmlHost(t,a,r);let l=a/t.width,u=t.__host.element;u.style.zIndex=`${this.zIndex}`,t.props.relativeStyle?u.style.transform=`translate(${Math.round(n)}px, ${Math.round(i)}px)`:u.style.transform=`translate(${Math.round(n)}px, ${Math.round(i)}px) scale(${l})`,this.previousVisible.indexOf(t)===-1&&this.htmlContainer.appendChild(u),this.htmlIds.indexOf(t.__id)===-1&&this.htmlIds.push(t.__id)}}pendingUpdate(){return!1}prepareLayer(t){t.__host||(t instanceof jh||t instanceof Sd)&&this.createHtmlHost(t)}resize(t,e){t!==void 0&&e!==void 0&&(this.htmlContainer.style.width=`${t}px`,this.htmlContainer.style.height=`${e}px`),this.rendererPosition=this.htmlContainer.getBoundingClientRect()}getRendererScreenPosition(){return this.rendererPosition}finishLayer(){}reset(){}},W8=Wh((t,e)=>{var n=!1,i,a,r,l,u,f,h,d,m,y,g,b,w,E,T;function S(){if(!n){n=!0;var A=navigator.userAgent,M=/(?:MSIE.(\d+\.\d+))|(?:(?:Firefox|GranParadiso|Iceweasel).(\d+\.\d+))|(?:Opera(?:.+Version.|.)(\d+\.\d+))|(?:AppleWebKit.(\d+(?:\.\d+)?))|(?:Trident\/\d+\.\d+.*rv:(\d+\.\d+))/.exec(A),z=/(Mac OS X)|(Windows)|(Linux)/.exec(A);if(b=/\b(iPhone|iP[ao]d)/.exec(A),w=/\b(iP[ao]d)/.exec(A),y=/Android/i.exec(A),E=/FBAN\/\w+;/i.exec(A),T=/Mobile/i.exec(A),g=!!/Win64/.exec(A),M){i=M[1]?parseFloat(M[1]):M[5]?parseFloat(M[5]):NaN,i&&document&&document.documentMode&&(i=document.documentMode);var I=/(?:Trident\/(\d+.\d+))/.exec(A);f=I?parseFloat(I[1])+4:i,a=M[2]?parseFloat(M[2]):NaN,r=M[3]?parseFloat(M[3]):NaN,l=M[4]?parseFloat(M[4]):NaN,l?(M=/(?:Chrome\/(\d+\.\d+))/.exec(A),u=M&&M[1]?parseFloat(M[1]):NaN):u=NaN}else i=a=r=u=l=NaN;if(z){if(z[1]){var L=/(?:Mac OS X (\d+(?:[._]\d+)?))/.exec(A);h=L?parseFloat(L[1].replace("_",".")):!0}else h=!1;d=!!z[2],m=!!z[3]}else h=d=m=!1}}var R={ie:function(){return S()||i},ieCompatibilityMode:function(){return S()||f>i},ie64:function(){return R.ie()&&g},firefox:function(){return S()||a},opera:function(){return S()||r},webkit:function(){return S()||l},safari:function(){return R.webkit()},chrome:function(){return S()||u},windows:function(){return S()||d},osx:function(){return S()||h},linux:function(){return S()||m},iphone:function(){return S()||b},mobile:function(){return S()||b||w||y||T},nativeApp:function(){return S()||E},android:function(){return S()||y},ipad:function(){return S()||w}};e.exports=R}),J8=Wh((t,e)=>{var n=!!(typeof window<"u"&&window.document&&window.document.createElement);e.exports={canUseDOM:n,canUseWorkers:typeof Worker<"u",canUseEventListeners:n&&!!(window.addEventListener||window.attachEvent),canUseViewport:n&&!!window.screen,isInWorker:!n}}),$8=Wh((t,e)=>{var n=J8(),i;n.canUseDOM&&(i=document.implementation&&document.implementation.hasFeature&&document.implementation.hasFeature("","")!==!0);function a(r,l){if(!n.canUseDOM||l&&!("addEventListener"in document))return!1;var u="on"+r,f=u in document;if(!f){var h=document.createElement("div");h.setAttribute(u,"return;"),f=typeof h[u]=="function"}return!f&&i&&r==="wheel"&&(f=document.implementation.hasFeature("Events.wheel","3.0")),f}e.exports=a}),tj=Wh((t,e)=>{var n=W8(),i=$8(),a=10,r=40,l=800;function u(f){var h=0,d=0,m=0,y=0;return"detail"in f&&(d=f.detail),"wheelDelta"in f&&(d=-f.wheelDelta/120),"wheelDeltaY"in f&&(d=-f.wheelDeltaY/120),"wheelDeltaX"in f&&(h=-f.wheelDeltaX/120),"axis"in f&&f.axis===f.HORIZONTAL_AXIS&&(h=d,d=0),m=h*a,y=d*a,"deltaY"in f&&(y=f.deltaY),"deltaX"in f&&(m=f.deltaX),(m||y)&&f.deltaMode&&(f.deltaMode==1?(m*=r,y*=r):(m*=l,y*=l)),m&&!h&&(h=m<1?-1:1),y&&!d&&(d=y<1?-1:1),{spinX:h,spinY:d,pixelX:m,pixelY:y}}u.getEventType=function(){return n.firefox()?"DOMMouseScroll":i("wheel")?"wheel":"mousewheel"},e.exports=u}),G3=Wh((t,e)=>{e.exports=tj()}),ej=x3(G3(),1),cn=Math.pow,Sv=Math.sqrt,Uh=Math.sin,t3=Math.cos,Yh=Math.PI,Iv=1.70158,xv=Iv*1.525,e3=Iv+1,n3=2*Yh/3,i3=2*Yh/4.5,wv=function(t){let e=7.5625,n=2.75;return t<1/n?e*t*t:t<2/n?e*(t-=1.5/n)*t+.75:t<2.5/n?e*(t-=2.25/n)*t+.9375:e*(t-=2.625/n)*t+.984375},Ur={linear:t=>t,easeInQuad:function(t){return t*t},easeOutQuad:function(t){return 1-(1-t)*(1-t)},easeInOutQuad:function(t){return t<.5?2*t*t:1-cn(-2*t+2,2)/2},easeInCubic:function(t){return t*t*t},easeOutCubic:function(t){return 1-cn(1-t,3)},easeInOutCubic:function(t){return t<.5?4*t*t*t:1-cn(-2*t+2,3)/2},easeInQuart:function(t){return t*t*t*t},easeOutQuart:function(t){return 1-cn(1-t,4)},easeInOutQuart:function(t){return t<.5?8*t*t*t*t:1-cn(-2*t+2,4)/2},easeInQuint:function(t){return t*t*t*t*t},easeOutQuint:function(t){return 1-cn(1-t,5)},easeInOutQuint:function(t){return t<.5?16*t*t*t*t*t:1-cn(-2*t+2,5)/2},easeInSine:function(t){return 1-t3(t*Yh/2)},easeOutSine:function(t){return Uh(t*Yh/2)},easeInOutSine:function(t){return-(t3(Yh*t)-1)/2},easeInExpo:function(t){return t===0?0:cn(2,10*t-10)},easeOutExpo:function(t){return t===1?1:1-cn(2,-10*t)},easeInOutExpo:function(t){return t===0?0:t===1?1:t<.5?cn(2,20*t-10)/2:(2-cn(2,-20*t+10))/2},easeInCirc:function(t){return 1-Sv(1-cn(t,2))},easeOutCirc:function(t){return Sv(1-cn(t-1,2))},easeInOutCirc:function(t){return t<.5?(1-Sv(1-cn(2*t,2)))/2:(Sv(1-cn(-2*t+2,2))+1)/2},easeInBack:function(t){return e3*t*t*t-Iv*t*t},easeOutBack:function(t){return 1+e3*cn(t-1,3)+Iv*cn(t-1,2)},easeInOutBack:function(t){return t<.5?cn(2*t,2)*((xv+1)*2*t-xv)/2:(cn(2*t-2,2)*((xv+1)*(t*2-2)+xv)+2)/2},easeInElastic:function(t){return t===0?0:t===1?1:-cn(2,10*t-10)*Uh((t*10-10.75)*n3)},easeOutElastic:function(t){return t===0?0:t===1?1:cn(2,-10*t)*Uh((t*10-.75)*n3)+1},easeInOutElastic:function(t){return t===0?0:t===1?1:t<.5?-(cn(2,20*t-10)*Uh((20*t-11.125)*i3))/2:cn(2,-20*t+10)*Uh((20*t-11.125)*i3)/2+1},easeInBounce:function(t){return 1-wv(1-t)},easeOutBounce:wv,easeInOutBounce:function(t){return t<.5?(1-wv(1-2*t))/2:(1+wv(2*t-1))/2}},a3="scroll",VT="gesture",nj={zoomOutFactor:.8,zoomInFactor:1.25,maxZoomFactor:1,minZoomFactor:.05,zoomDuration:300,zoomWheelConstant:20,zoomClamp:.6,panBounceStiffness:120,panBounceDamping:15,panTimeConstant:325,panPower:.1,enablePanMomentum:!0,panMomentumStrength:1,nudgeDistance:100,panPadding:0,devicePixelRatio:1,enableWheel:!0,enableClickToZoom:!0,enableDoubleTapZoom:!0,ignoreSingleFingerTouch:!1,enablePanOnWait:!1,requireMetaKeyForWheelZoom:!1,wheelInExploreModeOnly:!1,panOnWaitDelay:40,onPanInSketchMode:()=>{},parentElement:null},sR=(t={})=>({start:e=>{let{zoomWheelConstant:n,enableWheel:i,enableClickToZoom:a,enableDoubleTapZoom:r,ignoreSingleFingerTouch:l,enablePanOnWait:u,panOnWaitDelay:f,parentElement:h,requireMetaKeyForWheelZoom:d,wheelInExploreModeOnly:m,enablePanMomentum:y,panMomentumStrength:g,panBounceStiffness:b,panBounceDamping:w,panTimeConstant:E,panPadding:T}={...nj,...t},S={pointerStart:{x:0,y:0},isPressing:!1,mousemoveBuffer:It(5),multiTouch:{distance:0},hasMovedSincePress:!1},R=[],A={active:!1,vx:0,vy:0},M=null,z,I=0,L,H;function V(){R.length=0}function nt(st,Tt){let qt=performance.now(),_=R[R.length-1];if(_&&_.x===st&&_.y===Tt){_.t=qt;return}for(R.push({x:st,y:Tt,t:qt});R.length>1&&qt-R[0].t>140;)R.shift()}function X(){A.active=!1,A.vx=0,A.vy=0}function mt(){M=null,z=void 0}function lt(){if(!r||e.mode!=="explore"||S.hasMovedSincePress||!H)return!1;let st=performance.now();if(Gt&&st-Gt>250)return!1;let Tt=L&&I>0&&st-I<=350&&Gh(L,H)<=100;if(I=st,L={...H},!Tt)return!1;let qt=e.isViewportAtHomeZoomLevel({tolerance:.1})?e.getHomeTarget({cover:!0}):e.getHomeTarget();return e.transitionManager.goToRegion(qt,{transition:{duration:500,easing:Ur.easeInOutQuad}}),I=0,L=void 0,!0}function it(st,Tt,qt,_){let B=Math.min(qt,32)/1e3,rt=Tt*1e3,ft=st+rt*B,wt=ft-_,U=-b*wt-w*rt,P=rt+U*B;return{position:ft+.5*U*B*B,velocity:P/1e3}}function yt(st){e.transitionManager.customTransition(Tt=>{Tt.from=It(e.target),Tt.to=st,Tt.elapsed_time=0,Tt.total_time=0,Tt.timingFunction=Ur.easeInOutExpo,Tt.done=!1})}function xt(){if(R.length<2)return null;let st=R[R.length-1],Tt=R[0];for(let _=R.length-2;_>=0&&(Tt=R[_],!(st.t-Tt.t>=80));_--);let qt=st.t-Tt.t;return qt<=0?null:{vx:(st.x-Tt.x)/qt,vy:(st.y-Tt.y)/qt}}function et(){if(!y||!S.hasMovedSincePress||R.length<2)return!1;let st=xt();if(!st)return!1;let Tt=Math.max(0,g),qt=st.vx*Tt,_=st.vy*Tt;return Math.hypot(qt,_)*e.getScaleFactor()<.08?!1:(A.active=!0,A.vx=qt,A.vy=_,e.updateNextFrame(),!0)}function gt(){if(!S.isPressing){mt(),Vt();return}let st=e.mode==="explore"?et():!1;e.mode==="explore"&&!st&&e.world.constraintBounds(),S.isPressing=!1,S.hasMovedSincePress=!1,V(),mt(),Vt()}function Mt(){if(!S.isPressing){mt(),Vt();return}if(X(),e.mode==="explore"){let st=e.transitionManager.getPendingTransition(),Tt=M||(st&&st.total_time===0&&!st.done?st.to:e.target);e.transitionManager.constrainTarget(Tt,{origin:z,panPadding:T})}S.isPressing=!1,S.hasMovedSincePress=!1,V(),mt(),Vt()}e.world.activatedEvents.push("onMouseUp","onMouseDown","onMouseMove","onTouchStart","onTouchEnd","onTouchCancel","onTouchMove","onContextMenu");function Vt(){ee=0,re="",Zt(),Zt(void 0,"notice"),Gt=0,H=void 0}function Kt(){gt()}function te(st){if(re===VT&&st.touches.length<2){Mt();return}st.touches.length===0&&(lt(),gt())}function ue(st){if(re===VT){Mt();return}gt()}function dt(st){if(st.which>1){S.isPressing=!1;return}e.mode==="explore"&&(st.preventDefault(),X(),V(),S.hasMovedSincePress=!1,S.pointerStart.x=st.atlas.x,S.pointerStart.y=st.atlas.y,nt(e.target[1],e.target[2]),e.transitionManager.stopTransition(),S.isPressing=!0)}function Ht(){gt()}let ee=0,Gt=0,re="";function Ae(st){if(e.mode==="explore"){if(X(),V(),S.hasMovedSincePress=!1,st.atlasTouches.length===1&&(Gt=performance.now(),l==0&&st.preventDefault(),S.pointerStart.x=st.atlasTouches[0].x,S.pointerStart.y=st.atlasTouches[0].y,H={x:st.atlasTouches[0].x,y:st.atlasTouches[0].y},nt(e.target[1],e.target[2])),st.atlasTouches.length===2){re=VT,st.preventDefault();let Tt=st.atlasTouches[0].x,qt=st.atlasTouches[1].x;S.pointerStart.x=(Tt+qt)/2;let _=st.atlasTouches[0].y,B=st.atlasTouches[1].y;S.pointerStart.y=(_+B)/2,ee=Gh({x:st.touches[0].clientX,y:st.touches[0].clientY},{x:st.touches[1].clientX,y:st.touches[1].clientY}),V(),mt()}e.transitionManager.stopTransition(),S.isPressing=!0}}function Zt(st,Tt="intent"){h&&(h.dataset[Tt]=st)}function fe(st){let Tt=null,qt=null,_=0,B=!1;if(S.isPressing&&st.touches.length===2&&(Tt=(st.touches[0].clientX+st.touches[1].clientX)/2,qt=(st.touches[0].clientY+st.touches[1].clientY)/2,_=Gh({x:st.touches[0].clientX,y:st.touches[0].clientY},{x:st.touches[1].clientX,y:st.touches[1].clientY})),Zt(re),S.isPressing&&st.touches.length===1){if(u&&(performance.now()-Gt<f&&re==""&&(re=a3),re==""&&(re="pan")),Zt(re),re==""&&l==1||re==a3){Zt("require-two-finger","notice");return}let rt=st.touches[0];Tt=rt.clientX,qt=rt.clientY,B=!0}if(Tt!==null&&qt!==null){let rt=e.getRendererScreenPosition();if(rt){let{x:ft,y:wt}=e.viewerToWorld(Tt-rt.x,qt-rt.y),U=_&&ee?_/ee:1,P=Xi(It(e.target),Nr(ci(S.pointerStart.x-ft,S.pointerStart.y-wt),Ul(1/U,ft,wt)),S.mousemoveBuffer);if(B){let Z=R[R.length-1];Z&&(Z.x!==P[1]||Z.y!==P[2])&&(S.hasMovedSincePress=!0),nt(P[1],P[2])}st.touches.length===2&&(M=It(P),z={x:ft,y:wt}),yt(P)}ee=_}re=="pan"&&st.preventDefault()}function Ft(st){if(S.isPressing){let Tt=e.getRendererScreenPosition();if(Tt){let{x:qt,y:_}=e.viewerToWorld(st.clientX-Tt.x,st.clientY-Tt.y),B=Xi(It(e.target),ci(S.pointerStart.x-qt,S.pointerStart.y-_),S.mousemoveBuffer),rt=R[R.length-1];rt&&(rt.x!==B[1]||rt.y!==B[2])&&(S.hasMovedSincePress=!0),nt(B[1],B[2]),yt(B)}}}function tn(st){e.mode==="explore"&&e.world.zoomIn(st.atlas)}function Jt(st){if(m&&e.mode!=="explore")return;X();let Tt=1+(0,ej.default)(st).spinY/n;e.world.zoomTo(Tt,st.atlas,!0)}function ze(st){return d&&st.metaKey==0?(Zt("meta-required","notice"),st.stopPropagation(),!1):!0}e.world.addEventListener("mouseup",Kt),e.world.addEventListener("touchend",te),e.world.addEventListener("touchcancel",ue),e.world.addEventListener("touchstart",Ae),e.world.addEventListener("mousedown",dt),window.addEventListener("touchend",Ht),window.addEventListener("mouseup",Ht),window.addEventListener("mousemove",Ft),h&&h.addEventListener("touchmove",fe),a&&(e.world.activatedEvents.push("onClick"),e.world.addEventListener("click",tn)),i&&(e.world.activatedEvents.push("onWheel"),d&&h?.addEventListener("wheel",ze,{passive:!0,capture:!0}),e.world.addEventListener("wheel",Jt));let ri=e.world.addLayoutSubscriber((st,Tt)=>{if(st==="zone-changed"&&(X(),e.transitionManager.hasPending()||e.transitionManager.constrainBounds()),st==="zoom-to"&&Tt&&(X(),e.transitionManager.zoomTo(Tt.factor,{origin:Tt.point,stream:Tt.stream})),st==="go-home"){X();let qt=Tt.immediate?{duration:0}:void 0,_=Tt?.paddingPx,B=e.getHomeTarget({paddingPx:_});e.transitionManager.goToRegion(B,{transition:qt})}if(st==="goto-region"&&Tt){X();let qt=Tt.immediate?{duration:0}:{};if(Tt.paddingPx!==void 0){let _=e.getHomeTarget({position:de.singleBox(Tt.width,Tt.height,Tt.x,Tt.y),paddingPx:Tt.paddingPx});e.transitionManager.goToRegion(_,{transition:qt})}else e.transitionManager.goToRegion(Tt,{transition:qt})}st==="constrain-bounds"&&(X(),e.transitionManager.constrainBounds({panPadding:T,transition:Tt?.immediate?{duration:0}:void 0}))}),qn=e.registerHook("useFrame",st=>{if(!A.active)return;let Tt=Math.exp(-st/Math.max(1,E)),qt=e.target[3]-e.target[1],_=e.target[4]-e.target[2],B=Xi(It(e.target),ci(A.vx*st,A.vy*st),S.mousemoveBuffer),[,rt]=e.constrainBounds(B,{panPadding:T}),ft=B[1]!==rt[1],wt=B[2]!==rt[2],U=ft?A.vx:A.vx*Tt,P=wt?A.vy:A.vy*Tt,Z=It(B);if(ft){let Pt=it(e.target[1],A.vx,st,rt[1]);Z[1]=Pt.position,Z[3]=Pt.position+qt,U=Pt.velocity}else Z[1]=e.target[1]+U*st,Z[3]=Z[1]+qt;if(wt){let Pt=it(e.target[2],A.vy,st,rt[2]);Z[2]=Pt.position,Z[4]=Pt.position+_,P=Pt.velocity}else Z[2]=e.target[2]+P*st,Z[4]=Z[2]+_;A.vx=U,A.vy=P;let[,W]=e.constrainBounds(Z,{panPadding:T}),Lt=Math.hypot(Z[1]-W[1],Z[2]-W[2])*e.getScaleFactor(),Yt=Math.hypot(A.vx,A.vy)*e.getScaleFactor();if(Lt<=.5&&Yt<=.02){X(),yt(W);return}yt(Z),e.updateNextFrame()});return()=>{X(),e.world.removeEventListener("mouseup",Kt),e.world.removeEventListener("touchend",te),e.world.removeEventListener("touchcancel",ue),e.world.removeEventListener("touchstart",Ae),e.world.removeEventListener("mousedown",dt),window.removeEventListener("touchend",Ht),window.removeEventListener("mouseup",Ht),window.removeEventListener("mousemove",Ft),h&&(h.removeEventListener("touchmove",fe),h.removeEventListener("wheel",ze,{passive:!0,capture:!0})),a&&e.world.removeEventListener("click",tn),i&&e.world.removeEventListener("wheel",Jt),qn(),ri()}},updatePosition(){}}),ij=x3(G3(),1),aj={scrollWheelFactor:1,scrollLoadAheadFactor:1,clickDragThresholdPx:6,touchScrollMomentumStrength:1.4,touchScrollMomentumMinStartPxPerMs:.04},r3=.8,o3=.08,rj=1,jT=new WeakMap;function kT(t){return{x:t.x,y:t.y,width:t.width,height:t.height}}function s3(t,e,n){return t.points[0]!==0&&e>=t.points[1]&&e<=t.points[3]&&n>=t.points[2]&&n<=t.points[4]}var Y3=(t={})=>({start(e){let n=rj++;jT.set(e,n);let i=()=>jT.get(e)===n,{scrollWheelFactor:a,scrollLoadAheadFactor:r,clickDragThresholdPx:l,touchScrollMomentumStrength:u,touchScrollMomentumMinStartPxPerMs:f,enablePanMomentum:h=!0,panMomentumStrength:d=1,panTimeConstant:m=325}={...aj,...t},y=()=>{L||(L=!0,window.requestAnimationFrame(()=>{L=!1,i()&&e.updateNextFrame()}))},g=e.mode,b=e.manualHomePosition,w="scroll-mode",E=!1,T=!1,S=!1,R,A,M=!1,z,I=performance.now()+5e3,L=!1,H=0,V=0,nt=0,X=0,mt=null,lt=!1,it=null,yt=!1,xt=!1,et=0,gt,Mt=!0,Vt=-1,Kt=-1,te=-1,ue=-1,dt=-1,Ht=[],ee={active:!1,vy:0},Gt=sR({...t,enableWheel:!0,enableClickToZoom:!1,wheelInExploreModeOnly:!0}),re=q=>{e.world.activatedEvents.indexOf(q)===-1&&e.world.activatedEvents.push(q)},Ae=q=>{w=q,e.mode=q==="zone-active"?"explore":"sketch"},Zt=()=>{Ht.length=0},fe=q=>{let ht=performance.now(),Ot=Ht[Ht.length-1];if(Ot&&Ot.y===q){Ot.t=ht;return}for(Ht.push({y:q,t:ht});Ht.length>1&&ht-Ht[0].t>140;)Ht.shift()},Ft=()=>{ee.active=!1,ee.vy=0},tn=()=>{if(Ht.length<2)return null;let q=Ht[Ht.length-1],ht=Ht[0];for(let J=Ht.length-2;J>=0&&(ht=Ht[J],!(q.t-ht.t>=80));J--);let Ot=q.y-ht.y,ne=q.t-ht.t;return ne<=0||Math.abs(Ot)<=.5?null:Ot/ne},Jt=({strengthMultiplier:q=1,minStartPxPerMs:ht=o3}={})=>{if(!h||Ht.length<2)return!1;let Ot=tn();if(Ot===null)return!1;let ne=Ot*Math.max(0,d)*Math.max(0,q);return Math.abs(ne)*e.getScaleFactor()<ht?!1:(ee.active=!0,ee.vy=ne,e.updateNextFrame(),!0)},ze=()=>{let q=w==="zone-active"?"explore":"sketch";e.mode!==q&&(e.mode=q)},ri=()=>{Mt=!0},qn=(q,ht)=>Math.abs(q.x-ht.x)>.01||Math.abs(q.y-ht.y)>.01||Math.abs(q.width-ht.width)>.01||Math.abs(q.height-ht.height)>.01,st=()=>{let q,ht=0;for(let Ot of e.world.zones)Ot.recalculateBounds(),Ot.points[0]!==0&&(!q||Ot.points[2]<ht)&&(q=Ot,ht=Ot.points[2]);return q},Tt=()=>{let q=e.getRendererScreenPosition(),ht=Math.max(0,q?.height||0);if(ht===0)return;let Ot=Math.round(ht*.04999999999999999);return{top:Ot,bottom:Ot}},qt=()=>{let q=st();if(q)return q.points[2];let ht=!1,Ot=0;for(let ne of e.world.getObjects())!ne||ne.points[0]===0||(!ht||ne.points[2]<Ot)&&(Ot=ne.points[2],ht=!0);return ht?Ot:0},_=()=>{let q=e.getRendererScreenPosition(),ht=Math.round((q?.width||e.width||0)*100)/100,Ot=Math.round((q?.height||e.height||0)*100)/100,ne=q?.width&&q?.height?"renderer":"runtime",J=st();if(J)return["zone",J.id,J.points[1],J.points[2],J.points[3]-J.points[1],J.points[4]-J.points[2],`screen:${ht}x${Ot}:${ne}`].join(":");let pt=-1,vt=0,$t=e.world.getObjects();for(let Se=0;Se<$t.length;Se++){let en=$t[Se];!en||en.points[0]===0||(pt===-1||en.points[2]<vt)&&(pt=Se,vt=en.points[2])}if(pt!==-1){let Se=$t[pt];return["object",Se.id||pt,Se.points[1],Se.points[2],Se.points[3]-Se.points[1],Se.points[4]-Se.points[2],`screen:${ht}x${Ot}:${ne}`].join(":")}},B=()=>{if(!i()||M||w!=="scroll-mode"||E||xt||T||e.world.hasActiveZone())return;let q=_();if(!q){performance.now()<I&&e.updateNextFrame();return}q!==z&&(z=q,et=qt(),U(et),y())},rt=()=>{let q=e.world.width,ht=e.world.height,Ot=e.getRendererScreenPosition(),ne=Math.max(1,Ot?.width||e.width),J=Math.max(1,Ot?.height||e.height),pt=e.world.zones.length;if(!Mt&>&&Vt===q&&Kt===ht&&te===ne&&ue===J&&dt===pt)return gt;let vt=st(),$t;if(vt){let Se=e.getHomeTarget({position:vt.points,paddingPx:Tt()});$t={x:Se.x,y:Se.y,width:Se.width,height:Se.height}}else $t=q>0&&ht>0?{x:0,y:0,width:q,height:q/ne*J}:void 0;return gt=$t,Mt=!1,Vt=q,Kt=ht,te=ne,ue=J,dt=pt,gt},ft=q=>{let ht=rt();if(!ht)return;let Ot=e.world.height,ne=Math.max(1,r),J=ht.width*ne,pt=ht.height,vt=ht.height*ne,$t=Math.min(0,Ot-pt),Se=Math.max(0,Ot-pt);return{x:ht.x-(J-ht.width)/2,y:Math.min(Se,Math.max($t,q)),width:J,height:vt}},wt=q=>{if(q.recalculateBounds(),q.points[0]!==0)return ft(q.points[2])},U=q=>{let ht=ft(q);if(!ht)return;et=ht.y;let Ot=e.getViewport();!e.transitionManager.hasPending()&&!qn(Ot,ht)||(e.transitionManager.hasPending()&&e.transitionManager.stopTransition(),e.setViewport(ht),e.updateNextFrame())},P=q=>{let ht=ft(q);return ht?(et=ht.y,e.transitionManager.goToRegion(ht),e.updateNextFrame(),!0):!1},Z=()=>{if(w!=="scroll-mode"||E||T||e.world.hasActiveZone())return;let q=e.getViewport(),ht=ft(q.y);ht&&(et=ht.y,qn(q,ht)&&(e.transitionManager.hasPending()&&e.transitionManager.stopTransition(),e.setViewport(ht),e.updateNextFrame()))},W=(q,ht)=>{for(let Ot of e.world.zones)if(Ot.recalculateBounds(),s3(Ot,q,ht))return Ot},Lt=q=>{i()&&(Ft(),Zt(),M=!0,A||(A=kT({...e.getViewport(),y:et})),S=!0,e.goToZone(q)?Ae("zone-active"):S=!1)},Yt=()=>{if(!i())return;let q=P(A?A.y:et);A=void 0,T=q,q||(T=!1,E=!1,U(et)),e.updateNextFrame()},Pt=()=>{if(!i()||w!=="zone-active")return!1;let q=e.world.getActiveZone();if(!q||(q.recalculateBounds(),q.points[0]===0))return!1;let ht=e.getViewport();if(ht.width<=0||ht.height<=0)return!1;let Ot=q.points[3]-q.points[1],ne=q.points[4]-q.points[2],J=Ot/ht.width,pt=ne/ht.height;return J<r3&&pt<r3},Y=()=>{i()&&w==="zone-active"&&(Ft(),Zt(),Ae("scroll-mode"),E=!0,e.deselectZone(),Yt())},at=(q,ht)=>{Ft(),Zt(),M=!0,xt=!0,yt=!1,nt=q,X=ht,H=ht,V=et,fe(et)},At=(q,ht)=>{if(!xt)return!1;Math.hypot(q-nt,ht-X)>l&&(yt=!0);let Ot=(ht-H)/Math.max(1e-4,e.getScaleFactor());return U(V-Ot),fe(et),!0},Ct=({allowMomentum:q=!0,momentumStrengthMultiplier:ht=1,momentumMinStartPxPerMs:Ot=o3}={})=>{let ne=xt,J=yt;return xt=!1,yt=!1,ne?(q&&w==="scroll-mode"&&!T?Jt({strengthMultiplier:ht,minStartPxPerMs:Ot}):Ft(),Zt(),{releasedDrag:!0,tapSuppressed:J}):(Zt(),{releasedDrag:!1,tapSuppressed:J})},Rt=()=>{xt=!1,yt=!1,Zt(),Ft()},Ut=()=>{mt=null,lt=!1,it=null,yt=!1},G=q=>{if(!i()||(ze(),yt||T))return;if(w==="scroll-mode"){let Ot=W(q.x,q.y);Ot&&Lt(Ot.id);return}let ht=e.world.getActiveZone();(!ht||!s3(ht,q.x,q.y))&&Y()},Bt=q=>{i()&&q.atlas&&G(q.atlas)},he=q=>{if(!i())return;if(ze(),T){q.stopPropagation();return}if(w!=="scroll-mode")return;Ft(),M=!0,q.stopPropagation();let ht=((0,ij.default)(q).pixelY||q.deltaY||0)/Math.max(1e-4,e.getScaleFactor())*a;U(et+ht)},Ue=q=>{i()&&(ze(),!(w!=="scroll-mode"||T||!q.atlas)&&(q.stopPropagation(),at(typeof q.clientX=="number"?q.clientX:0,q.clientY)))},Le=q=>{i()&&(ze(),!(!xt||w!=="scroll-mode"||T||!q.atlas)&&(q.stopPropagation(),At(typeof q.clientX=="number"?q.clientX:0,q.clientY)))},Ve=()=>{i()&&Ct()},An=q=>{if(!i())return;if(ze(),w==="zone-active"){if(!q.atlasTouches||q.atlasTouches.length!==1||q.touches.length!==1){Ut();return}let ne=q.touches[0],J=q.atlasTouches[0];mt=J.id,lt=!0,yt=!1,nt=ne.clientX,X=ne.clientY,it={x:J.x,y:J.y};return}if(w!=="scroll-mode"||T)return;if(q.preventDefault(),q.stopPropagation?.(),!q.atlasTouches||q.atlasTouches.length!==1||q.touches.length!==1){Ut(),Rt();return}let ht=q.touches[0],Ot=q.atlasTouches[0];mt=Ot.id,lt=!0,it={x:Ot.x,y:Ot.y},at(ht.clientX,ht.clientY)},Qn=q=>{if(!i())return;if(ze(),w==="zone-active"){if(!lt)return;if(!q.atlasTouches||q.atlasTouches.length!==1||q.touches.length!==1){Ut();return}let ne=q.atlasTouches.find(pt=>pt.id===mt)||q.atlasTouches[0],J=Array.from(q.touches).find(pt=>pt.identifier===ne.id)||q.touches[0];it={x:ne.x,y:ne.y},Math.hypot(J.clientX-nt,J.clientY-X)>l&&(yt=!0);return}if(w!=="scroll-mode"||T||!xt)return;if(q.preventDefault(),q.stopPropagation?.(),!q.atlasTouches||q.atlasTouches.length!==1||q.touches.length!==1){Ut(),Rt();return}let ht=q.atlasTouches.find(ne=>ne.id===mt)||q.atlasTouches[0],Ot=Array.from(q.touches).find(ne=>ne.identifier===ht.id)||q.touches[0];mt=ht.id,it={x:ht.x,y:ht.y},At(Ot.clientX,Ot.clientY)},Mi=q=>{if(!i())return;if(ze(),w==="zone-active"){let ne=it,J=lt&&!yt&&q.touches.length===0;Ut(),ne&&J&&G(ne);return}if(w!=="scroll-mode")return;if(q.preventDefault(),q.stopPropagation?.(),q.touches.length>0){Ut(),Rt();return}let ht=it,Ot=Ct({momentumStrengthMultiplier:u,momentumMinStartPxPerMs:f});Ut(),ht&&!Ot.tapSuppressed&&G(ht)},Oi=q=>{if(i()){if(ze(),w==="zone-active"){Ut();return}w==="scroll-mode"&&(q.preventDefault(),q.stopPropagation?.(),Ut(),Rt())}},Ui=()=>{if(i()){if(w==="zone-active"){Ut();return}Ct({momentumStrengthMultiplier:u,momentumMinStartPxPerMs:f}),Ut()}},Xr=q=>{i()&&q.key==="Escape"&&Y()};re("onClick"),re("onWheel"),re("onMouseDown"),re("onMouseMove"),re("onMouseUp"),re("onTouchStart"),re("onTouchMove"),re("onTouchEnd"),re("onTouchCancel"),e.world.addEventListener("click",Bt),e.world.addEventListener("wheel",he),e.world.addEventListener("mousedown",Ue),e.world.addEventListener("mousemove",Le),e.world.addEventListener("mouseup",Ve),e.world.addEventListener("touchstart",An),e.world.addEventListener("touchmove",Qn),e.world.addEventListener("touchend",Mi),e.world.addEventListener("touchcancel",Oi),window.addEventListener("mouseup",Ve),window.addEventListener("touchend",Ui),window.addEventListener("touchcancel",Oi),window.addEventListener("keydown",Xr),e.manualHomePosition=!0,Ae("scroll-mode"),et=qt(),B();let ra=Gt.start(e),cl=e.registerHook("useFrame",q=>{if(!ee.active)return;if(!i()||w!=="scroll-mode"||E||T||xt||e.world.hasActiveZone()){Ft();return}let ht=Math.exp(-q/Math.max(1,m));if(ee.vy*=ht,Math.abs(ee.vy)*e.getScaleFactor()<=.02){Ft();return}let Ot=et;if(U(et+ee.vy*q),Math.abs(et-Ot)<=.01){Ft();return}e.updateNextFrame()}),dl=e.registerHook("useAfterFrame",()=>{if(i()){if(ze(),Z(),B(),T&&!e.transitionManager.hasPending()&&(T=!1,E=!1),R&&w==="zone-active"&&!e.transitionManager.hasPending()){let q=e.world.getActiveZone();if(q&&q.id===R){let ht=wt(q);ht&&(A=kT(ht),et=ht.y)}R=void 0}E||Pt()&&Y()}}),fl=e.world.addLayoutSubscriber(q=>{if(i()){if((q==="recalculate-world-size"||q==="zone-changed")&&ri(),q==="goto-region"&&(E=!1),q==="recalculate-world-size"&&w==="scroll-mode"&&!E){let ht=A?A.y:et;e.world.zones.length&&ht===0&&(et=qt()),U(et),y()}if(q==="zone-changed"){if(e.world.hasActiveZone()){Ft(),Zt(),M=!0;let Ot=e.world.getActiveZone();!S&&Ot?R=Ot.id:A||(A=kT({...e.getViewport(),y:et})),S=!1,Ae("zone-active");return}let ht=w==="zone-active";if(R=void 0,Ae("scroll-mode"),T)return;ht?(E=!0,Yt()):E||U(et)}}});return()=>{Ft(),Zt(),ra(),cl(),dl(),fl(),e.world.removeEventListener("click",Bt),e.world.removeEventListener("wheel",he),e.world.removeEventListener("mousedown",Ue),e.world.removeEventListener("mousemove",Le),e.world.removeEventListener("mouseup",Ve),e.world.removeEventListener("touchstart",An),e.world.removeEventListener("touchmove",Qn),e.world.removeEventListener("touchend",Mi),e.world.removeEventListener("touchcancel",Oi),window.removeEventListener("mouseup",Ve),window.removeEventListener("touchend",Ui),window.removeEventListener("touchcancel",Oi),window.removeEventListener("keydown",Xr),i()&&(jT.delete(e),e.manualHomePosition=b,e.mode=g)}},updatePosition(){}}),qv=k.default.createContext(null);qv.displayName="Atlas";var Uv=k.default.createContext(null);Uv.displayName="Bounds";var wd=k.default.createContext("explore");wd.displayName="Mode";var oj=()=>(0,k.useContext)(wd);var sj=class{constructor(t){C(this,"runtime",void 0),C(this,"pendingTransition",void 0),C(this,"lastZoomTo",null),C(this,"isConstraining",!1),C(this,"lastGoToRegion",null),this.runtime=t,this.pendingTransition={from:It(5),to:It(5),elapsed_time:0,done:!0,total_time:0,timingFunction:Ur.easeInOutQuad,constrain:!1}}hasPending(){return!this.pendingTransition.done}getPendingTransition(){return this.pendingTransition}getPendingFrom(){return this.pendingTransition.from}customTransition(t){t(this.pendingTransition)}stopTransition(){this.pendingTransition.from=It(this.runtime.target),this.pendingTransition.to=It(this.runtime.target),this.pendingTransition.done=!0,this.pendingTransition.elapsed_time=0,this.pendingTransition.total_time=0}runTransition(t,e){if(!this.pendingTransition.done){let n=this.pendingTransition,i=n.total_time===0?0:(n.elapsed_time+e)/n.total_time,a=n.total_time===0?1:i===0?0:n.timingFunction(i);t[1]=n.from[1]+(n.to[1]-n.from[1])*a,t[2]=n.from[2]+(n.to[2]-n.from[2])*a,t[3]=n.from[3]+(n.to[3]-n.from[3])*a,t[4]=n.from[4]+(n.to[4]-n.from[4])*a,this.pendingTransition.elapsed_time+=e,this.pendingTransition.elapsed_time>=this.pendingTransition.total_time&&(this.pendingTransition.done=!0,this.pendingTransition.callback?.(),this.pendingTransition.constrain&&this.constrainBounds({transition:{duration:this.pendingTransition.total_time===0?0:500,easing:Ur.easeOutExpo}}))}}resumeTransition(){this.lastZoomTo&&this.zoomTo(this.lastZoomTo.factor,this.lastZoomTo.options),this.isConstraining&&this.constrainBounds(),this.lastGoToRegion&&this.goToRegion(this.lastGoToRegion.target,this.lastGoToRegion.options)}zoomTo(t,e={}){let{origin:n,stream:i=!1,transition:a}=e;this.lastZoomTo={factor:t,options:e};let r=this.runtime.getZoomedPosition(t,{origin:n}),l=Math.abs(1-t);this.applyTransition(r,a,{duration:2e3*l,easing:Ur.easeOutExpo,constrain:!0,callback:()=>{this.lastZoomTo=null}},{stream:!1})}constrainBounds({transition:t,panPadding:e=0}={}){this.isConstraining=!0;let[n,i]=this.runtime.constrainBounds(this.runtime.target,{panPadding:e});if(n){this.applyTransition(i,t,{duration:500,easing:Ur.easeOutQuart,constrain:!1,callback:()=>{this.isConstraining=!1}}),this.runtime.updateNextFrame();return}this.isConstraining=!1}constrainTarget(t,{origin:e,transition:n,panPadding:i=0}={}){this.isConstraining=!0;let[a,r]=this.runtime.constrainTarget(t,{origin:e,panPadding:i});if(a){this.applyTransition(r,n,{duration:500,easing:Ur.easeOutQuart,constrain:!1,callback:()=>{this.isConstraining=!1}}),this.runtime.updateNextFrame();return}this.isConstraining=!1}applyTransition(t,e,n,{stream:i}={}){this.pendingTransition.from=It(this.runtime.target),this.pendingTransition.to=t,i||(this.pendingTransition.elapsed_time=0),this.pendingTransition.done=!1,this.pendingTransition.total_time=e?.duration===void 0?n?.duration===void 0?1e3:n.duration:e.duration,this.pendingTransition.constrain=e?.constrain===void 0?n?.constrain===void 0?!1:n.constrain:e.constrain,this.pendingTransition.timingFunction=e?.easing||n?.easing||Ur.easeInOutSine}goToRegion(t,{transition:e}={}){this.lastGoToRegion={target:t,options:{transition:e}};let n=this.runtime.clampRegion(t);this.applyTransition(de.singleBox(n.width,n.height,n.x,n.y),e,{duration:1e3,easing:Ur.easeOutExpo,constrain:!0,callback:()=>{this.lastGoToRegion=null}}),this.runtime.updateNextFrame()}};Number.MIN_VALUE+1;var Vv=class{get x(){return this.target[1]}set x(t){this.target[1]=t}get y(){return this.target[2]}set y(t){this.target[2]=t}get x2(){return this.target[3]}set x2(t){this.target[3]=t}get y2(){return this.target[4]}set y2(t){this.target[4]=t}get width(){return this.target[3]-this.target[1]}set width(t){this.target[3]=this.target[1]+t}get height(){return this.target[4]-this.target[2]}set height(t){this.target[4]=this.target[2]=t}constructor(t,e,n,i=[],a){C(this,"id",Fv()),C(this,"ready",!1),C(this,"readyCycle",0),C(this,"readyReason","initial"),C(this,"readyTimestamp",void 0),C(this,"renderer",void 0),C(this,"world",void 0),C(this,"target",void 0),C(this,"homePosition",void 0),C(this,"manualHomePosition",void 0),C(this,"manualFocalPosition",void 0),C(this,"focalPosition",void 0),C(this,"homePaddingPx",void 0),C(this,"transitionManager",void 0),C(this,"aggregate",void 0),C(this,"transformBuffer",It(500)),C(this,"lastTarget",It(5)),C(this,"zoomBuffer",It(5)),C(this,"logNextRender",!1),C(this,"pendingUpdate",!0),C(this,"isCommitting",!1),C(this,"firstRender",!0),C(this,"lastTime",void 0),C(this,"stopId",void 0),C(this,"mode","explore"),C(this,"controllers",[]),C(this,"controllersRunning",!1),C(this,"controllerStopFunctions",[]),C(this,"maxScaleFactor",1),C(this,"_viewerToWorld",{x:0,y:0}),C(this,"_lastGoodScale",1),C(this,"debugFrame",0),C(this,"debugSubscribers",new Set),C(this,"hooks",{useFrame:[],useBeforeFrame:[],useAfterPaint:[],useAfterFrame:[]}),C(this,"fpsLimit",void 0),C(this,"options",void 0),C(this,"hookOptions",{filters:{grayscale:0,contrast:0,brightness:0,saturate:0,sepia:0,invert:0,hueRotate:0,blur:0}}),C(this,"_viewport",{x:0,y:0,width:0,height:0}),C(this,"setViewport",r=>{let l=Math.round(r.x===void 0?this.target[1]:r.x),u=Math.round(r.y===void 0?this.target[2]:r.y);r.width?this.target[3]=l+r.width:this.target[3]=this.target[3]-this.target[1]+l,r.height?this.target[4]=u+r.height:this.target[4]=this.target[4]-this.target[2]+u,Math.abs(this.target[1]-l)>.01&&(this.target[1]=l),Math.abs(this.target[2]-u)>.01&&(this.target[2]=u),this.pendingUpdate=!0}),C(this,"render",r=>{let l=r-this.lastTime;if(this.isCommitting||this.fpsLimit&&l<1e3/this.fpsLimit){this.stopId=window.requestAnimationFrame(this.render);return}this.lastTime=r,this.world.flushSubscriptions(),this.stopId=window.requestAnimationFrame(this.render),this.hook("useFrame",l);let u=this.pendingUpdate,f=this.renderer.pendingUpdate(),h=this.world.hasPendingAnimation(),d=this.hasDebugSubscribers();if(this.transitionManager.hasPending()&&(this.transitionManager.runTransition(this.target,l),this.pendingUpdate=!0,u=!0,this.updateControllerPosition()),h&&(this.pendingUpdate=!0,u=!0),!this.firstRender&&!u&&!f&&!h&&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;let m=++this.debugFrame,y=0;d&&this.emitDebug({type:"frame-start",at:r,runtimeId:this.id,frame:m,delta:l,mode:this.mode,pendingUpdate:u,rendererPendingUpdate:f,target:[this.target[1],this.target[2],this.target[3],this.target[4]]}),this.hook("useBeforeFrame",l),this.renderer.beforeFrame(this.world,l,this.target,this.hookOptions);let g=this.getScaleFactor(),b=this.renderer.getPointsAt(this.world,this.target,this.aggregate,g),w=b.length;for(let S=0;S<w;S++){let R=b[S][0],A=b[S][1],M=b[S][2],z=M?Xi(A,M,this.transformBuffer):A;this.renderer.prepareLayer(R,R.__parent&&M?Xi(R.__parent.crop||R.__parent.points,M):z);let I=z.length/5;for(let L=0;L<I;L++){let H=L*5;if(z[H]!==0){if(this.renderer.paint(R,L,z[H+1],z[H+2],z[H+3]-z[H+1],z[H+4]-z[H+2]),y++,d){let V;if(R.getImageUrl)try{V=R.getImageUrl(L)}catch{V=void 0}this.emitDebug({type:"paint",at:r,runtimeId:this.id,frame:m,layerIndex:S,tileIndex:L,x:z[H+1],y:z[H+2],width:z[H+3]-z[H+1],height:z[H+4]-z[H+2],paintId:R.id||`${S}:${L}`,paintType:R?.constructor?.name||R.type||"UnknownPaint",ownerId:R.__owner?.value?.id,compositeId:R.__parent?.id,imageUrl:V})}this.hook("useAfterPaint",R)}}this.renderer.finishLayer(R,A)}this.renderer.afterFrame(this.world,l,this.target,this.hookOptions),this.pendingUpdate=!1,this.hook("useAfterFrame",l),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.logNextRender=!1,!this.ready&&this.renderer.isReady()&&(this.ready=!0,this.readyTimestamp=performance.now(),this.world.trigger("ready")),d&&this.emitDebug({type:"frame-end",at:r,runtimeId:this.id,frame:m,delta:l,scaleFactor:g,paintCount:y,ready:this.ready,pendingUpdate:this.pendingUpdate,worldWidth:this.world.width,worldHeight:this.world.height,target:[this.target[1],this.target[2],this.target[3],this.target[4]]}),this.world.flushSubscriptions();let E=this.world.getScheduledUpdates(this.target,g),T=E.length;if(T>0)for(let S=0;S<T;S++){let R=E[T-S-1]();R?R.then(()=>{this.pendingUpdate=!0}):this.pendingUpdate=!0}}),this.renderer=t,this.world=e,this.options={maxOverZoom:1,maxUnderZoom:1,visibilityRatio:1,...a||{}},this.target=de.projection(n),this.manualHomePosition=!1,this.pendingUpdate=!0,this.homePosition=de.projection(this.world),this.manualFocalPosition=!1,this.focalPosition=this.target,this.updateFocalPosition(),this.transitionManager=new sj(this),this.aggregate=ho(1),this.world.addLayoutSubscriber(r=>{(r==="repaint"||r==="zone-changed")&&(this.pendingUpdate=!0),r==="recalculate-world-size"&&(this.manualHomePosition||(this.setHomePosition(),this.goHome()),this.updateFocalPosition())}),this.lastTime=performance.now(),this.controllers=i,this.render(this.lastTime),this.startControllers(),this.homePaddingPx=void 0}setHomePosition(t){this.homePosition.set(de.projection(t||this.world)),this.pendingUpdate=!0}setHomePaddingPx(t){this.homePaddingPx=t,this.pendingUpdate=!0}getHomePaddingPx(){return this.homePaddingPx}startControllers(){if(!this.controllersRunning){for(let t of this.controllers)this.controllerStopFunctions.push(t.start(this));this.controllersRunning=!0}}stopControllers(){if(this.controllersRunning){for(let t of this.controllerStopFunctions)t();this.controllersRunning=!1,this.controllerStopFunctions=[]}}updateControllerPosition(){for(let t of this.controllers)t.updatePosition(this.x,this.y,this.width,this.height)}triggerResize(){this.renderer.triggerResize&&this.renderer.triggerResize(),this.pendingUpdate=!0}addController(t){this.controllers.push(t),this.controllersRunning&&t.start(this),this.pendingUpdate=!0}cover(){return this.goHome({cover:!0})}getRendererScreenPosition(){return this.renderer.getRendererScreenPosition()}updateRendererScreenPosition(){this.pendingUpdate=!0,this.renderer.resize()}setOptions(t){this.options={...this.options,...t}}normalizePadding(t){return typeof t=="number"?{left:t,right:t,top:t,bottom:t}:t?{left:t.left||0,right:t.right||0,top:t.top||0,bottom:t.bottom||0}:{left:0,right:0,top:0,bottom:0}}getHomeTarget(t={}){let e=this.getRendererScreenPosition(),n=e?.width||this.width,i=e?.height||this.height,a=t.paddingPx===void 0?this.homePaddingPx:t.paddingPx,r=this.normalizePadding(a),l=Math.max(1,n-r.left-r.right),u=Math.max(1,i-r.top-r.bottom),f=t.position?{x:t.position[1],y:t.position[2],width:t.position[3]-t.position[1],height:t.position[4]-t.position[2]}:{x:this.homePosition[1],y:this.homePosition[2],width:this.homePosition[3]-this.homePosition[1],height:this.homePosition[4]-this.homePosition[2]},h=l/u,d=f.width/f.height,m,y,g,b;(t.cover?d<h:d>h)?(m=f.width,y=f.width/h,g=f.x,b=f.y-(y-f.height)/2):(y=f.height,m=f.height*h,g=f.x-(m-f.width)/2,b=f.y);let w=m/l,E=r.left*w,T=r.right*w,S=r.top*w,R=r.bottom*w;return{x:g-E,y:b-S,width:m+E+T,height:y+S+R}}isViewportAtHome(t={}){let{cover:e=!1,tolerance:n=1,target:i=this.getViewport()}=t,a=this.getHomeTarget({cover:e});return Math.abs(i.x-a.x)<=n&&Math.abs(i.y-a.y)<=n&&Math.abs(i.width-a.width)<=n&&Math.abs(i.height-a.height)<=n}isViewportAtHomeZoomLevel(t={}){let{cover:e=!1,tolerance:n=.05,target:i=this.getViewport()}=t,a=this.getHomeTarget({cover:e}),r=this.renderer.getScale(i.width,i.height)||this._lastGoodScale,l=this.renderer.getScale(a.width,a.height)||this._lastGoodScale;return l===0?!1:Math.abs(r/l-1)<=n}goHome(t={}){if(this.world.width<=0||this.world.height<=0)return;let e=t.paddingPx===void 0?this.homePaddingPx:t.paddingPx,n=this.normalizePadding(e);if(n.left>0||n.right>0||n.top>0||n.bottom>0){let i=this.getHomeTarget(t);this.target[1]=Math.round(i.x),this.target[2]=Math.round(i.y),this.target[3]=Math.round(i.x+i.width),this.target[4]=Math.round(i.y+i.height)}else{let i=this.getScaleFactor(),a=t.position?{x:t.position[1],y:t.position[2],width:t.position[3]-t.position[1],height:t.position[4]-t.position[2]}:{x:this.homePosition[1],y:this.homePosition[2],width:this.homePosition[3]-this.homePosition[1],height:this.homePosition[4]-this.homePosition[2]},r=this.width*i,l=this.height*i,u=a.width/r,f=a.height/l,h=r/l;if(t.cover?u>f:u<f){let d=h*a.height,m=(d-a.width)/2;this.target[1]=Math.round(-m+a.x),this.target[2]=Math.round(a.y),this.target[3]=Math.round(d-m+a.x),this.target[4]=Math.round(a.height+a.y)}else{let d=a.width/h,m=(d-a.height)/2;this.target[1]=Math.round(a.x),this.target[2]=Math.round(a.y-m),this.target[3]=Math.round(a.x+a.width),this.target[4]=Math.round(a.y+d-m)}}this.constrainBounds(this.target),this.updateControllerPosition()}resize(t,e,n,i){this.transitionManager.hasPending()&&this.transitionManager.stopTransition(),this.updateFocalPosition(t-e,n-i);let a=e/t,r=i/n;this.target[3]=this.target[1]+(this.target[3]-this.target[1])*a,this.target[4]=this.target[2]+(this.target[4]-this.target[2])*r,this.goHome({position:this.focalPosition}),this.renderer.resize(e,i),this.pendingUpdate=!0,this.transitionManager.resumeTransition()}updateFocalPosition(t,e){if(!this.manualFocalPosition){let n=this.width,i=this.height,a=Math.min(n,i),r=this.x+0,l=this.y+0;if(n<i){let u=this.height-this.width;this.focalPosition=de.projection({x:r,y:l+u/2,width:a-0,height:a-0}),this.pendingUpdate=!0}else{let u=this.width-this.height;this.focalPosition=de.projection({x:r+u/2,y:l,width:a-0,height:a-0}),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(t,{panPadding:e=0,ref:n=!1}={}){let{minX:i,maxX:a,minY:r,maxY:l}=this.getBounds({target:t,padding:e}),u=!1,f=n?t:It(t),h=Math.round(t[3]-t[1]),d=Math.round(t[4]-t[2]);return i>t[1]&&(u=!0,f[1]=i,f[3]=i+h),r>t[2]&&(u=!0,f[2]=r,f[4]=r+d),a<t[1]&&(u=!0,f[1]=a,f[3]=a+h),l<t[2]&&(u=!0,f[2]=l,f[4]=l+d),[u,f]}getBounds(t){let e=t.target||this.target,n=t.padding,i=this.options.visibilityRatio,a=Math.abs(1-i);if(this.world.hasActiveZone()){let E=this.world.getActiveZone();if(E){E.recalculateBounds();let T=A3(e,E.points,n);if(T)return T}}let r=e[3]-e[1],l=this.world.width,u=-r*a,f=l-r-u,h=e[4]-e[2],d=this.world.height,m=-h*a,y=d-h-m,g=Math.round(Math.max(u,f)),b=Math.round(Math.min(u,f)),w=Math.round(Math.max(m,y));return{minX:b,maxX:g,minY:Math.round(Math.min(m,y)),maxY:w}}getScaleFactor(t=!1){let e=this.renderer.getScale(this.target[3]-this.target[1],this.target[4]-this.target[2],t);return e===0?this._lastGoodScale:(this._lastGoodScale=e,e)}copyStrandValues(t,e){t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4]}getZoomConstraintState(t){let e=t[3]-t[1],n=t[4]-t[2],i=this.renderer.getScale(e,n),a=i===0?this._lastGoodScale:i;i!==0&&(this._lastGoodScale=i);let r=e*a,l=n*a,u=this.world.width/r>this.world.height/l?r*this.options.maxUnderZoom/this.world.width:l*this.options.maxUnderZoom/this.world.height,f=this.getRendererScreenPosition()?.width,h=f?f/this.world.width:1;return{scaleFactor:a,minScale:u,maxScale:Math.max(h||1,this.options.maxOverZoom)}}constrainTarget(t,{origin:e,panPadding:n=0,ref:i=!1}={}){let a=!1,r=i?t:It(t),{scaleFactor:l,minScale:u,maxScale:f}=this.getZoomConstraintState(r),h=Math.max(u,Math.min(f,l));if(Math.abs(h-l)>1e-6){let m=e||{x:r[1]+(r[3]-r[1])/2,y:r[2]+(r[4]-r[2])/2},y=Xi(r,Ul(l/h,m.x,m.y),this.zoomBuffer);this.copyStrandValues(r,y),a=!0}let[d]=this.constrainBounds(r,{ref:!0,panPadding:n});return[a||d,r]}getZoomedPosition(t,{origin:e,fromPos:n}){let i=n||this.target,{scaleFactor:a,minScale:r,maxScale:l}=this.getZoomConstraintState(i),u=1/t,f=a*u;u<1?f<r&&(t=a/r):f>l&&(t=a/l);let h=Xi(i,Ul(t,e?e.x:i[1]+(i[3]-i[1])/2,e?e.y:i[2]+(i[4]-i[2])/2),this.zoomBuffer),d=this.world.hasActiveZone()?0:100;return this.constrainBounds(h,{ref:!0,panPadding:d}),h}clampRegion({x:t,y:e,width:n,height:i,padding:a=0}){let r=this.width,l=this.height,u=n/r<i/l,f=t-a,h=e-a,d=n+a*2,m=i+a*2;if(u){let g=m/l*r;return{x:f-(g-d)/2,y:h,width:g,height:m}}let y=d/r*l;return{x:f,y:h-(y-m)/2,width:d,height:y}}viewerToWorld(t,e){let n=this.getScaleFactor();return this._viewerToWorld.x=this.target[1]+t/n,this._viewerToWorld.y=this.target[2]+e/n,this._viewerToWorld}worldToViewer(t,e,n,i){let a=de.singleBox(n,i,t,e);return hr(a,Nr(ho(this.getScaleFactor()),ci(-this.target[1],-this.target[2]))),{x:a[1],y:a[2],width:a[3]-a[1],height:a[4]-a[2],strand:a}}setScale(t,e){hr(this.target,Ul(t,e?e.x:this.target[1]+(this.target[3]-this.target[1])/2,e?e.y:this.target[2]+(this.target[4]-this.target[2])/2)),this.pendingUpdate=!0}syncTo(t){let e=this.target;return this.target=t.target,this.pendingUpdate=!0,()=>{this.target=e}}stop(){return this.stopId!==void 0&&(window.cancelAnimationFrame(this.stopId),this.stopId=void 0),()=>{this.render(performance.now())}}reset(){this.renderer.reset(),this.resetReadyState("runtime-reset")}resetReadyState(t="manual"){this.ready=!1,this.readyCycle+=1,this.readyReason=t,this.readyTimestamp=void 0,this.renderer.resetReadyState&&this.renderer.resetReadyState(),this.pendingUpdate=!0}getReadyState(){return{ready:this.ready,cycle:this.readyCycle,reason:this.readyReason,timestamp:this.readyTimestamp}}selectZone(t){this.world.selectZone(t),this.pendingUpdate=!0}goToZone(t,e={}){let n=this.world.getZoneById(t);if(!n||(n.recalculateBounds(),n.points[0]===0))return!1;this.world.selectZone(t);let i=this.getHomeTarget({position:n.points,paddingPx:e.paddingPx});return e.immediate?(this.transitionManager.stopTransition(),this.setViewport(i),this.constrainBounds(this.target,{ref:!0}),this.updateControllerPosition(),this.pendingUpdate=!0,!0):(this.transitionManager.applyTransition(de.singleBox(i.width,i.height,i.x,i.y),void 0,{duration:1e3,easing:Ur.easeOutExpo,constrain:!1}),this.updateNextFrame(),this.pendingUpdate=!0,!0)}deselectZone(){this.world.deselectZone(),this.pendingUpdate=!0}getZoneRuntimeState(t,e=this.getViewport()){let n=this.world.getZoneById(t);if(!n)return{zoneId:t,exists:!1,active:!1,visibleInViewport:!1};n.recalculateBounds();let i=this.world.getActiveZone()?.id===t;if(n.points[0]===0)return{zoneId:t,exists:!0,active:i,visibleInViewport:!1};let a=n.points[1],r=n.points[2],l=n.points[3]-n.points[1],u=n.points[4]-n.points[2];return{zoneId:t,exists:!0,active:i,visibleInViewport:a<e.x+e.width&&a+l>e.x&&r<e.y+e.height&&r+u>e.y}}hook(t,e){let n=this.hooks[t].length;if(n!==0)for(let i=0;i<n;i++)this.hooks[t][i](e)}registerHook(t,e){return this.hooks[t].push(e),()=>{this.hooks[t]=this.hooks[t].filter(n=>n!==e)}}updateNextFrame(){this.pendingUpdate=!0}addDebugSubscriber(t){return this.debugSubscribers.add(t),()=>{this.removeDebugSubscriber(t)}}removeDebugSubscriber(t){this.debugSubscribers.delete(t)}hasDebugSubscribers(){return this.debugSubscribers.size>0}emitDebug(t){if(this.debugSubscribers.size!==0)for(let e of this.debugSubscribers)e(t)}},GT={margin:0},lj=class{constructor(t,e={}){C(this,"id",void 0),C(this,"config",void 0),C(this,"points",void 0),C(this,"objects",void 0),Array.isArray(t)?(this.id=t.map(n=>n.id).join("$$"),this.config={...GT,...e},this.objects=[...t]):(this.id=t.id,this.config={...GT,margin:typeof t.margin=="number"?t.margin:GT.margin,x:t.x,y:t.y,width:t.width,height:t.height},this.objects=[...t.objects||[]]),this.points=It(5),this.recalculateBounds()}applyProps(t){t.id!==void 0&&(this.id=t.id),this.config={...this.config,...t},this.recalculateBounds()}addObject(t){this.objects.indexOf(t)===-1&&(this.objects.push(t),this.recalculateBounds())}removeObject(t){this.objects=this.objects.filter(e=>e!==t),this.recalculateBounds()}recalculateBounds(){if(!(Number.isFinite(this.config.x)&&Number.isFinite(this.config.y)&&Number.isFinite(this.config.width)&&Number.isFinite(this.config.height)&&this.config.width>0&&this.config.height>0)){this.points.set([0,0,0,0,0]);return}let t=this.config.margin,e=this.config.x,n=this.config.y,i=this.config.width,a=this.config.height;this.points.set([1,e-t,n-t,e+i+t,n+a+t])}getPointsAt(t,e,n){return[]}},Nv;if(typeof performance=="object"&&typeof performance.now=="function"){let t=performance;Nv=()=>t.now()}else{let t=Date,e=t.now();Nv=()=>t.now()-e}var l3=typeof Vh.default=="function"?Vh.default:typeof Vh.default?.default=="function"?Vh.default.default:null,jr=class{constructor(t){C(this,"world",void 0),C(this,"zone",void 0),C(this,"isRegistered",!1),C(this,"directWorldObjects",[]),this.world=t,this.zone=new lj({id:""})}applyProps(t){this.zone.applyProps({id:t.id,x:t.x,y:t.y,width:t.width,height:t.height,margin:t.margin})}appendChild(t){t instanceof Do&&(this.registerDirectWorldObject(t),this.world.appendChild(t))}removeChild(t){t instanceof Do&&(this.unregisterDirectWorldObject(t),this.world.removeChild(t))}insertBefore(t,e){if(t instanceof Do){if(this.registerDirectWorldObject(t),e instanceof Do){this.world.insertBefore(t,e);return}this.world.appendChild(t)}}hideInstance(){}attachToWorld(t){this.isRegistered&&this.world!==t&&(this.world.removeZone(this.zone),this.isRegistered=!1),this.world=t,this.isRegistered||(this.world.addZone(this.zone),this.isRegistered=!0)}unmount(){this.directWorldObjects=[],this.isRegistered&&(this.world.removeZone(this.zone),this.isRegistered=!1)}registerDirectWorldObject(t){this.directWorldObjects.indexOf(t)===-1&&this.directWorldObjects.push(t),this.zone.addObject(t)}unregisterDirectWorldObject(t){this.directWorldObjects=this.directWorldObjects.filter(e=>e!==t),this.zone.removeObject(t)}};function u3(t,e){if(t instanceof fu&&e instanceof jr){e.attachToWorld(t);return}if(t instanceof jr){t.appendChild(e);return}t&&t.appendChild&&e&&t.appendChild(e)}function X3(t,e){if(t instanceof fu&&e instanceof jr){e.unmount();return}if(t instanceof jr){t.removeChild(e);return}t&&t.removeChild&&e&&t.removeChild(e)}function uj(t,e){if(e instanceof jr){e.unmount();return}return X3(t.world,e)}function cj(t,e,n){if(e instanceof jr){e.attachToWorld(t.world);return}return Q3(t.world,e,n)}function Q3(t,e,n){if(t&&t instanceof Vv&&(t=t.world),!(t instanceof fu&&e instanceof jr)){if(t instanceof jr){t.insertBefore(e,n);return}t&&t.insertBefore&&t.insertBefore(e,n)}}function K3(t,e,n){if(n&&(t.applyProps&&t.applyProps(n),t instanceof kr))for(let i of Pv){let a=i.slice(2).toLowerCase();n[i]!==e[i]&&(e[i]&&t.removeEventListener(a,e[i]),t.addEventListener(a,n[i]))}}function Z3(t,e){let n=Object.keys(e),i=!1;for(let a of n)if(Pv.indexOf(a)!==-1){let r=xd[a];if(r){if(t.activatedEvents.indexOf(r)!==-1)continue;i=!0,t.activatedEvents.push(r)}}i&&t.triggerEventActivation()}var Lv=new Map,c3={};function dj(t,{args:e=[],...n},i,a,r){if(!(i instanceof Vv)&&r){let f=h=>h.return?f(h.return):h.stateNode&&h.stateNode.containerInfo;i=f(r)}let l,u=i.world;switch(t){case"world":l=fu.withProps({width:n.width,height:n.height,viewingDirection:"left-to-right"}),l.activatedEvents=u.activatedEvents,l.eventHandlers=u.eventHandlers,l.subscriptions=u.subscriptions,l.triggerEventActivation(),u=l;break;case"box":l=new Sd;break;case"shape":l=new rR;break;case"worldObject":case"world-object":l=new Do;break;case"zone":l=new jr(u);break;case"worldImage":case"world-image":l=new gi;break;case"texture":l=new _v;break;case"compositeImage":case"composite-image":l=new oR({id:n.id,width:n.width,height:n.height,images:[],renderOptions:n.renderOptions});break;case"tiledImage":case"tiled-image":l=Ri.fromTile(n.uri,n.display,n.tile,n.scaleFactor,void 0,n.format,n.useFloorCalc,n.version3);break;case"mapTiledImage":case"map-tiled-image":l=new q8({id:n.id,bounds:n.bounds,worldWidth:n.worldWidth,worldHeight:n.worldHeight,zoom:n.zoom,tileSize:n.tileSize,scaleFactor:n.scaleFactor,tileSource:n.tileSource,tileUrlTemplate:n.tileUrlTemplate,subdomains:n.subdomains});break;case"paragraph":l=new jh,l.text=n.children;break;default:return}return Z3(u,n),K3(l,{},n),l}function fj(t,e){if(e instanceof fu)t.world=e;else if(e instanceof jr)e.attachToWorld(t.world);else if(e instanceof Do)t.world.appendChild(e);else if(e)throw Error("Invalid root")}var Tv=0,Xs=l3?l3({unstable_now:Nv,now:Nv,createInstance:dj,removeChild:X3,appendChild:u3,appendInitialChild:u3,insertBefore:Q3,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:fj,removeChildFromContainer:uj,createTextInstance(){},insertInContainerBefore:cj,prepareUpdate(t,e,n,i,a){return Z3(a.world,i),i},commitUpdate(t,e,n,i,a){let r=i,l=n;typeof r=="string"&&(r=n),t.applyProps&&r&&K3(t,l,r)},finalizeInitialChildren(t){return t?.__handlers},getChildHostContext(){return c3},getRootHostContext(){return c3},prepareForCommit(t){return t.isCommitting=!0,null},preparePortalMount(){},hideInstance(t){t&&t.points&&(t.points[0]=0)},unhideInstance(t,e){t&&t.points&&(t.points[0]=1)},getPublicInstance(t){return t},hideTextInstance(){throw Error("Text is not allowed in the react-three-fibre tree. You may have extraneous whitespace between components.")},resetAfterCommit(t){t.isCommitting=!1,t.pendingUpdate=!0,t.world&&t.world.needsRecalculate&&(t.world.recalculateWorldSize(),t.world.triggerRepaint())},shouldSetTextContent(){return!1},clearContainer(){return!1},supportsHydration:!1,supportsPersistence:!1,detachDeletedInstance(t){},afterActiveInstanceBlur(){},beforeActiveInstanceBlur(){},getCurrentEventPriority(){return 32},getInstanceFromNode(t){throw Error("Not implemented")},getInstanceFromScope(t){throw Error("Not implemented")},prepareScopeUpdate(t,e){throw Error("Not implemented")},logRecoverableError(){},requestPostPaintCallback(){},rendererPackageName:"@atlas-viewer/atlas",rendererVersion:k.version,shouldAttemptEagerTransition:()=>!1,trackSchedulerEvent:()=>{},resolveEventType:()=>null,resolveEventTimeStamp:()=>-1.1,maySuspendCommit:()=>!1,preloadInstance:()=>!0,startSuspendingCommit(){},suspendInstance(){},waitForCommitToBeReady:()=>null,NotPendingTransition:null,setCurrentUpdatePriority(t){Tv=t},getCurrentUpdatePriority(){return Tv},resolveUpdatePriority(){if(Tv!==0)return Tv;switch(typeof window<"u"&&window.event?.type){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return 2;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return 8;default:return 32}},resetFormInstance(){}}):null;Xs&&Xs.injectIntoDevTools();function lR(t,e){let n=Lv.get(t);if(n){if(!Xs)return;Xs.updateContainer(null,n,null,()=>{Lv.delete(t),e&&e(t)})}}var d3={render(t,e){let n=Lv.get(e);if(Xs)if(n)Xs.updateContainer(t,n,null);else{let i=Xs.createContainer(e,0,null,!1,null,"",()=>{},null);Xs.updateContainer(t,i,null),Lv.set(e,i)}},unmountComponentAtNode(t,e){lR(t,e)}},Xh=typeof window<"u"&&(window.document?.createElement||window.navigator?.product==="ReactNative")?Dv.useLayoutEffect:Dv.useEffect,hj=k.default.memo(({children:t,setIsReady:e,onCreated:n,bounds:i,preset:a,mode:r="explore",interactionMode:l="popmotion"})=>{let u=(0,k.useRef)(new WeakSet);return(0,k.useEffect)(()=>{if(!a||u.current.has(a))return;u.current.add(a),l!=="pdf-scroll-zone"&&a.runtime.goHome();let f=!1;return Promise.resolve(n?.(a)).then(()=>{f||e(!0)}),()=>{f=!0}},[l,n,a,e]),Xh(()=>{if(a){let f=a.runtime;r!==f.mode&&(f.mode=r),d3.render((0,K.jsx)(k.default.StrictMode,{children:(0,K.jsx)(Uv.Provider,{value:i,children:(0,K.jsx)(wd.Provider,{value:r,children:(0,K.jsx)(qv.Provider,{value:a,children:t})})})}),f)}},[a,r,i,t]),Xh(()=>{if(a){let f=a.runtime;return()=>{d3.unmountComponentAtNode(f)}}return()=>{}},[a]),null}),kh=k.default.forwardRef((t,e)=>(0,K.jsx)("div",{...t,ref:e,part:t.className})),jv=()=>(0,k.useContext)(qv),Jh=()=>{let t=jv();return t?t.runtime:void 0},JT=new Set,Po=new Map,Kh=new Map,Zh=[],Mv,Vr,W3={activeCandidateId:void 0,selectedRuntimeId:void 0,candidates:[],runtimes:[]};function J3(){let t=Array.from(Po.entries()).map(([e,n],i)=>({id:e,runtime:n.runtime,preset:n.preset,label:`Atlas ${i+1} (${e.slice(0,6)})`}));W3={activeCandidateId:Mv,selectedRuntimeId:Vr,candidates:[...Zh],runtimes:t}}function du(){J3();for(let t of JT)t()}function $h(){if(Vr&&Po.has(Vr))return;let t=Po.keys().next();Vr=t.done?void 0:t.value}function $3(){Mv&&Kh.has(Mv)||(Mv=Zh[0])}function pj(t){return JT.add(t),()=>{JT.delete(t)}}function f3(){return W3}function mj(t){let e=t.runtime.id;return Po.set(e,{runtime:t.runtime,preset:t}),$h(),du(),()=>{gj(e)}}function gj(t){Po.delete(t),$h(),du()}function yj(t){return Kh.get(t.id)||Zh.push(t.id),Kh.set(t.id,t),$3(),!Vr&&t.runtimeId&&Po.has(t.runtimeId)&&(Vr=t.runtimeId),$h(),du(),()=>{bj(t.id)}}function vj(t,e){let n=Kh.get(t);n&&(n.runtimeId=e,!Vr&&e&&Po.has(e)&&(Vr=e),$h(),du())}function bj(t){Kh.delete(t);let e=Zh.indexOf(t);e!==-1&&Zh.splice(e,1),$3(),du()}function h3(t){if(!t){Vr=void 0,$h(),du();return}Po.has(t)&&(Vr=t,du())}function Sj(t){if(t)return Po.get(t)}J3();function tD(t,e=[]){if(!t)return e;if(Array.isArray(t.renderers)){for(let n of t.renderers)tD(n,e);return e}return e.push(t),e}function $T(t,e,n,i){if(t){if(t instanceof Do){if(Array.isArray(t.layers))for(let a of t.layers)$T(a,e,t.id,i);return}if(t instanceof oR){let a=t.id,r=new Set([...t.allImages,...t.images]);for(let l of r)$T(l,e,n,a);return}if(t instanceof gi||t instanceof Ri){let a={id:t.id,type:t.constructor.name,ownerId:n,compositeId:i,anomalies:[]};t.__host?.canvas&&(a.canvas={loading:!!t.__host.canvas.loading,indices:t.__host.canvas.indices?.length||0,loaded:t.__host.canvas.loaded?.length||0},a.canvas.loading&&a.canvas.indices===0&&a.anomalies.push("Canvas host marked loading with empty queue."),a.canvas.loaded>a.canvas.indices&&a.canvas.indices>0&&a.anomalies.push("Canvas loaded count exceeds scheduled indices.")),t.__host?.webgl&&(a.webgl={loading:t.__host.webgl.loading?.length||0,loaded:t.__host.webgl.loaded?.length||0,textures:t.__host.webgl.textures?.filter(Boolean)?.length||0},a.webgl.loading>0&&a.webgl.textures===0&&a.webgl.loaded===0&&a.anomalies.push("WebGL has pending loads but no loaded textures.")),e.push(a)}}}function xj(t){let e=[],n=t.getObjects();for(let i of n)i&&$T(i,e,i.id,void 0);return e}function wj(t){let e=tD(t.renderer);return{rendererTypes:e.map(n=>n?.constructor?.name||"UnknownRenderer"),canvas:e.filter(n=>n?.loadingQueue!==void 0).map(n=>({type:n?.constructor?.name||"CanvasRenderer",loadingQueue:n.loadingQueue?.length||0,imagesPending:n.imagesPending||0,imagesLoaded:n.imagesLoaded||0,tasksRunning:n.tasksRunning||0,firstMeaningfulPaint:!!n.firstMeaningfulPaint})),webgl:e.filter(n=>n?.gl!==void 0).map(n=>({type:n?.constructor?.name||"WebGLRenderer"}))}}function Tj(t,e=30){let n=new Map;for(let i of t){if(i.type!=="paint"||!i.compositeId)continue;n.has(i.frame)||n.set(i.frame,new Map);let a=n.get(i.frame);a.has(i.compositeId)||a.set(i.compositeId,[]),a.get(i.compositeId).push({paintId:i.paintId,paintType:i.paintType,tileIndex:i.tileIndex,imageUrl:i.imageUrl})}return Array.from(n.entries()).sort((i,a)=>a[0]-i[0]).slice(0,e).map(([i,a])=>({frame:i,composites:Array.from(a.entries()).map(([r,l])=>({compositeId:r,layers:l}))}))}function eD(t,e=[]){if(!t)return e;if(Array.isArray(t.renderers)){for(let n of t.renderers)eD(n,e);return e}return e.push(t),e}function tR(t,e){if(t){if(t instanceof gi||t instanceof Ri){e.push(t);return}if(t instanceof oR){let n=new Set([...t.allImages,...t.images]);for(let i of n)tR(i,e);return}if(t instanceof Do&&Array.isArray(t.layers))for(let n of t.layers)tR(n,e)}}function Rj(t){let e=[],n=t.getObjects();for(let i of n)i&&tR(i,e);return e}function Ej(t){let e=Rj(t.world),n=0;for(let r of e)n++,r.__host||(r.__host={}),r.__host.canvas={canvas:void 0,canvases:[],tiles:{},indices:[],loaded:[],loading:!1},r.__host.webgl&&(r.__host.webgl.loading=[],r.__host.webgl.loaded=[],Array.isArray(r.__host.webgl.textures)&&(r.__host.webgl.textures=[...Array(r.points.length/5)]));let i=eD(t.renderer),a=0;for(let r of i)a++,Array.isArray(r.loadingQueue)&&(r.loadingQueue=[]),Array.isArray(r.tileRequestQueue)&&(r.tileRequestQueue=[]),Array.isArray(r.drawCalls)&&(r.drawCalls=[]),Array.isArray(r.invalidated)&&(r.invalidated=[]),Array.isArray(r.imageIdsLoaded)&&(r.imageIdsLoaded=[]),r.hostCache?.clear&&r.hostCache.clear(),typeof r.tasksRunning=="number"&&(r.tasksRunning=0),typeof r.imagesPending=="number"&&(r.imagesPending=0),typeof r.imagesLoaded=="number"&&(r.imagesLoaded=0),typeof r.pendingDrawCall=="boolean"&&(r.pendingDrawCall=!1),typeof r.loadingQueueOrdered=="boolean"&&(r.loadingQueueOrdered=!0),r.requiredTileKeys?.clear&&r.requiredTileKeys.clear(),r.requiredPrefetchTileKeys?.clear&&r.requiredPrefetchTileKeys.clear(),r.queuedTileRequestKeys?.clear&&r.queuedTileRequestKeys.clear(),r.imageRequestPool?.cancelAll&&r.imageRequestPool.cancelAll({silent:!0}),r.inFlightImageLoads?.clear&&r.inFlightImageLoads.clear(),typeof r.reset=="function"&&r.reset();return t.updateNextFrame(),{imageHostsReset:n,renderersReset:a}}async function nD(t,e,n){if(k.version.startsWith("18.")||k.version.startsWith("19.")){let i=await Promise.resolve().then(()=>N(kL(),1)),a=i.default?i.default.createRoot:i.createRoot;n.current||(n.current=a(t)),n.current.render(e)}else if(typeof ReactDOM<"u"){let{render:i,unmountComponentAtNode:a}=ReactDOM;i(e,t),n.current={unmount(){a(t)}}}else{let i=await Promise.resolve().then(()=>N(kl(),1)),a=i.default?i.default.render:i.render,r=i.default?i.default.unmountComponentAtNode:i.unmountComponentAtNode;a(e,t),n.current={unmount(){r(t)}}}}var Aj=["Overview","World","Inspector","Events","Images","Actions"],Cj=0,Mj=t=>{let e=Jh(),n=t.runtimeId||e?.id,i=(0,k.useRef)(null),a=(0,k.useRef)(null);return(0,k.useEffect)(()=>{if(typeof document>"u")return;let r=document.createElement("div");return r.dataset.atlasDevtools="true",document.body.appendChild(r),i.current=r,()=>{a.current?.unmount&&a.current.unmount(),r.remove(),i.current=null}},[]),(0,k.useEffect)(()=>{let r=i.current;r&&nD(r,(0,K.jsx)(zj,{...t,runtimeId:n}),a)}),null};function p3(t,e,n){t.push(e),t.length>n&&t.splice(0,t.length-n)}function YT(t){if(!(!t||t.length<5))return{x1:Number(t[1].toFixed?t[1].toFixed(2):t[1]),y1:Number(t[2].toFixed?t[2].toFixed(2):t[2]),x2:Number(t[3].toFixed?t[3].toFixed(2):t[3]),y2:Number(t[4].toFixed?t[4].toFixed(2):t[4])}}function iD(t){return t?.constructor?.name||t?.type||"Unknown"}function Oj(t){let e=[],n=new Set,i=(r,l,u)=>{if(!r||n.has(r))return;n.add(r);let f=r.id?` #${r.id}`:"";if(e.push({key:u,depth:l,label:`${iD(r)}${f}`,ref:r}),Array.isArray(r.layers))for(let h=0;h<r.layers.length;h++)i(r.layers[h],l+1,`${u}.layers.${h}`);if(Array.isArray(r.images)||Array.isArray(r.allImages)){let h=new Set([...r.allImages||[],...r.images||[]]),d=0;for(let m of h)i(m,l+1,`${u}.images.${d}`),d++}};i(t.world,0,"world");let a=t.world.getObjects();for(let r=0;r<a.length;r++){let l=a[r];l&&i(l,1,`world.objects.${r}`)}return e}function _j(t){return t?.__host?t.__host.canvas?`Canvas host loading=${!!t.__host.canvas.loading} indices=${t.__host.canvas.indices?.length||0} loaded=${t.__host.canvas.loaded?.length||0}`:t.__host.webgl?`WebGL host loading=${t.__host.webgl.loading?.length||0} loaded=${t.__host.webgl.loaded?.length||0}`:"Host attached":"No host"}var zj=({initialOpen:t=!1,bottom:e=16,right:n=16,zIndex:i=1e3,maxEvents:a=500,maxRuntimeEvents:r=1e3,runtimeId:l,className:u,style:f})=>{let h=(0,k.useRef)(`devtools-${++Cj}`),[d,m]=(0,k.useState)(t),[y,g]=(0,k.useState)("Overview"),[b,w]=(0,k.useState)(!1),[E,T]=(0,k.useState)(!1),[S,R]=(0,k.useState)(null),[A,M]=(0,k.useState)("explore"),[z,I]=(0,k.useState)(""),[L,H]=(0,k.useState)(!1),[V,nt]=(0,k.useState)(""),[X,mt]=(0,k.useState)("all"),[,lt]=(0,k.useState)(0),it=(0,k.useRef)([]),yt=(0,k.useRef)([]),xt=(0,k.useRef)(null),et=(0,k.useRef)(!1),gt=()=>{et.current||(et.current=!0,requestAnimationFrame(()=>{et.current=!1,lt(_=>_+1)}))},Mt=l;(0,k.useEffect)(()=>yj({id:h.current,runtimeId:Mt}),[]),(0,k.useEffect)(()=>{vj(h.current,Mt)},[Mt]);let Vt=(0,k.useSyncExternalStore)(pj,f3,f3),Kt=Vt.activeCandidateId===h.current,te=Vt.selectedRuntimeId||Mt||Vt.runtimes[0]?.id,ue=Sj(te),dt=ue?.runtime,Ht=ue?.preset;if((0,k.useEffect)(()=>{te&&te!==Vt.selectedRuntimeId&&h3(te)},[te,Vt.selectedRuntimeId]),(0,k.useEffect)(()=>{dt&&M(dt.mode)},[dt?.id]),(0,k.useEffect)(()=>{if(!Kt||!d||!dt)return;let _=dt.addDebugSubscriber(rt=>{b||(p3(it.current,rt,r),gt())}),B=dt.world.addDebugSubscriber(rt=>{b||(p3(yt.current,rt,a),gt())});return()=>{_(),B()}},[Kt,d,dt?.id,b,a,r]),(0,k.useEffect)(()=>{if(!Kt||!d)return;let _=setInterval(()=>{lt(B=>B+1)},250);return()=>{clearInterval(_)}},[Kt,d]),(0,k.useEffect)(()=>{if(!E||!dt||!Ht?.em?.element)return;let _=Ht.em.element,B=rt=>{let ft=_.getBoundingClientRect(),{x:wt,y:U}=dt.viewerToWorld(rt.clientX-ft.left,rt.clientY-ft.top),P=de.singleBox(1,1,wt,U),Z=dt.world.getObjectsAt(P,!0),W=Z[Z.length-1];if(W){let Lt=W[1];R(Lt.length?Lt[Lt.length-1]:W[0])}g("Inspector"),T(!1),gt(),rt.preventDefault(),rt.stopPropagation()};return _.addEventListener("pointerdown",B,!0),()=>{_.removeEventListener("pointerdown",B,!0)}},[E,dt?.id,Ht?.em?.element]),(0,k.useEffect)(()=>()=>{let _=xt.current;_&&(xt.current=null,_())},[]),typeof window>"u"||typeof document>"u"||!Kt)return null;let ee=dt?Oj(dt):[],Gt=S||ee[0]?.ref,re=dt?wj(dt):{rendererTypes:[],canvas:[],webgl:[]},Ae=dt?xj(dt.world):[],Zt=Tj(it.current,15),fe=yt.current.filter(_=>X==="all"||_.type===X),Ft=(()=>{if(!dt)return{width:220,height:220,rects:[],viewport:null};let _=dt.world.getPoints(),B=Math.max(1,dt.world.width),rt=Math.max(1,dt.world.height),ft=220/B,wt=220/rt,U=[],P=Math.min(_.length/5,300);for(let Z=0;Z<P;Z++){let W=Z*5;_[W]!==0&&U.push({x:_[W+1]*ft,y:_[W+2]*wt,width:Math.max(1,(_[W+3]-_[W+1])*ft),height:Math.max(1,(_[W+4]-_[W+2])*wt)})}return{width:220,height:220,rects:U,viewport:{x:dt.target[1]*ft,y:dt.target[2]*wt,width:Math.max(1,(dt.target[3]-dt.target[1])*ft),height:Math.max(1,(dt.target[4]-dt.target[2])*wt)}}})(),tn={position:"fixed",right:n,bottom:e,zIndex:i,color:"#eef1ff",fontFamily:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace",pointerEvents:"auto",...f||{}},Jt={background:"#111827",color:"#f9fafb",border:"1px solid #374151",borderRadius:999,fontSize:12,padding:"8px 12px",cursor:"pointer",boxShadow:"0 8px 24px rgba(0, 0, 0, 0.35)"},ze={width:460,maxHeight:"70vh",overflow:"hidden",background:"#0f172a",border:"1px solid #334155",borderRadius:10,boxShadow:"0 12px 36px rgba(0, 0, 0, 0.4)",marginBottom:10,display:"flex",flexDirection:"column"},ri={padding:10,overflow:"auto",fontSize:12,lineHeight:1.4,display:"grid",gap:8},qn=()=>{!dt||xt.current||(xt.current=dt.stop(),H(!0))},st=()=>{let _=xt.current;xt.current=null,_&&_(),H(!1)},Tt=()=>{if(dt){if(xt.current){let _=xt.current;xt.current=null,_(),requestAnimationFrame(()=>{dt&&(xt.current=dt.stop(),H(!0))});return}dt.updateNextFrame()}},qt=()=>{it.current=[],yt.current=[],nt("Logs cleared"),gt()};return(0,K.jsxs)("div",{className:u,style:tn,children:[d?(0,K.jsxs)("div",{style:ze,children:[(0,K.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,padding:10,borderBottom:"1px solid #1f2937"},children:[(0,K.jsx)("strong",{style:{fontSize:12,letterSpacing:.4},children:"Atlas DevTools"}),(0,K.jsx)("select",{style:{marginLeft:"auto",fontSize:12,background:"#111827",color:"#e2e8f0",border:"1px solid #334155"},value:te||"",onChange:_=>h3(_.target.value),children:Vt.runtimes.map(_=>(0,K.jsx)("option",{value:_.id,children:_.label},_.id))}),(0,K.jsx)("button",{style:Jt,onClick:()=>m(!1),children:"Close"})]}),(0,K.jsx)("div",{style:{display:"flex",gap:6,padding:8,borderBottom:"1px solid #1f2937",flexWrap:"wrap"},children:Aj.map(_=>(0,K.jsx)("button",{style:{...Jt,padding:"4px 8px",borderRadius:6,background:y===_?"#334155":"#111827"},onClick:()=>g(_),children:_},_))}),(0,K.jsxs)("div",{style:ri,children:[dt?null:(0,K.jsx)("div",{children:"No Atlas runtime available."}),dt&&y==="Overview"?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)("div",{children:["Runtime id: ",dt.id]}),(0,K.jsxs)("div",{children:["Mode: ",dt.mode]}),(0,K.jsxs)("div",{children:["Scale factor: ",dt.getScaleFactor().toFixed(4)]}),(0,K.jsxs)("div",{children:["World: ",dt.world.width," x ",dt.world.height]}),(0,K.jsxs)("div",{children:["Target: ",JSON.stringify(YT(dt.target))]}),(0,K.jsxs)("div",{children:["Pending update: ",String(dt.pendingUpdate)]}),(0,K.jsxs)("div",{children:["Renderer chain: ",re.rendererTypes.join(" -> ")||"None"]}),(0,K.jsxs)("div",{children:["Runtime log entries: ",it.current.length]}),(0,K.jsxs)("div",{children:["World log entries: ",yt.current.length]})]}):null,dt&&y==="World"?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)("div",{children:["World dimensions: ",dt.world.width," x ",dt.world.height]}),(0,K.jsxs)("div",{children:["Viewport target: ",JSON.stringify(YT(dt.target))]}),(0,K.jsxs)("svg",{width:Ft.width,height:Ft.height,style:{background:"#020617",border:"1px solid #334155"},children:[Ft.rects.map((_,B)=>(0,K.jsx)("rect",{x:_.x,y:_.y,width:_.width,height:_.height,fill:"rgba(56, 189, 248, 0.18)",stroke:"rgba(56, 189, 248, 0.7)"},`rect-${B}`)),Ft.viewport?(0,K.jsx)("rect",{x:Ft.viewport.x,y:Ft.viewport.y,width:Ft.viewport.width,height:Ft.viewport.height,fill:"rgba(251, 191, 36, 0.1)",stroke:"rgba(251, 191, 36, 1)"}):null]})]}):null,dt&&y==="Inspector"?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)("div",{style:{display:"flex",gap:8},children:(0,K.jsx)("button",{style:Jt,onClick:()=>T(_=>!_),children:E?"Cancel Pick":"Pick in Viewport"})}),(0,K.jsx)("div",{style:{maxHeight:180,overflow:"auto",border:"1px solid #1f2937",borderRadius:6},children:ee.map(_=>(0,K.jsx)("button",{onClick:()=>R(_.ref),style:{width:"100%",display:"block",textAlign:"left",padding:`2px 6px 2px ${6+_.depth*14}px`,background:Gt===_.ref?"#1e293b":"transparent",color:"#e2e8f0",border:0,cursor:"pointer",fontSize:12},children:_.label},_.key))}),Gt?(0,K.jsxs)("div",{style:{border:"1px solid #1f2937",borderRadius:6,padding:8},children:[(0,K.jsxs)("div",{children:["Type: ",iD(Gt)]}),(0,K.jsxs)("div",{children:["ID: ",Gt.id||"(none)"]}),(0,K.jsxs)("div",{children:["Points: ",JSON.stringify(YT(Gt.points))]}),(0,K.jsxs)("div",{children:["Display scale: ",Gt.display?.scale??"(n/a)"]}),(0,K.jsxs)("div",{children:["Crop: ",Gt.cropData?JSON.stringify(Gt.cropData):"(none)"]}),(0,K.jsxs)("div",{children:["Host: ",_j(Gt)]})]}):null]}):null,dt&&y==="Events"?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[(0,K.jsx)("button",{style:Jt,onClick:()=>w(_=>!_),children:b?"Resume Log":"Pause Log"}),(0,K.jsx)("button",{style:Jt,onClick:qt,children:"Clear"}),(0,K.jsxs)("select",{value:X,onChange:_=>mt(_.target.value),style:{fontSize:12,background:"#111827",color:"#e2e8f0",border:"1px solid #334155"},children:[(0,K.jsx)("option",{value:"all",children:"All"}),(0,K.jsx)("option",{value:"trigger",children:"Trigger"}),(0,K.jsx)("option",{value:"pointer",children:"Pointer"}),(0,K.jsx)("option",{value:"touch",children:"Touch"})]})]}),(0,K.jsx)("div",{style:{maxHeight:240,overflow:"auto",border:"1px solid #1f2937",borderRadius:6,padding:6},children:fe.slice().reverse().map((_,B)=>(0,K.jsxs)("div",{style:{marginBottom:4},children:["[",_.type,"] ",JSON.stringify(_)]},`event-${B}`))})]}):null,dt&&y==="Images"?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)("div",{children:"Renderer health"}),re.canvas.map((_,B)=>(0,K.jsxs)("div",{style:{border:"1px solid #1f2937",borderRadius:6,padding:8},children:[(0,K.jsx)("div",{children:_.type}),(0,K.jsxs)("div",{children:["loadingQueue: ",_.loadingQueue]}),(0,K.jsxs)("div",{children:["imagesPending: ",_.imagesPending]}),(0,K.jsxs)("div",{children:["imagesLoaded: ",_.imagesLoaded]}),(0,K.jsxs)("div",{children:["tasksRunning: ",_.tasksRunning]}),(0,K.jsxs)("div",{children:["firstMeaningfulPaint: ",String(_.firstMeaningfulPaint)]})]},`canvas-${B}`)),re.webgl.map((_,B)=>(0,K.jsx)("div",{style:{border:"1px solid #1f2937",borderRadius:6,padding:8},children:(0,K.jsx)("div",{children:_.type})},`webgl-${B}`)),(0,K.jsxs)("div",{children:["Image hosts (",Ae.length,")"]}),(0,K.jsx)("div",{style:{maxHeight:180,overflow:"auto",border:"1px solid #1f2937",borderRadius:6,padding:6},children:Ae.map(_=>(0,K.jsxs)("div",{style:{marginBottom:6},children:[(0,K.jsxs)("div",{children:[_.type," #",_.id]}),(0,K.jsxs)("div",{children:["owner: ",_.ownerId||"(none)"," composite: ",_.compositeId||"(none)"]}),(0,K.jsxs)("div",{children:["canvas: ",_.canvas?JSON.stringify(_.canvas):"(none)"]}),(0,K.jsxs)("div",{children:["webgl: ",_.webgl?JSON.stringify(_.webgl):"(none)"]}),_.anomalies.length?(0,K.jsxs)("div",{children:["anomalies: ",_.anomalies.join(" | ")]}):null]},`${_.type}-${_.id}-${_.ownerId||"none"}`))}),(0,K.jsx)("div",{children:"Chosen composite layers by frame"}),(0,K.jsx)("div",{style:{maxHeight:180,overflow:"auto",border:"1px solid #1f2937",borderRadius:6,padding:6},children:Zt.map(_=>(0,K.jsxs)("div",{style:{marginBottom:8},children:[(0,K.jsxs)("div",{children:["frame ",_.frame]}),_.composites.map(B=>(0,K.jsxs)("div",{style:{paddingLeft:8},children:[(0,K.jsxs)("div",{children:["composite ",B.compositeId]}),B.layers.map((rt,ft)=>(0,K.jsxs)("div",{style:{paddingLeft:10},children:[rt.paintType," #",rt.paintId," tile=",rt.tileIndex]},`${B.compositeId}-${ft}`))]},`${_.frame}-${B.compositeId}`))]},`frame-${_.frame}`))})]}):null,dt&&y==="Actions"?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[(0,K.jsx)("button",{style:Jt,onClick:L?st:qn,children:L?"Resume Loop":"Pause Loop"}),(0,K.jsx)("button",{style:Jt,onClick:Tt,children:"Step Frame"}),(0,K.jsx)("button",{style:Jt,onClick:()=>dt.updateNextFrame(),children:"Repaint"}),(0,K.jsx)("button",{style:Jt,onClick:()=>dt.triggerResize(),children:"Trigger Resize"})]}),(0,K.jsxs)("div",{style:{display:"flex",gap:8,alignItems:"center",flexWrap:"wrap"},children:[(0,K.jsxs)("select",{value:A,onChange:_=>M(_.target.value),style:{fontSize:12,background:"#111827",color:"#e2e8f0",border:"1px solid #334155"},children:[(0,K.jsx)("option",{value:"explore",children:"explore"}),(0,K.jsx)("option",{value:"sketch",children:"sketch"}),(0,K.jsx)("option",{value:"static",children:"static"})]}),(0,K.jsx)("button",{style:Jt,onClick:()=>{dt.mode=A,dt.updateNextFrame()},children:"Apply Mode"})]}),(0,K.jsxs)("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[(0,K.jsx)("button",{style:Jt,onClick:()=>dt.world.goHome(),children:"goHome"}),(0,K.jsx)("button",{style:Jt,onClick:()=>dt.world.zoomIn(),children:"zoomIn"}),(0,K.jsx)("button",{style:Jt,onClick:()=>dt.world.zoomOut(),children:"zoomOut"}),(0,K.jsx)("button",{style:Jt,onClick:()=>dt.world.constraintBounds(!0),children:"constrain-bounds"})]}),(0,K.jsxs)("div",{style:{display:"flex",gap:8,alignItems:"center",flexWrap:"wrap"},children:[(0,K.jsxs)("select",{value:z,onChange:_=>I(_.target.value),style:{fontSize:12,background:"#111827",color:"#e2e8f0",border:"1px solid #334155"},children:[(0,K.jsx)("option",{value:"",children:"Select zone"}),dt.world.zones.map((_,B)=>(0,K.jsx)("option",{value:String(_.id||B),children:_.id||`zone-${B}`},`${_.id}-${B}`))]}),(0,K.jsx)("button",{style:Jt,onClick:()=>{z&&dt.selectZone(z)},children:"Select Zone"}),(0,K.jsx)("button",{style:Jt,onClick:()=>dt.deselectZone(),children:"Deselect Zone"})]}),(0,K.jsxs)("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[(0,K.jsx)("button",{style:Jt,onClick:()=>{let _=Ej(dt);nt(`Reset image hosts=${_.imageHostsReset}, renderers=${_.renderersReset}`),gt()},children:"Recover Images"}),(0,K.jsx)("button",{style:Jt,onClick:qt,children:"Clear Logs"})]}),V?(0,K.jsx)("div",{children:V}):null]}):null]})]}):null,(0,K.jsx)("button",{style:Jt,onClick:()=>m(_=>!_),children:d?"Hide DevTools":"Open DevTools"})]})};function Ij(t){return(0,k.useMemo)(()=>WT(t),t)}function Nj(t,e){let n={},i=new Set([...Object.keys(t),...Object.keys(e)]);for(let a of i){let r=t[a],l=e[a];r!==l&&(n[a]={before:r,after:l})}return Object.keys(n).length>0?n:null}function Lj(t,e="",n=!1){let i=(0,k.useRef)(t);i.current&&n&&(console.log("Diff:",e,Nj(i.current,t)),i.current=t)}function eR(t,e){return!(!(t instanceof gi||t instanceof Ri)||t.crop||t.cropData||t.display.rotation||t.style&&t.style.opacity!==void 0&&t.style.opacity!==1||t.__owner?.value?.rotation)}var Dj=new Map,m3=class{constructor(t,e){C(this,"canvas",void 0),C(this,"gl",void 0),C(this,"options",void 0),C(this,"fatalImageError",void 0),C(this,"program",void 0),C(this,"fragmentShader",void 0),C(this,"vertexShader",void 0),C(this,"rectBuffer",void 0),C(this,"fragmentShaderSource",`
|
|
25
30
|
precision mediump float;
|
|
26
31
|
|
|
27
32
|
uniform sampler2D u_image;
|
|
33
|
+
uniform float u_alpha;
|
|
28
34
|
varying vec2 v_texCoord;
|
|
29
35
|
|
|
30
36
|
void main() {
|
|
31
|
-
|
|
37
|
+
vec4 color = texture2D(u_image, v_texCoord);
|
|
38
|
+
gl_FragColor = vec4(color.rgb, color.a * u_alpha);
|
|
32
39
|
}
|
|
33
|
-
`),
|
|
40
|
+
`),C(this,"vertexShaderSource",`
|
|
34
41
|
attribute vec2 a_position;
|
|
35
42
|
uniform vec2 u_resolution;
|
|
36
43
|
varying vec4 v_color;
|
|
@@ -51,41 +58,40 @@ Error generating stack: `+i.message+`
|
|
|
51
58
|
vec2 clipSpace = zeroToTwo - 1.0;
|
|
52
59
|
|
|
53
60
|
gl_Position = vec4(clipSpace * vec2(1, -1), 0, 1);
|
|
54
|
-
|
|
61
|
+
|
|
55
62
|
v_texCoord = a_texCoord;
|
|
56
63
|
}
|
|
57
|
-
`),O(this,"attributes",void 0),O(this,"uniforms",void 0),O(this,"buffers",void 0),O(this,"rendererPosition",void 0),O(this,"dpi",void 0),O(this,"lastResize",0),O(this,"lastKnownScale",1),this.canvas=t,this.rendererPosition=t.getBoundingClientRect(),this.gl=t.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=e?.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(t,e,n){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+=e}prepareLayer(t){(!t.__host||!t.__host.webgl)&&((t instanceof Sl||t instanceof vh)&&this.createImageHost(t),t instanceof bA&&this.createTextureHost(t))}createTextureHost(t){t.__host=t.__host?t.__host:{};let e=this.gl,n=this.gl.createTexture();e.bindTexture(e.TEXTURE_2D,n),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,!1);let i;if(t instanceof bA){let a=t.getTexture();a.source&&e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,a.source),i=a}e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),t.__host.webgl={height:t.height,width:t.width,texture:n,lastImage:i}}createImageHost(t){let e=[...Array(t.points.length/5)];t.__host=t.__host?t.__host:{},t.__host.webgl={height:t.height,width:t.width,textures:e,loading:[],loaded:[],lastLevelRendered:-1,onLoad:(n,i)=>{let a=this.gl,o=this.gl.createTexture();a.bindTexture(a.TEXTURE_2D,o),a.pixelStorei(a.UNPACK_FLIP_Y_WEBGL,!1),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,a.RGBA,a.UNSIGNED_BYTE,i),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.LINEAR),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.LINEAR),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE),a.bindTexture(a.TEXTURE_2D,null),t.__host.webgl.textures[n]=o,t.__host.webgl.loaded.push(n)}}}paint(t,e,n,i,a,o){if(t.type==="spacial-content"&&t.__host&&t.__host.webgl){if(t.getTexture){let u=t?.getTexture();if(u&&t.__host.webgl.lastImage!==u.hash&&u.source&&!t.__host.webgl.error)try{let d=this.gl.RGBA,p=this.gl.RGBA,f=this.gl.UNSIGNED_BYTE;this.gl.bindTexture(this.gl.TEXTURE_2D,t.__host.webgl.texture),this.gl.texImage2D(this.gl.TEXTURE_2D,0,d,p,f,u.source),t.__host.webgl.lastImage=u.hash}catch(d){t.__host.webgl.error=d}}if(t.__host.webgl.loading&&t.__host.webgl.loading.indexOf(e)===-1&&t.getImageUrl){t.__host.webgl.loading.push(e);let u=document.createElement("img");u.decoding="async",u.crossOrigin="anonymous",u.src=t.getImageUrl(e),u.onload=()=>(u.onload=null,t.__host.webgl.onLoad(e,u))}let s=t.__host.webgl.texture?t.__host.webgl.texture:t.__host.webgl.textures[e];s&&(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,s),this.gl.uniform1i(this.uniforms.texture,0),this.setRectangle(n,i,a,o),this.gl.drawArrays(this.gl.TRIANGLES,0,6))}}afterPaintLayer(t,e){}pendingUpdate(){return!0}getPointsAt(t,e,n,i){return t.getPointsAt(e,n,i)}afterFrame(){}getScale(t,e,n){if(Number.isNaN(t)||Number.isNaN(e))return this.lastKnownScale;let i=this.getCanvasDims(),a=i.width/t,o=i.height/e,s=(a<o?o:a)*(n&&this.dpi||1);return Number.isNaN(s)||(this.lastKnownScale=s),this.lastKnownScale}getCanvasDims(){return{width:this.canvas.width/this.dpi,height:this.canvas.height/this.dpi}}getViewportBounds(t,e,n){return null}createShader(t,e){let n=this.gl.createShader(t);if(n){if(this.gl.shaderSource(n,e),this.gl.compileShader(n),this.gl.getShaderParameter(n,this.gl.COMPILE_STATUS))return n;let i=this.gl.getShaderInfoLog(n);if(this.gl.deleteShader(n),i)throw Error(i)}throw Error("Invalid shader")}createProgram(t,e){let n=this.gl.createProgram();if(n){if(this.gl.attachShader(n,t),this.gl.attachShader(n,e),this.gl.linkProgram(n),this.gl.getProgramParameter(n,this.gl.LINK_STATUS))return n;let i=this.gl.getProgramInfoLog(n);if(this.gl.deleteProgram(n),i)throw Error(i)}throw Error("Invalid program")}resizeCanvasToDisplaySize(){let t=this.gl.canvas,e=t.clientWidth,n=t.clientHeight,i=t.width!==e||t.height!==n;return i&&(t.width=e,t.height=n),i}createArrayBuffer(t){let e=this.gl.createBuffer();if(this.gl.bindBuffer(this.gl.ARRAY_BUFFER,e),t&&this.gl.bufferData(this.gl.ARRAY_BUFFER,t,this.gl.STATIC_DRAW),!e)throw Error("Cannot create buffer");return e}setRectangle(t,e,n,i){this.gl.bufferData(this.gl.ARRAY_BUFFER,this.getRectangle(t,e,n,i),this.gl.STATIC_DRAW)}getRectangle(t,e,n,i){let a=t,o=t+n,s=e,u=e+i;return this.rectBuffer.set([a,s,o,s,a,u,a,u,o,s,o,u]),this.rectBuffer}getRendererScreenPosition(){return this.rendererPosition}finishLayer(){}reset(){}};function AA(t,e){let n=e?t:JSON.stringify(t),i=5381,a=n.length;for(;a;)i=i*33^n.charCodeAt(--a);let o=(i>>>0).toString(16);return o.length%2?"0"+o:o}var kI=class{constructor(t){O(this,"$element",void 0),O(this,"stylesheetClasses",void 0),O(this,"activeStylesheetClasses",void 0),O(this,"sheetsDidUpdate",void 0),O(this,"sheetPrefix",void 0),O(this,"stylesheetEntries",void 0),this.sheetPrefix=t?.sheetPrefix||"a-",this.$element=document.createElement("style"),this.stylesheetClasses=[],this.activeStylesheetClasses=[],this.sheetsDidUpdate=!1,this.stylesheetEntries={}}getElement(){return this.$element}addStylesheet(t){let e=t.replace(/\s\s+/g," ").replace(/: /g,":").replace(/; /g,";").trim(),n=this.sheetPrefix+AA(e,!0);return this.stylesheetClasses.indexOf(n)===-1&&(this.stylesheetClasses.push(n),this.activeStylesheetClasses.push(n),this.stylesheetEntries[n]=e,this.sheetsDidUpdate=!0),n}removeStylesheet(t){let e=this.sheetPrefix+AA(t,!0);this.stylesheetClasses.indexOf(e)&&(this.stylesheetClasses=this.stylesheetClasses.filter(n=>n!==e)),this.sheetsDidUpdate=!0}clearClasses(){this.activeStylesheetClasses=[]}didUpdateActive(){if(this.activeStylesheetClasses.length){for(let t of this.activeStylesheetClasses)if(this.stylesheetClasses.indexOf(t)===-1)return!0;for(let t of this.stylesheetClasses)if(this.activeStylesheetClasses.indexOf(t)===-1)return!0}return!1}updateSheet(){(this.sheetsDidUpdate||this.didUpdateActive())&&(this.$element.innerText=this.activeStylesheetClasses.map(t=>`.${t}{${this.stylesheetEntries[t]}}`).join(""),this.sheetsDidUpdate=!1,this.stylesheetClasses=[...this.activeStylesheetClasses])}},YI=class{constructor(t,e){O(this,"htmlContainer",void 0),O(this,"visible",[]),O(this,"previousVisible",[]),O(this,"htmlIds",[]),O(this,"firstMeaningfulPaint",!1),O(this,"rendererPosition",void 0),O(this,"stylesheet",void 0),O(this,"options",void 0),O(this,"paintTx",1),O(this,"zIndex",0),O(this,"classes",void 0),this.htmlContainer=t,this.htmlContainer.innerHTML="",this.rendererPosition=this.htmlContainer.getBoundingClientRect(),this.options={triggerResize:()=>{},box:!1,text:!1,sheetPrefix:"",inlineStyles:!1,background:"",...e||{}},this.stylesheet=new kI({sheetPrefix:this.options.sheetPrefix}),this.options.inlineStyles||this.htmlContainer.appendChild(this.stylesheet.getElement()),this.options.background&&this.htmlContainer.classList.add(this.stylesheet.addStylesheet(`
|
|
58
|
-
background: ${this.options.background};
|
|
59
|
-
`)),this.classes={hostClassName:this.stylesheet.addStylesheet(`
|
|
60
|
-
position: absolute;
|
|
61
|
-
transform-origin: 0px 0px;
|
|
62
|
-
`),interactive:this.stylesheet.addStylesheet("pointer-events: all"),nonInteractive:this.stylesheet.addStylesheet("pointer-events: none")},this.stylesheet.updateSheet()}createHtmlHost(t){if(this.htmlContainer&&(this.options.box||t.props.className||t.props.html||t.props.href)){let e=document.createElement(t.props.href?"a":"div");if(t.props.href){e.style.display="block",e.href=t.props.href;let n=t.props.hrefTarget||"_blank";e.target=n,n!=="_self"&&(e.rel="noopener noreferrer")}e.title=t.props.title||"",this.options.inlineStyles?(e.style.display="block",e.style.position="absolute",e.style.overflow="hidden",e.style.transformOrigin="0px 0px"):e.classList.add(this.classes.hostClassName),t.__host={element:e,revision:null,relative:!1},this.updateHtmlHost(t,t.width,t.height),t.__onCreate&&t.__onCreate()}}triggerResize(){this.options.triggerResize()}updateHtmlHost(t,e,n){if(t.__revision!==t.__host.revision){let i=t.__host.element,a=[this.classes.hostClassName];if(t.props.interactive?this.options.inlineStyles?i.style.pointerEvents="all":a.push(this.classes.interactive):this.options.inlineStyles?i.style.pointerEvents="none":a.push(this.classes.nonInteractive),t.props.href){i.style.display="block",i.href=t.props.href;let s=t.props.hrefTarget||"_blank";i.target=s,s==="_self"?i.rel="":i.rel="noopener noreferrer"}else i.href&&i.removeAttribute("href");if(t.props.title&&(i.title=t.props.title||""),t.props.className&&(a.push(t.props.className),t.hovering&&a.push(`${t.props.className}--hover`),t.pressing&&a.push(`${t.props.className}--active`)),t.props.relativeStyle?(i.style.width=`${e||t.width}px`,i.style.height=`${n||t.height}px`):(i.style.width=`${t.width}px`,i.style.height=`${t.height}px`),t.props.style){Object.assign(i.style,t.props.style||{},t.hovering&&t.props.hoverStyles||{},t.pressing&&t.props.pressStyles||{});return}if(this.options.text&&t instanceof Xy){t.text&&(i.innerText=t.text),t.backgroundColor&&(i.style.backgroundColor=t.backgroundColor),t.color&&(i.style.color=t.color),t.props.font&&(i.style.font=t.props.font),t.props.textAlign&&(i.style.textAlign=t.props.textAlign),t.__host.revision=t.__revision;let s=a.join(" ");i.className=s,i.part=s}t instanceof ph&&(this.options.box||t.props.className||t.props.html)&&(t.props.backgroundColor&&(i.style.backgroundColor=t.props.backgroundColor),t.props.border!==i.style.border&&(i.style.border=t.props.border));let o=a.join(" ");i.className=o,i.part=o}}afterFrame(t,e,n){this.stylesheet.updateSheet();for(let i of this.previousVisible)this.visible.indexOf(i)===-1&&this.htmlContainer&&i.__id&&this.htmlIds.indexOf(i.__id)!==-1&&this.htmlContainer.removeChild(i.__host.element);this.previousVisible=this.visible}afterPaintLayer(t,e){}beforeFrame(t,e,n){this.stylesheet.clearClasses(),this.paintTx++,this.zIndex=0,this.visible=[]}getPointsAt(t,e,n,i){return t.getPointsAt(e,n,i)}getScale(t,e){let n=this.rendererPosition.width/t,i=this.rendererPosition.height/e;return n<i?i:n}getViewportBounds(t,e,n){return null}isReady(){return!1}paint(t,e,n,i,a,o){if(this.zIndex++,(this.options.text&&t instanceof Xy||t instanceof ph&&(this.options.box||t.props.className||t.props.html))&&t.__host.tx!==this.paintTx&&(this.visible.push(t),t.__host.tx=this.paintTx,this.htmlContainer)){this.updateHtmlHost(t,a,o);let s=a/t.width,u=t.__host.element;u.style.zIndex=`${this.zIndex}`,t.props.relativeStyle?u.style.transform=`translate(${Math.round(n)}px, ${Math.round(i)}px)`:u.style.transform=`translate(${Math.round(n)}px, ${Math.round(i)}px) scale(${s})`,this.previousVisible.indexOf(t)===-1&&this.htmlContainer.appendChild(u),this.htmlIds.indexOf(t.__id)===-1&&this.htmlIds.push(t.__id)}}pendingUpdate(){return!1}prepareLayer(t){t.__host||(t instanceof Xy||t instanceof ph)&&this.createHtmlHost(t)}resize(t,e){t!==void 0&&e!==void 0&&(this.htmlContainer.style.width=`${t}px`,this.htmlContainer.style.height=`${e}px`),this.rendererPosition=this.htmlContainer.getBoundingClientRect()}getRendererScreenPosition(){return this.rendererPosition}finishLayer(){}reset(){}},MA=class Zy{constructor(e,n,i){O(this,"element",void 0),O(this,"runtime",void 0),O(this,"unsubscribe",void 0),O(this,"activatedEvents",[]),O(this,"eventHandlers",[]),O(this,"bounds",void 0),O(this,"listening",void 0),O(this,"pointerMoveEvent",void 0),O(this,"pointerEventState",{isClicking:!1,isDragging:!1,isPressed:!1,mousedOver:[],itemsBeingDragged:[],mouseDownStart:{x:0,y:0},lastTouches:[]}),O(this,"options",void 0),O(this,"_realPointerMove",o=>{this.pointerMoveEvent=o}),O(this,"onWheelEvent",o=>{o.preventDefault(),this.onPointerEvent(o)}),O(this,"onContextMenu",o=>{o.preventDefault();let s="onContextMenu";if(this.runtime.world.activatedEvents.indexOf(s)!==-1){let{x:u,y:d}=this.runtime.viewerToWorld(o.clientX-this.bounds.left,o.clientY-this.bounds.top);this.assignToEvent(o,u,d),this.runtime.world.propagatePointerEvent(s,o,u,d)}}),O(this,"onTouchEvent",o=>{let s=Fc[o.type],u=[],d=o.touches.length;for(let p=0;p<d;p++){let f=o.touches.item(p);if(!f)continue;let{x:m,y:g}=this.runtime.viewerToWorld(f.clientX-this.bounds.left,f.clientY-this.bounds.top),v={id:f.identifier,x:m,y:g};u.push(v)}u.length&&this.assignToEvent(o,u[0].x,u[0].y),s==="onTouchEnd"?(o.atlasTouches=[],this.runtime.world.propagateTouchEvent(s,o,this.pointerEventState.lastTouches),this.pointerEventState.lastTouches=[]):(this.pointerEventState.lastTouches=u,o.atlasTouches=u,this.runtime.world.propagateTouchEvent(s,o,u))}),O(this,"onPointerEvent",o=>{if(o.button===2)return;let s=Fc[o.type];if(s&&this.runtime.world.activatedEvents.indexOf(s)!==-1){let{x:u,y:d}=this.runtime.viewerToWorld(o.clientX-this.bounds.left,o.clientY-this.bounds.top);this.assignToEvent(o,u,d),this.runtime.world.propagatePointerEvent(s,o,u,d)}}),O(this,"onPointerDown",o=>{o.button!==2&&(this.pointerEventState.isPressed=!0,this.pointerEventState.isClicking=!0,this.pointerEventState.mouseDownStart.x=o.clientX,this.pointerEventState.mouseDownStart.y=o.clientY,setTimeout(()=>{this.runtime&&(this.pointerEventState.isClicking=!1)},250),setTimeout(()=>{if(this.runtime&&this.pointerEventState.isPressed&&!this.pointerEventState.isDragging){let s=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",o,s.x,s.y)}},800),this.onPointerEvent(o))}),O(this,"onPointerUp",o=>{if(o.button!==2){if(this.pointerEventState.isClicking){let{x:s,y:u}=this.runtime.viewerToWorld(o.clientX-this.bounds.left,o.clientY-this.bounds.top);this.assignToEvent(o,s,u),this.runtime.world.propagatePointerEvent("onClick",o,s,u)}if(this.pointerEventState.isDragging){for(let s of this.pointerEventState.itemsBeingDragged)s.dispatchEvent("onDragEnd",o);this.pointerEventState.isDragging=!1}this.pointerEventState.isClicking=!1,this.pointerEventState.isPressed=!1,this.pointerEventState.itemsBeingDragged=[],this.onPointerEvent(o)}}),O(this,"onPointerMove",o=>{this.pointerMoveEvent=void 0;let{x:s,y:u}=this.runtime.viewerToWorld(o.clientX-this.bounds.left,o.clientY-this.bounds.top);if(Number.isNaN(s)||Number.isNaN(u))return;this.assignToEvent(o,s,u),this.runtime.world.propagatePointerEvent("onPointerMove",o,s,u);let d=this.runtime.world.propagatePointerEvent("onMouseMove",o,s,u),p=[],f=[];for(let m of d)p.push(m.id),f.push(m),this.pointerEventState.mousedOver.indexOf(m)===-1&&(m.dispatchEvent("onMouseEnter",o),m.dispatchEvent("onPointerEnter",o),m.dispatchEvent("onMouseOver",o),m.dispatchEvent("onPointerOver",o));for(let m of this.pointerEventState.mousedOver)p.indexOf(m.id)===-1&&(m.dispatchEvent("onMouseLeave",o),m.dispatchEvent("onPointerLeave",o),m.dispatchEvent("onMouseOut",o),m.dispatchEvent("onPointerOut",o));if(this.pointerEventState.isDragging)for(let m of this.pointerEventState.itemsBeingDragged)m.dispatchEvent("onDrag",o);if(this.pointerEventState.isPressed&&!this.pointerEventState.isDragging&&Wy(this.pointerEventState.mouseDownStart,{x:o.clientX,y:o.clientY})>50){let m=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",{...o,atlas:{x:m.x,y:m.y}},m.x,m.y)}this.pointerEventState.mousedOver=f}),this.element=e,this.runtime=n,this.unsubscribe=n.world.addLayoutSubscriber(this.layoutSubscriber.bind(this)),this.bounds=e.getBoundingClientRect(),this.listening=!1,this.options={simulationRate:0,...i||{}};let a=0;n.registerHook("useFrame",o=>{a+=o,a>this.options.simulationRate&&this.pointerMoveEvent&&(a=0,n.updateNextFrame())}),n.registerHook("useBeforeFrame",()=>{this.pointerMoveEvent&&this.onPointerMove(this.pointerMoveEvent)}),this.activateEvents()}updateBounds(){this.bounds=this.element.getBoundingClientRect(),this.runtime.updateRendererScreenPosition()}layoutSubscriber(e){e==="event-activation"&&this.listening==0&&this.activateEvents()}assignToEvent(e,n,i){Zy.eventPool.atlas.x=n,Zy.eventPool.atlas.y=i,e.atlas=Zy.eventPool.atlas}activateEvents(){this.listening=!0,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("contextmenu",this.onContextMenu),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(e){return e.startsWith("on")?e.slice(2).toLowerCase():e.toLowerCase()}stop(){this.listening=!1,this.element.removeEventListener("pointermove",this._realPointerMove),this.element.removeEventListener("pointerup",this.onPointerUp),this.element.removeEventListener("pointerdown",this.onPointerDown),this.element.removeEventListener("mousedown",this.onPointerEvent),this.element.removeEventListener("mouseup",this.onPointerEvent),this.element.removeEventListener("pointercancel",this.onPointerEvent),this.element.removeEventListener("wheel",this.onWheelEvent),this.element.removeEventListener("touchstart",this.onTouchEvent),this.element.removeEventListener("touchcancel",this.onTouchEvent),this.element.removeEventListener("touchend",this.onTouchEvent),this.element.removeEventListener("touchmove",this.onTouchEvent),this.unsubscribe();for(let[e,n]of this.eventHandlers)this.element.removeEventListener(this.normalizeEventName(e),n)}};O(MA,"eventPool",{atlas:{x:0,y:0}});function QI({interactive:t=!0,viewport:e,forceRefresh:n,canvasElement:i,overlayElement:a,controllerConfig:o,unstable_webglRenderer:s,dpi:u,debug:d,canvasBox:p=!0,polygon:f=!0,navigatorElement:m,runtimeOptions:g}){if(!i)throw Error("Invalid container");i.style.userSelect="none";let v=t?VI({minZoomFactor:.5,maxZoomFactor:3,enableClickToZoom:!1,parentElement:i,...o||{}}):void 0,S=new UI([s?new Dj(i,{dpi:u}):new bj(i,{dpi:u,debug:d,box:p,polygon:f}),a?new YI(a,{box:s||!p,text:!0,triggerResize:n}):void 0,m?new xj(m):void 0]),E=new rv(S,new ov(1024,1024),e,v?[v]:[],g),T=new MA(i,E);return{name:"default-preset",em:T,runtime:E,renderer:S,controller:v,canvas:i,navigator:m,unmount(){wA(E),E.stopControllers(),E.stop(),E.reset(),T&&T.stop()}}}var gl=1+Number.MIN_VALUE,Lj=class{constructor(t,e){O(this,"container",void 0),O(this,"width",void 0),O(this,"height",void 0),O(this,"pending",!0),O(this,"options",void 0),O(this,"stylesheet",void 0),O(this,"zIndex",0),O(this,"lastKnownScale",1),O(this,"rendererPosition",void 0),O(this,"currentlyVisible",[]),O(this,"previouslyVisible",[]),this.container=t,this.rendererPosition=t.getBoundingClientRect();let{width:n,height:i}=this.rendererPosition;this.width=n,this.height=i,this.options={addPart:!1,setDraggableFalse:!1,imageClass:"",widthStylesheet:!1,sheetPrefix:"position-",background:"#000",...e||{}},this.stylesheet=new kI({sheetPrefix:this.options.sheetPrefix}),this.container.classList.add(this.stylesheet.addStylesheet(`
|
|
64
|
+
`),C(this,"attributes",void 0),C(this,"uniforms",void 0),C(this,"buffers",void 0),C(this,"rendererPosition",void 0),C(this,"dpi",void 0),C(this,"maxConcurrentTasks",6),C(this,"maxPrefetchPerFrame",8),C(this,"imageLoadingConfig",void 0),C(this,"imageRequestPool",void 0),C(this,"framePrefetchCount",0),C(this,"loadingCount",0),C(this,"hasTilesFading",!1),C(this,"firstMeaningfulPaint",!1),C(this,"frameSawFastPathCandidate",!1),C(this,"requiresRepaint",!0),C(this,"tileRequestQueue",[]),C(this,"queuedTileRequestKeys",new Set),C(this,"inFlightImageLoads",new Map),C(this,"requiredTileKeys",new Set),C(this,"requiredPrefetchTileKeys",new Set),C(this,"requestGeneration",0),C(this,"frameCounter",0),C(this,"pendingTileReveals",new Map),C(this,"activeLayerScissorRect",void 0),C(this,"onContextLost",i=>{i.preventDefault(),this.emitFatalImageError({reason:"webgl-context-lost",error:i})}),C(this,"lastResize",0),C(this,"lastKnownScale",1),this.canvas=t,this.rendererPosition=t.getBoundingClientRect(),this.options=e||{},this.imageLoadingConfig=O3(this.options.imageLoading),this.maxConcurrentTasks=this.imageLoadingConfig.maxConcurrentRequests,this.maxPrefetchPerFrame=this.imageLoadingConfig.maxPrefetchPerFrame,this.imageRequestPool=new L3({timeoutMs:this.imageLoadingConfig.timeoutMs,crossOrigin:"anonymous",useFetch:!0,cache:Dj});let n=t.getContext("webgl2");if(!n)throw this.emitFatalImageError({reason:"webgl-context-unavailable",error:Error("WebGL2 context unavailable")}),Error("WebGL2 context unavailable");this.gl=n,this.canvas.addEventListener("webglcontextlost",this.onContextLost),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=e?.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"),alpha:this.gl.getUniformLocation(this.program,"u_alpha")},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),this.gl.enable(this.gl.BLEND),this.gl.blendFunc(this.gl.SRC_ALPHA,this.gl.ONE_MINUS_SRC_ALPHA),this.isImmediateReadiness()&&(this.firstMeaningfulPaint=!0)}isImmediateReadiness(){return this.options.readiness==="immediate"}emitFatalImageError(t){if(this.fatalImageError)return;let e={from:"webgl",to:"canvas",...t};this.fatalImageError=e,this.options.onFatalImageError&&this.options.onFatalImageError(e)}resize(){this.resizeCanvasToDisplaySize(),this.gl.viewport(0,0,this.gl.canvas.width,this.gl.canvas.height),this.rendererPosition=this.canvas.getBoundingClientRect()}isReady(){return this.isImmediateReadiness()||this.firstMeaningfulPaint?!0:this.frameSawFastPathCandidate?!1:this.tileRequestQueue.length===0&&this.loadingCount===0&&this.inFlightImageLoads.size===0&&this.pendingTileReveals.size===0}beforeFrame(t,e,n,i){this.hasTilesFading=!1,this.requiresRepaint=!1,this.frameSawFastPathCandidate=!1,this.framePrefetchCount=0,this.frameCounter+=1,this.requiredTileKeys.clear(),this.requiredPrefetchTileKeys.clear(),this.flushTileRevealBatch();let a=C3(i);this.canvas.style.filter!==a&&(this.canvas.style.filter=a),this.gl.clearColor(0,0,0,0),this.gl.clear(this.gl.COLOR_BUFFER_BIT),this.gl.disable(this.gl.SCISSOR_TEST),this.activeLayerScissorRect=void 0,this.gl.vertexAttribPointer(this.attributes.position,2,this.gl.FLOAT,!1,0,0),this.gl.uniform2f(this.uniforms.resolution,this.gl.canvas.width/this.dpi,this.gl.canvas.height/this.dpi),this.lastResize>1e3&&(this.lastResize=0,this.resizeCanvasToDisplaySize()),this.lastResize+=e}getCompositeRenderOptions(t){return t.__parent?.renderOptions}shouldClipLayerToBounds(t){return t instanceof gi||t instanceof Ri?!!this.getCompositeRenderOptions(t)?.clipToBounds:!1}getBoundsFromPoints(t){let e=1/0,n=1/0,i=-1/0,a=-1/0;for(let r=0;r<t.length;r+=5)t[r]&&(e=Math.min(e,t[r+1]),n=Math.min(n,t[r+2]),i=Math.max(i,t[r+3]),a=Math.max(a,t[r+4]));if(!(!Number.isFinite(e)||!Number.isFinite(n)||!Number.isFinite(i)||!Number.isFinite(a))&&!(i<=e||a<=n))return{x:e,y:n,width:i-e,height:a-n}}toScissorRect(t){let e=this.gl.canvas.width/this.dpi,n=this.gl.canvas.height/this.dpi,i=Math.max(0,Math.min(e,t.x)),a=Math.max(0,Math.min(n,t.y)),r=Math.max(0,Math.min(e,t.x+t.width)),l=Math.max(0,Math.min(n,t.y+t.height));if(r<=i||l<=a)return;let u=Math.floor(i*this.dpi),f=Math.floor((n-l)*this.dpi),h=Math.ceil((r-i)*this.dpi),d=Math.ceil((l-a)*this.dpi);if(u<0&&(h+=u,u=0),f<0&&(d+=f,f=0),h=Math.min(h,this.gl.canvas.width-u),d=Math.min(d,this.gl.canvas.height-f),!(h<=0||d<=0))return{x:u,y:f,width:h,height:d}}prepareLayer(t,e){if(this.activeLayerScissorRect=void 0,e&&this.shouldClipLayerToBounds(t)){let n=this.getBoundsFromPoints(e);if(n){let i=this.toScissorRect(n);i?(this.activeLayerScissorRect=i,this.gl.enable(this.gl.SCISSOR_TEST),this.gl.scissor(i.x,i.y,i.width,i.height)):(this.gl.enable(this.gl.SCISSOR_TEST),this.gl.scissor(0,0,0,0),this.activeLayerScissorRect={x:0,y:0,width:0,height:0})}}(!t.__host||!t.__host.webgl)&&((t instanceof gi||t instanceof Ri)&&eR(t,0)&&this.createImageHost(t),t instanceof _v&&this.createTextureHost(t))}createTextureHost(t){t.__host=t.__host?t.__host:{};let e=this.gl,n=this.gl.createTexture();e.bindTexture(e.TEXTURE_2D,n),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,!1);let i;if(t instanceof _v){let a=t.getTexture();if(a.source)try{e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,a.source)}catch(r){this.emitFatalImageError({reason:"teximage-security",contentId:t.id,error:r})}i=a}e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),t.__host.webgl={height:t.height,width:t.width,texture:n,lastImage:i}}createImageHost(t){let e=[...Array(t.points.length/5)];t.__host=t.__host?t.__host:{},t.__host.webgl={height:t.height,width:t.width,textures:e,loading:[],loaded:[],loadedAt:[],tileState:{},lastLevelRendered:-1,onLoad:(n,i)=>{let a=this.gl,r=this.gl.createTexture();a.bindTexture(a.TEXTURE_2D,r),a.pixelStorei(a.UNPACK_FLIP_Y_WEBGL,!1);try{a.texImage2D(a.TEXTURE_2D,0,a.RGBA,a.RGBA,a.UNSIGNED_BYTE,i)}catch(l){this.emitFatalImageError({reason:"teximage-security",imageUrl:t.getImageUrl?t.getImageUrl(n):void 0,contentId:t.id,tileIndex:n,error:l}),this.removeLoadingIndex(t,n);return}a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.LINEAR),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.LINEAR),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE),a.bindTexture(a.TEXTURE_2D,null),t.__host.webgl.textures[n]=r,t.__host.webgl.loaded.push(n),t.__host.webgl.loadedAt[n]=void 0,this.setTileState(t,n,{...this.getTileState(t,n),state:"decoded",attempts:0,nextRetryAt:void 0,error:void 0}),this.enqueueTileReveal(this.getTileKey(t,n),t,n),this.requiresRepaint=!0,this.removeLoadingIndex(t,n)}}}removeLoadingIndex(t,e){if(!t.__host?.webgl?.loading)return;let n=t.__host.webgl.loading.indexOf(e);n!==-1&&(t.__host.webgl.loading.splice(n,1),this.loadingCount=Math.max(0,this.loadingCount-1),this.requiresRepaint=!0)}getTileKey(t,e){return`${t.id}::${t.display.scale}::${e}`}nextRequestKey(t){return this.requestGeneration+=1,`${t}::${this.requestGeneration}`}getTileState(t,e){let n=t.__host?.webgl;return n?(n.tileState||(n.tileState={}),n.tileState[e]||(n.tileState[e]={state:"idle"}),n.tileState[e]):{state:"idle"}}setTileState(t,e,n){let i=t.__host?.webgl;i&&(i.tileState||(i.tileState={}),i.tileState[e]=n)}markTileRequired(t,e){if(e){this.requiredPrefetchTileKeys.add(t);return}this.requiredTileKeys.add(t)}isTileRequired(t){return this.requiredTileKeys.has(t)||this.requiredPrefetchTileKeys.has(t)}shouldSkipFade(t,e=performance.now()){return t?.requestedAt?e-t.requestedAt<=this.imageLoadingConfig.skipFadeIfLoadedWithinMs:!1}enqueueTileReveal(t,e,n){let i=performance.now();if(this.imageLoadingConfig.revealDelayFrames===0&&this.imageLoadingConfig.revealBatchWindowFrames===0){e.__host?.webgl?.loadedAt&&(e.__host.webgl.loadedAt[n]=i);let a=this.getTileState(e,n);this.setTileState(e,n,{...a,skipFade:this.shouldSkipFade(a,i)});return}this.pendingTileReveals.set(t,{paint:e,index:n,queuedFrame:this.frameCounter})}flushTileRevealBatch(){if(this.pendingTileReveals.size===0)return;let t=this.imageLoadingConfig.revealDelayFrames,e=this.imageLoadingConfig.revealBatchWindowFrames,n=performance.now(),i=[...this.pendingTileReveals.entries()].sort((r,l)=>r[1].queuedFrame-l[1].queuedFrame),a=0;for(;a<i.length;){let r=i[a];if(this.frameCounter-r[1].queuedFrame<t)break;let l=r[1].queuedFrame+e;for(;a<i.length&&i[a][1].queuedFrame<=l;){let[u,f]=i[a],h=f.paint.__host?.webgl,d=this.getTileState(f.paint,f.index);h?.loadedAt&&d.state==="decoded"&&!h.loadedAt[f.index]&&(h.loadedAt[f.index]=n,this.setTileState(f.paint,f.index,{...d,skipFade:this.shouldSkipFade(d,n)}),this.requiresRepaint=!0),this.pendingTileReveals.delete(u),a+=1}}}emitImageError(t){this.options.onImageError&&this.options.onImageError({renderer:"webgl",...t})}releaseInFlightTileLoad(t,e={}){let n=this.inFlightImageLoads.get(t);n&&(n.release(e),this.inFlightImageLoads.delete(t))}pruneStaleTileWork(){this.tileRequestQueue=this.tileRequestQueue.filter(t=>{if(this.isTileRequired(t.tileKey))return!0;this.queuedTileRequestKeys.delete(t.key);let e=this.getTileState(t.paint,t.index);return e.lastRequestKey===t.requestKey&&e.state==="queued"&&this.setTileState(t.paint,t.index,{...e,state:"idle",cancelledAt:performance.now()}),this.pendingTileReveals.delete(t.tileKey),!1});for(let[t,e]of[...this.inFlightImageLoads.entries()]){if(this.isTileRequired(t))continue;let n=this.getTileState(e.paint,e.index);n.lastRequestKey===e.requestKey&&n.state==="loading"&&this.setTileState(e.paint,e.index,{...n,state:"idle",cancelledAt:performance.now()}),this.pendingTileReveals.delete(t),this.removeLoadingIndex(e.paint,e.index),this.releaseInFlightTileLoad(t,{silent:!0})}}getPrefetchRadius(t){let e=this.getCompositeRenderOptions(t);return e?typeof e.prefetchRadius=="number"?Math.max(0,e.prefetchRadius):e.loadingBias==="speed"?2:e.loadingBias==="data"?0:1:0}isLayerActive(t){let e=t.__parent;return e&&typeof e.isImageActive=="function"?!!e.isImageActive(t):!0}shouldDrawLayer(t,e,n){return(this.getCompositeRenderOptions(t)?.layerPolicy||"fallback-only")==="active-only"?n?!0:!!(t.__host?.webgl?.texture?t.__host.webgl.texture:t.__host?.webgl?.textures?.[e]):!0}getFadeAlpha(t,e,n){if(this.getTileState(t,e).skipFade)return 1;if(this.getTileState(t,e).state==="decoded"&&!t.__host?.webgl?.loadedAt?.[e]&&(this.imageLoadingConfig.revealDelayFrames>0||this.imageLoadingConfig.revealBatchWindowFrames>0))return 0;let i=this.getCompositeRenderOptions(t);if(!i||!i.fadeInMs||i.fadeInMs<=0)return 1;let a=performance.now(),r=1;if(n&&i.fadeOnLayerChange&&i.layerPolicy!=="active-only"){let u=t.__parent;if(u&&typeof u.getImageActivatedAt=="function"){let f=u.getImageActivatedAt(t);typeof f=="number"&&(r=Math.min(r,Math.max(0,Math.min(1,(a-f)/i.fadeInMs))))}}let l=t.__host?.webgl?.loadedAt?.[e];return l&&(n||i.fadeFallbackTiles)&&(r=Math.min(r,Math.max(0,Math.min(1,(a-l)/i.fadeInMs)))),r}getTileRequestKey(t,e){return`${t.id}::${t.display.scale}::${e}`}getCompositeOwner(t){let e=t?.__parent;return e&&e.renderOptions?e:void 0}compareCompositeLoadPriority(t,e){let n=this.getCompositeOwner(t),i=this.getCompositeOwner(e);if(!n||n!==i)return 0;let a=t?.display.scale||0;return(e?.display.scale||0)-a}enqueueTileRequest(t,e,n,i){if(!t.getImageUrl||!t.__host?.webgl)return!1;let a=this.getTileKey(t,e);if(this.markTileRequired(a,i),(t.__host.webgl.texture?t.__host.webgl.texture:t.__host.webgl.textures?.[e])||t.__host.webgl.loading&&t.__host.webgl.loading.indexOf(e)!==-1)return!1;let r=this.getTileState(t,e),l=performance.now();if(r.nextRetryAt&&r.nextRetryAt>l)return!1;let u=this.getTileRequestKey(t,e);if(this.queuedTileRequestKeys.has(u))return!1;let f=this.nextRequestKey(a);return this.pendingTileReveals.delete(a),this.setTileState(t,e,{...r,state:"queued",requestedAt:l,lastRequestKey:f,cancelledAt:void 0,error:void 0,skipFade:!1}),this.tileRequestQueue.push({key:u,tileKey:a,requestKey:f,paint:t,index:e,url:t.getImageUrl(e),priority:n,scale:t.display.scale,prefetch:i}),this.queuedTileRequestKeys.add(u),this.requiresRepaint=!0,!0}schedulePrefetchNeighbours(t,e,n){if(this.framePrefetchCount>=this.maxPrefetchPerFrame||this.getCompositeRenderOptions(t)?.loadingBias==="data")return;let i=this.getPrefetchRadius(t);if(i<=0||!t.columns||!t.rows)return;let a=e%t.columns,r=Math.floor(e/t.columns);for(let l=1;l<=i;l++)for(let u=-l;u<=l;u++)for(let f=-l;f<=l;f++){if(Math.max(Math.abs(f),Math.abs(u))!==l)continue;let h=a+f,d=r+u;if(h<0||d<0||h>=t.columns||d>=t.rows)continue;let m=d*t.columns+h;if(this.enqueueTileRequest(t,m,n+l*1e3,!0)&&(this.framePrefetchCount++,this.framePrefetchCount>=this.maxPrefetchPerFrame))return}}processTileQueue(){if(this.tileRequestQueue.length)for(this.tileRequestQueue.sort((t,e)=>{if(t.prefetch!==e.prefetch)return t.prefetch?1:-1;let n=this.compareCompositeLoadPriority(t.paint,e.paint);return n===0?t.priority===e.priority?e.scale-t.scale:t.priority-e.priority:n});this.loadingCount<this.maxConcurrentTasks&&this.tileRequestQueue.length;){let t=this.tileRequestQueue.shift();this.queuedTileRequestKeys.delete(t.key);let e=t.paint.__host?.webgl;if(!e||!t.paint.getImageUrl)continue;let n=this.getTileState(t.paint,t.index);if(n.lastRequestKey!==t.requestKey||(e.texture?e.texture:e.textures?.[t.index])||e.loading&&e.loading.indexOf(t.index)!==-1)continue;this.setTileState(t.paint,t.index,{...n,state:"loading",url:t.url,requestedAt:n.requestedAt||performance.now()}),e.loading.push(t.index),this.loadingCount++,this.requiresRepaint=!0;let i=`${t.tileKey}::${t.requestKey}`,a=this.imageRequestPool.acquire(t.url,i);this.inFlightImageLoads.set(t.tileKey,{tileKey:t.tileKey,requestKey:t.requestKey,consumerId:i,paint:t.paint,index:t.index,release:a.release}),a.promise.then(r=>{this.releaseInFlightTileLoad(t.tileKey,{silent:!0});let l=this.getTileState(t.paint,t.index);if(l.lastRequestKey!==t.requestKey||l.state!=="loading"){this.removeLoadingIndex(t.paint,t.index);return}t.paint.__host?.webgl?.onLoad(t.index,r)}).catch(r=>{if(this.releaseInFlightTileLoad(t.tileKey,{silent:!0}),I3(r)){let d=this.getTileState(t.paint,t.index);d.lastRequestKey===t.requestKey&&this.setTileState(t.paint,t.index,{...d,state:"idle",cancelledAt:performance.now()}),this.pendingTileReveals.delete(t.tileKey),this.removeLoadingIndex(t.paint,t.index);return}let l=this.getTileState(t.paint,t.index);if(l.lastRequestKey!==t.requestKey){this.removeLoadingIndex(t.paint,t.index);return}let u=(l.attempts||0)+1,f=u<this.imageLoadingConfig.maxAttempts,h=f?performance.now()+_3(this.imageLoadingConfig,u):performance.now()+this.imageLoadingConfig.errorRetryIntervalMs;this.setTileState(t.paint,t.index,{...l,state:f?"idle":"error",attempts:u,nextRetryAt:h,error:r}),this.pendingTileReveals.delete(t.tileKey),this.removeLoadingIndex(t.paint,t.index),this.emitImageError({severity:"recoverable",imageUrl:t.url,contentId:t.paint.id,tileIndex:t.index,attempt:u,maxAttempts:this.imageLoadingConfig.maxAttempts,willRetry:f,nextRetryAt:h,error:r}),!f&&this.options.fallbackOnImageLoadError&&this.emitFatalImageError({reason:"image-cors-or-load",imageUrl:t.url,contentId:t.paint.id,tileIndex:t.index,error:r})}).finally(()=>{this.processTileQueue()})}}paint(t,e,n,i,a,r){if(t.type!=="spacial-content"||!t.__host||!t.__host.webgl)return;let l=t instanceof gi||t instanceof Ri;if(l&&!eR(t,e))return;l&&(this.frameSawFastPathCandidate=!0);let u=l?this.isLayerActive(t):!0;if(t.getTexture){let h=t.getTexture();if(h&&t.__host.webgl.lastImage!==h.hash&&h.source&&!t.__host.webgl.error)try{let d=this.gl.RGBA,m=this.gl.RGBA,y=this.gl.UNSIGNED_BYTE;this.gl.bindTexture(this.gl.TEXTURE_2D,t.__host.webgl.texture),this.gl.texImage2D(this.gl.TEXTURE_2D,0,d,m,y,h.source),t.__host.webgl.lastImage=h.hash}catch(d){t.__host.webgl.error=d,this.emitFatalImageError({reason:"teximage-security",contentId:t.id,tileIndex:e,error:d})}}let f=t.__host.webgl.texture?t.__host.webgl.texture:t.__host.webgl.textures[e];if(l&&u){let h=this.gl.canvas.width/this.dpi/2,d=this.gl.canvas.height/this.dpi/2,m=n+a/2,y=i+r/2,g=Math.hypot(m-h,y-d);f||this.enqueueTileRequest(t,e,g,!1),t instanceof Ri&&this.schedulePrefetchNeighbours(t,e,g)}if(!(l&&!this.shouldDrawLayer(t,e,u))&&f){let h=l&&typeof t.style?.opacity=="number"?t.style.opacity:1,d=typeof t.__zoneVisibilityAlpha=="number"?t.__zoneVisibilityAlpha:1;if(!h)return;let m=l?this.getFadeAlpha(t,e,u):1;m<1&&(this.hasTilesFading=!0);let y=h*m*d;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,f),this.gl.uniform1i(this.uniforms.texture,0),this.gl.uniform1f(this.uniforms.alpha,y),this.setRectangle(n,i,a,r),this.gl.drawArrays(this.gl.TRIANGLES,0,6),!this.isImmediateReadiness()&&l&&y>0&&(this.firstMeaningfulPaint=!0)}}afterPaintLayer(t,e){}pendingUpdate(){return this.requiresRepaint||this.tileRequestQueue.length>0||this.loadingCount>0||this.inFlightImageLoads.size>0||this.pendingTileReveals.size>0||this.hasTilesFading}getPointsAt(t,e,n,i){return t.getPointsAt(e,n,i)}afterFrame(){this.pruneStaleTileWork(),this.processTileQueue()}getScale(t,e,n){if(Number.isNaN(t)||Number.isNaN(e))return this.lastKnownScale;let i=this.getCanvasDims(),a=i.width/t,r=i.height/e,l=(a<r?r:a)*(n&&this.dpi||1);return Number.isNaN(l)||(this.lastKnownScale=l),this.lastKnownScale}getCanvasDims(){return{width:this.canvas.width/this.dpi,height:this.canvas.height/this.dpi}}getViewportBounds(t,e,n){return null}createShader(t,e){let n=this.gl.createShader(t);if(n){if(this.gl.shaderSource(n,e),this.gl.compileShader(n),this.gl.getShaderParameter(n,this.gl.COMPILE_STATUS))return n;let i=this.gl.getShaderInfoLog(n);if(this.gl.deleteShader(n),i)throw Error(i)}throw Error("Invalid shader")}createProgram(t,e){let n=this.gl.createProgram();if(n){if(this.gl.attachShader(n,t),this.gl.attachShader(n,e),this.gl.linkProgram(n),this.gl.getProgramParameter(n,this.gl.LINK_STATUS))return n;let i=this.gl.getProgramInfoLog(n);if(this.gl.deleteProgram(n),i)throw Error(i)}throw Error("Invalid program")}resizeCanvasToDisplaySize(){let t=this.gl.canvas,e=t.clientWidth,n=t.clientHeight,i=Math.round(e*this.dpi),a=Math.round(n*this.dpi),r=t.width!==i||t.height!==a;return r&&(t.width=i,t.height=a),r}createArrayBuffer(t){let e=this.gl.createBuffer();if(this.gl.bindBuffer(this.gl.ARRAY_BUFFER,e),t&&this.gl.bufferData(this.gl.ARRAY_BUFFER,t,this.gl.STATIC_DRAW),!e)throw Error("Cannot create buffer");return e}setRectangle(t,e,n,i){this.gl.bufferData(this.gl.ARRAY_BUFFER,this.getRectangle(t,e,n,i),this.gl.STATIC_DRAW)}getRectangle(t,e,n,i){let a=t,r=t+n,l=e,u=e+i;return this.rectBuffer.set([a,l,r,l,a,u,a,u,r,l,r,u]),this.rectBuffer}getRendererScreenPosition(){return this.rendererPosition}finishLayer(){this.activeLayerScissorRect&&(this.gl.disable(this.gl.SCISSOR_TEST),this.activeLayerScissorRect=void 0)}resetReadyState(){this.isImmediateReadiness()||(this.firstMeaningfulPaint=!1)}reset(){this.canvas.removeEventListener("webglcontextlost",this.onContextLost),this.canvas.style.filter="none",this.framePrefetchCount=0,this.loadingCount=0,this.hasTilesFading=!1,this.requiresRepaint=!1,this.tileRequestQueue=[],this.queuedTileRequestKeys.clear();for(let t of[...this.inFlightImageLoads.keys()])this.releaseInFlightTileLoad(t,{silent:!0});this.imageRequestPool.cancelAll({silent:!0}),this.inFlightImageLoads.clear(),this.requiredTileKeys.clear(),this.requiredPrefetchTileKeys.clear(),this.pendingTileReveals.clear(),this.requestGeneration+=1,this.frameCounter=0,this.frameSawFastPathCandidate=!1,this.firstMeaningfulPaint=this.isImmediateReadiness()}};function aD({interactive:t=!0,viewport:e,forceRefresh:n,canvasElement:i,parityCanvasElement:a,overlayElement:r,controllerConfig:l,interactionMode:u="popmotion",unstable_webglRenderer:f,dpi:h,debug:d,canvasBox:m=!0,polygon:y=!0,navigatorElement:g,runtimeOptions:b,onWebGLFallback:w,onImageError:E,imageLoading:T,webglFallbackOnImageLoadError:S,webglReadiness:R,navigatorRendererOptions:A}){if(!i)throw Error("Invalid container");i.style.userSelect="none";let M=t?(u==="pdf-scroll-zone"?Y3:sR)({minZoomFactor:.5,maxZoomFactor:3,enableClickToZoom:!1,parentElement:i,...l||{}}):void 0,z,I;if(f)try{z=new m3(i,{dpi:h,onFatalImageError:w,onImageError:E,imageLoading:T,fallbackOnImageLoadError:S,readiness:R})}catch{z=new yv(i,{dpi:h,debug:d,box:m,polygon:y,imageLoading:T,onImageError:E})}else z=new yv(i,{dpi:h,debug:d,box:m,polygon:y,imageLoading:T,onImageError:E});let L=z instanceof m3;L&&a&&(I=new yv(a,{dpi:h,debug:d,box:m,polygon:y,paintImages:!0,shouldPaintImage:(yt,xt)=>!eR(yt,xt),readiness:"immediate",imageLoading:T,onImageError:E}));let H=L&&!I?!0:!m,V={},nt=A?.onRequestRender,X=g?new Z8(g,{...A||{},sharedCanvasRenderer:z instanceof yv?z:void 0,onRequestRender:()=>{nt&&nt(),V.current&&V.current.updateNextFrame()}}):void 0,mt=new D3([z,I,r?new k3(r,{box:H,text:!0,triggerResize:n}):void 0,X]),lt=new Vv(mt,new fu(1024,1024),e,M?[M]:[],b);V.current=lt;let it=new nR(i,lt);return{name:"default-preset",em:it,runtime:lt,renderer:mt,controller:M,canvas:i,parityCanvas:I?a:void 0,navigator:g,unmount(){lR(lt),lt.stopControllers(),lt.stop(),lt.reset(),it&&it.stop()}}}var Gs=1+Number.MIN_VALUE,Pj=class{constructor(t,e){C(this,"container",void 0),C(this,"width",void 0),C(this,"height",void 0),C(this,"pending",!0),C(this,"options",void 0),C(this,"stylesheet",void 0),C(this,"zIndex",0),C(this,"lastKnownScale",1),C(this,"rendererPosition",void 0),C(this,"currentlyVisible",[]),C(this,"previouslyVisible",[]),this.container=t,this.rendererPosition=t.getBoundingClientRect();let{width:n,height:i}=this.rendererPosition;this.width=n,this.height=i,this.options={addPart:!1,setDraggableFalse:!1,imageClass:"",widthStylesheet:!1,sheetPrefix:"position-",background:"#000",...e||{}},this.stylesheet=new j3({sheetPrefix:this.options.sheetPrefix}),this.container.classList.add(this.stylesheet.addStylesheet(`
|
|
63
65
|
background: ${this.options.background};
|
|
64
|
-
`)),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(t,e,n){this.stylesheet.updateSheet();for(let i of this.previouslyVisible)this.currentlyVisible.indexOf(i)===-1&&this.container.removeChild(i);for(let i of this.currentlyVisible)this.previouslyVisible.indexOf(i)===-1&&this.container.appendChild(i);this.previouslyVisible=this.currentlyVisible,this.currentlyVisible=[]}afterPaintLayer(t,e){}beforeFrame(t,e,n){this.stylesheet.clearClasses(),this.zIndex=0}getPointsAt(t,e,n,i){return t.getPointsAt(e,n,i)}getScale(t,e){if(Number.isNaN(t)||Number.isNaN(e))return this.lastKnownScale;let n=this.width/t,i=this.height/e,a=n<i?i:n;return Number.isNaN(a)||(this.lastKnownScale=a),this.lastKnownScale}getViewportBounds(t,e,n){return null}createImage(){let t=document.createElement("img");return this.options.imageClass?(t.className=this.options.imageClass,this.options.addPart&&t.setAttribute("part",this.options.imageClass)):(t.style.position="absolute",t.style.pointerEvents="none",t.style.userSelect="none"),this.options.setDraggableFalse&&t.setAttribute("draggable","false"),t}paint(t,e,n,i,a,o){if(this.pending=!1,this.zIndex++,t instanceof Sl){if(!t.__host){let u=this.createImage();u.src=t.uri,t.__host=u,this.container.appendChild(t.__host)}let s=t.__host;this.currentlyVisible.push(s),s.style.zIndex=`${this.zIndex}`,s.style.opacity=`${t.style.opacity}`,this.options.widthStylesheet?s.className=this.options.imageClass+" "+this.stylesheet.addStylesheet(`width:${(a+gl).toFixed(2)}px;height:${(o+gl).toFixed(2)}px;`):(s.style.width=`${a+gl}px`,s.style.height=`${o+gl}px`),s.style.transform=`translate(${n}px, ${i}px)`}if(t instanceof vh){if(t.__host||(t.__host={images:[]}),!t.__host.images[e]){let u=t.getImageUrl(e),d=this.createImage();d.src=u,t.__host.images[e]=d,this.container.appendChild(d)}let s=t.__host.images[e];s.style.zIndex=`${this.zIndex}`,s.style.opacity=`${t.style.opacity}`,this.currentlyVisible.push(s),this.options.widthStylesheet?s.className=this.options.imageClass+" "+this.stylesheet.addStylesheet(`width:${(a+gl).toFixed(2)}px;height:${(o+gl).toFixed(2)}px;`):(s.style.width=`${a+gl}px`,s.style.height=`${o+gl}px`),s.style.transform=`translate(${n}px, ${i}px)`}}pendingUpdate(){return this.pending}prepareLayer(t){}finishLayer(t){}reset(){}};function Bj({interactive:t,viewport:e,forceRefresh:n,containerElement:i,overlayElement:a,controllerConfig:o}){if(!i)throw Error("Invalid container");i.style.userSelect="none";let s=t?VI({minZoomFactor:.5,maxZoomFactor:3,enableClickToZoom:!1,parentElement:i,...o||{}}):void 0,u=new Lj(i,{addPart:!1,setDraggableFalse:!1,imageClass:"atlas-static-image"}),d=a?new UI([u,new YI(a,{box:!0,text:!0,triggerResize:n})]):u,p=new rv(d,new ov(1024,1024),e,s?[s]:[]),f=new MA(i,p);return{name:"static-preset",em:f,runtime:p,renderer:d,controller:s,container:i,overlay:a,unmount(){wA(p),p.stopControllers(),p.stop(),f&&f.stop()}}}var Pj={"default-preset":QI,"static-preset":Bj},Hj={};function Uj(t,e){let n=(0,st.useRef)(),i=(0,st.useRef)(),a=(0,st.useRef)(),o=(0,st.useRef)(),s=(0,st.useRef)({width:e.width,height:e.height,didUpdate:!0}),[u="default-preset",d=Hj]=Array.isArray(t)?t||[]:[t],[p,f]=(0,st.useState)(null);return(0,st.useLayoutEffect)(()=>{let m=i.current,g=o.current,v=n.current,S=a.current,E=(Pj[u]||QI)({containerElement:g,canvasElement:m,overlayElement:v,navigatorElement:S,viewport:s.current,dpi:window.devicePixelRatio||1,forceRefresh:e.forceRefresh,unstable_webglRenderer:e.unstable_webglRenderer,...d||{}});return f(E),()=>{E&&(E.unmount(),m&&(m.height=0,m.width=0),v&&(v.innerHTML=""),S&&(S.height=0,S.width=0))}},[u,d]),[u,p,s,(0,st.useMemo)(()=>({canvas:i,overlay:n,container:o,navigator:a}),[])]}function Vj(t){return(0,st.useMemo)(()=>AA(t),t)}var hh=st.default.forwardRef((t,e)=>(0,Ce.jsx)("div",{...t,ref:e,part:t.className}));function jj(t,e){let n={},i=new Set([...Object.keys(t),...Object.keys(e)]);for(let a of i){let o=t[a],s=e[a];o!==s&&(n[a]={before:o,after:s})}return Object.keys(n).length>0?n:null}function qj(t,e="",n=!1){let i=(0,st.useRef)(t);i.current&&n&&(console.log("Diff:",e,jj(i.current,t)),i.current=t)}var MI=["brightness","contrast","grayscale","hueRotate","invert","saturate","sepia","blur"],Fj=(0,st.memo)(function(t){let{htmlChildren:e,renderPreset:n,onCreated:i,mode:a="explore",resetWorldOnChange:o=!0,unstable_webglRenderer:s=!1,unstable_noReconciler:u=!1,hideInlineStyle:d=!1,controllerConfig:p,children:f,overlayStyle:m,containerStyle:g,enableNavigator:v,className:S,containerProps:E={},homePosition:T,homeOnResize:A,homeCover:x,background:R,runtimeOptions:C,debug:M,filters:z,homePaddingPx:N,...D}=t;qj(t,"Atlas.tsx",t.debug);let[q,P]=(0,st.useState)(a),[U,J]=(0,st.useState)(!1),at=(0,st.useRef)(!1),X=(0,st.useMemo)(()=>(typeof n=="string"&&(n=[n,{}]),M?n?[n[0],{debug:M,...n[1]||{}}]:["default-preset",{debug:M}]:n||"default-preset"),[n,M]),[tt,ut,xt]=M1({scroll:!0}),lt=(0,st.useRef)(),dt=St=>{lt.current=St,tt(St)},[Rt,K,Ct,ee]=Uj(X,{width:D.width,height:D.height,forceRefresh:xt,unstable_webglRenderer:s}),[ce,le]=(0,st.useState)("");(0,st.useEffect)(()=>{P(a)},[a]),(0,st.useEffect)(()=>{K&&K.em&&K.em.updateBounds()},[K,ut]),(0,st.useEffect)(()=>{K?.runtime.setOptions(C||{})},[C]),(0,st.useEffect)(()=>{K&&K.runtime&&(K.runtime.mode=q),U&&K&&(K.ready=!0)},[K,U,q]),(0,st.useEffect)(()=>{K&&(x||(K.runtime.manualHomePosition=!!T,K.runtime.setHomePosition(T)))},[K,x,T]),(0,st.useEffect)(()=>{K&&K.runtime.setHomePaddingPx(N)},[K,N]),(0,st.useEffect)(()=>{if(K){let St=K.runtime;St.resize(Ct.current.width,D.width,Ct.current.height,D.height),Ct.current.width=D.width,Ct.current.height=D.height,St.updateNextFrame(),Ct.current.didUpdate=!0}},[K,D.width,D.height,Ct]),(0,st.useEffect)(()=>{if(z&&K){let St=K.runtime,It=!1;St.hookOptions.enableFilters=!0;for(let te of MI)z[te]?z[te]!==K.runtime.hookOptions.filters[te]&&(St.hookOptions.filters[te]=z[te],It=!0):St.hookOptions.filters[te]&&(St.hookOptions.filters[te]=0,It=!0);It&&St.updateNextFrame()}else if(K){let St=K.runtime;for(let It of MI)St.hookOptions.filters[It]=0;St.hookOptions.enableFilters=!1,St.updateNextFrame()}},[K,z]);function pe(){if(K&&(K.overlay&&(K.overlay.style.width=`${ut.width}px`,K.overlay.style.height=`${ut.height}px`),K.container&&(K.container.style.width=`${ut.width}px`,K.container.style.height=`${ut.height}px`),x)){let St=K.runtime.world.width,It=K.runtime.world.height,te=St/It,Hn=Ct.current.width,Zn=Ct.current.height,tn=Hn/Zn;if(te>tn){tn=Zn/Hn,K.runtime.manualHomePosition=!0;let bn=(St-It/tn)/2;x==="start"&&(bn=0),x==="end"&&(bn=St-It/tn);let B={x:bn,y:0,width:It/tn,height:It};K.runtime.setHomePosition(B)}else{let bn=(It-St/tn)/2;x==="start"&&(bn=0),x==="end"&&(bn=It-St/tn),K.runtime.manualHomePosition=!0;let B={x:0,y:bn,width:St,height:St/tn};K.runtime.setHomePosition(B)}A&&K.runtime.goHome({})}}gh(()=>{pe()},[K,t.runtimeOptions?.maxOverZoom,ut.height,ut.width,x]),gh(()=>{let St=()=>{if(K){let It=K.runtime;Ct.current.width!==D.width&&Ct.current.height!==D.height&&(It.resize(Ct.current.width,D.width,Ct.current.height,D.height),Ct.current.width=D.width,Ct.current.height=D.height,It.updateNextFrame(),Ct.current.didUpdate=!0)}};return window.addEventListener("resize",St),()=>window.removeEventListener("resize",St)},[K,D.height,D.width]);let De={width:120},ne=()=>{if(K&&K.navigator){let St=K.runtime.world.height,It=K.runtime.world.width,te=window.devicePixelRatio||1,Hn=De.width,Zn=De.width/It*St;K.navigator.width=Hn*te,K.navigator.height=Zn*te,K.navigator.style.width=Hn+"px",K.navigator.style.height=Zn+"px"}};gh(()=>{if(K){ne();let St=K.runtime;return St.world.addLayoutSubscriber(It=>{It==="recalculate-world-size"&&(ne(),pe(),St.resize(Ct.current.width,D.width,Ct.current.height,D.height))})}return()=>{}},[K,D.width,D.height]);let Di=(0,st.useCallback)(function(St){let It=()=>{J(!0)};return(0,st.useEffect)(()=>{if(K){K.runtime.goHome();let te=i&&i(K);te&&te.then?te.then(It):It();return}else throw Error("Invalid configuration - no runtime found")},[]),St.children},[K]);(0,st.useEffect)(()=>{if(K){let St=K.runtime;if(o)return St.world.addLayoutSubscriber(It=>{It==="recalculate-world-size"&&St.goHome()})}return()=>{}},[K,o]),(0,st.useEffect)(()=>K?K.runtime.registerHook("useBeforeFrame",()=>{if(Ct.current.didUpdate&&K.canvas){let St=window.devicePixelRatio||1,It=Ct.current.width,te=Ct.current.height;K.canvas.width=It*St,K.canvas.height=te*St,K.canvas.style.width=It+"px",K.canvas.style.height=te+"px",K.canvas.getContext("2d")?.scale(St,St),K&&K.em&&K.em.updateBounds(),Ct.current.didUpdate=!1}}):()=>{},[K,o]),(0,st.useEffect)(()=>{let St=()=>{K&&(P("sketch"),le("mode-sketch")),window.removeEventListener("keyup",St)},It=te=>{if(te.code==="Space"&&K&&K.runtime.mode==="sketch"){let Hn=te.target?.tagName?.toLowerCase();if(Hn==="input"||Hn==="textarea"||te.target?.isContentEditable)return;te.preventDefault(),P("explore"),le("mode-explore"),window.addEventListener("keyup",St)}};return window.addEventListener("keydown",It),()=>{window.removeEventListener("keydown",It),window.removeEventListener("keyup",St)}},[K]),at.current=!0;let{height:ri,width:me,...ge}=D,$t=Vj([D.width,D.height]),Mn=!0;return X&&Array.isArray(X)&&X.length>1&&X[1].interactive===!1&&(Mn=!1),R=R??"#000",lt.current&&(R=getComputedStyle(lt.current).getPropertyValue("--atlas-background")||R),(0,Ce.jsxs)(hh,{ref:dt,className:["atlas",d?"":`atlas-width-${$t}`,ce,S,`atlas-${Rt}`].filter(Boolean).join(" ").trim(),style:{...g,...d?{}:{width:D.width,height:D.height}},children:[Rt==="static-preset"?(0,Ce.jsx)(hh,{className:"atlas-static-container",ref:ee.container,tabIndex:0,...E}):(0,Ce.jsx)("canvas",{className:"atlas-canvas",part:"atlas-canvas",tabIndex:0,...ge,...E,ref:ee.canvas,"data-background":R}),(0,Ce.jsx)(hh,{className:["atlas-overlay",Mn?"atlas-overlay--interactive":""].filter(Boolean).join(" ").trim(),style:{...m||{}},ref:ee.overlay,children:u?(0,Ce.jsx)(Di,{children:(0,Ce.jsx)(cv.Provider,{value:ut,children:(0,Ce.jsx)(Gc.Provider,{value:q,children:(0,Ce.jsx)(uv.Provider,{value:K,children:f})})})}):(0,Ce.jsx)(Ij,{bounds:ut,preset:K,mode:q,setIsReady:J,onCreated:i,children:f})}),v?(0,Ce.jsx)(hh,{className:"atlas-navigator",children:(0,Ce.jsx)("canvas",{className:"atlas-navigator-canvas",part:"atlas-navigator-canvas",ref:ee.navigator})}):null,d?(0,Ce.jsx)("style",{children:`.atlas-width-${$t} { width: ${D.width}px; height: ${D.height}px; }`}):(0,Ce.jsx)("style",{children:`
|
|
65
|
-
.atlas { position: relative; display: flex; background: ${
|
|
66
|
-
.atlas-width-${
|
|
66
|
+
`)),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,this.pending=!0}getRendererScreenPosition(){return this.rendererPosition}afterFrame(t,e,n){this.stylesheet.updateSheet();for(let i of this.previouslyVisible)this.currentlyVisible.indexOf(i)===-1&&this.container.removeChild(i);for(let i of this.currentlyVisible)this.previouslyVisible.indexOf(i)===-1&&this.container.appendChild(i);this.previouslyVisible=this.currentlyVisible,this.currentlyVisible=[],this.pending=!1}afterPaintLayer(t,e){}beforeFrame(t,e,n){this.stylesheet.clearClasses(),this.zIndex=0}getPointsAt(t,e,n,i){return t.getPointsAt(e,n,i)}getScale(t,e){if(Number.isNaN(t)||Number.isNaN(e))return this.lastKnownScale;let n=this.width/t,i=this.height/e,a=n<i?i:n;return Number.isNaN(a)||(this.lastKnownScale=a),this.lastKnownScale}getViewportBounds(t,e,n){return null}createImage(){let t=document.createElement("img");return this.options.imageClass?(t.className=this.options.imageClass,this.options.addPart&&t.setAttribute("part",this.options.imageClass)):(t.style.position="absolute",t.style.pointerEvents="none",t.style.userSelect="none"),this.options.setDraggableFalse&&t.setAttribute("draggable","false"),t}paint(t,e,n,i,a,r){if(this.zIndex++,t instanceof gi){if(!t.__host){let u=this.createImage();u.src=t.uri,t.__host=u,this.container.appendChild(t.__host)}let l=t.__host;this.currentlyVisible.push(l),l.style.zIndex=`${this.zIndex}`,l.style.opacity=`${t.style.opacity}`,this.options.widthStylesheet?l.className=this.options.imageClass+" "+this.stylesheet.addStylesheet(`width:${(a+Gs).toFixed(2)}px;height:${(r+Gs).toFixed(2)}px;`):(l.style.width=`${a+Gs}px`,l.style.height=`${r+Gs}px`),l.style.transform=`translate(${n}px, ${i}px)`}if(t instanceof Ri){if(t.__host||(t.__host={images:[]}),!t.__host.images[e]){let u=t.getImageUrl(e),f=this.createImage();f.src=u,t.__host.images[e]=f,this.container.appendChild(f)}let l=t.__host.images[e];l.style.zIndex=`${this.zIndex}`,l.style.opacity=`${t.style.opacity}`,this.currentlyVisible.push(l),this.options.widthStylesheet?l.className=this.options.imageClass+" "+this.stylesheet.addStylesheet(`width:${(a+Gs).toFixed(2)}px;height:${(r+Gs).toFixed(2)}px;`):(l.style.width=`${a+Gs}px`,l.style.height=`${r+Gs}px`),l.style.transform=`translate(${n}px, ${i}px)`}}pendingUpdate(){return this.pending}prepareLayer(t){}finishLayer(t){}reset(){this.pending=!0}};function Bj({interactive:t,viewport:e,forceRefresh:n,containerElement:i,overlayElement:a,controllerConfig:r,interactionMode:l="popmotion"}){if(!i)throw Error("Invalid container");i.style.userSelect="none";let u=t?(l==="pdf-scroll-zone"?Y3:sR)({minZoomFactor:.5,maxZoomFactor:3,enableClickToZoom:!1,parentElement:i,...r||{}}):void 0,f=new Pj(i,{addPart:!1,setDraggableFalse:!1,imageClass:"atlas-static-image"}),h=a?new D3([f,new k3(a,{box:!0,text:!0,triggerResize:n})]):f,d=new Vv(h,new fu(1024,1024),e,u?[u]:[]),m=new nR(i,d);return{name:"static-preset",em:m,runtime:d,renderer:h,controller:u,container:i,overlay:a,unmount(){lR(d),d.stopControllers(),d.stop(),m&&m.stop()}}}var Hj={"default-preset":aD,"static-preset":Bj},Fj={};function qj(t,e){let n=(0,k.useRef)(),i=(0,k.useRef)(),a=(0,k.useRef)(),r=(0,k.useRef)(),l=(0,k.useRef)(),u=(0,k.useRef)({x:0,y:0,width:e.width,height:e.height,scale:1,didUpdate:!0}),f=(0,k.useRef)({onWebGLFallback:e.onWebGLFallback,onImageError:e.onImageError}),[h="default-preset",d=Fj]=Array.isArray(t)?t||[]:[t],[m,y]=(0,k.useState)(null);return(0,k.useLayoutEffect)(()=>{f.current.onWebGLFallback=e.onWebGLFallback,f.current.onImageError=e.onImageError},[e.onImageError,e.onWebGLFallback]),(0,k.useLayoutEffect)(()=>{let g=i.current,b=l.current,w=n.current,E=r.current,T=(Hj[h]||aD)({containerElement:b,canvasElement:g,parityCanvasElement:a.current,overlayElement:w,navigatorElement:E,viewport:u.current,dpi:window.devicePixelRatio||1,forceRefresh:e.forceRefresh,controllerConfig:e.controllerConfig,interactionMode:e.interactionMode,unstable_webglRenderer:e.unstable_webglRenderer,onWebGLFallback:S=>{f.current.onWebGLFallback&&f.current.onWebGLFallback(S)},onImageError:S=>{f.current.onImageError&&f.current.onImageError(S)},imageLoading:e.imageLoading,webglFallbackOnImageLoadError:e.webglFallbackOnImageLoadError,webglReadiness:e.webglReadiness,runtimeOptions:e.runtimeOptions,...d||{}});return y(T),()=>{if(T){let S=T.runtime.getViewport();u.current={...u.current,...S,didUpdate:!0},T.unmount(),g&&(g.height=0,g.width=0),w&&(w.innerHTML=""),E&&(E.height=0,E.width=0)}}},[h,d,e.unstable_webglRenderer,e.controllerConfig,e.interactionMode,e.imageLoading,e.webglFallbackOnImageLoadError,e.webglReadiness]),[h,m,u,(0,k.useMemo)(()=>({canvas:i,parityCanvas:a,overlay:n,container:l,navigator:r}),[])]}function Uj(t){let e=t;if(Array.isArray(e?.renderers))return"composite";let n=e?.constructor?.name||"";return n==="CanvasRenderer"?"canvas":n==="WebGLRenderer"?"webgl":n==="StaticRenderer"?"static":"unknown"}var g3=["brightness","contrast","grayscale","hueRotate","invert","saturate","sepia","blur"],Vj=(0,k.memo)(function(t){let{htmlChildren:e,renderPreset:n,onCreated:i,mode:a="explore",resetWorldOnChange:r=!0,unstable_webglRenderer:l=!1,onWebGLFallback:u,onReady:f,onImageError:h,readyResetKey:d,webglFallbackOnImageLoadError:m=!1,webglReadiness:y,imageLoading:g,unstable_noReconciler:b=!1,hideInlineStyle:w=!1,controllerConfig:E,interactionMode:T="popmotion",children:S,overlayStyle:R,containerStyle:A,enableNavigator:M,className:z,containerProps:I={},homePosition:L,homeOnResize:H,homeCover:V,background:nt,navigatorOptions:X,runtimeOptions:mt,debug:lt,filters:it,homePaddingPx:yt,devTools:xt,...et}=t;Lj(t,"Atlas.tsx",t.debug);let[gt,Mt]=(0,k.useState)(a),[Vt,Kt]=(0,k.useState)(l),te=(0,k.useRef)(!1),ue=(0,k.useRef)(null),dt=(0,k.useRef)(null),Ht=(0,k.useRef)(void 0),ee=(0,k.useRef)(void 0),[Gt,re]=(0,k.useState)(!1),Ae=(0,k.useRef)(void 0),[Zt,fe]=(0,k.useState)(!1),[Ft,tn]=(0,k.useState)(!1),[Jt,ze]=(0,k.useState)(!1),ri=(0,k.useRef)(!1),qn=X?.style?.background,st=X?.style?.objectFill,Tt=X?.style?.objectStroke,qt=X?.style?.viewportFill,_=X?.style?.viewportStroke,B=X?.style?.viewportLineWidth,rt=X?.pdfScrollZoneZoneWindow?.total,ft=X?.pdfScrollZoneZoneWindow?.before,wt=X?.pdfScrollZoneZoneWindow?.after,U=(0,k.useMemo)(()=>{if(!(qn===void 0&&st===void 0&&Tt===void 0&&qt===void 0&&_===void 0&&B===void 0))return{background:qn,objectFill:st,objectStroke:Tt,viewportFill:qt,viewportStroke:_,viewportLineWidth:B}},[qn,st,Tt,qt,_,B]),P=(0,k.useMemo)(()=>{if(T==="pdf-scroll-zone")return{total:rt??9,before:ft,after:wt}},[T,wt,ft,rt]),Z=(0,k.useCallback)(J=>{lt&&console.debug("[Atlas navigator]",J)},[lt]),W=(0,k.useMemo)(()=>({width:X?.width??120,idleFade:X?.idleFade??!0,idleMs:X?.idleMs??800,fadeDurationMs:X?.fadeDurationMs??250,opacityActive:X?.opacityActive??.94,opacityIdle:X?.opacityIdle??0,style:U,zoneWindow:P}),[X?.fadeDurationMs,X?.idleFade,X?.idleMs,X?.opacityActive,X?.opacityIdle,X?.width,U,P]),Lt=(0,k.useMemo)(()=>{let J="default-preset",pt={},vt=!1;if(Array.isArray(n)?(J=n[0],pt={...n[1]||{}},vt=!0):typeof n=="string"&&(J=n),lt&&(pt.debug=lt,vt=!0),J==="default-preset"){let $t={};W.style&&($t.style=W.style),W.zoneWindow&&($t.zoneWindow=W.zoneWindow),lt&&($t.onDebugEvent=Z),Object.keys($t).length>0&&(pt.navigatorRendererOptions={...pt.navigatorRendererOptions||{},...$t},vt=!0)}return vt?[J,pt]:n||"default-preset"},[n,lt,Z,W.style,W.zoneWindow]),[Yt,Pt,Y]=rx({scroll:!0}),at=(0,k.useRef)(),At=J=>{at.current=J,Yt(J)},Ct=(0,k.useCallback)(J=>{te.current||(te.current=!0,dt.current&&(ue.current=dt.current.getViewport()),Kt(!1),u&&u(J))},[u]),Rt=(0,k.useCallback)(J=>{if(ue.current&&(J.runtime.setViewport(ue.current),J.runtime.updateNextFrame(),ue.current=null),i)return i(J)},[i]),[Ut,G,Bt,he]=qj(Lt,{width:et.width,height:et.height,forceRefresh:Y,controllerConfig:E,interactionMode:T,unstable_webglRenderer:Vt,onWebGLFallback:Ct,onImageError:h,webglFallbackOnImageLoadError:m,webglReadiness:y,imageLoading:g,runtimeOptions:mt});(0,k.useEffect)(()=>{if(G)return mj(G)},[G]);let[Ue,Le]=(0,k.useState)("");(0,k.useEffect)(()=>{Mt(a)},[a]),(0,k.useEffect)(()=>{re(!1),dt.current=G?G.runtime:null,Ht.current=void 0,ee.current=void 0},[G]),(0,k.useEffect)(()=>{if(!l){Kt(!1);return}te.current||Kt(!0)},[l]),(0,k.useEffect)(()=>{if(!G||!f)return;let J=G.runtime;return J.world.addLayoutSubscriber(pt=>{if(pt!=="ready")return;let vt=J.getReadyState();ee.current!==vt.cycle&&(ee.current=vt.cycle,vt.timestamp&&f({runtimeId:J.id,cycle:vt.cycle,reason:vt.reason,renderer:Uj(J.renderer),timestamp:vt.timestamp}))})},[G,f]),(0,k.useEffect)(()=>{if(G){if(d===void 0){Ht.current=void 0;return}if(Ht.current===void 0){Ht.current=d;return}Ht.current!==d&&(Ht.current=d,ee.current=void 0,G.runtime.resetReadyState("ready-reset-key-change"))}},[G,d]),(0,k.useEffect)(()=>{G&&G.em&&G.em.updateBounds()},[G,Pt]),(0,k.useEffect)(()=>{G&&G.runtime.setOptions(mt||{})},[G,mt]),(0,k.useEffect)(()=>{G&&G.runtime&&(G.runtime.mode=gt),Gt&&G&&(G.ready=!0)},[G,Gt,gt]),(0,k.useEffect)(()=>{G&&(V||(G.runtime.manualHomePosition=T==="pdf-scroll-zone"||!!L,G.runtime.setHomePosition(L)))},[G,V,L,T]),(0,k.useEffect)(()=>{G&&G.runtime.setHomePaddingPx(yt)},[G,yt]),(0,k.useEffect)(()=>{if(G){let J=G.runtime;(Bt.current.width!==et.width||Bt.current.height!==et.height)&&(J.resize(Bt.current.width,et.width,Bt.current.height,et.height),Bt.current.width=et.width,Bt.current.height=et.height,Bt.current.didUpdate=!0,J.updateNextFrame())}},[G,et.width,et.height,Bt]),(0,k.useEffect)(()=>{if(it&&G){let J=G.runtime,pt=!1;J.hookOptions.enableFilters=!0;for(let vt of g3)it[vt]?it[vt]!==G.runtime.hookOptions.filters[vt]&&(J.hookOptions.filters[vt]=it[vt],pt=!0):J.hookOptions.filters[vt]&&(J.hookOptions.filters[vt]=0,pt=!0);pt&&J.updateNextFrame()}else if(G){let J=G.runtime;for(let pt of g3)J.hookOptions.filters[pt]=0;J.hookOptions.enableFilters=!1,J.updateNextFrame()}},[G,it]);function Ve(){if(G&&(G.overlay&&(G.overlay.style.width=`${Pt.width}px`,G.overlay.style.height=`${Pt.height}px`),G.container&&(G.container.style.width=`${Pt.width}px`,G.container.style.height=`${Pt.height}px`),V)){let J=G.runtime.world.width,pt=G.runtime.world.height,vt=J/pt,$t=Bt.current.width,Se=Bt.current.height,en=$t/Se;if(vt>en){en=Se/$t,G.runtime.manualHomePosition=!0;let Un=(J-pt/en)/2;V==="start"&&(Un=0),V==="end"&&(Un=J-pt/en);let oa={x:Un,y:0,width:pt/en,height:pt};G.runtime.setHomePosition(oa)}else{let Un=(pt-J/en)/2;V==="start"&&(Un=0),V==="end"&&(Un=pt-J/en),G.runtime.manualHomePosition=!0;let oa={x:0,y:Un,width:J,height:J/en};G.runtime.setHomePosition(oa)}H&&G.runtime.goHome({})}}Xh(()=>{Ve()},[G,t.runtimeOptions?.maxOverZoom,Pt.height,Pt.width,V]),Xh(()=>{let J=()=>{if(G){let pt=G.runtime;(Bt.current.width!==et.width||Bt.current.height!==et.height)&&(pt.resize(Bt.current.width,et.width,Bt.current.height,et.height),Bt.current.width=et.width,Bt.current.height=et.height,pt.updateNextFrame(),Bt.current.didUpdate=!0)}};return window.addEventListener("resize",J),()=>window.removeEventListener("resize",J)},[G,et.height,et.width]);let An=()=>{if(!G)return;let J=G.renderer;if(Array.isArray(J.renderers))return J.renderers.find(pt=>typeof pt.invalidateWorldLayer=="function")},Qn=(0,k.useCallback)(()=>{if(!G)return window.devicePixelRatio||1;let J=G.renderer,pt=(Array.isArray(J.renderers)?J.renderers[0]:J)?.dpi;return typeof pt=="number"&&Number.isFinite(pt)&&pt>0?pt:window.devicePixelRatio||1},[G]),Mi=(0,k.useCallback)(J=>V3(J.world,{target:J.getViewport(),zoneWindow:W.zoneWindow}),[W.zoneWindow]),Oi=(0,k.useCallback)(J=>J.isViewportAtHome({cover:!!V,tolerance:1}),[V,yt]),Ui=()=>{if(G&&G.navigator){let J=Mi(G.runtime),pt=J.height,vt=J.width,$t=Qn(),Se=Math.max(1,vt),en=Math.max(1,pt),Un=Math.max(1,W.width),oa=Math.max(1,et.height-20),Qr=Un,nr=Un/Se*en;if(nr>oa){let ie=oa/nr;nr=oa,Qr=Math.max(1,Un*ie)}G.navigator.width=Qr*$t,G.navigator.height=nr*$t,G.navigator.style.width=Qr+"px",G.navigator.style.height=nr+"px";let Ar=An();Ar&&Ar.invalidateWorldLayer&&Ar.invalidateWorldLayer()}};Xh(()=>{if(G){Ui();let J=G.runtime;return J.world.addLayoutSubscriber(pt=>{if(pt==="repaint"){let vt=An();vt&&vt.invalidateWorldLayer&&vt.invalidateWorldLayer()}(pt==="recalculate-world-size"||pt==="zone-changed")&&(Ui(),Ve(),pt==="recalculate-world-size"&&(Bt.current.width!==et.width||Bt.current.height!==et.height)&&J.resize(Bt.current.width,et.width,Bt.current.height,et.height))})}return()=>{}},[G,et.width,et.height,W.width,Mi,Qn]),(0,k.useEffect)(()=>{if(!G||!M){ze(!1);return}let J=G.runtime,pt=()=>{let vt=Oi(J);ze($t=>$t===vt?$t:vt)};return pt(),J.world.addLayoutSubscriber(()=>{pt()})},[G,M,Oi]);let Xr=(0,k.useCallback)(function(J){let pt=()=>{re(!0)};return(0,k.useEffect)(()=>{if(!G)return;T!=="pdf-scroll-zone"&&G.runtime.goHome();let vt=Rt&&Rt(G);vt&&vt.then?vt.then(pt):pt()},[]),J.children},[G,Rt,T]);(0,k.useEffect)(()=>{if(G){let J=G.runtime;if(r)return J.world.addLayoutSubscriber(pt=>{pt==="recalculate-world-size"&&T!=="pdf-scroll-zone"&&J.goHome()})}return()=>{}},[G,r,T]),(0,k.useEffect)(()=>G?G.runtime.registerHook("useBeforeFrame",()=>{if(Bt.current.didUpdate&&G.canvas){let J=Qn(),pt=Bt.current.width,vt=Bt.current.height;G.canvas.width=pt*J,G.canvas.height=vt*J,G.canvas.style.width=pt+"px",G.canvas.style.height=vt+"px";let $t=G.canvas.getContext("2d");if($t&&($t.setTransform(1,0,0,1,0,0),$t.scale(J,J)),G.parityCanvas){G.parityCanvas.width=pt*J,G.parityCanvas.height=vt*J,G.parityCanvas.style.width=pt+"px",G.parityCanvas.style.height=vt+"px";let Se=G.parityCanvas.getContext("2d");Se&&(Se.setTransform(1,0,0,1,0,0),Se.scale(J,J))}G&&G.em&&G.em.updateBounds(),Bt.current.didUpdate=!1}}):()=>{},[G,r,Qn]),(0,k.useEffect)(()=>{let J=()=>{G&&(Mt("sketch"),Le("mode-sketch")),window.removeEventListener("keyup",J)},pt=vt=>{if(vt.code==="Space"&&G&&G.runtime.mode==="sketch"){let $t=vt.target?.tagName?.toLowerCase();if($t==="input"||$t==="textarea"||vt.target?.isContentEditable)return;vt.preventDefault(),Mt("explore"),Le("mode-explore"),window.addEventListener("keyup",J)}};return window.addEventListener("keydown",pt),()=>{window.removeEventListener("keydown",pt),window.removeEventListener("keyup",J)}},[G]);let ra=(0,k.useCallback)(()=>{!M||!W.idleFade||(fe(!1),Ae.current!==void 0&&window.clearTimeout(Ae.current),Ae.current=window.setTimeout(()=>{ri.current||fe(!0)},W.idleMs))},[M,W.idleFade,W.idleMs]);(0,k.useEffect)(()=>()=>{Ae.current!==void 0&&(window.clearTimeout(Ae.current),Ae.current=void 0)},[]),(0,k.useEffect)(()=>{if(!G?.canvas||!M||!W.idleFade)return;let J=G.canvas,pt=()=>ra(),vt=["pointerdown","pointermove","pointerup","touchstart","touchmove","touchend","wheel"];for(let $t of vt)J.addEventListener($t,pt,{passive:!0});return ra(),()=>{for(let $t of vt)J.removeEventListener($t,pt)}},[G,M,W.idleFade,ra]),(0,k.useEffect)(()=>{if(!G?.navigator||!M)return;let J=G.navigator,pt=G.runtime,vt={active:!1,pointerId:-1,offsetX:0,offsetY:0,startClientX:0,startClientY:0,startWorldX:0,startWorldY:0},$t=ie=>{ri.current=ie,tn(ie)},Se=ie=>{let pe=J.getBoundingClientRect();if(pe.width<=0||pe.height<=0)return{x:0,y:0};let Ye=ie.clientX-pe.left,Cn=ie.clientY-pe.top,Kn=Mi(pt);return K8(ZT(Kn.width,Kn.height,pe.width,pe.height,Kn.x,Kn.y),Ye,Cn)},en=(ie,pe,{preserveOffset:Ye=!0,constrainAfterMove:Cn=!1}={})=>{let Kn=pt.getViewport(),_i=Ye?ie-vt.offsetX:ie-Kn.width/2,Iu=Ye?pe-vt.offsetY:pe-Kn.height/2,nn=de.singleBox(Kn.width,Kn.height,_i,Iu),[,Cr]=pt.constrainBounds(nn,{ref:!0});pt.setViewport({x:Cr[1],y:Cr[2],width:Cr[3]-Cr[1],height:Cr[4]-Cr[2]}),pt.updateControllerPosition(),pt.updateNextFrame(),Cn&&pt.world.constraintBounds(!0)},Un=(ie,pe)=>{let Ye=Q8(pt.world,{target:pt.getViewport(),zoneWindow:W.zoneWindow});for(let Cn of pt.world.zones)if(!(Ye&&!Ye.has(Cn.id))&&(Cn.recalculateBounds(),Cn.points[0]!==0&&ie>=Cn.points[1]&&ie<=Cn.points[3]&&pe>=Cn.points[2]&&pe<=Cn.points[4]))return Cn},oa=ie=>{if(ie.button!==0)return;ra();let pe=Se(ie),Ye=pt.getViewport(),Cn=pe.x>=Ye.x&&pe.y>=Ye.y&&pe.x<=Ye.x+Ye.width&&pe.y<=Ye.y+Ye.height;vt.active=!0,vt.pointerId=ie.pointerId,vt.startClientX=ie.clientX,vt.startClientY=ie.clientY,vt.startWorldX=pe.x,vt.startWorldY=pe.y,Cn?(vt.offsetX=pe.x-Ye.x,vt.offsetY=pe.y-Ye.y):(vt.offsetX=Ye.width/2,vt.offsetY=Ye.height/2,en(pe.x,pe.y,{preserveOffset:!0,constrainAfterMove:!0})),$t(!0),J.setPointerCapture(ie.pointerId),ie.preventDefault(),ie.stopPropagation()},Qr=ie=>{if(!vt.active||ie.pointerId!==vt.pointerId)return;let pe=Se(ie);en(pe.x,pe.y,{preserveOffset:!0}),ra(),ie.preventDefault(),ie.stopPropagation()},nr=ie=>{if(!vt.active||ie.pointerId!==vt.pointerId)return;Se(ie);let pe=Math.hypot(ie.clientX-vt.startClientX,ie.clientY-vt.startClientY),Ye=!1;if(pe<4){let Cn=Un(vt.startWorldX,vt.startWorldY);Cn&&(Ye=pt.goToZone(Cn.id),Ye&&pt.updateNextFrame())}vt.active=!1,vt.pointerId=-1,$t(!1),Ye||pt.world.constraintBounds(!0),J.hasPointerCapture(ie.pointerId)&&J.releasePointerCapture(ie.pointerId),ra(),ie.preventDefault(),ie.stopPropagation()},Ar=ie=>{!vt.active||ie.pointerId!==vt.pointerId||(vt.active=!1,vt.pointerId=-1,$t(!1),J.hasPointerCapture(ie.pointerId)&&J.releasePointerCapture(ie.pointerId),ra())};return J.addEventListener("pointerdown",oa),J.addEventListener("pointermove",Qr),J.addEventListener("pointerup",nr),J.addEventListener("pointercancel",Ar),()=>{$t(!1),J.removeEventListener("pointerdown",oa),J.removeEventListener("pointermove",Qr),J.removeEventListener("pointerup",nr),J.removeEventListener("pointercancel",Ar)}},[G,M,ra,Mi]);let{height:cl,width:dl,...fl}=et,q=Ij([et.width,et.height]),ht=!0;Lt&&Array.isArray(Lt)&&Lt.length>1&&Lt[1].interactive===!1&&(ht=!1),nt=nt??"#000",at.current&&(nt=getComputedStyle(at.current).getPropertyValue("--atlas-background")||nt);let Ot=typeof xt=="object"?xt:void 0,ne=(0,k.useMemo)(()=>({"--atlas-navigator-fade-duration":`${W.fadeDurationMs}ms`,"--atlas-navigator-opacity-active":`${W.opacityActive}`,"--atlas-navigator-opacity-idle":`${W.opacityIdle}`}),[W.fadeDurationMs,W.opacityActive,W.opacityIdle]);return(0,K.jsxs)(kh,{ref:At,className:["atlas",`atlas-interaction-${T}`,w?"":`atlas-width-${q}`,Ue,z,`atlas-${Ut}`].filter(Boolean).join(" ").trim(),style:{...A,...w?{}:{width:et.width,height:et.height}},children:[Ut==="static-preset"?(0,K.jsx)(kh,{className:"atlas-static-container",ref:he.container,tabIndex:0,...I}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)("canvas",{className:"atlas-canvas",part:"atlas-canvas",tabIndex:0,...fl,...I,ref:he.canvas,"data-background":nt}),Vt?(0,K.jsx)("canvas",{className:"atlas-parity-canvas",part:"atlas-parity-canvas","aria-hidden":"true","data-background":"transparent",ref:he.parityCanvas}):null]}),(0,K.jsx)(kh,{className:["atlas-overlay",ht?"atlas-overlay--interactive":""].filter(Boolean).join(" ").trim(),style:{...R||{}},ref:he.overlay,children:b?(0,K.jsx)(Xr,{children:(0,K.jsx)(Uv.Provider,{value:Pt,children:(0,K.jsx)(wd.Provider,{value:gt,children:(0,K.jsx)(qv.Provider,{value:G,children:S})})})}):(0,K.jsx)(hj,{bounds:Pt,preset:G,mode:gt,interactionMode:T,setIsReady:re,onCreated:Rt,children:S})}),M?(0,K.jsx)(kh,{className:["atlas-navigator",Jt?"atlas-navigator--hidden-at-home":"",W.idleFade&&Zt?"atlas-navigator--idle":"",Ft?"atlas-navigator--dragging":""].filter(Boolean).join(" ").trim(),style:ne,children:(0,K.jsx)("canvas",{className:"atlas-navigator-canvas",part:"atlas-navigator-canvas",ref:he.navigator})}):null,xt?(0,K.jsx)(Mj,{...Ot,runtimeId:Ot?.runtimeId||G?.runtime.id}):null,w?(0,K.jsx)("style",{children:`.atlas-width-${q} { width: ${et.width}px; height: ${et.height}px; }`}):(0,K.jsx)("style",{children:`
|
|
67
|
+
.atlas { position: relative; display: flex; background: ${nt}; z-index: var(--atlas-z-index, 10); -webkit-touch-callout: none; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; }
|
|
68
|
+
.atlas-width-${q} { width: ${et.width}px; height: ${et.height}px; }
|
|
67
69
|
.atlas-canvas { flex: 1 1 0px; }
|
|
70
|
+
.atlas-interaction-pdf-scroll-zone .atlas-canvas,
|
|
71
|
+
.atlas-interaction-pdf-scroll-zone .atlas-static-container { touch-action: none; }
|
|
72
|
+
.atlas-parity-canvas { position: absolute; top: 0; left: 0; pointer-events: none; }
|
|
68
73
|
.atlas-canvas:focus, .atlas-static-container:focus { outline: none }
|
|
69
74
|
.atlas-canvas:focus-visible, .atlas-canvas-container:focus-visible { outline: var(--atlas-focus, 2px solid darkorange) }
|
|
70
75
|
.atlas-static-preset { touch-action: inherit; }
|
|
71
76
|
.atlas-static-container { position: relative; overflow: hidden; flex: 1 1 0px; }
|
|
72
|
-
.atlas-overlay { position: absolute; top: 0; left: 0;
|
|
77
|
+
.atlas-overlay { position: absolute; top: 0; left: 0; right: 0; bottom: 0; overflow: hidden; }
|
|
73
78
|
/** setting the pointer events to none means that Atlas will own the touch and mousewheel events **/
|
|
74
79
|
.atlas-overlay--interactive { pointer-events: none; }
|
|
75
80
|
.atlas-static-image { position: absolute; user-select: none; transform-origin: 0px 0px; }
|
|
76
|
-
.atlas-navigator { position: absolute; top: var(--atlas-navigator-top, 10px); right: var(--atlas-navigator-
|
|
77
|
-
.atlas-navigator
|
|
78
|
-
|
|
79
|
-
|
|
81
|
+
.atlas-navigator { position: absolute; top: var(--atlas-navigator-top, 10px); right: var(--atlas-navigator-right, 10px); left: var(--atlas-navigator-left); bottom: var(--atlas-navigator-bottom); opacity: var(--atlas-navigator-opacity-active, .94); transition: opacity var(--atlas-navigator-fade-duration, 250ms) ease; z-index: var(--atlas-navigator-z-index, 30); }
|
|
82
|
+
.atlas-navigator--idle { opacity: var(--atlas-navigator-opacity-idle, .4); }
|
|
83
|
+
.atlas-navigator--hidden-at-home { opacity: 0; pointer-events: none; }
|
|
84
|
+
.atlas-navigator-canvas { width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; border-radius: var(--atlas-navigator-radius, 6px); border: var(--atlas-navigator-border, 1px solid rgba(0, 0, 0, 0.7)); box-shadow: var(--atlas-navigator-shadow, 0 6px 16px rgba(2, 6, 23, 0.45)); box-sizing: border-box; }
|
|
85
|
+
.atlas-navigator--dragging .atlas-navigator-canvas { cursor: grabbing; }
|
|
86
|
+
`}),e]})});function y3(t){return Number(t)==t?`${t}px`:t}var rD=(0,k.memo)(function({resizeHash:t,aspectRatio:e,containerProps:n={},htmlChildren:i,...a}){let[r,l,u]=rx(),f=(0,k.useId)(),{height:h,width:d,...m}=a;(0,k.useEffect)(()=>{u()},[d,h,t,u]);let y=(0,k.useMemo)(()=>e?{width:l.width,height:l.width*(1/e)}:l,[l,e]),g=(0,k.useMemo)(()=>`atlas-auto-${f.replace(/[^a-zA-Z0-9_-]/g,"")}`,[f]),b=(0,k.useMemo)(()=>["atlas-container",g,n.className].filter(Boolean).join(" ").trim(),[g,n.className]),w=(0,k.useMemo)(()=>`.${g} {
|
|
80
87
|
display: var(--atlas-container-display, block);
|
|
81
88
|
flex: var(--atlas-container-flex, none);
|
|
82
|
-
width: var(--atlas-container-width, ${
|
|
83
|
-
height: var(--atlas-container-height, ${
|
|
84
|
-
}
|
|
85
|
-
`}),i]})}),fv=()=>(0,st.useContext)(uv),dv=()=>{let t=fv();return t?t.runtime:void 0};var KI=(t,e=[])=>{let n=dv();(0,st.useEffect)(()=>n?n.registerHook("useFrame",t):()=>{},e)},hv=()=>{let t=fv();return t&&t.canvas?t.canvas:void 0};function kj(){return(0,st.useContext)(cv)}async function Yj(t,e,n){if(st.version.startsWith("18.")||st.version.startsWith("19.")){let i=await Promise.resolve().then(()=>_(gI(),1)),a=i.default?i.default.createRoot:i.createRoot;n.current||(n.current=a(t)),n.current.render(e)}else if(typeof ReactDOM<"u"){let{render:i,unmountComponentAtNode:a}=ReactDOM;i(e,t),n.current={unmount(){a(t)}}}else{let i=await Promise.resolve().then(()=>_(ms(),1)),a=i.default?i.default.render:i.render,o=i.default?i.default.unmountComponentAtNode:i.unmountComponentAtNode;a(e,t),n.current={unmount(){o(t)}}}}var _i=st.default.forwardRef(({children:t,...e},n)=>{let i=(0,st.useRef)(),a=dv(),o=(0,st.useRef)(0),s=(0,st.useRef)(),u=(0,st.useRef)();return KI(()=>{if(e.relative){let d=i.current;if(d&&a){let p=a.getScaleFactor();o.current!==p&&(o.current=p,d.style.transformOrigin="0 0",d.style.transform=`scale(${1/o.current})`,d.style.width=`${o.current*100}%`,d.style.height=`${o.current*100}%`,i.current&&s.current?.__owner.value?.rotation&&(d.style.transform=`scale(${1/o.current}) translate(50%, 50%) rotate(${s.current?.__owner.value?.rotation||0}deg) translate(-50%, -50%)`))}}},[e.relative]),(0,st.useLayoutEffect)(()=>{let d=s.current;n&&d&&(typeof n=="function"?n(d):n.current=d);async function p(){if(d&&d.__host){let f=e.relative?(0,Ce.jsx)("div",{ref:i,children:t}):t;await Yj(d.__host.element,f,u)}}d&&d.__host?p():d&&(d.__onCreate=p)},[n,t,s,e.relative]),(0,st.useLayoutEffect)(()=>()=>{u.current&&setTimeout(()=>{u.current.unmount()},0)},[]),(0,Ce.jsx)("box",{html:!0,...e,ref:s})});_i.displayName="HTMLPortal";var OI=(t,e,n=[])=>{let i=dv();(0,st.useEffect)(()=>{if(i){let a=e,o=Fc[t];i.world.activatedEvents.push(o);let s=o.slice(2).toLowerCase();return i.world.addEventListener(s,a),()=>{i.world.removeEventListener(s,a)}}return()=>{}},[i?i.world:void 0,t,...n])};function _I(t,e){if(t===0)return[0,1];if(e===0)return[1,0];let n=Math.abs(t)/Math.abs(e);return[n,1-n]}function Qj(){let t=(0,st.useRef)({ctrl:!1,shift:!1,alt:!1});return(0,st.useLayoutEffect)(()=>{function e(i){i.key==="Shift"&&(t.current.shift=!0),i.key==="Control"&&(t.current.ctrl=!0),i.key==="Alt"&&(t.current.alt=!0)}function n(i){i.key==="Shift"&&(t.current.shift=!1),i.key==="Control"&&(t.current.ctrl=!1),i.key==="Alt"&&(t.current.alt=!1)}return window.addEventListener("keydown",e),window.addEventListener("keyup",n),()=>{window.removeEventListener("keydown",e),window.removeEventListener("keyup",n)}},[]),t}var ZI=(t,e)=>{let n=Mj(),i=dv(),a=kj(),o=(0,st.useRef)(),s=(0,st.useRef)(null),u=(0,st.useRef)(),[d,p]=(0,st.useState)(!1),f=(0,st.useRef)(!1),m=(0,st.useRef)({north:0,south:0,east:0,west:0}),g=Qj(),v=(0,st.useCallback)(x=>R=>{if(f.current=!0,p(!0),a&&i){let{top:C,left:M}=a,z=i.viewerToWorld(R.pageX-M,R.pageY-C);u.current={x:z.x,y:z.y},o.current=x}},[a,i]),S=(0,st.useMemo)(()=>t.width/t.height,[t.width,t.height]),E=(0,st.useCallback)(x=>{if(!Math.abs(x.north-x.south+(x.east-x.west)))return;let R=-x.west+x.east,C=-x.north+x.south,M=t.width+R,z=t.height+C;if(M/z>=S){let N=M-z*S,[D,q]=_I(x.east,x.west);x.west+=N*q,x.east-=N*D}else{let N=z-M/S,[D,q]=_I(x.north,x.south);x.north+=N*D,x.south-=N*q}},[t.width,t.height,S]);KI(()=>{u&&i&&i.updateNextFrame()}),(0,st.useEffect)(()=>{i&&i.updateNextFrame()},[i,d]);let T=(0,st.useCallback)(x=>{if(!i||!a||i.mode!=="sketch")return;let{top:R,left:C}=a,M=i.viewerToWorld(x.pageX-C,x.pageY-R),z=s.current,N=!t.maintainAspectRatio&&g.current.alt,D=!N&&g.current.shift&&o.current?.indexOf("-")!==-1;if((o.current==="translate"||o.current==="east"||o.current==="north-east"||o.current==="south-east")&&(m.current.east=M.x-(u.current?u.current.x:0),N&&(m.current.west=-m.current.east)),(o.current==="translate"||o.current==="west"||o.current==="north-west"||o.current==="south-west")&&(m.current.west=M.x-(u.current?u.current.x:0),N&&(m.current.east=-m.current.west)),(o.current==="translate"||o.current==="north"||o.current==="north-east"||o.current==="north-west")&&(m.current.north=M.y-(u.current?u.current.y:0),N&&(m.current.south=-m.current.north)),(o.current==="translate"||o.current==="south"||o.current==="south-west"||o.current==="south-east")&&(m.current.south=M.y-(u.current?u.current.y:0),N&&(m.current.north=-m.current.south)),(t.maintainAspectRatio||D)&&E(m.current),z){let q=m.current.west,P=m.current.north,U=t.width+m.current.east,J=t.height+m.current.south;z.points[1]=Math.min(q,U),z.points[2]=Math.min(P,J),z.points[3]=Math.max(q,U),z.points[4]=Math.max(P,J),i.updateNextFrame()}},[i,t.width,t.height,t.maintainAspectRatio,a]);OI("mousemove",T,[t.width,t.height,a]),OI("pointermove",T,[t.width,t.height,a]);let A=(0,st.useRef)();return(0,st.useEffect)(()=>{A.current=()=>{if(f.current){let x=m.current.west,R=m.current.north,C=t.width+m.current.east,M=t.height+m.current.south,z=Math.min(x,C),N=Math.min(R,M),D=Math.max(x,C),q=Math.max(R,M),P={x:(t.x||0)+z,y:(t.y||0)+N,width:D-z||1,height:q-N||1};t.maintainAspectRatio,e(P),o.current=void 0,u.current=void 0,m.current.east=0,m.current.west=0,m.current.north=0,m.current.south=0,f.current=!1,p(!1)}}},[e,t.height,t.width,t.x,t.y]),(0,st.useEffect)(()=>{let x=()=>{A.current&&A.current()};return window.addEventListener("pointerup",x),window.addEventListener("touchend",x),()=>{window.removeEventListener("pointerup",x),window.removeEventListener("touchend",x)}},[]),{portalRef:s,mode:n,mouseEvent:v,onPointerMoveCallback:T,isEditing:d}};function bh(t,e){return t?e?{...t,...e||{},":hover":t[":hover"]?Object.assign(t[":hover"]||{},e[":hover"]||{}):e[":hover"],":active":t[":active"]?Object.assign(t[":active"]||{},e[":active"]||{}):e[":hover"]}:t:e}var ar=_(nt(),1);function ka(t){return{all:t=t||new Map,on:function(e,n){var i=t.get(e);i?i.push(n):t.set(e,[n])},off:function(e,n){var i=t.get(e);i&&(n?i.splice(i.indexOf(n)>>>0,1):t.set(e,[]))},emit:function(e,n){var i=t.get(e);i&&i.slice().map(function(a){a(n)}),(i=t.get("*"))&&i.slice().map(function(a){a(e,n)})}}}var Bs=_(nt(),1),WI=_(Y(),1),Xj=ka(),pv=(0,Bs.createContext)(Xj);function Kj({children:t,emitter:e}){return(0,WI.jsx)(pv.Provider,{value:e,children:t})}function OA(){return(0,Bs.useContext)(pv)}function Ps(t,e,n=[]){let i=(0,Bs.useContext)(pv);(0,Bs.useEffect)(()=>{let a=o=>{e(o)};return i.on(t,a),()=>{i.off(t,a)}},[i,t,...n])}function Zj(t){return{all:t=t||new Map,on:function(e,n){var i=t.get(e);i?i.push(n):t.set(e,[n])},off:function(e,n){var i=t.get(e);i&&(n?i.splice(i.indexOf(n)>>>0,1):t.set(e,[]))},emit:function(e,n){var i=t.get(e);i&&i.slice().map(function(a){a(n)}),(i=t.get("*"))&&i.slice().map(function(a){a(e,n)})}}}function Wj(t,e,n){let[i,a]=t,[o,s]=e,[u,d]=n,p=u-o,f=d-s,m=Math.sqrt(p*p+f*f);if(m===0)return{distance:Math.sqrt((i-o)**2+(a-s)**2),closestPoint:[o,s]};let g=Math.max(0,Math.min(1,((i-o)*p+(a-s)*f)/(m*m))),v=o+g*p,S=s+g*f,E=[v,S];return{distance:Math.sqrt((i-v)**2+(a-S)**2),closestPoint:E}}function Jj(t,e,n,i){let[a,o]=t,[s,u]=e,[d,p]=n,[f,m]=i,g=(a-s)*(p-m)-(o-u)*(d-f);if(Math.abs(g)<1e-10)return null;let v=((a-d)*(p-m)-(o-p)*(d-f))/g,S=-((a-s)*(o-p)-(o-u)*(a-d))/g;if(v>=0&&v<=1&&S>=0&&S<=1){let E=a+v*(s-a),T=o+v*(u-o);return[E,T]}return null}function $j(t,e,n){let i=n||e.snapThreshold||15,a=[],[o,s]=t,u=e.polygon.points,d=e.slowState.transitionIntentType==="move-point";if(e.slowState.snapToPoints)for(let p=0;p<u.length;p++){if(d&&e.selectedPoints.includes(p))continue;let f=u[p];if(f[0]===o&&f[1]===s)continue;let m=f[0]-o,g=f[1]-s,v=Math.sqrt(m*m+g*g);v<=i&&a.push({type:"point",point:[f[0],f[1]],source:{pointIndex:p,polygon:e.polygon},distance:v})}if(e.slowState.snapToLines)for(let p=0;p<u.length;p++){if(d&&e.selectedPoints.includes(p))continue;let f=(p+1)%u.length;if(p===f)continue;let m=u[p],g=u[f],{distance:v,closestPoint:S}=Wj(t,m,g);v<=i&&a.push({type:"line",point:S,source:{lineIndex:p,polygon:e.polygon},distance:v})}if(e.slowState.snapToIntersections&&u.length>=4)for(let p=0;p<u.length;p++){if(d&&e.selectedPoints.includes(p))continue;let f=(p+1)%u.length,m=u[p],g=u[f];for(let v=p+2;v<u.length;v++){if(d&&e.selectedPoints.includes(v))continue;let S=(v+1)%u.length;if(v===f||S===p)continue;let E=u[v],T=u[S],A=Jj(m,g,E,T);if(A){let[x,R]=A,C=Math.sqrt((o-x)**2+(s-R)**2);C<=i&&a.push({type:"intersection",point:A,source:{lineIndex:p,polygon:e.polygon},distance:C})}}}if(e.slowState.snapToParallel)for(let p=0;p<u.length;p++){if(d&&e.selectedPoints.includes(p))continue;let f=u[p],[m,g]=f,v=Math.abs(s-g);v<=i&&a.push({type:"parallel",point:[o,g],source:{pointIndex:p,polygon:e.polygon},distance:v});let S=Math.abs(o-m);S<=i&&a.push({type:"parallel",point:[m,s],source:{pointIndex:p,polygon:e.polygon},distance:S})}return a.sort((p,f)=>p.distance-f.distance)}function t7(t){return t.sort((e,n)=>{let i=e.type==="point"?0:e.type==="intersection"?1:e.type==="parallel"?2:3,a=n.type==="point"?0:n.type==="intersection"?1:n.type==="parallel"?2:3;return i!==a?i-a:e.distance-n.distance})}function e7(t,e){let n=[];for(let i of t)switch(i.type){case"point":n.push({type:"point",points:[i.point],target:i});break;case"line":if(i.source?.lineIndex!==void 0){let a=e.polygon.points,o=i.source.lineIndex,s=(o+1)%a.length,u=a[o],d=a[s];n.push({type:"line",points:[u,d,i.point],target:i})}else n.push({type:"point",points:[i.point],target:i});break;case"intersection":n.push({type:"cross",points:[i.point],target:i});break;case"parallel":if(i.source?.pointIndex!==void 0){let a=e.polygon.points[i.source.pointIndex];n.push({type:"parallel-line",points:[a,i.point],target:i})}break}return n}function bl(t,e,n=5,i){if(!e.slowState.snapEnabled)return e.snapTargets=[],e.activeSnapGuides=[],e.isSnapping=!1,e.snapPoint=null,null;let a=$j(t,e,void 0);if(a.length===0)return e.snapTargets=[],e.activeSnapGuides=[],e.isSnapping=!1,e.snapPoint=null,null;let o=t7(a);return e.snapTargets=o,e.activeSnapGuides=e7(o.slice(0,n),e),e.isSnapping=!0,e.snapPoint=o[0].point,e.snapPoint}function nD(t){t.snapTargets=[],t.activeSnapGuides=[],t.isSnapping=!1,t.snapPoint=null}function n7(t){return t.isSnapping&&t.snapPoint!==null}function Th(t,e){return n7(e)&&e.snapPoint?e.snapPoint:t}var i7={type:"add-open-point",label:"Add point",tools:["pen","line","lineBox"],trigger:{type:"click"},isValid(t,e,n){if(!e.isOpen)return!1;if(e.polygon.points.length===0)return!0;if(e.selectedPoints.length!==1||e.polygon.points.length>=2&&(e.slowState.currentTool==="line"||e.slowState.currentTool==="lineBox"))return!1;if(e.slowState.bounds){let{x:a,y:o,width:s,height:u}=e.slowState.bounds,[d,p]=t[0];if(d<a||d>a+s||p<o||p>o+u)return!1}let i=e.selectedPoints[0];return i===0||i===e.polygon.points.length-1},commit(t,e,n){let i=e.line?e.line[1]:t[0];!n.Shift&&e.slowState.snapEnabled&&(bl(i,e,3),i=Th(i,e));let a=e.polygon.points;if(a.length===0)return{selectedPoints:[0],points:[i]};n.Shift;let o=e.selectedPoints[0],s=e.slowState.currentTool==="line"||e.slowState.currentTool==="lineBox";if(o===0)return~~a[0][0]===~~i[0]&&~~a[0][1]===~~i[1]?{selectedPoints:[0],points:a}:{selectedPoints:s?[]:[0],points:[i,...a]};let u=a[a.length-1];return~~u[0]===~~i[0]&&~~u[1]===~~i[1]?{selectedPoints:[a.length-1],points:a}:(e.line=null,{selectedPoints:s?[]:[a.length],points:[...a,i]})}};function JI(t,e){return Math.abs(t-e)}function aa(t,e){let n=JI(t[0],e[0]),i=JI(t[1],e[1]);return Math.sqrt(n**2+i**2)}function _A(t,e){return[t[0]-e[0],t[1]-e[1]]}function a7(t,e){return t[0]*e[0]+t[1]*e[1]}function iD(t){return t[0]*t[0]+t[1]*t[1]}function mv(t,e){return iD(_A(t,e))}function aD(t,e,n,i){return i&&n&&(t<0?t=Math.max(t,-i.x-n.x):t>0&&(t=Math.min(t,i.x+i.width-n.x-n.width)),e<0?e=Math.max(e,-i.y-n.y):e>0&&(e=Math.min(e,i.y+i.height-n.y-n.height))),[t,e]}function oD(t,e){let n,i,a,o;var s=(S,E,T,A,x)=>{if(A<=T+1)return;let R=T,C=0,M=S*S;n=[E[T],E[A]],i=_A(n[1],n[0]);let z=iD(i),N,D,q,P,U;for(let J=T+1;J<A;J++)N=_A(E[J],n[0]),P=a7(N,i),P<=0?U=mv(E[J],n[0]):z<=P?U=mv(E[J],n[1]):(q=P/z,D=[n[0][0]+q*i[0],n[0][1]+q*i[1]],U=mv(E[J],D)),!(U<=C)&&(R=J,C=U);C>M&&(x[R]=1,s(S,E,T,R,x),s(S,E,R,A,x))};let u=t.length,d=[],p,f,m,g,v=e*e;for(a=[],o=[],a[0]=t[0],p=f=1,g=0;p<u;p++)mv(t[p],t[g])<v||(a[f++]=t[p],g=p);for(g<u-1&&(a[f++]=t[u-1]),o[0]=o[f-1]=1,s(e,a,0,f-1,o),p=m=0;p<f;p++)o[p]&&(d[m++]=a[p]);return d}function o7(t){if(t.length!==4)return!1;let e=1e-10,n=Math.min(...t.map(u=>u[0])),i=Math.max(...t.map(u=>u[0])),a=Math.min(...t.map(u=>u[1])),o=Math.max(...t.map(u=>u[1]));for(let u of t){let d=Math.abs(u[0]-n)<e||Math.abs(u[0]-i)<e,p=Math.abs(u[1]-a)<e||Math.abs(u[1]-o)<e;if(!d||!p)return!1}let s=[[n,a],[n,o],[i,a],[i,o]];for(let u of s)if(!t.some(d=>Math.abs(d[0]-u[0])<e&&Math.abs(d[1]-u[1])<e))return!1;return!0}function rD(t){let e=t.points.length,n=!1,i=[];if(e>1){t.iedges=[];let a=t.points[e-1];for(let o=0;o<e;o++){let s=a;if(a=t.points[o],a.length===6){let p=a[2],f=a[3],m=a[4],g=a[5];i.push([o,[a[0]+p,a[1]+f],[a[0]+m,a[1]+g]]),n=!0}let u=[a[0]-s[0],a[1]-s[1]],d=u[0]*u[0]+u[1]*u[1];d>0?t.iedges.push([u[0]/d,u[1]/d]):t.iedges.push([0,0])}}else e===1?t.iedges=[[0,0]]:t.iedges=null;t.isBezier=n,t.bezierLines=i}function r7(t,e){let n=1/0,i=null,a=-1,o=t.points.length;if(o<=1)return[null,n,a];let s=t.points[o-1];for(let u=0;u<o;u++){let d=s;s=t.points[u];let p=d[0]-e[0],f=d[1]-e[1],m=p*p+f*f;m<n&&(i=d,n=m,a=u===0?o-1:u-1)}return[i,n,a]}function yv(t){if(t.points.length>2){let e=Math.min(...t.points.map(o=>o[0])),n=Math.min(...t.points.map(o=>o[1])),i=Math.max(0,...t.points.map(o=>o[0])),a=Math.max(0,...t.points.map(o=>o[1]));t.boundingBox={x:e,y:n,width:i-e,height:a-n};return}t.boundingBox=null}function l7(t){return t[0]*t[0]+t[1]*t[1]}function $I(t,e){let n=1/0,i=null,a=-1,o=[],s=t.points.length;if(s<=1)return[null,n,o,a];if(t.iedges===null&&(rD(t),!t.iedges))return[null,n,o,a];let u=t.points[s-1];for(let d=0;d<s;d++){let p=u;u=t.points[d];let f=(e[0]-p[0])*t.iedges[d][0]+(e[1]-p[1])*t.iedges[d][1],m;f<=0?m=p:f<1?m=[(1-f)*p[0]+f*u[0],(1-f)*p[1]+f*u[1]]:m=u;let g=l7([m[0]-e[0],m[1]-e[1]]);g<n&&(i=m,n=g,o=[p,u],a=d===0?s-1:d-1)}return[i,n,o,a]}var xh={type:"bounding-box-corners",label:"Drag to resize",tools:["pointer","box"],modifiers:{Shift:"Maintain aspect ratio",Alt:"Scale from center",Meta:"Rotate"},isValid(t,e,n){if(e.transitionDirection=null,e.transitionRotate=!1,e.isOpen||!e.slowState.boxMode&&e.selectedPoints.length!==e.polygon.points.length||!e.polygon.boundingBox)return!1;let i=n.proximity*.5,a=n.proximity*5,o=t[0],s=e.polygon.boundingBox,u=s.x+i,d=s.x+s.width-i*2,p=s.y+i,f=s.y+s.height-i*2;if(o[0]>u&&o[0]<d&&o[1]>p&&o[1]<f)return!1;let m=[s.x+s.width,s.y+s.height],g=[s.x,s.y],v=[s.x+s.width,s.y],S=[s.x,s.y+s.height],E=["ne","nw","se","sw"],T={ne:v,nw:g,se:m,sw:S},A=[aa(t[0],v),aa(t[0],g),aa(t[0],m),aa(t[0],S)],x=Math.min(...A),R=A.indexOf(x),C=R===-1?null:E[R],M=C?T[C]:null;if(A[0]<a||A[1]<a||A[2]<a||A[3]<a){if(C){let[z,N]=o;(n.Meta||z>=M[0]-n.proximity*4&&N>=M[1]-n.proximity*4&&z<=M[0]+n.proximity*4&&N<=M[1]+n.proximity*4&&!(z>=M[0]-n.proximity*2&&N>=M[1]-n.proximity*2&&z<=M[0]+n.proximity*2&&N<=M[1]+n.proximity*2))&&(e.slowState.boxMode||(e.transitionRotate=!0)),e.transitionDirection=C}return!0}return!1},start(t,e,n){let i=t[0],a=e.polygon.boundingBox,o=[a.x+a.width,a.y+a.height],s=[a.x,a.y],u=[a.x+a.width,a.y],d=[a.x,a.y+a.height],p=["ne","nw","se","sw"],f=[aa(t[0],u),aa(t[0],s),aa(t[0],o),aa(t[0],d)],m=Math.min(...f),g=f.indexOf(m);e.transitionDirection=g!==-1?p[g]:null},transition(t,e,n){let i=e.polygon.boundingBox,a=e.transitionOrigin||t[0],[o,s]=t[0];if((n.Meta||e.transitionRotate)&&!e.slowState.boxMode){let x=[i.x+i.width/2,i.y+i.height/2],R=Math.atan2(a[1]-x[1],a[0]-x[0]),C=Math.atan2(s-x[1],o-x[0]),M=n.Shift,z=Math.PI/(n.Alt?4:12),N=C-R;M&&(N=Math.round(N/z)*z);let D=Math.cos(N),q=Math.sin(N),P=[];for(let U of e.polygon.points){let J=U[0]-x[0],at=U[1]-x[1],X=J*D-at*q,tt=J*q+at*D,ut=X+x[0],xt=tt+x[1];P.push(U.length===6?[ut,xt,U[2],U[3],U[4],U[5]]:[ut,xt])}e.transitionPoints=P,yv({points:P,iedges:null,boundingBox:null,isBezier:!1,bezierLines:[]}),e.transitionBoundingBox=e.polygon.boundingBox?{...e.polygon.boundingBox,rotation:N}:null;return}let u=e.transitionDirection,d=u.includes("e")?1:-1,p=u.includes("s")?1:-1,f=!!n.Alt,m;if(f)m=[i.x+i.width/2,i.y+i.height/2];else switch(u){case"se":m=[i.x,i.y];break;case"sw":m=[i.x+i.width,i.y];break;case"ne":m=[i.x,i.y+i.height];break;case"nw":m=[i.x+i.width,i.y+i.height];break}let g=f?i.width/2:i.width,v=f?i.height/2:i.height,S,E;if(n.Shift||e.slowState.fixedAspectRatio){let x=d*g,R=p*v,C=o-m[0],M=s-m[1],z=x*x+R*R,N=z>0?(C*x+M*R)/z:1;N=Math.max(N,.01),S=N,E=N}else{let x=0,R=0;switch(u){case"se":x=o-a[0],R=s-a[1];break;case"sw":x=a[0]-o,R=s-a[1];break;case"ne":x=o-a[0],R=a[1]-s;break;case"nw":x=a[0]-o,R=a[1]-s;break}f&&(x*=2,R*=2),S=(i.width+x)/i.width,E=(i.height+R)/i.height}let T=[];for(let x of e.polygon.points){let R=x[0]-m[0],C=x[1]-m[1],M=R*S,z=C*E,N=M+m[0],D=z+m[1];T.push(x.length===6?[N,D,x[2],x[3],x[4],x[5]]:[N,D])}e.transitionPoints=T;let A={points:T,iedges:null,boundingBox:null,bezierLines:[],isBezier:!1};yv(A),e.transitionBoundingBox=A.boundingBox},commit(t,e,n){let i=e.transitionPoints;return e.transitionPoints=null,e.transitionBoundingBox=null,e.transitionRotate=!1,{points:i}}},s7={type:"close-line-box",label:"Close Line Box",tools:["lineBox"],trigger:{type:"click"},isValid(t,e,n){return e.polygon.points.length===2&&e.lineBox!==null&&e.slowState.boxMode===!1},commit(t,e,n){return e.lineBox?{isOpen:!1,points:e.lineBox,tool:"pen"}:{}}},lD={type:"close-shape",label:"Close shape",tools:["pen","line"],trigger:{type:"click"},isValid(t,e,n){if(!e.isOpen||e.slowState.boxMode||e.selectedPoints.length!==1||e.polygon.points.length<2||n.Meta)return!1;let i=e.selectedPoints[0];if(i===0){let a=e.polygon.points[e.polygon.points.length-1];return aa(t[0],a)<n.proximity}if(i===e.polygon.points.length-1){let a=e.polygon.points[0];return aa(t[0],a)<n.proximity}return!1},commit(t,e,n){let i=e.selectedPoints[0];if(e.line=null,i===0)return{selectedPoints:[],points:e.polygon.points.slice(0).reverse(),isOpen:!1};if(i===e.polygon.points.length-1)return{selectedPoints:[],isOpen:!1}}},u7={type:"close-shape-line",label:"Close shape line",trigger:{type:"click"},tools:["pen"],isValid(t,e,n){return!e.isOpen||e.slowState.boxMode||e.polygon.points.length<3||!e.closestLinePoint||e.closestLineDistance>=n.proximity*2?!1:(e.closestLineIndex===0||(e.closestLineIndex,e.polygon.points.length-2),!0)},commit(t,e,n){return lD.commit(t,e,n)}},sD={type:"split-line",label:"Split line",tools:["pen"],isValid(t,e,n){let i=e.slowState.currentTool==="line";return n.Meta||i?!1:!!(e.closestLinePoint&&e.closestLineDistance<n.proximity)},transition(t,e,n){let i=t[0];!n.Shift&&e.slowState.snapEnabled&&(bl(i,e,3,e.closestLineIndex),i=Th(i,e));let a=e.transitionOrigin||i,[o,s]=i,u=e.polygon.points,d=[],p=o-a[0],f=s-a[1];for(let m=0;m<u.length;m++)if(d.push(u[m]),e.closestLineIndex===m){let g=e.closestLinePoint;d.push([g[0]+p,g[1]+f])}e.transitionPoints=d},commit(t,e,n){let i=e.transitionPoints;return e.transitionPoints=null,e.transitionBoundingBox=null,{selectedPoints:[e.closestLineIndex+1],points:i}}},c7={type:"cut-line",label:"Add new point",tools:["pen"],trigger:{type:"click"},modifiers:{Shift:"Cut line"},isValid(t,e,n){return e.slowState.boxMode?!1:sD.isValid(t,e,n)},commit(t,e,n){if(n.Shift&&!e.isOpen){let o=e.polygon.points,s=[],u=[],d=!1;for(let p=0;p<o.length;p++)d?u.push(o[p]):s.push(o[p]),e.closestLineIndex===p&&(d=!0);return{isOpen:!0,points:[...u,...s]}}let i=e.polygon.points,a=[];for(let o=0;o<i.length;o++)if(a.push(i[o]),e.closestLineIndex===o){let s=e.closestLinePoint;a.push(s)}return{points:a}}},f7={type:"delete-point",label:"Delete point",tools:["pointer","pen","lineBox","line"],trigger:{type:"key",key:"Backspace"},isValid(t,e,n){return e.selectedPoints.length>0&&e.slowState.canDelete},commit(t,e,n){let i=e.polygon.points.filter((a,o)=>!e.selectedPoints.includes(o));return{isOpen:i.length<3,selectedPoints:[],points:i,tool:e.slowState.boxMode?"box":void 0}}},d7={type:"deselect-bounding-box",label:"Deselect bounding box",tools:["pointer"],trigger:{type:"click"},isValid(t,e,n){return e.slowState.canDeselect&&!e.isOpen&&!e.slowState.boxMode&&e.selectedPoints.length>2&&e.selectedPoints.length===e.polygon.points.length},commit(t,e,n){return e.slowState.lastCreationTool==="pen"?{selectedPoints:[],tool:"pen"}:{selectedPoints:[]}}},h7={type:"deselect-draw",label:"Deselect draw",trigger:{type:"key",key:"Escape"},tools:["pointer","pen","box","lineBox","stamp","hand","pencil"],isValid(t,e,n){return e.slowState.canDeselect},commit(t,e,n){return{selectedPoints:[]}}},p7={type:"deselect-points",label:"Deselect points",trigger:{type:"click"},tools:["pointer","pen"],isValid(t,e,n){return e.selectedPoints.length>0&&e.slowState.canDeselect},commit(t,e,n){return{selectedPoints:[]}}},m7={type:"draw-shape",label:"Draw shape",tools:["pen","pencil"],modifiers:{Alt:"Freehand drawing"},isValid(t,e,n){let i=n.Alt||e.slowState.currentTool==="pencil";return!!(e.isOpen&&(e.line||e.polygon.points.length===0)&&i)},start(t,e,n){e.transitionDraw=[]},transition(t,e,n){let i=t[0];!n.Shift&&e.slowState.snapEnabled&&(bl(i,e,3),i=Th(i,e)),e.transitionDraw.push(i)},commit(t,e,n){let i=e.slowState.currentTool==="pencil"?e.scale*1.5:e.scale*3,a=oD(e.transitionDraw,i);if(e.transitionDraw=[],a.length===0)return;let o=!0,s=3,u=e.selectedPoints[0],d=[...e.polygon.points,...a],p=d[0],f=d[d.length-1];u===0&&(p=d[d.length-1],f=d[0],d=[...a,...e.polygon.points.slice(0).reverse()]);let m=[d.length-1],g=aa(p,f)/n.proximity<s,v="";return g&&(o=!1,v="pointer",m=d.map((S,E)=>E)),{isOpen:o,tool:v||void 0,points:d,selectedPoints:m}}},g7={type:"move-line",label:"Move line",tools:["line"],isValid(t,e,n){return e.slowState.currentTool!=="line"||e.slowState.boxMode?!1:!!(e.closestLinePoint&&e.closestLineDistance<n.proximity)},transition(t,e){let n=e.transitionOrigin,i=e.polygon.boundingBox,a=t[0],[o,s]=aD(a[0]-n[0],a[1]-n[1],i,e.slowState.bounds);e.transitionPoints=e.polygon.points.map(u=>u.length===6?[u[0]+o,u[1]+s,u[2],u[3],u[4],u[5]]:[u[0]+o,u[1]+s])},commit(t,e,n){let i=e.transitionPoints;return e.transitionPoints=null,e.transitionBoundingBox=null,{points:i}}},y7={type:"move-point",label:"Move point",tools:["pointer","pen","line"],modifiers:{Shift:"Constrain to axis"},isValid(t,e,n){if(n.Alt)return!1;let i=n.proximity,[a,o]=t[0],s=e.polygon.points,u=e.selectedPoints;for(let d=0;d<s.length;d++){let p=s[d],f=p[0]-a,m=p[1]-o;if(f*f+m*m<i*i)return!0}return!1},start(t,e,n){if(e.slowState.boxMode)return xh.start?xh.start(t,e,n):void 0;if(e.selectedPoints.length<2){let[i,a,o]=r7(e.polygon,t[0]);return{selectedPoints:[o]}}if(e.slowState.closestPoint&&!e.selectedPoints.includes(e.slowState.closestPoint))return{selectedPoints:[e.slowState.closestPoint]}},transition(t,e,n){if(e.slowState.boxMode)return xh.transition(t,e,n);let i=e.transitionOrigin,a=t[0];!n.Shift&&e.slowState.snapEnabled&&(bl(a,e,3),a=Th(a,e));let[o,s]=a,u=e.polygon.points,d=e.selectedPoints;if(e.slowState.closestPoint){let g=e.slowState.closestPoint;d.indexOf(g)===-1&&(d=[g])}let p=[],f=o-i[0],m=s-i[1];n.Shift&&!e.slowState.snapEnabled&&(Math.abs(f)>Math.abs(m)?m=0:f=0);for(let g=0;g<u.length;g++){let v=d.indexOf(g)!==-1,S=u[g];v?S.length===6?p.push([S[0]+f,S[1]+m,S[2],S[3],S[4],S[5]]):p.push([S[0]+f,S[1]+m]):p.push(S)}e.transitionPoints=p},commit(t,e,n){if(e.slowState.boxMode)return xh.commit(t,e,n);let i=e.transitionPoints;return e.transitionPoints=null,e.transitionBoundingBox=null,{points:i}}},uD={type:"move-bounding-box",label:"Move bounding box",tools:["pointer"],isValid(t,e,n){let i=e.polygon.points.length,a=i===e.selectedPoints.length,o=e.polygon.boundingBox;if(i<1||!a||!o)return!1;let s=t[0],u=s[0],d=s[1];return u>=o.x&&u<=o.x+o.width&&d>=o.y&&d<=o.y+o.height},transition(t,e,n){let i=e.slowState.bounds,a=e.transitionOrigin,o=e.polygon.boundingBox,s=t[0],[u,d]=aD(s[0]-a[0],s[1]-a[1],o,i);e.transitionPoints=e.polygon.points.map(p=>p.length===6?[p[0]+u,p[1]+d,p[2],p[3],p[4],p[5]]:[p[0]+u,p[1]+d]),o&&(e.transitionBoundingBox={x:o.x+u,y:o.y+d,width:o.width,height:o.height})},commit(t,e,n){let i=e.transitionPoints;return e.transitionPoints=null,e.transitionBoundingBox=null,{points:i}}},cD={type:"move-shape",label:"Move shape",tools:["pointer","hand","box"],isValid(t,e,n){return n.Shift?!1:e.slowState.pointerInsideShape&&(!e.isOpen||e.line===null)},transition(t,e,n){uD.transition(t,e,n)},commit(t,e,n){let i=e.transitionPoints;return e.transitionPoints=null,e.transitionBoundingBox=null,{points:i}}},v7={type:"nudge-right",label:"Nudge right",trigger:{type:"key",key:"ArrowRight"},tools:["pointer","pen"],modifiers:{Shift:"Nudge right more"},isValid(t,e,n){return e.selectedPoints.length>0},commit(t,e,n){let i=n.proximity*.3,a=e.polygon.points,o=e.selectedPoints;return{points:a.map((s,u)=>o.includes(u)?[s[0]+(n.Shift?4*i:1),s[1]]:s)}}},S7={type:"nudge-left",label:"Nudge left",trigger:{type:"key",key:"ArrowLeft"},tools:["pointer","pen"],modifiers:{Shift:"Nudge left more"},isValid(t,e,n){return e.selectedPoints.length>0},commit(t,e,n){let i=n.proximity*.3,a=e.polygon.points,o=e.selectedPoints;return{points:a.map((s,u)=>o.includes(u)?[Math.max(0,s[0]-(n.Shift?4*i:1)),s[1]]:s)}}},b7={type:"nudge-up",label:"Nudge up",trigger:{type:"key",key:"ArrowUp"},tools:["pointer","pen"],modifiers:{Shift:"Nudge up more"},isValid(t,e,n){return e.selectedPoints.length>0},commit(t,e,n){let i=n.proximity*.3,a=e.polygon.points,o=e.selectedPoints;return{points:a.map((s,u)=>{if(o.includes(u)){let d=s[0],p=Math.max(0,s[1]-(n.Shift?4*i:1));return s.length===6?[d,p,s[2],s[3],s[4],s[5]]:[d,p]}return s})}}},x7={type:"nudge-down",label:"Nudge down",trigger:{type:"key",key:"ArrowDown"},tools:["pointer","pen"],modifiers:{Shift:"Nudge down more"},isValid(t,e,n){return e.selectedPoints.length>0},commit(t,e,n){let i=n.proximity*.3,a=e.polygon.points,o=e.selectedPoints;return{points:a.map((s,u)=>{let d=s[0],p=Math.max(0,s[1]+(n.Shift?4*i:1));return o.includes(u)?s.length===6?[d,p,s[2],s[3],s[4],s[5]]:[d,p]:s})}}},E7={type:"select-multiple-points",label:"Drag to select multiple points",tools:["pointer","pen"],isValid(t,e,n){return e.slowState.currentTool==="line"&&e.polygon.points.length>=2?!0:!(e.slowState.boxMode||e.line)},transition(t,e,n){if(!e.transitionOrigin)return;let i=e.transitionOrigin[0],a=e.transitionOrigin[1],o=t[0][0],s=t[0][1],u=Math.min(i,o),d=Math.min(a,s),p=Math.abs(i-o),f=Math.abs(a-s);e.selectionBox={x:u,y:d,width:p,height:f}},commit(t,e,n){if(e.selectionBox){let i=[];n.Shift&&i.push(...e.selectedPoints);for(let a=0;a<e.polygon.points.length;a++){let o=e.polygon.points[a];o[0]>=e.selectionBox.x&&o[0]<=e.selectionBox.x+e.selectionBox.width&&o[1]>=e.selectionBox.y&&o[1]<=e.selectionBox.y+e.selectionBox.height&&i.push(a)}return{selectedPoints:i}}}},tD=10,A7={type:"select-point",label:"Select point",trigger:{type:"click"},tools:["pointer","pen","line"],modifiers:{Shift:"Add to selection"},isValid(t,e,n){let i=-1;if(e.selectedPoints.length===1){let u=e.selectedPoints[0];u===0&&(i=e.polygon.points.length-1),u===e.polygon.points.length-1&&(i=0)}if(e.slowState.boxMode)return!1;let[a,o]=t[0],s=e.polygon.points;for(let u=0;u<s.length;u++){let d=s[u],p=d[0]-a,f=d[1]-o;if(p*p+f*f<tD*tD)return i!==u}return!1},commit(t,e,n){let i=n.Shift?[...e.selectedPoints]:[],[a,o]=t[0],s=e.polygon.points.map((u,d)=>{let p=u[0]-a,f=u[1]-o;return[p*p+f*f,d]}).sort((u,d)=>u[0]-d[0])[0];if(e.line=null,!i.includes(s[1]))i.push(s[1]);else if(n.Shift)return{selectedPoints:i.filter(u=>u!==s[1])};return{selectedPoints:i}}},R7={type:"select-shape",label:"Select shape",trigger:{type:"click"},tools:["pointer","pen"],isValid(t,e,n){return cD.isValid(t,e,n)},commit(t,e,n){return{tool:"pointer",selectedPoints:e.polygon.points.map((i,a)=>a)}}},T7={type:"snap",label:"Smart snap",tools:["pointer","pen","line"],modifiers:{Shift:"Disable snapping"},isValid(t,e,n){return n.Shift||!e.slowState.snapEnabled||e.slowState.transitioning&&e.slowState.transitionIntentType!=="snap"||!e.slowState.snapToPoints&&!e.slowState.snapToLines&&!e.slowState.snapToIntersections?!1:bl(t[0],e,0)!==null},start(t,e,n){bl(t[0],e,5)},transition(t,e,n){let i=bl(t[0],e,5);i&&(e.pointer=i)},commit(t,e,n){nD(e)}},C7={type:"stamp-fixed-size-shape",label:"Stamp fixed size shape",trigger:{type:"click"},tools:["stamp"],isValid(t,e,n){return e.slowState.selectedStamp!==null},commit(t,e,n){let i=t[0],a=e.slowState.selectedStamp;if(!i||!a)return;let o=i[0],s=i[1],u=[],d=Math.min(...a.points.map(E=>E[0])),p=Math.min(...a.points.map(E=>E[1])),f=Math.max(...a.points.map(E=>E[0]))-d,m=Math.max(...a.points.map(E=>E[1]))-p,g=4*n.proximity,v=f/g;m/g>v&&(v=m/g),o-=f/v/2,s-=m/v/2;let S=0;for(let E of a.points)u.push([o+(E[0]-d)/v,s+(E[1]-p)/v]),S++;return{isOpen:!1,points:u}}},fD={id:"square",open:!1,points:[[0,0],[0,100],[100,100],[100,0]]},w7={id:"triangle",open:!1,points:[[50,0],[0,100],[100,100]]},M7={id:"pentagon",open:!1,points:[[0,0],[0,100],[100,100],[100,0],[50,-50]]},O7={id:"hexagon",open:!1,points:[[50,0],[0,25],[0,75],[50,100],[100,75],[100,25]]},_7={id:"circle",open:!1,points:[[948.949,571.107],[954.545,500],[954.545,500],[948.949,428.893],[948.949,428.893],[932.298,359.538],[932.298,359.538],[905.003,293.641],[905.003,293.641],[867.735,232.825],[867.735,232.825],[821.412,178.588],[821.412,178.588],[767.175,132.265],[767.175,132.265],[706.359,94.997],[706.359,94.997],[640.462,67.702],[640.462,67.702],[571.107,51.051],[571.107,51.051],[500,45.455],[500,45.455],[428.893,51.051],[428.893,51.051],[359.538,67.702],[359.538,67.702],[293.641,94.997],[293.641,94.997],[232.825,132.265],[232.825,132.265],[178.588,178.588],[178.588,178.588],[132.265,232.825],[132.265,232.825],[94.997,293.641],[94.997,293.641],[67.702,359.538],[67.702,359.538],[51.051,428.893],[51.051,428.893],[45.455,500],[45.455,500],[51.051,571.107],[51.051,571.107],[67.702,640.462],[67.702,640.462],[94.997,706.359],[94.997,706.359],[132.265,767.175],[132.265,767.175],[178.588,821.412],[178.588,821.412],[232.825,867.735],[232.825,867.735],[293.641,905.003],[293.641,905.003],[359.538,932.298],[359.538,932.298],[428.893,948.949],[428.893,948.949],[500,954.545],[500,954.545],[571.107,948.949],[571.107,948.949],[640.462,932.298],[640.462,932.298],[706.359,905.003],[706.359,905.003],[767.175,867.735],[767.175,867.735],[821.412,821.412],[821.412,821.412],[867.735,767.175],[867.735,767.175],[905.003,706.359],[905.003,706.359],[932.298,640.462],[932.298,640.462],[948.949,571.107]]},z7={type:"stamp-shape",label:"Stamp shape",tools:["stamp","box"],modifiers:{Shift:"Maintain aspect ratio"},isValid(t,e,n){return!(e.polygon.points.length&&!e.slowState.canDelete)},start(t,e,n){let i=t[0],a=e.slowState.selectedStamp||fD;if(i){let o=i[0],s=i[1],u=[],d=Math.min(...a.points.map(E=>E[0])),p=Math.min(...a.points.map(E=>E[1])),f=Math.max(...a.points.map(E=>E[0]))-d,m=Math.max(...a.points.map(E=>E[1]))-p,g=f/32;m/32>g&&(g=m/32);let v=[],S=0;for(let E of a.points)v.push(S),u.push([o+(E[0]-d)/g,s+(E[1]-p)/g]),S++;return e.transitionPoints=u,{isOpen:!1,selectedPoints:v,points:u}}},transition(t,e,n){if(!e.transitionOrigin)return;let i=e.polygon.boundingBox,a=[i.x,i.y],o=e.transitionOrigin||t[0],[s,u]=t[0],d=e.transitionOrigin[0],p=e.transitionOrigin[1],f=t[0][0],m=t[0][1],g=f-d-32,v=m-p-32;if(n.Shift||e.slowState.fixedAspectRatio){let x=i.width/i.height;Math.abs(i.width/g)>Math.abs(i.height/v)?v=g/x:g=v*x}let S=(i.width+g)/i.width,E=(i.height+v)/i.height,T=[];for(let x of e.polygon.points){let R=x[0]-a[0],C=x[1]-a[1],M=R*S,z=C*E,N=M+a[0],D=z+a[1];if(x.length===6){T.push([N,D,x[2],x[3],x[4],x[5]]);continue}T.push([N,D])}e.transitionPoints=T;let A={points:T,iedges:null,boundingBox:null,bezierLines:[],isBezier:!1};yv(A),e.transitionBoundingBox=A.boundingBox},commit(t,e,n){return{isOpen:!1,points:e.transitionPoints,tool:"pointer"}}},N7={type:"toggle-snap",label:"Toggle snapping",trigger:{type:"key",key:"`"},tools:["pointer","pen","line","lineBox","box","stamp"],modifiers:{},isValid(t,e,n){return!0},commit(t,e,n){let i=!e.slowState.snapEnabled;return e.slowState.snapEnabled=i,i||(e.snapTargets=[],e.activeSnapGuides=[],e.isSnapping=!1,e.snapPoint=null),{}}};function dD(t={}){let e=t.proximityThreshold||10,n=t.closestLinePointFill||{selected:"#fff",unselected:"rgba(255, 255, 255, .5)"},i=t.closestLinePointStroke||{selected:"#000",unselected:"rgba(0, 0, 0, .5)"};function a(S,E,T){S&&E.transitionBoundingBox&&T.transitioning&&(S.setAttribute("x",""+E.transitionBoundingBox.x),S.setAttribute("y",""+E.transitionBoundingBox.y),S.setAttribute("width",""+E.transitionBoundingBox.width),S.setAttribute("height",""+E.transitionBoundingBox.height))}function o(S,E,T){S&&E.polygon.boundingBox&&T.showBoundingBox&&(S.setAttribute("x",""+E.polygon.boundingBox.x),S.setAttribute("y",""+E.polygon.boundingBox.y),S.setAttribute("width",""+E.polygon.boundingBox.width),S.setAttribute("height",""+E.polygon.boundingBox.height))}function s(S,E,T){if(S&&E.polygon.boundingBox&&T.showBoundingBox){let A=E.transitionBoundingBox||E.polygon.boundingBox;A.rotation?(S.style.transformOrigin=`${A.x+A.width/2}px ${A.y+A.height/2}px`,S.style.transform=`rotate(${Math.round(100*A.rotation*(180/Math.PI))/100}deg)`):S.style.transform="",S.setAttribute("points",[[A.x,A.y],[A.x+A.width,A.y],[A.x+A.width,A.y+A.height],[A.x,A.y+A.height]].map(x=>x.join(",")).join(" "))}}function u(S,E,T){S&&E.transitionPoints&&T.transitioning&&S.setAttribute("points",E.transitionPoints.map(A=>A.join(",")).join(" "))}function d(S,E,T){S&&E.closestLinePoint&&T.hasClosestLine&&(S.setAttribute("cx",""+E.closestLinePoint[0]),S.setAttribute("cy",""+E.closestLinePoint[1]),S.setAttribute("fill",E.closestLineDistance<e?n.selected:n.unselected),S.setAttribute("stroke",E.closestLineDistance<e?i.selected:i.unselected))}function p(S,E,T){S&&E.closestLinePoint&&T.hasClosestLine&&S.setAttribute("transform",`translate(${E.closestLinePoint[0]}, ${E.closestLinePoint[1]})`)}function f(S,E,T){S&&E.selectionBox&&T.transitionIntentType==="select-multiple-points"&&(S.setAttribute("x",""+E.selectionBox.x),S.setAttribute("y",""+E.selectionBox.y),S.setAttribute("width",""+E.selectionBox.width),S.setAttribute("height",""+E.selectionBox.height))}function m(S,E,T){if(S&&E.pointer&&E.selectedPoints.length)if(T.actionIntentType==="close-shape"||T.actionIntentType==="close-shape-line"){let A=E.polygon.points[0],x=E.polygon.points[E.polygon.points.length-1];A&&x&&S.setAttribute("points",`${A.join(",")} ${x.join(",")}`)}else if(E.line)S.setAttribute("points",`${E.line[0].join(",")} ${E.line[1].join(",")}`);else{let A=E.polygon.points[E.selectedPoints[0]];A&&A.length&&S.setAttribute("points",`${E.pointer[0]},${E.pointer[1]} ${A.join(",")}`)}}function g(S,E,T,A=3){S&&E.transitionDraw.length&&S.setAttribute("points",oD(E.transitionDraw,A*E.scale).map(x=>x.join(",")).join(" "))}function v(S,E){S&&E.lineBox&&S.setAttribute("points",E.lineBox.map(T=>T.join(",")).join(" "))}return{updateTransitionBoundingBox:a,updateClosestLinePointTransform:p,updateBoundingBoxPolygon:s,updateBoundingBox:o,updateTransitionShape:u,updateClosestLinePoint:d,updateSelectBox:f,updatePointLine:m,updateDrawPreview:g,updateLineBox:v}}var I7=typeof window<"u"?window.requestAnimationFrame:t=>setTimeout(t,16),D7=typeof window<"u"?window.cancelAnimationFrame:t=>clearTimeout(t);function eD(t){return!["hand","pointer"].includes(t)}var Ah=[xh,y7,g7,sD,cD,uD,m7,E7,z7,T7],L7=Ah.length,Eh=[s7,C7,lD,A7,u7,c7,i7,R7,d7,p7],kc=[h7,v7,S7,b7,x7,f7,N7],Rh={};Ah.forEach(t=>{Rh[t.type]=t});Eh.forEach(t=>{Rh[t.type]=t});kc.forEach(t=>{Rh[t.type]=t});var gv=10;function hD(t,e){let n=t?.fixedAspectRatio||!1,i=t?.tool||"pointer",a=t?.keyboardShortcutMapping||{},o=typeof t?.keyboardShortcutsEnabled=="boolean"?t.keyboardShortcutsEnabled:!0,s=t?.enabledTools||["pointer","pen","box","lineBox","stamp","hand","line","pencil"],u=t?.emitter||Zj(),d={V:"pointer",P:"pen",B:"box",L:"lineBox",S:"stamp",H:"hand",N:"line",D:"pencil",...t?.toolMap||{}},p={shapeId:t?.id||null,noShape:t===null,transitioning:!1,actionIntentType:null,transitionIntentType:null,selectedPoints:[],hasClosestLine:!1,modifiers:{Alt:!1,Shift:!1,Meta:!1,proximity:gv},bounds:t?.bounds||null,showBoundingBox:!1,currentModifiers:{},validIntentKeys:{},pointerInsideShape:!1,closestPoint:null,selectedStamp:null,transitionModifiers:null,boxMode:!1,bezierLines:[],fixedAspectRatio:n,isToolSwitchingLocked:!1,canDeselect:!1,canDelete:!0,cursor:"default",enabledTools:s,currentTool:i,lastCreationTool:eD(i)?i:null,snapEnabled:!1,snapToPoints:!0,snapToLines:!0,snapToIntersections:!0,snapToGrid:!1,snapToParallel:!0},f={isOpen:typeof t?.open=="boolean"?t.open:!1,polygon:{points:t?.points||[],iedges:null,boundingBox:null,isBezier:null,bezierLines:[]},scale:1,selectedPoints:[],pointer:null,line:null,lineBox:null,transitionPoints:null,transitionOrigin:null,transitionBoundingBox:null,closestLinePoint:null,closestLineDistance:0,closestLineIndex:-1,transitionRotate:!1,transitionDirection:null,transitionBezierLine:null,selectionBox:null,slowState:p,transitionDraw:[],isPanning:!1,panStart:null,snapTargets:[],activeSnapGuides:[],snapThreshold:15,isSnapping:!1,snapPoint:null},m={startTime:0,time:0,shouldUpdate:!1,nextSlowState:null,renderFunc:()=>{},setStateFunc:()=>{},animationFrame:0,actionIntent:null,transitionIntent:null,undoStack:[],undoStackPointer:-1},g={isPressed:!1,isClicking:!1,lastPress:null,pressTimeout:0,noTransition:!1};function v(B){rD(B),B.isBezier&&S({bezierLines:B.bezierLines}),yv(B),m.shouldUpdate=!0}v(f.polygon);function S(B){let Q=Object.keys(B);if(Q.length===0)return;let ft=m.nextSlowState||f.slowState,ht=!1;if(Q.length===1&&Q[0]==="validIntentKeys"&&ft.validIntentKeys){let vt=Object.keys(ft.validIntentKeys),j=Object.keys(B.validIntentKeys||{});if(vt.length===j.length){for(let L of vt)ft.validIntentKeys[L]!==B.validIntentKeys[L]&&(ht=!0);if(!ht)return}}if(B.selectedPoints){let vt=Array.from(ft.selectedPoints||[]),j=Array.from(B.selectedPoints||[]);if(vt.length===j.length){for(let L of vt)if(!j.includes(L)){ht=!0;break}}else ht=!0;ht||delete B.selectedPoints}if(!(Q.length===1&&Q.includes("hasClosestLine")&&B.hasClosestLine===ft.hasClosestLine)){if(m.nextSlowState){m.nextSlowState={...m.nextSlowState,...B};return}m.nextSlowState={...f.slowState,...B}}}function E(B,Q=!1){m.time+=B,T(),A(),q(),D(),N(),U(),at(),J(),z(),m.renderFunc(f,f.slowState,B),!Q&&(m.animationFrame=I7(E))}function T(){if(m.shouldUpdate&&(e({id:f.slowState.shapeId||void 0,open:f.isOpen,points:f.polygon.points}),m.shouldUpdate=!1),m.nextSlowState&&m.nextSlowState!==f.slowState){let B=Object.keys(f.slowState),Q={},ft={},ht=!1;for(let vt of B){let j=f.slowState[vt],L=m.nextSlowState[vt];j!==L?(ht=!0,Q[vt]=L,ft[vt]=L):Q[vt]=j}ht&&(f.slowState=Q,m.nextSlowState=null,m.setStateFunc(f.slowState),t?.customSetState?.(ft))}}function A(){let B=!f.slowState.noShape&&f.polygon.points.length>2&&f.selectedPoints.length===f.polygon.points.length&&!f.isOpen&&(f.slowState.currentTool==="pointer"||f.slowState.currentTool==="box");f.slowState.showBoundingBox!==B&&S({showBoundingBox:B})}function x(B){f.selectedPoints=B.selectedPoints,S({selectedPoints:B.selectedPoints}),f.polygon.points=B.points,f.polygon.boundingBox=null,f.polygon.iedges=null,f.polygon.isBezier=null,v(f.polygon),S({closestPoint:null}),(B.isOpen===!0||B.isOpen===!1)&&(f.isOpen=B.isOpen,m.shouldUpdate=!0)}function R(){if(m.undoStackPointer===-1)return;m.undoStackPointer--;let B=m.undoStack[m.undoStackPointer];x(B)}function C(){if(m.undoStackPointer===m.undoStack.length-1)return;m.undoStackPointer++;let B=m.undoStack[m.undoStackPointer];x(B)}function M(B){m.undoStackPointer++,m.undoStack[m.undoStackPointer]=B,m.undoStack.length>15&&(m.undoStack.shift(),m.undoStackPointer--)}function z(){S({boxMode:o7(f.polygon.points||[])})}function N(){if(!f.pointer||f.slowState.noShape){S({pointerInsideShape:!1});return}let[B,Q]=f.pointer,ft=f.polygon.points,ht=f.polygon.boundingBox;if(!ht){S({pointerInsideShape:!1});return}if(B<ht.x||B>ht.x+ht.width||Q<ht.y||Q>ht.height+ht.y){S({pointerInsideShape:!1});return}let vt=!1;for(let j=0,L=ft.length-1;j<ft.length;L=j++)ft[j][1]>Q!=ft[L][1]>Q&&B<(ft[L][0]-ft[j][0])*(Q-ft[j][1])/(ft[L][1]-ft[j][1])+ft[j][0]&&(vt=!vt);S({pointerInsideShape:vt})}function D(){if(f.slowState.noShape||!f.pointer||f.slowState.transitioning||!f.polygon.points||f.polygon.points.length===0)return;let[B,Q]=f.pointer,ft=f.polygon.points.map((ht,vt)=>{let j=ht[0]-B,L=ht[1]-Q;return[j*j+L*L,vt]}).sort((ht,vt)=>ht[0]-vt[0]);ft.length&&S({closestPoint:ft[0][1]})}function q(){if(!f.pointer||f.slowState.transitioning)return;if(f.slowState.noShape){f.closestLineIndex=-1,f.closestLinePoint=null,f.closestLineDistance=0;return}let[B,Q,ft,ht]=$I(f.polygon,f.pointer),vt=ee()*ee();Q<vt&&(!f.isOpen||f.slowState.currentTool==="line"||f.polygon.points.length-1!==ht)?(f.closestLinePoint=B,f.closestLineDistance=Math.sqrt(Q),f.closestLineIndex=ht,S({hasClosestLine:!0})):(f.closestLinePoint=null,f.closestLineDistance=0,f.closestLineIndex=-1,S({hasClosestLine:!1}))}function P(B,Q=null){let ft={},ht=Q||(f.pointer?[f.pointer[0],f.pointer[1]]:null);for(let vt of[...Ah,...Eh,...kc])vt.tools.includes(B)&&(ht&&vt.isValid([ht],f,X())?ft[vt.type]=vt.label:ht||(ft[vt.type]=vt.label));return ft}function U(){if(f.slowState.transitioning||f.slowState.noShape||!f.pointer||!Array.isArray(f.pointer)||f.pointer.length<2||typeof f.pointer[0]!="number"||typeof f.pointer[1]!="number")return;let B=f.slowState.currentTool;Mn(B);let Q=!1;for(let vt=0;vt<L7;vt++){let j=Ah[vt];if(j.tools.includes(B)&&j.isValid(g.isPressed?[g.lastPress]:[f.pointer],f,X())){if(m.transitionIntent===j){Q=!0;break}S({transitionIntentType:j.type}),m.transitionIntent=j,Q=!0;break}}Q||m.transitionIntent&&(S({transitionIntentType:null}),m.transitionIntent=null);let ft=!1;for(let vt=0;vt<Eh.length;vt++){let j=Eh[vt];if(j.tools.includes(B)&&ut(j)){if(m.actionIntent===j){ft=!0;break}S({actionIntentType:j.type}),m.actionIntent=j,ft=!0;break}}ft||m.actionIntent&&(m.actionIntent=null,S({actionIntentType:null}));let ht={};for(let vt=0;vt<kc.length;vt++){let j=kc[vt];j.trigger.type==="key"&&ut(j)&&(ht[j.trigger.key]=j.label)}S({validIntentKeys:ht})}function J(){let B=f.pointer;if(f.lineBox=null,!B||lt()||f.polygon.points.length!==2)return;let[Q,ft]=B,[ht,vt]=f.polygon.points[0],[j,L]=f.polygon.points[1],[$,it,Nt,Lt]=$I(f.polygon,B);if(!$)return;let jt=Q-$[0],G=ft-$[1],Z=[ht,vt],mt=[j,L],yt=[mt[0]+jt,mt[1]+G],pt=[Z[0]+jt,Z[1]+G];f.lineBox=[Z,mt,yt,pt]}function at(){let B=f.pointer;if(!B||!lt()||f.slowState.noShape)return;let Q=f.selectedPoints[0],ft=B;if(f.slowState.snapEnabled&&!f.slowState.modifiers.Shift?(bl(B,f,5),ft=Th(B,f)):nD(f),f.line=[f.polygon.points[Q],ft],f.slowState.modifiers.Shift){let ht=0;if(f.polygon.points.length>1){let G=f.selectedPoints[0];G===0?ht=Math.atan2(f.polygon.points[1][1]-f.polygon.points[0][1],f.polygon.points[1][0]-f.polygon.points[0][0]):ht=Math.atan2(f.polygon.points[G-1][1]-f.polygon.points[G][1],f.polygon.points[G-1][0]-f.polygon.points[G][0])}let vt=B[0]-f.polygon.points[Q][0],j=B[1]-f.polygon.points[Q][1],L=Math.atan2(j,vt),$=Math.PI/4,it=Math.round((L-ht)/$)*$+ht,Nt=aa(f.polygon.points[Q],B),Lt=Math.cos(it)*Nt+f.polygon.points[Q][0],jt=Math.sin(it)*Nt+f.polygon.points[Q][1];f.line[1]=[Lt,jt]}}function X(){return f.slowState.modifiers}function tt(B){let Q=B.commit([g.lastPress],f,X());u.emit("polygons.end-transition",{transitionIntent:B.type,response:Q}),Q&&(Q.tool&&$t(Q.tool),Q.selectedPoints&&(f.selectedPoints=Q.selectedPoints,S({selectedPoints:Q.selectedPoints})),Q.points&&(f.polygon.points=Q.points,f.polygon.boundingBox=null,f.polygon.iedges=null,f.polygon.isBezier=null,f.transitionBoundingBox=null,v(f.polygon),S({closestPoint:null,selectedStamp:null})),(Q.isOpen===!0||Q.isOpen===!1)&&(f.isOpen=Q.isOpen,m.shouldUpdate=!0),M({isOpen:f.isOpen,points:f.polygon.points,selectedPoints:f.selectedPoints}),Mn(f.slowState.currentTool)),S({transitionModifiers:null})}function ut(B){if(!B.tools.includes(f.slowState.currentTool))return!1;let Q=[];return f.pointer&&Array.isArray(f.pointer)&&f.pointer.length>=2&&typeof f.pointer[0]=="number"&&typeof f.pointer[1]=="number"&&(Q=[f.pointer]),B.isValid(Q,f,X())}function xt(B){B==="Delete"&&(B="Backspace");let Q=f.slowState.currentTool;for(let ft of kc)if(!(ft.trigger.type!=="key"||ft.trigger.key!==B)&&ft.tools.includes(Q)&&ut(ft))return tt(ft),!0;return!1}function lt(){let B=f.polygon.points,Q=f.pointer;if(!f.isOpen||!B.length||f.selectedPoints.length!==1||!Q)return!1;let ft=f.selectedPoints[0],ht=ft===0,vt=ft===B.length-1;return ht||vt}let dt={reset(){S({modifiers:{Alt:!1,Shift:!1,Meta:!1,proximity:gv}})},getForType(B){let Q={};if(!B)return Q;let ft=Rh[B];return!ft||!ft.modifiers?Q:ft.modifiers},set(B){B!=="Shift"&&B!=="Alt"&&B!=="Meta"||S({modifiers:{...m.nextSlowState?.modifiers||f.slowState.modifiers,[B]:!0}})},unset(B){B!=="Shift"&&B!=="Alt"&&B!=="Meta"||S({modifiers:{...m.nextSlowState?.modifiers||f.slowState.modifiers,[B]:!1}})}},Rt={set(B){let Q=B?B.id==="square"||B.id==="rectangle":!1;S({selectedStamp:B,boxMode:Q})},clear(){Rt.set(null)},square(){Rt.set(fD)},triangle(){Rt.set(w7)},pentagon(){Rt.set(M7)},hexagon(){Rt.set(O7)},circle(){Rt.set(_7)}},K={down(B){let Q=a[B]||B;if(Q==="Shift"||Q==="Alt"||Q==="Meta")return dt.set(Q),!0;if(Q==="Control")return dt.set("Meta"),!0;if(Q==="z"&&f.slowState.modifiers.Meta)return f.slowState.modifiers.Shift?C():R(),!0;if(!f.slowState.modifiers.Meta&&!f.slowState.modifiers.Alt&&!f.slowState.transitioning){if(!o)return;let ft=Q.toUpperCase();if(d[ft]){let ht=d[ft];return $t(ht),!0}}return xt(Q)},up(B){let Q=a[B]||B;if(Q==="Control"){dt.unset("Meta");return}Q!=="Shift"&&Q!=="Alt"&&Q!=="Meta"||dt.unset(Q)}};function Ct(B){f.scale=B,S({modifiers:{...m.nextSlowState?.modifiers||f.slowState.modifiers,proximity:B*gv}})}function ee(){return gv*f.scale}let ce={set:B=>{m.renderFunc=B},start:(B,Q)=>{m.startTime=performance.now(),m.time=0,B&&(m.renderFunc=B),Q&&(Q(f.slowState),m.setStateFunc=Q),E(0)},stop:()=>{m.animationFrame&&(D7(m.animationFrame),m.animationFrame=0)},step:(B=16)=>{E(B)}};function le(B){if(!B||!Array.isArray(B)||B.length===0)return;let Q=B[0];if(!(!Q||!Q[0]&&Q[0]!==0||!Q[1]&&Q[1]!==0)&&!(Number.isNaN(Q[0])||Number.isNaN(Q[1]))){if(f.pointer=Q,f.slowState.transitioning)m.transitionIntent&&(m.transitionIntent.transition(B,f,X()),u.emit("polygons.transition",{transitionIntent:m.transitionIntent.type}));else if(g.isPressed&&!g.noTransition&&g.lastPress&&f.pointer&&(!g.isClicking||aa(g.lastPress,f.pointer)>10))if(clearTimeout(g.pressTimeout),g.isClicking=!1,m.transitionIntent){if(f.transitionOrigin=g.lastPress,S({transitioning:!0}),m.transitionIntent.start){let ft=m.transitionIntent.start([g.lastPress],f,X());ft&&(ft.selectedPoints&&(f.selectedPoints=ft.selectedPoints,S({selectedPoints:ft.selectedPoints})),(ft.isOpen===!0||ft.isOpen===!1)&&(f.isOpen=ft.isOpen,m.shouldUpdate=!0),ft.points&&(f.polygon.points=ft.points,f.polygon.boundingBox=null,f.polygon.iedges=null,v(f.polygon),S({closestPoint:null})))}S({transitionModifiers:m.transitionIntent.modifiers||null}),u.emit("polygons.start-transition",{transitionIntent:m.transitionIntent.type}),m.transitionIntent.transition([g.lastPress],f,X()),u.emit("polygons.transition",{transitionIntent:m.transitionIntent.type})}else g.noTransition=!0}}function pe(){f.pointer=null,f.slowState.transitioning||(g.isPressed=!1,g.isClicking=!1,g.lastPress=null,S({transitionIntentType:null,actionIntentType:null}),m.transitionIntent=null,m.actionIntent=null)}function De(){g.isClicking=!0,g.isPressed=!0,g.lastPress=f.pointer,g.pressTimeout=setTimeout(()=>{g.isPressed&&(g.isClicking=!1)},250)}function ne(){f.slowState.transitioning?(S({transitioning:!1}),m.transitionIntent&&tt(m.transitionIntent),m.transitionIntent=null,S({transitionIntentType:null})):g.isClicking&&(m.actionIntent&&tt(m.actionIntent),m.actionIntent=null,S({actionIntentType:null})),g.isPressed=!1,g.isClicking=!1,g.lastPress=null,g.noTransition=!1,clearTimeout(g.pressTimeout)}function Di(B){f.polygon.points=B?.points||[],f.polygon.boundingBox=null,f.polygon.iedges=null,f.isOpen=B?.open||!1,v(f.polygon),m.nextSlowState=null,m.undoStack=[],m.undoStackPointer=-1,f.lineBox=null,f.line=null,g.pressTimeout&&clearTimeout(g.pressTimeout),S({noShape:B===null,shapeId:B?.id||null,transitioning:!1,actionIntentType:null,transitionIntentType:null,selectedPoints:[],hasClosestLine:!1,modifiers:{Alt:!1,Shift:!1,Meta:!1,proximity:f.slowState.modifiers.proximity},showBoundingBox:!1,currentModifiers:{},validIntentKeys:{},selectedStamp:null,closestPoint:null,pointerInsideShape:!1,boxMode:!1,fixedAspectRatio:n}),$t(i),T()}function ri(B){if(!B)return"";let Q=Rh[B];return!Q||!Q.modifiers?Q.label||"":f.slowState.modifiers.Shift&&Q.modifiers.Shift?Q.modifiers.Shift:f.slowState.modifiers.Alt&&Q.modifiers.Alt?Q.modifiers.Alt:f.slowState.modifiers.Meta&&Q.modifiers.Meta?Q.modifiers.Meta:Q.label}function me(){S({fixedAspectRatio:!0})}function ge(){S({fixedAspectRatio:!1})}function $t(B){if(f.slowState.isToolSwitchingLocked||f.slowState.currentTool===B||!f.slowState.enabledTools.includes(B))return;let Q=f.slowState.lastCreationTool;if(eD(B)){if(f.slowState.isToolSwitchingLocked)return;Q=B}f.slowState.transitioning&&(f.transitionPoints=null,f.transitionBoundingBox=null,f.transitionDraw=[],f.line=null,f.lineBox=null,S({transitioning:!1}));let ft=P(B),ht=f.selectedPoints,vt=f.isOpen,j=f.slowState.selectedStamp;switch(B){case"pointer":f.polygon.points.length>0&&!vt&&ht.length===0&&(ht=f.polygon.points.map((L,$)=>$));break;case"pen":f.polygon.points.length===0?(ht=[],vt=!0):vt&&ht.length>1&&(ht=[ht[ht.length-1]]);break;case"line":f.polygon.points.length===0?(ht=[],vt=!0):vt?ht.length>1&&(ht=[ht[ht.length-1]]):(ht=[f.polygon.points.length-1],vt=!0);break;case"pencil":ht=[],f.polygon.points.length===0&&(vt=!0);break;case"box":ht=f.polygon.points.map((L,$)=>$),vt=!1,Rt.square();break;case"lineBox":ht=[],f.polygon.points.length===0&&(vt=!0);break;case"stamp":ht=[],vt=!1,j||Rt.square();break;case"hand":ht=[];break;default:ht=[];break}S({validIntentKeys:ft}),S({currentTool:B,selectedPoints:ht,lastCreationTool:Q,boxMode:B==="box"}),f.selectedPoints=ht,f.isOpen=vt,Mn(B),U()}function Mn(B){let Q=B==="box"||B==="pointer"&&f.polygon.points.length>2&&f.selectedPoints.length===f.polygon.points.length&&!f.isOpen;S({showBoundingBox:Q})}function St(B){f.slowState.currentTool===B&&$t("pointer")}function It(B){f.slowState.currentTool===B?$t("pointer"):$t(B)}let te={undo:R,redo:C,get canUndo(){return m.undoStackPointer>-1},get canRedo(){return m.undoStackPointer<m.undoStack.length-1}},Hn={setTool:$t,unsetTool:St,toggleTool:It,updateVisibility:Mn,setCanDelete(B){S({canDelete:B})},setCanDeselect(B){tn(),S({canDeselect:B})},lockToolSwitching(){S({isToolSwitchingLocked:!0})},unlockToolSwitching(){S({isToolSwitchingLocked:!1})},toggleToolSwitching(){S({isToolSwitchingLocked:!f.slowState.isToolSwitchingLocked})},shortcuts:Object.fromEntries(Object.entries(d).map(([B,Q])=>[Q,B])),getValidIntents(B){let Q=B||f.slowState.currentTool;return{actions:Eh.filter(ft=>ft.tools.includes(Q)),transitions:Ah.filter(ft=>ft.tools.includes(Q)),keys:kc.filter(ft=>ft.tools.includes(Q)),all:P(Q),current:f.slowState.validIntentKeys}},getToolInfo(){return{name:f.slowState.currentTool,cursor:f.slowState.cursor,selectionCount:f.selectedPoints.length,pointCount:f.polygon.points.length,isOpen:f.isOpen}},smartSelect(){f.polygon.points.length!==0&&(f.isOpen?(f.selectedPoints=[f.polygon.points.length-1],S({selectedPoints:f.selectedPoints})):(f.selectedPoints=f.polygon.points.map((B,Q)=>Q),S({selectedPoints:f.selectedPoints})))},clearSelection(){f.selectedPoints=[],S({selectedPoints:[]})},autoSelect(){f.selectedPoints.length===f.polygon.points.length&&!f.isOpen?$t("pointer"):f.isOpen||f.selectedPoints.length>0?$t(f.slowState.lastCreationTool||"pen"):$t("pointer")}},Zn={enabled:()=>f.slowState.snapEnabled,enable:()=>S({snapEnabled:!0}),disable:()=>S({snapEnabled:!1}),toggle:()=>S({snapEnabled:!f.slowState.snapEnabled}),pointsEnabled:()=>f.slowState.snapToPoints,enablePoints:()=>S({snapToPoints:!0}),disablePoints:()=>S({snapToPoints:!1}),togglePoints:()=>S({snapToPoints:!f.slowState.snapToPoints}),linesEnabled:()=>f.slowState.snapToLines,enableLines:()=>S({snapToLines:!0}),disableLines:()=>S({snapToLines:!1}),toggleLines:()=>S({snapToLines:!f.slowState.snapToLines}),intersectionsEnabled:()=>f.slowState.snapToIntersections,enableIntersections:()=>S({snapToIntersections:!0}),disableIntersections:()=>S({snapToIntersections:!1}),toggleIntersections:()=>S({snapToIntersections:!f.slowState.snapToIntersections}),gridEnabled:()=>f.slowState.snapToGrid,enableGrid:()=>S({snapToGrid:!0}),disableGrid:()=>S({snapToGrid:!1}),toggleGrid:()=>S({snapToGrid:!f.slowState.snapToGrid}),parallelEnabled:()=>f.slowState.snapToParallel,enableParallel:()=>S({snapToParallel:!0}),disableParallel:()=>S({snapToParallel:!1}),toggleParallel:()=>S({snapToParallel:!f.slowState.snapToParallel}),getThreshold:()=>f.snapThreshold*f.slowState.modifiers.proximity,setThreshold:B=>{f.snapThreshold=Math.max(5,Math.min(50,B))},isActive:()=>f.isSnapping,getSnapPoint:()=>f.snapPoint,getActiveGuides:()=>f.activeSnapGuides,getTargets:()=>f.snapTargets};function tn(){S({selectedPoints:f.polygon.points.map((B,Q)=>Q)})}function bn(B){S({bounds:B})}return $t(i),{state:f,setState:S,emitter:u,modifiers:dt,stamps:Rt,history:te,key:K,setScale:Ct,clock:ce,pointer:le,blur:pe,pointerDown:De,pointerUp:ne,setShape:Di,label:ri,tools:Hn,snap:Zn,selectAllPoints:tn,setBounds:bn,lockAspectRatio:me,unlockAspectRatio:ge}}function Yc(t){let e=Math.max(...t.map(o=>o[0])),n=Math.min(...t.map(o=>o[0])),i=Math.max(...t.map(o=>o[1])),a=Math.min(...t.map(o=>o[1]));for(let o of t)if(o[0]!==n&&o[0]!==e&&o[1]!==a&&o[1]!==i||o[0]<n||o[0]>e||o[1]<a||o[1]>i)return!1;return!0}function xl(t){if(!t)return null;if(t.points.length>2){let e=Math.min(...t.points.map(o=>o[0])),n=Math.min(...t.points.map(o=>o[1])),i=Math.max(0,...t.points.map(o=>o[0])),a=Math.max(0,...t.points.map(o=>o[1]));return{x:e,y:n,width:i-e,height:a-n}}return null}function pD(t){return t.type==="SvgSelector"}function B7(t){return t.type==="BoxSelector"}function vv(t,e){if(pD(t)){let s=t.svgShape==="polyline";if(!t.points||t.points.length===0)return null;if(e){let{width:u,height:d}=e;return{type:"SvgSelector",value:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${u} ${d}" width="${u}" height="${d}"><${s?"polygon":"polyline"} points="${t.points.map(f=>f.join(",")).join(" ")}" /></svg>`}}return{type:"SvgSelector",value:`<svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'><g><path d='M${t.points.map(u=>u.join(",")).join(" ")}${s?" Z":""}' /></g></svg>`}}if(!t.spatial)return null;let{x:n,y:i,width:a,height:o}=t.spatial||{};return!a||!o?null:{type:"FragmentSelector",value:`xywh=${~~n},${~~i},${~~a},${~~o}`}}function Qc(t,e){if(!t||!t.points.length)return null;if(Yc(t.points)){let n=t.points.map(d=>d[0]),i=t.points.map(d=>d[1]),a=Math.min(...n),o=Math.min(...i),s=Math.max(...n)-a,u=Math.max(...i)-o;return vv({type:"BoxSelector",spatial:{x:a,y:o,width:s,height:u}},e)}return vv({type:"SvgSelector",points:t.points,svgShape:t.open?"polygon":"polyline"},e)}function Ch(t){if(t.type==="polygon"&&!t.noBox&&t.points&&Yc(t.points)){let n=xl({open:!1,points:t.points||[]});return Ch({...t,type:"box",selector:n})}if(t.type==="polygon"||t.type==="draw")return{polygon:{points:t.points||[],open:t.open||!1},requestType:t.type,boundingBox:xl({points:t.points||[],open:!1}),metadata:{},arguments:t.arguments||{},target:Qc({points:t.points||[],open:!1},t.bounds)};let e=t.selector;if(e){let n=[[e.x,e.y],[e.x+e.width,e.y],[e.x+e.width,e.y+e.height],[e.x,e.y+e.height]];return{polygon:{points:n,open:!1},requestType:t.type,boundingBox:e,metadata:{},target:Qc({points:n,open:!1},t.bounds),arguments:t.arguments||{}}}return{polygon:{points:[],open:!1},requestType:t.type,boundingBox:null,target:null,metadata:{},arguments:t.arguments||{}}}var P7={shapeId:null,noShape:!0,transitioning:!1,actionIntentType:null,transitionIntentType:null,selectedPoints:[],hasClosestLine:!1,lastCreationTool:null,modifiers:{Alt:!1,Shift:!1,Meta:!1,proximity:0},bounds:null,showBoundingBox:!1,currentModifiers:{},validIntentKeys:{},pointerInsideShape:!1,closestPoint:null,transitionModifiers:null,selectedStamp:null,bezierLines:[],boxMode:!1,fixedAspectRatio:!1,cursor:"",enabledTools:["pointer","pen","box","lineBox","stamp","hand","line","pencil"],canDelete:!0,canDeselect:!0,isToolSwitchingLocked:!1,currentTool:"box",snapEnabled:!1,snapToPoints:!1,snapToLines:!1,snapToIntersections:!1,snapToGrid:!1,snapToParallel:!1};function zA({events:t,enabledTools:e,keyboardShortcutMapping:n,keyboardShortcutsEnabled:i=!1,debug:a}){let o=Yi((u,d)=>{let p=null,m=hD({emitter:t,keyboardShortcutsEnabled:i,keyboardShortcutMapping:n,enabledTools:e,customSetState:g=>{a&&console.log("partial state",g),u(v=>({polygonState:{...v.polygonState,...g}}))}},g=>{u(v=>v.tool.requestId?{polygon:{...g,id:v.tool.requestId}}:{polygon:{id:void 0,points:[],open:!0}}),t.emit("atlas.polygon-update",g)});return{mode:"explore",tool:{enabled:!1,requestId:null,canvasId:null},runtime:null,requestType:null,requests:{},history:m.history,polygon:null,validRequestIds:[],metadata:{},stableViewport:null,canvasRelativePositions:{},canvasViewports:{},polygons:m,polygonState:P7,setMetadata:(g,v)=>{let S=v||d().tool.requestId;S&&u(E=>({metadata:{...E.metadata,[S]:{...E.metadata[S]||{},...g}}}))},setToolCanvasId:g=>{u(v=>({tool:{...v.tool,canvasId:g}}))},switchTool:{pointer(){u({mode:"sketch"}),s.tools.setTool("pointer")},hand(){u({mode:"explore"}),s.tools.setTool("hand")},draw(){u({mode:"sketch"}),s.tools.setTool("pencil")},pen(){u({mode:"sketch"}),s.tools.setTool("pen")},line(){u({mode:"sketch"}),s.tools.setTool("line")},lineBox(){u({mode:"sketch"}),s.tools.setTool("lineBox")},box(){u({mode:"sketch"}),s.tools.setTool("box")},triangle(){u({mode:"sketch"}),s.tools.setTool("stamp"),s.stamps.triangle()},hexagon(){u({mode:"sketch"}),s.tools.setTool("stamp"),s.stamps.hexagon()},circle(){u({mode:"sketch"}),s.tools.setTool("stamp"),s.stamps.circle()},remove(){let g=d();g.tool.requestId&&(m.setShape({points:[],open:!0}),g.cancelRequest(g.tool.requestId))}},reset:()=>{let g=d();g.tool.requestId&&g.cancelRequest(g.tool.requestId)},setPolygonState:g=>u({polygonState:typeof g=="function"?g(d().polygonState):g}),getRequestId:()=>{let g=Math.random().toString(36).slice(2);return u(v=>({validRequestIds:[...v.validRequestIds,g]})),{requestId:g,clear:()=>{d().tool.requestId,u(v=>({tool:v.tool.requestId===g?{enabled:!1,requestId:null,canvasId:null}:v.tool,validRequestIds:v.validRequestIds.filter(S=>S!==g)}))}}},cancelRequest:g=>{let v=g||d().tool.requestId;v&&(u(S=>({mode:"explore",tool:S.tool.requestId===v?{enabled:!1,requestId:null,canvasId:null}:S.tool,validRequestIds:S.validRequestIds.filter(E=>E!==v)})),t.emit("atlas.request-cancelled",{id:v}))},requestAnnotation:async(g,v)=>{let E={...d().requests,[v.requestId]:g},T=Ch(g);a&&console.log("requestAnnotation",{response:T,request:g});try{let{points:A=[],open:x=!0}=T.polygon||{},{requestId:R,canvasId:C=null,toolId:M}=v,z=M,N=d(),D=N.validRequestIds.includes(R),q=T.requestType;return a&&console.log("setting points",{requestType:q,points:A,open:x}),!D||N.tool.enabled?null:(m.setShape({id:R,points:A,open:x}),q==="polygon"&&(z=z||"pen",m.tools.setTool("pen")),q==="draw"&&(z=z||"draw",m.tools.setTool("pencil")),q==="box"&&(z=z||"box",m.tools.setTool("box")),q==="target"?(z=z||"box",m.tools.setTool("box"),m.lockAspectRatio(),m.tools.lockToolSwitching(),m.tools.setCanDeselect(!1),m.tools.setCanDelete(!1)):(m.tools.unlockToolSwitching(),m.tools.setCanDeselect(!0),m.tools.setCanDelete(!0)),g.bounds&&m.setBounds(g.bounds),t.emit("atlas.annotation-request",{id:R}),u({polygon:{id:R,points:A,open:x},mode:"sketch",requestType:q,tool:{enabled:!0,requestId:R,canvasId:C},requests:E}),z?N.switchTool[z]?.():A.length===0&&N.switchTool.box(),(typeof g.selectByDefault>"u"&&A.length&&q==="box"||g.selectByDefault)&&N.switchTool.pointer(),new Promise(P=>{let U=at=>{at.id===R&&(u(X=>({mode:"explore",tool:{requestId:null,enabled:!1,canvasId:null},requests:Object.fromEntries(Object.entries(X.requests).filter(([tt])=>tt!==R))})),t.off("atlas.request-cancelled",U),t.off("atlas.annotation-completed",J),P(null))},J=at=>{at.id===R&&(u(X=>({mode:"explore",tool:{requestId:null,enabled:!1,canvasId:null},requests:Object.fromEntries(Object.entries(X.requests).filter(([tt])=>tt!==R))})),t.off("atlas.annotation-completed",J),t.off("atlas.request-cancelled",U),P(at))};t.on("atlas.request-cancelled",U),t.on("atlas.annotation-completed",J)}))}catch(A){return console.error(A),null}},completeRequest:g=>{let v=d().tool.requestId;if(typeof g=="string"&&g&&g!==v)return;let S=v?d().requests[v]?.arguments||{}:{},E=v?d().metadata[v]||{}:{},T=d().polygonState.bounds,A=d().polygon;A&&(t.emit("atlas.annotation-completed",{id:A.id,polygon:A,requestType:d().requestType,target:Qc(A,T),canvasId:d().tool.canvasId,boundingBox:xl(A),metadata:E,arguments:{...S}}),m.setShape(null))},setAtlasRuntime:g=>{p=g,t.emit("atlas.ready",{runtime:g}),s.setScale(1/p._lastGoodScale),p.world.addLayoutSubscriber((v,S)=>{(v==="event-activation"||v==="zoom-to"||v==="go-home")&&p?._lastGoodScale&&!Number.isNaN(p._lastGoodScale)&&s.setScale(1/p._lastGoodScale)}),u({runtime:p})},clearAtlasRuntime:()=>{p=null,u({stableViewport:null,runtime:null})},setCanvasRelativePosition:(g,v)=>{u(S=>({canvasRelativePositions:{...S.canvasRelativePositions,[g]:v}}))},clearCanvasRelativePosition:g=>{u(v=>{let S={...v.canvasRelativePositions};return delete S[g],{canvasRelativePositions:S}})},changeMode:g=>{u({mode:g})},nudgeLeft:g=>{if(!p)return;let v=p.getViewport(),S=g??v.width*.1;p.world.gotoRegion({x:v.x-S,y:v.y,width:v.width,height:v.height,nudge:!0})},nudgeRight:g=>{if(!p)return;let v=p.getViewport(),S=g??v.width*.1;p.world.gotoRegion({x:v.x+S,y:v.y,width:v.width,height:v.height,nudge:!0})},nudgeUp:g=>{if(!p)return;let v=p.getViewport(),S=g??v.height*.1;p.world.gotoRegion({x:v.x,y:v.y-S,width:v.width,height:v.height,nudge:!0})},nudgeDown:g=>{if(!p)return;let v=p.getViewport(),S=g??v.height*.1;p.world.gotoRegion({x:v.x,y:v.y+S,width:v.width,height:v.height,nudge:!0})},zoomIn:()=>{p?.world?.zoomIn()},zoomOut:()=>{p?.world?.zoomOut()},goHome:()=>{p?.world?.goHome()},goToRegion:g=>{p?.world?.gotoRegion(g)},getRuntime:()=>p}}),s=o.getState().polygons;return t.on("atlas.annotation-request",()=>{s.clock.start((u,d,p)=>{t.emit("atlas.polygon-render",{state:u,slowState:d,dt:p})},u=>{typeof u=="object"?o.setState({polygonState:u}):o.setState(d=>({polygonState:u(d.polygonState)}))})}),t.on("atlas.annotation-completed",()=>{s.clock.stop()}),t.on("atlas.request-cancelled",()=>{s.clock.stop()}),o}var IA=_(Y(),1),Hs=(0,ar.createContext)(null);function Ie(){return(0,ar.useContext)(Hs)}var NA={};function DA(t="atlas"){return NA[t]?.getState()}function Xc({children:t,name:e="atlas",existing:n,atlasStoreConfig:i}){let a=OA(),o=(0,ar.useContext)(Hs),s=(0,ar.useMemo)(()=>n||o||zA({events:a,...i||{}}),[a,n,o]),u=bt(s,d=>d.mode);return(0,ar.useEffect)(()=>{let d=e;return d&&(NA[d]=s),()=>{d&&delete NA[d]}},[s,e]),(0,IA.jsx)(Hs.Provider,{value:s,children:(0,IA.jsx)(Gc.Provider,{value:u||"explore",children:t})})}var xD=_(nt(),1);var Kc=_(nt(),1),mD=_(Y(),1);function LA(){return{default:{backgroundColor:"rgba(0,0,0,0)",borderWidth:"2px",borderColor:"rgba(252,0,98, .5)"},highlighted:{backgroundColor:"rgba(75, 103, 225, 0.4)",borderWidth:"1px",borderColor:"rgba(75,103,225,0.99)"},hidden:{borderWidth:"0px",borderColor:"rgba(0,0,0,0)",backgroundColor:"rgba(0,0,0,0)",hidden:!0}}}var BA=(0,Kc.createContext)(LA());BA.displayName="AnnotationStyle";function wh(){return(0,Kc.useContext)(BA)}function H7({theme:t,children:e}){let n=(0,Kc.useMemo)(()=>t||LA(),[t]);return(0,mD.jsx)(BA.Provider,{value:n,children:e})}var yD=_(nt(),1);var Zc=_(nt(),1);var gD=Wm()((t,e)=>{let n=new Map,i=()=>Math.random().toString(36).substring(2,15),a=o=>{let s=n.get(o);if(s)return s;let u=i();return n.set(o,u),u};return{stylesheets:{},loading:[],errors:[],async parseStylesheet(o){let{loadStylesheet:s,setStylesheet:u}=e();if(!o)return null;if(typeof o=="string")return o.startsWith("http")?{id:o,type:"CssStylesheet",value:await s(o)}:{id:u(o),type:"CssStylesheet",value:o};if(o.type==="CssStylesheet"){let d=o.id;if("value"in o){let p=Array.isArray(o.value)?o.value.join(`
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
`):i.value;a&&(n[i.id||`inline-${Object.keys(n).length}`]=a)}return Object.keys(n).length?n:void 0}function Wc(t=Po){function e(a){let o=a?typeof a=="string"?t.get(a):a:null;if(!o)return[];let s=t.get(o.items,{parent:o}),u=[];for(let d of s)u.push(...t.get(d.items,{parent:d}));return u}function n(a,o=[]){let s=Array.isArray(a)?a:e(a),u=[],d={items:[],type:"complex-choice"},p=[];for(let f of s){if(f.type!=="Annotation")throw Error("getPaintables() accept either a canvas or list of annotations");let m=Array.from(Array.isArray(f.body)?f.body:[f.body]);for(let g of m){let[v,{selector:S,styleClass:E}]=kA(g),T=t.get(v),A=(T.type||"unknown").toLowerCase();if(A==="choice"){let M=t.get(T.items,{parent:T.id}),z=o.length?o.map(N=>M.find(D=>D.id===N)).filter(Boolean):[M[0]];z.length===0&&z.push(M[0]),d.items.push({type:"single-choice",items:M.map(N=>({id:N.id,label:N.label,selected:z.indexOf(N)!==-1})),label:v.label}),m.push(...z);continue}u.indexOf(A)===-1&&u.push(A);let x=E?F7(f.stylesheet):void 0,R=E?Dr(E,x):void 0,C=R?Ir(R):{};p.push({type:A,annotationId:f.id,annotation:f,resource:T,target:f.target,selector:S,...E?{styleClass:E}:{},...R&&Object.keys(R).length?{style:R}:{},...C})}}return{types:u,items:p,choice:d.items.length<2?d.items[0]||null:d,allChoices:d.items.length?d:null}}function i(a){let{choice:o}=n(a);return o}return{getAllPaintingAnnotations:e,getPaintables:n,extractChoices:i}}function Nh(){let t=on(),e=zt();return(0,_D.useMemo)(()=>{if(!t||!e||!t.start)return null;let n=an(t.start);return!n||n.source.id!==e.id||!n||!n.selector||n.selector.type!=="TemporalSelector"?null:n.selector.temporal},[t,e])}var $e=_(nt(),1);function zD(t){return{isMuted:!1,playRequested:!1,isPlaying:!1,isFinished:!1,volume:100,duration:t}}function G7(t,e){switch(e.type){case"RESET":return e.state;case"FINISHED":return{...t,isFinished:!0,isPlaying:!1,playRequested:!1};case"PLAY_PAUSE":return{...t,isFinished:!1,isPlaying:!t.isPlaying};case"PLAY_REQUESTED":return{...t,isFinished:!1,playRequested:!0};case"PAUSE":return{...t,isPlaying:!1};case"PLAY":return{...t,isFinished:!1,playRequested:!1,isPlaying:!0};case"MUTE":return{...t,isMuted:!0};case"SET_VOLUME":return{...t,volume:e.volume,isMuted:e.volume===0};case"TOGGLE_MUTE":return{...t,isMuted:!t.isMuted};case"UNMUTE":return{...t,isMuted:!1}}return t}function xv(t){let e=Math.round(t);return`${Math.floor(e/60)}:${`${e%60}`.padStart(2,"0")}`}function js(t){let[e,n]=(0,$e.useReducer)(G7,zD(t.duration));(0,$e.useEffect)(()=>{n({type:"RESET",state:zD(t.duration)})},[t.duration]);let i=(0,$e.useRef)(null),a=(0,$e.useRef)(null),o=(0,$e.useRef)(null),s=(0,$e.useRef)(!1),u=(0,$e.useCallback)(()=>{a.current&&i.current&&(a.current.innerHTML=xv(i.current.currentTime),o.current&&(o.current.style.width=`${i.current.currentTime/t.duration*100}%`),s.current!==i.current.muted&&(s.current=i.current.muted,n(i.current.muted?{type:"MUTE"}:{type:"UNMUTE"})))},[t.duration]),d=(0,$e.useCallback)(()=>{i.current&&(n({type:"PLAY_REQUESTED"}),i.current.play().then(()=>{n({type:"PLAY"})}),u())},[u]),p=(0,$e.useCallback)(()=>{i.current&&(i.current.duration>0&&i.current.paused?d():f())},[u]),f=(0,$e.useCallback)(()=>{i.current&&(i.current.pause(),n({type:"PAUSE"}),u())},[u]),m=(0,$e.useCallback)(()=>{i.current&&(i.current.muted=!i.current.muted,n(i.current.muted?{type:"MUTE"}:{type:"UNMUTE"}))},[]),g=(0,$e.useCallback)(()=>{i.current&&(i.current.muted=!0,n({type:"MUTE"}))},[]),v=(0,$e.useCallback)(()=>{i.current&&(i.current.muted=!1,n({type:"UNMUTE"}))},[]),S=(0,$e.useCallback)(A=>{i.current&&(i.current.muted=!1,i.current.volume=A/100,n({type:"SET_VOLUME",volume:A}))},[]),E=(0,$e.useCallback)(A=>{i.current&&(i.current.currentTime=Math.max(0,Math.min(A*t.duration,t.duration)),u())},[]),T=(0,$e.useCallback)(A=>{if(i.current){let x=typeof A=="function"?A(i.current.currentTime):A;i.current.currentTime=Math.max(0,Math.min(x,t.duration)),u()}},[]);return(0,$e.useEffect)(()=>{let A=setInterval(()=>{u()},350);return()=>clearInterval(A)},[u,t.duration]),(0,$e.useEffect)(()=>{let A=()=>{n({type:"FINISHED"})},x=i.current;return x?.addEventListener("ended",A),()=>x?.removeEventListener("ended",A)},[]),[{element:i,currentTime:a,progress:o},e,{play:d,pause:f,playPause:p,mute:g,unmute:v,toggleMute:m,setVolume:S,setDurationPercent:E,setTime:T}]}var qs=_(nt(),1),YA=(0,qs.createContext)(()=>{}),QA=(0,qs.createContext)(()=>{});function Xn(t,e,n,i,a=[]){let o=(0,qs.useContext)(t==="portal"?QA:YA);(0,qs.useEffect)(()=>(t!=="none"&&o(e,n,i),()=>{o(e,null)}),[e,t,o,...a])}var Av=_(Y(),1);function XA({media:t,startTime:e,children:n}){let[{element:i,currentTime:a,progress:o},s,u]=js({duration:t.duration}),d=e?`${t.url}#t=${e}`:t.url;return(0,Av.jsxs)(zh,{state:s,actions:u,currentTime:a,progress:o,element:i,children:[(0,Av.jsx)("audio",{ref:i,src:d}),n]},t.url)}function Ev({media:t,mediaControlsDeps:e,audioCopmonent:n=XA,children:i}){let a=Nh();return Xn("portal","audio",n,{media:t,startTime:a?a.startTime:null,children:i},[t,a,...e||[]]),null}var Rv=_(nt(),1),Tl=(0,Rv.createContext)(null);Tl.displayName="Strategy";function Fe(){let t=(0,Rv.useContext)(Tl);if(!t)throw new Error("useStrategy must be used within a StrategyProvider");return t}var Cl=_(Y(),1);function KA({model:t}){return(0,Cl.jsxs)(Cl.Fragment,{children:[(0,Cl.jsx)("style",{children:`
|
|
89
|
+
width: var(--atlas-container-width, ${y3(d??"100%")});
|
|
90
|
+
height: var(--atlas-container-height, ${y3(h||(e?y.height:512))})
|
|
91
|
+
}`,[e,g,y.height,h,d]);return(0,K.jsxs)(kh,{ref:r,className:b,...n,children:[y.width?(0,K.jsx)(Vj,{width:y.width||100,height:y.height||100,...m,children:a.children}):null,a.hideInlineStyle?null:(0,K.jsx)("style",{children:w}),i]})});var oD=(t,e=[])=>{let n=Jh();(0,k.useEffect)(()=>n?n.registerHook("useFrame",t):()=>{},e)},kv=()=>{let t=jv();return t&&t.canvas?t.canvas:void 0};function jj(){return(0,k.useContext)(Uv)}var ea=k.default.forwardRef(({children:t,...e},n)=>{let i=(0,k.useRef)(),a=Jh(),r=(0,k.useRef)(0),l=(0,k.useRef)(),u=(0,k.useRef)();return oD(()=>{if(e.relative){let f=i.current;if(f&&a){let h=a.getScaleFactor();r.current!==h&&(r.current=h,f.style.transformOrigin="0 0",f.style.transform=`scale(${1/r.current})`,f.style.width=`${r.current*100}%`,f.style.height=`${r.current*100}%`,i.current&&l.current?.__owner.value?.rotation&&(f.style.transform=`scale(${1/r.current}) translate(50%, 50%) rotate(${l.current?.__owner.value?.rotation||0}deg) translate(-50%, -50%)`))}}},[e.relative]),(0,k.useLayoutEffect)(()=>{let f=l.current;n&&f&&(typeof n=="function"?n(f):n.current=f);async function h(){if(f&&f.__host){let d=e.relative?(0,K.jsx)("div",{ref:i,children:t}):t;await nD(f.__host.element,d,u)}}f&&f.__host?h():f&&(f.__onCreate=h)},[n,t,l,e.relative]),(0,k.useLayoutEffect)(()=>()=>{u.current&&setTimeout(()=>{u.current.unmount()},0)},[]),(0,K.jsx)("box",{html:!0,...e,ref:l})});ea.displayName="HTMLPortal";var kj=(0,k.createContext)(null);kj.displayName="MapProjection";var v3=(t,e,n=[])=>{let i=Jh();(0,k.useEffect)(()=>{if(i){let a=e,r=xd[t];i.world.activatedEvents.push(r);let l=r.slice(2).toLowerCase();return i.world.addEventListener(l,a),()=>{i.world.removeEventListener(l,a)}}return()=>{}},[i?i.world:void 0,t,...n])};function b3(t,e){if(t===0)return[0,1];if(e===0)return[1,0];let n=Math.abs(t)/Math.abs(e);return[n,1-n]}function Gj(){let t=(0,k.useRef)({ctrl:!1,shift:!1,alt:!1});return(0,k.useLayoutEffect)(()=>{function e(i){i.key==="Shift"&&(t.current.shift=!0),i.key==="Control"&&(t.current.ctrl=!0),i.key==="Alt"&&(t.current.alt=!0)}function n(i){i.key==="Shift"&&(t.current.shift=!1),i.key==="Control"&&(t.current.ctrl=!1),i.key==="Alt"&&(t.current.alt=!1)}return window.addEventListener("keydown",e),window.addEventListener("keyup",n),()=>{window.removeEventListener("keydown",e),window.removeEventListener("keyup",n)}},[]),t}var sD=(t,e)=>{let n=oj(),i=Jh(),a=jj(),r=(0,k.useRef)(),l=(0,k.useRef)(null),u=(0,k.useRef)(),[f,h]=(0,k.useState)(!1),d=(0,k.useRef)(!1),m=(0,k.useRef)({north:0,south:0,east:0,west:0}),y=Gj(),g=(0,k.useCallback)(S=>R=>{if(d.current=!0,h(!0),a&&i){let{top:A,left:M}=a,z=i.viewerToWorld(R.pageX-M,R.pageY-A);u.current={x:z.x,y:z.y},r.current=S}},[a,i]),b=(0,k.useMemo)(()=>t.width/t.height,[t.width,t.height]),w=(0,k.useCallback)(S=>{if(!Math.abs(S.north-S.south+(S.east-S.west)))return;let R=-S.west+S.east,A=-S.north+S.south,M=t.width+R,z=t.height+A;if(M/z>=b){let I=M-z*b,[L,H]=b3(S.east,S.west);S.west+=I*H,S.east-=I*L}else{let I=z-M/b,[L,H]=b3(S.north,S.south);S.north+=I*L,S.south-=I*H}},[t.width,t.height,b]);oD(()=>{u&&i&&i.updateNextFrame()}),(0,k.useEffect)(()=>{i&&i.updateNextFrame()},[i,f]);let E=(0,k.useCallback)(S=>{if(!i||!a||i.mode!=="sketch")return;let{top:R,left:A}=a,M=i.viewerToWorld(S.pageX-A,S.pageY-R),z=l.current,I=!t.maintainAspectRatio&&y.current.alt,L=!I&&y.current.shift&&r.current?.indexOf("-")!==-1;if((r.current==="translate"||r.current==="east"||r.current==="north-east"||r.current==="south-east")&&(m.current.east=M.x-(u.current?u.current.x:0),I&&(m.current.west=-m.current.east)),(r.current==="translate"||r.current==="west"||r.current==="north-west"||r.current==="south-west")&&(m.current.west=M.x-(u.current?u.current.x:0),I&&(m.current.east=-m.current.west)),(r.current==="translate"||r.current==="north"||r.current==="north-east"||r.current==="north-west")&&(m.current.north=M.y-(u.current?u.current.y:0),I&&(m.current.south=-m.current.north)),(r.current==="translate"||r.current==="south"||r.current==="south-west"||r.current==="south-east")&&(m.current.south=M.y-(u.current?u.current.y:0),I&&(m.current.north=-m.current.south)),(t.maintainAspectRatio||L)&&w(m.current),z){let H=m.current.west,V=m.current.north,nt=t.width+m.current.east,X=t.height+m.current.south;z.points[1]=Math.min(H,nt),z.points[2]=Math.min(V,X),z.points[3]=Math.max(H,nt),z.points[4]=Math.max(V,X),i.updateNextFrame()}},[i,t.width,t.height,t.maintainAspectRatio,a]);v3("mousemove",E,[t.width,t.height,a]),v3("pointermove",E,[t.width,t.height,a]);let T=(0,k.useRef)();return(0,k.useEffect)(()=>{T.current=()=>{if(d.current){let S=m.current.west,R=m.current.north,A=t.width+m.current.east,M=t.height+m.current.south,z=Math.min(S,A),I=Math.min(R,M),L=Math.max(S,A),H=Math.max(R,M),V={x:(t.x||0)+z,y:(t.y||0)+I,width:L-z||1,height:H-I||1};t.maintainAspectRatio,e(V),r.current=void 0,u.current=void 0,m.current.east=0,m.current.west=0,m.current.north=0,m.current.south=0,d.current=!1,h(!1)}}},[e,t.height,t.width,t.x,t.y]),(0,k.useEffect)(()=>{let S=()=>{T.current&&T.current()};return window.addEventListener("pointerup",S),window.addEventListener("touchend",S),()=>{window.removeEventListener("pointerup",S),window.removeEventListener("touchend",S)}},[]),{portalRef:l,mode:n,mouseEvent:g,onPointerMoveCallback:E,isEditing:f}};function tp(t,e){return t?e?{...t,...e||{},":hover":t[":hover"]?Object.assign(t[":hover"]||{},e[":hover"]||{}):e[":hover"],":active":t[":active"]?Object.assign(t[":active"]||{},e[":active"]||{}):e[":hover"]}:t:e}var Bo=N(ct(),1);function vr(t){return{all:t=t||new Map,on:function(e,n){var i=t.get(e);i?i.push(n):t.set(e,[n])},off:function(e,n){var i=t.get(e);i&&(n?i.splice(i.indexOf(n)>>>0,1):t.set(e,[]))},emit:function(e,n){var i=t.get(e);i&&i.slice().map(function(a){a(n)}),(i=t.get("*"))&&i.slice().map(function(a){a(e,n)})}}}var hu=N(ct(),1),lD=N(tt(),1),Yj=vr(),Gv=(0,hu.createContext)(Yj);function Xj({children:t,emitter:e}){return(0,lD.jsx)(Gv.Provider,{value:e,children:t})}function uR(){return(0,hu.useContext)(Gv)}function pu(t,e,n=[]){let i=(0,hu.useContext)(Gv);(0,hu.useEffect)(()=>{let a=r=>{e(r)};return i.on(t,a),()=>{i.off(t,a)}},[i,t,...n])}function Qj(t){return{all:t=t||new Map,on:function(e,n){var i=t.get(e);i?i.push(n):t.set(e,[n])},off:function(e,n){var i=t.get(e);i&&(n?i.splice(i.indexOf(n)>>>0,1):t.set(e,[]))},emit:function(e,n){var i=t.get(e);i&&i.slice().map(function(a){a(n)}),(i=t.get("*"))&&i.slice().map(function(a){a(e,n)})}}}function Kj(t,e,n){let[i,a]=t,[r,l]=e,[u,f]=n,h=u-r,d=f-l,m=Math.sqrt(h*h+d*d);if(m===0)return{distance:Math.sqrt((i-r)**2+(a-l)**2),closestPoint:[r,l]};let y=Math.max(0,Math.min(1,((i-r)*h+(a-l)*d)/(m*m))),g=r+y*h,b=l+y*d,w=[g,b];return{distance:Math.sqrt((i-g)**2+(a-b)**2),closestPoint:w}}function Zj(t,e,n,i){let[a,r]=t,[l,u]=e,[f,h]=n,[d,m]=i,y=(a-l)*(h-m)-(r-u)*(f-d);if(Math.abs(y)<1e-10)return null;let g=((a-f)*(h-m)-(r-h)*(f-d))/y,b=-((a-l)*(r-h)-(r-u)*(a-f))/y;if(g>=0&&g<=1&&b>=0&&b<=1){let w=a+g*(l-a),E=r+g*(u-r);return[w,E]}return null}function Wj(t,e,n){let i=n||e.snapThreshold||15,a=[],[r,l]=t,u=e.polygon.points,f=e.slowState.transitionIntentType==="move-point";if(e.slowState.snapToPoints)for(let h=0;h<u.length;h++){if(f&&e.selectedPoints.includes(h))continue;let d=u[h];if(d[0]===r&&d[1]===l)continue;let m=d[0]-r,y=d[1]-l,g=Math.sqrt(m*m+y*y);g<=i&&a.push({type:"point",point:[d[0],d[1]],source:{pointIndex:h,polygon:e.polygon},distance:g})}if(e.slowState.snapToLines)for(let h=0;h<u.length;h++){if(f&&e.selectedPoints.includes(h))continue;let d=(h+1)%u.length;if(h===d)continue;let m=u[h],y=u[d],{distance:g,closestPoint:b}=Kj(t,m,y);g<=i&&a.push({type:"line",point:b,source:{lineIndex:h,polygon:e.polygon},distance:g})}if(e.slowState.snapToIntersections&&u.length>=4)for(let h=0;h<u.length;h++){if(f&&e.selectedPoints.includes(h))continue;let d=(h+1)%u.length,m=u[h],y=u[d];for(let g=h+2;g<u.length;g++){if(f&&e.selectedPoints.includes(g))continue;let b=(g+1)%u.length;if(g===d||b===h)continue;let w=u[g],E=u[b],T=Zj(m,y,w,E);if(T){let[S,R]=T,A=Math.sqrt((r-S)**2+(l-R)**2);A<=i&&a.push({type:"intersection",point:T,source:{lineIndex:h,polygon:e.polygon},distance:A})}}}if(e.slowState.snapToParallel)for(let h=0;h<u.length;h++){if(f&&e.selectedPoints.includes(h))continue;let d=u[h],[m,y]=d,g=Math.abs(l-y);g<=i&&a.push({type:"parallel",point:[r,y],source:{pointIndex:h,polygon:e.polygon},distance:g});let b=Math.abs(r-m);b<=i&&a.push({type:"parallel",point:[m,l],source:{pointIndex:h,polygon:e.polygon},distance:b})}return a.sort((h,d)=>h.distance-d.distance)}function Jj(t){return t.sort((e,n)=>{let i=e.type==="point"?0:e.type==="intersection"?1:e.type==="parallel"?2:3,a=n.type==="point"?0:n.type==="intersection"?1:n.type==="parallel"?2:3;return i!==a?i-a:e.distance-n.distance})}function $j(t,e){let n=[];for(let i of t)switch(i.type){case"point":n.push({type:"point",points:[i.point],target:i});break;case"line":if(i.source?.lineIndex!==void 0){let a=e.polygon.points,r=i.source.lineIndex,l=(r+1)%a.length,u=a[r],f=a[l];n.push({type:"line",points:[u,f,i.point],target:i})}else n.push({type:"point",points:[i.point],target:i});break;case"intersection":n.push({type:"cross",points:[i.point],target:i});break;case"parallel":if(i.source?.pointIndex!==void 0){let a=e.polygon.points[i.source.pointIndex];n.push({type:"parallel-line",points:[a,i.point],target:i})}break}return n}function Qs(t,e,n=5,i){if(!e.slowState.snapEnabled)return e.snapTargets=[],e.activeSnapGuides=[],e.isSnapping=!1,e.snapPoint=null,null;let a=Wj(t,e,void 0);if(a.length===0)return e.snapTargets=[],e.activeSnapGuides=[],e.isSnapping=!1,e.snapPoint=null,null;let r=Jj(a);return e.snapTargets=r,e.activeSnapGuides=$j(r.slice(0,n),e),e.isSnapping=!0,e.snapPoint=r[0].point,e.snapPoint}function hD(t){t.snapTargets=[],t.activeSnapGuides=[],t.isSnapping=!1,t.snapPoint=null}function t7(t){return t.isSnapping&&t.snapPoint!==null}function rp(t,e){return t7(e)&&e.snapPoint?e.snapPoint:t}var e7={type:"add-open-point",label:"Add point",tools:["pen","line","lineBox"],trigger:{type:"click"},isValid(t,e,n){if(!e.isOpen)return!1;if(e.polygon.points.length===0)return!0;if(e.selectedPoints.length!==1||e.polygon.points.length>=2&&(e.slowState.currentTool==="line"||e.slowState.currentTool==="lineBox"))return!1;if(e.slowState.bounds){let{x:a,y:r,width:l,height:u}=e.slowState.bounds,[f,h]=t[0];if(f<a||f>a+l||h<r||h>r+u)return!1}let i=e.selectedPoints[0];return i===0||i===e.polygon.points.length-1},commit(t,e,n){let i=e.line?e.line[1]:t[0];!n.Shift&&e.slowState.snapEnabled&&(Qs(i,e,3),i=rp(i,e));let a=e.polygon.points;if(a.length===0)return{selectedPoints:[0],points:[i]};n.Shift;let r=e.selectedPoints[0],l=e.slowState.currentTool==="line"||e.slowState.currentTool==="lineBox";if(r===0)return~~a[0][0]===~~i[0]&&~~a[0][1]===~~i[1]?{selectedPoints:[0],points:a}:{selectedPoints:l?[]:[0],points:[i,...a]};let u=a[a.length-1];return~~u[0]===~~i[0]&&~~u[1]===~~i[1]?{selectedPoints:[a.length-1],points:a}:(e.line=null,{selectedPoints:l?[]:[a.length],points:[...a,i]})}};function uD(t,e){return Math.abs(t-e)}function Oa(t,e){let n=uD(t[0],e[0]),i=uD(t[1],e[1]);return Math.sqrt(n**2+i**2)}function cR(t,e){return[t[0]-e[0],t[1]-e[1]]}function n7(t,e){return t[0]*e[0]+t[1]*e[1]}function pD(t){return t[0]*t[0]+t[1]*t[1]}function Yv(t,e){return pD(cR(t,e))}function mD(t,e,n,i){return i&&n&&(t<0?t=Math.max(t,-i.x-n.x):t>0&&(t=Math.min(t,i.x+i.width-n.x-n.width)),e<0?e=Math.max(e,-i.y-n.y):e>0&&(e=Math.min(e,i.y+i.height-n.y-n.height))),[t,e]}function gD(t,e){let n,i,a,r;var l=(b,w,E,T,S)=>{if(T<=E+1)return;let R=E,A=0,M=b*b;n=[w[E],w[T]],i=cR(n[1],n[0]);let z=pD(i),I,L,H,V,nt;for(let X=E+1;X<T;X++)I=cR(w[X],n[0]),V=n7(I,i),V<=0?nt=Yv(w[X],n[0]):z<=V?nt=Yv(w[X],n[1]):(H=V/z,L=[n[0][0]+H*i[0],n[0][1]+H*i[1]],nt=Yv(w[X],L)),!(nt<=A)&&(R=X,A=nt);A>M&&(S[R]=1,l(b,w,E,R,S),l(b,w,R,T,S))};let u=t.length,f=[],h,d,m,y,g=e*e;for(a=[],r=[],a[0]=t[0],h=d=1,y=0;h<u;h++)Yv(t[h],t[y])<g||(a[d++]=t[h],y=h);for(y<u-1&&(a[d++]=t[u-1]),r[0]=r[d-1]=1,l(e,a,0,d-1,r),h=m=0;h<d;h++)r[h]&&(f[m++]=a[h]);return f}function i7(t){if(t.length!==4)return!1;let e=1e-10,n=Math.min(...t.map(u=>u[0])),i=Math.max(...t.map(u=>u[0])),a=Math.min(...t.map(u=>u[1])),r=Math.max(...t.map(u=>u[1]));for(let u of t){let f=Math.abs(u[0]-n)<e||Math.abs(u[0]-i)<e,h=Math.abs(u[1]-a)<e||Math.abs(u[1]-r)<e;if(!f||!h)return!1}let l=[[n,a],[n,r],[i,a],[i,r]];for(let u of l)if(!t.some(f=>Math.abs(f[0]-u[0])<e&&Math.abs(f[1]-u[1])<e))return!1;return!0}function yD(t){let e=t.points.length,n=!1,i=[];if(e>1){t.iedges=[];let a=t.points[e-1];for(let r=0;r<e;r++){let l=a;if(a=t.points[r],a.length===6){let h=a[2],d=a[3],m=a[4],y=a[5];i.push([r,[a[0]+h,a[1]+d],[a[0]+m,a[1]+y]]),n=!0}let u=[a[0]-l[0],a[1]-l[1]],f=u[0]*u[0]+u[1]*u[1];f>0?t.iedges.push([u[0]/f,u[1]/f]):t.iedges.push([0,0])}}else e===1?t.iedges=[[0,0]]:t.iedges=null;t.isBezier=n,t.bezierLines=i}function a7(t,e){let n=1/0,i=null,a=-1,r=t.points.length;if(r<=1)return[null,n,a];let l=t.points[r-1];for(let u=0;u<r;u++){let f=l;l=t.points[u];let h=f[0]-e[0],d=f[1]-e[1],m=h*h+d*d;m<n&&(i=f,n=m,a=u===0?r-1:u-1)}return[i,n,a]}function Qv(t){if(t.points.length>2){let e=Math.min(...t.points.map(r=>r[0])),n=Math.min(...t.points.map(r=>r[1])),i=Math.max(0,...t.points.map(r=>r[0])),a=Math.max(0,...t.points.map(r=>r[1]));t.boundingBox={x:e,y:n,width:i-e,height:a-n};return}t.boundingBox=null}function r7(t){return t[0]*t[0]+t[1]*t[1]}function cD(t,e){let n=1/0,i=null,a=-1,r=[],l=t.points.length;if(l<=1)return[null,n,r,a];if(t.iedges===null&&(yD(t),!t.iedges))return[null,n,r,a];let u=t.points[l-1];for(let f=0;f<l;f++){let h=u;u=t.points[f];let d=(e[0]-h[0])*t.iedges[f][0]+(e[1]-h[1])*t.iedges[f][1],m;d<=0?m=h:d<1?m=[(1-d)*h[0]+d*u[0],(1-d)*h[1]+d*u[1]]:m=u;let y=r7([m[0]-e[0],m[1]-e[1]]);y<n&&(i=m,n=y,r=[h,u],a=f===0?l-1:f-1)}return[i,n,r,a]}var ep={type:"bounding-box-corners",label:"Drag to resize",tools:["pointer","box"],modifiers:{Shift:"Maintain aspect ratio",Alt:"Scale from center",Meta:"Rotate"},isValid(t,e,n){if(e.transitionDirection=null,e.transitionRotate=!1,e.isOpen||!e.slowState.boxMode&&e.selectedPoints.length!==e.polygon.points.length||!e.polygon.boundingBox)return!1;let i=n.proximity*.5,a=n.proximity*5,r=t[0],l=e.polygon.boundingBox,u=l.x+i,f=l.x+l.width-i*2,h=l.y+i,d=l.y+l.height-i*2;if(r[0]>u&&r[0]<f&&r[1]>h&&r[1]<d)return!1;let m=[l.x+l.width,l.y+l.height],y=[l.x,l.y],g=[l.x+l.width,l.y],b=[l.x,l.y+l.height],w=["ne","nw","se","sw"],E={ne:g,nw:y,se:m,sw:b},T=[Oa(t[0],g),Oa(t[0],y),Oa(t[0],m),Oa(t[0],b)],S=Math.min(...T),R=T.indexOf(S),A=R===-1?null:w[R],M=A?E[A]:null;if(T[0]<a||T[1]<a||T[2]<a||T[3]<a){if(A){let[z,I]=r;(n.Meta||z>=M[0]-n.proximity*4&&I>=M[1]-n.proximity*4&&z<=M[0]+n.proximity*4&&I<=M[1]+n.proximity*4&&!(z>=M[0]-n.proximity*2&&I>=M[1]-n.proximity*2&&z<=M[0]+n.proximity*2&&I<=M[1]+n.proximity*2))&&(e.slowState.boxMode||(e.transitionRotate=!0)),e.transitionDirection=A}return!0}return!1},start(t,e,n){let i=t[0],a=e.polygon.boundingBox,r=[a.x+a.width,a.y+a.height],l=[a.x,a.y],u=[a.x+a.width,a.y],f=[a.x,a.y+a.height],h=["ne","nw","se","sw"],d=[Oa(t[0],u),Oa(t[0],l),Oa(t[0],r),Oa(t[0],f)],m=Math.min(...d),y=d.indexOf(m);e.transitionDirection=y!==-1?h[y]:null},transition(t,e,n){let i=e.polygon.boundingBox,a=e.transitionOrigin||t[0],[r,l]=t[0];if((n.Meta||e.transitionRotate)&&!e.slowState.boxMode){let S=[i.x+i.width/2,i.y+i.height/2],R=Math.atan2(a[1]-S[1],a[0]-S[0]),A=Math.atan2(l-S[1],r-S[0]),M=n.Shift,z=Math.PI/(n.Alt?4:12),I=A-R;M&&(I=Math.round(I/z)*z);let L=Math.cos(I),H=Math.sin(I),V=[];for(let nt of e.polygon.points){let X=nt[0]-S[0],mt=nt[1]-S[1],lt=X*L-mt*H,it=X*H+mt*L,yt=lt+S[0],xt=it+S[1];V.push(nt.length===6?[yt,xt,nt[2],nt[3],nt[4],nt[5]]:[yt,xt])}e.transitionPoints=V,Qv({points:V,iedges:null,boundingBox:null,isBezier:!1,bezierLines:[]}),e.transitionBoundingBox=e.polygon.boundingBox?{...e.polygon.boundingBox,rotation:I}:null;return}let u=e.transitionDirection,f=u.includes("e")?1:-1,h=u.includes("s")?1:-1,d=!!n.Alt,m;if(d)m=[i.x+i.width/2,i.y+i.height/2];else switch(u){case"se":m=[i.x,i.y];break;case"sw":m=[i.x+i.width,i.y];break;case"ne":m=[i.x,i.y+i.height];break;case"nw":m=[i.x+i.width,i.y+i.height];break}let y=d?i.width/2:i.width,g=d?i.height/2:i.height,b,w;if(n.Shift||e.slowState.fixedAspectRatio){let S=f*y,R=h*g,A=r-m[0],M=l-m[1],z=S*S+R*R,I=z>0?(A*S+M*R)/z:1;I=Math.max(I,.01),b=I,w=I}else{let S=0,R=0;switch(u){case"se":S=r-a[0],R=l-a[1];break;case"sw":S=a[0]-r,R=l-a[1];break;case"ne":S=r-a[0],R=a[1]-l;break;case"nw":S=a[0]-r,R=a[1]-l;break}d&&(S*=2,R*=2),b=(i.width+S)/i.width,w=(i.height+R)/i.height}let E=[];for(let S of e.polygon.points){let R=S[0]-m[0],A=S[1]-m[1],M=R*b,z=A*w,I=M+m[0],L=z+m[1];E.push(S.length===6?[I,L,S[2],S[3],S[4],S[5]]:[I,L])}e.transitionPoints=E;let T={points:E,iedges:null,boundingBox:null,bezierLines:[],isBezier:!1};Qv(T),e.transitionBoundingBox=T.boundingBox},commit(t,e,n){let i=e.transitionPoints;return e.transitionPoints=null,e.transitionBoundingBox=null,e.transitionRotate=!1,{points:i}}},o7={type:"close-line-box",label:"Close Line Box",tools:["lineBox"],trigger:{type:"click"},isValid(t,e,n){return e.polygon.points.length===2&&e.lineBox!==null&&e.slowState.boxMode===!1},commit(t,e,n){return e.lineBox?{isOpen:!1,points:e.lineBox,tool:"pen"}:{}}},vD={type:"close-shape",label:"Close shape",tools:["pen","line"],trigger:{type:"click"},isValid(t,e,n){if(!e.isOpen||e.slowState.boxMode||e.selectedPoints.length!==1||e.polygon.points.length<2||n.Meta)return!1;let i=e.selectedPoints[0];if(i===0){let a=e.polygon.points[e.polygon.points.length-1];return Oa(t[0],a)<n.proximity}if(i===e.polygon.points.length-1){let a=e.polygon.points[0];return Oa(t[0],a)<n.proximity}return!1},commit(t,e,n){let i=e.selectedPoints[0];if(e.line=null,i===0)return{selectedPoints:[],points:e.polygon.points.slice(0).reverse(),isOpen:!1};if(i===e.polygon.points.length-1)return{selectedPoints:[],isOpen:!1}}},s7={type:"close-shape-line",label:"Close shape line",trigger:{type:"click"},tools:["pen"],isValid(t,e,n){return!e.isOpen||e.slowState.boxMode||e.polygon.points.length<3||!e.closestLinePoint||e.closestLineDistance>=n.proximity*2?!1:(e.closestLineIndex===0||(e.closestLineIndex,e.polygon.points.length-2),!0)},commit(t,e,n){return vD.commit(t,e,n)}},bD={type:"split-line",label:"Split line",tools:["pen"],isValid(t,e,n){let i=e.slowState.currentTool==="line";return n.Meta||i?!1:!!(e.closestLinePoint&&e.closestLineDistance<n.proximity)},transition(t,e,n){let i=t[0];!n.Shift&&e.slowState.snapEnabled&&(Qs(i,e,3,e.closestLineIndex),i=rp(i,e));let a=e.transitionOrigin||i,[r,l]=i,u=e.polygon.points,f=[],h=r-a[0],d=l-a[1];for(let m=0;m<u.length;m++)if(f.push(u[m]),e.closestLineIndex===m){let y=e.closestLinePoint;f.push([y[0]+h,y[1]+d])}e.transitionPoints=f},commit(t,e,n){let i=e.transitionPoints;return e.transitionPoints=null,e.transitionBoundingBox=null,{selectedPoints:[e.closestLineIndex+1],points:i}}},l7={type:"cut-line",label:"Add new point",tools:["pen"],trigger:{type:"click"},modifiers:{Shift:"Cut line"},isValid(t,e,n){return e.slowState.boxMode?!1:bD.isValid(t,e,n)},commit(t,e,n){if(n.Shift&&!e.isOpen){let r=e.polygon.points,l=[],u=[],f=!1;for(let h=0;h<r.length;h++)f?u.push(r[h]):l.push(r[h]),e.closestLineIndex===h&&(f=!0);return{isOpen:!0,points:[...u,...l]}}let i=e.polygon.points,a=[];for(let r=0;r<i.length;r++)if(a.push(i[r]),e.closestLineIndex===r){let l=e.closestLinePoint;a.push(l)}return{points:a}}},u7={type:"delete-point",label:"Delete point",tools:["pointer","pen","lineBox","line"],trigger:{type:"key",key:"Backspace"},isValid(t,e,n){return e.selectedPoints.length>0&&e.slowState.canDelete},commit(t,e,n){let i=e.polygon.points.filter((a,r)=>!e.selectedPoints.includes(r));return{isOpen:i.length<3,selectedPoints:[],points:i,tool:e.slowState.boxMode?"box":void 0}}},c7={type:"deselect-bounding-box",label:"Deselect bounding box",tools:["pointer"],trigger:{type:"click"},isValid(t,e,n){return e.slowState.canDeselect&&!e.isOpen&&!e.slowState.boxMode&&e.selectedPoints.length>2&&e.selectedPoints.length===e.polygon.points.length},commit(t,e,n){return e.slowState.lastCreationTool==="pen"?{selectedPoints:[],tool:"pen"}:{selectedPoints:[]}}},d7={type:"deselect-draw",label:"Deselect draw",trigger:{type:"key",key:"Escape"},tools:["pointer","pen","box","lineBox","stamp","hand","pencil"],isValid(t,e,n){return e.slowState.canDeselect},commit(t,e,n){return{selectedPoints:[]}}},f7={type:"deselect-points",label:"Deselect points",trigger:{type:"click"},tools:["pointer","pen"],isValid(t,e,n){return e.selectedPoints.length>0&&e.slowState.canDeselect},commit(t,e,n){return{selectedPoints:[]}}},h7={type:"draw-shape",label:"Draw shape",tools:["pen","pencil"],modifiers:{Alt:"Freehand drawing"},isValid(t,e,n){let i=n.Alt||e.slowState.currentTool==="pencil";return!!(e.isOpen&&(e.line||e.polygon.points.length===0)&&i)},start(t,e,n){e.transitionDraw=[]},transition(t,e,n){let i=t[0];!n.Shift&&e.slowState.snapEnabled&&(Qs(i,e,3),i=rp(i,e)),e.transitionDraw.push(i)},commit(t,e,n){let i=e.slowState.currentTool==="pencil"?e.scale*1.5:e.scale*3,a=gD(e.transitionDraw,i);if(e.transitionDraw=[],a.length===0)return;let r=!0,l=3,u=e.selectedPoints[0],f=[...e.polygon.points,...a],h=f[0],d=f[f.length-1];u===0&&(h=f[f.length-1],d=f[0],f=[...a,...e.polygon.points.slice(0).reverse()]);let m=[f.length-1],y=Oa(h,d)/n.proximity<l,g="";return y&&(r=!1,g="pointer",m=f.map((b,w)=>w)),{isOpen:r,tool:g||void 0,points:f,selectedPoints:m}}},p7={type:"move-line",label:"Move line",tools:["line"],isValid(t,e,n){return e.slowState.currentTool!=="line"||e.slowState.boxMode?!1:!!(e.closestLinePoint&&e.closestLineDistance<n.proximity)},transition(t,e){let n=e.transitionOrigin,i=e.polygon.boundingBox,a=t[0],[r,l]=mD(a[0]-n[0],a[1]-n[1],i,e.slowState.bounds);e.transitionPoints=e.polygon.points.map(u=>u.length===6?[u[0]+r,u[1]+l,u[2],u[3],u[4],u[5]]:[u[0]+r,u[1]+l])},commit(t,e,n){let i=e.transitionPoints;return e.transitionPoints=null,e.transitionBoundingBox=null,{points:i}}},m7={type:"move-point",label:"Move point",tools:["pointer","pen","line"],modifiers:{Shift:"Constrain to axis"},isValid(t,e,n){if(n.Alt)return!1;let i=n.proximity,[a,r]=t[0],l=e.polygon.points,u=e.selectedPoints;for(let f=0;f<l.length;f++){let h=l[f],d=h[0]-a,m=h[1]-r;if(d*d+m*m<i*i)return!0}return!1},start(t,e,n){if(e.slowState.boxMode)return ep.start?ep.start(t,e,n):void 0;if(e.selectedPoints.length<2){let[i,a,r]=a7(e.polygon,t[0]);return{selectedPoints:[r]}}if(e.slowState.closestPoint&&!e.selectedPoints.includes(e.slowState.closestPoint))return{selectedPoints:[e.slowState.closestPoint]}},transition(t,e,n){if(e.slowState.boxMode)return ep.transition(t,e,n);let i=e.transitionOrigin,a=t[0];!n.Shift&&e.slowState.snapEnabled&&(Qs(a,e,3),a=rp(a,e));let[r,l]=a,u=e.polygon.points,f=e.selectedPoints;if(e.slowState.closestPoint){let y=e.slowState.closestPoint;f.indexOf(y)===-1&&(f=[y])}let h=[],d=r-i[0],m=l-i[1];n.Shift&&!e.slowState.snapEnabled&&(Math.abs(d)>Math.abs(m)?m=0:d=0);for(let y=0;y<u.length;y++){let g=f.indexOf(y)!==-1,b=u[y];g?b.length===6?h.push([b[0]+d,b[1]+m,b[2],b[3],b[4],b[5]]):h.push([b[0]+d,b[1]+m]):h.push(b)}e.transitionPoints=h},commit(t,e,n){if(e.slowState.boxMode)return ep.commit(t,e,n);let i=e.transitionPoints;return e.transitionPoints=null,e.transitionBoundingBox=null,{points:i}}},SD={type:"move-bounding-box",label:"Move bounding box",tools:["pointer"],isValid(t,e,n){let i=e.polygon.points.length,a=i===e.selectedPoints.length,r=e.polygon.boundingBox;if(i<1||!a||!r)return!1;let l=t[0],u=l[0],f=l[1];return u>=r.x&&u<=r.x+r.width&&f>=r.y&&f<=r.y+r.height},transition(t,e,n){let i=e.slowState.bounds,a=e.transitionOrigin,r=e.polygon.boundingBox,l=t[0],[u,f]=mD(l[0]-a[0],l[1]-a[1],r,i);e.transitionPoints=e.polygon.points.map(h=>h.length===6?[h[0]+u,h[1]+f,h[2],h[3],h[4],h[5]]:[h[0]+u,h[1]+f]),r&&(e.transitionBoundingBox={x:r.x+u,y:r.y+f,width:r.width,height:r.height})},commit(t,e,n){let i=e.transitionPoints;return e.transitionPoints=null,e.transitionBoundingBox=null,{points:i}}},xD={type:"move-shape",label:"Move shape",tools:["pointer","hand","box"],isValid(t,e,n){return n.Shift?!1:e.slowState.pointerInsideShape&&(!e.isOpen||e.line===null)},transition(t,e,n){SD.transition(t,e,n)},commit(t,e,n){let i=e.transitionPoints;return e.transitionPoints=null,e.transitionBoundingBox=null,{points:i}}},g7={type:"nudge-right",label:"Nudge right",trigger:{type:"key",key:"ArrowRight"},tools:["pointer","pen"],modifiers:{Shift:"Nudge right more"},isValid(t,e,n){return e.selectedPoints.length>0},commit(t,e,n){let i=n.proximity*.3,a=e.polygon.points,r=e.selectedPoints;return{points:a.map((l,u)=>r.includes(u)?[l[0]+(n.Shift?4*i:1),l[1]]:l)}}},y7={type:"nudge-left",label:"Nudge left",trigger:{type:"key",key:"ArrowLeft"},tools:["pointer","pen"],modifiers:{Shift:"Nudge left more"},isValid(t,e,n){return e.selectedPoints.length>0},commit(t,e,n){let i=n.proximity*.3,a=e.polygon.points,r=e.selectedPoints;return{points:a.map((l,u)=>r.includes(u)?[Math.max(0,l[0]-(n.Shift?4*i:1)),l[1]]:l)}}},v7={type:"nudge-up",label:"Nudge up",trigger:{type:"key",key:"ArrowUp"},tools:["pointer","pen"],modifiers:{Shift:"Nudge up more"},isValid(t,e,n){return e.selectedPoints.length>0},commit(t,e,n){let i=n.proximity*.3,a=e.polygon.points,r=e.selectedPoints;return{points:a.map((l,u)=>{if(r.includes(u)){let f=l[0],h=Math.max(0,l[1]-(n.Shift?4*i:1));return l.length===6?[f,h,l[2],l[3],l[4],l[5]]:[f,h]}return l})}}},b7={type:"nudge-down",label:"Nudge down",trigger:{type:"key",key:"ArrowDown"},tools:["pointer","pen"],modifiers:{Shift:"Nudge down more"},isValid(t,e,n){return e.selectedPoints.length>0},commit(t,e,n){let i=n.proximity*.3,a=e.polygon.points,r=e.selectedPoints;return{points:a.map((l,u)=>{let f=l[0],h=Math.max(0,l[1]+(n.Shift?4*i:1));return r.includes(u)?l.length===6?[f,h,l[2],l[3],l[4],l[5]]:[f,h]:l})}}},S7={type:"select-multiple-points",label:"Drag to select multiple points",tools:["pointer","pen"],isValid(t,e,n){return e.slowState.currentTool==="line"&&e.polygon.points.length>=2?!0:!(e.slowState.boxMode||e.line)},transition(t,e,n){if(!e.transitionOrigin)return;let i=e.transitionOrigin[0],a=e.transitionOrigin[1],r=t[0][0],l=t[0][1],u=Math.min(i,r),f=Math.min(a,l),h=Math.abs(i-r),d=Math.abs(a-l);e.selectionBox={x:u,y:f,width:h,height:d}},commit(t,e,n){if(e.selectionBox){let i=[];n.Shift&&i.push(...e.selectedPoints);for(let a=0;a<e.polygon.points.length;a++){let r=e.polygon.points[a];r[0]>=e.selectionBox.x&&r[0]<=e.selectionBox.x+e.selectionBox.width&&r[1]>=e.selectionBox.y&&r[1]<=e.selectionBox.y+e.selectionBox.height&&i.push(a)}return{selectedPoints:i}}}},dD=10,x7={type:"select-point",label:"Select point",trigger:{type:"click"},tools:["pointer","pen","line"],modifiers:{Shift:"Add to selection"},isValid(t,e,n){let i=-1;if(e.selectedPoints.length===1){let u=e.selectedPoints[0];u===0&&(i=e.polygon.points.length-1),u===e.polygon.points.length-1&&(i=0)}if(e.slowState.boxMode)return!1;let[a,r]=t[0],l=e.polygon.points;for(let u=0;u<l.length;u++){let f=l[u],h=f[0]-a,d=f[1]-r;if(h*h+d*d<dD*dD)return i!==u}return!1},commit(t,e,n){let i=n.Shift?[...e.selectedPoints]:[],[a,r]=t[0],l=e.polygon.points.map((u,f)=>{let h=u[0]-a,d=u[1]-r;return[h*h+d*d,f]}).sort((u,f)=>u[0]-f[0])[0];if(e.line=null,!i.includes(l[1]))i.push(l[1]);else if(n.Shift)return{selectedPoints:i.filter(u=>u!==l[1])};return{selectedPoints:i}}},w7={type:"select-shape",label:"Select shape",trigger:{type:"click"},tools:["pointer","pen"],isValid(t,e,n){return xD.isValid(t,e,n)},commit(t,e,n){return{tool:"pointer",selectedPoints:e.polygon.points.map((i,a)=>a)}}},T7={type:"snap",label:"Smart snap",tools:["pointer","pen","line"],modifiers:{Shift:"Disable snapping"},isValid(t,e,n){return n.Shift||!e.slowState.snapEnabled||e.slowState.transitioning&&e.slowState.transitionIntentType!=="snap"||!e.slowState.snapToPoints&&!e.slowState.snapToLines&&!e.slowState.snapToIntersections?!1:Qs(t[0],e,0)!==null},start(t,e,n){Qs(t[0],e,5)},transition(t,e,n){let i=Qs(t[0],e,5);i&&(e.pointer=i)},commit(t,e,n){hD(e)}},R7={type:"stamp-fixed-size-shape",label:"Stamp fixed size shape",trigger:{type:"click"},tools:["stamp"],isValid(t,e,n){return e.slowState.selectedStamp!==null},commit(t,e,n){let i=t[0],a=e.slowState.selectedStamp;if(!i||!a)return;let r=i[0],l=i[1],u=[],f=Math.min(...a.points.map(w=>w[0])),h=Math.min(...a.points.map(w=>w[1])),d=Math.max(...a.points.map(w=>w[0]))-f,m=Math.max(...a.points.map(w=>w[1]))-h,y=4*n.proximity,g=d/y;m/y>g&&(g=m/y),r-=d/g/2,l-=m/g/2;let b=0;for(let w of a.points)u.push([r+(w[0]-f)/g,l+(w[1]-h)/g]),b++;return{isOpen:!1,points:u}}},wD={id:"square",open:!1,points:[[0,0],[0,100],[100,100],[100,0]]},E7={id:"triangle",open:!1,points:[[50,0],[0,100],[100,100]]},A7={id:"pentagon",open:!1,points:[[0,0],[0,100],[100,100],[100,0],[50,-50]]},C7={id:"hexagon",open:!1,points:[[50,0],[0,25],[0,75],[50,100],[100,75],[100,25]]},M7={id:"circle",open:!1,points:[[948.949,571.107],[954.545,500],[954.545,500],[948.949,428.893],[948.949,428.893],[932.298,359.538],[932.298,359.538],[905.003,293.641],[905.003,293.641],[867.735,232.825],[867.735,232.825],[821.412,178.588],[821.412,178.588],[767.175,132.265],[767.175,132.265],[706.359,94.997],[706.359,94.997],[640.462,67.702],[640.462,67.702],[571.107,51.051],[571.107,51.051],[500,45.455],[500,45.455],[428.893,51.051],[428.893,51.051],[359.538,67.702],[359.538,67.702],[293.641,94.997],[293.641,94.997],[232.825,132.265],[232.825,132.265],[178.588,178.588],[178.588,178.588],[132.265,232.825],[132.265,232.825],[94.997,293.641],[94.997,293.641],[67.702,359.538],[67.702,359.538],[51.051,428.893],[51.051,428.893],[45.455,500],[45.455,500],[51.051,571.107],[51.051,571.107],[67.702,640.462],[67.702,640.462],[94.997,706.359],[94.997,706.359],[132.265,767.175],[132.265,767.175],[178.588,821.412],[178.588,821.412],[232.825,867.735],[232.825,867.735],[293.641,905.003],[293.641,905.003],[359.538,932.298],[359.538,932.298],[428.893,948.949],[428.893,948.949],[500,954.545],[500,954.545],[571.107,948.949],[571.107,948.949],[640.462,932.298],[640.462,932.298],[706.359,905.003],[706.359,905.003],[767.175,867.735],[767.175,867.735],[821.412,821.412],[821.412,821.412],[867.735,767.175],[867.735,767.175],[905.003,706.359],[905.003,706.359],[932.298,640.462],[932.298,640.462],[948.949,571.107]]},O7={type:"stamp-shape",label:"Stamp shape",tools:["stamp","box"],modifiers:{Shift:"Maintain aspect ratio"},isValid(t,e,n){return!(e.polygon.points.length&&!e.slowState.canDelete)},start(t,e,n){let i=t[0],a=e.slowState.selectedStamp||wD;if(i){let r=i[0],l=i[1],u=[],f=Math.min(...a.points.map(w=>w[0])),h=Math.min(...a.points.map(w=>w[1])),d=Math.max(...a.points.map(w=>w[0]))-f,m=Math.max(...a.points.map(w=>w[1]))-h,y=d/32;m/32>y&&(y=m/32);let g=[],b=0;for(let w of a.points)g.push(b),u.push([r+(w[0]-f)/y,l+(w[1]-h)/y]),b++;return e.transitionPoints=u,{isOpen:!1,selectedPoints:g,points:u}}},transition(t,e,n){if(!e.transitionOrigin)return;let i=e.polygon.boundingBox,a=[i.x,i.y],r=e.transitionOrigin||t[0],[l,u]=t[0],f=e.transitionOrigin[0],h=e.transitionOrigin[1],d=t[0][0],m=t[0][1],y=d-f-32,g=m-h-32;if(n.Shift||e.slowState.fixedAspectRatio){let S=i.width/i.height;Math.abs(i.width/y)>Math.abs(i.height/g)?g=y/S:y=g*S}let b=(i.width+y)/i.width,w=(i.height+g)/i.height,E=[];for(let S of e.polygon.points){let R=S[0]-a[0],A=S[1]-a[1],M=R*b,z=A*w,I=M+a[0],L=z+a[1];if(S.length===6){E.push([I,L,S[2],S[3],S[4],S[5]]);continue}E.push([I,L])}e.transitionPoints=E;let T={points:E,iedges:null,boundingBox:null,bezierLines:[],isBezier:!1};Qv(T),e.transitionBoundingBox=T.boundingBox},commit(t,e,n){return{isOpen:!1,points:e.transitionPoints,tool:"pointer"}}},_7={type:"toggle-snap",label:"Toggle snapping",trigger:{type:"key",key:"`"},tools:["pointer","pen","line","lineBox","box","stamp"],modifiers:{},isValid(t,e,n){return!0},commit(t,e,n){let i=!e.slowState.snapEnabled;return e.slowState.snapEnabled=i,i||(e.snapTargets=[],e.activeSnapGuides=[],e.isSnapping=!1,e.snapPoint=null),{}}};function TD(t={}){let e=t.proximityThreshold||10,n=t.closestLinePointFill||{selected:"#fff",unselected:"rgba(255, 255, 255, .5)"},i=t.closestLinePointStroke||{selected:"#000",unselected:"rgba(0, 0, 0, .5)"};function a(b,w,E){b&&w.transitionBoundingBox&&E.transitioning&&(b.setAttribute("x",""+w.transitionBoundingBox.x),b.setAttribute("y",""+w.transitionBoundingBox.y),b.setAttribute("width",""+w.transitionBoundingBox.width),b.setAttribute("height",""+w.transitionBoundingBox.height))}function r(b,w,E){b&&w.polygon.boundingBox&&E.showBoundingBox&&(b.setAttribute("x",""+w.polygon.boundingBox.x),b.setAttribute("y",""+w.polygon.boundingBox.y),b.setAttribute("width",""+w.polygon.boundingBox.width),b.setAttribute("height",""+w.polygon.boundingBox.height))}function l(b,w,E){if(b&&w.polygon.boundingBox&&E.showBoundingBox){let T=w.transitionBoundingBox||w.polygon.boundingBox;T.rotation?(b.style.transformOrigin=`${T.x+T.width/2}px ${T.y+T.height/2}px`,b.style.transform=`rotate(${Math.round(100*T.rotation*(180/Math.PI))/100}deg)`):b.style.transform="",b.setAttribute("points",[[T.x,T.y],[T.x+T.width,T.y],[T.x+T.width,T.y+T.height],[T.x,T.y+T.height]].map(S=>S.join(",")).join(" "))}}function u(b,w,E){b&&w.transitionPoints&&E.transitioning&&b.setAttribute("points",w.transitionPoints.map(T=>T.join(",")).join(" "))}function f(b,w,E){b&&w.closestLinePoint&&E.hasClosestLine&&(b.setAttribute("cx",""+w.closestLinePoint[0]),b.setAttribute("cy",""+w.closestLinePoint[1]),b.setAttribute("fill",w.closestLineDistance<e?n.selected:n.unselected),b.setAttribute("stroke",w.closestLineDistance<e?i.selected:i.unselected))}function h(b,w,E){b&&w.closestLinePoint&&E.hasClosestLine&&b.setAttribute("transform",`translate(${w.closestLinePoint[0]}, ${w.closestLinePoint[1]})`)}function d(b,w,E){b&&w.selectionBox&&E.transitionIntentType==="select-multiple-points"&&(b.setAttribute("x",""+w.selectionBox.x),b.setAttribute("y",""+w.selectionBox.y),b.setAttribute("width",""+w.selectionBox.width),b.setAttribute("height",""+w.selectionBox.height))}function m(b,w,E){if(b&&w.pointer&&w.selectedPoints.length)if(E.actionIntentType==="close-shape"||E.actionIntentType==="close-shape-line"){let T=w.polygon.points[0],S=w.polygon.points[w.polygon.points.length-1];T&&S&&b.setAttribute("points",`${T.join(",")} ${S.join(",")}`)}else if(w.line)b.setAttribute("points",`${w.line[0].join(",")} ${w.line[1].join(",")}`);else{let T=w.polygon.points[w.selectedPoints[0]];T&&T.length&&b.setAttribute("points",`${w.pointer[0]},${w.pointer[1]} ${T.join(",")}`)}}function y(b,w,E,T=3){b&&w.transitionDraw.length&&b.setAttribute("points",gD(w.transitionDraw,T*w.scale).map(S=>S.join(",")).join(" "))}function g(b,w){b&&w.lineBox&&b.setAttribute("points",w.lineBox.map(E=>E.join(",")).join(" "))}return{updateTransitionBoundingBox:a,updateClosestLinePointTransform:h,updateBoundingBoxPolygon:l,updateBoundingBox:r,updateTransitionShape:u,updateClosestLinePoint:f,updateSelectBox:d,updatePointLine:m,updateDrawPreview:y,updateLineBox:g}}var z7=typeof window<"u"?window.requestAnimationFrame:t=>setTimeout(t,16),I7=typeof window<"u"?window.cancelAnimationFrame:t=>clearTimeout(t);function fD(t){return!["hand","pointer"].includes(t)}var ip=[ep,m7,p7,bD,xD,SD,h7,S7,O7,T7],N7=ip.length,np=[o7,R7,vD,x7,s7,l7,e7,w7,c7,f7],Td=[d7,g7,y7,v7,b7,u7,_7],ap={};ip.forEach(t=>{ap[t.type]=t});np.forEach(t=>{ap[t.type]=t});Td.forEach(t=>{ap[t.type]=t});var Xv=10;function RD(t,e){let n=t?.fixedAspectRatio||!1,i=t?.tool||"pointer",a=t?.keyboardShortcutMapping||{},r=typeof t?.keyboardShortcutsEnabled=="boolean"?t.keyboardShortcutsEnabled:!0,l=t?.enabledTools||["pointer","pen","box","lineBox","stamp","hand","line","pencil"],u=t?.emitter||Qj(),f={V:"pointer",P:"pen",B:"box",L:"lineBox",S:"stamp",H:"hand",N:"line",D:"pencil",...t?.toolMap||{}},h={shapeId:t?.id||null,noShape:t===null,transitioning:!1,actionIntentType:null,transitionIntentType:null,selectedPoints:[],hasClosestLine:!1,modifiers:{Alt:!1,Shift:!1,Meta:!1,proximity:Xv},bounds:t?.bounds||null,showBoundingBox:!1,currentModifiers:{},validIntentKeys:{},pointerInsideShape:!1,closestPoint:null,selectedStamp:null,transitionModifiers:null,boxMode:!1,bezierLines:[],fixedAspectRatio:n,isToolSwitchingLocked:!1,canDeselect:!1,canDelete:!0,cursor:"default",enabledTools:l,currentTool:i,lastCreationTool:fD(i)?i:null,snapEnabled:!1,snapToPoints:!0,snapToLines:!0,snapToIntersections:!0,snapToGrid:!1,snapToParallel:!0},d={isOpen:typeof t?.open=="boolean"?t.open:!1,polygon:{points:t?.points||[],iedges:null,boundingBox:null,isBezier:null,bezierLines:[]},scale:1,selectedPoints:[],pointer:null,line:null,lineBox:null,transitionPoints:null,transitionOrigin:null,transitionBoundingBox:null,closestLinePoint:null,closestLineDistance:0,closestLineIndex:-1,transitionRotate:!1,transitionDirection:null,transitionBezierLine:null,selectionBox:null,slowState:h,transitionDraw:[],isPanning:!1,panStart:null,snapTargets:[],activeSnapGuides:[],snapThreshold:15,isSnapping:!1,snapPoint:null},m={startTime:0,time:0,shouldUpdate:!1,nextSlowState:null,renderFunc:()=>{},setStateFunc:()=>{},animationFrame:0,actionIntent:null,transitionIntent:null,undoStack:[],undoStackPointer:-1},y={isPressed:!1,isClicking:!1,lastPress:null,pressTimeout:0,noTransition:!1};function g(_){yD(_),_.isBezier&&b({bezierLines:_.bezierLines}),Qv(_),m.shouldUpdate=!0}g(d.polygon);function b(_){let B=Object.keys(_);if(B.length===0)return;let rt=m.nextSlowState||d.slowState,ft=!1;if(B.length===1&&B[0]==="validIntentKeys"&&rt.validIntentKeys){let wt=Object.keys(rt.validIntentKeys),U=Object.keys(_.validIntentKeys||{});if(wt.length===U.length){for(let P of wt)rt.validIntentKeys[P]!==_.validIntentKeys[P]&&(ft=!0);if(!ft)return}}if(_.selectedPoints){let wt=Array.from(rt.selectedPoints||[]),U=Array.from(_.selectedPoints||[]);if(wt.length===U.length){for(let P of wt)if(!U.includes(P)){ft=!0;break}}else ft=!0;ft||delete _.selectedPoints}if(!(B.length===1&&B.includes("hasClosestLine")&&_.hasClosestLine===rt.hasClosestLine)){if(m.nextSlowState){m.nextSlowState={...m.nextSlowState,..._};return}m.nextSlowState={...d.slowState,..._}}}function w(_,B=!1){m.time+=_,E(),T(),H(),L(),I(),nt(),mt(),X(),z(),m.renderFunc(d,d.slowState,_),!B&&(m.animationFrame=z7(w))}function E(){if(m.shouldUpdate&&(e({id:d.slowState.shapeId||void 0,open:d.isOpen,points:d.polygon.points}),m.shouldUpdate=!1),m.nextSlowState&&m.nextSlowState!==d.slowState){let _=Object.keys(d.slowState),B={},rt={},ft=!1;for(let wt of _){let U=d.slowState[wt],P=m.nextSlowState[wt];U!==P?(ft=!0,B[wt]=P,rt[wt]=P):B[wt]=U}ft&&(d.slowState=B,m.nextSlowState=null,m.setStateFunc(d.slowState),t?.customSetState?.(rt))}}function T(){let _=!d.slowState.noShape&&d.polygon.points.length>2&&d.selectedPoints.length===d.polygon.points.length&&!d.isOpen&&(d.slowState.currentTool==="pointer"||d.slowState.currentTool==="box");d.slowState.showBoundingBox!==_&&b({showBoundingBox:_})}function S(_){d.selectedPoints=_.selectedPoints,b({selectedPoints:_.selectedPoints}),d.polygon.points=_.points,d.polygon.boundingBox=null,d.polygon.iedges=null,d.polygon.isBezier=null,g(d.polygon),b({closestPoint:null}),(_.isOpen===!0||_.isOpen===!1)&&(d.isOpen=_.isOpen,m.shouldUpdate=!0)}function R(){if(m.undoStackPointer===-1)return;m.undoStackPointer--;let _=m.undoStack[m.undoStackPointer];S(_)}function A(){if(m.undoStackPointer===m.undoStack.length-1)return;m.undoStackPointer++;let _=m.undoStack[m.undoStackPointer];S(_)}function M(_){m.undoStackPointer++,m.undoStack[m.undoStackPointer]=_,m.undoStack.length>15&&(m.undoStack.shift(),m.undoStackPointer--)}function z(){b({boxMode:i7(d.polygon.points||[])})}function I(){if(!d.pointer||d.slowState.noShape){b({pointerInsideShape:!1});return}let[_,B]=d.pointer,rt=d.polygon.points,ft=d.polygon.boundingBox;if(!ft){b({pointerInsideShape:!1});return}if(_<ft.x||_>ft.x+ft.width||B<ft.y||B>ft.height+ft.y){b({pointerInsideShape:!1});return}let wt=!1;for(let U=0,P=rt.length-1;U<rt.length;P=U++)rt[U][1]>B!=rt[P][1]>B&&_<(rt[P][0]-rt[U][0])*(B-rt[U][1])/(rt[P][1]-rt[U][1])+rt[U][0]&&(wt=!wt);b({pointerInsideShape:wt})}function L(){if(d.slowState.noShape||!d.pointer||d.slowState.transitioning||!d.polygon.points||d.polygon.points.length===0)return;let[_,B]=d.pointer,rt=d.polygon.points.map((ft,wt)=>{let U=ft[0]-_,P=ft[1]-B;return[U*U+P*P,wt]}).sort((ft,wt)=>ft[0]-wt[0]);rt.length&&b({closestPoint:rt[0][1]})}function H(){if(!d.pointer||d.slowState.transitioning)return;if(d.slowState.noShape){d.closestLineIndex=-1,d.closestLinePoint=null,d.closestLineDistance=0;return}let[_,B,rt,ft]=cD(d.polygon,d.pointer),wt=te()*te();B<wt&&(!d.isOpen||d.slowState.currentTool==="line"||d.polygon.points.length-1!==ft)?(d.closestLinePoint=_,d.closestLineDistance=Math.sqrt(B),d.closestLineIndex=ft,b({hasClosestLine:!0})):(d.closestLinePoint=null,d.closestLineDistance=0,d.closestLineIndex=-1,b({hasClosestLine:!1}))}function V(_,B=null){let rt={},ft=B||(d.pointer?[d.pointer[0],d.pointer[1]]:null);for(let wt of[...ip,...np,...Td])wt.tools.includes(_)&&(ft&&wt.isValid([ft],d,lt())?rt[wt.type]=wt.label:ft||(rt[wt.type]=wt.label));return rt}function nt(){if(d.slowState.transitioning||d.slowState.noShape||!d.pointer||!Array.isArray(d.pointer)||d.pointer.length<2||typeof d.pointer[0]!="number"||typeof d.pointer[1]!="number")return;let _=d.slowState.currentTool;tn(_);let B=!1;for(let wt=0;wt<N7;wt++){let U=ip[wt];if(U.tools.includes(_)&&U.isValid(y.isPressed?[y.lastPress]:[d.pointer],d,lt())){if(m.transitionIntent===U){B=!0;break}b({transitionIntentType:U.type}),m.transitionIntent=U,B=!0;break}}B||m.transitionIntent&&(b({transitionIntentType:null}),m.transitionIntent=null);let rt=!1;for(let wt=0;wt<np.length;wt++){let U=np[wt];if(U.tools.includes(_)&&yt(U)){if(m.actionIntent===U){rt=!0;break}b({actionIntentType:U.type}),m.actionIntent=U,rt=!0;break}}rt||m.actionIntent&&(m.actionIntent=null,b({actionIntentType:null}));let ft={};for(let wt=0;wt<Td.length;wt++){let U=Td[wt];U.trigger.type==="key"&&yt(U)&&(ft[U.trigger.key]=U.label)}b({validIntentKeys:ft})}function X(){let _=d.pointer;if(d.lineBox=null,!_||et()||d.polygon.points.length!==2)return;let[B,rt]=_,[ft,wt]=d.polygon.points[0],[U,P]=d.polygon.points[1],[Z,W,Lt,Yt]=cD(d.polygon,_);if(!Z)return;let Pt=B-Z[0],Y=rt-Z[1],at=[ft,wt],At=[U,P],Ct=[At[0]+Pt,At[1]+Y],Rt=[at[0]+Pt,at[1]+Y];d.lineBox=[at,At,Ct,Rt]}function mt(){let _=d.pointer;if(!_||!et()||d.slowState.noShape)return;let B=d.selectedPoints[0],rt=_;if(d.slowState.snapEnabled&&!d.slowState.modifiers.Shift?(Qs(_,d,5),rt=rp(_,d)):hD(d),d.line=[d.polygon.points[B],rt],d.slowState.modifiers.Shift){let ft=0;if(d.polygon.points.length>1){let Y=d.selectedPoints[0];Y===0?ft=Math.atan2(d.polygon.points[1][1]-d.polygon.points[0][1],d.polygon.points[1][0]-d.polygon.points[0][0]):ft=Math.atan2(d.polygon.points[Y-1][1]-d.polygon.points[Y][1],d.polygon.points[Y-1][0]-d.polygon.points[Y][0])}let wt=_[0]-d.polygon.points[B][0],U=_[1]-d.polygon.points[B][1],P=Math.atan2(U,wt),Z=Math.PI/4,W=Math.round((P-ft)/Z)*Z+ft,Lt=Oa(d.polygon.points[B],_),Yt=Math.cos(W)*Lt+d.polygon.points[B][0],Pt=Math.sin(W)*Lt+d.polygon.points[B][1];d.line[1]=[Yt,Pt]}}function lt(){return d.slowState.modifiers}function it(_){let B=_.commit([y.lastPress],d,lt());u.emit("polygons.end-transition",{transitionIntent:_.type,response:B}),B&&(B.tool&&Ft(B.tool),B.selectedPoints&&(d.selectedPoints=B.selectedPoints,b({selectedPoints:B.selectedPoints})),B.points&&(d.polygon.points=B.points,d.polygon.boundingBox=null,d.polygon.iedges=null,d.polygon.isBezier=null,d.transitionBoundingBox=null,g(d.polygon),b({closestPoint:null,selectedStamp:null})),(B.isOpen===!0||B.isOpen===!1)&&(d.isOpen=B.isOpen,m.shouldUpdate=!0),M({isOpen:d.isOpen,points:d.polygon.points,selectedPoints:d.selectedPoints}),tn(d.slowState.currentTool)),b({transitionModifiers:null})}function yt(_){if(!_.tools.includes(d.slowState.currentTool))return!1;let B=[];return d.pointer&&Array.isArray(d.pointer)&&d.pointer.length>=2&&typeof d.pointer[0]=="number"&&typeof d.pointer[1]=="number"&&(B=[d.pointer]),_.isValid(B,d,lt())}function xt(_){_==="Delete"&&(_="Backspace");let B=d.slowState.currentTool;for(let rt of Td)if(!(rt.trigger.type!=="key"||rt.trigger.key!==_)&&rt.tools.includes(B)&&yt(rt))return it(rt),!0;return!1}function et(){let _=d.polygon.points,B=d.pointer;if(!d.isOpen||!_.length||d.selectedPoints.length!==1||!B)return!1;let rt=d.selectedPoints[0],ft=rt===0,wt=rt===_.length-1;return ft||wt}let gt={reset(){b({modifiers:{Alt:!1,Shift:!1,Meta:!1,proximity:Xv}})},getForType(_){let B={};if(!_)return B;let rt=ap[_];return!rt||!rt.modifiers?B:rt.modifiers},set(_){_!=="Shift"&&_!=="Alt"&&_!=="Meta"||b({modifiers:{...m.nextSlowState?.modifiers||d.slowState.modifiers,[_]:!0}})},unset(_){_!=="Shift"&&_!=="Alt"&&_!=="Meta"||b({modifiers:{...m.nextSlowState?.modifiers||d.slowState.modifiers,[_]:!1}})}},Mt={set(_){let B=_?_.id==="square"||_.id==="rectangle":!1;b({selectedStamp:_,boxMode:B})},clear(){Mt.set(null)},square(){Mt.set(wD)},triangle(){Mt.set(E7)},pentagon(){Mt.set(A7)},hexagon(){Mt.set(C7)},circle(){Mt.set(M7)}},Vt={down(_){let B=a[_]||_;if(B==="Shift"||B==="Alt"||B==="Meta")return gt.set(B),!0;if(B==="Control")return gt.set("Meta"),!0;if(B==="z"&&d.slowState.modifiers.Meta)return d.slowState.modifiers.Shift?A():R(),!0;if(!d.slowState.modifiers.Meta&&!d.slowState.modifiers.Alt&&!d.slowState.transitioning){if(!r)return;let rt=B.toUpperCase();if(f[rt]){let ft=f[rt];return Ft(ft),!0}}return xt(B)},up(_){let B=a[_]||_;if(B==="Control"){gt.unset("Meta");return}B!=="Shift"&&B!=="Alt"&&B!=="Meta"||gt.unset(B)}};function Kt(_){d.scale=_,b({modifiers:{...m.nextSlowState?.modifiers||d.slowState.modifiers,proximity:_*Xv}})}function te(){return Xv*d.scale}let ue={set:_=>{m.renderFunc=_},start:(_,B)=>{m.startTime=performance.now(),m.time=0,_&&(m.renderFunc=_),B&&(B(d.slowState),m.setStateFunc=B),w(0)},stop:()=>{m.animationFrame&&(I7(m.animationFrame),m.animationFrame=0)},step:(_=16)=>{w(_)}};function dt(_){if(!_||!Array.isArray(_)||_.length===0)return;let B=_[0];if(!(!B||!B[0]&&B[0]!==0||!B[1]&&B[1]!==0)&&!(Number.isNaN(B[0])||Number.isNaN(B[1]))){if(d.pointer=B,d.slowState.transitioning)m.transitionIntent&&(m.transitionIntent.transition(_,d,lt()),u.emit("polygons.transition",{transitionIntent:m.transitionIntent.type}));else if(y.isPressed&&!y.noTransition&&y.lastPress&&d.pointer&&(!y.isClicking||Oa(y.lastPress,d.pointer)>10))if(clearTimeout(y.pressTimeout),y.isClicking=!1,m.transitionIntent){if(d.transitionOrigin=y.lastPress,b({transitioning:!0}),m.transitionIntent.start){let rt=m.transitionIntent.start([y.lastPress],d,lt());rt&&(rt.selectedPoints&&(d.selectedPoints=rt.selectedPoints,b({selectedPoints:rt.selectedPoints})),(rt.isOpen===!0||rt.isOpen===!1)&&(d.isOpen=rt.isOpen,m.shouldUpdate=!0),rt.points&&(d.polygon.points=rt.points,d.polygon.boundingBox=null,d.polygon.iedges=null,g(d.polygon),b({closestPoint:null})))}b({transitionModifiers:m.transitionIntent.modifiers||null}),u.emit("polygons.start-transition",{transitionIntent:m.transitionIntent.type}),m.transitionIntent.transition([y.lastPress],d,lt()),u.emit("polygons.transition",{transitionIntent:m.transitionIntent.type})}else y.noTransition=!0}}function Ht(){d.pointer=null,d.slowState.transitioning||(y.isPressed=!1,y.isClicking=!1,y.lastPress=null,b({transitionIntentType:null,actionIntentType:null}),m.transitionIntent=null,m.actionIntent=null)}function ee(){y.isClicking=!0,y.isPressed=!0,y.lastPress=d.pointer,y.pressTimeout=setTimeout(()=>{y.isPressed&&(y.isClicking=!1)},250)}function Gt(){d.slowState.transitioning?(b({transitioning:!1}),m.transitionIntent&&it(m.transitionIntent),m.transitionIntent=null,b({transitionIntentType:null})):y.isClicking&&(m.actionIntent&&it(m.actionIntent),m.actionIntent=null,b({actionIntentType:null})),y.isPressed=!1,y.isClicking=!1,y.lastPress=null,y.noTransition=!1,clearTimeout(y.pressTimeout)}function re(_){d.polygon.points=_?.points||[],d.polygon.boundingBox=null,d.polygon.iedges=null,d.isOpen=_?.open||!1,g(d.polygon),m.nextSlowState=null,m.undoStack=[],m.undoStackPointer=-1,d.lineBox=null,d.line=null,y.pressTimeout&&clearTimeout(y.pressTimeout),b({noShape:_===null,shapeId:_?.id||null,transitioning:!1,actionIntentType:null,transitionIntentType:null,selectedPoints:[],hasClosestLine:!1,modifiers:{Alt:!1,Shift:!1,Meta:!1,proximity:d.slowState.modifiers.proximity},showBoundingBox:!1,currentModifiers:{},validIntentKeys:{},selectedStamp:null,closestPoint:null,pointerInsideShape:!1,boxMode:!1,fixedAspectRatio:n}),Ft(i),E()}function Ae(_){if(!_)return"";let B=ap[_];return!B||!B.modifiers?B.label||"":d.slowState.modifiers.Shift&&B.modifiers.Shift?B.modifiers.Shift:d.slowState.modifiers.Alt&&B.modifiers.Alt?B.modifiers.Alt:d.slowState.modifiers.Meta&&B.modifiers.Meta?B.modifiers.Meta:B.label}function Zt(){b({fixedAspectRatio:!0})}function fe(){b({fixedAspectRatio:!1})}function Ft(_){if(d.slowState.isToolSwitchingLocked||d.slowState.currentTool===_||!d.slowState.enabledTools.includes(_))return;let B=d.slowState.lastCreationTool;if(fD(_)){if(d.slowState.isToolSwitchingLocked)return;B=_}d.slowState.transitioning&&(d.transitionPoints=null,d.transitionBoundingBox=null,d.transitionDraw=[],d.line=null,d.lineBox=null,b({transitioning:!1}));let rt=V(_),ft=d.selectedPoints,wt=d.isOpen,U=d.slowState.selectedStamp;switch(_){case"pointer":d.polygon.points.length>0&&!wt&&ft.length===0&&(ft=d.polygon.points.map((P,Z)=>Z));break;case"pen":d.polygon.points.length===0?(ft=[],wt=!0):wt&&ft.length>1&&(ft=[ft[ft.length-1]]);break;case"line":d.polygon.points.length===0?(ft=[],wt=!0):wt?ft.length>1&&(ft=[ft[ft.length-1]]):(ft=[d.polygon.points.length-1],wt=!0);break;case"pencil":ft=[],d.polygon.points.length===0&&(wt=!0);break;case"box":ft=d.polygon.points.map((P,Z)=>Z),wt=!1,Mt.square();break;case"lineBox":ft=[],d.polygon.points.length===0&&(wt=!0);break;case"stamp":ft=[],wt=!1,U||Mt.square();break;case"hand":ft=[];break;default:ft=[];break}b({validIntentKeys:rt}),b({currentTool:_,selectedPoints:ft,lastCreationTool:B,boxMode:_==="box"}),d.selectedPoints=ft,d.isOpen=wt,tn(_),nt()}function tn(_){let B=_==="box"||_==="pointer"&&d.polygon.points.length>2&&d.selectedPoints.length===d.polygon.points.length&&!d.isOpen;b({showBoundingBox:B})}function Jt(_){d.slowState.currentTool===_&&Ft("pointer")}function ze(_){d.slowState.currentTool===_?Ft("pointer"):Ft(_)}let ri={undo:R,redo:A,get canUndo(){return m.undoStackPointer>-1},get canRedo(){return m.undoStackPointer<m.undoStack.length-1}},qn={setTool:Ft,unsetTool:Jt,toggleTool:ze,updateVisibility:tn,setCanDelete(_){b({canDelete:_})},setCanDeselect(_){Tt(),b({canDeselect:_})},lockToolSwitching(){b({isToolSwitchingLocked:!0})},unlockToolSwitching(){b({isToolSwitchingLocked:!1})},toggleToolSwitching(){b({isToolSwitchingLocked:!d.slowState.isToolSwitchingLocked})},shortcuts:Object.fromEntries(Object.entries(f).map(([_,B])=>[B,_])),getValidIntents(_){let B=_||d.slowState.currentTool;return{actions:np.filter(rt=>rt.tools.includes(B)),transitions:ip.filter(rt=>rt.tools.includes(B)),keys:Td.filter(rt=>rt.tools.includes(B)),all:V(B),current:d.slowState.validIntentKeys}},getToolInfo(){return{name:d.slowState.currentTool,cursor:d.slowState.cursor,selectionCount:d.selectedPoints.length,pointCount:d.polygon.points.length,isOpen:d.isOpen}},smartSelect(){d.polygon.points.length!==0&&(d.isOpen?(d.selectedPoints=[d.polygon.points.length-1],b({selectedPoints:d.selectedPoints})):(d.selectedPoints=d.polygon.points.map((_,B)=>B),b({selectedPoints:d.selectedPoints})))},clearSelection(){d.selectedPoints=[],b({selectedPoints:[]})},autoSelect(){d.selectedPoints.length===d.polygon.points.length&&!d.isOpen?Ft("pointer"):d.isOpen||d.selectedPoints.length>0?Ft(d.slowState.lastCreationTool||"pen"):Ft("pointer")}},st={enabled:()=>d.slowState.snapEnabled,enable:()=>b({snapEnabled:!0}),disable:()=>b({snapEnabled:!1}),toggle:()=>b({snapEnabled:!d.slowState.snapEnabled}),pointsEnabled:()=>d.slowState.snapToPoints,enablePoints:()=>b({snapToPoints:!0}),disablePoints:()=>b({snapToPoints:!1}),togglePoints:()=>b({snapToPoints:!d.slowState.snapToPoints}),linesEnabled:()=>d.slowState.snapToLines,enableLines:()=>b({snapToLines:!0}),disableLines:()=>b({snapToLines:!1}),toggleLines:()=>b({snapToLines:!d.slowState.snapToLines}),intersectionsEnabled:()=>d.slowState.snapToIntersections,enableIntersections:()=>b({snapToIntersections:!0}),disableIntersections:()=>b({snapToIntersections:!1}),toggleIntersections:()=>b({snapToIntersections:!d.slowState.snapToIntersections}),gridEnabled:()=>d.slowState.snapToGrid,enableGrid:()=>b({snapToGrid:!0}),disableGrid:()=>b({snapToGrid:!1}),toggleGrid:()=>b({snapToGrid:!d.slowState.snapToGrid}),parallelEnabled:()=>d.slowState.snapToParallel,enableParallel:()=>b({snapToParallel:!0}),disableParallel:()=>b({snapToParallel:!1}),toggleParallel:()=>b({snapToParallel:!d.slowState.snapToParallel}),getThreshold:()=>d.snapThreshold*d.slowState.modifiers.proximity,setThreshold:_=>{d.snapThreshold=Math.max(5,Math.min(50,_))},isActive:()=>d.isSnapping,getSnapPoint:()=>d.snapPoint,getActiveGuides:()=>d.activeSnapGuides,getTargets:()=>d.snapTargets};function Tt(){b({selectedPoints:d.polygon.points.map((_,B)=>B)})}function qt(_){b({bounds:_})}return Ft(i),{state:d,setState:b,emitter:u,modifiers:gt,stamps:Mt,history:ri,key:Vt,setScale:Kt,clock:ue,pointer:dt,blur:Ht,pointerDown:ee,pointerUp:Gt,setShape:re,label:Ae,tools:qn,snap:st,selectAllPoints:Tt,setBounds:qt,lockAspectRatio:Zt,unlockAspectRatio:fe}}function Rd(t){let e=Math.max(...t.map(r=>r[0])),n=Math.min(...t.map(r=>r[0])),i=Math.max(...t.map(r=>r[1])),a=Math.min(...t.map(r=>r[1]));for(let r of t)if(r[0]!==n&&r[0]!==e&&r[1]!==a&&r[1]!==i||r[0]<n||r[0]>e||r[1]<a||r[1]>i)return!1;return!0}function Ks(t){if(!t)return null;if(t.points.length>2){let e=Math.min(...t.points.map(r=>r[0])),n=Math.min(...t.points.map(r=>r[1])),i=Math.max(0,...t.points.map(r=>r[0])),a=Math.max(0,...t.points.map(r=>r[1]));return{x:e,y:n,width:i-e,height:a-n}}return null}function ED(t){return t.type==="SvgSelector"}function L7(t){return t.type==="BoxSelector"}function Kv(t,e){if(ED(t)){let l=t.svgShape==="polyline";if(!t.points||t.points.length===0)return null;if(e){let{width:u,height:f}=e;return{type:"SvgSelector",value:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${u} ${f}" width="${u}" height="${f}"><${l?"polygon":"polyline"} points="${t.points.map(d=>d.join(",")).join(" ")}" /></svg>`}}return{type:"SvgSelector",value:`<svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'><g><path d='M${t.points.map(u=>u.join(",")).join(" ")}${l?" Z":""}' /></g></svg>`}}if(!t.spatial)return null;let{x:n,y:i,width:a,height:r}=t.spatial||{};return!a||!r?null:{type:"FragmentSelector",value:`xywh=${~~n},${~~i},${~~a},${~~r}`}}function Ed(t,e){if(!t||!t.points.length)return null;if(Rd(t.points)){let n=t.points.map(f=>f[0]),i=t.points.map(f=>f[1]),a=Math.min(...n),r=Math.min(...i),l=Math.max(...n)-a,u=Math.max(...i)-r;return Kv({type:"BoxSelector",spatial:{x:a,y:r,width:l,height:u}},e)}return Kv({type:"SvgSelector",points:t.points,svgShape:t.open?"polygon":"polyline"},e)}function op(t){if(t.type==="polygon"&&!t.noBox&&t.points&&Rd(t.points)){let n=Ks({open:!1,points:t.points||[]});return op({...t,type:"box",selector:n})}if(t.type==="polygon"||t.type==="draw")return{polygon:{points:t.points||[],open:t.open||!1},requestType:t.type,boundingBox:Ks({points:t.points||[],open:!1}),metadata:{},arguments:t.arguments||{},target:Ed({points:t.points||[],open:!1},t.bounds)};let e=t.selector;if(e){let n=[[e.x,e.y],[e.x+e.width,e.y],[e.x+e.width,e.y+e.height],[e.x,e.y+e.height]];return{polygon:{points:n,open:!1},requestType:t.type,boundingBox:e,metadata:{},target:Ed({points:n,open:!1},t.bounds),arguments:t.arguments||{}}}return{polygon:{points:[],open:!1},requestType:t.type,boundingBox:null,target:null,metadata:{},arguments:t.arguments||{}}}var D7={shapeId:null,noShape:!0,transitioning:!1,actionIntentType:null,transitionIntentType:null,selectedPoints:[],hasClosestLine:!1,lastCreationTool:null,modifiers:{Alt:!1,Shift:!1,Meta:!1,proximity:0},bounds:null,showBoundingBox:!1,currentModifiers:{},validIntentKeys:{},pointerInsideShape:!1,closestPoint:null,transitionModifiers:null,selectedStamp:null,bezierLines:[],boxMode:!1,fixedAspectRatio:!1,cursor:"",enabledTools:["pointer","pen","box","lineBox","stamp","hand","line","pencil"],canDelete:!0,canDeselect:!0,isToolSwitchingLocked:!1,currentTool:"box",snapEnabled:!1,snapToPoints:!1,snapToLines:!1,snapToIntersections:!1,snapToGrid:!1,snapToParallel:!1};function dR({events:t,enabledTools:e,keyboardShortcutMapping:n,keyboardShortcutsEnabled:i=!1,debug:a}){let r=ya((u,f)=>{let h=null,m=RD({emitter:t,keyboardShortcutsEnabled:i,keyboardShortcutMapping:n,enabledTools:e,customSetState:y=>{a&&console.log("partial state",y),u(g=>({polygonState:{...g.polygonState,...y}}))}},y=>{u(g=>g.tool.requestId?{polygon:{...y,id:g.tool.requestId}}:{polygon:{id:void 0,points:[],open:!0}}),t.emit("atlas.polygon-update",y)});return{mode:"explore",tool:{enabled:!1,requestId:null,canvasId:null},runtime:null,requestType:null,requests:{},history:m.history,polygon:null,validRequestIds:[],metadata:{},stableViewport:null,canvasRelativePositions:{},canvasViewports:{},polygons:m,polygonState:D7,setMetadata:(y,g)=>{let b=g||f().tool.requestId;b&&u(w=>({metadata:{...w.metadata,[b]:{...w.metadata[b]||{},...y}}}))},setToolCanvasId:y=>{u(g=>({tool:{...g.tool,canvasId:y}}))},switchTool:{pointer(){u({mode:"sketch"}),l.tools.setTool("pointer")},hand(){u({mode:"explore"}),l.tools.setTool("hand")},draw(){u({mode:"sketch"}),l.tools.setTool("pencil")},pen(){u({mode:"sketch"}),l.tools.setTool("pen")},line(){u({mode:"sketch"}),l.tools.setTool("line")},lineBox(){u({mode:"sketch"}),l.tools.setTool("lineBox")},box(){u({mode:"sketch"}),l.tools.setTool("box")},triangle(){u({mode:"sketch"}),l.tools.setTool("stamp"),l.stamps.triangle()},hexagon(){u({mode:"sketch"}),l.tools.setTool("stamp"),l.stamps.hexagon()},circle(){u({mode:"sketch"}),l.tools.setTool("stamp"),l.stamps.circle()},remove(){let y=f();y.tool.requestId&&(m.setShape({points:[],open:!0}),y.cancelRequest(y.tool.requestId))}},reset:()=>{let y=f();y.tool.requestId&&y.cancelRequest(y.tool.requestId)},setPolygonState:y=>u({polygonState:typeof y=="function"?y(f().polygonState):y}),getRequestId:()=>{let y=Math.random().toString(36).slice(2);return u(g=>({validRequestIds:[...g.validRequestIds,y]})),{requestId:y,clear:()=>{f().tool.requestId,u(g=>({tool:g.tool.requestId===y?{enabled:!1,requestId:null,canvasId:null}:g.tool,validRequestIds:g.validRequestIds.filter(b=>b!==y)}))}}},cancelRequest:y=>{let g=y||f().tool.requestId;g&&(u(b=>({mode:"explore",tool:b.tool.requestId===g?{enabled:!1,requestId:null,canvasId:null}:b.tool,validRequestIds:b.validRequestIds.filter(w=>w!==g)})),t.emit("atlas.request-cancelled",{id:g}))},requestAnnotation:async(y,g)=>{let w={...f().requests,[g.requestId]:y},E=op(y);a&&console.log("requestAnnotation",{response:E,request:y});try{let{points:T=[],open:S=!0}=E.polygon||{},{requestId:R,canvasId:A=null,toolId:M}=g,z=M,I=f(),L=I.validRequestIds.includes(R),H=E.requestType;return a&&console.log("setting points",{requestType:H,points:T,open:S}),!L||I.tool.enabled?null:(m.setShape({id:R,points:T,open:S}),H==="polygon"&&(z=z||"pen",m.tools.setTool("pen")),H==="draw"&&(z=z||"draw",m.tools.setTool("pencil")),H==="box"&&(z=z||"box",m.tools.setTool("box")),H==="target"?(z=z||"box",m.tools.setTool("box"),m.lockAspectRatio(),m.tools.lockToolSwitching(),m.tools.setCanDeselect(!1),m.tools.setCanDelete(!1)):(m.tools.unlockToolSwitching(),m.tools.setCanDeselect(!0),m.tools.setCanDelete(!0)),y.bounds&&m.setBounds(y.bounds),t.emit("atlas.annotation-request",{id:R}),u({polygon:{id:R,points:T,open:S},mode:"sketch",requestType:H,tool:{enabled:!0,requestId:R,canvasId:A},requests:w}),z?I.switchTool[z]?.():T.length===0&&I.switchTool.box(),(typeof y.selectByDefault>"u"&&T.length&&H==="box"||y.selectByDefault)&&I.switchTool.pointer(),new Promise(V=>{let nt=mt=>{mt.id===R&&(u(lt=>({mode:"explore",tool:{requestId:null,enabled:!1,canvasId:null},requests:Object.fromEntries(Object.entries(lt.requests).filter(([it])=>it!==R))})),t.off("atlas.request-cancelled",nt),t.off("atlas.annotation-completed",X),V(null))},X=mt=>{mt.id===R&&(u(lt=>({mode:"explore",tool:{requestId:null,enabled:!1,canvasId:null},requests:Object.fromEntries(Object.entries(lt.requests).filter(([it])=>it!==R))})),t.off("atlas.annotation-completed",X),t.off("atlas.request-cancelled",nt),V(mt))};t.on("atlas.request-cancelled",nt),t.on("atlas.annotation-completed",X)}))}catch(T){return console.error(T),null}},completeRequest:y=>{let g=f().tool.requestId;if(typeof y=="string"&&y&&y!==g)return;let b=g?f().requests[g]?.arguments||{}:{},w=g?f().metadata[g]||{}:{},E=f().polygonState.bounds,T=f().polygon;T&&(t.emit("atlas.annotation-completed",{id:T.id,polygon:T,requestType:f().requestType,target:Ed(T,E),canvasId:f().tool.canvasId,boundingBox:Ks(T),metadata:w,arguments:{...b}}),m.setShape(null))},setAtlasRuntime:y=>{h=y,t.emit("atlas.ready",{runtime:y}),l.setScale(1/h._lastGoodScale),h.world.addLayoutSubscriber((g,b)=>{(g==="event-activation"||g==="zoom-to"||g==="go-home")&&h?._lastGoodScale&&!Number.isNaN(h._lastGoodScale)&&l.setScale(1/h._lastGoodScale)}),u({runtime:h})},clearAtlasRuntime:()=>{h=null,u({stableViewport:null,runtime:null})},setCanvasRelativePosition:(y,g)=>{u(b=>({canvasRelativePositions:{...b.canvasRelativePositions,[y]:g}}))},clearCanvasRelativePosition:y=>{u(g=>{let b={...g.canvasRelativePositions};return delete b[y],{canvasRelativePositions:b}})},changeMode:y=>{u({mode:y})},nudgeLeft:y=>{if(!h)return;let g=h.getViewport(),b=y??g.width*.1;h.world.gotoRegion({x:g.x-b,y:g.y,width:g.width,height:g.height,nudge:!0})},nudgeRight:y=>{if(!h)return;let g=h.getViewport(),b=y??g.width*.1;h.world.gotoRegion({x:g.x+b,y:g.y,width:g.width,height:g.height,nudge:!0})},nudgeUp:y=>{if(!h)return;let g=h.getViewport(),b=y??g.height*.1;h.world.gotoRegion({x:g.x,y:g.y-b,width:g.width,height:g.height,nudge:!0})},nudgeDown:y=>{if(!h)return;let g=h.getViewport(),b=y??g.height*.1;h.world.gotoRegion({x:g.x,y:g.y+b,width:g.width,height:g.height,nudge:!0})},zoomIn:()=>{h?.world?.zoomIn()},zoomOut:()=>{h?.world?.zoomOut()},goHome:()=>{h?.world?.goHome()},goToRegion:y=>{h?.world?.gotoRegion(y)},getRuntime:()=>h}}),l=r.getState().polygons;return t.on("atlas.annotation-request",()=>{l.clock.start((u,f,h)=>{t.emit("atlas.polygon-render",{state:u,slowState:f,dt:h})},u=>{typeof u=="object"?r.setState({polygonState:u}):r.setState(f=>({polygonState:u(f.polygonState)}))})}),t.on("atlas.annotation-completed",()=>{l.clock.stop()}),t.on("atlas.request-cancelled",()=>{l.clock.stop()}),r}var hR=N(tt(),1),mu=(0,Bo.createContext)(null);function $e(){return(0,Bo.useContext)(mu)}var fR={};function pR(t="atlas"){return fR[t]?.getState()}function Ad({children:t,name:e="atlas",existing:n,atlasStoreConfig:i}){let a=uR(),r=(0,Bo.useContext)(mu),l=(0,Bo.useMemo)(()=>n||r||dR({events:a,...i||{}}),[a,n,r]),u=zt(l,f=>f.mode);return(0,Bo.useEffect)(()=>{let f=e;return f&&(fR[f]=l),()=>{f&&delete fR[f]}},[l,e]),(0,hR.jsx)(mu.Provider,{value:l,children:(0,hR.jsx)(wd.Provider,{value:u||"explore",children:t})})}var ID=N(ct(),1);var Cd=N(ct(),1),AD=N(tt(),1);function mR(){return{default:{backgroundColor:"rgba(0,0,0,0)",borderWidth:"2px",borderColor:"rgba(252,0,98, .5)"},highlighted:{backgroundColor:"rgba(75, 103, 225, 0.4)",borderWidth:"1px",borderColor:"rgba(75,103,225,0.99)"},hidden:{borderWidth:"0px",borderColor:"rgba(0,0,0,0)",backgroundColor:"rgba(0,0,0,0)",hidden:!0}}}var gR=(0,Cd.createContext)(mR());gR.displayName="AnnotationStyle";function sp(){return(0,Cd.useContext)(gR)}function P7({theme:t,children:e}){let n=(0,Cd.useMemo)(()=>t||mR(),[t]);return(0,AD.jsx)(gR.Provider,{value:n,children:e})}var MD=N(ct(),1);var Md=N(ct(),1);var CD=Ag()((t,e)=>{let n=new Map,i=()=>Math.random().toString(36).substring(2,15),a=r=>{let l=n.get(r);if(l)return l;let u=i();return n.set(r,u),u};return{stylesheets:{},loading:[],errors:[],async parseStylesheet(r){let{loadStylesheet:l,setStylesheet:u}=e();if(!r)return null;if(typeof r=="string")return r.startsWith("http")?{id:r,type:"CssStylesheet",value:await l(r)}:{id:u(r),type:"CssStylesheet",value:r};if(r.type==="CssStylesheet"){let f=r.id;if("value"in r){let h=Array.isArray(r.value)?r.value.join(`
|
|
92
|
+
`):r.value;if(h)return{id:u(h,f),type:"CssStylesheet",value:h}}if("id"in r&&r.id){let h=await l(r.id);return{id:r.id,type:"CssStylesheet",value:h}}}return null},async loadStylesheet(r){if(e().loading.includes(r))return"";try{let u=await fetch(r);if(!u.ok)throw new Error(`Failed to load stylesheet from ${r}`);let f=await u.text();return t(h=>({stylesheets:{...h.stylesheets,[r]:f}})),f}catch(u){return t(f=>({errors:[...f.errors,{url:r,error:u}]})),""}},setStylesheet(r,l){let u=l||a(r);return t(f=>({stylesheets:{...f.stylesheets,[u]:r}})),u}}});function yR(t){let[e,n]=(0,Md.useState)(""),{loading:i,errors:a,stylesheets:r,parseStylesheet:l}=CD();return(0,Md.useEffect)(()=>{t&&l(t).then(f=>{f?.id&&n(f.id)})},[t,l]),[(0,Md.useMemo)(()=>{let f={};return e&&r[e]&&(f[e]=r[e]),f},[e,r]),{id:e,stylesheets:r,loading:i,errors:a}]}function lp(t={},e=[]){let{id:n,selector:i}=t,a=wi(),r=ce(),l=n||a.annotation,u=_e(d=>l?d.iiif.entities.Annotation[l]:void 0,[l]),[f]=yR(u?.stylesheet),h=_e(d=>u&&u.body?u.body.map(m=>m?m.type==="SpecificResource"?{...m,source:r.get(m)}:m?d.iiif.entities[m.type][m.id]:null:null).filter(Boolean):[],[u]);return(0,MD.useMemo)(()=>{if(!u)return;let d={...u,body:h,target:wn(u.target,{typeMap:r.getState().iiif.mapping,loadedStylesheets:f})};return i?i(d):d},[u,i,h,f,...e])}var OD=N(ct(),1);function Wt(t={},e=[]){let{id:n,selector:i}=t,a=wi(),r=n||a.canvas,l=_e(u=>r?u.iiif.entities.Canvas[r]:void 0,[r]);return(0,OD.useMemo)(()=>{if(l)return i?i(l):l},[l,i,...e])}var vR=N(ct(),1);function up(t=po){return{addEventListener(e,n,i,a){if(e)return t.setMetaValue([e.id,"eventManager",n],r=>{let l=r||[];for(let u of l)if(u.callback===i)return l;return[...l,{callback:i,scope:a}]}),i},removeEventListener(e,n,i){e&&t.setMetaValue([e.id,"eventManager",n],a=>(a||[]).filter(r=>r.callback!==i))},getListenersAsProps(e,n){let i=typeof e=="string"?{id:e}:e;if(!i||!i.id)return{};let a=t.getResourceMeta(i.id,"eventManager"),r={};if(a&&i)for(let l of Object.keys(a))r[l]=u=>{let f=t.get(i);for(let{callback:h,scope:d}of a[l]||[])(!d||n&&d.indexOf(n)!==-1)&&h(u,f)};return r}}}function cp(t,e){let n=ce(),i=(0,vR.useMemo)(()=>up(n),[n]),a=_e(()=>t&&t.id?n.getResourceMeta(t.id,"eventManager"):null,[t]);return(0,vR.useMemo)(()=>t?i.getListenersAsProps(t,e):{},[a,t,n,e])}var _D=N(ct(),1);function Zs(t=po){return{applyStyles(e,n,i){let a=typeof e=="string"?e:e.id;return t.setMetaValue([a,"styles",n],i)},getAppliedStyles(e){let n=typeof e=="string"?e:e.id;return t.getResourceMeta(n,"styles")}}}function gu(t,e){let n=ce(),i=(0,_D.useMemo)(()=>Zs(n),[n]);return _e(()=>{if(!t)return null;let a=i.getAppliedStyles(t.id);return a?e?a[e]:a:void 0},[t,e])}var zD=N(ct(),1);var Gr=N(ct(),1),Bn=N(tt(),1);function bR({handleSize:t,resizable:e,onSave:n,children:i,maintainAspectRatio:a,disableCardinalControls:r,aspectRatio:l,...u}){let f=typeof t>"u"?a?12:8:t,{portalRef:h,mode:d,mouseEvent:m,isEditing:y}=sD({x:u.x||0,y:u.y||0,width:u.width,height:u.height,aspectRatio:l,maintainAspectRatio:a},n),g=(0,Gr.useMemo)(()=>m("translate"),[m]),b=(0,Gr.useMemo)(()=>m("east"),[m]),w=(0,Gr.useMemo)(()=>m("west"),[m]),E=(0,Gr.useMemo)(()=>m("south"),[m]),T=(0,Gr.useMemo)(()=>m("north"),[m]),S=(0,Gr.useMemo)(()=>m("south-east"),[m]),R=(0,Gr.useMemo)(()=>m("south-west"),[m]),A=(0,Gr.useMemo)(()=>m("north-east"),[m]),M=(0,Gr.useMemo)(()=>m("north-west"),[m]),z=d==="sketch",I={zIndex:999,boxShadow:"0px 2px 3px 0 rgba(0,0,0,0.2)",outline:"2px solid rgba(155,155,155,.7)",borderRadius:a||r?"50%":2,position:"absolute",background:"#fff",pointerEvents:y?"none":z?"initial":"none"};return(0,Bn.jsx)(Bn.Fragment,{children:(0,Bn.jsxs)("world-object",{...u,children:[i,z&&e?(0,Bn.jsx)(ea,{ref:h,target:{x:0,y:0,height:u.height,width:u.width},relative:!0,interactive:!1,children:z&&e?(0,Bn.jsxs)(Bn.Fragment,{children:[(0,Bn.jsx)("div",{onMouseDown:g,onTouchStart:g,style:{display:"block",width:"100%",height:"100%",cursor:"move",border:"1px solid rgba(255,255,255, .7)",outline:"2px solid rgba(155,155,155, .7)",boxSizing:"border-box",pointerEvents:y?"none":z?"initial":"none"}}),a?null:(0,Bn.jsxs)(Bn.Fragment,{children:[(0,Bn.jsx)("div",{title:"east",onTouchStart:b,onMouseDown:b,style:{...I,cursor:"e-resize",height:f*2,width:f,right:0,top:"50%",opacity:r?0:1,transform:`translate(${f/2}px, -${f}px)`}}),(0,Bn.jsx)("div",{title:"west",onMouseDown:w,style:{...I,cursor:"w-resize",position:"absolute",height:f*2,width:f,left:0,top:"50%",opacity:r?0:1,transform:`translate(-${f/2}px, -${f}px)`}}),(0,Bn.jsx)("div",{title:"north",onMouseDown:T,style:{...I,cursor:"n-resize",position:"absolute",height:f,width:f*2,left:"50%",top:0,opacity:r?0:1,transform:`translate(-${f}px, -${f/2}px)`}}),(0,Bn.jsx)("div",{title:"south",onMouseDown:E,style:{...I,cursor:"s-resize",position:"absolute",height:f,width:f*2,left:"50%",bottom:0,opacity:r?0:1,transform:`translate(-${f}px, ${f/2}px)`}})]}),(0,Bn.jsx)("div",{title:"north-east",onMouseDown:A,style:{...I,cursor:"ne-resize",position:"absolute",height:f,width:f,right:0,top:0,transform:`translate(${f/2}px, -${f/2}px)`}}),(0,Bn.jsx)("div",{title:"south-east",onMouseDown:S,style:{...I,cursor:"se-resize",position:"absolute",height:f,width:f,bottom:0,right:0,transform:`translate(${f/2}px, ${f/2}px)`}}),(0,Bn.jsx)("div",{title:"south-west",onMouseDown:R,style:{...I,cursor:"sw-resize",position:"absolute",height:f,width:f,bottom:0,left:0,transform:`translate(-${f/2}px, ${f/2}px)`}}),(0,Bn.jsx)("div",{title:"north-west",onMouseDown:M,style:{...I,cursor:"nw-resize",position:"absolute",height:f,width:f,top:0,left:0,transform:`translate(-${f/2}px, -${f/2}px)`}})]}):null}):null]})})}var SR=N(tt(),1);function xR({id:t,interactive:e,region:n,onClick:i,onHover:a,onSave:r,aspectRatio:l,maintainAspectRatio:u,disableCardinalControls:f,isEditing:h,style:d={backgroundColor:"rgba(0,0,0,.5)"}}){let m=(0,zD.useCallback)(y=>{h&&r?.({id:n.id,x:n.x,y:n.y,height:n.height,width:n.width,...y})},[r,h,n.id,n.x,n.y,n.height,n.width]);return(0,SR.jsx)(bR,{id:t,x:n.x,y:n.y,width:n.width,aspectRatio:l,height:n.height,resizable:h,onSave:m,maintainAspectRatio:u,disableCardinalControls:f,children:(0,SR.jsx)("box",{interactive:e,onClick:y=>{y.preventDefault(),y.stopPropagation(),i?.(n)},relativeStyle:!0,onMouseEnter:()=>{a?.(n)},target:{x:0,y:0,width:n.width,height:n.height},style:d})})}var ND=N(tt(),1),yu=({id:t,style:e,className:n,interactive:i,targetId:a,ignoreTargetId:r})=>{let l=lp({id:t}),u=gu(l,"atlas"),f=gu(l,"html"),h=cp(l,["atlas"]),d=Wt(),m=sp(),y=(0,ID.useMemo)(()=>tp(tp(tp(tp(e,u),l?.motivation?.includes("highlighting")?m.highlighted:m.default),l?.target?.selector?.boxStyle||{})),[e,u,m,l?.motivation,l?.target]),g=a||d?.id;return d&&l&&l.target&&l.target.selector&&(l.target.selector.type==="BoxSelector"||l.target.selector.type==="SvgSelector")&&l.target.source&&(r?!0:l.target.source.id===g||l.target.source===g)?(0,ND.jsx)(xR,{id:l.id,isEditing:!0,region:l.target.selector.spatial,style:y,className:f?.className||n,interactive:!!(f?.href||i),href:f?.href||null,title:f?.title||null,hrefTarget:f?.target||null,onClick:()=>{},...h}):null};var DD=N(ct(),1);var LD=N(ct(),1);function wR(t={},e=[]){let{id:n,selector:i}=t,a=wi(),r=n||a.annotationPage,l=_e(u=>r?u.iiif.entities.AnnotationPage[r]:void 0,[r]);return(0,LD.useMemo)(()=>{if(l)return i?i(l):l},[l,...e])}var TR=N(tt(),1),Ws=({className:t,page:e,targetId:n,ignoreTargetId:i})=>{let a=wR({id:e.id})||e,r=gu(a,"atlas"),l=gu(a,"html");return _e(u=>a.id?u.iiif.entities.AnnotationPage[a.id]:null,[]),(0,TR.jsx)(DD.Fragment,{children:a.items?.map(u=>(0,TR.jsx)(yu,{id:u.id,style:r,className:l?.className||t,targetId:n,ignoreTargetId:i},u.id))})};var Js=N(ct(),1),Zv=N(tt(),1),PD=(0,Js.createContext)(null),BD=(0,Js.createContext)(null),HD=(0,Js.createContext)(null);function B7(){let t=(0,Js.useContext)(PD);if(!t)throw new Error("Ctx not found");return t}function H7(){let t=(0,Js.useContext)(BD);if(!t)throw new Error("Ctx not found");return t}function F7(){let t=(0,Js.useContext)(HD);if(!t)throw new Error("Ctx not found");return t}function dp({actions:t,state:e,children:n,currentTime:i,progress:a,element:r}){return(0,Zv.jsx)(HD.Provider,{value:{currentTime:i,progress:a,element:r},children:(0,Zv.jsx)(BD.Provider,{value:t,children:(0,Zv.jsx)(PD.Provider,{value:e,children:n})})})}var UD=N(ct(),1);function FD(t,e,n=[],i=!1,a=[]){if(a.length&&(e=e.filter(l=>a.indexOf(l)===-1)),!e||e.length===0)return;if(e.length===1)return e[0];if(!t)return e.indexOf("none")===-1?e[0]:"none";if(e.indexOf(t)!==-1)return t;let r=t.indexOf("-")===-1?null:t.slice(0,t.indexOf("-"));if(r&&e.indexOf(r)!==-1)return r;for(let l of n)if(e.indexOf(l)!==-1)return l;if(!i&&t){let l=e.map(u=>u.indexOf("-")===-1?null:u.slice(0,u.indexOf("-"))).indexOf(t);if(l!==-1)return e[l];for(let u of n){let f=u.indexOf("-")===-1?null:u.slice(0,u.indexOf("-")),h=f?e.indexOf(f):-1;if(h!==-1)return e[h]}}return e.indexOf("none")===-1?e.indexOf("@none")===-1?e[0]:"@none":"none"}function RR(t,e,n={}){let{strictFallback:i=!1,defaultText:a="",separator:r=`
|
|
93
|
+
`,fallbackLanguages:l=[],closest:u,skipLanguages:f}=n,h=u?e:FD(e,Object.keys(t||{}),l,i,f);if(!t)return a;if(typeof t=="string")return t;let d=h?t[h]:void 0;if(d&&h){if(typeof d=="string")return d;if(d.length===1&&d[0]===""){let m=n.skipLanguages||[];return RR(t,e,{...n,skipLanguages:[...m,h]})}return d.join(r)}return""}function Wv(t,e={}){return RR(t,e.language||(typeof navigator<"u"?navigator.language:"en"),e)}var q7=qD();function qD(t={}){return(e,...n)=>{let i="";for(let a=0;a<e.length;a++)if(i+=e[a],a<n.length){let r=n[a];if(r==null)continue;typeof r=="string"?i+=r:i+=Wv(r,t)}return i}}function ER(t){return t.type==="SpecificResource"?[t.source,{selector:t.selector,...t.styleClass?{styleClass:t.styleClass}:{}}]:[t,{selector:null}]}function U7(t){if(!t)return;let e=Array.isArray(t)?t:[t],n={};for(let i of e){if(i?.type!=="CssStylesheet"||!("value"in i))continue;let a=Array.isArray(i.value)?i.value.join(`
|
|
94
|
+
`):i.value;a&&(n[i.id||`inline-${Object.keys(n).length}`]=a)}return Object.keys(n).length?n:void 0}function Od(t=po){function e(a){let r=a?typeof a=="string"?t.get(a):a:null;if(!r)return[];let l=t.get(r.items,{parent:r}),u=[];for(let f of l)u.push(...t.get(f.items,{parent:f}));return u}function n(a,r=[]){let l=Array.isArray(a)?a:e(a),u=[],f={items:[],type:"complex-choice"},h=[];for(let d of l){if(d.type!=="Annotation")throw Error("getPaintables() accept either a canvas or list of annotations");let m=Array.from(Array.isArray(d.body)?d.body:[d.body]);for(let y of m){let[g,{selector:b,styleClass:w}]=ER(y),E=t.get(g),T=(E.type||"unknown").toLowerCase();if(T==="choice"){let M=t.get(E.items,{parent:E.id}),z=r.length?r.map(I=>M.find(L=>L.id===I)).filter(Boolean):[M[0]];z.length===0&&z.push(M[0]),f.items.push({type:"single-choice",items:M.map(I=>({id:I.id,label:I.label,selected:z.indexOf(I)!==-1})),label:g.label}),m.push(...z);continue}u.indexOf(T)===-1&&u.push(T);let S=w?U7(d.stylesheet):void 0,R=w?ls(w,S):void 0,A=R?ss(R):{};h.push({type:T,annotationId:d.id,annotation:d,resource:E,target:d.target,selector:b,...w?{styleClass:w}:{},...R&&Object.keys(R).length?{style:R}:{},...A})}}return{types:u,items:h,choice:f.items.length<2?f.items[0]||null:f,allChoices:f.items.length?f:null}}function i(a){let{choice:r}=n(a);return r}return{getAllPaintingAnnotations:e,getPaintables:n,extractChoices:i}}function fp(){let t=Tn(),e=Wt();return(0,UD.useMemo)(()=>{if(!t||!e||!t.start)return null;let n=wn(t.start);return!n||n.source.id!==e.id||!n||!n.selector||n.selector.type!=="TemporalSelector"?null:n.selector.temporal},[t,e])}var bn=N(ct(),1);function VD(t){return{isMuted:!1,playRequested:!1,isPlaying:!1,isFinished:!1,volume:100,duration:t}}function V7(t,e){switch(e.type){case"RESET":return e.state;case"FINISHED":return{...t,isFinished:!0,isPlaying:!1,playRequested:!1};case"PLAY_PAUSE":return{...t,isFinished:!1,isPlaying:!t.isPlaying};case"PLAY_REQUESTED":return{...t,isFinished:!1,playRequested:!0};case"PAUSE":return{...t,isPlaying:!1};case"PLAY":return{...t,isFinished:!1,playRequested:!1,isPlaying:!0};case"MUTE":return{...t,isMuted:!0};case"SET_VOLUME":return{...t,volume:e.volume,isMuted:e.volume===0};case"TOGGLE_MUTE":return{...t,isMuted:!t.isMuted};case"UNMUTE":return{...t,isMuted:!1}}return t}function Jv(t){let e=Math.round(t);return`${Math.floor(e/60)}:${`${e%60}`.padStart(2,"0")}`}function vu(t){let[e,n]=(0,bn.useReducer)(V7,VD(t.duration));(0,bn.useEffect)(()=>{n({type:"RESET",state:VD(t.duration)})},[t.duration]);let i=(0,bn.useRef)(null),a=(0,bn.useRef)(null),r=(0,bn.useRef)(null),l=(0,bn.useRef)(!1),u=(0,bn.useCallback)(()=>{a.current&&i.current&&(a.current.innerHTML=Jv(i.current.currentTime),r.current&&(r.current.style.width=`${i.current.currentTime/t.duration*100}%`),l.current!==i.current.muted&&(l.current=i.current.muted,n(i.current.muted?{type:"MUTE"}:{type:"UNMUTE"})))},[t.duration]),f=(0,bn.useCallback)(()=>{i.current&&(n({type:"PLAY_REQUESTED"}),i.current.play().then(()=>{n({type:"PLAY"})}),u())},[u]),h=(0,bn.useCallback)(()=>{i.current&&(i.current.duration>0&&i.current.paused?f():d())},[u]),d=(0,bn.useCallback)(()=>{i.current&&(i.current.pause(),n({type:"PAUSE"}),u())},[u]),m=(0,bn.useCallback)(()=>{i.current&&(i.current.muted=!i.current.muted,n(i.current.muted?{type:"MUTE"}:{type:"UNMUTE"}))},[]),y=(0,bn.useCallback)(()=>{i.current&&(i.current.muted=!0,n({type:"MUTE"}))},[]),g=(0,bn.useCallback)(()=>{i.current&&(i.current.muted=!1,n({type:"UNMUTE"}))},[]),b=(0,bn.useCallback)(T=>{i.current&&(i.current.muted=!1,i.current.volume=T/100,n({type:"SET_VOLUME",volume:T}))},[]),w=(0,bn.useCallback)(T=>{i.current&&(i.current.currentTime=Math.max(0,Math.min(T*t.duration,t.duration)),u())},[]),E=(0,bn.useCallback)(T=>{if(i.current){let S=typeof T=="function"?T(i.current.currentTime):T;i.current.currentTime=Math.max(0,Math.min(S,t.duration)),u()}},[]);return(0,bn.useEffect)(()=>{let T=setInterval(()=>{u()},350);return()=>clearInterval(T)},[u,t.duration]),(0,bn.useEffect)(()=>{let T=()=>{n({type:"FINISHED"})},S=i.current;return S?.addEventListener("ended",T),()=>S?.removeEventListener("ended",T)},[]),[{element:i,currentTime:a,progress:r},e,{play:f,pause:d,playPause:h,mute:y,unmute:g,toggleMute:m,setVolume:b,setDurationPercent:w,setTime:E}]}var bu=N(ct(),1),AR=(0,bu.createContext)(()=>{}),CR=(0,bu.createContext)(()=>{});function yi(t,e,n,i,a=[]){let r=(0,bu.useContext)(t==="portal"?CR:AR);(0,bu.useEffect)(()=>(t!=="none"&&r(e,n,i),()=>{r(e,null)}),[e,t,r,...a])}var t0=N(tt(),1);function MR({media:t,startTime:e,children:n}){let[{element:i,currentTime:a,progress:r},l,u]=vu({duration:t.duration}),f=e?`${t.url}#t=${e}`:t.url;return(0,t0.jsxs)(dp,{state:l,actions:u,currentTime:a,progress:r,element:i,children:[(0,t0.jsx)("audio",{ref:i,src:f}),n]},t.url)}function $v({media:t,mediaControlsDeps:e,audioCopmonent:n=MR,children:i}){let a=fp();return yi("portal","audio",n,{media:t,startTime:a?a.startTime:null,children:i},[t,a,...e||[]]),null}var e0=N(ct(),1),$s=(0,e0.createContext)(null);$s.displayName="Strategy";function dn(){let t=(0,e0.useContext)($s);if(!t)throw new Error("useStrategy must be used within a StrategyProvider");return t}var tl=N(tt(),1);function OR({model:t}){return(0,tl.jsxs)(tl.Fragment,{children:[(0,tl.jsx)("style",{children:`
|
|
89
95
|
.model-container {
|
|
90
96
|
position: absolute;
|
|
91
97
|
top: 0;
|
|
@@ -98,10 +104,10 @@ Error generating stack: `+i.message+`
|
|
|
98
104
|
justify-content: center;
|
|
99
105
|
pointer-events: visible;
|
|
100
106
|
}
|
|
101
|
-
`}),(0,Cl.jsx)("div",{className:"model-container",children:(0,Cl.jsx)("model-viewer",{"interaction-prompt":"none",style:{width:"100%",height:"100%"},"camera-controls":"","ar-status":"not-presenting",src:t.id})})]})}function Tv({model:t,name:e}){return Xn("overlay",`model-${e}`,KA,{model:t},[t]),null}var ND=_(Y(),1);function ZA(){let{strategy:t}=Fe();return t.type!=="3d-model"?null:(0,ND.jsx)(Tv,{model:t.model})}var Cv=_(nt(),1),Ih=(0,Cv.createContext)(null);Ih.displayName="Controls";function hi(){let t=(0,Cv.useContext)(Ih);if(!t)throw new Error("useStrategy must be used within a StrategyProvider");return t}var or=_(Y(),1);function WA(){let{strategy:t}=Fe(),{renderViewerControls:e,viewControlsDeps:n}=hi(),i=zt(),a=i?.accompanyingCanvas,o=i?.placeholderCanvas;return(0,or.jsxs)(or.Fragment,{children:[t.type==="media"&&t.media.type==="Sound"&&a?(0,or.jsx)(ma,{canvas:a.id,children:(0,or.jsx)(Fs,{renderViewerControls:e,viewControlsDeps:n})}):null,t.type==="media"&&t.media.type==="Sound"&&o&&!a?(0,or.jsx)(ma,{canvas:o.id,children:(0,or.jsx)(Fs,{renderViewerControls:e,viewControlsDeps:n})}):null]})}var Jc=_(nt(),1);var rr=_(nt(),1);var ID=_(nt(),1);function JA(){let e=Vt().getStore();return(0,ID.useMemo)(()=>n=>e.dispatch(n),[e])}function DD(t){return typeof t!="string"&&t&&t.bindToVault}function $A(){let t=Vt(),e=(0,rr.useRef)([]),n=JA(),i=(0,rr.useMemo)(()=>`vault://annotation-page/${new Date().getTime()}/${Math.round(Math.random()*1e9).toString(16)}`,[]);(0,rr.useLayoutEffect)(()=>{let u={id:i,type:"AnnotationPage",behavior:[],label:null,thumbnail:[],summary:null,requiredStatement:null,metadata:[],rights:null,provider:[],items:[],seeAlso:[],homepage:[],rendering:[],service:[]};n(os.importEntities({entities:{AnnotationPage:{[u.id]:u}}}))},[i]);let a=re(u=>i&&u.iiif.entities.AnnotationPage[i]||null,[i]),o=(0,rr.useCallback)((u,d)=>{if(i){if(DD(u)){let m=u;m.__vault||m.bindToVault(t),u=typeof m.source=="string"?m.source:m.source.id,e.current[u]=m}else typeof u!="string"&&(u=u.id);let p=t.get({id:i,type:"AnnotationPage"}),f=t.get({id:u,type:"Annotation"});p&&f&&(p.items.find(m=>m.id===f.id)||n(os.addReference({id:i,type:"AnnotationPage",key:"items",reference:{id:u,type:"Annotation"},index:d})))}},[i]),s=(0,rr.useCallback)(u=>{i&&(DD(u)?u=typeof u.source=="string"?u.source:u.source.id:typeof u!="string"&&(u=u.id),e.current[u]&&e.current[u].beforeRemove(),t.get({id:i,type:"AnnotationPage"})&&n(os.removeReference({id:i,type:"AnnotationPage",key:"items",reference:{id:u,type:"Annotation"}})))},[i]);return[a,{addAnnotation:o,removeAnnotation:s}]}var BD=_(Y(),1),LD=(0,Jc.createContext)(null);function tR(){let t=(0,Jc.useContext)(LD);return[t.fullPage,{addAnnotation:t.addAnnotation,removeAnnotation:t.removeAnnotation}]}function eR({children:t}){let[e,{addAnnotation:n,removeAnnotation:i}]=$A();return(0,BD.jsx)(LD.Provider,{value:(0,Jc.useMemo)(()=>({fullPage:e,addAnnotation:n,removeAnnotation:i}),[e]),children:t})}var Gs=_(Y(),1);function nR({children:t}){let{strategy:e}=Fe(),[n]=tR();return e.type!=="images"?null:(0,Gs.jsxs)(Gs.Fragment,{children:[n?(0,Gs.jsx)(Al,{page:n}):null,e.annotations&&e.annotations.pages?e.annotations.pages.map(i=>(0,Gs.jsx)(Al,{page:i},i.id)):null,t]})}var wl=_(nt(),1);var PD=_(nt(),1),iR=(t,e=[])=>{let n=Vt();(0,PD.useEffect)(()=>{t(n)},[n,...e])};var wv=_(nt(),1);var HD=wv.default.createContext(new tc);function Dh(){return(0,wv.useContext)(HD)}function lr(t,e,{canvasId:n,manifestId:i}={}){let a=Vt(),o=Dh(),s=(0,wl.useMemo)(()=>k1(a,{imageServiceLoader:o}),[a,o]),[u,d]=(0,wl.useState)(),p=on(i?{id:i}:void 0),f=zt(n?{id:n}:void 0),m=f||p,g=(0,wl.useRef)(!1);if((0,wl.useEffect)(()=>(g.current=!1,()=>{g.current=!0}),[]),!m)throw new Error("Must be called under a manifest or canvas context.");return iR(v=>{s.getBestThumbnailAtSize(m,t,e).then(S=>{S.best&&!g.current&&d(S.best)})},[m]),u}var aR=_(Y(),1);function ks({x:t=0,y:e=0}){let n=zt(),i=lr({maxWidth:256,maxHeight:256});return!n||!i||i.type!=="fixed"?null:(0,aR.jsx)("world-object",{height:n.height,width:n.width,x:t,y:e,children:(0,aR.jsx)("world-image",{uri:i.id,target:{x:0,y:0,width:n.width,height:n.height},display:i.width&&i.height?{width:i.width,height:i.height}:void 0,crop:void 0})})}var Mv=_(Y(),1);function oR({as:t}){let{strategy:e}=Fe(),{renderMediaControls:n,mediaControlsDeps:i}=hi();return e.type!=="media"||e.media.type!=="Sound"?null:(0,Mv.jsxs)(Ev,{media:e.media,mediaControlsDeps:i,audioCopmonent:t,children:[(0,Mv.jsx)(ks,{}),n?n(e):null]},e.media.url)}var Lv=_(nt(),1);var Ov=_(nt(),1);var UD=_(Y(),1),rR=(0,Ov.createContext)(null);rR.displayName="ComplexTimeline";function lR({children:t,store:e}){return(0,UD.jsx)(rR.Provider,{value:e,children:t})}function k7(t){let e=(0,Ov.useContext)(rR);if(!e)throw new Error("useComplexTimeline must be used within a ComplexTimelineProvider");return bt(e,t)}function VD({currentKeyFrameIndex:t,keyframes:e,targetTime:n,currentTime:i}){if(i<=n){let a=e.findIndex(u=>u.time>n);if(a===-1)return[t,[]];let o={},s=e.slice(t,a);for(let u of s)u.type==="enter"&&(o[u.id]=u),u.type==="exit"&&(o[u.id]?delete o[u.id]:o[u.id]=u);return[a,Object.values(o)]}return[t,[]]}function jD({complexTimeline:t,startTime:e=0}){let n=ka(),i={},a={progress:null,currentTime:null},o=0,s=null,u=0,d=null;function p(){let x=T.getState().visibleElements,R=i,C=[],M=Object.keys(R);for(let z of M){let N=R[z],D=x[z];N&&D&&C.push(N)}return C}function f(){return Object.keys(i).map(x=>i[x])}function m(A){a.currentTime&&(a.currentTime.innerHTML=xv(A),a.progress&&(a.progress.style.width=`${A/t.duration*100}%`))}let g=()=>{let A=T.getState(),x=A.currentPrime;if(!x)return;let R=i,C=A.visibleElements,M=Object.keys(R);for(let z of M){let N=R[z],D=C[z];if(N&&z!==x.id&&D){let q=u-D.time*1e3;Math.abs(u-D.time*1e3-N.currentTime*1e3)>300&&(N.currentTime=q/1e3)}}},v=(A=0)=>{let x=A-o,R=T.getState();if(R.isPlaying){let C=R.currentPrime;if(C){let D=i[C.id];D&&(D.paused?u+=x:u=(C.time+D.currentTime)*1e3)}else u+=x;let M=u/1e3;if(M>R.duration){T.getState().setTime(0),T.setState({isPlaying:!1}),S(),m(0);return}m(M);let[z,N]=VD({currentTime:M,currentKeyFrameIndex:R.nextKeyframeIndex,keyframes:R.complexTimeline.keyframes,targetTime:M});N.length&&R.applyKeyframes(z,N)}o=A,s=requestAnimationFrame(v)},S=()=>{s&&cancelAnimationFrame(s)},E=(A,x)=>{},T=Yi((A,x)=>({complexTimeline:t,elements:{},visibleElements:{},isBuffering:!1,bufferMap:{},isMuted:!1,playRequested:!1,isPlaying:!1,isFinished:!1,isReady:!1,volume:100,duration:t.duration,clockStartRequests:0,clockStartTime:0,primeTime:0,currentPrime:null,clockRunning:!1,nextKeyframeIndex:0,startClock:()=>{x().clockRunning||(v(),d=setInterval(g,500)),A({clockRunning:!0,clockStartRequests:x().clockStartRequests+1})},applyKeyframes(R,C){let M=x(),z={...M.visibleElements},N=M.currentPrime;for(let D of C)D.type==="enter"&&(z[D.id]=D,n.emit("complex-timeline.enter",{id:D.id})),D.type==="exit"&&(z[D.id]=null,n.emit("complex-timeline.exit",{id:D.id})),D.isPrime&&(N=D);A({nextKeyframeIndex:R,visibleElements:z,currentPrime:N})},stopClock:()=>{let R=x().clockStartRequests;if(R!==0){if(R===1){S(),d&&clearInterval(d),A({clockRunning:!1,clockStartRequests:0});return}A({clockStartRequests:R-1})}},setElement:(R,C)=>{i[R]=C;let M=Object.keys(i),z=x().complexTimeline;E(C,R),z.items.filter(D=>D.type!=="Image"&&D.type!=="Text").every(D=>M.includes(D.annotationId))&&!x().isReady&&(n.emit("complex-timeline.ready",{complexTimeline:z}),A({isReady:!0}))},removeElement:R=>{delete i[R]},mute(){for(let R of f())R.muted=!0;A({isMuted:!0})},unmute(){for(let R of f())R.muted=!1;A({isMuted:!1})},play(){if(!x().isPlaying){for(let C of p())C.play();A({isPlaying:!0})}},pause(){if(x().isPlaying){for(let C of p())C.pause();A({isPlaying:!1})}},playPause(){let R=x();R.isPlaying?R.pause():R.play()},setDurationPercent(R){let M=x().duration*R;x().setTime(M)},setTime(R){let C=x(),M=u/1e3,z=typeof R=="function"?R(M):R,N=C.nextKeyframeIndex;if(M>z){A({visibleElements:{},currentPrime:null});let X=Object.keys(C.visibleElements);for(let tt of X)n.emit("complex-timeline.exit",{id:tt});M=0,N=0}let[D,q]=VD({currentTime:M,currentKeyFrameIndex:N,keyframes:C.complexTimeline.keyframes,targetTime:z});C.applyKeyframes(D,q),u=z*1e3;let U=T.getState().visibleElements,J=i,at=Object.keys(U);for(let X of at){let tt=U[X];if(tt){let ut=J[X];ut&&(ut.currentTime=(u-tt.time*1e3)/1e3)}}m(z)},setVolume(R){for(let C of f())C.volume=Math.min(1,Math.max(0,R/100));A({volume:R})},toggleMute(){let R=x();R.isMuted?(R.unmute(),A({isMuted:!1})):(R.mute(),A({isMuted:!0}))},clearProgressElement(){a.progress=null},setProgressElement(R){a.progress=R},setCurrentTimeElement(R){a.currentTime=R},clearCurrentTimeElement(){a.currentTime=null}}));return n.on("complex-timeline.enter",A=>{let x=T.getState(),R=A.id,C=i[R];C&&x.isPlaying&&C.play()}),n.on("complex-timeline.exit",A=>{let x=T.getState(),R=A.id,C=i[R];C&&(C.currentTime=0,C.pause())}),T.getState().setTime(e),{store:T,emitter:n}}var tf=_(nt(),1);var _v=_(nt(),1);var qD=_v.default.createContext(G1.store);qD.displayName="ImageServicesHelper";function zv(){return(0,_v.useContext)(qD)}function FD(t){let e=zv();return bt(e,({loaded:n})=>n[t])}function $c(){let t=zv();return bt(t,({loadServiceSync:e})=>e)}function GD(){let t=zv();return bt(t,({loaded:e})=>e)}function kD(){let t=zv();return bt(t,({loadService:e})=>e)}var Qa=_(nt(),1),Ya=_(Y(),1),QD=Qa.default.createContext("en"),XD=Qa.default.createContext({}),KD=Qa.default.createContext(null);function Y7(t){return(0,Ya.jsx)(XD.Provider,{value:t.translations,children:t.children})}function Q7(t){return(0,Ya.jsx)(QD.Provider,{value:t.language,children:t.children})}function X7(t){return(0,Ya.jsx)(KD.Provider,{value:t.convert,children:t.children})}function sR(){return Qa.default.useContext(KD)}function Nv(){return Qa.default.useContext(QD)}function uR(){return Qa.default.useContext(XD)}function YD(t){return t.indexOf("-")!==-1?t.slice(0,t.indexOf("-")):t}function ZD({as:t,language:e,children:n,viewingDirection:i,...a}){let o=Nv();return(0,Qa.useMemo)(()=>YD(o)===YD(e),[o,e])?t?(0,Ya.jsx)(t,{...a,children:n}):(0,Ya.jsx)("span",{...a,children:n}):t?(0,Ya.jsx)(t,{...a,lang:e,dir:i,children:n}):(0,Ya.jsx)("span",{...a,lang:e,dir:i,children:n})}function WD(t,e,n){if(e.length===0)return;if(e.length===1)return e[0];if(e.indexOf(t)!==-1)return t;let i=t.indexOf("-")!==-1?t.slice(0,t.indexOf("-")):null;if(i&&e.indexOf(i)!==-1)return i;for(let a of n)if(e.indexOf(a)!==-1)return a;return e.indexOf("none")!==-1?"none":e.indexOf("@none")!==-1?"@none":e[0]}var JD=(t,e=[])=>{let n=Nv();return(0,Qa.useMemo)(()=>{let i=t();return WD(n,i,[])},[n,...e])};function Ys(t,e,n,i){return e?n?n(t[e]||e,i||"none"):t[e]||e:""}function $D(t,e,n=`
|
|
102
|
-
`,i={}){let a=
|
|
103
|
-
`,u=e){let
|
|
104
|
-
`):""}}function
|
|
107
|
+
`}),(0,tl.jsx)("div",{className:"model-container",children:(0,tl.jsx)("model-viewer",{"interaction-prompt":"none",style:{width:"100%",height:"100%"},"camera-controls":"","ar-status":"not-presenting",src:t.id})})]})}function n0({model:t,name:e}){return yi("overlay",`model-${e}`,OR,{model:t},[t]),null}var jD=N(tt(),1);function _R(){let{strategy:t}=dn();return t.type!=="3d-model"?null:(0,jD.jsx)(n0,{model:t.model})}var i0=N(ct(),1),hp=(0,i0.createContext)(null);hp.displayName="Controls";function Bi(){let t=(0,i0.useContext)(hp);if(!t)throw new Error("useStrategy must be used within a StrategyProvider");return t}var Ho=N(tt(),1);function zR(){let{strategy:t}=dn(),{renderViewerControls:e,viewControlsDeps:n}=Bi(),i=Wt(),a=i?.accompanyingCanvas,r=i?.placeholderCanvas;return(0,Ho.jsxs)(Ho.Fragment,{children:[t.type==="media"&&t.media.type==="Sound"&&a?(0,Ho.jsx)(qa,{canvas:a.id,children:(0,Ho.jsx)(Su,{renderViewerControls:e,viewControlsDeps:n})}):null,t.type==="media"&&t.media.type==="Sound"&&r&&!a?(0,Ho.jsx)(qa,{canvas:r.id,children:(0,Ho.jsx)(Su,{renderViewerControls:e,viewControlsDeps:n})}):null]})}var _d=N(ct(),1);var Fo=N(ct(),1);var kD=N(ct(),1);function IR(){let e=ce().getStore();return(0,kD.useMemo)(()=>n=>e.dispatch(n),[e])}function GD(t){return typeof t!="string"&&t&&t.bindToVault}function NR(){let t=ce(),e=(0,Fo.useRef)([]),n=IR(),i=(0,Fo.useMemo)(()=>`vault://annotation-page/${new Date().getTime()}/${Math.round(Math.random()*1e9).toString(16)}`,[]);(0,Fo.useLayoutEffect)(()=>{let u={id:i,type:"AnnotationPage",behavior:[],label:null,thumbnail:[],summary:null,requiredStatement:null,metadata:[],rights:null,provider:[],items:[],seeAlso:[],homepage:[],rendering:[],service:[]};n(Nl.importEntities({entities:{AnnotationPage:{[u.id]:u}}}))},[i]);let a=_e(u=>i&&u.iiif.entities.AnnotationPage[i]||null,[i]),r=(0,Fo.useCallback)((u,f)=>{if(i){if(GD(u)){let m=u;m.__vault||m.bindToVault(t),u=typeof m.source=="string"?m.source:m.source.id,e.current[u]=m}else typeof u!="string"&&(u=u.id);let h=t.get({id:i,type:"AnnotationPage"}),d=t.get({id:u,type:"Annotation"});h&&d&&(h.items.find(m=>m.id===d.id)||n(Nl.addReference({id:i,type:"AnnotationPage",key:"items",reference:{id:u,type:"Annotation"},index:f})))}},[i]),l=(0,Fo.useCallback)(u=>{i&&(GD(u)?u=typeof u.source=="string"?u.source:u.source.id:typeof u!="string"&&(u=u.id),e.current[u]&&e.current[u].beforeRemove(),t.get({id:i,type:"AnnotationPage"})&&n(Nl.removeReference({id:i,type:"AnnotationPage",key:"items",reference:{id:u,type:"Annotation"}})))},[i]);return[a,{addAnnotation:r,removeAnnotation:l}]}var XD=N(tt(),1),YD=(0,_d.createContext)(null);function LR(){let t=(0,_d.useContext)(YD);return[t.fullPage,{addAnnotation:t.addAnnotation,removeAnnotation:t.removeAnnotation}]}function DR({children:t}){let[e,{addAnnotation:n,removeAnnotation:i}]=NR();return(0,XD.jsx)(YD.Provider,{value:(0,_d.useMemo)(()=>({fullPage:e,addAnnotation:n,removeAnnotation:i}),[e]),children:t})}var xu=N(tt(),1);function PR({children:t}){let{strategy:e}=dn(),[n]=LR();return e.type!=="images"?null:(0,xu.jsxs)(xu.Fragment,{children:[n?(0,xu.jsx)(Ws,{page:n}):null,e.annotations&&e.annotations.pages?e.annotations.pages.map(i=>(0,xu.jsx)(Ws,{page:i},i.id)):null,t]})}var el=N(ct(),1);var QD=N(ct(),1),BR=(t,e=[])=>{let n=ce();(0,QD.useEffect)(()=>{t(n)},[n,...e])};var a0=N(ct(),1);var KD=a0.default.createContext(new Oc);function pp(){return(0,a0.useContext)(KD)}function qo(t,e,{canvasId:n,manifestId:i}={}){let a=ce(),r=pp(),l=(0,el.useMemo)(()=>ax(a,{imageServiceLoader:r}),[a,r]),[u,f]=(0,el.useState)(),h=Tn(i?{id:i}:void 0),d=Wt(n?{id:n}:void 0),m=d||h,y=(0,el.useRef)(!1);if((0,el.useEffect)(()=>(y.current=!1,()=>{y.current=!0}),[]),!m)throw new Error("Must be called under a manifest or canvas context.");return BR(g=>{l.getBestThumbnailAtSize(m,t,e).then(b=>{b.best&&!y.current&&f(b.best)})},[m]),u}var HR=N(tt(),1);function wu({x:t=0,y:e=0}){let n=Wt(),i=qo({maxWidth:256,maxHeight:256});return!n||!i||i.type!=="fixed"?null:(0,HR.jsx)("world-object",{height:n.height,width:n.width,x:t,y:e,children:(0,HR.jsx)("world-image",{uri:i.id,target:{x:0,y:0,width:n.width,height:n.height},display:i.width&&i.height?{width:i.width,height:i.height}:void 0,crop:void 0})})}var r0=N(tt(),1);function FR({as:t}){let{strategy:e}=dn(),{renderMediaControls:n,mediaControlsDeps:i}=Bi();return e.type!=="media"||e.media.type!=="Sound"?null:(0,r0.jsxs)($v,{media:e.media,mediaControlsDeps:i,audioCopmonent:t,children:[(0,r0.jsx)(wu,{}),n?n(e):null]},e.media.url)}var f0=N(ct(),1);var o0=N(ct(),1);var ZD=N(tt(),1),qR=(0,o0.createContext)(null);qR.displayName="ComplexTimeline";function UR({children:t,store:e}){return(0,ZD.jsx)(qR.Provider,{value:e,children:t})}function j7(t){let e=(0,o0.useContext)(qR);if(!e)throw new Error("useComplexTimeline must be used within a ComplexTimelineProvider");return zt(e,t)}function WD({currentKeyFrameIndex:t,keyframes:e,targetTime:n,currentTime:i}){if(i<=n){let a=e.findIndex(u=>u.time>n);if(a===-1)return[t,[]];let r={},l=e.slice(t,a);for(let u of l)u.type==="enter"&&(r[u.id]=u),u.type==="exit"&&(r[u.id]?delete r[u.id]:r[u.id]=u);return[a,Object.values(r)]}return[t,[]]}function JD({complexTimeline:t,startTime:e=0}){let n=vr(),i={},a={progress:null,currentTime:null},r=0,l=null,u=0,f=null;function h(){let S=E.getState().visibleElements,R=i,A=[],M=Object.keys(R);for(let z of M){let I=R[z],L=S[z];I&&L&&A.push(I)}return A}function d(){return Object.keys(i).map(S=>i[S])}function m(T){a.currentTime&&(a.currentTime.innerHTML=Jv(T),a.progress&&(a.progress.style.width=`${T/t.duration*100}%`))}let y=()=>{let T=E.getState(),S=T.currentPrime;if(!S)return;let R=i,A=T.visibleElements,M=Object.keys(R);for(let z of M){let I=R[z],L=A[z];if(I&&z!==S.id&&L){let H=u-L.time*1e3;Math.abs(u-L.time*1e3-I.currentTime*1e3)>300&&(I.currentTime=H/1e3)}}},g=(T=0)=>{let S=T-r,R=E.getState();if(R.isPlaying){let A=R.currentPrime;if(A){let L=i[A.id];L&&(L.paused?u+=S:u=(A.time+L.currentTime)*1e3)}else u+=S;let M=u/1e3;if(M>R.duration){E.getState().setTime(0),E.setState({isPlaying:!1}),b(),m(0);return}m(M);let[z,I]=WD({currentTime:M,currentKeyFrameIndex:R.nextKeyframeIndex,keyframes:R.complexTimeline.keyframes,targetTime:M});I.length&&R.applyKeyframes(z,I)}r=T,l=requestAnimationFrame(g)},b=()=>{l&&cancelAnimationFrame(l)},w=(T,S)=>{},E=ya((T,S)=>({complexTimeline:t,elements:{},visibleElements:{},isBuffering:!1,bufferMap:{},isMuted:!1,playRequested:!1,isPlaying:!1,isFinished:!1,isReady:!1,volume:100,duration:t.duration,clockStartRequests:0,clockStartTime:0,primeTime:0,currentPrime:null,clockRunning:!1,nextKeyframeIndex:0,startClock:()=>{S().clockRunning||(g(),f=setInterval(y,500)),T({clockRunning:!0,clockStartRequests:S().clockStartRequests+1})},applyKeyframes(R,A){let M=S(),z={...M.visibleElements},I=M.currentPrime;for(let L of A)L.type==="enter"&&(z[L.id]=L,n.emit("complex-timeline.enter",{id:L.id})),L.type==="exit"&&(z[L.id]=null,n.emit("complex-timeline.exit",{id:L.id})),L.isPrime&&(I=L);T({nextKeyframeIndex:R,visibleElements:z,currentPrime:I})},stopClock:()=>{let R=S().clockStartRequests;if(R!==0){if(R===1){b(),f&&clearInterval(f),T({clockRunning:!1,clockStartRequests:0});return}T({clockStartRequests:R-1})}},setElement:(R,A)=>{i[R]=A;let M=Object.keys(i),z=S().complexTimeline;w(A,R),z.items.filter(L=>L.type!=="Image"&&L.type!=="Text").every(L=>M.includes(L.annotationId))&&!S().isReady&&(n.emit("complex-timeline.ready",{complexTimeline:z}),T({isReady:!0}))},removeElement:R=>{delete i[R]},mute(){for(let R of d())R.muted=!0;T({isMuted:!0})},unmute(){for(let R of d())R.muted=!1;T({isMuted:!1})},play(){if(!S().isPlaying){for(let A of h())A.play();T({isPlaying:!0})}},pause(){if(S().isPlaying){for(let A of h())A.pause();T({isPlaying:!1})}},playPause(){let R=S();R.isPlaying?R.pause():R.play()},setDurationPercent(R){let M=S().duration*R;S().setTime(M)},setTime(R){let A=S(),M=u/1e3,z=typeof R=="function"?R(M):R,I=A.nextKeyframeIndex;if(M>z){T({visibleElements:{},currentPrime:null});let lt=Object.keys(A.visibleElements);for(let it of lt)n.emit("complex-timeline.exit",{id:it});M=0,I=0}let[L,H]=WD({currentTime:M,currentKeyFrameIndex:I,keyframes:A.complexTimeline.keyframes,targetTime:z});A.applyKeyframes(L,H),u=z*1e3;let nt=E.getState().visibleElements,X=i,mt=Object.keys(nt);for(let lt of mt){let it=nt[lt];if(it){let yt=X[lt];yt&&(yt.currentTime=(u-it.time*1e3)/1e3)}}m(z)},setVolume(R){for(let A of d())A.volume=Math.min(1,Math.max(0,R/100));T({volume:R})},toggleMute(){let R=S();R.isMuted?(R.unmute(),T({isMuted:!1})):(R.mute(),T({isMuted:!0}))},clearProgressElement(){a.progress=null},setProgressElement(R){a.progress=R},setCurrentTimeElement(R){a.currentTime=R},clearCurrentTimeElement(){a.currentTime=null}}));return n.on("complex-timeline.enter",T=>{let S=E.getState(),R=T.id,A=i[R];A&&S.isPlaying&&A.play()}),n.on("complex-timeline.exit",T=>{let S=E.getState(),R=T.id,A=i[R];A&&(A.currentTime=0,A.pause())}),E.getState().setTime(e),{store:E,emitter:n}}var Id=N(ct(),1);var s0=N(ct(),1);var $D=s0.default.createContext(ix.store);$D.displayName="ImageServicesHelper";function l0(){return(0,s0.useContext)($D)}function tP(t){let e=l0();return zt(e,({loaded:n})=>n[t])}function zd(){let t=l0();return zt(t,({loadServiceSync:e})=>e)}function eP(){let t=l0();return zt(t,({loaded:e})=>e)}function nP(){let t=l0();return zt(t,({loadService:e})=>e)}var Sr=N(ct(),1),br=N(tt(),1),aP=Sr.default.createContext("en"),rP=Sr.default.createContext({}),oP=Sr.default.createContext(null);function k7(t){return(0,br.jsx)(rP.Provider,{value:t.translations,children:t.children})}function G7(t){return(0,br.jsx)(aP.Provider,{value:t.language,children:t.children})}function Y7(t){return(0,br.jsx)(oP.Provider,{value:t.convert,children:t.children})}function VR(){return Sr.default.useContext(oP)}function u0(){return Sr.default.useContext(aP)}function jR(){return Sr.default.useContext(rP)}function iP(t){return t.indexOf("-")!==-1?t.slice(0,t.indexOf("-")):t}function sP({as:t,language:e,children:n,viewingDirection:i,...a}){let r=u0();return(0,Sr.useMemo)(()=>iP(r)===iP(e),[r,e])?t?(0,br.jsx)(t,{...a,children:n}):(0,br.jsx)("span",{...a,children:n}):t?(0,br.jsx)(t,{...a,lang:e,dir:i,children:n}):(0,br.jsx)("span",{...a,lang:e,dir:i,children:n})}function lP(t,e,n){if(e.length===0)return;if(e.length===1)return e[0];if(e.indexOf(t)!==-1)return t;let i=t.indexOf("-")!==-1?t.slice(0,t.indexOf("-")):null;if(i&&e.indexOf(i)!==-1)return i;for(let a of n)if(e.indexOf(a)!==-1)return a;return e.indexOf("none")!==-1?"none":e.indexOf("@none")!==-1?"@none":e[0]}var uP=(t,e=[])=>{let n=u0();return(0,Sr.useMemo)(()=>{let i=t();return lP(n,i,[])},[n,...e])};function Tu(t,e,n,i){return e?n?n(t[e]||e,i||"none"):t[e]||e:""}function cP(t,e,n=`
|
|
108
|
+
`,i={}){let a=VR(),r=uP(()=>Object.keys(t||{}),[t]);return[(0,Sr.useMemo)(()=>{if(!t)return Tu(i,e,a)||"";if(typeof t=="string")return Tu(i,t,a);let l=r?t[r]:void 0;return l?typeof l=="string"?l:l.map(u=>Tu(i,u,a,r)).join(n):""},[r,e,t]),r]}function X7(){let t=u0(),e=jR(),n=VR();return function(a,r="",l=`
|
|
109
|
+
`,u=e){let f=Object.keys(a||{}),h=lP(t,f,[]);if(!a)return Tu(u,r,n)||"";if(typeof a=="string")return Tu(u,a,n);let d=h?a[h]:void 0;return d?typeof d=="string"?Tu(u,d,n,h):d.map(m=>Tu(u,m,n,h)).join(typeof l<"u"?l:`
|
|
110
|
+
`):""}}function _a({as:t,defaultText:e,enableDangerouslySetInnerHTML:n,children:i,separator:a,...r}){let l=jR(),[u,f]=cP(i,e,a,l);return f?(0,br.jsx)(sP,{...r,as:t,language:f,title:n?void 0:u,dangerouslySetInnerHTML:n?{__html:u}:void 0,children:n?void 0:u}):t?(0,br.jsx)(t,{...r,children:u}):(0,br.jsx)("span",{...r,title:n?void 0:u,dangerouslySetInnerHTML:n?{__html:u}:void 0,children:n?void 0:u})}var c0=N(ct(),1),Ru=N(tt(),1),kR=t=>{let e=t.format||"jpg",n=t.width/(t.crop?.width||t.tiles.width),i=t.tiles.imageService.sizes||[],a=t.enableThumbnail,r=t.enableSizes,l=(0,c0.useMemo)(()=>{let h=t.tiles.imageService.id||t.tiles.imageService["@id"];return h?.endsWith("/info.json")?h.slice(0,-1*10):h},[t.tiles.imageService.id,t.tiles.imageService["@id"]]),u=(0,c0.useMemo)(()=>{let h=t.tiles.imageService.tiles||[];if(!h.length){let d=t.width,m=[1],y=1;for(;2**y<d;)y=y*2,m.push(y);return(t.tiles.imageService.maxArea||t.tiles.imageService.maxWidth||t.tiles.imageService.maxHeight)&&Mc(2,t.tiles.imageService)?[{width:256,height:256,scaleFactors:m}]:Mc(2,t.tiles.imageService)?[{width:256,height:256,scaleFactors:m}]:[]}return h},[t.tiles.imageService,t.width]),f=(0,c0.useMemo)(()=>{let h=t.tiles.imageService;return(h?h["@context"]?Array.isArray(h["@context"])?h["@context"]:[h["@context"]]:[]:[]).indexOf("http://iiif.io/api/image/3/context.json")!==-1},[t.tiles.imageService.id,t.tiles.imageService]);return(0,Ru.jsx)("world-object",{rotation:t.rotation,scale:n,height:t.crop?.height||t.tiles.height,width:t.crop?.width||t.tiles.width,x:t.x,y:t.y,onClick:t.onClick,children:(0,Ru.jsxs)("composite-image",{id:t.tiles.imageService.id,width:t.crop?.width||t.tiles.width,height:t.crop?.height||t.tiles.height,crop:t.crop,renderOptions:t.renderOptions,children:[a&&t.tiles.thumbnail?(0,Ru.jsx)("world-image",{priority:!0,uri:t.tiles.thumbnail.id,target:{width:t.tiles.width,height:t.tiles.height},display:{width:t.tiles.thumbnail.width,height:t.tiles.thumbnail.height},crop:t.crop}):null,r&&i.map((h,d)=>(0,Ru.jsx)("world-image",{uri:`${l}/full/${h.width},${f?h.height:""}/0/default.${e}`,target:{width:t.tiles.width,height:t.tiles.height},display:{width:h.width,height:h.height},crop:t.crop},d)),u.map(h=>(h.scaleFactors||[]).map(d=>(0,Ru.jsx)("tiled-image",{uri:t.tiles.imageService.id,display:{width:t.tiles.width,height:t.tiles.height},format:e,tile:h,scaleFactor:d,crop:t.crop,version3:f},`${t.tiles.imageService.id}-tile-${d}`)))]},t.tiles.imageService.id)},t.tiles.imageService.id)};var $a=N(tt(),1);function Q7({resource:t,heading:e,note:n,extra:i}){return i?(0,$a.jsx)(ea,{target:{x:0,y:0,width:i.target?.spatial.width,height:i.target?.spatial.height},backgroundColor:"#333",relative:!0,children:(0,$a.jsx)("div",{style:{display:"flex",alignContent:"center",justifyContent:"center",alignItems:"center",height:"100%",width:"100%",background:"#444",color:"#BBB"},children:(0,$a.jsxs)("div",{children:[(0,$a.jsx)(_a,{children:e||"Not authorised"}),n&&(0,$a.jsx)("p",{children:(0,$a.jsx)(_a,{children:n})}),(0,$a.jsx)("p",{children:t.id||t["@id"]||"unknown"})]})})}):null}function dP({image:t,thumbnail:e,crop:n,enableSizes:i,enableThumbnail:a,renderOptions:r,rotation:l,manualRotation:u}){let f=X1(),h=ke(t.service),d=tP(h),m=zd(),y=d?.service;m(t.service,t);let g=y&&d?.status==="done",b=(y?.preferredFormats||[])[0],w=e&&e.type==="fixed"&&e.id&&!e.id.includes("/full/full/")&&!e.id.includes("/max/")?e:void 0;if(g===!1)return null;if(!f){let E=t.service,T=E.width||t.width||0,S=E.height||t.height||0,R=0,A=0,M=t.target?.spatial.width||T,z=t.target?.spatial.height||S,I=M,L=z;return(l===90||l===270)&&!u&&([M,z]=[z,M],R=(I-M)/2,A=(L-z)/2),u&&([M,z]=[z,M]),(0,$a.jsx)(kR,{enableThumbnail:a,renderOptions:r,rotation:l,tiles:{id:E.id||E["@id"]||"unknown",height:S,width:T,imageService:E,thumbnail:w},enableSizes:i,x:R,y:A,format:b,width:M,height:z,crop:n})}return(0,$a.jsx)(Q1,{resource:t.service,errorComponent:Q7,extra:t,children:E=>{let T=E.width||t.width||0,S=E.height||t.height||0,R=0,A=0,M=t.target?.spatial.width||T,z=t.target?.spatial.height||S,I=M,L=z;return(l===90||l===270)&&!u&&([M,z]=[z,M],R=(I-M)/2,A=(L-z)/2),(0,$a.jsx)(kR,{enableThumbnail:a,renderOptions:r,tiles:{id:E.id||E["@id"]||"unknown",height:S,width:T,imageService:E,thumbnail:w},rotation:l,format:b,enableSizes:i,x:R,y:A,width:M,height:z,crop:n})}},t.id)}var nl=N(tt(),1);function il({id:t,image:e,thumbnail:n,isStatic:i,x:a=0,y:r=0,children:l,selector:u,onClick:f,rotation:h,enableSizes:d,enableAnnotations:m}){let y=(0,Id.useMemo)(()=>{if(!(!u||u.spatial.x===0&&u.spatial.y===0))return u.spatial},[u]),g=(0,Id.useMemo)(()=>{if(typeof e.rotation<"u")return e.rotation;if(!e.annotation)return 0;let M=Array.isArray(e.annotation.body)?e.annotation.body?.[0]:e.annotation.body;if(M&&M.selector?.type==="ImageApiSelector")return Number(M.selector.rotation)},[e]),b=!!e.service,w=a+e.target.spatial.x,E=r+e.target.spatial.y,T=e.target.spatial.width,S=e.target.spatial.height,R=e.target.spatial.width,A=e.target.spatial.height;return(g===90||g===270)&&([R,A]=[A,R],b||([T,S]=[S,T],w+=(e.target.spatial.width-T)/2,E+=(e.target.spatial.height-S)/2)),(0,nl.jsxs)("world-object",{x:w,y:E,width:T,height:S,onClick:f,rotation:e.service?void 0:typeof h<"u"?h:g,children:[e.service?(0,nl.jsxs)(Id.Fragment,{children:[(0,nl.jsx)(dP,{image:e,thumbnail:n,crop:y,enableSizes:d,rotation:typeof h<"u"?h:g,manualRotation:typeof h<"u"}),l]},"service"):(0,nl.jsxs)(Id.Fragment,{children:[(0,nl.jsx)("world-image",{onClick:f,uri:e.id,target:{x:0,y:0,width:R,height:A},display:R&&A?{width:R,height:A}:void 0,crop:y}),l]},"no-service"),m&&e.annotationPages?e.annotationPages.map(M=>(0,nl.jsx)(Ws,{page:M,className:"image-service-annotation",ignoreTargetId:!0},M.id)):null]},t+(b?"server":"no-service")+h)}var Uo=N(tt(),1);function d0({strategy:t,onClickPaintingAnnotation:e}){return(0,Uo.jsx)(Uo.Fragment,{children:t.items.map((n,i)=>(0,Uo.jsx)(Uo.Fragment,{children:(0,Uo.jsx)(ea,{onClick:e?a=>{a.stopPropagation(),e(n.annotationId,n,a)}:void 0,target:n.target?.spatial||void 0,children:(0,Uo.jsx)("div",{"data-textual-content":!0,children:(0,Uo.jsx)(_a,{enableDangerouslySetInnerHTML:!0,children:n.text})})},i)}))})}var tr=N(tt(),1);function fP({strategy:t,children:e}){let{store:n}=(0,f0.useMemo)(()=>JD({complexTimeline:t}),[t]),i=zt(n,l=>l.isReady),a=zt(n,l=>l.visibleElements);function r(l){return u=>{u&&n.getState().setElement(l,u)}}return(0,f0.useLayoutEffect)(()=>{if(i){let{startClock:l,stopClock:u}=n.getState();return l(),()=>{u()}}},[t,i]),yi("portal","custom-controls",UR,{store:n,children:e},[i]),(0,tr.jsxs)(tr.Fragment,{children:[t.items.map(l=>l.type!=="Image"||!a[l.annotationId]?null:(0,tr.jsx)(il,{image:l,id:l.annotationId},l.id)),t.items.map((l,u)=>l.type!=="Text"||!a[l.annotationId]?null:(0,tr.jsx)(d0,{strategy:{type:"textual-content",items:[l]}},u)),t.items.map((l,u)=>l.type!=="Video"||!l.target.spatial?null:(0,tr.jsx)(ea,{target:l.target.spatial,children:(0,tr.jsx)("video",{ref:r(l.annotationId),src:l.url,style:{height:"100%",width:"100%",opacity:a[l.annotationId]?1:0}})},u)),t.items.map((l,u)=>l.type!=="Sound"?null:(0,tr.jsx)(ea,{children:(0,tr.jsx)("audio",{ref:r(l.annotationId),src:l.url})},u)),t.highlights.map(({annotation:l})=>a[l.id]?(0,tr.jsx)(yu,{id:l.id,ignoreTargetId:!0,style:{outline:"3px solid red"},className:"image-service-annotation"},l.id):null)]})}var hP=N(tt(),1);function GR(){let{strategy:t}=dn(),{renderComplexTimelineControls:e}=Bi();return t.type!=="complex-timeline"?null:(0,hP.jsx)(fP,{strategy:t,children:e?e(t):null})}var pP=N(tt(),1);function h0({style:t}){let e=Wt();return!e||!e.height||!e.width?null:(0,pP.jsx)("box",{interactive:!1,target:{x:0,y:0,width:Number(e.width),height:Number(e.height)},style:t})}var mP=N(tt(),1);function YR({backgroundStyle:t,alwaysShowBackground:e}){let{strategy:n}=dn();return n.type!=="empty"&&!e?null:(0,mP.jsx)(h0,{style:t})}var p0=N(ct(),1),xr=(0,p0.createContext)(null);function mp(){return(0,p0.useContext)(xr)}var Nd=N(tt(),1);function XR({isStatic:t=!1,enableSizes:e=!1,enableAnnotations:n=!0,onClickPaintingAnnotation:i,rotation:a,children:r}){let{strategy:l}=dn(),{renderViewerControls:u,viewControlsDeps:f}=Bi(),h=Wt(),d=mp(),m=qo({maxWidth:256,maxHeight:256});if(yi(d&&l.type==="images"&&u?"overlay":"none",`canvas-portal-controls-${h?.id}`,xr.Provider,u?{value:d||null,children:u(l)}:{},[h,d,l,...f||[]]),l.type!=="images")return null;let y=l.images.length===1?a:0;return(0,Nd.jsxs)(Nd.Fragment,{children:[l.images.map((g,b)=>(0,Nd.jsx)(il,{isStatic:t,image:g,id:g.id,thumbnail:b===0?m:void 0,selector:g.selector,enableSizes:e,enableAnnotations:n,rotation:y,onClick:i?w=>{i(g.annotationId,g,w)}:void 0},g.id+b)),r]})}var Ld=N(tt(),1);function QR({onClickPaintingAnnotation:t,children:e}){let{strategy:n}=dn(),{renderViewerControls:i,viewControlsDeps:a}=Bi(),r=mp(),l=Wt();return yi(r&&n.type==="textual-content"&&i?"overlay":"none",`canvas-portal-controls-${l?.id}`,xr.Provider,i?{value:r||null,children:i(n)}:{},[l,r,n,...a||[]]),n.type!=="textual-content"?null:(0,Ld.jsxs)(Ld.Fragment,{children:[(0,Ld.jsx)(d0,{strategy:n,onClickPaintingAnnotation:t}),e]})}var gp=N(tt(),1);function KR({element:t,media:e,startTime:n,playPause:i,poster:a}){let r="div",l=n?`${e.url}#t=${n}`:e.url;return(0,gp.jsxs)(r,{className:"video-container",part:"video-container",onClick:i,children:[(0,gp.jsx)("style",{children:`
|
|
105
111
|
.video-container {
|
|
106
112
|
position: absolute;
|
|
107
113
|
top: 0;
|
|
@@ -114,7 +120,7 @@ Error generating stack: `+i.message+`
|
|
|
114
120
|
justify-content: center;
|
|
115
121
|
pointer-events: visible;
|
|
116
122
|
}
|
|
117
|
-
`}),(0,
|
|
123
|
+
`}),(0,gp.jsx)("video",{poster:a,ref:t,src:l,style:{width:"100%",objectFit:"contain"}})]})}function m0({media:t,mediaControlsDeps:e,children:n,videoComponent:i=KR,captions:a}){let r=Wt(),l=fp(),u=r&&r.placeholderCanvas&&r.placeholderCanvas.id||void 0,f=qo({},!1,{canvasId:u}),[{element:h,currentTime:d,progress:m},y,g]=vu({duration:t.duration});return yi("overlay","video-element",i,{element:h,media:t,playPause:g.playPause,poster:f?.id,canvas:r,startTime:l?l.startTime:null,captions:a},[f]),yi("portal","custom-controls",dp,{state:y,actions:g,currentTime:d,progress:m,element:h,children:n},[d,y,t,...e||[]]),null}var g0=N(tt(),1);function ZR({as:t}){let{strategy:e}=dn(),{renderMediaControls:n,mediaControlsDeps:i}=Bi();return e.type!=="media"||e.media.type!=="Video"?null:(0,g0.jsxs)(m0,{captions:e.captions,media:e.media,mediaControlsDeps:i,videoComponent:t,children:[(0,g0.jsx)(wu,{}),n?n(e):null]},e.media.url)}var gP=N(ct(),1),yp=N(tt(),1);function K7({element:t,media:e,playPause:n}){let i=(0,gP.useRef)(null);return e.youTubeId?(0,yp.jsxs)("div",{className:"video-container",part:"video-container",onClick:n,children:[(0,yp.jsx)("style",{children:`
|
|
118
124
|
.video-container {
|
|
119
125
|
position: absolute;
|
|
120
126
|
top: 0;
|
|
@@ -132,7 +138,7 @@ Error generating stack: `+i.message+`
|
|
|
132
138
|
width: 100%;
|
|
133
139
|
object-fit: contain;
|
|
134
140
|
}
|
|
135
|
-
`}),(0,Ph.jsx)("iframe",{className:"video-yt",ref:i,src:`https://www.youtube.com/embed/${e.youTubeId}?enablejsapi=1&origin=${window.location.host}`,referrerPolicy:"no-referrer",sandbox:"allow-scripts allow-same-origin allow-presentation"})]}):null}function rL({media:t,mediaControlsDeps:e,children:n}){let[{element:i,currentTime:a,progress:o},s,u]=js({duration:t.duration});return Xn("overlay","video-element",W7,{element:i,media:t,playPause:u.playPause}),null}var Vv=_(Y(),1);function yR(){let{strategy:t}=Fe(),{renderMediaControls:e,mediaControlsDeps:n}=hi();return t.type!=="media"||t.media.type!=="VideoYouTube"?null:(0,Vv.jsxs)(rL,{media:t.media,mediaControlsDeps:n,children:[(0,Vv.jsx)(ks,{}),e?e(t):null]})}var e0=_(nt(),1);var zl=_(nt(),1);var ii=_(nt(),1);function vR(t){let e=Ie(),n=bt(e,o=>o.polygons),i=bt(e,o=>o.polygonState),a=bt(e,o=>o.polygon);return Ps("atlas.polygon-render",({state:o,slowState:s,dt:u})=>{t(o,s,u)}),{currentShape:a,state:i,helper:n}}var Jt=_(Y(),1),ur=dD(),lL={shapeFill:"#ffffff33",shapeStroke:"#000",lineStroke:"#000",ghostLineStroke:"#0F0",activeLineStroke:"#4D7EEA",boundingBoxDottedStroke:"#0007",boundingBoxStroke:"#fffA",controlFill:"#fff"};function SR(t){let{image:e}=t,n={...lL,...t.theme||{}},i=(0,ii.useRef)(),a=(0,ii.useRef)(),o=(0,ii.useRef)(),s=(0,ii.useRef)(),u=(0,ii.useRef)(),d=(0,ii.useRef)(),p=(0,ii.useRef)(),f=(0,ii.useRef)(),m=(0,ii.useRef)(),g=(0,ii.useRef)(),[v,S]=(0,ii.useState)(null),[E,T]=(0,ii.useState)(!1),{helper:A,state:x,currentShape:R}=vR((U,J)=>{if(U.closestLineIndex,ur.updateTransitionBoundingBox(o.current,U,J),ur.updateBoundingBoxPolygon(i.current,U,J),ur.updateBoundingBoxPolygon(a.current,U,J),ur.updateTransitionShape(p.current,U,J),ur.updateClosestLinePointTransform(u.current,U,J),ur.updateSelectBox(s.current,U,J),ur.updatePointLine(f.current,U,J),ur.updateDrawPreview(d.current,U,J,3),ur.updateLineBox(m.current,U),S(U.transitionDirection),T(U.transitionRotate),U.closestLineIndex!==-1&&g.current){let at=U.polygon,X=at.points[U.closestLineIndex],tt=at.points[(U.closestLineIndex+1)%at.points.length];X&&tt&&g.current.setAttribute("points",`${X[0]},${X[1]} ${tt[0]},${tt[1]}`)}});(0,ii.useEffect)(()=>{let U=()=>{A.modifiers.reset()};return document.addEventListener("mouseleave",U),()=>{document.removeEventListener("mouseleave",U)}},[]);let C=(0,Jt.jsxs)(Jt.Fragment,{children:[(0,Jt.jsxs)("marker",{id:"dot",viewBox:"0 0 10 10",refX:"5",refY:"5",markerWidth:"5",markerHeight:"5",children:[(0,Jt.jsx)("circle",{cx:"5",cy:"5",r:"5",fill:n.lineStroke,className:"marker"}),(0,Jt.jsx)("circle",{cx:"5",cy:"5",r:"3",fill:n.controlFill})]}),(0,Jt.jsx)("marker",{id:"newdot",viewBox:"0 0 10 10",refX:"5",refY:"5",markerWidth:"5",markerHeight:"5",children:(0,Jt.jsx)("circle",{cx:"5",cy:"5",r:"5",fill:n.activeLineStroke,className:"marker"})}),(0,Jt.jsxs)("marker",{id:"selected",viewBox:"0 0 10 10",refX:"5",refY:"5",markerWidth:"5",markerHeight:"5",children:[(0,Jt.jsx)("circle",{cx:"5",cy:"5",r:"5",fill:n.lineStroke}),(0,Jt.jsx)("circle",{cx:"5",cy:"5",r:"3",fill:n.activeLineStroke})]}),(0,Jt.jsxs)("marker",{id:"resizer",viewBox:"0 0 10 10",refX:"5",refY:"5",markerWidth:"6",markerHeight:"6",children:[(0,Jt.jsx)("rect",{width:"10",height:"10",fill:n.lineStroke}),(0,Jt.jsx)("rect",{x:"1",y:"1",width:"8",height:"8",fill:n.controlFill})]})]}),M=R?R.open?"polyline":"polygon":null,z=!x.showBoundingBox&&x.closestPoint!==null&&x.actionIntentType==="select-point",N=x.actionIntentType==="add-open-point",D=x.transitionIntentType==="split-line",q=x.transitioning&&x.selectedStamp&&x.transitionIntentType==="stamp-shape",P=R&&M?(0,Jt.jsxs)(Jt.Fragment,{children:[(0,Jt.jsx)(M,{fill:(!x.transitioning||x.transitionIntentType==="select-multiple-points")&&!R.open?n.shapeFill:"none",strokeWidth:q||x.showBoundingBox&&x.boxMode||x.transitioning&&x.transitionIntentType==="split-line"||x.transitioning&&x.transitionIntentType==="move-point"?0:2,stroke:n.shapeStroke,points:R.points.map(U=>U.join(",")).join(" "),vectorEffect:"non-scaling-stroke",markerStart:x.showBoundingBox?void 0:x.boxMode?"url(#resizer)":"url(#dot)",markerMid:x.showBoundingBox?void 0:x.boxMode?"url(#resizer)":"url(#dot)",markerEnd:x.showBoundingBox?void 0:x.boxMode?"url(#resizer)":"url(#dot)",style:{pointerEvents:"none"},opacity:x.transitioning&&x.transitionIntentType==="move-shape"?0:1}),x.currentTool==="lineBox"&&x.actionIntentType==="close-line-box"?(0,Jt.jsx)("polygon",{fill:n.shapeFill,ref:m,stroke:n.lineStroke,strokeWidth:2,vectorEffect:"non-scaling-stroke"}):null,x.transitionIntentType==="draw-shape"&&x.transitioning?(0,Jt.jsx)("polyline",{ref:d,fill:"none",stroke:n.activeLineStroke,strokeWidth:2,vectorEffect:"non-scaling-stroke"}):null,!(x.transitioning&&x.transitionIntentType==="move-point")&&!(x.transitioning&&x.transitionIntentType==="stamp-shape")&&!x.showBoundingBox&&x.selectedPoints&&x.selectedPoints.length?(0,Jt.jsx)("polyline",{strokeWidth:2,vectorEffect:"non-scaling-stroke",stroke:"transparent",markerStart:"url(#selected)",markerMid:"url(#selected)",markerEnd:"url(#selected)",fill:"transparent",points:R.points.filter((U,J)=>x.selectedPoints?.includes(J)).map(U=>U.join(",")).join(" "),opacity:x.transitioning&&x.transitionIntentType==="move-shape"?0:1}):null,z&&!x.transitioning&&x.closestPoint!==null&&R.points[x.closestPoint]?(0,Jt.jsx)("polyline",{strokeWidth:2,vectorEffect:"non-scaling-stroke",stroke:"transparent",markerStart:"url(#selected)",markerMid:"url(#selected)",markerEnd:"url(#selected)",fill:n.activeLineStroke,points:`${R.points[x.closestPoint][0]},${R.points[x.closestPoint][1]}`,opacity:x.transitioning&&x.transitionIntentType==="move-shape"?0:1}):null,!x.transitioning&&(x.actionIntentType==="add-open-point"||x.actionIntentType==="close-shape"||x.actionIntentType==="close-shape-line")?(0,Jt.jsx)("polyline",{stroke:n.activeLineStroke,ref:f,strokeWidth:x.actionIntentType==="add-open-point"?1:2,vectorEffect:"non-scaling-stroke"}):null,x.hasClosestLine&&!x.showBoundingBox&&!x.transitioning&&x.currentTool!=="box"&&x.transitionIntentType==="split-line"?(0,Jt.jsx)("g",{children:(0,Jt.jsx)("polyline",{ref:g,vectorEffect:"non-scaling-stroke",fill:"transparent",stroke:n.activeLineStroke,strokeWidth:3})}):null,x.hasClosestLine&&!x.showBoundingBox&&!x.transitioning&&x.currentTool!=="box"&&x.transitionIntentType==="split-line"?(0,Jt.jsx)("g",{ref:u,children:(0,Jt.jsx)("polyline",{markerStart:"url(#newdot)",points:"0,0 1,1",vectorEffect:"non-scaling-stroke",stroke:"transparent",fill:"transparent",strokeWidth:2})}):null,x.transitioning?(0,Jt.jsx)(M,{ref:p,fill:R.open?"none":n.shapeFill,stroke:x.transitionIntentType==="stamp-shape"?n.activeLineStroke:n.shapeStroke,vectorEffect:"non-scaling-stroke",strokeWidth:(R.open,2)}):null,x.transitioning&&x.transitionIntentType==="select-multiple-points"?(0,Jt.jsx)("rect",{ref:s,fill:"rgba(255, 255, 255, .3)",strokeWidth:1,stroke:"rgba(0,0,0,.2)",vectorEffect:"non-scaling-stroke"}):null,x.showBoundingBox&&!q?(0,Jt.jsxs)(Jt.Fragment,{children:[(0,Jt.jsx)("polygon",{ref:i,strokeWidth:2,stroke:n.boundingBoxStroke,fill:"none",markerStart:"url(#resizer)",markerMid:"url(#resizer)",markerEnd:"url(#resizer)",vectorEffect:"non-scaling-stroke"}),(0,Jt.jsx)("polygon",{ref:a,strokeWidth:2,stroke:n.boundingBoxDottedStroke,fill:"none",strokeDasharray:"4 4",markerStart:"url(#resizer)",markerMid:"url(#resizer)",markerEnd:"url(#resizer)",vectorEffect:"non-scaling-stroke"})]}):null]}):null;return{currentTool:A.state.slowState.currentTool,setCurrentTool:A.tools.setTool,helper:A,currentShape:R,state:x,isAddingPoint:N,isSplitting:D,isStamping:q,isHoveringPoint:z,transitionDirection:v,transitionRotate:E,defs:C,editor:P}}var _l=_(Y(),1);function sL(t){let e=fv(),{image:n}=t,{helper:i,defs:a,editor:o,state:s,transitionDirection:u,isSplitting:d,transitionRotate:p,isHoveringPoint:f,isAddingPoint:m}=SR({image:t.image,theme:t.theme}),g=(0,zl.useCallback)(E=>{E.button!==2&&i.pointer([[~~E.atlas.x,~~E.atlas.y]])},[i]),v=(0,zl.useCallback)(E=>{E.button!==2&&i.pointerDown()},[i]),S=(0,zl.useCallback)(E=>{E.button!==2&&i.pointerUp()},[i]);return(0,zl.useEffect)(()=>{let E=T=>{i.key.up(T.key)};return document.addEventListener("keyup",E),()=>{document.removeEventListener("keyup",E)}},[i]),(0,zl.useEffect)(()=>{let E=T=>{T.target&&["INPUT","TEXTAREA"].includes(T.target.tagName)||T.target?.isContentEditable||document.activeElement&&(document.activeElement instanceof HTMLInputElement||document.activeElement instanceof HTMLTextAreaElement||document.activeElement.isContentEditable)||i.key.down(T.key)};return document.addEventListener("keydown",E),()=>{document.removeEventListener("keydown",E)}},[i]),(0,zl.useEffect)(()=>{let E=[];return u&&E.push(`atlas-cursor-${u}`),s.actionIntentType==="cut-line"&&s.modifiers?.Shift&&E.push("atlas-cursor-cut"),(f||s.transitionIntentType==="move-shape"||s.transitionIntentType==="move-point")&&E.push("atlas-cursor-move"),m&&E.push("atlas-cursor-crosshair"),d&&E.push("atlas-cursor-copy"),p&&E.push("atlas-cursor-rotate"),s.transitionIntentType==="draw-shape"&&E.push("atlas-cursor-draw"),e?.canvas&&e.canvas.classList.add(...E),()=>{e?.canvas&&e.canvas.classList.remove(...E)}},[e?.canvas,m,f,d,s.modifiers?.Shift,s.actionIntentType,s.transitionIntentType,u,p]),(0,_l.jsx)("world-object",{height:n.height,width:n.width,onMouseMove:g,onMouseDown:v,onMouseUp:S,onMouseLeave:i.blur,children:(0,_l.jsx)(_i,{relative:!0,interactive:!1,children:(0,_l.jsx)("div",{className:"absolute top-0 right-0 left-0 bottom-0",children:(0,_l.jsxs)("svg",{width:"100%",height:"100%",viewBox:`0 0 ${n.width} ${n.height}`,tabIndex:-1,children:[(0,_l.jsx)("title",{children:"Annotation Editor"}),(0,_l.jsx)("defs",{children:a}),o]})})})})}var l4=_(nt(),1);var Dt=_(nt(),1);function jv(){return typeof window<"u"}function Nl(t){return uL(t)?(t.nodeName||"").toLowerCase():"#document"}function pi(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Za(t){var e;return(e=(uL(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function uL(t){return jv()?t instanceof Node||t instanceof pi(t).Node:!1}function Ge(t){return jv()?t instanceof Element||t instanceof pi(t).Element:!1}function zi(t){return jv()?t instanceof HTMLElement||t instanceof pi(t).HTMLElement:!1}function Hh(t){return!jv()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof pi(t).ShadowRoot}var J7=new Set(["inline","contents"]);function af(t){let{overflow:e,overflowX:n,overflowY:i,display:a}=Ni(t);return/auto|scroll|overlay|hidden|clip/.test(e+i+n)&&!J7.has(a)}var $7=new Set(["table","td","th"]);function cL(t){return $7.has(Nl(t))}var tq=[":popover-open",":modal"];function Uh(t){return tq.some(e=>{try{return t.matches(e)}catch{return!1}})}var eq=["transform","translate","scale","rotate","perspective"],nq=["transform","translate","scale","rotate","perspective","filter"],iq=["paint","layout","strict","content"];function qv(t){let e=of(),n=Ge(t)?Ni(t):t;return eq.some(i=>n[i]?n[i]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||nq.some(i=>(n.willChange||"").includes(i))||iq.some(i=>(n.contain||"").includes(i))}function fL(t){let e=Ka(t);for(;zi(e)&&!Wa(e);){if(qv(e))return e;if(Uh(e))return null;e=Ka(e)}return null}function of(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}var aq=new Set(["html","body","#document"]);function Wa(t){return aq.has(Nl(t))}function Ni(t){return pi(t).getComputedStyle(t)}function Vh(t){return Ge(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Ka(t){if(Nl(t)==="html")return t;let e=t.assignedSlot||t.parentNode||Hh(t)&&t.host||Za(t);return Hh(e)?e.host:e}function dL(t){let e=Ka(t);return Wa(e)?t.ownerDocument?t.ownerDocument.body:t.body:zi(e)&&af(e)?e:dL(e)}function ra(t,e,n){var i;e===void 0&&(e=[]),n===void 0&&(n=!0);let a=dL(t),o=a===((i=t.ownerDocument)==null?void 0:i.body),s=pi(a);if(o){let u=Fv(s);return e.concat(s,s.visualViewport||[],af(a)?a:[],u&&n?ra(u):[])}return e.concat(a,ra(a,[],n))}function Fv(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}var Yh=_(nt(),1),SL=_(nt(),1);var rf=Math.min,cr=Math.max,qh=Math.round,Fh=Math.floor,Ja=t=>({x:t,y:t}),oq={left:"right",right:"left",bottom:"top",top:"bottom"},rq={start:"end",end:"start"};function bR(t,e,n){return cr(t,rf(e,n))}function Gh(t,e){return typeof t=="function"?t(e):t}function Il(t){return t.split("-")[0]}function kh(t){return t.split("-")[1]}function xR(t){return t==="x"?"y":"x"}function ER(t){return t==="y"?"height":"width"}var lq=new Set(["top","bottom"]);function fr(t){return lq.has(Il(t))?"y":"x"}function AR(t){return xR(fr(t))}function mL(t,e,n){n===void 0&&(n=!1);let i=kh(t),a=AR(t),o=ER(a),s=a==="x"?i===(n?"end":"start")?"right":"left":i==="start"?"bottom":"top";return e.reference[o]>e.floating[o]&&(s=jh(s)),[s,jh(s)]}function gL(t){let e=jh(t);return[Gv(t),e,Gv(e)]}function Gv(t){return t.replace(/start|end/g,e=>rq[e])}var hL=["left","right"],pL=["right","left"],sq=["top","bottom"],uq=["bottom","top"];function cq(t,e,n){switch(t){case"top":case"bottom":return n?e?pL:hL:e?hL:pL;case"left":case"right":return e?sq:uq;default:return[]}}function yL(t,e,n,i){let a=kh(t),o=cq(Il(t),n==="start",i);return a&&(o=o.map(s=>s+"-"+a),e&&(o=o.concat(o.map(Gv)))),o}function jh(t){return t.replace(/left|right|bottom|top/g,e=>oq[e])}function fq(t){return{top:0,right:0,bottom:0,left:0,...t}}function vL(t){return typeof t!="number"?fq(t):{top:t,right:t,bottom:t,left:t}}function Xs(t){let{x:e,y:n,width:i,height:a}=t;return{width:i,height:a,top:n,left:e,right:e+i,bottom:n+a,x:e,y:n}}function RR(t,e){if(!t||!e)return!1;let n=e.getRootNode==null?void 0:e.getRootNode();if(t.contains(e))return!0;if(n&&Hh(n)){let i=e;for(;i;){if(t===i)return!0;i=i.parentNode||i.host}}return!1}function lf(t){return"composedPath"in t?t.composedPath()[0]:t.target}function kv(t,e){if(e==null)return!1;if("composedPath"in t)return t.composedPath().includes(e);let n=t;return n.target!=null&&e.contains(n.target)}function bL(t){return t.matches("html,body")}function TR(t){return t?.ownerDocument||document}function Qh(t,e,n){return n===void 0&&(n=!0),t.filter(a=>{var o;return a.parentId===e&&(!n||((o=a.context)==null?void 0:o.open))}).flatMap(a=>[a,...Qh(t,a.id,n)])}function xL(t){return"nativeEvent"in t}var dq=typeof document<"u",hq=function(){},Yv=dq?SL.useLayoutEffect:hq,pq={...Yh};var mq=pq.useInsertionEffect,gq=mq||(t=>t());function Ks(t){let e=Yh.useRef(()=>{});return gq(()=>{e.current=t}),Yh.useCallback(function(){for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return e.current==null?void 0:e.current(...i)},[])}var DR=_(Y(),1);var XL=_(ms(),1);function EL(t,e,n){let{reference:i,floating:a}=t,o=fr(e),s=AR(e),u=ER(s),d=Il(e),p=o==="y",f=i.x+i.width/2-a.width/2,m=i.y+i.height/2-a.height/2,g=i[u]/2-a[u]/2,v;switch(d){case"top":v={x:f,y:i.y-a.height};break;case"bottom":v={x:f,y:i.y+i.height};break;case"right":v={x:i.x+i.width,y:m};break;case"left":v={x:i.x-a.width,y:m};break;default:v={x:i.x,y:i.y}}switch(kh(e)){case"start":v[s]-=g*(n&&p?-1:1);break;case"end":v[s]+=g*(n&&p?-1:1);break}return v}var AL=async(t,e,n)=>{let{placement:i="bottom",strategy:a="absolute",middleware:o=[],platform:s}=n,u=o.filter(Boolean),d=await(s.isRTL==null?void 0:s.isRTL(e)),p=await s.getElementRects({reference:t,floating:e,strategy:a}),{x:f,y:m}=EL(p,i,d),g=i,v={},S=0;for(let E=0;E<u.length;E++){let{name:T,fn:A}=u[E],{x,y:R,data:C,reset:M}=await A({x:f,y:m,initialPlacement:i,placement:g,strategy:a,middlewareData:v,rects:p,platform:s,elements:{reference:t,floating:e}});f=x??f,m=R??m,v={...v,[T]:{...v[T],...C}},M&&S<=50&&(S++,typeof M=="object"&&(M.placement&&(g=M.placement),M.rects&&(p=M.rects===!0?await s.getElementRects({reference:t,floating:e,strategy:a}):M.rects),{x:f,y:m}=EL(p,g,d)),E=-1)}return{x:f,y:m,placement:g,strategy:a,middlewareData:v}};async function Qv(t,e){var n;e===void 0&&(e={});let{x:i,y:a,platform:o,rects:s,elements:u,strategy:d}=t,{boundary:p="clippingAncestors",rootBoundary:f="viewport",elementContext:m="floating",altBoundary:g=!1,padding:v=0}=Gh(e,t),S=vL(v),T=u[g?m==="floating"?"reference":"floating":m],A=Xs(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(T)))==null||n?T:T.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(u.floating)),boundary:p,rootBoundary:f,strategy:d})),x=m==="floating"?{x:i,y:a,width:s.floating.width,height:s.floating.height}:s.reference,R=await(o.getOffsetParent==null?void 0:o.getOffsetParent(u.floating)),C=await(o.isElement==null?void 0:o.isElement(R))?await(o.getScale==null?void 0:o.getScale(R))||{x:1,y:1}:{x:1,y:1},M=Xs(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:u,rect:x,offsetParent:R,strategy:d}):x);return{top:(A.top-M.top+S.top)/C.y,bottom:(M.bottom-A.bottom+S.bottom)/C.y,left:(A.left-M.left+S.left)/C.x,right:(M.right-A.right+S.right)/C.x}}var RL=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,i;let{placement:a,middlewareData:o,rects:s,initialPlacement:u,platform:d,elements:p}=e,{mainAxis:f=!0,crossAxis:m=!0,fallbackPlacements:g,fallbackStrategy:v="bestFit",fallbackAxisSideDirection:S="none",flipAlignment:E=!0,...T}=Gh(t,e);if((n=o.arrow)!=null&&n.alignmentOffset)return{};let A=Il(a),x=fr(u),R=Il(u)===u,C=await(d.isRTL==null?void 0:d.isRTL(p.floating)),M=g||(R||!E?[jh(u)]:gL(u)),z=S!=="none";!g&&z&&M.push(...yL(u,E,S,C));let N=[u,...M],D=await Qv(e,T),q=[],P=((i=o.flip)==null?void 0:i.overflows)||[];if(f&&q.push(D[A]),m){let X=mL(a,s,C);q.push(D[X[0]],D[X[1]])}if(P=[...P,{placement:a,overflows:q}],!q.every(X=>X<=0)){var U,J;let X=(((U=o.flip)==null?void 0:U.index)||0)+1,tt=N[X];if(tt&&(!(m==="alignment"?x!==fr(tt):!1)||P.every(lt=>lt.overflows[0]>0&&fr(lt.placement)===x)))return{data:{index:X,overflows:P},reset:{placement:tt}};let ut=(J=P.filter(xt=>xt.overflows[0]<=0).sort((xt,lt)=>xt.overflows[1]-lt.overflows[1])[0])==null?void 0:J.placement;if(!ut)switch(v){case"bestFit":{var at;let xt=(at=P.filter(lt=>{if(z){let dt=fr(lt.placement);return dt===x||dt==="y"}return!0}).map(lt=>[lt.placement,lt.overflows.filter(dt=>dt>0).reduce((dt,Rt)=>dt+Rt,0)]).sort((lt,dt)=>lt[1]-dt[1])[0])==null?void 0:at[0];xt&&(ut=xt);break}case"initialPlacement":ut=u;break}if(a!==ut)return{reset:{placement:ut}}}return{}}}};var yq=new Set(["left","top"]);async function vq(t,e){let{placement:n,platform:i,elements:a}=t,o=await(i.isRTL==null?void 0:i.isRTL(a.floating)),s=Il(n),u=kh(n),d=fr(n)==="y",p=yq.has(s)?-1:1,f=o&&d?-1:1,m=Gh(e,t),{mainAxis:g,crossAxis:v,alignmentAxis:S}=typeof m=="number"?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:m.mainAxis||0,crossAxis:m.crossAxis||0,alignmentAxis:m.alignmentAxis};return u&&typeof S=="number"&&(v=u==="end"?S*-1:S),d?{x:v*f,y:g*p}:{x:g*p,y:v*f}}var TL=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,i;let{x:a,y:o,placement:s,middlewareData:u}=e,d=await vq(e,t);return s===((n=u.offset)==null?void 0:n.placement)&&(i=u.arrow)!=null&&i.alignmentOffset?{}:{x:a+d.x,y:o+d.y,data:{...d,placement:s}}}}},CL=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){let{x:n,y:i,placement:a}=e,{mainAxis:o=!0,crossAxis:s=!1,limiter:u={fn:T=>{let{x:A,y:x}=T;return{x:A,y:x}}},...d}=Gh(t,e),p={x:n,y:i},f=await Qv(e,d),m=fr(Il(a)),g=xR(m),v=p[g],S=p[m];if(o){let T=g==="y"?"top":"left",A=g==="y"?"bottom":"right",x=v+f[T],R=v-f[A];v=bR(x,v,R)}if(s){let T=m==="y"?"top":"left",A=m==="y"?"bottom":"right",x=S+f[T],R=S-f[A];S=bR(x,S,R)}let E=u.fn({...e,[g]:v,[m]:S});return{...E,data:{x:E.x-n,y:E.y-i,enabled:{[g]:o,[m]:s}}}}}};function OL(t){let e=Ni(t),n=parseFloat(e.width)||0,i=parseFloat(e.height)||0,a=zi(t),o=a?t.offsetWidth:n,s=a?t.offsetHeight:i,u=qh(n)!==o||qh(i)!==s;return u&&(n=o,i=s),{width:n,height:i,$:u}}function wR(t){return Ge(t)?t:t.contextElement}function sf(t){let e=wR(t);if(!zi(e))return Ja(1);let n=e.getBoundingClientRect(),{width:i,height:a,$:o}=OL(e),s=(o?qh(n.width):n.width)/i,u=(o?qh(n.height):n.height)/a;return(!s||!Number.isFinite(s))&&(s=1),(!u||!Number.isFinite(u))&&(u=1),{x:s,y:u}}var Sq=Ja(0);function _L(t){let e=pi(t);return!of()||!e.visualViewport?Sq:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function bq(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==pi(t)?!1:e}function Zs(t,e,n,i){e===void 0&&(e=!1),n===void 0&&(n=!1);let a=t.getBoundingClientRect(),o=wR(t),s=Ja(1);e&&(i?Ge(i)&&(s=sf(i)):s=sf(t));let u=bq(o,n,i)?_L(o):Ja(0),d=(a.left+u.x)/s.x,p=(a.top+u.y)/s.y,f=a.width/s.x,m=a.height/s.y;if(o){let g=pi(o),v=i&&Ge(i)?pi(i):i,S=g,E=Fv(S);for(;E&&i&&v!==S;){let T=sf(E),A=E.getBoundingClientRect(),x=Ni(E),R=A.left+(E.clientLeft+parseFloat(x.paddingLeft))*T.x,C=A.top+(E.clientTop+parseFloat(x.paddingTop))*T.y;d*=T.x,p*=T.y,f*=T.x,m*=T.y,d+=R,p+=C,S=pi(E),E=Fv(S)}}return Xs({width:f,height:m,x:d,y:p})}function MR(t,e){let n=Vh(t).scrollLeft;return e?e.left+n:Zs(Za(t)).left+n}function zL(t,e,n){n===void 0&&(n=!1);let i=t.getBoundingClientRect(),a=i.left+e.scrollLeft-(n?0:MR(t,i)),o=i.top+e.scrollTop;return{x:a,y:o}}function xq(t){let{elements:e,rect:n,offsetParent:i,strategy:a}=t,o=a==="fixed",s=Za(i),u=e?Uh(e.floating):!1;if(i===s||u&&o)return n;let d={scrollLeft:0,scrollTop:0},p=Ja(1),f=Ja(0),m=zi(i);if((m||!m&&!o)&&((Nl(i)!=="body"||af(s))&&(d=Vh(i)),zi(i))){let v=Zs(i);p=sf(i),f.x=v.x+i.clientLeft,f.y=v.y+i.clientTop}let g=s&&!m&&!o?zL(s,d,!0):Ja(0);return{width:n.width*p.x,height:n.height*p.y,x:n.x*p.x-d.scrollLeft*p.x+f.x+g.x,y:n.y*p.y-d.scrollTop*p.y+f.y+g.y}}function Eq(t){return Array.from(t.getClientRects())}function Aq(t){let e=Za(t),n=Vh(t),i=t.ownerDocument.body,a=cr(e.scrollWidth,e.clientWidth,i.scrollWidth,i.clientWidth),o=cr(e.scrollHeight,e.clientHeight,i.scrollHeight,i.clientHeight),s=-n.scrollLeft+MR(t),u=-n.scrollTop;return Ni(i).direction==="rtl"&&(s+=cr(e.clientWidth,i.clientWidth)-a),{width:a,height:o,x:s,y:u}}function Rq(t,e){let n=pi(t),i=Za(t),a=n.visualViewport,o=i.clientWidth,s=i.clientHeight,u=0,d=0;if(a){o=a.width,s=a.height;let p=of();(!p||p&&e==="fixed")&&(u=a.offsetLeft,d=a.offsetTop)}return{width:o,height:s,x:u,y:d}}var Tq=new Set(["absolute","fixed"]);function Cq(t,e){let n=Zs(t,!0,e==="fixed"),i=n.top+t.clientTop,a=n.left+t.clientLeft,o=zi(t)?sf(t):Ja(1),s=t.clientWidth*o.x,u=t.clientHeight*o.y,d=a*o.x,p=i*o.y;return{width:s,height:u,x:d,y:p}}function wL(t,e,n){let i;if(e==="viewport")i=Rq(t,n);else if(e==="document")i=Aq(Za(t));else if(Ge(e))i=Cq(e,n);else{let a=_L(t);i={x:e.x-a.x,y:e.y-a.y,width:e.width,height:e.height}}return Xs(i)}function NL(t,e){let n=Ka(t);return n===e||!Ge(n)||Wa(n)?!1:Ni(n).position==="fixed"||NL(n,e)}function wq(t,e){let n=e.get(t);if(n)return n;let i=ra(t,[],!1).filter(u=>Ge(u)&&Nl(u)!=="body"),a=null,o=Ni(t).position==="fixed",s=o?Ka(t):t;for(;Ge(s)&&!Wa(s);){let u=Ni(s),d=qv(s);!d&&u.position==="fixed"&&(a=null),(o?!d&&!a:!d&&u.position==="static"&&!!a&&Tq.has(a.position)||af(s)&&!d&&NL(t,s))?i=i.filter(f=>f!==s):a=u,s=Ka(s)}return e.set(t,i),i}function Mq(t){let{element:e,boundary:n,rootBoundary:i,strategy:a}=t,s=[...n==="clippingAncestors"?Uh(e)?[]:wq(e,this._c):[].concat(n),i],u=s[0],d=s.reduce((p,f)=>{let m=wL(e,f,a);return p.top=cr(m.top,p.top),p.right=rf(m.right,p.right),p.bottom=rf(m.bottom,p.bottom),p.left=cr(m.left,p.left),p},wL(e,u,a));return{width:d.right-d.left,height:d.bottom-d.top,x:d.left,y:d.top}}function Oq(t){let{width:e,height:n}=OL(t);return{width:e,height:n}}function _q(t,e,n){let i=zi(e),a=Za(e),o=n==="fixed",s=Zs(t,!0,o,e),u={scrollLeft:0,scrollTop:0},d=Ja(0);function p(){d.x=MR(a)}if(i||!i&&!o)if((Nl(e)!=="body"||af(a))&&(u=Vh(e)),i){let v=Zs(e,!0,o,e);d.x=v.x+e.clientLeft,d.y=v.y+e.clientTop}else a&&p();o&&!i&&a&&p();let f=a&&!i&&!o?zL(a,u):Ja(0),m=s.left+u.scrollLeft-d.x-f.x,g=s.top+u.scrollTop-d.y-f.y;return{x:m,y:g,width:s.width,height:s.height}}function CR(t){return Ni(t).position==="static"}function ML(t,e){if(!zi(t)||Ni(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return Za(t)===n&&(n=n.ownerDocument.body),n}function IL(t,e){let n=pi(t);if(Uh(t))return n;if(!zi(t)){let a=Ka(t);for(;a&&!Wa(a);){if(Ge(a)&&!CR(a))return a;a=Ka(a)}return n}let i=ML(t,e);for(;i&&cL(i)&&CR(i);)i=ML(i,e);return i&&Wa(i)&&CR(i)&&!qv(i)?n:i||fL(t)||n}var zq=async function(t){let e=this.getOffsetParent||IL,n=this.getDimensions,i=await n(t.floating);return{reference:_q(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function Nq(t){return Ni(t).direction==="rtl"}var OR={convertOffsetParentRelativeRectToViewportRelativeRect:xq,getDocumentElement:Za,getClippingRect:Mq,getOffsetParent:IL,getElementRects:zq,getClientRects:Eq,getDimensions:Oq,getScale:sf,isElement:Ge,isRTL:Nq};function DL(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function Iq(t,e){let n=null,i,a=Za(t);function o(){var u;clearTimeout(i),(u=n)==null||u.disconnect(),n=null}function s(u,d){u===void 0&&(u=!1),d===void 0&&(d=1),o();let p=t.getBoundingClientRect(),{left:f,top:m,width:g,height:v}=p;if(u||e(),!g||!v)return;let S=Fh(m),E=Fh(a.clientWidth-(f+g)),T=Fh(a.clientHeight-(m+v)),A=Fh(f),R={rootMargin:-S+"px "+-E+"px "+-T+"px "+-A+"px",threshold:cr(0,rf(1,d))||1},C=!0;function M(z){let N=z[0].intersectionRatio;if(N!==d){if(!C)return s();N?s(!1,N):i=setTimeout(()=>{s(!1,1e-7)},1e3)}N===1&&!DL(p,t.getBoundingClientRect())&&s(),C=!1}try{n=new IntersectionObserver(M,{...R,root:a.ownerDocument})}catch{n=new IntersectionObserver(M,R)}n.observe(t)}return s(!0),o}function Xv(t,e,n,i){i===void 0&&(i={});let{ancestorScroll:a=!0,ancestorResize:o=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:u=typeof IntersectionObserver=="function",animationFrame:d=!1}=i,p=wR(t),f=a||o?[...p?ra(p):[],...ra(e)]:[];f.forEach(A=>{a&&A.addEventListener("scroll",n,{passive:!0}),o&&A.addEventListener("resize",n)});let m=p&&u?Iq(p,n):null,g=-1,v=null;s&&(v=new ResizeObserver(A=>{let[x]=A;x&&x.target===p&&v&&(v.unobserve(e),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var R;(R=v)==null||R.observe(e)})),n()}),p&&!d&&v.observe(p),v.observe(e));let S,E=d?Zs(t):null;d&&T();function T(){let A=Zs(t);E&&!DL(E,A)&&n(),E=A,S=requestAnimationFrame(T)}return n(),()=>{var A;f.forEach(x=>{a&&x.removeEventListener("scroll",n),o&&x.removeEventListener("resize",n)}),m?.(),(A=v)==null||A.disconnect(),v=null,d&&cancelAnimationFrame(S)}}var Xh=Qv,LL=TL;var BL=CL,PL=RL;var Kv=(t,e,n)=>{let i=new Map,a={platform:OR,...n},o={...a.platform,_c:i};return AL(t,e,{...a,platform:o})};var vn=_(nt(),1),UL=_(nt(),1),VL=_(ms(),1),Dq=typeof document<"u",Lq=function(){},Zv=Dq?UL.useLayoutEffect:Lq;function Wv(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,i,a;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(i=n;i--!==0;)if(!Wv(t[i],e[i]))return!1;return!0}if(a=Object.keys(t),n=a.length,n!==Object.keys(e).length)return!1;for(i=n;i--!==0;)if(!{}.hasOwnProperty.call(e,a[i]))return!1;for(i=n;i--!==0;){let o=a[i];if(!(o==="_owner"&&t.$$typeof)&&!Wv(t[o],e[o]))return!1}return!0}return t!==t&&e!==e}function jL(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function HL(t,e){let n=jL(t);return Math.round(e*n)/n}function _R(t){let e=vn.useRef(t);return Zv(()=>{e.current=t}),e}function qL(t){t===void 0&&(t={});let{placement:e="bottom",strategy:n="absolute",middleware:i=[],platform:a,elements:{reference:o,floating:s}={},transform:u=!0,whileElementsMounted:d,open:p}=t,[f,m]=vn.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[g,v]=vn.useState(i);Wv(g,i)||v(i);let[S,E]=vn.useState(null),[T,A]=vn.useState(null),x=vn.useCallback(lt=>{lt!==z.current&&(z.current=lt,E(lt))},[]),R=vn.useCallback(lt=>{lt!==N.current&&(N.current=lt,A(lt))},[]),C=o||S,M=s||T,z=vn.useRef(null),N=vn.useRef(null),D=vn.useRef(f),q=d!=null,P=_R(d),U=_R(a),J=_R(p),at=vn.useCallback(()=>{if(!z.current||!N.current)return;let lt={placement:e,strategy:n,middleware:g};U.current&&(lt.platform=U.current),Kv(z.current,N.current,lt).then(dt=>{let Rt={...dt,isPositioned:J.current!==!1};X.current&&!Wv(D.current,Rt)&&(D.current=Rt,VL.flushSync(()=>{m(Rt)}))})},[g,e,n,U,J]);Zv(()=>{p===!1&&D.current.isPositioned&&(D.current.isPositioned=!1,m(lt=>({...lt,isPositioned:!1})))},[p]);let X=vn.useRef(!1);Zv(()=>(X.current=!0,()=>{X.current=!1}),[]),Zv(()=>{if(C&&(z.current=C),M&&(N.current=M),C&&M){if(P.current)return P.current(C,M,at);at()}},[C,M,at,P,q]);let tt=vn.useMemo(()=>({reference:z,floating:N,setReference:x,setFloating:R}),[x,R]),ut=vn.useMemo(()=>({reference:C,floating:M}),[C,M]),xt=vn.useMemo(()=>{let lt={position:n,left:0,top:0};if(!ut.floating)return lt;let dt=HL(ut.floating,f.x),Rt=HL(ut.floating,f.y);return u?{...lt,transform:"translate("+dt+"px, "+Rt+"px)",...jL(ut.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:dt,top:Rt}},[n,u,ut.floating,f.x,f.y]);return vn.useMemo(()=>({...f,update:at,refs:tt,elements:ut,floatingStyles:xt}),[f,at,tt,ut,xt])}var Jv=(t,e)=>({...LL(t),options:[t,e]}),zR=(t,e)=>({...BL(t),options:[t,e]});var NR=(t,e)=>({...PL(t),options:[t,e]});var Bq="data-floating-ui-focusable",FL="active",GL="selected",Pq="ArrowLeft",Hq="ArrowRight",Uq="ArrowUp",Vq="ArrowDown";var jq=[Pq,Hq],qq=[Uq,Vq],VJ=[...jq,...qq];var Fq={...Dt},kL=!1,Gq=0,YL=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+Gq++;function kq(){let[t,e]=Dt.useState(()=>kL?YL():void 0);return Yv(()=>{t==null&&e(YL())},[]),Dt.useEffect(()=>{kL=!0},[]),t}var Yq=Fq.useId,Qq=Yq||kq;function Xq(){let t=new Map;return{emit(e,n){var i;(i=t.get(e))==null||i.forEach(a=>a(n))},on(e,n){t.has(e)||t.set(e,new Set),t.get(e).add(n)},off(e,n){var i;(i=t.get(e))==null||i.delete(n)}}}var Kq=Dt.createContext(null),Zq=Dt.createContext(null),Wq=()=>{var t;return((t=Dt.useContext(Kq))==null?void 0:t.id)||null},KL=()=>Dt.useContext(Zq);function Jq(t){return"data-floating-ui-"+t}function $q(t){t.current!==-1&&(clearTimeout(t.current),t.current=-1)}var t9={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},e9={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},QL=t=>{var e,n;return{escapeKey:typeof t=="boolean"?t:(e=t?.escapeKey)!=null?e:!1,outsidePress:typeof t=="boolean"?t:(n=t?.outsidePress)!=null?n:!0}};function ZL(t,e){e===void 0&&(e={});let{open:n,onOpenChange:i,elements:a,dataRef:o}=t,{enabled:s=!0,escapeKey:u=!0,outsidePress:d=!0,outsidePressEvent:p="pointerdown",referencePress:f=!1,referencePressEvent:m="pointerdown",ancestorScroll:g=!1,bubbles:v,capture:S}=e,E=KL(),T=Ks(typeof d=="function"?d:()=>!1),A=typeof d=="function"?T:d,x=Dt.useRef(!1),{escapeKey:R,outsidePress:C}=QL(v),{escapeKey:M,outsidePress:z}=QL(S),N=Dt.useRef(!1),D=Dt.useRef(-1),q=Ks(tt=>{var ut;if(!n||!s||!u||tt.key!=="Escape"||N.current)return;let xt=(ut=o.current.floatingContext)==null?void 0:ut.nodeId,lt=E?Qh(E.nodesRef.current,xt):[];if(!R&&(tt.stopPropagation(),lt.length>0)){let dt=!0;if(lt.forEach(Rt=>{var K;if((K=Rt.context)!=null&&K.open&&!Rt.context.dataRef.current.__escapeKeyBubbles){dt=!1;return}}),!dt)return}i(!1,xL(tt)?tt.nativeEvent:tt,"escape-key")}),P=Ks(tt=>{var ut;let xt=()=>{var lt;q(tt),(lt=lf(tt))==null||lt.removeEventListener("keydown",xt)};(ut=lf(tt))==null||ut.addEventListener("keydown",xt)}),U=Ks(tt=>{var ut;let xt=o.current.insideReactTree;o.current.insideReactTree=!1;let lt=x.current;if(x.current=!1,p==="click"&<||xt||typeof A=="function"&&!A(tt))return;let dt=lf(tt),Rt="["+Jq("inert")+"]",K=TR(a.floating).querySelectorAll(Rt),Ct=Ge(dt)?dt:null;for(;Ct&&!Wa(Ct);){let pe=Ka(Ct);if(Wa(pe)||!Ge(pe))break;Ct=pe}if(K.length&&Ge(dt)&&!bL(dt)&&!RR(dt,a.floating)&&Array.from(K).every(pe=>!RR(Ct,pe)))return;if(zi(dt)&&X){let pe=Wa(dt),De=Ni(dt),ne=/auto|scroll/,Di=pe||ne.test(De.overflowX),ri=pe||ne.test(De.overflowY),me=Di&&dt.clientWidth>0&&dt.scrollWidth>dt.clientWidth,ge=ri&&dt.clientHeight>0&&dt.scrollHeight>dt.clientHeight,$t=De.direction==="rtl",Mn=ge&&($t?tt.offsetX<=dt.offsetWidth-dt.clientWidth:tt.offsetX>dt.clientWidth),St=me&&tt.offsetY>dt.clientHeight;if(Mn||St)return}let ee=(ut=o.current.floatingContext)==null?void 0:ut.nodeId,ce=E&&Qh(E.nodesRef.current,ee).some(pe=>{var De;return kv(tt,(De=pe.context)==null?void 0:De.elements.floating)});if(kv(tt,a.floating)||kv(tt,a.domReference)||ce)return;let le=E?Qh(E.nodesRef.current,ee):[];if(le.length>0){let pe=!0;if(le.forEach(De=>{var ne;if((ne=De.context)!=null&&ne.open&&!De.context.dataRef.current.__outsidePressBubbles){pe=!1;return}}),!pe)return}i(!1,tt,"outside-press")}),J=Ks(tt=>{var ut;let xt=()=>{var lt;U(tt),(lt=lf(tt))==null||lt.removeEventListener(p,xt)};(ut=lf(tt))==null||ut.addEventListener(p,xt)});Dt.useEffect(()=>{if(!n||!s)return;o.current.__escapeKeyBubbles=R,o.current.__outsidePressBubbles=C;let tt=-1;function ut(K){i(!1,K,"ancestor-scroll")}function xt(){window.clearTimeout(tt),N.current=!0}function lt(){tt=window.setTimeout(()=>{N.current=!1},of()?5:0)}let dt=TR(a.floating);u&&(dt.addEventListener("keydown",M?P:q,M),dt.addEventListener("compositionstart",xt),dt.addEventListener("compositionend",lt)),A&&dt.addEventListener(p,z?J:U,z);let Rt=[];return g&&(Ge(a.domReference)&&(Rt=ra(a.domReference)),Ge(a.floating)&&(Rt=Rt.concat(ra(a.floating))),!Ge(a.reference)&&a.reference&&a.reference.contextElement&&(Rt=Rt.concat(ra(a.reference.contextElement)))),Rt=Rt.filter(K=>{var Ct;return K!==((Ct=dt.defaultView)==null?void 0:Ct.visualViewport)}),Rt.forEach(K=>{K.addEventListener("scroll",ut,{passive:!0})}),()=>{u&&(dt.removeEventListener("keydown",M?P:q,M),dt.removeEventListener("compositionstart",xt),dt.removeEventListener("compositionend",lt)),A&&dt.removeEventListener(p,z?J:U,z),Rt.forEach(K=>{K.removeEventListener("scroll",ut)}),window.clearTimeout(tt)}},[o,a,u,A,p,n,i,g,s,R,C,q,M,P,U,z,J]),Dt.useEffect(()=>{o.current.insideReactTree=!1},[o,A,p]);let at=Dt.useMemo(()=>({onKeyDown:q,...f&&{[t9[m]]:tt=>{i(!1,tt.nativeEvent,"reference-press")},...m!=="click"&&{onClick(tt){i(!1,tt.nativeEvent,"reference-press")}}}}),[q,i,f,m]),X=Dt.useMemo(()=>({onKeyDown:q,onMouseDown(){x.current=!0},onMouseUp(){x.current=!0},[e9[p]]:()=>{o.current.insideReactTree=!0},onBlurCapture(){E||($q(D),o.current.insideReactTree=!0,D.current=window.setTimeout(()=>{o.current.insideReactTree=!1}))}}),[q,p,o,E]);return Dt.useMemo(()=>s?{reference:at,floating:X}:{},[s,at,X])}function n9(t){let{open:e=!1,onOpenChange:n,elements:i}=t,a=Qq(),o=Dt.useRef({}),[s]=Dt.useState(()=>Xq()),u=Wq()!=null,[d,p]=Dt.useState(i.reference),f=Ks((v,S,E)=>{o.current.openEvent=v?S:void 0,s.emit("openchange",{open:v,event:S,reason:E,nested:u}),n?.(v,S,E)}),m=Dt.useMemo(()=>({setPositionReference:p}),[]),g=Dt.useMemo(()=>({reference:d||i.reference||null,floating:i.floating||null,domReference:i.reference}),[d,i.reference,i.floating]);return Dt.useMemo(()=>({dataRef:o,open:e,onOpenChange:f,elements:g,events:s,floatingId:a,refs:m}),[e,f,g,s,a,m])}function WL(t){t===void 0&&(t={});let{nodeId:e}=t,n=n9({...t,elements:{reference:null,floating:null,...t.elements}}),i=t.rootContext||n,a=i.elements,[o,s]=Dt.useState(null),[u,d]=Dt.useState(null),f=a?.domReference||o,m=Dt.useRef(null),g=KL();Yv(()=>{f&&(m.current=f)},[f]);let v=qL({...t,elements:{...a,...u&&{reference:u}}}),S=Dt.useCallback(R=>{let C=Ge(R)?{getBoundingClientRect:()=>R.getBoundingClientRect(),getClientRects:()=>R.getClientRects(),contextElement:R}:R;d(C),v.refs.setReference(C)},[v.refs]),E=Dt.useCallback(R=>{(Ge(R)||R===null)&&(m.current=R,s(R)),(Ge(v.refs.reference.current)||v.refs.reference.current===null||R!==null&&!Ge(R))&&v.refs.setReference(R)},[v.refs]),T=Dt.useMemo(()=>({...v.refs,setReference:E,setPositionReference:S,domReference:m}),[v.refs,E,S]),A=Dt.useMemo(()=>({...v.elements,domReference:f}),[v.elements,f]),x=Dt.useMemo(()=>({...v,...i,refs:T,elements:A,nodeId:e}),[v,T,A,e,i]);return Yv(()=>{i.dataRef.current.floatingContext=x;let R=g?.nodesRef.current.find(C=>C.id===e);R&&(R.context=x)}),Dt.useMemo(()=>({...v,context:x,refs:T,elements:A}),[v,T,A,x])}function IR(t,e,n){let i=new Map,a=n==="item",o=t;if(a&&t){let{[FL]:s,[GL]:u,...d}=t;o=d}return{...n==="floating"&&{tabIndex:-1,[Bq]:""},...o,...e.map(s=>{let u=s?s[n]:null;return typeof u=="function"?t?u(t):null:u}).concat(t).reduce((s,u)=>(u&&Object.entries(u).forEach(d=>{let[p,f]=d;if(!(a&&[FL,GL].includes(p)))if(p.indexOf("on")===0){if(i.has(p)||i.set(p,[]),typeof f=="function"){var m;(m=i.get(p))==null||m.push(f),s[p]=function(){for(var g,v=arguments.length,S=new Array(v),E=0;E<v;E++)S[E]=arguments[E];return(g=i.get(p))==null?void 0:g.map(T=>T(...S)).find(T=>T!==void 0)}}}else s[p]=f}),s),{})}}function JL(t){t===void 0&&(t=[]);let e=t.map(u=>u?.reference),n=t.map(u=>u?.floating),i=t.map(u=>u?.item),a=Dt.useCallback(u=>IR(u,t,"reference"),e),o=Dt.useCallback(u=>IR(u,t,"floating"),n),s=Dt.useCallback(u=>IR(u,t,"item"),i);return Dt.useMemo(()=>({getReferenceProps:a,getFloatingProps:o,getItemProps:s}),[a,o,s])}var o4=_(ms(),1);var Ln=_(nt(),1);var $L=_(nt(),1),$v=_(nt(),1);var e4=_(Y(),1),t4=ka(),Ws=(0,$v.createContext)({emitter:t4});Ws.displayName="Events";function Kh(){return $L.default.useContext(Ws).emitter}function i9({emitter:t,children:e}){return(0,e4.jsx)(Ws.Provider,{value:(0,$v.useMemo)(()=>({emitter:t}),[t]),children:e})}var la=_(Y(),1),Zh=Ln.default.createContext({});function Wh(){let t=(0,Ln.useContext)(Zh),e=Object.keys(t),n={};for(let i of e)t[i].Provider&&(n[i]={value:(0,Ln.useContext)(t[i]),Provider:t[i].Provider});return n}function n4(t){let e=Object.keys(t),n=t.children;for(let i of e){if(i==="children")continue;let{value:a,Provider:o}=t[i];n=(0,la.jsx)(o,{value:a,children:n})}return n}function a9(t){let e=(0,Ln.useContext)(Zh),n=(0,Ln.useMemo)(()=>({...e,...t.providers}),[t.providers]);return(0,la.jsx)(Zh.Provider,{value:n,children:t.children})}function Jh(){return{VaultContext:(0,Ln.useContext)(Ur),ResourceContext:(0,Ln.useContext)(Yf),SimpleViewerReactContext:(0,Ln.useContext)(Qu),VisibleCanvasReactContext:(0,Ln.useContext)(us),AuthRContext:(0,Ln.useContext)(fs),SearchReactContext:(0,Ln.useContext)(Yu),ReactEventContext:(0,Ln.useContext)(Ws),ContextBridgeReactContext:(0,Ln.useContext)(Zh),StrategyReactContext:(0,Ln.useContext)(Tl),AtlasStoreReactContext:(0,Ln.useContext)(Hs)}}function $h(t){return(0,la.jsx)(Io,{vault:t.bridge.VaultContext.vault||void 0,resources:t.bridge.ResourceContext,children:(0,la.jsx)(us.Provider,{value:t.bridge.VisibleCanvasReactContext,children:(0,la.jsx)(Qu.Provider,{value:t.bridge.SimpleViewerReactContext,children:(0,la.jsx)(Ws.Provider,{value:t.bridge.ReactEventContext,children:(0,la.jsx)(Hs.Provider,{value:t.bridge.AtlasStoreReactContext,children:(0,la.jsx)(fs.Provider,{value:t.bridge.AuthRContext,children:(0,la.jsx)(Yu.Provider,{value:t.bridge.SearchReactContext,children:(0,la.jsx)(Zh.Provider,{value:t.bridge.ContextBridgeReactContext,children:(0,la.jsx)(Tl.Provider,{value:t.bridge.StrategyReactContext,children:t.custom?(0,la.jsx)(n4,{...t.custom,children:t.children}):t.children})})})})})})})})})}var uf=_(Y(),1),r4=10,i4=1;function o9(t){let[e,n]=t.split("-");return[e,n]}function a4(t,e,n){return e>n?t:Math.min(Math.max(t,e),n)}function r9(t){return t.top>0||t.right>0||t.bottom>0||t.left>0}function l9(t){return{name:"insideHighlightFallback",options:t,async fn(e){if(t.width<=i4||t.height<=i4)return{};let n=await Xh(e,{altBoundary:!0});if(!r9(n))return{};let{reference:i,floating:a}=e.rects,[o,s]=o9(e.initialPlacement),u=Math.min(r4,i.width/2,i.height/2),d=i.x+(i.width-a.width)/2,p=i.y+(i.height-a.height)/2,f=e.x,m=e.y;return o==="top"||o==="bottom"?(m=o==="top"?i.y+u:i.y+i.height-a.height-u,s==="start"?f=i.x+u:s==="end"?f=i.x+i.width-a.width-u:f=d,f=a4(f,i.x+u,i.x+i.width-a.width-u)):(f=o==="left"?i.x+u:i.x+i.width-a.width-u,s==="start"?m=i.y+u:s==="end"?m=i.y+i.height-a.height-u:m=p,m=a4(m,i.y+u,i.y+i.height-a.height-u)),{x:f,y:m}}}}function t0({annotation:t,target:e,children:n,dismissable:i,isOpen:a,onOpenChange:o,placement:s}){let u=Jh(),d=Wh(),{refs:p,floatingStyles:f,context:m}=WL({open:a,onOpenChange:o,nodeId:t.id,placement:s||"bottom",middleware:[Jv(r4),NR({mainAxis:!0,fallbackStrategy:"bestFit",altBoundary:!0}),zR({altBoundary:!0}),l9(e)],whileElementsMounted:Xv}),g=ZL(m),{getReferenceProps:v,getFloatingProps:S}=JL([i?g:null].filter(E=>E!==null));return(0,uf.jsxs)(_i,{relative:!0,target:e,interactive:!1,children:[(0,uf.jsx)("div",{ref:p.setReference,...v(),style:{position:"absolute",top:0,left:0,right:0,bottom:0,pointerEvents:"none"}}),(0,o4.createPortal)((0,uf.jsx)($h,{bridge:u,custom:d,children:(0,uf.jsx)("div",{ref:p.setFloating,style:f,...S(),children:n})}),document.getElementById("atlas-floating-ui"))]})}var tp=_(Y(),1),s4=Wm()(t=>({isMenuOpen:!1,menuPosition:{x:0,y:0},setMenuPosition(e){t({menuPosition:e})},toggle(e){t(n=>({isMenuOpen:!n.isMenuOpen,menuPosition:e}))},open(e){t({isMenuOpen:!0,menuPosition:e})},setIsMenuOpen(e){t(typeof e=="function"?n=>({isMenuOpen:e(n.isMenuOpen)}):{isMenuOpen:e})},close(){t({isMenuOpen:!1})}}));function ep(t,e,n){let{isMenuOpen:i,setIsMenuOpen:a,close:o,open:s,menuPosition:u,setMenuPosition:d,toggle:p}=s4(),f=(0,l4.useCallback)(v=>{n&&(v.preventDefault(),v.stopPropagation(),p(v.atlas))},[p,n]);return[(0,tp.jsx)(tp.Fragment,{children:n&&i&&(0,tp.jsx)(t0,{dismissable:!0,placement:"bottom-start",isOpen:i,onOpenChange:a,annotation:{id:t},target:{x:u.x,y:u.y,height:1,width:1},children:i&&n({canvasId:e,position:u,close:()=>a(!1)})})}),{onContextMenu:f},{open:s,close:o,toggle:p,isMenuOpen:i,setIsMenuOpen:a,menuPosition:u,setMenuPosition:d}]}function LR(){let t=Ie();return bt(t,e=>e.tool.requestId&&e.requests[e.tool.requestId]||null)}var ai=_(Y(),1);function BR({theme:t,renderContextMenu:e,children:n}){let i=Ie(),a=zt(),o=bt(i,M=>M.polygon),s=bt(i,M=>M.polygonState.currentTool),u=bt(i,M=>M.mode),d=bt(i,M=>M.changeMode),p=bt(i,M=>M.polygonState.transitioning),{enabled:f,requestId:m}=bt(i,M=>M.tool),g=(0,e0.useMemo)(()=>xl(o),[o]),v=LR(),[S,E]=ep("editing-annotation",a?.id,e),T=v?.annotationPopup||n||(0,ai.jsx)(u4,{}),A=v?.svgTheme||t,x=()=>{d("sketch")};if(!f||!a||!m||!o)return null;let R=g&&o.id&&!p&&(s==="pointer"||s==="hand"||!o.open)?(0,ai.jsx)(t0,{annotation:o,target:g,children:T}):null,C="shape";return u==="explore"?(0,ai.jsxs)(ai.Fragment,{children:[(0,ai.jsx)(C,{id:`shape-${o.id}`,points:o.points,open:o.open,onClick:x,relativeStyle:!0,target:{x:0,y:0,width:a.width,height:a.height},style:{":hover":{backgroundColor:"rgba(0,0,0,0.2)"},backgroundColor:"rgba(0,0,0,0)",borderWidth:"4px",borderColor:"rgba(255, 255, 255, .4)"},...E}),(0,ai.jsx)(C,{id:`shape-${o.id}`,points:o.points,open:o.open,onClick:x,relativeStyle:!0,target:{x:0,y:0,width:a.width,height:a.height},style:{backgroundColor:"rgba(0,0,0,0)",borderWidth:"2px",borderColor:"rgba(0, 0, 0, .4)"}}),R]}):(0,ai.jsxs)(ai.Fragment,{children:[e?(0,ai.jsx)(C,{id:`shape-${o.id}`,points:o.points,open:o.open,target:{x:0,y:0,width:a.width,height:a.height},...E}):null,(0,ai.jsx)(sL,{image:a,theme:A}),R,S]})}function u4(){let t=Ie(),e=bt(t,s=>s.changeMode),n=bt(t,s=>s.mode),i=bt(t,s=>s.completeRequest),a=bt(t,s=>s.tool),o=()=>{(0,e0.startTransition)(()=>{i()})};return a.enabled?(0,ai.jsxs)("div",{className:"svg-tools-container animate-fadeIn",children:[n!=="sketch"&&(0,ai.jsx)("button",{className:"svg-tools-button",onClick:()=>{e("sketch")},children:"Edit"}),(0,ai.jsx)("button",{className:"svg-tools-button",onClick:o,children:"Save"})]}):null}var Dl=_(nt(),1);var cf=_(nt(),1);function s9(t){return t.type==="SpecificResource"?[t.source,{selector:t.selector}]:[t,{selector:null}]}function np(t,e){let{selector:n,source:i}=an(e);if(i.id!==t.id)return[null,i];let a={type:"BoxSelector",spatial:{x:0,y:0,width:Number(t.width),height:Number(t.height)}};return[n?n.type==="TemporalSelector"?{type:"TemporalBoxSelector",temporal:n.temporal,spatial:a.spatial}:n:null,i]}var PR={makeChoice:()=>{}},ip={type:"unknown"},Pe=t=>({type:"unknown",reason:t,annotations:{pages:[]}}),HR=(t,e)=>({type:"empty",width:t,height:e,annotations:{pages:[]},image:null,images:[]});var ap=_(nt(),1);function u9(t,e){let n=t?.iiif?.meta[e];return n?n.annotationPageManager:null}function c4(t,e){return re(n=>{let i=[];if(!t)return i;let a=Object.keys(n.iiif.entities.AnnotationPage);for(let o of a)if(!e||e.indexOf(o)!==-1){let s=u9(n,o);s&&s.views&&s.views[t]&&i.push(o)}return i},[t,e])}function UR({canvas:t,manifest:e,all:n,canvases:i}){let a=[];if(e)for(let o of e.annotations)a.indexOf(o.id)===-1&&a.push(o.id);if(n){if(i&&i.length)for(let o of i)for(let s of o.annotations)a.indexOf(s.id)===-1&&a.push(s.id)}else if(t)for(let o of t.annotations)a.indexOf(o.id)===-1&&a.push(o.id);return a}function c9(t,e){let n=t?.iiif?.meta[e];return n?n.annotationPageManager:null}function op(t,e={}){let n=Vt(),i=on(),a=zt(),o=cs(),s=(0,ap.useMemo)(()=>UR({all:e.all,manifest:i,canvas:a,canvases:o}),[e.all,a,o,i]),u=c4(t,e.all?void 0:s),d=(0,ap.useCallback)(f=>{t&&n.setMetaValue([f,"annotationPageManager","views"],m=>m&&!m[t]?m:{...m||{},[t]:!1})},[t,n]),p=(0,ap.useCallback)((f,m={})=>{if(!t)return;let g=n.getState(),v=[];if(m?.deselectOthers){let S=Object.keys(g.iiif.entities.AnnotationPage);for(let E of S){let T=c9(g,E);T&&T.views&&T.views[t]&&v.push(E)}}for(let S of v)d(S);n.setMetaValue([f,"annotationPageManager","views"],S=>S&&S[t]?S:{...S||{},[t]:!0})},[t,d,n]);return{availablePageIds:s,enabledPageIds:u,setPageEnabled:p,setPageDisabled:d}}function VR(t,e){return re((n,i)=>i.get(t.map(a=>({id:a,type:e}))),[t,e])}var f4=_(nt(),1);var f9=Yi((t,e)=>({loaded:{},setLoaded:(n,i="done")=>{t(a=>({loaded:{...a.loaded,[n]:i}}))}})),d9=ka();d9.on("loaded",t=>{f9.getState().setLoaded(t.imageServiceId)});function rp(){let t=$c(),e=GD();return[(0,f4.useCallback)((i,{height:a,width:o})=>i&&t(i,{height:a,width:o},!0),[t]),e]}var Js=_(nt(),1);function dr(t={}){let e=Mh(),n=zt(t.canvasId?{id:t.canvasId}:void 0);return re((i,a)=>{if(!n)return[];if(e&&t.enableSingleAnnotation)return[e];let o=a.get(n.items),s=[];for(let u of o)s.push(...a.get(u.items));return s},[n])}function jR(t,e=[]){let n=Vt(),i=(0,Js.useMemo)(()=>Wc(n),[]),a=dr({enableSingleAnnotation:t?.enableSingleAnnotation}),[o,s]=(0,Js.useState)(t?.defaultChoices||[]),u=(0,Js.useMemo)(()=>i.getPaintables(a,o),[n,a,o,...e]),p={makeChoice:(0,Js.useCallback)((f,{deselectOthers:m=!0,deselect:g=!1}={})=>{u.choice&&s(v=>{if(g){let E=v.filter(T=>T!==f);if(E.length===0){let T=u.items[0].resource.id;return T?[T]:[]}return E}if(m)return[f];let S=[...v];if(S.length===0&&u.items.length){let E=u.items[0].resource.id;E&&S.push(E)}return v.indexOf(f)!==-1?v:[...v,f]})},[u.choice])};return[u,p]}var h9=["model/gltf-binary"];function qR(t,e){let n=e.items[0],i=n.resource;return i.format?h9.indexOf(i.format)===-1?Pe(`3D format: ${i.format} is unsupported`):{type:"3d-model",model:i,annotationId:n.annotationId,annotation:n.annotation}:Pe("Unknown format")}function n0(t,e){let n=e.items,i=n[0];if(n.length===0||!i)return Pe("No audio");if(!t.duration)return Pe("No duration on canvas");if(n.length>1)return Pe("Only one audio source supported");let a=i.resource;return a?("format"in a||(a.format="audio/mpeg"),{type:"media",media:{annotationId:i.annotationId,annotation:i.annotation,duration:t.duration,url:a.id,type:"Sound",target:{type:"TemporalSelector",temporal:{startTime:0,endTime:t.duration}},format:a.format,selector:{type:"TemporalSelector",temporal:{startTime:0,endTime:t.duration}}},annotations:{pages:[]}}):Pe("Unknown audio")}function hr(t){return t.replace(/^http:/,"https:")}function d4(t){if(!(t?.type!=="ImageApiSelector"||typeof t.rotation>"u"))return FR(t.rotation)}function FR(t){if(t===null||typeof t>"u"||t==="")return;let e=Number(t);return Number.isFinite(e)?e:void 0}function p9(t){let e=t.selector||{};return{...t.rotationOrigin||e.rotationOrigin?{rotationOrigin:t.rotationOrigin||e.rotationOrigin}:{},...t.translate||e.translate?{translate:t.translate||e.translate}:{},...t.transform||e.transform?{transform:t.transform||e.transform}:{},...t.style||e.boxStyle?{style:t.style||e.boxStyle}:{},...t.styleClass?{styleClass:t.styleClass}:{}}}function lp(t,e,n){let i=[],a=[];for(let o of e.items){let s=o.resource&&o.resource.type==="SpecificResource"?o.resource.source:o.resource;if(!s.id)return Pe("No resource Identifier");let d=(o.resource.type==="SpecificResource"?d4(o.resource.selector):void 0)??d4(o.selector)??FR(o.rotation)??FR(o.selector?.rotation),p=typeof d<"u",f;if(s.service){let R=Fr(s);R[0]&&(f=n(R[0],p?{width:Number(s.width||t.width),height:Number(s.height||t.height)}:t))}let m={type:"BoxSelector",spatial:{x:0,y:0,width:Number(t.width),height:Number(t.height)}},[g,v]=np(t,o.target),S=t.id?.split("?")[0]||"";if(!(hr(v.id||"")===hr(t.id)||hr(decodeURIComponent(v.id||""))===hr(t.id||"")||hr(v.id||"")===hr(S)||hr(decodeURIComponent(v.id||""))===hr(S)))continue;let E=o.resource.width&&o.resource.height?{type:"BoxSelector",spatial:{x:0,y:0,width:o.resource.width,height:o.resource.height}}:void 0,T=o.resource.type==="SpecificResource"?an(o.resource):null;if(o.selector){let R=an({type:"SpecificResource",source:o.resource,selector:o.selector});R&&(T=R)}let A=T&&T.selector&&(T.selector.type==="BoxSelector"||T.selector.type==="TemporalBoxSelector")?{type:"BoxSelector",spatial:{x:T.selector.spatial.x,y:T.selector.spatial.y,width:T.selector.spatial.width,height:T.selector.spatial.height},...typeof T.selector.rotation<"u"?{rotation:T.selector.rotation}:{},...T.selector.rotationOrigin?{rotationOrigin:T.selector.rotationOrigin}:{},...T.selector.translate?{translate:T.selector.translate}:{},...T.selector.transform?{transform:T.selector.transform}:{},...T.selector.boxStyle?{boxStyle:T.selector.boxStyle}:{}}:void 0;f&&!f.id&&(f.id=f["@id"]);let x={id:s.id,type:"Image",annotationId:o.annotationId,annotation:o.annotation,width:Number(p||g||A?s.width:t.width),height:Number(p||g||A?s.height:t.height),...typeof d<"u"?{rotation:d}:{},...p9(o),service:f,sizes:f&&f.sizes?f.sizes:s.width&&s.height?[{width:s.width,height:s.height}]:[],target:g&&g.type!=="PointSelector"?g:m,selector:A||{type:"BoxSelector",spatial:{x:0,y:0,width:Number(t.width),height:Number(t.height)}},annotationPages:o.resource.annotations||[]};i.push(x)}return{type:"images",image:i[0],images:i,choice:e.choice}}function h4(t,e={},n){let i=t.language||n||"none";switch(t.type){case"TextualBody":{typeof t.value<"u"&&(e[i]=[t.value]);break}case"List":case"Composite":case"Choice":t.items&&t.items.forEach(a=>h4(a,e,i))}return e}function sp(t,e){let n=[];return e.items.forEach(i=>{if(i.resource){let[a]=np(t,i.target);n.push({type:"Text",annotationId:i.annotationId,annotation:i.annotation,text:h4(i.resource),target:a})}}),{type:"textual-content",items:n}}var m9=/^.*(?:(?:youtu\.be\/|v\/|vi\/|u\/\w\/|embed\/|shorts\/)|(?:(?:watch)?\?vi?=|&vi?=))([^#&?]*).*/;function up(t,e,n,i=!1){let a=e.items.filter(E=>E.type==="video"),o=a[0],s=!1,u=!1;if(t.duration||(u=!0),a.length>1||!o)return Pe("Only one video source supported");let d=a[0]?.resource,p=!!(d.service||[]).find(E=>(E.profile||"").includes("youtube.com"));if(!p&&u)return Pe("Video does not have duration");if(!d)return Pe("Unknown video");if((!d.format||d.format==="text/html")&&!p)return Pe("Video does not have format");let f=[],m=n.get(t.annotations||[]);for(let E of m){let T=n.get(E.items||[]);for(let A of T)if((A.motivation?Array.isArray(A.motivation||"")?A.motivation:[A.motivation]:[]).includes("supplementing")){let R=n.get(A.body||[]);for(let C of R){let M=C;if(M.type==="Choice")for(let z of M.items){let N=n.get(z);N.format==="text/vtt"&&f.push({id:N.id,type:"Text",format:"text/vtt",label:N.label,language:N.language})}else M.format==="text/vtt"&&f.push({id:M.id,type:"Text",format:"text/vtt",label:M.label,language:M.language})}}}let g={annotationId:o.annotationId,annotation:o.annotation,duration:t.duration,url:d.id,type:"Video",target:{type:"TemporalSelector",temporal:{startTime:0,endTime:t.duration}},format:d.format,selector:{type:"TemporalSelector",temporal:{startTime:0,endTime:t.duration}}},v=an(o.target);v.selector&&v.selector.type==="TemporalBoxSelector"&&(g.target=v.selector);let{selector:S}=_o(o.selector);if(S===null){let E=g.target.temporal.startTime,A=(g.target.temporal.endTime||t.duration)-E;g.selector={type:"TemporalSelector",temporal:{startTime:0,endTime:A}}}else S.type==="TemporalSelector"&&(g.selector=S);if(i&&!g.target.spatial&&(s=!0,g.target={type:"TemporalBoxSelector",temporal:g.target.temporal,spatial:{x:t.width/2,y:t.height/2,width:t.width/2,height:t.height/2}}),p){g.type="VideoYouTube";let E=d.id.match(m9);if(!E[1])return Pe("Video is not known youtube video");g.youTubeId=E[1]}return{type:"media",media:g,annotations:{pages:[]},noSpatial:s,captions:f}}function GR(t,e,n,i){let a={type:"complex-timeline",items:[],keyframes:[],highlights:[],duration:t.duration||0},o={type:"complex-choice",items:[]},s=i.get(t.annotations);function u(f){f.choice&&(f.choice.type==="complex-choice"?o.items.push(...f.choice.items):o.items.push(f.choice))}for(let f of e.items){if(f.type==="image"){let m=lp(t,{choice:null,allChoices:null,types:["image"],items:[f]},n);if(m.type==="images"){if(!m.image)continue;u(m),a.items.push(m.image);let g={id:m.image.annotationId,type:"enter",resourceType:"image",time:m.image.target?.temporal?.startTime||0};a.keyframes.push(g);let v={id:m.image.annotationId,type:"exit",resourceType:"image",time:m.image.target?.temporal?.endTime||t.duration||0};a.keyframes.push(v)}}if(f.type==="textualbody"){let m=sp(t,{choice:null,allChoices:null,types:["textualbody"],items:[f]});if(m.type==="textual-content"){u(m);let g=m.items[0];a.items.push(g);let v=g.target,S={id:g.annotationId,type:"enter",resourceType:"text",time:v.temporal?.startTime||0};a.keyframes.push(S);let E={id:g.annotationId,type:"exit",resourceType:"text",time:v.temporal?.endTime||t.duration||0};a.keyframes.push(E)}}if(f.type==="video"){let m=up(t,{choice:null,allChoices:null,types:["video"],items:[f]},i,!0);if(m.type==="media"){u(m);let g=m.media;a.items.push(g);let v={id:g.annotationId,type:"enter",resourceType:"video",time:g.target?.temporal?.startTime||0};a.keyframes.push(v);let S={id:g.annotationId,type:"exit",resourceType:"video",time:g.target?.temporal?.endTime||t.duration||0};a.keyframes.push(S)}}if(f.type==="audio"||f.type==="sound"){let m=n0(t,{choice:null,allChoices:null,types:["audio"],items:[f]});if(m.type==="media"){u(m);let g=m.media;a.items.push(g);let v={id:g.annotationId,type:"enter",resourceType:"audio",time:g.target?.temporal?.startTime||0};a.keyframes.push(v);let S={id:g.annotationId,type:"exit",resourceType:"audio",time:g.target?.temporal?.endTime||t.duration||0};a.keyframes.push(S)}}}for(let f of s)for(let m of f.items){let g=i.get(m),v=an(g.target,{typeMap:i.getState?.().iiif.mapping});if(v.selector?.temporal){let S={id:g.id,type:"enter",resourceType:"highlight",time:v.selector.temporal.startTime||0};a.keyframes.push(S);let E={id:g.id,type:"exit",resourceType:"highlight",time:v.selector.temporal.endTime||t.duration||0};a.keyframes.push(E)}a.highlights.push({annotation:g,target:v})}a.keyframes.sort((f,m)=>f.time-m.time);let d=[],p=[];for(let f of a.keyframes){if(f.resourceType==="image"||f.resourceType==="text"||f.resourceType==="highlight"){p.push(f);continue}if(f.type==="enter"){d.length===0&&(f.isPrime=!0),d.push(f),p.push(f);continue}if(f.type==="exit"&&(p.push(f),d=d.filter(m=>m.id!==f.id),d.length!==0)){let m=d[0],g={id:m.id,type:"change",isPrime:!0,resourceType:m.resourceType,time:f.time};p.push(g)}}return a.keyframes=p,o.items.length&&(a.choice=o),a}var i0={},kR={get(t){return t},setMetaValue([t,e,n],i){let a=kR.getResourceMeta(t,e),o=a?a[n]:void 0,s=typeof i=="function"?i(o):i;i0[t]={...i0[t]||{},[e]:{...(i0[t]||{})[e]||{},[n]:s}}},getResourceMeta:(t,e)=>{let n=i0[t];if(n)return e?n[e]:n},async load(t){let e=typeof t=="string"?t:t.id;return fetch(e).then(n=>n.json())},requestStatus(t){}};function cp({canvas:t,paintables:e,supports:n,loadImageService:i,vault:a=kR}){if(!t)return ip;if(e.types.length===0)return n.indexOf("empty")!==-1?HR(t.width,t.height):ip;if(e.types.length!==1)if(e.types.length===2&&e.types.indexOf("text")!==-1)e.types=e.types.filter(s=>s!=="text");else return n.indexOf("complex-timeline")===-1?Pe("Complex timeline not supported"):GR(t,e,i,a);let o=e.types[0];return o==="image"?n.indexOf("images")===-1?Pe("Image not supported"):lp(t,e,i):o==="Model"||o==="model"?n.indexOf("3d-model")===-1?Pe("3D not supported"):qR(t,e):o==="textualbody"?n.indexOf("textual-content")===-1?Pe("Textual content not supported"):sp(t,e):o==="sound"||o==="audio"?n.indexOf("media")===-1?Pe("Media not supported"):n0(t,e):o==="video"?n.indexOf("media")===-1?Pe("Media not supported"):up(t,e,a):ip}function YR(t){let e=on(),n=zt(),i=Vt(),a=Kh(),o=t?.emitter||a,[s,u]=rp(),{enabledPageIds:d}=op(t?.annotationPageManagerId||e?.id||n?.id,{all:!1}),p=VR(d,"AnnotationPage"),f=t?.strategies||["empty","images","media","textual-content","complex-timeline"],[m,g]=jR(t,[u]);(0,cf.useEffect)(()=>{let S=E=>{g.makeChoice(E.choiceId,{deselectOthers:E.deselectOthers,deselect:E.deselect})};return o.on("make-choice",S),()=>{o.off("make-choice",S)}},[]);let v=(0,cf.useMemo)(()=>cp({canvas:n,paintables:m,supports:f,loadImageService:s,vault:i}),[n,m,i,g.makeChoice]);return(0,cf.useEffect)(()=>{let S=m.allChoices,E={canvasId:n?.id,manifestId:e?.id};S&&o.emit("choice-change",{choice:S,partOf:E})},[n?.id,m.allChoices]),(0,cf.useMemo)(()=>v.type==="unknown"?[v,PR]:[{...v,annotations:{pages:p}},g],[v,p])}var QR=_(Y(),1);function XR({strategies:t,registerActions:e,defaultChoices:n,onChoiceChange:i,mediaControlsDeps:a,renderMediaControls:o,renderViewerControls:s,viewControlsDeps:u,renderComplexTimelineControls:d,complexTimelineControlsDeps:p,throwOnUnknown:f,children:m}){let g=zt(),v=Vt(),S=(0,Dl.useMemo)(()=>El(v),[v]),[E,T]=YR({strategies:t||["images"],defaultChoices:n?.map(({id:C})=>C)}),A="choice"in E?E.choice:void 0;if((0,Dl.useEffect)(()=>{e&&e(T)},[E.annotations]),(0,Dl.useEffect)(()=>{i&&i(A)},[A]),(0,Dl.useEffect)(()=>{if(n)for(let C of n)typeof C.opacity<"u"&&S.applyStyles({id:C.id},"atlas",{opacity:C.opacity})},[n]),E.type==="unknown"&&f)throw new Error(E.reason||"Unknown strategy");let x=(0,Dl.useMemo)(()=>({renderMediaControls:o,mediaControlsDeps:a||[],renderViewerControls:s,viewControlsDeps:u||[],renderComplexTimelineControls:d,complexTimelineControlsDeps:p||[]}),[a,o,s,u,d,p]),R=(0,Dl.useMemo)(()=>({strategy:E,actions:T,choices:"choice"in E?E.choice:[]}),[E,g]);return(0,QR.jsx)(Ih.Provider,{value:x,children:(0,QR.jsx)(Tl.Provider,{value:R,children:m})})}var fp=_(nt(),1);var ff=_(nt(),1);var KR=(0,ff.createContext)(()=>{});function p4(t){let e=zt(),n=(0,ff.useContext)(KR);(0,ff.useEffect)(()=>e&&e.id?(n(e.id,t),()=>n(e.id,-1)):()=>{},[e,t])}var m4=_(Y(),1);function ZR({x:t=0,y:e=0,keepCanvasScale:n=!0,renderContextMenu:i,children:a}){let{strategy:o}=Fe(),s=zt(),u=Ie(),d=_h(s,["deep-zoom"]),p=bt(u,E=>E.setCanvasRelativePosition),f=bt(u,E=>E.clearCanvasRelativePosition),[m,g]=ep(`context-menu/${s?.id}`,s?.id,i),v=(0,fp.useMemo)(()=>n?1:Math.max(1,...o.type==="images"?o.images.map(E=>(E.width||0)/E.target?.spatial.width):[]),[n,o]);(0,fp.useEffect)(()=>{if(s)return p(s.id,{x:t,y:e,width:s.width,height:s.height}),()=>{f(s.id)}},[t,e,s,f,p]),(0,fp.useEffect)(()=>{s&&u.getState().reset()},[u,s]),p4(v);let S=o.type==="images"?o.images.length:0;return s?(0,m4.jsxs)("world-object",{height:s.height,width:s.width,x:t,y:e,...g,...d,children:[m,a]},`${s.id}/${o.type}/${S}`):null}var mi=_(Y(),1);function Fs({x:t,y:e,onChoiceChange:n,registerActions:i,defaultChoices:a,isStatic:o,renderViewerControls:s,renderMediaControls:u,renderComplexTimelineControls:d,complexTimelineControlsDeps:p,viewControlsDeps:f,mediaControlsDeps:m,strategies:g,throwOnUnknown:v,backgroundStyle:S,alwaysShowBackground:E,keepCanvasScale:T=!1,enableSizes:A=!1,enableYouTube:x=!0,onClickPaintingAnnotation:R,components:C={},children:M,annotationPopup:z,svgTheme:N,renderContextMenu:D,renderAnnotationContextMenu:q}){return(0,mi.jsxs)(XR,{throwOnUnknown:v,onChoiceChange:n,registerActions:i,strategies:g,defaultChoices:a,mediaControlsDeps:m,renderMediaControls:u,renderViewerControls:s,renderComplexTimelineControls:d,complexTimelineControlsDeps:p,viewControlsDeps:f,children:[(0,mi.jsxs)(ZR,{keepCanvasScale:T,x:t,y:e,renderContextMenu:D,children:[(0,mi.jsx)(dR,{alwaysShowBackground:E,backgroundStyle:S}),(0,mi.jsx)(fR,{}),(0,mi.jsx)(pR,{}),(0,mi.jsx)(hR,{isStatic:o,enableSizes:A,onClickPaintingAnnotation:R}),(0,mi.jsx)(nR,{}),(0,mi.jsx)(ZA,{}),(0,mi.jsx)(oR,{as:C.Audio}),(0,mi.jsx)(gR,{as:C.Video}),x?(0,mi.jsx)(yR,{}):null,(0,mi.jsx)(BR,{theme:N,renderContextMenu:q,children:z}),M]}),(0,mi.jsx)(WA,{})]})}var WR=_(Y(),1);function g4(t){let e=zt();return!e||!e.placeholderCanvas?null:(0,WR.jsx)(ma,{canvas:e.placeholderCanvas.id,children:(0,WR.jsx)(Fs,{renderViewerControls:t.renderViewerControls})})}var gi=_(nt(),1);var sa=_(nt()),g9=(0,sa.createContext)(null),JR={didCatch:!1,error:null},df=class extends sa.Component{constructor(e){super(e),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=JR}static getDerivedStateFromError(e){return{didCatch:!0,error:e}}resetErrorBoundary(){let{error:e}=this.state;if(e!==null){for(var n,i,a=arguments.length,o=new Array(a),s=0;s<a;s++)o[s]=arguments[s];(n=(i=this.props).onReset)===null||n===void 0||n.call(i,{args:o,reason:"imperative-api"}),this.setState(JR)}}componentDidCatch(e,n){var i,a;(i=(a=this.props).onError)===null||i===void 0||i.call(a,e,n)}componentDidUpdate(e,n){let{didCatch:i}=this.state,{resetKeys:a}=this.props;if(i&&n.error!==null&&y9(e.resetKeys,a)){var o,s;(o=(s=this.props).onReset)===null||o===void 0||o.call(s,{next:a,prev:e.resetKeys,reason:"keys"}),this.setState(JR)}}render(){let{children:e,fallbackRender:n,FallbackComponent:i,fallback:a}=this.props,{didCatch:o,error:s}=this.state,u=e;if(o){let d={error:s,resetErrorBoundary:this.resetErrorBoundary};if(typeof n=="function")u=n(d);else if(i)u=(0,sa.createElement)(i,d);else if(a===null||(0,sa.isValidElement)(a))u=a;else throw s}return(0,sa.createElement)(g9.Provider,{value:{didCatch:o,error:s,resetErrorBoundary:this.resetErrorBoundary}},u)}};function y9(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return t.length!==e.length||t.some((n,i)=>!Object.is(n,e[i]))}var a0=_(nt(),1);function y4(t,e=2e3){let{currentSequenceIndex:n,sequence:i,items:a}=ds(),o=zt(),s=(0,a0.useMemo)(()=>{let d=i[n]||[];return d.length===0&&o?[{id:o.id,type:"Canvas"}]:d.map(p=>a[p])},[i,n,o,a]),u=Ie();(0,a0.useEffect)(()=>{let p=setInterval(()=>{if(t&&e!==-1){let f={x:t.x,y:t.y,width:t.width,height:t.height},m=u.getState().canvasRelativePositions,g={};for(let v of s){let S=m[v.id];if(S){let E=S.x,T=S.y,A=S.width,x=S.height,R={x:Math.max(E,f.x),y:Math.max(T,f.y),width:Math.min(E+A,f.x+f.width)-Math.max(E,f.x),height:Math.min(T+x,f.y+f.height)-Math.max(T,f.y)};R.width<=0||R.height<=0||(g[v.id]={x:R.x-S.x,y:R.y-S.y,width:R.width,height:R.height}),u.setState({canvasViewports:g})}}}},e);return()=>{clearTimeout(p)}},[s,t,u,e])}var hf=_(Y(),1);function o0({width:t,style:e,height:n,error:i,resetErrorBoundary:a}){return(0,hf.jsxs)("div",{style:{width:t,height:n,minHeight:500,...e||{},background:"#f9f9f9"},children:[(0,hf.jsx)("h3",{children:"Error occurred"}),(0,hf.jsx)("p",{children:i.message}),(0,hf.jsx)("button",{type:"button",onClick:a,children:"Reset"})]})}var ke=_(Y(),1);function r0(t){let e=Ie();return(0,ke.jsx)(Xc,{name:t.name,existing:e,children:(0,ke.jsx)(v9,{...t})})}function v9({name:t,children:e,errorFallback:n,outerContainerProps:i={},worldScale:a,updateViewportTimeout:o,...s}){let u=Ie(),d=bt(u,at=>at.mode),p=bt(u,at=>at.setAtlasRuntime),[f,m]=(0,gi.useState)(),g=Wh(),v=Jh(),S=n||o0,[E,T]=(0,gi.useState)({}),A=Object.entries(E),[x,R]=(0,gi.useState)({}),C=Object.entries(x),[M,z]=(0,gi.useState)({}),{worldScale:N,runtimeOptions:D}=(0,gi.useMemo)(()=>{if(Object.values(M).length===0)return{worldScale:1,runtimeOptions:s.runtimeOptions||{maxOverZoom:1}};let X=Math.max(...Object.values(M));return{worldScale:X,runtimeOptions:{maxOverZoom:X||1,...s.runtimeOptions||{}}}},[M,s.runtimeOptions]);y4(f?.runtime,o);let q=(0,gi.useCallback)((at,X)=>{z(tt=>{if(X===-1){let{[at]:ut,...xt}=tt;return xt}return{...tt,[at]:X}})},[]),P=(0,gi.useCallback)((at,X,tt)=>{T(({[at]:ut,...xt})=>X?{...xt,[at]:{element:X,props:tt}}:xt)},[]),U=(0,gi.useCallback)((at,X,tt)=>{R(({[at]:ut,...xt})=>X?{...xt,[at]:{element:X,props:tt}}:xt)},[]),J=(0,gi.useCallback)(at=>{m(at),p(at.runtime),s.onCreated&&s.onCreated(at)},[s.onCreated,p]);return(0,ke.jsxs)(df,{resetKeys:[],fallbackRender:at=>(0,ke.jsx)(S,{...s,...at}),children:[(0,ke.jsx)(XI,{...s,mode:d,containerProps:{style:{position:"relative"},...s.containerProps||{}},htmlChildren:(0,ke.jsx)(ke.Fragment,{children:A.map(([at,{element:X,props:tt}])=>(0,ke.jsx)(gi.default.Fragment,{children:(0,ke.jsx)(X,{...tt||{}})},at))}),onCreated:J,runtimeOptions:D,children:(0,ke.jsx)(Xc,{name:t,existing:u,children:(0,ke.jsx)(Xa.Provider,{value:f,children:(0,ke.jsx)(KR.Provider,{value:q,children:(0,ke.jsx)(YA.Provider,{value:P,children:(0,ke.jsx)(QA.Provider,{value:U,children:(0,ke.jsx)($h,{bridge:v,custom:g,children:(0,ke.jsx)(eR,{children:e})})})})})})})}),(0,ke.jsx)("div",{children:C.map(([at,{element:X,props:tt}])=>(0,ke.jsx)(gi.default.Fragment,{children:(0,ke.jsx)(X,{...tt||{}})},at))}),(0,ke.jsx)("div",{id:"atlas-floating-ui",style:{position:"relative",zIndex:999999}})]})}var oi=_(Y(),1),S9=(0,$s.forwardRef)(function(e,n){let i=on(),a=cs(),o=ds(),{ViewerControls:s,MediaControls:u,ComplexTimelineControls:d}=e.components||{};if((0,$s.useImperativeHandle)(n,()=>o,[o]),!i)return(0,oi.jsx)("div",{});let p=0,f=i.viewingDirection==="top-to-bottom",m=i.viewingDirection==="bottom-to-top",g=i.viewingDirection==="left-to-right",v=i.viewingDirection==="right-to-left",E=i.behavior.includes("continuous")?0:e.spacing||0,T=m||v,A=(0,$s.useMemo)(()=>T?[...a].reverse():a,[a,T]);return(0,oi.jsxs)(oi.Fragment,{children:[e.header,(0,oi.jsx)(wn.Viewer,{height:e.height,mode:e.mode,renderPreset:e.renderPreset,runtimeOptions:e.runtimeOptions,updateViewportTimeout:e.updateViewportTimeout,homePaddingPx:e.padding,children:A.map((x,R)=>{let C=0,M=0;return!f&&!m?(C=p,p+=x.width+E):(M=p,p+=x.height+E),(0,oi.jsx)(ma,{canvas:x.id,children:(0,oi.jsx)(wn.RenderCanvas,{strategies:["3d-model","media","images","empty","textual-content","complex-timeline"],renderViewerControls:R===0&&s?()=>(0,oi.jsx)(s,{}):void 0,renderMediaControls:R===0&&u?()=>(0,oi.jsx)(u,{}):void 0,annotationPopup:e.annotationPopup,renderContextMenu:e.renderContextMenu,keepCanvasScale:e.keepCanvasScale,renderComplexTimelineControls:R===0&&d?()=>(0,oi.jsx)(d,{}):void 0,renderAnnotationContextMenu:e.renderAnnotationContextMenu,x:C,y:M,svgTheme:e.svgTheme,...e.canvasProps||{},children:e.annotations},x.id)},x.id)})},e.reuseAtlas?"":o.currentSequenceIndex),e.children]})}),wn=(0,$s.forwardRef)(function({children:e,height:n,annotations:i,canvasProps:a,spacing:o,header:s,components:u,mode:d,reuseAtlas:p,renderPreset:f,runtimeOptions:m,annotationPopup:g,name:v,svgTheme:S,updateViewportTimeout:E,renderContextMenu:T,keepCanvasScale:A,renderAnnotationContextMenu:x,padding:R,...C},M){let z=Do();return(0,oi.jsx)(Xc,{name:v,children:(0,oi.jsx)(Io,{vault:z,children:(0,oi.jsx)(w1,{...C,children:(0,oi.jsx)(S9,{ref:M,height:n,components:u,spacing:o,canvasProps:a,annotations:i,header:s,mode:d,reuseAtlas:p,renderPreset:f,runtimeOptions:m,annotationPopup:g,svgTheme:S,updateViewportTimeout:E,renderContextMenu:T,keepCanvasScale:A,renderAnnotationContextMenu:x,padding:R,children:e})})})})});wn.RenderImage=Ol;wn.RenderCanvas=Fs;wn.RenderAnnotationPage=Al;wn.RenderAnnotation=Vs;wn.Viewer=r0;wn.CanvasBackground=Bv;wn.Audio=Ev;wn.Video=Hv;wn.Model=Tv;wn.AudioHTML=XA;wn.VideoHTML=mR;wn.ModelHTML=KA;wn.PlaceholderCanvas=g4;wn.getAtlasStoreByName=DA;var v4=_(nt(),1);var _a=_(nt(),1);function $R(t){let[e,n]=(0,_a.useState)(0),i=Ie(),a=bt(i,M=>M.tool.enabled),o=bt(i,M=>M.tool.requestId),s=bt(i,M=>M.getRequestId),u=bt(i,M=>M.requestAnnotation),d=bt(i,M=>M.completeRequest),p=bt(i,M=>M.cancelRequest),f=(0,_a.useRef)(t?.onSuccess);f.current=t?.onSuccess;let[m,g]=(0,_a.useState)(!1),[v,S]=(0,_a.useState)(null),[E,T]=(0,_a.useState)(null),A=a&&o!==E,x=a&&o===E,R=(0,_a.useCallback)(async(M,z)=>{if(E){let N=f.current;g(!0);let D=await u(M,{...z,requestId:E});if(D)return N?.(D),n(P=>P+1),g(!1),S(D),D;let q={id:E,cancelled:!0,...Ch(M)};return N?.(q),S(q),n(P=>P+1),g(!1),q}return null},[u,E]),C=(0,_a.useCallback)(()=>{S(null),g(!1)},[]);return(0,_a.useEffect)(()=>{let M=s();return T(M.requestId),()=>{M.clear()}},[e]),{id:e,busy:A,isPending:m,isActive:x,requestId:E,requestAnnotation:R,cancelRequest:()=>E?p(E):void 0,completeRequest:()=>E?d(E):void 0,reset:C,data:v}}var b9=[{name:"Default",outer:{borderWidth:4,borderColor:"rgba(255, 255, 255, .4)"},inner:{borderWidth:2,borderColor:"#000"}},{name:"High contrast",outer:{borderWidth:3,borderColor:"#fff"},inner:{borderWidth:1,borderColor:"#000"}},{name:"Lightsaber",outer:{borderWidth:"4",borderColor:"rgba(56,68,255,0.64)"},inner:{borderWidth:"2",borderColor:"#fff"}},{name:"Bright",outer:{borderWidth:"6",borderColor:"#25d527"},inner:{borderWidth:"3",borderColor:"#a916ff"}},{name:"pink",outer:{borderWidth:"4",borderColor:"#ff00ff"},inner:{borderWidth:"2",borderColor:"#ffffff"}},{name:"fine (dark)",outer:{borderWidth:"1",borderColor:"#000000"},inner:{}},{name:"fine (light)",outer:{borderWidth:"1",borderColor:"#FFF"},inner:{}}];function tT(t){let{id:e,data:n,requestAnnotation:i,cancelRequest:a,isPending:o}=$R({onSuccess:s=>{t.updateShape(s.polygon)}});return(0,v4.useEffect)(()=>(i({type:"polygon",open:t.shape?.open,points:t.shape?.points}),()=>{a()}),[]),null}var Kn=_(nt(),1);var S4=_(Y(),1),l0=(0,Kn.createContext)(ka());l0.displayName="SelectorHelper";function x9({children:t}){return(0,S4.jsx)(l0.Provider,{value:(0,Kn.useMemo)(()=>ka(),[]),children:t})}function E9(){return(0,Kn.useContext)(l0)}function eT(t){let e=nT(),[n,i]=(0,Kn.useState)(!1);(0,Kn.useEffect)(()=>e.withSelector(t).on("highlight",()=>{i(!0)}),[e,t]),(0,Kn.useEffect)(()=>e.withSelector(t).on("clear-highlight",()=>{i(!1)}),[e,t]);let a=(0,Kn.useCallback)(s=>{e.emit("click",{selectorId:t,event:s})},[t,e]),o=(0,Kn.useCallback)(s=>{e.emit("hover",{selectorId:t,event:s})},[t,e]);return{controller:e,onClick:a,onHover:o,isHighlighted:n}}function nT(){let t=(0,Kn.useContext)(l0);return(0,Kn.useMemo)(()=>({withSelector(e){return{on(n,i){let a=o=>{o&&o.selectorId===e&&i(o)};return t.on(n,a),()=>{t.off(n,a)}},emit(n,i){t.emit(n,{...i,selectorId:e})}}},on(e,n){return t.on(e,n),()=>{t.off(e,n)}},emit(e,n){t.emit(e,n)}}),[t])}function A9(){let t=nT();return(0,Kn.useMemo)(()=>({withSelector(e){return{highlight(){t.emit("highlight",{selectorId:e})},clearHighlight(){t.emit("clear-highlight",{selectorId:e})},zoomTo(){t.emit("zoom-to",{selectorId:e})},addEventListener(n,i){return t.emit("event-listener",{selectorId:e,name:n,callback:i}),()=>{t.emit("remove-event-listener",{selectorId:e,name:n,callback:i})}},getImagePreview(){return new Promise((n,i)=>{t.emit("image-preview-request",{selectorId:e,resolve:n,reject:i})})},on(n,i){return t.withSelector(e).on(n,i)}}},highlight(e){t.emit("highlight",{selectorId:e})},clearHighlight(e){t.emit("clear-highlight",{selectorId:e})},zoomTo(e){t.emit("zoom-to",{selectorId:e})},addEventListener(e,n,i){return t.emit("event-listener",{selectorId:e,name:n,callback:i}),()=>{t.emit("remove-event-listener",{selectorId:e,name:n,callback:i})}},getImagePreview(e){return new Promise((n,i)=>{t.emit("image-preview-request",{selectorId:e,resolve:n,reject:i})})},on(e,n){return t.on(e,n)}}),[t])}var iT=_(Y(),1);function R9(t){let e=zt(),n=t.annotationBucket,i=t.readOnly,a=t.id,{onClick:o,isHighlighted:s}=eT(t.id),u=wh(),d=s?u.highlighted:u[n||"hidden"]||u.hidden;if(!e)return null;if(i){let p="shape",f=t.polygon,m=f.open;return f?(0,iT.jsx)(p,{id:`shape-${a}`,points:f.points,open:m,onClick:o,relativeStyle:!0,target:{x:0,y:0,width:e.width,height:e.height},style:d}):null}return(0,iT.jsx)(tT,{image:e,shape:t.polygon||{id:t.id,open:!0,points:[]},updateShape:t.updatePolygon,theme:t.theme,controlsHtmlId:t.controlsHtmlId,renderControls:t.renderControls})}var s0=_(nt(),1),dp=_(Y(),1),T9=(0,s0.forwardRef)(function({canvasId:e},n){let i=hv(),a=op(e||i?.id),o=Vt();return(0,s0.useImperativeHandle)(n,()=>a,[e,i]),!i||a.enabledPageIds.length===0?null:(0,dp.jsx)(dp.Fragment,{children:a.enabledPageIds.map(s=>(0,dp.jsx)(wn.RenderAnnotationPage,{page:o.get(s)},s))})});var x4=_(nt(),1);var b4=_(nt(),1);var Sn=_(Y(),1);function hp({metadata:t=[],config:e,labelWidth:n=16,showEmptyMessage:i=!0,allowHtml:a,emptyFallback:o,classes:s={},emptyMessage:u="No metadata available",emptyValueFallback:d="No value",emptyLabelFallback:p="",separator:f,tableFooter:m,tableHeader:g,customLabelRender:v,customValueRender:S}){let E=(0,b4.useMemo)(()=>{let A=(e||[]).reduce((R,C)=>[...R,...C.keys],[]),x={};for(let R of t){let C=R?.label?Object.values(R.label):[];for(let M of C)if(M?.length&&(A.indexOf(`metadata.${M[0]}`)!==-1||A.length===0)&&R){let z=`metadata.${M[0]}`;x[z]=x[z]?x[z]:[],x[z].push(R);break}}return x},[e,t]);return Object.keys(E).length===0&&i?(0,Sn.jsx)(Sn.Fragment,{children:o})||(0,Sn.jsx)("div",{className:s.empty,children:u}):e?.length?(0,Sn.jsxs)("table",{className:s.container,children:[g,(0,Sn.jsx)("tbody",{children:e.map((A,x)=>{let R=[];for(let M of A.keys)for(let z of E[M]||[]){let N=(0,Sn.jsx)(oa,{enableDangerouslySetInnerHTML:a,defaultText:d,separator:f,children:z.value},x+"__"+M);S?R.push(S(z,N)):R.push(N)}if(R.length===0)return null;let C=(0,Sn.jsx)(oa,{enableDangerouslySetInnerHTML:a,separator:f,defaultText:p,children:A.label});return(0,Sn.jsxs)("tr",{className:s.row,children:[(0,Sn.jsx)("td",{className:s.label,style:n?{minWidth:n}:{},children:v?v(A.label,C):C}),(0,Sn.jsx)("td",{className:s.value,children:R})]},x)})}),m]}):(0,Sn.jsxs)("table",{className:s.container,children:[g,(0,Sn.jsx)("tbody",{children:t?.length?t.map((A,x)=>{if(!A)return null;let R=(0,Sn.jsx)(oa,{enableDangerouslySetInnerHTML:a,defaultText:d,separator:f,children:A.label}),C=(0,Sn.jsx)(oa,{enableDangerouslySetInnerHTML:a,defaultText:d,separator:f,children:A.value});return(0,Sn.jsxs)("tr",{className:s.row,children:[(0,Sn.jsx)("td",{className:s.label,style:n?{minWidth:n}:{},children:v?v(A.label,R):R}),(0,Sn.jsx)("td",{className:s.value,children:S?S(A,C):C})]},x)}):null}),m]})}var E4=_(Y(),1);function C9(t){let e=on(),n=zt(),i=ad(),a=(0,x4.useMemo)(()=>{let o=e?.metadata||[],s=n?.metadata||[],u=i?.metadata||[];return[...o,...s,...u]},[e,n,i]);return(0,E4.jsx)(hp,{metadata:a,...t})}var c0=_(nt(),1);var A4=_(nt(),1);function u0(t,e={},n=[]){return(0,A4.useMemo)(()=>{if(!t)return null;let i=e.quality;t&&t.extraQualities&&e.quality&&(t.extraQualities.includes(e.quality)||(i="default"));let a=ug(t);return sg({identifier:a.identifier,server:a.server,scheme:a.scheme,type:"image",size:{max:!e.size?.width&&!e.size?.height,confined:!1,upscaled:!1,...e.size||{}},format:e.format||"jpg",region:e.region||{full:!0},rotation:e?.rotation?Number.isInteger(e.rotation)?{angle:e.rotation}:e.rotation:{angle:0},quality:i||"default",prefix:a.prefix,originalPath:a.originalPath})},[...n])}var pp=_(Y(),1);function w9(t){let e=typeof t.src=="string"?t.src:t.src.id,n=Dh(),[i,a]=(0,c0.useState)(!1),o;if(e){let u=n.loadServiceSync({id:e});u&&(o=u)}!o&&!i&&n.loadService({id:e}).then(()=>{a(!0)});let s=u0(o,{size:t.size,selector:t.region,rotation:t.rotation,format:t.format,region:t.region,quality:t.quality},[i,t.src,t.size,t.region,t.rotation,t.format,t.region,t.quality]);return(0,c0.useEffect)(()=>()=>{a(!1)},[e]),s?(0,pp.jsx)("img",{src:s,alt:t.alt,className:t.className,style:t.style}):(0,pp.jsx)(R4,{...t,fetchImageService:!1})}function R4(t){if(t.fetchImageService)return(0,pp.jsx)(w9,{...t});let e=typeof t.src=="string"?{id:t.src,profile:"level0"}:t.src,n=u0(e,{size:t.size,selector:t.region,rotation:t.rotation,format:t.format,region:t.region,quality:t.quality},[t.src,t.size,t.region,t.rotation,t.format,t.region,t.quality]);return n?(0,pp.jsx)("img",{src:n,alt:t.alt,className:t.className,style:t.style}):null}var f0=_(nt(),1);var pr=_(Y(),1);function M9({src:t,errorFallback:e,interactive:n,skipSizes:i,children:a,renderViewerControls:o,viewControlsDeps:s,fluid:u,x:d,y:p,...f}){let m=Do(),[g,v]=(0,f0.useState)(),S=e||o0,[E,T]=rp(),A=(0,f0.useMemo)(()=>{let R=T[t]?.status,C=E({id:t},{});return C?.height&&C.width&&R!=="loading"?{id:t,width:C.width,height:C.height,service:C,type:"Image",selector:{type:"BoxSelector",spatial:{x:0,y:0,width:C.width,height:C.height}},target:{type:"BoxSelector",spatial:{x:0,y:0,width:C.width,height:C.height}}}:null},[E,t,T]);if(!A||!A.height||!A.width)return null;let x=u?void 0:f.homePosition?f.homePosition.width/f.homePosition.height:A.width/A.height;return(0,pr.jsx)(df,{resetKeys:[],fallbackRender:R=>(0,pr.jsx)(S,{...f,...R}),children:(0,pr.jsx)(Io,{vault:m,children:(0,pr.jsx)(r0,{...f,aspectRatio:x,containerProps:{style:{position:"relative"},...f.containerProps||{}},onCreated:R=>{v(R),f.onCreated&&f.onCreated(R)},children:(0,pr.jsxs)(Xa.Provider,{value:g,children:[(0,pr.jsx)(Ol,{image:A,id:A.id,isStatic:!n,x:d,y:p},A.id),(0,pr.jsx)(O9,{viewerPreset:g,renderViewerControls:o,image:A,src:t,viewControlsDeps:s}),a]})})})})}function O9({viewerPreset:t,renderViewerControls:e,image:n,src:i,viewControlsDeps:a}){return Xn(t&&e?"overlay":"none",`canvas-portal-controls-${i}`,Xa.Provider,e&&n?{value:t||null,children:e({image:n,images:[n],type:"images"})}:{},[i,t,...a||[]]),null}var T4=_(Y(),1);function _9(t){let e=on();return(0,T4.jsx)(hp,{metadata:e?.metadata||[],...t})}var d0=_(nt(),1);var aT=_(w4(),1);var Ii=_(Y(),1),{LazyLoadComponent:z9}=aT||aT.default;function oT(t){let{size:e,visible:n,classes:i,canvasId:a,figure:o}=t,s=e?.width||128,u=e?.height||e?.width||128,d=(0,Ii.jsx)(N9,{...t}),p=(0,Ii.jsx)(z9,{threshold:300,style:{height:u,width:s},visibleByDefault:n,children:a?(0,Ii.jsx)(ma,{canvas:a,children:d}):d});return o?(0,Ii.jsx)("figure",{className:i?.figure,children:p}):p}function N9({fallback:t,size:e,classes:n,showLabel:i,alt:a,dereference:o=!1}){let s=zt(),u=e?.width||128,d=e?.height||e?.width||128,p=a||bv(s?.label)||"",f=lr({width:u,height:d,allowUnsafe:!0},o);return!f||f.type!=="fixed"?(0,Ii.jsx)(Ii.Fragment,{children:t}):(0,Ii.jsxs)(Ii.Fragment,{children:[(0,Ii.jsx)("div",{className:n?.imageWrapper,children:(0,Ii.jsx)("img",{className:n?.img,src:f.id,alt:p})}),i?(0,Ii.jsx)(oa,{as:"figcaption",className:n?.label,children:s?.label}):null]})}var pf=_(Y(),1);function I9({scrollBehaviour:t,dereference:e,flat:n,size:i,classes:a={},showLabel:o,figure:s,fallback:u}){let d=(0,d0.useRef)(null),{items:p,sequence:f,currentSequenceIndex:m,setSequenceIndex:g}=ds(),v={row:a.selected?.row||a.row,item:a.selected?.item||a.item,figure:a.selected?.figure||a.figure,img:a.selected?.img||a.img,label:a.selected?.label||a.label,imageWrapper:a.selected?.imageWrapper||a.imageWrapper};(0,d0.useLayoutEffect)(()=>{if(!d.current)return;let E=d.current.querySelector("[data-selected=true]");E&&E.scrollIntoView({behavior:t||"instant",block:"nearest",inline:"center"})},[m]);let S=[];for(let E of f){let T=[],A=f[m]===E;for(let x of E){let R=p[x];T.push((0,pf.jsx)("div",{className:A?v.item:a.item,children:(0,pf.jsx)(oT,{classes:A?v:a,canvasId:R.id,size:i,dereference:e,showLabel:o,figure:s,placeholder:(0,pf.jsx)("div",{style:{height:128,width:128}}),fallback:u})},x))}if(n){S.push(T);continue}S.push((0,pf.jsx)("div",{onClick:x=>{g(f.indexOf(E))},"data-selected":A,className:A?v.row:a.row,children:T},E.join("-")))}return(0,pf.jsx)("div",{ref:d,className:a.container,children:S})}function rT(){let t=Ie(),e=bt(t,o=>o.completeRequest),n=bt(t,o=>o.polygonState.currentTool),i=bt(t,o=>o.polygonState.selectedStamp),a=bt(t,o=>o.switchTool);return{completeRequest:e,currentTool:n,selectedStamp:i,switchTool:a}}var Bn=_(Y(),1),D9={draw:!0,polygon:!0,line:!0,lineBox:!0,box:!0,triangle:!0,hexagon:!0,circle:!0,delete:!0,pen:!0};function L9({showShapes:t=!0,enabled:e=D9,classNames:n={},icons:i={}}){let{currentTool:a,switchTool:o,selectedStamp:s}=rT();return(0,Bn.jsxs)(Bn.Fragment,{children:[a,(0,Bn.jsx)("button",{className:n.button,onClick:o.pointer,"data-active":a==="pointer",children:i.PointerIcon||"Pointer"}),(0,Bn.jsx)("button",{className:n.button,onClick:o.hand,"data-active":a==="hand",children:i.HandIcon||"Hand"}),t?(0,Bn.jsxs)(Bn.Fragment,{children:[e.box&&(0,Bn.jsx)("button",{className:n.button,onClick:o.box,"data-active":a==="box",children:i.BoxIcon||"Box"}),e.pen&&(0,Bn.jsx)("button",{className:n.button,onClick:o.pen,"data-active":a==="pen",children:i.PenIcon||"Pen"}),e.draw&&(0,Bn.jsx)("button",{className:n.button,onClick:o.draw,"data-active":a==="pencil",children:i.DrawIcon||"Draw"}),e.line&&(0,Bn.jsx)("button",{className:n.button,onClick:o.line,"data-active":a==="line",children:i.LineIcon||"Line"}),e.lineBox&&(0,Bn.jsx)("button",{className:n.button,onClick:o.lineBox,"data-active":a==="lineBox",children:i.LineBoxIcon||"LineBox"}),e.triangle&&(0,Bn.jsx)("button",{className:n.button,onClick:o.triangle,"data-active":a==="stamp"&&s?.id==="triangle",children:i.TriangleIcon||"Triangle"}),e.hexagon&&(0,Bn.jsx)("button",{className:n.button,onClick:o.hexagon,"data-active":a==="stamp"&&s?.id==="hexagon",children:i.HexagonIcon||"Hexagon"}),e.circle&&(0,Bn.jsx)("button",{className:n.button,"data-active":a==="stamp"&&s?.id==="circle",onClick:o.circle,children:i.CircleIcon||"Circle"})]}):null,e.delete&&(0,Bn.jsx)("button",{className:n.button,onClick:o.remove,children:i.DeleteForeverIcon||"Delete"})]})}var M4=_(Y(),1);function B9({annotation:t,children:e}){return(0,M4.jsx)(ci,{value:{annotation:t},children:e})}var O4=_(Y(),1);function P9({annotationPage:t,children:e}){return(0,O4.jsx)(ci,{value:{annotationPage:t},children:e})}var _4=_(Y(),1);function H9({collection:t,children:e}){return(0,_4.jsx)(ci,{value:{collection:t},children:e})}function U9(t,e={}){return dr(e)}var Ll=_(nt(),1);function V9({canvasId:t}={}){let e=hv(),n=cs(),i=(0,Ll.useMemo)(()=>t?[t]:e?[e.id]:n.map(p=>p.id),[t,e,n]),[a,o]=(0,Ll.useState)({}),s=Kh();(0,Ll.useEffect)(()=>{let p=f=>{let m=f.partOf.canvasId;m&&o(g=>({...g,[m]:f.choice}))};return s.on("choice-change",p),()=>{s.off("choice-change",p)}},[]);let u=(0,Ll.useMemo)(()=>{let p=[];for(let f of i){let m=a[f];m&&p.push({canvasId:f,choice:m})}return p},[i,a]),d=(0,Ll.useMemo)(()=>({makeChoice:(p,f)=>{s.emit("make-choice",{choiceId:p,...f})}}),[s]);return{choices:u,actions:d}}function j9(t,e=!1){}function q9(t){let n=ti().manifest,i=t?t.map(a=>typeof a=="string"?a:a?.id):[];return re(a=>{let o=n?a.iiif.entities.Manifest[n]:void 0,s=o?.items||[];if(typeof t>"u")return s;let u=[];for(let d of o?.items||[])i.indexOf(d.id)!==-1&&u.push(d);return u},[i.join("/")])}var z4=_(nt(),1);function F9(t,e=[]){let{id:n,selector:i}=t,a=ti(),o=n||a.collection,s=re(u=>o?u.iiif.entities.Collection[o]:void 0,[o]);return(0,z4.useMemo)(()=>{if(s)return i?i(s):s},[s,i,...e])}var h0=_(nt(),1);function G9(){let t=Ie(),e=bt(t,i=>i.completeRequest),n=bt(t,i=>i.cancelRequest);return(0,h0.useMemo)(()=>({saveAnnotation:()=>{(0,h0.startTransition)(()=>{e()})},cancelRequest:n}),[e,n])}var N4=_(nt(),1);function k9({requestId:t}={}){let e=Ie(),n=bt(e,u=>u.metadata),i=bt(e,u=>u.tool.requestId),a=t||i,o=bt(e,u=>u.setMetadata),s=(0,N4.useCallback)(u=>o(u,a||void 0),[o,a]);return[a?n[a]||{}:{},s]}function Y9(t){let e=Ie(),n=bt(e,i=>i.tool.requestId);Ps("polygons.start-transition",i=>{t.requestId&&n!==t.requestId||t?.onStart?.(i.transitionIntent)},[n,t.requestId]),Ps("polygons.end-transition",i=>{t.requestId&&n!==t.requestId||t?.onEnd?.(i.transitionIntent,i.response)},[n,t.requestId]),Ps("polygons.transition",i=>{t.requestId&&n!==t.requestId||t?.onTransition?.(i.transitionIntent)},[n,t.requestId])}var p0=_(nt(),1);function Q9(t,e,n,i,a=[]){let o=Vt(),s=(0,p0.useMemo)(()=>Oh(o),[o]);(0,p0.useEffect)(()=>{let u=t;return u?(s.addEventListener(u,e,n,i),()=>{s.removeEventListener(u,e,n)}):()=>{}},[s,t,e,...a])}function X9(t,e){let{id:n,isLoaded:i,error:a,resource:o,requestId:s,cached:u}=id(t,e);return{id:n,isLoaded:i,error:a,manifest:o,requestId:s,cached:u}}var yo=_(nt(),1);function lT({cacheKey:t}={}){let e=zt(),n=dr(),i=Vt(),a=$c(),o=kD(),[s,u]=(0,yo.useState)(void 0),[d,p]=(0,yo.useState)(!1),[f,m]=(0,yo.useState)("idle"),[g,v]=(0,yo.useState)(void 0),S=e?e.id:"undefined",E=(0,yo.useMemo)(()=>{try{if(e&&n.length){let A=n[0],x=i.get(A.body[0]),C=Fr(x)[0];return C&&a(C,{width:C.width||e.width,height:C.height||e.height},!0)||void 0}}catch(A){console.error(A)}},[S,t,e]),T=f==="success"&&s?s:E;return(0,yo.useEffect)(()=>{(async()=>{try{if(e&&n.length){let A=n[0],x=i.get(A.body[0]),C=Fr(x)[0];if(!C)return;p(!0),m("loading");try{let M=await o(C,{width:C.width||e.width,height:C.height||e.height})||void 0;u(M),m("success"),p(!1)}catch(M){m("error"),v(M)}}}catch(A){m("error"),v(A)}})()},[S,t]),(0,yo.useMemo)(()=>({data:T,isFetching:d,status:f,error:g}),[T,d,f,g])}function K9(){let t=lT();return{isLoading:t.isFetching,tile:t.data?{id:t.data.id||t.data["@id"],width:t.data.width,height:t.data.height,imageService:t.data,thumbnail:void 0}:null}}var m0=_(nt(),1);function Z9({supports:t=["empty","images","media","3d-model","textual-content","complex-timeline"]}={}){let e=Vt(),n=zt(),i=dr(),a=(0,m0.useMemo)(()=>Wc(e),[e]),o=(0,m0.useMemo)(()=>a.getPaintables(i),[a,i]);return(0,m0.useMemo)(()=>cp({canvas:n,loadImageService:s=>s,paintables:o,supports:t}),[n,o,t])}var I4=_(nt(),1);function W9(){let t=Vt();return(0,I4.useMemo)(()=>El(t),[t])}var Pn=_(nt(),1);var mp=[.6,.02,0,.75],sT=16,uT={linear:[0,0,1,1],"ease-in":[.42,0,1,1],"ease-out":[0,0,.58,1],"ease-in-out":[.42,0,.58,1],"ease-in-cubic":mp,"ease-out-cubic":[.215,.61,.355,1]};function cT(t,e,n){let i=Math.max(0,Math.min(1,n));return{x:t.x+(e.x-t.x)*i,y:t.y+(e.y-t.y)*i,width:t.width+(e.width-t.width)*i,height:t.height+(e.height-t.height)*i}}function fT(t,e){let n=[],i=t;for(let a of e)n.push({from:i,to:a}),i=a;return n}function mf([t,e,n,i]){let a=3*t,o=3*(n-t)-a,s=1-a-o,u=3*e,d=3*(i-e)-u,p=1-u-d;function f(S){return((s*S+o)*S+a)*S}function m(S){return((p*S+d)*S+u)*S}function g(S){return(3*s*S+2*o)*S+a}function v(S,E=1e-6){let T=S;for(let R=0;R<8;R++){let C=f(T)-S;if(Math.abs(C)<E)return T;let M=g(T);if(Math.abs(M)<1e-6)break;T=T-C/M}let A=0,x=1;for(T=S;A<x;){let R=f(T);if(Math.abs(R-S)<E)return T;S>R?A=T:x=T,T=(x-A)*.5+A}return T}return S=>{if(S<=0)return 0;if(S>=1)return 1;let E=v(S);return m(E)}}function dT(t,e){if(!e||e.length===0)return{index:-1,t:0};if(Number.isNaN(t)||!isFinite(t))return{index:-1,t:0};if(t<0)return{index:-1,t:0};if(t>=e.length)return{index:e.length,t:0};let n=Math.floor(t),i=t-n;return{index:n,t:i}}function J9(t){let{initial:e,regions:n,progress:i,getProgress:a,enabled:o=!0,easing:s,reportEveryFrame:u=!1,pollInterval:d=sT,loop:p=!1,onEnter:f,onExit:m,onProgress:g,jumpTo:v}=t,S=(0,Pn.useMemo)(()=>fT(e,n),[e,n]),[E,T]=(0,Pn.useState)(()=>-1),[A,x]=(0,Pn.useState)(0),R=(0,Pn.useRef)(-1),C=(0,Pn.useRef)(0),M=(0,Pn.useRef)(!0),z=(0,Pn.useRef)(()=>{});(0,Pn.useEffect)(()=>(M.current=!0,()=>{M.current=!1}),[]);let N=(0,Pn.useMemo)(()=>{if(!s)return mf(mp);if(typeof s=="function")return s;if(Array.isArray(s)&&s.length===4)return mf(s);let J=uT[s];return J?mf(J):mf(mp)},[s]),D=(0,Pn.useCallback)(J=>{if(!(J<0||J>=S.length)&&(T(J),R.current=J,C.current=0,x(0),f))try{f(J)}catch{}},[S,f]);(0,Pn.useEffect)(()=>{z.current=D,v&&v(D)},[D,v]);function q(J){let{index:at,t:X}=dT(J,S),tt=at;if(p&&S.length>0){let xt=S.length;tt=(at%xt+xt)%xt}let ut=N(X);if(tt!==R.current){if(R.current>=0&&m)try{m(R.current)}catch{}if(tt>=0&&f)try{f(tt)}catch{}R.current=tt,M.current&&T(tt)}if(C.current=ut,M.current&&(u||tt!==E)&&x(ut),g&&tt>=0)try{g(tt,ut)}catch{}}(0,Pn.useEffect)(()=>{o&&typeof i=="number"&&q(i)},[i,o]),(0,Pn.useEffect)(()=>{if(!o||typeof a!="function")return;let J=null,at=()=>{try{let X=a();q(X)}catch{}};return at(),J=setInterval(at,d),()=>clearInterval(J)},[a,o,d]);let P=E>=0&&E<S.length?S[E]:void 0,U=P?cT(P.from,P.to,C.current):void 0;return{transitions:S,currentIndex:E,currentTransition:P,t:C.current,rect:U,jumpTo:D}}var tu=_(nt(),1);function $9(t,e={}){let{axis:n="y",offset:i=0,steps:a=1,enabled:o=!0}=e,[s,u]=(0,tu.useState)(0),d=(0,tu.useRef)(-1),p=(0,tu.useRef)(null);return(0,tu.useEffect)(()=>{if(!o||!t||!t.current)return;let f=t.current,m=()=>{let v=n==="y"?f.scrollTop:f.scrollLeft,S=n==="y"?f.clientHeight:f.clientWidth,T=(n==="y"?f.scrollHeight:f.scrollWidth)-S,x=(T<=0?0:Math.max(0,Math.min(1,(v+i)/T)))*a;x!==d.current&&(d.current=x,u(x)),p.current=null},g=()=>{p.current===null&&(p.current=requestAnimationFrame(m))};return f.addEventListener("scroll",g,{passive:!0}),m(),()=>{f.removeEventListener("scroll",g),p.current!==null&&cancelAnimationFrame(p.current)}},[t,n,i,a,o]),s}function tF(t,e){let{x:n,y:i,width:a,height:o}=t,{x:s,y:u}=e,{width:d,height:p}=e;return n+a>s&&n<s+d&&i+o>u&&i<u+p}var eF=!0,hT="Invariant failed";function D4(t,e){if(!t){if(eF)throw new Error(hT);var n=typeof e=="function"?e():e,i=n?"".concat(hT,": ").concat(n):hT;throw new Error(i)}}function nF(t,e){let n=t.boundingBox||xl(t.polygon);if(t.polygon&&!Yc(t.polygon.points)){let i=t.target||Qc(t.polygon,e);return D4(i?.type==="SvgSelector"),{type:"SvgSelector",points:t.polygon.points,spatial:{unit:"pixel",...n||{}},svgShape:t.polygon.open?"polyline":"polygon",svg:i.value}}return{type:"BoxSelector",spatial:n}}return iP(iF);})();
|
|
141
|
+
`}),(0,yp.jsx)("iframe",{className:"video-yt",ref:i,src:`https://www.youtube.com/embed/${e.youTubeId}?enablejsapi=1&origin=${window.location.host}`,referrerPolicy:"no-referrer",sandbox:"allow-scripts allow-same-origin allow-presentation"})]}):null}function yP({media:t,mediaControlsDeps:e,children:n}){let[{element:i,currentTime:a,progress:r},l,u]=vu({duration:t.duration});return yi("overlay","video-element",K7,{element:i,media:t,playPause:u.playPause}),null}var y0=N(tt(),1);function WR(){let{strategy:t}=dn(),{renderMediaControls:e,mediaControlsDeps:n}=Bi();return t.type!=="media"||t.media.type!=="VideoYouTube"?null:(0,y0.jsxs)(yP,{media:t.media,mediaControlsDeps:n,children:[(0,y0.jsx)(wu,{}),e?e(t):null]})}var I0=N(ct(),1);var rl=N(ct(),1);var Ei=N(ct(),1);function JR(t){let e=$e(),n=zt(e,r=>r.polygons),i=zt(e,r=>r.polygonState),a=zt(e,r=>r.polygon);return pu("atlas.polygon-render",({state:r,slowState:l,dt:u})=>{t(r,l,u)}),{currentShape:a,state:i,helper:n}}var Ee=N(tt(),1),Vo=TD(),vP={shapeFill:"#ffffff33",shapeStroke:"#000",lineStroke:"#000",ghostLineStroke:"#0F0",activeLineStroke:"#4D7EEA",boundingBoxDottedStroke:"#0007",boundingBoxStroke:"#fffA",controlFill:"#fff"};function $R(t){let{image:e}=t,n={...vP,...t.theme||{}},i=(0,Ei.useRef)(),a=(0,Ei.useRef)(),r=(0,Ei.useRef)(),l=(0,Ei.useRef)(),u=(0,Ei.useRef)(),f=(0,Ei.useRef)(),h=(0,Ei.useRef)(),d=(0,Ei.useRef)(),m=(0,Ei.useRef)(),y=(0,Ei.useRef)(),[g,b]=(0,Ei.useState)(null),[w,E]=(0,Ei.useState)(!1),{helper:T,state:S,currentShape:R}=JR((nt,X)=>{if(nt.closestLineIndex,Vo.updateTransitionBoundingBox(r.current,nt,X),Vo.updateBoundingBoxPolygon(i.current,nt,X),Vo.updateBoundingBoxPolygon(a.current,nt,X),Vo.updateTransitionShape(h.current,nt,X),Vo.updateClosestLinePointTransform(u.current,nt,X),Vo.updateSelectBox(l.current,nt,X),Vo.updatePointLine(d.current,nt,X),Vo.updateDrawPreview(f.current,nt,X,3),Vo.updateLineBox(m.current,nt),b(nt.transitionDirection),E(nt.transitionRotate),nt.closestLineIndex!==-1&&y.current){let mt=nt.polygon,lt=mt.points[nt.closestLineIndex],it=mt.points[(nt.closestLineIndex+1)%mt.points.length];lt&&it&&y.current.setAttribute("points",`${lt[0]},${lt[1]} ${it[0]},${it[1]}`)}});(0,Ei.useEffect)(()=>{let nt=()=>{T.modifiers.reset()};return document.addEventListener("mouseleave",nt),()=>{document.removeEventListener("mouseleave",nt)}},[]);let A=(0,Ee.jsxs)(Ee.Fragment,{children:[(0,Ee.jsxs)("marker",{id:"dot",viewBox:"0 0 10 10",refX:"5",refY:"5",markerWidth:"5",markerHeight:"5",children:[(0,Ee.jsx)("circle",{cx:"5",cy:"5",r:"5",fill:n.lineStroke,className:"marker"}),(0,Ee.jsx)("circle",{cx:"5",cy:"5",r:"3",fill:n.controlFill})]}),(0,Ee.jsx)("marker",{id:"newdot",viewBox:"0 0 10 10",refX:"5",refY:"5",markerWidth:"5",markerHeight:"5",children:(0,Ee.jsx)("circle",{cx:"5",cy:"5",r:"5",fill:n.activeLineStroke,className:"marker"})}),(0,Ee.jsxs)("marker",{id:"selected",viewBox:"0 0 10 10",refX:"5",refY:"5",markerWidth:"5",markerHeight:"5",children:[(0,Ee.jsx)("circle",{cx:"5",cy:"5",r:"5",fill:n.lineStroke}),(0,Ee.jsx)("circle",{cx:"5",cy:"5",r:"3",fill:n.activeLineStroke})]}),(0,Ee.jsxs)("marker",{id:"resizer",viewBox:"0 0 10 10",refX:"5",refY:"5",markerWidth:"6",markerHeight:"6",children:[(0,Ee.jsx)("rect",{width:"10",height:"10",fill:n.lineStroke}),(0,Ee.jsx)("rect",{x:"1",y:"1",width:"8",height:"8",fill:n.controlFill})]})]}),M=R?R.open?"polyline":"polygon":null,z=!S.showBoundingBox&&S.closestPoint!==null&&S.actionIntentType==="select-point",I=S.actionIntentType==="add-open-point",L=S.transitionIntentType==="split-line",H=S.transitioning&&S.selectedStamp&&S.transitionIntentType==="stamp-shape",V=R&&M?(0,Ee.jsxs)(Ee.Fragment,{children:[(0,Ee.jsx)(M,{fill:(!S.transitioning||S.transitionIntentType==="select-multiple-points")&&!R.open?n.shapeFill:"none",strokeWidth:H||S.showBoundingBox&&S.boxMode||S.transitioning&&S.transitionIntentType==="split-line"||S.transitioning&&S.transitionIntentType==="move-point"?0:2,stroke:n.shapeStroke,points:R.points.map(nt=>nt.join(",")).join(" "),vectorEffect:"non-scaling-stroke",markerStart:S.showBoundingBox?void 0:S.boxMode?"url(#resizer)":"url(#dot)",markerMid:S.showBoundingBox?void 0:S.boxMode?"url(#resizer)":"url(#dot)",markerEnd:S.showBoundingBox?void 0:S.boxMode?"url(#resizer)":"url(#dot)",style:{pointerEvents:"none"},opacity:S.transitioning&&S.transitionIntentType==="move-shape"?0:1}),S.currentTool==="lineBox"&&S.actionIntentType==="close-line-box"?(0,Ee.jsx)("polygon",{fill:n.shapeFill,ref:m,stroke:n.lineStroke,strokeWidth:2,vectorEffect:"non-scaling-stroke"}):null,S.transitionIntentType==="draw-shape"&&S.transitioning?(0,Ee.jsx)("polyline",{ref:f,fill:"none",stroke:n.activeLineStroke,strokeWidth:2,vectorEffect:"non-scaling-stroke"}):null,!(S.transitioning&&S.transitionIntentType==="move-point")&&!(S.transitioning&&S.transitionIntentType==="stamp-shape")&&!S.showBoundingBox&&S.selectedPoints&&S.selectedPoints.length?(0,Ee.jsx)("polyline",{strokeWidth:2,vectorEffect:"non-scaling-stroke",stroke:"transparent",markerStart:"url(#selected)",markerMid:"url(#selected)",markerEnd:"url(#selected)",fill:"transparent",points:R.points.filter((nt,X)=>S.selectedPoints?.includes(X)).map(nt=>nt.join(",")).join(" "),opacity:S.transitioning&&S.transitionIntentType==="move-shape"?0:1}):null,z&&!S.transitioning&&S.closestPoint!==null&&R.points[S.closestPoint]?(0,Ee.jsx)("polyline",{strokeWidth:2,vectorEffect:"non-scaling-stroke",stroke:"transparent",markerStart:"url(#selected)",markerMid:"url(#selected)",markerEnd:"url(#selected)",fill:n.activeLineStroke,points:`${R.points[S.closestPoint][0]},${R.points[S.closestPoint][1]}`,opacity:S.transitioning&&S.transitionIntentType==="move-shape"?0:1}):null,!S.transitioning&&(S.actionIntentType==="add-open-point"||S.actionIntentType==="close-shape"||S.actionIntentType==="close-shape-line")?(0,Ee.jsx)("polyline",{stroke:n.activeLineStroke,ref:d,strokeWidth:S.actionIntentType==="add-open-point"?1:2,vectorEffect:"non-scaling-stroke"}):null,S.hasClosestLine&&!S.showBoundingBox&&!S.transitioning&&S.currentTool!=="box"&&S.transitionIntentType==="split-line"?(0,Ee.jsx)("g",{children:(0,Ee.jsx)("polyline",{ref:y,vectorEffect:"non-scaling-stroke",fill:"transparent",stroke:n.activeLineStroke,strokeWidth:3})}):null,S.hasClosestLine&&!S.showBoundingBox&&!S.transitioning&&S.currentTool!=="box"&&S.transitionIntentType==="split-line"?(0,Ee.jsx)("g",{ref:u,children:(0,Ee.jsx)("polyline",{markerStart:"url(#newdot)",points:"0,0 1,1",vectorEffect:"non-scaling-stroke",stroke:"transparent",fill:"transparent",strokeWidth:2})}):null,S.transitioning?(0,Ee.jsx)(M,{ref:h,fill:R.open?"none":n.shapeFill,stroke:S.transitionIntentType==="stamp-shape"?n.activeLineStroke:n.shapeStroke,vectorEffect:"non-scaling-stroke",strokeWidth:(R.open,2)}):null,S.transitioning&&S.transitionIntentType==="select-multiple-points"?(0,Ee.jsx)("rect",{ref:l,fill:"rgba(255, 255, 255, .3)",strokeWidth:1,stroke:"rgba(0,0,0,.2)",vectorEffect:"non-scaling-stroke"}):null,S.showBoundingBox&&!H?(0,Ee.jsxs)(Ee.Fragment,{children:[(0,Ee.jsx)("polygon",{ref:i,strokeWidth:2,stroke:n.boundingBoxStroke,fill:"none",markerStart:"url(#resizer)",markerMid:"url(#resizer)",markerEnd:"url(#resizer)",vectorEffect:"non-scaling-stroke"}),(0,Ee.jsx)("polygon",{ref:a,strokeWidth:2,stroke:n.boundingBoxDottedStroke,fill:"none",strokeDasharray:"4 4",markerStart:"url(#resizer)",markerMid:"url(#resizer)",markerEnd:"url(#resizer)",vectorEffect:"non-scaling-stroke"})]}):null]}):null;return{currentTool:T.state.slowState.currentTool,setCurrentTool:T.tools.setTool,helper:T,currentShape:R,state:S,isAddingPoint:I,isSplitting:L,isStamping:H,isHoveringPoint:z,transitionDirection:g,transitionRotate:w,defs:A,editor:V}}var al=N(tt(),1);function bP(t){let e=jv(),{image:n}=t,{helper:i,defs:a,editor:r,state:l,transitionDirection:u,isSplitting:f,transitionRotate:h,isHoveringPoint:d,isAddingPoint:m}=$R({image:t.image,theme:t.theme}),y=(0,rl.useCallback)(w=>{w.button!==2&&i.pointer([[~~w.atlas.x,~~w.atlas.y]])},[i]),g=(0,rl.useCallback)(w=>{w.button!==2&&i.pointerDown()},[i]),b=(0,rl.useCallback)(w=>{w.button!==2&&i.pointerUp()},[i]);return(0,rl.useEffect)(()=>{let w=E=>{i.key.up(E.key)};return document.addEventListener("keyup",w),()=>{document.removeEventListener("keyup",w)}},[i]),(0,rl.useEffect)(()=>{let w=E=>{E.target&&["INPUT","TEXTAREA"].includes(E.target.tagName)||E.target?.isContentEditable||document.activeElement&&(document.activeElement instanceof HTMLInputElement||document.activeElement instanceof HTMLTextAreaElement||document.activeElement.isContentEditable)||i.key.down(E.key)};return document.addEventListener("keydown",w),()=>{document.removeEventListener("keydown",w)}},[i]),(0,rl.useEffect)(()=>{let w=[];return u&&w.push(`atlas-cursor-${u}`),l.actionIntentType==="cut-line"&&l.modifiers?.Shift&&w.push("atlas-cursor-cut"),(d||l.transitionIntentType==="move-shape"||l.transitionIntentType==="move-point")&&w.push("atlas-cursor-move"),m&&w.push("atlas-cursor-crosshair"),f&&w.push("atlas-cursor-copy"),h&&w.push("atlas-cursor-rotate"),l.transitionIntentType==="draw-shape"&&w.push("atlas-cursor-draw"),e?.canvas&&e.canvas.classList.add(...w),()=>{e?.canvas&&e.canvas.classList.remove(...w)}},[e?.canvas,m,d,f,l.modifiers?.Shift,l.actionIntentType,l.transitionIntentType,u,h]),(0,al.jsx)("world-object",{height:n.height,width:n.width,onMouseMove:y,onMouseDown:g,onMouseUp:b,onMouseLeave:i.blur,children:(0,al.jsx)(ea,{relative:!0,interactive:!1,children:(0,al.jsx)("div",{className:"absolute top-0 right-0 left-0 bottom-0",children:(0,al.jsxs)("svg",{width:"100%",height:"100%",viewBox:`0 0 ${n.width} ${n.height}`,tabIndex:-1,children:[(0,al.jsx)("title",{children:"Annotation Editor"}),(0,al.jsx)("defs",{children:a}),r]})})})})}var v4=N(ct(),1);var ae=N(ct(),1);function v0(){return typeof window<"u"}function ol(t){return SP(t)?(t.nodeName||"").toLowerCase():"#document"}function Hi(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Tr(t){var e;return(e=(SP(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function SP(t){return v0()?t instanceof Node||t instanceof Hi(t).Node:!1}function fn(t){return v0()?t instanceof Element||t instanceof Hi(t).Element:!1}function na(t){return v0()?t instanceof HTMLElement||t instanceof Hi(t).HTMLElement:!1}function vp(t){return!v0()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Hi(t).ShadowRoot}var Z7=new Set(["inline","contents"]);function Dd(t){let{overflow:e,overflowX:n,overflowY:i,display:a}=ia(t);return/auto|scroll|overlay|hidden|clip/.test(e+i+n)&&!Z7.has(a)}var W7=new Set(["table","td","th"]);function xP(t){return W7.has(ol(t))}var J7=[":popover-open",":modal"];function bp(t){return J7.some(e=>{try{return t.matches(e)}catch{return!1}})}var $7=["transform","translate","scale","rotate","perspective"],t9=["transform","translate","scale","rotate","perspective","filter"],e9=["paint","layout","strict","content"];function b0(t){let e=Pd(),n=fn(t)?ia(t):t;return $7.some(i=>n[i]?n[i]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||t9.some(i=>(n.willChange||"").includes(i))||e9.some(i=>(n.contain||"").includes(i))}function wP(t){let e=wr(t);for(;na(e)&&!Rr(e);){if(b0(e))return e;if(bp(e))return null;e=wr(e)}return null}function Pd(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}var n9=new Set(["html","body","#document"]);function Rr(t){return n9.has(ol(t))}function ia(t){return Hi(t).getComputedStyle(t)}function Sp(t){return fn(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function wr(t){if(ol(t)==="html")return t;let e=t.assignedSlot||t.parentNode||vp(t)&&t.host||Tr(t);return vp(e)?e.host:e}function TP(t){let e=wr(t);return Rr(e)?t.ownerDocument?t.ownerDocument.body:t.body:na(e)&&Dd(e)?e:TP(e)}function za(t,e,n){var i;e===void 0&&(e=[]),n===void 0&&(n=!0);let a=TP(t),r=a===((i=t.ownerDocument)==null?void 0:i.body),l=Hi(a);if(r){let u=S0(l);return e.concat(l,l.visualViewport||[],Dd(a)?a:[],u&&n?za(u):[])}return e.concat(a,za(a,[],n))}function S0(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}var Ap=N(ct(),1),_P=N(ct(),1);var Bd=Math.min,jo=Math.max,wp=Math.round,Tp=Math.floor,Er=t=>({x:t,y:t}),i9={left:"right",right:"left",bottom:"top",top:"bottom"},a9={start:"end",end:"start"};function tE(t,e,n){return jo(t,Bd(e,n))}function Rp(t,e){return typeof t=="function"?t(e):t}function sl(t){return t.split("-")[0]}function Ep(t){return t.split("-")[1]}function eE(t){return t==="x"?"y":"x"}function nE(t){return t==="y"?"height":"width"}var r9=new Set(["top","bottom"]);function ko(t){return r9.has(sl(t))?"y":"x"}function iE(t){return eE(ko(t))}function AP(t,e,n){n===void 0&&(n=!1);let i=Ep(t),a=iE(t),r=nE(a),l=a==="x"?i===(n?"end":"start")?"right":"left":i==="start"?"bottom":"top";return e.reference[r]>e.floating[r]&&(l=xp(l)),[l,xp(l)]}function CP(t){let e=xp(t);return[x0(t),e,x0(e)]}function x0(t){return t.replace(/start|end/g,e=>a9[e])}var RP=["left","right"],EP=["right","left"],o9=["top","bottom"],s9=["bottom","top"];function l9(t,e,n){switch(t){case"top":case"bottom":return n?e?EP:RP:e?RP:EP;case"left":case"right":return e?o9:s9;default:return[]}}function MP(t,e,n,i){let a=Ep(t),r=l9(sl(t),n==="start",i);return a&&(r=r.map(l=>l+"-"+a),e&&(r=r.concat(r.map(x0)))),r}function xp(t){return t.replace(/left|right|bottom|top/g,e=>i9[e])}function u9(t){return{top:0,right:0,bottom:0,left:0,...t}}function OP(t){return typeof t!="number"?u9(t):{top:t,right:t,bottom:t,left:t}}function Eu(t){let{x:e,y:n,width:i,height:a}=t;return{width:i,height:a,top:n,left:e,right:e+i,bottom:n+a,x:e,y:n}}function aE(t,e){if(!t||!e)return!1;let n=e.getRootNode==null?void 0:e.getRootNode();if(t.contains(e))return!0;if(n&&vp(n)){let i=e;for(;i;){if(t===i)return!0;i=i.parentNode||i.host}}return!1}function Hd(t){return"composedPath"in t?t.composedPath()[0]:t.target}function w0(t,e){if(e==null)return!1;if("composedPath"in t)return t.composedPath().includes(e);let n=t;return n.target!=null&&e.contains(n.target)}function zP(t){return t.matches("html,body")}function rE(t){return t?.ownerDocument||document}function Cp(t,e,n){return n===void 0&&(n=!0),t.filter(a=>{var r;return a.parentId===e&&(!n||((r=a.context)==null?void 0:r.open))}).flatMap(a=>[a,...Cp(t,a.id,n)])}function IP(t){return"nativeEvent"in t}var c9=typeof document<"u",d9=function(){},T0=c9?_P.useLayoutEffect:d9,f9={...Ap};var h9=f9.useInsertionEffect,p9=h9||(t=>t());function Au(t){let e=Ap.useRef(()=>{});return p9(()=>{e.current=t}),Ap.useCallback(function(){for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return e.current==null?void 0:e.current(...i)},[])}var pE=N(tt(),1);var r4=N(kl(),1);function NP(t,e,n){let{reference:i,floating:a}=t,r=ko(e),l=iE(e),u=nE(l),f=sl(e),h=r==="y",d=i.x+i.width/2-a.width/2,m=i.y+i.height/2-a.height/2,y=i[u]/2-a[u]/2,g;switch(f){case"top":g={x:d,y:i.y-a.height};break;case"bottom":g={x:d,y:i.y+i.height};break;case"right":g={x:i.x+i.width,y:m};break;case"left":g={x:i.x-a.width,y:m};break;default:g={x:i.x,y:i.y}}switch(Ep(e)){case"start":g[l]-=y*(n&&h?-1:1);break;case"end":g[l]+=y*(n&&h?-1:1);break}return g}var LP=async(t,e,n)=>{let{placement:i="bottom",strategy:a="absolute",middleware:r=[],platform:l}=n,u=r.filter(Boolean),f=await(l.isRTL==null?void 0:l.isRTL(e)),h=await l.getElementRects({reference:t,floating:e,strategy:a}),{x:d,y:m}=NP(h,i,f),y=i,g={},b=0;for(let w=0;w<u.length;w++){let{name:E,fn:T}=u[w],{x:S,y:R,data:A,reset:M}=await T({x:d,y:m,initialPlacement:i,placement:y,strategy:a,middlewareData:g,rects:h,platform:l,elements:{reference:t,floating:e}});d=S??d,m=R??m,g={...g,[E]:{...g[E],...A}},M&&b<=50&&(b++,typeof M=="object"&&(M.placement&&(y=M.placement),M.rects&&(h=M.rects===!0?await l.getElementRects({reference:t,floating:e,strategy:a}):M.rects),{x:d,y:m}=NP(h,y,f)),w=-1)}return{x:d,y:m,placement:y,strategy:a,middlewareData:g}};async function R0(t,e){var n;e===void 0&&(e={});let{x:i,y:a,platform:r,rects:l,elements:u,strategy:f}=t,{boundary:h="clippingAncestors",rootBoundary:d="viewport",elementContext:m="floating",altBoundary:y=!1,padding:g=0}=Rp(e,t),b=OP(g),E=u[y?m==="floating"?"reference":"floating":m],T=Eu(await r.getClippingRect({element:(n=await(r.isElement==null?void 0:r.isElement(E)))==null||n?E:E.contextElement||await(r.getDocumentElement==null?void 0:r.getDocumentElement(u.floating)),boundary:h,rootBoundary:d,strategy:f})),S=m==="floating"?{x:i,y:a,width:l.floating.width,height:l.floating.height}:l.reference,R=await(r.getOffsetParent==null?void 0:r.getOffsetParent(u.floating)),A=await(r.isElement==null?void 0:r.isElement(R))?await(r.getScale==null?void 0:r.getScale(R))||{x:1,y:1}:{x:1,y:1},M=Eu(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:u,rect:S,offsetParent:R,strategy:f}):S);return{top:(T.top-M.top+b.top)/A.y,bottom:(M.bottom-T.bottom+b.bottom)/A.y,left:(T.left-M.left+b.left)/A.x,right:(M.right-T.right+b.right)/A.x}}var DP=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,i;let{placement:a,middlewareData:r,rects:l,initialPlacement:u,platform:f,elements:h}=e,{mainAxis:d=!0,crossAxis:m=!0,fallbackPlacements:y,fallbackStrategy:g="bestFit",fallbackAxisSideDirection:b="none",flipAlignment:w=!0,...E}=Rp(t,e);if((n=r.arrow)!=null&&n.alignmentOffset)return{};let T=sl(a),S=ko(u),R=sl(u)===u,A=await(f.isRTL==null?void 0:f.isRTL(h.floating)),M=y||(R||!w?[xp(u)]:CP(u)),z=b!=="none";!y&&z&&M.push(...MP(u,w,b,A));let I=[u,...M],L=await R0(e,E),H=[],V=((i=r.flip)==null?void 0:i.overflows)||[];if(d&&H.push(L[T]),m){let lt=AP(a,l,A);H.push(L[lt[0]],L[lt[1]])}if(V=[...V,{placement:a,overflows:H}],!H.every(lt=>lt<=0)){var nt,X;let lt=(((nt=r.flip)==null?void 0:nt.index)||0)+1,it=I[lt];if(it&&(!(m==="alignment"?S!==ko(it):!1)||V.every(et=>et.overflows[0]>0&&ko(et.placement)===S)))return{data:{index:lt,overflows:V},reset:{placement:it}};let yt=(X=V.filter(xt=>xt.overflows[0]<=0).sort((xt,et)=>xt.overflows[1]-et.overflows[1])[0])==null?void 0:X.placement;if(!yt)switch(g){case"bestFit":{var mt;let xt=(mt=V.filter(et=>{if(z){let gt=ko(et.placement);return gt===S||gt==="y"}return!0}).map(et=>[et.placement,et.overflows.filter(gt=>gt>0).reduce((gt,Mt)=>gt+Mt,0)]).sort((et,gt)=>et[1]-gt[1])[0])==null?void 0:mt[0];xt&&(yt=xt);break}case"initialPlacement":yt=u;break}if(a!==yt)return{reset:{placement:yt}}}return{}}}};var m9=new Set(["left","top"]);async function g9(t,e){let{placement:n,platform:i,elements:a}=t,r=await(i.isRTL==null?void 0:i.isRTL(a.floating)),l=sl(n),u=Ep(n),f=ko(n)==="y",h=m9.has(l)?-1:1,d=r&&f?-1:1,m=Rp(e,t),{mainAxis:y,crossAxis:g,alignmentAxis:b}=typeof m=="number"?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:m.mainAxis||0,crossAxis:m.crossAxis||0,alignmentAxis:m.alignmentAxis};return u&&typeof b=="number"&&(g=u==="end"?b*-1:b),f?{x:g*d,y:y*h}:{x:y*h,y:g*d}}var PP=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,i;let{x:a,y:r,placement:l,middlewareData:u}=e,f=await g9(e,t);return l===((n=u.offset)==null?void 0:n.placement)&&(i=u.arrow)!=null&&i.alignmentOffset?{}:{x:a+f.x,y:r+f.y,data:{...f,placement:l}}}}},BP=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){let{x:n,y:i,placement:a}=e,{mainAxis:r=!0,crossAxis:l=!1,limiter:u={fn:E=>{let{x:T,y:S}=E;return{x:T,y:S}}},...f}=Rp(t,e),h={x:n,y:i},d=await R0(e,f),m=ko(sl(a)),y=eE(m),g=h[y],b=h[m];if(r){let E=y==="y"?"top":"left",T=y==="y"?"bottom":"right",S=g+d[E],R=g-d[T];g=tE(S,g,R)}if(l){let E=m==="y"?"top":"left",T=m==="y"?"bottom":"right",S=b+d[E],R=b-d[T];b=tE(S,b,R)}let w=u.fn({...e,[y]:g,[m]:b});return{...w,data:{x:w.x-n,y:w.y-i,enabled:{[y]:r,[m]:l}}}}}};function qP(t){let e=ia(t),n=parseFloat(e.width)||0,i=parseFloat(e.height)||0,a=na(t),r=a?t.offsetWidth:n,l=a?t.offsetHeight:i,u=wp(n)!==r||wp(i)!==l;return u&&(n=r,i=l),{width:n,height:i,$:u}}function sE(t){return fn(t)?t:t.contextElement}function Fd(t){let e=sE(t);if(!na(e))return Er(1);let n=e.getBoundingClientRect(),{width:i,height:a,$:r}=qP(e),l=(r?wp(n.width):n.width)/i,u=(r?wp(n.height):n.height)/a;return(!l||!Number.isFinite(l))&&(l=1),(!u||!Number.isFinite(u))&&(u=1),{x:l,y:u}}var y9=Er(0);function UP(t){let e=Hi(t);return!Pd()||!e.visualViewport?y9:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function v9(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==Hi(t)?!1:e}function Cu(t,e,n,i){e===void 0&&(e=!1),n===void 0&&(n=!1);let a=t.getBoundingClientRect(),r=sE(t),l=Er(1);e&&(i?fn(i)&&(l=Fd(i)):l=Fd(t));let u=v9(r,n,i)?UP(r):Er(0),f=(a.left+u.x)/l.x,h=(a.top+u.y)/l.y,d=a.width/l.x,m=a.height/l.y;if(r){let y=Hi(r),g=i&&fn(i)?Hi(i):i,b=y,w=S0(b);for(;w&&i&&g!==b;){let E=Fd(w),T=w.getBoundingClientRect(),S=ia(w),R=T.left+(w.clientLeft+parseFloat(S.paddingLeft))*E.x,A=T.top+(w.clientTop+parseFloat(S.paddingTop))*E.y;f*=E.x,h*=E.y,d*=E.x,m*=E.y,f+=R,h+=A,b=Hi(w),w=S0(b)}}return Eu({width:d,height:m,x:f,y:h})}function lE(t,e){let n=Sp(t).scrollLeft;return e?e.left+n:Cu(Tr(t)).left+n}function VP(t,e,n){n===void 0&&(n=!1);let i=t.getBoundingClientRect(),a=i.left+e.scrollLeft-(n?0:lE(t,i)),r=i.top+e.scrollTop;return{x:a,y:r}}function b9(t){let{elements:e,rect:n,offsetParent:i,strategy:a}=t,r=a==="fixed",l=Tr(i),u=e?bp(e.floating):!1;if(i===l||u&&r)return n;let f={scrollLeft:0,scrollTop:0},h=Er(1),d=Er(0),m=na(i);if((m||!m&&!r)&&((ol(i)!=="body"||Dd(l))&&(f=Sp(i)),na(i))){let g=Cu(i);h=Fd(i),d.x=g.x+i.clientLeft,d.y=g.y+i.clientTop}let y=l&&!m&&!r?VP(l,f,!0):Er(0);return{width:n.width*h.x,height:n.height*h.y,x:n.x*h.x-f.scrollLeft*h.x+d.x+y.x,y:n.y*h.y-f.scrollTop*h.y+d.y+y.y}}function S9(t){return Array.from(t.getClientRects())}function x9(t){let e=Tr(t),n=Sp(t),i=t.ownerDocument.body,a=jo(e.scrollWidth,e.clientWidth,i.scrollWidth,i.clientWidth),r=jo(e.scrollHeight,e.clientHeight,i.scrollHeight,i.clientHeight),l=-n.scrollLeft+lE(t),u=-n.scrollTop;return ia(i).direction==="rtl"&&(l+=jo(e.clientWidth,i.clientWidth)-a),{width:a,height:r,x:l,y:u}}function w9(t,e){let n=Hi(t),i=Tr(t),a=n.visualViewport,r=i.clientWidth,l=i.clientHeight,u=0,f=0;if(a){r=a.width,l=a.height;let h=Pd();(!h||h&&e==="fixed")&&(u=a.offsetLeft,f=a.offsetTop)}return{width:r,height:l,x:u,y:f}}var T9=new Set(["absolute","fixed"]);function R9(t,e){let n=Cu(t,!0,e==="fixed"),i=n.top+t.clientTop,a=n.left+t.clientLeft,r=na(t)?Fd(t):Er(1),l=t.clientWidth*r.x,u=t.clientHeight*r.y,f=a*r.x,h=i*r.y;return{width:l,height:u,x:f,y:h}}function HP(t,e,n){let i;if(e==="viewport")i=w9(t,n);else if(e==="document")i=x9(Tr(t));else if(fn(e))i=R9(e,n);else{let a=UP(t);i={x:e.x-a.x,y:e.y-a.y,width:e.width,height:e.height}}return Eu(i)}function jP(t,e){let n=wr(t);return n===e||!fn(n)||Rr(n)?!1:ia(n).position==="fixed"||jP(n,e)}function E9(t,e){let n=e.get(t);if(n)return n;let i=za(t,[],!1).filter(u=>fn(u)&&ol(u)!=="body"),a=null,r=ia(t).position==="fixed",l=r?wr(t):t;for(;fn(l)&&!Rr(l);){let u=ia(l),f=b0(l);!f&&u.position==="fixed"&&(a=null),(r?!f&&!a:!f&&u.position==="static"&&!!a&&T9.has(a.position)||Dd(l)&&!f&&jP(t,l))?i=i.filter(d=>d!==l):a=u,l=wr(l)}return e.set(t,i),i}function A9(t){let{element:e,boundary:n,rootBoundary:i,strategy:a}=t,l=[...n==="clippingAncestors"?bp(e)?[]:E9(e,this._c):[].concat(n),i],u=l[0],f=l.reduce((h,d)=>{let m=HP(e,d,a);return h.top=jo(m.top,h.top),h.right=Bd(m.right,h.right),h.bottom=Bd(m.bottom,h.bottom),h.left=jo(m.left,h.left),h},HP(e,u,a));return{width:f.right-f.left,height:f.bottom-f.top,x:f.left,y:f.top}}function C9(t){let{width:e,height:n}=qP(t);return{width:e,height:n}}function M9(t,e,n){let i=na(e),a=Tr(e),r=n==="fixed",l=Cu(t,!0,r,e),u={scrollLeft:0,scrollTop:0},f=Er(0);function h(){f.x=lE(a)}if(i||!i&&!r)if((ol(e)!=="body"||Dd(a))&&(u=Sp(e)),i){let g=Cu(e,!0,r,e);f.x=g.x+e.clientLeft,f.y=g.y+e.clientTop}else a&&h();r&&!i&&a&&h();let d=a&&!i&&!r?VP(a,u):Er(0),m=l.left+u.scrollLeft-f.x-d.x,y=l.top+u.scrollTop-f.y-d.y;return{x:m,y,width:l.width,height:l.height}}function oE(t){return ia(t).position==="static"}function FP(t,e){if(!na(t)||ia(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return Tr(t)===n&&(n=n.ownerDocument.body),n}function kP(t,e){let n=Hi(t);if(bp(t))return n;if(!na(t)){let a=wr(t);for(;a&&!Rr(a);){if(fn(a)&&!oE(a))return a;a=wr(a)}return n}let i=FP(t,e);for(;i&&xP(i)&&oE(i);)i=FP(i,e);return i&&Rr(i)&&oE(i)&&!b0(i)?n:i||wP(t)||n}var O9=async function(t){let e=this.getOffsetParent||kP,n=this.getDimensions,i=await n(t.floating);return{reference:M9(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function _9(t){return ia(t).direction==="rtl"}var uE={convertOffsetParentRelativeRectToViewportRelativeRect:b9,getDocumentElement:Tr,getClippingRect:A9,getOffsetParent:kP,getElementRects:O9,getClientRects:S9,getDimensions:C9,getScale:Fd,isElement:fn,isRTL:_9};function GP(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function z9(t,e){let n=null,i,a=Tr(t);function r(){var u;clearTimeout(i),(u=n)==null||u.disconnect(),n=null}function l(u,f){u===void 0&&(u=!1),f===void 0&&(f=1),r();let h=t.getBoundingClientRect(),{left:d,top:m,width:y,height:g}=h;if(u||e(),!y||!g)return;let b=Tp(m),w=Tp(a.clientWidth-(d+y)),E=Tp(a.clientHeight-(m+g)),T=Tp(d),R={rootMargin:-b+"px "+-w+"px "+-E+"px "+-T+"px",threshold:jo(0,Bd(1,f))||1},A=!0;function M(z){let I=z[0].intersectionRatio;if(I!==f){if(!A)return l();I?l(!1,I):i=setTimeout(()=>{l(!1,1e-7)},1e3)}I===1&&!GP(h,t.getBoundingClientRect())&&l(),A=!1}try{n=new IntersectionObserver(M,{...R,root:a.ownerDocument})}catch{n=new IntersectionObserver(M,R)}n.observe(t)}return l(!0),r}function E0(t,e,n,i){i===void 0&&(i={});let{ancestorScroll:a=!0,ancestorResize:r=!0,elementResize:l=typeof ResizeObserver=="function",layoutShift:u=typeof IntersectionObserver=="function",animationFrame:f=!1}=i,h=sE(t),d=a||r?[...h?za(h):[],...za(e)]:[];d.forEach(T=>{a&&T.addEventListener("scroll",n,{passive:!0}),r&&T.addEventListener("resize",n)});let m=h&&u?z9(h,n):null,y=-1,g=null;l&&(g=new ResizeObserver(T=>{let[S]=T;S&&S.target===h&&g&&(g.unobserve(e),cancelAnimationFrame(y),y=requestAnimationFrame(()=>{var R;(R=g)==null||R.observe(e)})),n()}),h&&!f&&g.observe(h),g.observe(e));let b,w=f?Cu(t):null;f&&E();function E(){let T=Cu(t);w&&!GP(w,T)&&n(),w=T,b=requestAnimationFrame(E)}return n(),()=>{var T;d.forEach(S=>{a&&S.removeEventListener("scroll",n),r&&S.removeEventListener("resize",n)}),m?.(),(T=g)==null||T.disconnect(),g=null,f&&cancelAnimationFrame(b)}}var Mp=R0,YP=PP;var XP=BP,QP=DP;var A0=(t,e,n)=>{let i=new Map,a={platform:uE,...n},r={...a.platform,_c:i};return LP(t,e,{...a,platform:r})};var Hn=N(ct(),1),ZP=N(ct(),1),WP=N(kl(),1),I9=typeof document<"u",N9=function(){},C0=I9?ZP.useLayoutEffect:N9;function M0(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,i,a;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(i=n;i--!==0;)if(!M0(t[i],e[i]))return!1;return!0}if(a=Object.keys(t),n=a.length,n!==Object.keys(e).length)return!1;for(i=n;i--!==0;)if(!{}.hasOwnProperty.call(e,a[i]))return!1;for(i=n;i--!==0;){let r=a[i];if(!(r==="_owner"&&t.$$typeof)&&!M0(t[r],e[r]))return!1}return!0}return t!==t&&e!==e}function JP(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function KP(t,e){let n=JP(t);return Math.round(e*n)/n}function cE(t){let e=Hn.useRef(t);return C0(()=>{e.current=t}),e}function $P(t){t===void 0&&(t={});let{placement:e="bottom",strategy:n="absolute",middleware:i=[],platform:a,elements:{reference:r,floating:l}={},transform:u=!0,whileElementsMounted:f,open:h}=t,[d,m]=Hn.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[y,g]=Hn.useState(i);M0(y,i)||g(i);let[b,w]=Hn.useState(null),[E,T]=Hn.useState(null),S=Hn.useCallback(et=>{et!==z.current&&(z.current=et,w(et))},[]),R=Hn.useCallback(et=>{et!==I.current&&(I.current=et,T(et))},[]),A=r||b,M=l||E,z=Hn.useRef(null),I=Hn.useRef(null),L=Hn.useRef(d),H=f!=null,V=cE(f),nt=cE(a),X=cE(h),mt=Hn.useCallback(()=>{if(!z.current||!I.current)return;let et={placement:e,strategy:n,middleware:y};nt.current&&(et.platform=nt.current),A0(z.current,I.current,et).then(gt=>{let Mt={...gt,isPositioned:X.current!==!1};lt.current&&!M0(L.current,Mt)&&(L.current=Mt,WP.flushSync(()=>{m(Mt)}))})},[y,e,n,nt,X]);C0(()=>{h===!1&&L.current.isPositioned&&(L.current.isPositioned=!1,m(et=>({...et,isPositioned:!1})))},[h]);let lt=Hn.useRef(!1);C0(()=>(lt.current=!0,()=>{lt.current=!1}),[]),C0(()=>{if(A&&(z.current=A),M&&(I.current=M),A&&M){if(V.current)return V.current(A,M,mt);mt()}},[A,M,mt,V,H]);let it=Hn.useMemo(()=>({reference:z,floating:I,setReference:S,setFloating:R}),[S,R]),yt=Hn.useMemo(()=>({reference:A,floating:M}),[A,M]),xt=Hn.useMemo(()=>{let et={position:n,left:0,top:0};if(!yt.floating)return et;let gt=KP(yt.floating,d.x),Mt=KP(yt.floating,d.y);return u?{...et,transform:"translate("+gt+"px, "+Mt+"px)",...JP(yt.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:gt,top:Mt}},[n,u,yt.floating,d.x,d.y]);return Hn.useMemo(()=>({...d,update:mt,refs:it,elements:yt,floatingStyles:xt}),[d,mt,it,yt,xt])}var O0=(t,e)=>({...YP(t),options:[t,e]}),dE=(t,e)=>({...XP(t),options:[t,e]});var fE=(t,e)=>({...QP(t),options:[t,e]});var L9="data-floating-ui-focusable",t4="active",e4="selected",D9="ArrowLeft",P9="ArrowRight",B9="ArrowUp",H9="ArrowDown";var F9=[D9,P9],q9=[B9,H9],ktt=[...F9,...q9];var U9={...ae},n4=!1,V9=0,i4=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+V9++;function j9(){let[t,e]=ae.useState(()=>n4?i4():void 0);return T0(()=>{t==null&&e(i4())},[]),ae.useEffect(()=>{n4=!0},[]),t}var k9=U9.useId,G9=k9||j9;function Y9(){let t=new Map;return{emit(e,n){var i;(i=t.get(e))==null||i.forEach(a=>a(n))},on(e,n){t.has(e)||t.set(e,new Set),t.get(e).add(n)},off(e,n){var i;(i=t.get(e))==null||i.delete(n)}}}var X9=ae.createContext(null),Q9=ae.createContext(null),K9=()=>{var t;return((t=ae.useContext(X9))==null?void 0:t.id)||null},o4=()=>ae.useContext(Q9);function Z9(t){return"data-floating-ui-"+t}function W9(t){t.current!==-1&&(clearTimeout(t.current),t.current=-1)}var J9={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},$9={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},a4=t=>{var e,n;return{escapeKey:typeof t=="boolean"?t:(e=t?.escapeKey)!=null?e:!1,outsidePress:typeof t=="boolean"?t:(n=t?.outsidePress)!=null?n:!0}};function s4(t,e){e===void 0&&(e={});let{open:n,onOpenChange:i,elements:a,dataRef:r}=t,{enabled:l=!0,escapeKey:u=!0,outsidePress:f=!0,outsidePressEvent:h="pointerdown",referencePress:d=!1,referencePressEvent:m="pointerdown",ancestorScroll:y=!1,bubbles:g,capture:b}=e,w=o4(),E=Au(typeof f=="function"?f:()=>!1),T=typeof f=="function"?E:f,S=ae.useRef(!1),{escapeKey:R,outsidePress:A}=a4(g),{escapeKey:M,outsidePress:z}=a4(b),I=ae.useRef(!1),L=ae.useRef(-1),H=Au(it=>{var yt;if(!n||!l||!u||it.key!=="Escape"||I.current)return;let xt=(yt=r.current.floatingContext)==null?void 0:yt.nodeId,et=w?Cp(w.nodesRef.current,xt):[];if(!R&&(it.stopPropagation(),et.length>0)){let gt=!0;if(et.forEach(Mt=>{var Vt;if((Vt=Mt.context)!=null&&Vt.open&&!Mt.context.dataRef.current.__escapeKeyBubbles){gt=!1;return}}),!gt)return}i(!1,IP(it)?it.nativeEvent:it,"escape-key")}),V=Au(it=>{var yt;let xt=()=>{var et;H(it),(et=Hd(it))==null||et.removeEventListener("keydown",xt)};(yt=Hd(it))==null||yt.addEventListener("keydown",xt)}),nt=Au(it=>{var yt;let xt=r.current.insideReactTree;r.current.insideReactTree=!1;let et=S.current;if(S.current=!1,h==="click"&&et||xt||typeof T=="function"&&!T(it))return;let gt=Hd(it),Mt="["+Z9("inert")+"]",Vt=rE(a.floating).querySelectorAll(Mt),Kt=fn(gt)?gt:null;for(;Kt&&!Rr(Kt);){let Ht=wr(Kt);if(Rr(Ht)||!fn(Ht))break;Kt=Ht}if(Vt.length&&fn(gt)&&!zP(gt)&&!aE(gt,a.floating)&&Array.from(Vt).every(Ht=>!aE(Kt,Ht)))return;if(na(gt)&<){let Ht=Rr(gt),ee=ia(gt),Gt=/auto|scroll/,re=Ht||Gt.test(ee.overflowX),Ae=Ht||Gt.test(ee.overflowY),Zt=re&>.clientWidth>0&>.scrollWidth>gt.clientWidth,fe=Ae&>.clientHeight>0&>.scrollHeight>gt.clientHeight,Ft=ee.direction==="rtl",tn=fe&&(Ft?it.offsetX<=gt.offsetWidth-gt.clientWidth:it.offsetX>gt.clientWidth),Jt=Zt&&it.offsetY>gt.clientHeight;if(tn||Jt)return}let te=(yt=r.current.floatingContext)==null?void 0:yt.nodeId,ue=w&&Cp(w.nodesRef.current,te).some(Ht=>{var ee;return w0(it,(ee=Ht.context)==null?void 0:ee.elements.floating)});if(w0(it,a.floating)||w0(it,a.domReference)||ue)return;let dt=w?Cp(w.nodesRef.current,te):[];if(dt.length>0){let Ht=!0;if(dt.forEach(ee=>{var Gt;if((Gt=ee.context)!=null&&Gt.open&&!ee.context.dataRef.current.__outsidePressBubbles){Ht=!1;return}}),!Ht)return}i(!1,it,"outside-press")}),X=Au(it=>{var yt;let xt=()=>{var et;nt(it),(et=Hd(it))==null||et.removeEventListener(h,xt)};(yt=Hd(it))==null||yt.addEventListener(h,xt)});ae.useEffect(()=>{if(!n||!l)return;r.current.__escapeKeyBubbles=R,r.current.__outsidePressBubbles=A;let it=-1;function yt(Vt){i(!1,Vt,"ancestor-scroll")}function xt(){window.clearTimeout(it),I.current=!0}function et(){it=window.setTimeout(()=>{I.current=!1},Pd()?5:0)}let gt=rE(a.floating);u&&(gt.addEventListener("keydown",M?V:H,M),gt.addEventListener("compositionstart",xt),gt.addEventListener("compositionend",et)),T&>.addEventListener(h,z?X:nt,z);let Mt=[];return y&&(fn(a.domReference)&&(Mt=za(a.domReference)),fn(a.floating)&&(Mt=Mt.concat(za(a.floating))),!fn(a.reference)&&a.reference&&a.reference.contextElement&&(Mt=Mt.concat(za(a.reference.contextElement)))),Mt=Mt.filter(Vt=>{var Kt;return Vt!==((Kt=gt.defaultView)==null?void 0:Kt.visualViewport)}),Mt.forEach(Vt=>{Vt.addEventListener("scroll",yt,{passive:!0})}),()=>{u&&(gt.removeEventListener("keydown",M?V:H,M),gt.removeEventListener("compositionstart",xt),gt.removeEventListener("compositionend",et)),T&>.removeEventListener(h,z?X:nt,z),Mt.forEach(Vt=>{Vt.removeEventListener("scroll",yt)}),window.clearTimeout(it)}},[r,a,u,T,h,n,i,y,l,R,A,H,M,V,nt,z,X]),ae.useEffect(()=>{r.current.insideReactTree=!1},[r,T,h]);let mt=ae.useMemo(()=>({onKeyDown:H,...d&&{[J9[m]]:it=>{i(!1,it.nativeEvent,"reference-press")},...m!=="click"&&{onClick(it){i(!1,it.nativeEvent,"reference-press")}}}}),[H,i,d,m]),lt=ae.useMemo(()=>({onKeyDown:H,onMouseDown(){S.current=!0},onMouseUp(){S.current=!0},[$9[h]]:()=>{r.current.insideReactTree=!0},onBlurCapture(){w||(W9(L),r.current.insideReactTree=!0,L.current=window.setTimeout(()=>{r.current.insideReactTree=!1}))}}),[H,h,r,w]);return ae.useMemo(()=>l?{reference:mt,floating:lt}:{},[l,mt,lt])}function tk(t){let{open:e=!1,onOpenChange:n,elements:i}=t,a=G9(),r=ae.useRef({}),[l]=ae.useState(()=>Y9()),u=K9()!=null,[f,h]=ae.useState(i.reference),d=Au((g,b,w)=>{r.current.openEvent=g?b:void 0,l.emit("openchange",{open:g,event:b,reason:w,nested:u}),n?.(g,b,w)}),m=ae.useMemo(()=>({setPositionReference:h}),[]),y=ae.useMemo(()=>({reference:f||i.reference||null,floating:i.floating||null,domReference:i.reference}),[f,i.reference,i.floating]);return ae.useMemo(()=>({dataRef:r,open:e,onOpenChange:d,elements:y,events:l,floatingId:a,refs:m}),[e,d,y,l,a,m])}function l4(t){t===void 0&&(t={});let{nodeId:e}=t,n=tk({...t,elements:{reference:null,floating:null,...t.elements}}),i=t.rootContext||n,a=i.elements,[r,l]=ae.useState(null),[u,f]=ae.useState(null),d=a?.domReference||r,m=ae.useRef(null),y=o4();T0(()=>{d&&(m.current=d)},[d]);let g=$P({...t,elements:{...a,...u&&{reference:u}}}),b=ae.useCallback(R=>{let A=fn(R)?{getBoundingClientRect:()=>R.getBoundingClientRect(),getClientRects:()=>R.getClientRects(),contextElement:R}:R;f(A),g.refs.setReference(A)},[g.refs]),w=ae.useCallback(R=>{(fn(R)||R===null)&&(m.current=R,l(R)),(fn(g.refs.reference.current)||g.refs.reference.current===null||R!==null&&!fn(R))&&g.refs.setReference(R)},[g.refs]),E=ae.useMemo(()=>({...g.refs,setReference:w,setPositionReference:b,domReference:m}),[g.refs,w,b]),T=ae.useMemo(()=>({...g.elements,domReference:d}),[g.elements,d]),S=ae.useMemo(()=>({...g,...i,refs:E,elements:T,nodeId:e}),[g,E,T,e,i]);return T0(()=>{i.dataRef.current.floatingContext=S;let R=y?.nodesRef.current.find(A=>A.id===e);R&&(R.context=S)}),ae.useMemo(()=>({...g,context:S,refs:E,elements:T}),[g,E,T,S])}function hE(t,e,n){let i=new Map,a=n==="item",r=t;if(a&&t){let{[t4]:l,[e4]:u,...f}=t;r=f}return{...n==="floating"&&{tabIndex:-1,[L9]:""},...r,...e.map(l=>{let u=l?l[n]:null;return typeof u=="function"?t?u(t):null:u}).concat(t).reduce((l,u)=>(u&&Object.entries(u).forEach(f=>{let[h,d]=f;if(!(a&&[t4,e4].includes(h)))if(h.indexOf("on")===0){if(i.has(h)||i.set(h,[]),typeof d=="function"){var m;(m=i.get(h))==null||m.push(d),l[h]=function(){for(var y,g=arguments.length,b=new Array(g),w=0;w<g;w++)b[w]=arguments[w];return(y=i.get(h))==null?void 0:y.map(E=>E(...b)).find(E=>E!==void 0)}}}else l[h]=d}),l),{})}}function u4(t){t===void 0&&(t=[]);let e=t.map(u=>u?.reference),n=t.map(u=>u?.floating),i=t.map(u=>u?.item),a=ae.useCallback(u=>hE(u,t,"reference"),e),r=ae.useCallback(u=>hE(u,t,"floating"),n),l=ae.useCallback(u=>hE(u,t,"item"),i);return ae.useMemo(()=>({getReferenceProps:a,getFloatingProps:r,getItemProps:l}),[a,r,l])}var g4=N(kl(),1);var ni=N(ct(),1);var c4=N(ct(),1),_0=N(ct(),1);var f4=N(tt(),1),d4=vr(),Mu=(0,_0.createContext)({emitter:d4});Mu.displayName="Events";function Op(){return c4.default.useContext(Mu).emitter}function ek({emitter:t,children:e}){return(0,f4.jsx)(Mu.Provider,{value:(0,_0.useMemo)(()=>({emitter:t}),[t]),children:e})}var Ia=N(tt(),1),_p=ni.default.createContext({});function zp(){let t=(0,ni.useContext)(_p),e=Object.keys(t),n={};for(let i of e)t[i].Provider&&(n[i]={value:(0,ni.useContext)(t[i]),Provider:t[i].Provider});return n}function h4(t){let e=Object.keys(t),n=t.children;for(let i of e){if(i==="children")continue;let{value:a,Provider:r}=t[i];n=(0,Ia.jsx)(r,{value:a,children:n})}return n}function nk(t){let e=(0,ni.useContext)(_p),n=(0,ni.useMemo)(()=>({...e,...t.providers}),[t.providers]);return(0,Ia.jsx)(_p.Provider,{value:n,children:t.children})}function Ip(){return{VaultContext:(0,ni.useContext)(hs),ResourceContext:(0,ni.useContext)(xf),SimpleViewerReactContext:(0,ni.useContext)(Ec),VisibleCanvasReactContext:(0,ni.useContext)(Bl),AuthRContext:(0,ni.useContext)(Fl),SearchReactContext:(0,ni.useContext)(Rc),ReactEventContext:(0,ni.useContext)(Mu),ContextBridgeReactContext:(0,ni.useContext)(_p),StrategyReactContext:(0,ni.useContext)($s),AtlasStoreReactContext:(0,ni.useContext)(mu)}}function Np(t){return(0,Ia.jsx)(co,{vault:t.bridge.VaultContext.vault||void 0,resources:t.bridge.ResourceContext,children:(0,Ia.jsx)(Bl.Provider,{value:t.bridge.VisibleCanvasReactContext,children:(0,Ia.jsx)(Ec.Provider,{value:t.bridge.SimpleViewerReactContext,children:(0,Ia.jsx)(Mu.Provider,{value:t.bridge.ReactEventContext,children:(0,Ia.jsx)(mu.Provider,{value:t.bridge.AtlasStoreReactContext,children:(0,Ia.jsx)(Fl.Provider,{value:t.bridge.AuthRContext,children:(0,Ia.jsx)(Rc.Provider,{value:t.bridge.SearchReactContext,children:(0,Ia.jsx)(_p.Provider,{value:t.bridge.ContextBridgeReactContext,children:(0,Ia.jsx)($s.Provider,{value:t.bridge.StrategyReactContext,children:t.custom?(0,Ia.jsx)(h4,{...t.custom,children:t.children}):t.children})})})})})})})})})}var qd=N(tt(),1),y4=10,p4=1;function ik(t){let[e,n]=t.split("-");return[e,n]}function m4(t,e,n){return e>n?t:Math.min(Math.max(t,e),n)}function ak(t){return t.top>0||t.right>0||t.bottom>0||t.left>0}function rk(t){return{name:"insideHighlightFallback",options:t,async fn(e){if(t.width<=p4||t.height<=p4)return{};let n=await Mp(e,{altBoundary:!0});if(!ak(n))return{};let{reference:i,floating:a}=e.rects,[r,l]=ik(e.initialPlacement),u=Math.min(y4,i.width/2,i.height/2),f=i.x+(i.width-a.width)/2,h=i.y+(i.height-a.height)/2,d=e.x,m=e.y;return r==="top"||r==="bottom"?(m=r==="top"?i.y+u:i.y+i.height-a.height-u,l==="start"?d=i.x+u:l==="end"?d=i.x+i.width-a.width-u:d=f,d=m4(d,i.x+u,i.x+i.width-a.width-u)):(d=r==="left"?i.x+u:i.x+i.width-a.width-u,l==="start"?m=i.y+u:l==="end"?m=i.y+i.height-a.height-u:m=h,m=m4(m,i.y+u,i.y+i.height-a.height-u)),{x:d,y:m}}}}function z0({annotation:t,target:e,children:n,dismissable:i,isOpen:a,onOpenChange:r,placement:l}){let u=Ip(),f=zp(),{refs:h,floatingStyles:d,context:m}=l4({open:a,onOpenChange:r,nodeId:t.id,placement:l||"bottom",middleware:[O0(y4),fE({mainAxis:!0,fallbackStrategy:"bestFit",altBoundary:!0}),dE({altBoundary:!0}),rk(e)],whileElementsMounted:E0}),y=s4(m),{getReferenceProps:g,getFloatingProps:b}=u4([i?y:null].filter(w=>w!==null));return(0,qd.jsxs)(ea,{relative:!0,target:e,interactive:!1,children:[(0,qd.jsx)("div",{ref:h.setReference,...g(),style:{position:"absolute",top:0,left:0,right:0,bottom:0,pointerEvents:"none"}}),(0,g4.createPortal)((0,qd.jsx)(Np,{bridge:u,custom:f,children:(0,qd.jsx)("div",{ref:h.setFloating,style:d,...b(),children:n})}),document.getElementById("atlas-floating-ui"))]})}var Lp=N(tt(),1),b4=Ag()(t=>({isMenuOpen:!1,menuPosition:{x:0,y:0},setMenuPosition(e){t({menuPosition:e})},toggle(e){t(n=>({isMenuOpen:!n.isMenuOpen,menuPosition:e}))},open(e){t({isMenuOpen:!0,menuPosition:e})},setIsMenuOpen(e){t(typeof e=="function"?n=>({isMenuOpen:e(n.isMenuOpen)}):{isMenuOpen:e})},close(){t({isMenuOpen:!1})}}));function Dp(t,e,n){let{isMenuOpen:i,setIsMenuOpen:a,close:r,open:l,menuPosition:u,setMenuPosition:f,toggle:h}=b4(),d=(0,v4.useCallback)(g=>{n&&(g.preventDefault(),g.stopPropagation(),h(g.atlas))},[h,n]);return[(0,Lp.jsx)(Lp.Fragment,{children:n&&i&&(0,Lp.jsx)(z0,{dismissable:!0,placement:"bottom-start",isOpen:i,onOpenChange:a,annotation:{id:t},target:{x:u.x,y:u.y,height:1,width:1},children:i&&n({canvasId:e,position:u,close:()=>a(!1)})})}),{onContextMenu:d},{open:l,close:r,toggle:h,isMenuOpen:i,setIsMenuOpen:a,menuPosition:u,setMenuPosition:f}]}function mE(){let t=$e();return zt(t,e=>e.tool.requestId&&e.requests[e.tool.requestId]||null)}var Ai=N(tt(),1);function gE({theme:t,renderContextMenu:e,children:n}){let i=$e(),a=Wt(),r=zt(i,M=>M.polygon),l=zt(i,M=>M.polygonState.currentTool),u=zt(i,M=>M.mode),f=zt(i,M=>M.changeMode),h=zt(i,M=>M.polygonState.transitioning),{enabled:d,requestId:m}=zt(i,M=>M.tool),y=(0,I0.useMemo)(()=>Ks(r),[r]),g=mE(),[b,w]=Dp("editing-annotation",a?.id,e),E=g?.annotationPopup||n||(0,Ai.jsx)(S4,{}),T=g?.svgTheme||t,S=()=>{f("sketch")};if(!d||!a||!m||!r)return null;let R=y&&r.id&&!h&&(l==="pointer"||l==="hand"||!r.open)?(0,Ai.jsx)(z0,{annotation:r,target:y,children:E}):null,A="shape";return u==="explore"?(0,Ai.jsxs)(Ai.Fragment,{children:[(0,Ai.jsx)(A,{id:`shape-${r.id}`,points:r.points,open:r.open,onClick:S,relativeStyle:!0,target:{x:0,y:0,width:a.width,height:a.height},style:{":hover":{backgroundColor:"rgba(0,0,0,0.2)"},backgroundColor:"rgba(0,0,0,0)",borderWidth:"4px",borderColor:"rgba(255, 255, 255, .4)"},...w}),(0,Ai.jsx)(A,{id:`shape-${r.id}`,points:r.points,open:r.open,onClick:S,relativeStyle:!0,target:{x:0,y:0,width:a.width,height:a.height},style:{backgroundColor:"rgba(0,0,0,0)",borderWidth:"2px",borderColor:"rgba(0, 0, 0, .4)"}}),R]}):(0,Ai.jsxs)(Ai.Fragment,{children:[e?(0,Ai.jsx)(A,{id:`shape-${r.id}`,points:r.points,open:r.open,target:{x:0,y:0,width:a.width,height:a.height},...w}):null,(0,Ai.jsx)(bP,{image:a,theme:T}),R,b]})}function S4(){let t=$e(),e=zt(t,l=>l.changeMode),n=zt(t,l=>l.mode),i=zt(t,l=>l.completeRequest),a=zt(t,l=>l.tool),r=()=>{(0,I0.startTransition)(()=>{i()})};return a.enabled?(0,Ai.jsxs)("div",{className:"svg-tools-container animate-fadeIn",children:[n!=="sketch"&&(0,Ai.jsx)("button",{className:"svg-tools-button",onClick:()=>{e("sketch")},children:"Edit"}),(0,Ai.jsx)("button",{className:"svg-tools-button",onClick:r,children:"Save"})]}):null}var ll=N(ct(),1);var Ud=N(ct(),1);function ok(t){return t.type==="SpecificResource"?[t.source,{selector:t.selector}]:[t,{selector:null}]}function Pp(t,e){let{selector:n,source:i}=wn(e);if(i.id!==t.id)return[null,i];let a={type:"BoxSelector",spatial:{x:0,y:0,width:Number(t.width),height:Number(t.height)}};return[n?n.type==="TemporalSelector"?{type:"TemporalBoxSelector",temporal:n.temporal,spatial:a.spatial}:n:null,i]}var yE={makeChoice:()=>{}},Bp={type:"unknown"},on=t=>({type:"unknown",reason:t,annotations:{pages:[]}}),vE=(t,e)=>({type:"empty",width:t,height:e,annotations:{pages:[]},image:null,images:[]});var Hp=N(ct(),1);function sk(t,e){let n=t?.iiif?.meta[e];return n?n.annotationPageManager:null}function x4(t,e){return _e(n=>{let i=[];if(!t)return i;let a=Object.keys(n.iiif.entities.AnnotationPage);for(let r of a)if(!e||e.indexOf(r)!==-1){let l=sk(n,r);l&&l.views&&l.views[t]&&i.push(r)}return i},[t,e])}function bE({canvas:t,manifest:e,all:n,canvases:i}){let a=[];if(e)for(let r of e.annotations)a.indexOf(r.id)===-1&&a.push(r.id);if(n){if(i&&i.length)for(let r of i)for(let l of r.annotations)a.indexOf(l.id)===-1&&a.push(l.id)}else if(t)for(let r of t.annotations)a.indexOf(r.id)===-1&&a.push(r.id);return a}function lk(t,e){let n=t?.iiif?.meta[e];return n?n.annotationPageManager:null}function Fp(t,e={}){let n=ce(),i=Tn(),a=Wt(),r=Hl(),l=(0,Hp.useMemo)(()=>bE({all:e.all,manifest:i,canvas:a,canvases:r}),[e.all,a,r,i]),u=x4(t,e.all?void 0:l),f=(0,Hp.useCallback)(d=>{t&&n.setMetaValue([d,"annotationPageManager","views"],m=>m&&!m[t]?m:{...m||{},[t]:!1})},[t,n]),h=(0,Hp.useCallback)((d,m={})=>{if(!t)return;let y=n.getState(),g=[];if(m?.deselectOthers){let b=Object.keys(y.iiif.entities.AnnotationPage);for(let w of b){let E=lk(y,w);E&&E.views&&E.views[t]&&g.push(w)}}for(let b of g)f(b);n.setMetaValue([d,"annotationPageManager","views"],b=>b&&b[t]?b:{...b||{},[t]:!0})},[t,f,n]);return{availablePageIds:l,enabledPageIds:u,setPageEnabled:h,setPageDisabled:f}}function SE(t,e){return _e((n,i)=>i.get(t.map(a=>({id:a,type:e}))),[t,e])}var w4=N(ct(),1);var uk=ya((t,e)=>({loaded:{},setLoaded:(n,i="done")=>{t(a=>({loaded:{...a.loaded,[n]:i}}))}})),ck=vr();ck.on("loaded",t=>{uk.getState().setLoaded(t.imageServiceId)});function qp(){let t=zd(),e=eP();return[(0,w4.useCallback)((i,{height:a,width:r})=>i&&t(i,{height:a,width:r},!0),[t]),e]}var Ou=N(ct(),1);function Go(t={}){let e=lp(),n=Wt(t.canvasId?{id:t.canvasId}:void 0);return _e((i,a)=>{if(!n)return[];if(e&&t.enableSingleAnnotation)return[e];let r=a.get(n.items),l=[];for(let u of r)l.push(...a.get(u.items));return l},[n])}function xE(t,e=[]){let n=ce(),i=(0,Ou.useMemo)(()=>Od(n),[]),a=Go({enableSingleAnnotation:t?.enableSingleAnnotation}),[r,l]=(0,Ou.useState)(t?.defaultChoices||[]),u=(0,Ou.useMemo)(()=>i.getPaintables(a,r),[n,a,r,...e]),h={makeChoice:(0,Ou.useCallback)((d,{deselectOthers:m=!0,deselect:y=!1}={})=>{u.choice&&l(g=>{if(y){let w=g.filter(E=>E!==d);if(w.length===0){let E=u.items[0].resource.id;return E?[E]:[]}return w}if(m)return[d];let b=[...g];if(b.length===0&&u.items.length){let w=u.items[0].resource.id;w&&b.push(w)}return g.indexOf(d)!==-1?g:[...g,d]})},[u.choice])};return[u,h]}var dk=["model/gltf-binary"];function wE(t,e){let n=e.items[0],i=n.resource;return i.format?dk.indexOf(i.format)===-1?on(`3D format: ${i.format} is unsupported`):{type:"3d-model",model:i,annotationId:n.annotationId,annotation:n.annotation}:on("Unknown format")}function N0(t,e){let n=e.items,i=n[0];if(n.length===0||!i)return on("No audio");if(!t.duration)return on("No duration on canvas");if(n.length>1)return on("Only one audio source supported");let a=i.resource;return a?("format"in a||(a.format="audio/mpeg"),{type:"media",media:{annotationId:i.annotationId,annotation:i.annotation,duration:t.duration,url:a.id,type:"Sound",target:{type:"TemporalSelector",temporal:{startTime:0,endTime:t.duration}},format:a.format,selector:{type:"TemporalSelector",temporal:{startTime:0,endTime:t.duration}}},annotations:{pages:[]}}):on("Unknown audio")}function Yo(t){return t.replace(/^http:/,"https:")}function T4(t){if(!(t?.type!=="ImageApiSelector"||typeof t.rotation>"u"))return TE(t.rotation)}function TE(t){if(t===null||typeof t>"u"||t==="")return;let e=Number(t);return Number.isFinite(e)?e:void 0}function fk(t){let e=t.selector||{};return{...t.rotationOrigin||e.rotationOrigin?{rotationOrigin:t.rotationOrigin||e.rotationOrigin}:{},...t.translate||e.translate?{translate:t.translate||e.translate}:{},...t.transform||e.transform?{transform:t.transform||e.transform}:{},...t.style||e.boxStyle?{style:t.style||e.boxStyle}:{},...t.styleClass?{styleClass:t.styleClass}:{}}}function Up(t,e,n){let i=[],a=[];for(let r of e.items){let l=r.resource&&r.resource.type==="SpecificResource"?r.resource.source:r.resource;if(!l.id)return on("No resource Identifier");let f=(r.resource.type==="SpecificResource"?T4(r.resource.selector):void 0)??T4(r.selector)??TE(r.rotation)??TE(r.selector?.rotation),h=typeof f<"u",d;if(l.service){let R=gs(l);R[0]&&(d=n(R[0],h?{width:Number(l.width||t.width),height:Number(l.height||t.height)}:t))}let m={type:"BoxSelector",spatial:{x:0,y:0,width:Number(t.width),height:Number(t.height)}},[y,g]=Pp(t,r.target),b=t.id?.split("?")[0]||"";if(!(Yo(g.id||"")===Yo(t.id)||Yo(decodeURIComponent(g.id||""))===Yo(t.id||"")||Yo(g.id||"")===Yo(b)||Yo(decodeURIComponent(g.id||""))===Yo(b)))continue;let w=r.resource.width&&r.resource.height?{type:"BoxSelector",spatial:{x:0,y:0,width:r.resource.width,height:r.resource.height}}:void 0,E=r.resource.type==="SpecificResource"?wn(r.resource):null;if(r.selector){let R=wn({type:"SpecificResource",source:r.resource,selector:r.selector});R&&(E=R)}let T=E&&E.selector&&(E.selector.type==="BoxSelector"||E.selector.type==="TemporalBoxSelector")?{type:"BoxSelector",spatial:{x:E.selector.spatial.x,y:E.selector.spatial.y,width:E.selector.spatial.width,height:E.selector.spatial.height},...typeof E.selector.rotation<"u"?{rotation:E.selector.rotation}:{},...E.selector.rotationOrigin?{rotationOrigin:E.selector.rotationOrigin}:{},...E.selector.translate?{translate:E.selector.translate}:{},...E.selector.transform?{transform:E.selector.transform}:{},...E.selector.boxStyle?{boxStyle:E.selector.boxStyle}:{}}:void 0;d&&!d.id&&(d.id=d["@id"]);let S={id:l.id,type:"Image",annotationId:r.annotationId,annotation:r.annotation,width:Number(h||y||T?l.width:t.width),height:Number(h||y||T?l.height:t.height),...typeof f<"u"?{rotation:f}:{},...fk(r),service:d,sizes:d&&d.sizes?d.sizes:l.width&&l.height?[{width:l.width,height:l.height}]:[],target:y&&y.type!=="PointSelector"?y:m,selector:T||{type:"BoxSelector",spatial:{x:0,y:0,width:Number(t.width),height:Number(t.height)}},annotationPages:r.resource.annotations||[]};i.push(S)}return{type:"images",image:i[0],images:i,choice:e.choice}}function R4(t,e={},n){let i=t.language||n||"none";switch(t.type){case"TextualBody":{typeof t.value<"u"&&(e[i]=[t.value]);break}case"List":case"Composite":case"Choice":t.items&&t.items.forEach(a=>R4(a,e,i))}return e}function Vp(t,e){let n=[];return e.items.forEach(i=>{if(i.resource){let[a]=Pp(t,i.target);n.push({type:"Text",annotationId:i.annotationId,annotation:i.annotation,text:R4(i.resource),target:a})}}),{type:"textual-content",items:n}}var hk=/^.*(?:(?:youtu\.be\/|v\/|vi\/|u\/\w\/|embed\/|shorts\/)|(?:(?:watch)?\?vi?=|&vi?=))([^#&?]*).*/;function jp(t,e,n,i=!1){let a=e.items.filter(w=>w.type==="video"),r=a[0],l=!1,u=!1;if(t.duration||(u=!0),a.length>1||!r)return on("Only one video source supported");let f=a[0]?.resource,h=!!(f.service||[]).find(w=>(w.profile||"").includes("youtube.com"));if(!h&&u)return on("Video does not have duration");if(!f)return on("Unknown video");if((!f.format||f.format==="text/html")&&!h)return on("Video does not have format");let d=[],m=n.get(t.annotations||[]);for(let w of m){let E=n.get(w.items||[]);for(let T of E)if((T.motivation?Array.isArray(T.motivation||"")?T.motivation:[T.motivation]:[]).includes("supplementing")){let R=n.get(T.body||[]);for(let A of R){let M=A;if(M.type==="Choice")for(let z of M.items){let I=n.get(z);I.format==="text/vtt"&&d.push({id:I.id,type:"Text",format:"text/vtt",label:I.label,language:I.language})}else M.format==="text/vtt"&&d.push({id:M.id,type:"Text",format:"text/vtt",label:M.label,language:M.language})}}}let y={annotationId:r.annotationId,annotation:r.annotation,duration:t.duration,url:f.id,type:"Video",target:{type:"TemporalSelector",temporal:{startTime:0,endTime:t.duration}},format:f.format,selector:{type:"TemporalSelector",temporal:{startTime:0,endTime:t.duration}}},g=wn(r.target);g.selector&&g.selector.type==="TemporalBoxSelector"&&(y.target=g.selector);let{selector:b}=so(r.selector);if(b===null){let w=y.target.temporal.startTime,T=(y.target.temporal.endTime||t.duration)-w;y.selector={type:"TemporalSelector",temporal:{startTime:0,endTime:T}}}else b.type==="TemporalSelector"&&(y.selector=b);if(i&&!y.target.spatial&&(l=!0,y.target={type:"TemporalBoxSelector",temporal:y.target.temporal,spatial:{x:t.width/2,y:t.height/2,width:t.width/2,height:t.height/2}}),h){y.type="VideoYouTube";let w=f.id.match(hk);if(!w[1])return on("Video is not known youtube video");y.youTubeId=w[1]}return{type:"media",media:y,annotations:{pages:[]},noSpatial:l,captions:d}}function RE(t,e,n,i){let a={type:"complex-timeline",items:[],keyframes:[],highlights:[],duration:t.duration||0},r={type:"complex-choice",items:[]},l=i.get(t.annotations);function u(d){d.choice&&(d.choice.type==="complex-choice"?r.items.push(...d.choice.items):r.items.push(d.choice))}for(let d of e.items){if(d.type==="image"){let m=Up(t,{choice:null,allChoices:null,types:["image"],items:[d]},n);if(m.type==="images"){if(!m.image)continue;u(m),a.items.push(m.image);let y={id:m.image.annotationId,type:"enter",resourceType:"image",time:m.image.target?.temporal?.startTime||0};a.keyframes.push(y);let g={id:m.image.annotationId,type:"exit",resourceType:"image",time:m.image.target?.temporal?.endTime||t.duration||0};a.keyframes.push(g)}}if(d.type==="textualbody"){let m=Vp(t,{choice:null,allChoices:null,types:["textualbody"],items:[d]});if(m.type==="textual-content"){u(m);let y=m.items[0];a.items.push(y);let g=y.target,b={id:y.annotationId,type:"enter",resourceType:"text",time:g.temporal?.startTime||0};a.keyframes.push(b);let w={id:y.annotationId,type:"exit",resourceType:"text",time:g.temporal?.endTime||t.duration||0};a.keyframes.push(w)}}if(d.type==="video"){let m=jp(t,{choice:null,allChoices:null,types:["video"],items:[d]},i,!0);if(m.type==="media"){u(m);let y=m.media;a.items.push(y);let g={id:y.annotationId,type:"enter",resourceType:"video",time:y.target?.temporal?.startTime||0};a.keyframes.push(g);let b={id:y.annotationId,type:"exit",resourceType:"video",time:y.target?.temporal?.endTime||t.duration||0};a.keyframes.push(b)}}if(d.type==="audio"||d.type==="sound"){let m=N0(t,{choice:null,allChoices:null,types:["audio"],items:[d]});if(m.type==="media"){u(m);let y=m.media;a.items.push(y);let g={id:y.annotationId,type:"enter",resourceType:"audio",time:y.target?.temporal?.startTime||0};a.keyframes.push(g);let b={id:y.annotationId,type:"exit",resourceType:"audio",time:y.target?.temporal?.endTime||t.duration||0};a.keyframes.push(b)}}}for(let d of l)for(let m of d.items){let y=i.get(m),g=wn(y.target,{typeMap:i.getState?.().iiif.mapping});if(g.selector?.temporal){let b={id:y.id,type:"enter",resourceType:"highlight",time:g.selector.temporal.startTime||0};a.keyframes.push(b);let w={id:y.id,type:"exit",resourceType:"highlight",time:g.selector.temporal.endTime||t.duration||0};a.keyframes.push(w)}a.highlights.push({annotation:y,target:g})}a.keyframes.sort((d,m)=>d.time-m.time);let f=[],h=[];for(let d of a.keyframes){if(d.resourceType==="image"||d.resourceType==="text"||d.resourceType==="highlight"){h.push(d);continue}if(d.type==="enter"){f.length===0&&(d.isPrime=!0),f.push(d),h.push(d);continue}if(d.type==="exit"&&(h.push(d),f=f.filter(m=>m.id!==d.id),f.length!==0)){let m=f[0],y={id:m.id,type:"change",isPrime:!0,resourceType:m.resourceType,time:d.time};h.push(y)}}return a.keyframes=h,r.items.length&&(a.choice=r),a}var L0={},EE={get(t){return t},setMetaValue([t,e,n],i){let a=EE.getResourceMeta(t,e),r=a?a[n]:void 0,l=typeof i=="function"?i(r):i;L0[t]={...L0[t]||{},[e]:{...(L0[t]||{})[e]||{},[n]:l}}},getResourceMeta:(t,e)=>{let n=L0[t];if(n)return e?n[e]:n},async load(t){let e=typeof t=="string"?t:t.id;return fetch(e).then(n=>n.json())},requestStatus(t){}};function kp({canvas:t,paintables:e,supports:n,loadImageService:i,vault:a=EE}){if(!t)return Bp;if(e.types.length===0)return n.indexOf("empty")!==-1?vE(t.width,t.height):Bp;if(e.types.length!==1)if(e.types.length===2&&e.types.indexOf("text")!==-1)e.types=e.types.filter(l=>l!=="text");else return n.indexOf("complex-timeline")===-1?on("Complex timeline not supported"):RE(t,e,i,a);let r=e.types[0];return r==="image"?n.indexOf("images")===-1?on("Image not supported"):Up(t,e,i):r==="Model"||r==="model"?n.indexOf("3d-model")===-1?on("3D not supported"):wE(t,e):r==="textualbody"?n.indexOf("textual-content")===-1?on("Textual content not supported"):Vp(t,e):r==="sound"||r==="audio"?n.indexOf("media")===-1?on("Media not supported"):N0(t,e):r==="video"?n.indexOf("media")===-1?on("Media not supported"):jp(t,e,a):Bp}function AE(t){let e=Tn(),n=Wt(),i=ce(),a=Op(),r=t?.emitter||a,[l,u]=qp(),{enabledPageIds:f}=Fp(t?.annotationPageManagerId||e?.id||n?.id,{all:!1}),h=SE(f,"AnnotationPage"),d=t?.strategies||["empty","images","media","textual-content","complex-timeline"],[m,y]=xE(t,[u]);(0,Ud.useEffect)(()=>{let b=w=>{y.makeChoice(w.choiceId,{deselectOthers:w.deselectOthers,deselect:w.deselect})};return r.on("make-choice",b),()=>{r.off("make-choice",b)}},[]);let g=(0,Ud.useMemo)(()=>kp({canvas:n,paintables:m,supports:d,loadImageService:l,vault:i}),[n,m,i,y.makeChoice]);return(0,Ud.useEffect)(()=>{let b=m.allChoices,w={canvasId:n?.id,manifestId:e?.id};b&&r.emit("choice-change",{choice:b,partOf:w})},[n?.id,m.allChoices]),(0,Ud.useMemo)(()=>g.type==="unknown"?[g,yE]:[{...g,annotations:{pages:h}},y],[g,h])}var CE=N(tt(),1);function ME({strategies:t,registerActions:e,defaultChoices:n,onChoiceChange:i,mediaControlsDeps:a,renderMediaControls:r,renderViewerControls:l,viewControlsDeps:u,renderComplexTimelineControls:f,complexTimelineControlsDeps:h,throwOnUnknown:d,children:m}){let y=Wt(),g=ce(),b=(0,ll.useMemo)(()=>Zs(g),[g]),[w,E]=AE({strategies:t||["images"],defaultChoices:n?.map(({id:A})=>A)}),T="choice"in w?w.choice:void 0;if((0,ll.useEffect)(()=>{e&&e(E)},[w.annotations]),(0,ll.useEffect)(()=>{i&&i(T)},[T]),(0,ll.useEffect)(()=>{if(n)for(let A of n)typeof A.opacity<"u"&&b.applyStyles({id:A.id},"atlas",{opacity:A.opacity})},[n]),w.type==="unknown"&&d)throw new Error(w.reason||"Unknown strategy");let S=(0,ll.useMemo)(()=>({renderMediaControls:r,mediaControlsDeps:a||[],renderViewerControls:l,viewControlsDeps:u||[],renderComplexTimelineControls:f,complexTimelineControlsDeps:h||[]}),[a,r,l,u,f,h]),R=(0,ll.useMemo)(()=>({strategy:w,actions:E,choices:"choice"in w?w.choice:[]}),[w,y]);return(0,CE.jsx)(hp.Provider,{value:S,children:(0,CE.jsx)($s.Provider,{value:R,children:m})})}var Gp=N(ct(),1);var Vd=N(ct(),1);var OE=(0,Vd.createContext)(()=>{});function E4(t){let e=Wt(),n=(0,Vd.useContext)(OE);(0,Vd.useEffect)(()=>e&&e.id?(n(e.id,t),()=>n(e.id,-1)):()=>{},[e,t])}var A4=N(tt(),1);function _E({x:t=0,y:e=0,keepCanvasScale:n=!0,renderContextMenu:i,children:a}){let{strategy:r}=dn(),l=Wt(),u=$e(),f=cp(l,["deep-zoom"]),h=zt(u,w=>w.setCanvasRelativePosition),d=zt(u,w=>w.clearCanvasRelativePosition),[m,y]=Dp(`context-menu/${l?.id}`,l?.id,i),g=(0,Gp.useMemo)(()=>n?1:Math.max(1,...r.type==="images"?r.images.map(w=>(w.width||0)/w.target?.spatial.width):[]),[n,r]);(0,Gp.useEffect)(()=>{if(l)return h(l.id,{x:t,y:e,width:l.width,height:l.height}),()=>{d(l.id)}},[t,e,l,d,h]),(0,Gp.useEffect)(()=>{l&&u.getState().reset()},[u,l]),E4(g);let b=r.type==="images"?r.images.length:0;return l?(0,A4.jsxs)("world-object",{height:l.height,width:l.width,x:t,y:e,...y,...f,children:[m,a]},`${l.id}/${r.type}/${b}`):null}var Fi=N(tt(),1);function Su({x:t,y:e,onChoiceChange:n,registerActions:i,defaultChoices:a,isStatic:r,renderViewerControls:l,renderMediaControls:u,renderComplexTimelineControls:f,complexTimelineControlsDeps:h,viewControlsDeps:d,mediaControlsDeps:m,strategies:y,throwOnUnknown:g,rotation:b,backgroundStyle:w,alwaysShowBackground:E,keepCanvasScale:T=!1,enableSizes:S=!1,enableYouTube:R=!0,onClickPaintingAnnotation:A,components:M={},children:z,annotationPopup:I,svgTheme:L,renderContextMenu:H,renderAnnotationContextMenu:V}){return(0,Fi.jsxs)(ME,{throwOnUnknown:g,onChoiceChange:n,registerActions:i,strategies:y,defaultChoices:a,mediaControlsDeps:m,renderMediaControls:u,renderViewerControls:l,renderComplexTimelineControls:f,complexTimelineControlsDeps:h,viewControlsDeps:d,children:[(0,Fi.jsxs)(_E,{keepCanvasScale:T,x:t,y:e,renderContextMenu:H,children:[(0,Fi.jsx)(YR,{alwaysShowBackground:E,backgroundStyle:w}),(0,Fi.jsx)(GR,{}),(0,Fi.jsx)(QR,{}),(0,Fi.jsx)(XR,{isStatic:r,enableSizes:S,onClickPaintingAnnotation:A,rotation:b}),(0,Fi.jsx)(PR,{}),(0,Fi.jsx)(_R,{}),(0,Fi.jsx)(FR,{as:M.Audio}),(0,Fi.jsx)(ZR,{as:M.Video}),R?(0,Fi.jsx)(WR,{}):null,(0,Fi.jsx)(gE,{theme:L,renderContextMenu:V,children:I}),z]}),(0,Fi.jsx)(zR,{})]})}var zE=N(tt(),1);function C4(t){let e=Wt();return!e||!e.placeholderCanvas?null:(0,zE.jsx)(qa,{canvas:e.placeholderCanvas.id,children:(0,zE.jsx)(Su,{renderViewerControls:t.renderViewerControls})})}var qi=N(ct(),1);var Na=N(ct()),pk=(0,Na.createContext)(null),IE={didCatch:!1,error:null},jd=class extends Na.Component{constructor(e){super(e),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=IE}static getDerivedStateFromError(e){return{didCatch:!0,error:e}}resetErrorBoundary(){let{error:e}=this.state;if(e!==null){for(var n,i,a=arguments.length,r=new Array(a),l=0;l<a;l++)r[l]=arguments[l];(n=(i=this.props).onReset)===null||n===void 0||n.call(i,{args:r,reason:"imperative-api"}),this.setState(IE)}}componentDidCatch(e,n){var i,a;(i=(a=this.props).onError)===null||i===void 0||i.call(a,e,n)}componentDidUpdate(e,n){let{didCatch:i}=this.state,{resetKeys:a}=this.props;if(i&&n.error!==null&&mk(e.resetKeys,a)){var r,l;(r=(l=this.props).onReset)===null||r===void 0||r.call(l,{next:a,prev:e.resetKeys,reason:"keys"}),this.setState(IE)}}render(){let{children:e,fallbackRender:n,FallbackComponent:i,fallback:a}=this.props,{didCatch:r,error:l}=this.state,u=e;if(r){let f={error:l,resetErrorBoundary:this.resetErrorBoundary};if(typeof n=="function")u=n(f);else if(i)u=(0,Na.createElement)(i,f);else if(a===null||(0,Na.isValidElement)(a))u=a;else throw l}return(0,Na.createElement)(pk.Provider,{value:{didCatch:r,error:l,resetErrorBoundary:this.resetErrorBoundary}},u)}};function mk(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return t.length!==e.length||t.some((n,i)=>!Object.is(n,e[i]))}var D0=N(ct(),1);function M4(t,e=2e3){let{currentSequenceIndex:n,sequence:i,items:a}=ql(),r=Wt(),l=(0,D0.useMemo)(()=>{let f=i[n]||[];return f.length===0&&r?[{id:r.id,type:"Canvas"}]:f.map(h=>a[h])},[i,n,r,a]),u=$e();(0,D0.useEffect)(()=>{let h=setInterval(()=>{if(t&&e!==-1){let d={x:t.x,y:t.y,width:t.width,height:t.height},m=u.getState().canvasRelativePositions,y={};for(let g of l){let b=m[g.id];if(b){let w=b.x,E=b.y,T=b.width,S=b.height,R={x:Math.max(w,d.x),y:Math.max(E,d.y),width:Math.min(w+T,d.x+d.width)-Math.max(w,d.x),height:Math.min(E+S,d.y+d.height)-Math.max(E,d.y)};R.width<=0||R.height<=0||(y[g.id]={x:R.x-b.x,y:R.y-b.y,width:R.width,height:R.height}),u.setState({canvasViewports:y})}}}},e);return()=>{clearTimeout(h)}},[l,t,u,e])}var kd=N(tt(),1);function P0({width:t,style:e,height:n,error:i,resetErrorBoundary:a}){return(0,kd.jsxs)("div",{style:{width:t,height:n,minHeight:500,...e||{},background:"#f9f9f9"},children:[(0,kd.jsx)("h3",{children:"Error occurred"}),(0,kd.jsx)("p",{children:i.message}),(0,kd.jsx)("button",{type:"button",onClick:a,children:"Reset"})]})}var hn=N(tt(),1);function B0(t){let e=$e();return(0,hn.jsx)(Ad,{name:t.name,existing:e,children:(0,hn.jsx)(gk,{...t})})}function gk({name:t,children:e,errorFallback:n,outerContainerProps:i={},worldScale:a,updateViewportTimeout:r,...l}){let u=$e(),f=zt(u,mt=>mt.mode),h=zt(u,mt=>mt.setAtlasRuntime),[d,m]=(0,qi.useState)(),y=zp(),g=Ip(),b=n||P0,[w,E]=(0,qi.useState)({}),T=Object.entries(w),[S,R]=(0,qi.useState)({}),A=Object.entries(S),[M,z]=(0,qi.useState)({}),{worldScale:I,runtimeOptions:L}=(0,qi.useMemo)(()=>{if(Object.values(M).length===0)return{worldScale:1,runtimeOptions:l.runtimeOptions||{maxOverZoom:1}};let lt=Math.max(...Object.values(M));return{worldScale:lt,runtimeOptions:{maxOverZoom:lt||1,...l.runtimeOptions||{}}}},[M,l.runtimeOptions]);M4(d?.runtime,r);let H=(0,qi.useCallback)((mt,lt)=>{z(it=>{if(lt===-1){let{[mt]:yt,...xt}=it;return xt}return{...it,[mt]:lt}})},[]),V=(0,qi.useCallback)((mt,lt,it)=>{E(({[mt]:yt,...xt})=>lt?{...xt,[mt]:{element:lt,props:it}}:xt)},[]),nt=(0,qi.useCallback)((mt,lt,it)=>{R(({[mt]:yt,...xt})=>lt?{...xt,[mt]:{element:lt,props:it}}:xt)},[]),X=(0,qi.useCallback)(mt=>{m(mt),h(mt.runtime),l.onCreated&&l.onCreated(mt)},[l.onCreated,h]);return(0,hn.jsxs)(jd,{resetKeys:[],fallbackRender:mt=>(0,hn.jsx)(b,{...l,...mt}),children:[(0,hn.jsx)(rD,{...l,mode:f,containerProps:{style:{position:"relative"},...l.containerProps||{}},htmlChildren:(0,hn.jsx)(hn.Fragment,{children:T.map(([mt,{element:lt,props:it}])=>(0,hn.jsx)(qi.default.Fragment,{children:(0,hn.jsx)(lt,{...it||{}})},mt))}),onCreated:X,runtimeOptions:L,children:(0,hn.jsx)(Ad,{name:t,existing:u,children:(0,hn.jsx)(xr.Provider,{value:d,children:(0,hn.jsx)(OE.Provider,{value:H,children:(0,hn.jsx)(AR.Provider,{value:V,children:(0,hn.jsx)(CR.Provider,{value:nt,children:(0,hn.jsx)(Np,{bridge:g,custom:y,children:(0,hn.jsx)(DR,{children:e})})})})})})})}),(0,hn.jsx)("div",{children:A.map(([mt,{element:lt,props:it}])=>(0,hn.jsx)(qi.default.Fragment,{children:(0,hn.jsx)(lt,{...it||{}})},mt))}),(0,hn.jsx)("div",{id:"atlas-floating-ui",style:{position:"relative",zIndex:999999}})]})}var Ci=N(tt(),1),yk=(0,_u.forwardRef)(function(e,n){let i=Tn(),a=Hl(),r=ql(),{ViewerControls:l,MediaControls:u,ComplexTimelineControls:f}=e.components||{};if((0,_u.useImperativeHandle)(n,()=>r,[r]),!i)return(0,Ci.jsx)("div",{});let h=0,d=i.viewingDirection==="top-to-bottom",m=i.viewingDirection==="bottom-to-top",y=i.viewingDirection==="left-to-right",g=i.viewingDirection==="right-to-left",w=i.behavior.includes("continuous")?0:e.spacing||0,E=m||g,T=(0,_u.useMemo)(()=>E?[...a].reverse():a,[a,E]);return(0,Ci.jsxs)(Ci.Fragment,{children:[e.header,(0,Ci.jsx)(Xn.Viewer,{height:e.height,mode:e.mode,renderPreset:e.renderPreset,runtimeOptions:e.runtimeOptions,updateViewportTimeout:e.updateViewportTimeout,homePaddingPx:e.padding,children:T.map((S,R)=>{let A=0,M=0;return!d&&!m?(A=h,h+=S.width+w):(M=h,h+=S.height+w),(0,Ci.jsx)(qa,{canvas:S.id,children:(0,Ci.jsx)(Xn.RenderCanvas,{strategies:["3d-model","media","images","empty","textual-content","complex-timeline"],renderViewerControls:R===0&&l?()=>(0,Ci.jsx)(l,{}):void 0,renderMediaControls:R===0&&u?()=>(0,Ci.jsx)(u,{}):void 0,annotationPopup:e.annotationPopup,renderContextMenu:e.renderContextMenu,keepCanvasScale:e.keepCanvasScale,renderComplexTimelineControls:R===0&&f?()=>(0,Ci.jsx)(f,{}):void 0,renderAnnotationContextMenu:e.renderAnnotationContextMenu,x:A,y:M,svgTheme:e.svgTheme,rotation:e.rotation,...e.canvasProps||{},children:e.annotations},S.id)},S.id)})},e.reuseAtlas?"":r.currentSequenceIndex),e.children]})}),Xn=(0,_u.forwardRef)(function({children:e,height:n,annotations:i,canvasProps:a,spacing:r,header:l,components:u,mode:f,reuseAtlas:h,renderPreset:d,runtimeOptions:m,annotationPopup:y,name:g,svgTheme:b,updateViewportTimeout:w,renderContextMenu:E,keepCanvasScale:T,renderAnnotationContextMenu:S,padding:R,rotation:A,...M},z){let I=fo();return(0,Ci.jsx)(Ad,{name:g,children:(0,Ci.jsx)(co,{vault:I,children:(0,Ci.jsx)(Z1,{...M,children:(0,Ci.jsx)(yk,{ref:z,height:n,components:u,spacing:r,canvasProps:a,annotations:i,header:l,mode:f,reuseAtlas:h,renderPreset:d,runtimeOptions:m,annotationPopup:y,svgTheme:b,updateViewportTimeout:w,renderContextMenu:E,keepCanvasScale:T,renderAnnotationContextMenu:S,padding:R,rotation:A,children:e})})})})});Xn.RenderImage=il;Xn.RenderCanvas=Su;Xn.RenderAnnotationPage=Ws;Xn.RenderAnnotation=yu;Xn.Viewer=B0;Xn.CanvasBackground=h0;Xn.Audio=$v;Xn.Video=m0;Xn.Model=n0;Xn.AudioHTML=MR;Xn.VideoHTML=KR;Xn.ModelHTML=OR;Xn.PlaceholderCanvas=C4;Xn.getAtlasStoreByName=pR;var O4=N(ct(),1);var er=N(ct(),1);function NE(t){let[e,n]=(0,er.useState)(0),i=$e(),a=zt(i,M=>M.tool.enabled),r=zt(i,M=>M.tool.requestId),l=zt(i,M=>M.getRequestId),u=zt(i,M=>M.requestAnnotation),f=zt(i,M=>M.completeRequest),h=zt(i,M=>M.cancelRequest),d=(0,er.useRef)(t?.onSuccess);d.current=t?.onSuccess;let[m,y]=(0,er.useState)(!1),[g,b]=(0,er.useState)(null),[w,E]=(0,er.useState)(null),T=a&&r!==w,S=a&&r===w,R=(0,er.useCallback)(async(M,z)=>{if(w){let I=d.current;y(!0);let L=await u(M,{...z,requestId:w});if(L)return I?.(L),n(V=>V+1),y(!1),b(L),L;let H={id:w,cancelled:!0,...op(M)};return I?.(H),b(H),n(V=>V+1),y(!1),H}return null},[u,w]),A=(0,er.useCallback)(()=>{b(null),y(!1)},[]);return(0,er.useEffect)(()=>{let M=l();return E(M.requestId),()=>{M.clear()}},[e]),{id:e,busy:T,isPending:m,isActive:S,requestId:w,requestAnnotation:R,cancelRequest:()=>w?h(w):void 0,completeRequest:()=>w?f(w):void 0,reset:A,data:g}}var vk=[{name:"Default",outer:{borderWidth:4,borderColor:"rgba(255, 255, 255, .4)"},inner:{borderWidth:2,borderColor:"#000"}},{name:"High contrast",outer:{borderWidth:3,borderColor:"#fff"},inner:{borderWidth:1,borderColor:"#000"}},{name:"Lightsaber",outer:{borderWidth:"4",borderColor:"rgba(56,68,255,0.64)"},inner:{borderWidth:"2",borderColor:"#fff"}},{name:"Bright",outer:{borderWidth:"6",borderColor:"#25d527"},inner:{borderWidth:"3",borderColor:"#a916ff"}},{name:"pink",outer:{borderWidth:"4",borderColor:"#ff00ff"},inner:{borderWidth:"2",borderColor:"#ffffff"}},{name:"fine (dark)",outer:{borderWidth:"1",borderColor:"#000000"},inner:{}},{name:"fine (light)",outer:{borderWidth:"1",borderColor:"#FFF"},inner:{}}];function LE(t){let{id:e,data:n,requestAnnotation:i,cancelRequest:a,isPending:r}=NE({onSuccess:l=>{t.updateShape(l.polygon)}});return(0,O4.useEffect)(()=>(i({type:"polygon",open:t.shape?.open,points:t.shape?.points}),()=>{a()}),[]),null}var vi=N(ct(),1);var _4=N(tt(),1),H0=(0,vi.createContext)(vr());H0.displayName="SelectorHelper";function bk({children:t}){return(0,_4.jsx)(H0.Provider,{value:(0,vi.useMemo)(()=>vr(),[]),children:t})}function Sk(){return(0,vi.useContext)(H0)}function DE(t){let e=PE(),[n,i]=(0,vi.useState)(!1);(0,vi.useEffect)(()=>e.withSelector(t).on("highlight",()=>{i(!0)}),[e,t]),(0,vi.useEffect)(()=>e.withSelector(t).on("clear-highlight",()=>{i(!1)}),[e,t]);let a=(0,vi.useCallback)(l=>{e.emit("click",{selectorId:t,event:l})},[t,e]),r=(0,vi.useCallback)(l=>{e.emit("hover",{selectorId:t,event:l})},[t,e]);return{controller:e,onClick:a,onHover:r,isHighlighted:n}}function PE(){let t=(0,vi.useContext)(H0);return(0,vi.useMemo)(()=>({withSelector(e){return{on(n,i){let a=r=>{r&&r.selectorId===e&&i(r)};return t.on(n,a),()=>{t.off(n,a)}},emit(n,i){t.emit(n,{...i,selectorId:e})}}},on(e,n){return t.on(e,n),()=>{t.off(e,n)}},emit(e,n){t.emit(e,n)}}),[t])}function xk(){let t=PE();return(0,vi.useMemo)(()=>({withSelector(e){return{highlight(){t.emit("highlight",{selectorId:e})},clearHighlight(){t.emit("clear-highlight",{selectorId:e})},zoomTo(){t.emit("zoom-to",{selectorId:e})},addEventListener(n,i){return t.emit("event-listener",{selectorId:e,name:n,callback:i}),()=>{t.emit("remove-event-listener",{selectorId:e,name:n,callback:i})}},getImagePreview(){return new Promise((n,i)=>{t.emit("image-preview-request",{selectorId:e,resolve:n,reject:i})})},on(n,i){return t.withSelector(e).on(n,i)}}},highlight(e){t.emit("highlight",{selectorId:e})},clearHighlight(e){t.emit("clear-highlight",{selectorId:e})},zoomTo(e){t.emit("zoom-to",{selectorId:e})},addEventListener(e,n,i){return t.emit("event-listener",{selectorId:e,name:n,callback:i}),()=>{t.emit("remove-event-listener",{selectorId:e,name:n,callback:i})}},getImagePreview(e){return new Promise((n,i)=>{t.emit("image-preview-request",{selectorId:e,resolve:n,reject:i})})},on(e,n){return t.on(e,n)}}),[t])}var BE=N(tt(),1);function wk(t){let e=Wt(),n=t.annotationBucket,i=t.readOnly,a=t.id,{onClick:r,isHighlighted:l}=DE(t.id),u=sp(),f=l?u.highlighted:u[n||"hidden"]||u.hidden;if(!e)return null;if(i){let h="shape",d=t.polygon,m=d.open;return d?(0,BE.jsx)(h,{id:`shape-${a}`,points:d.points,open:m,onClick:r,relativeStyle:!0,target:{x:0,y:0,width:e.width,height:e.height},style:f}):null}return(0,BE.jsx)(LE,{image:e,shape:t.polygon||{id:t.id,open:!0,points:[]},updateShape:t.updatePolygon,theme:t.theme,controlsHtmlId:t.controlsHtmlId,renderControls:t.renderControls})}var F0=N(ct(),1),Yp=N(tt(),1),Tk=(0,F0.forwardRef)(function({canvasId:e},n){let i=kv(),a=Fp(e||i?.id),r=ce();return(0,F0.useImperativeHandle)(n,()=>a,[e,i]),!i||a.enabledPageIds.length===0?null:(0,Yp.jsx)(Yp.Fragment,{children:a.enabledPageIds.map(l=>(0,Yp.jsx)(Xn.RenderAnnotationPage,{page:r.get(l)},l))})});var I4=N(ct(),1);var z4=N(ct(),1);var Fn=N(tt(),1);function Xp({metadata:t=[],config:e,labelWidth:n=16,showEmptyMessage:i=!0,allowHtml:a,emptyFallback:r,classes:l={},emptyMessage:u="No metadata available",emptyValueFallback:f="No value",emptyLabelFallback:h="",separator:d,tableFooter:m,tableHeader:y,customLabelRender:g,customValueRender:b}){let w=(0,z4.useMemo)(()=>{let T=(e||[]).reduce((R,A)=>[...R,...A.keys],[]),S={};for(let R of t){let A=R?.label?Object.values(R.label):[];for(let M of A)if(M?.length&&(T.indexOf(`metadata.${M[0]}`)!==-1||T.length===0)&&R){let z=`metadata.${M[0]}`;S[z]=S[z]?S[z]:[],S[z].push(R);break}}return S},[e,t]);return Object.keys(w).length===0&&i?(0,Fn.jsx)(Fn.Fragment,{children:r})||(0,Fn.jsx)("div",{className:l.empty,children:u}):e?.length?(0,Fn.jsxs)("table",{className:l.container,children:[y,(0,Fn.jsx)("tbody",{children:e.map((T,S)=>{let R=[];for(let M of T.keys)for(let z of w[M]||[]){let I=(0,Fn.jsx)(_a,{enableDangerouslySetInnerHTML:a,defaultText:f,separator:d,children:z.value},S+"__"+M);b?R.push(b(z,I)):R.push(I)}if(R.length===0)return null;let A=(0,Fn.jsx)(_a,{enableDangerouslySetInnerHTML:a,separator:d,defaultText:h,children:T.label});return(0,Fn.jsxs)("tr",{className:l.row,children:[(0,Fn.jsx)("td",{className:l.label,style:n?{minWidth:n}:{},children:g?g(T.label,A):A}),(0,Fn.jsx)("td",{className:l.value,children:R})]},S)})}),m]}):(0,Fn.jsxs)("table",{className:l.container,children:[y,(0,Fn.jsx)("tbody",{children:t?.length?t.map((T,S)=>{if(!T)return null;let R=(0,Fn.jsx)(_a,{enableDangerouslySetInnerHTML:a,defaultText:f,separator:d,children:T.label}),A=(0,Fn.jsx)(_a,{enableDangerouslySetInnerHTML:a,defaultText:f,separator:d,children:T.value});return(0,Fn.jsxs)("tr",{className:l.row,children:[(0,Fn.jsx)("td",{className:l.label,style:n?{minWidth:n}:{},children:g?g(T.label,R):R}),(0,Fn.jsx)("td",{className:l.value,children:b?b(T,A):A})]},S)}):null}),m]})}var N4=N(tt(),1);function Rk(t){let e=Tn(),n=Wt(),i=Nf(),a=(0,I4.useMemo)(()=>{let r=e?.metadata||[],l=n?.metadata||[],u=i?.metadata||[];return[...r,...l,...u]},[e,n,i]);return(0,N4.jsx)(Xp,{metadata:a,...t})}var U0=N(ct(),1);var L4=N(ct(),1);function q0(t,e={},n=[]){return(0,L4.useMemo)(()=>{if(!t)return null;let i=e.quality;t&&t.extraQualities&&e.quality&&(t.extraQualities.includes(e.quality)||(i="default"));let a=Dg(t);return Lg({identifier:a.identifier,server:a.server,scheme:a.scheme,type:"image",size:{max:!e.size?.width&&!e.size?.height,confined:!1,upscaled:!1,...e.size||{}},format:e.format||"jpg",region:e.region||{full:!0},rotation:e?.rotation?Number.isInteger(e.rotation)?{angle:e.rotation}:e.rotation:{angle:0},quality:i||"default",prefix:a.prefix,originalPath:a.originalPath})},[...n])}var Qp=N(tt(),1);function Ek(t){let e=typeof t.src=="string"?t.src:t.src.id,n=pp(),[i,a]=(0,U0.useState)(!1),r;if(e){let u=n.loadServiceSync({id:e});u&&(r=u)}!r&&!i&&n.loadService({id:e}).then(()=>{a(!0)});let l=q0(r,{size:t.size,selector:t.region,rotation:t.rotation,format:t.format,region:t.region,quality:t.quality},[i,t.src,t.size,t.region,t.rotation,t.format,t.region,t.quality]);return(0,U0.useEffect)(()=>()=>{a(!1)},[e]),l?(0,Qp.jsx)("img",{src:l,alt:t.alt,className:t.className,style:t.style}):(0,Qp.jsx)(D4,{...t,fetchImageService:!1})}function D4(t){if(t.fetchImageService)return(0,Qp.jsx)(Ek,{...t});let e=typeof t.src=="string"?{id:t.src,profile:"level0"}:t.src,n=q0(e,{size:t.size,selector:t.region,rotation:t.rotation,format:t.format,region:t.region,quality:t.quality},[t.src,t.size,t.region,t.rotation,t.format,t.region,t.quality]);return n?(0,Qp.jsx)("img",{src:n,alt:t.alt,className:t.className,style:t.style}):null}var V0=N(ct(),1);var Xo=N(tt(),1);function Ak({src:t,errorFallback:e,interactive:n,skipSizes:i,children:a,renderViewerControls:r,viewControlsDeps:l,fluid:u,x:f,y:h,...d}){let m=fo(),[y,g]=(0,V0.useState)(),b=e||P0,[w,E]=qp(),T=(0,V0.useMemo)(()=>{let R=E[t]?.status,A=w({id:t},{});return A?.height&&A.width&&R!=="loading"?{id:t,width:A.width,height:A.height,service:A,type:"Image",selector:{type:"BoxSelector",spatial:{x:0,y:0,width:A.width,height:A.height}},target:{type:"BoxSelector",spatial:{x:0,y:0,width:A.width,height:A.height}}}:null},[w,t,E]);if(!T||!T.height||!T.width)return null;let S=u?void 0:d.homePosition?d.homePosition.width/d.homePosition.height:T.width/T.height;return(0,Xo.jsx)(jd,{resetKeys:[],fallbackRender:R=>(0,Xo.jsx)(b,{...d,...R}),children:(0,Xo.jsx)(co,{vault:m,children:(0,Xo.jsx)(B0,{...d,aspectRatio:S,containerProps:{style:{position:"relative"},...d.containerProps||{}},onCreated:R=>{g(R),d.onCreated&&d.onCreated(R)},children:(0,Xo.jsxs)(xr.Provider,{value:y,children:[(0,Xo.jsx)(il,{image:T,id:T.id,isStatic:!n,x:f,y:h},T.id),(0,Xo.jsx)(Ck,{viewerPreset:y,renderViewerControls:r,image:T,src:t,viewControlsDeps:l}),a]})})})})}function Ck({viewerPreset:t,renderViewerControls:e,image:n,src:i,viewControlsDeps:a}){return yi(t&&e?"overlay":"none",`canvas-portal-controls-${i}`,xr.Provider,e&&n?{value:t||null,children:e({image:n,images:[n],type:"images"})}:{},[i,t,...a||[]]),null}var P4=N(tt(),1);function Mk(t){let e=Tn();return(0,P4.jsx)(Xp,{metadata:e?.metadata||[],...t})}var j0=N(ct(),1);var HE=N(H4(),1);var aa=N(tt(),1),{LazyLoadComponent:Ok}=HE||HE.default;function FE(t){let{size:e,visible:n,classes:i,canvasId:a,figure:r}=t,l=e?.width||128,u=e?.height||e?.width||128,f=(0,aa.jsx)(_k,{...t}),h=(0,aa.jsx)(Ok,{threshold:300,style:{height:u,width:l},visibleByDefault:n,children:a?(0,aa.jsx)(qa,{canvas:a,children:f}):f});return r?(0,aa.jsx)("figure",{className:i?.figure,children:h}):h}function _k({fallback:t,size:e,classes:n,showLabel:i,alt:a,dereference:r=!1}){let l=Wt(),u=e?.width||128,f=e?.height||e?.width||128,h=a||Wv(l?.label)||"",d=qo({width:u,height:f,allowUnsafe:!0},r);return!d||d.type!=="fixed"?(0,aa.jsx)(aa.Fragment,{children:t}):(0,aa.jsxs)(aa.Fragment,{children:[(0,aa.jsx)("div",{className:n?.imageWrapper,children:(0,aa.jsx)("img",{className:n?.img,src:d.id,alt:h})}),i?(0,aa.jsx)(_a,{as:"figcaption",className:n?.label,children:l?.label}):null]})}var Gd=N(tt(),1);function zk({scrollBehaviour:t,dereference:e,flat:n,size:i,classes:a={},showLabel:r,figure:l,fallback:u}){let f=(0,j0.useRef)(null),{items:h,sequence:d,currentSequenceIndex:m,setSequenceIndex:y}=ql(),g={row:a.selected?.row||a.row,item:a.selected?.item||a.item,figure:a.selected?.figure||a.figure,img:a.selected?.img||a.img,label:a.selected?.label||a.label,imageWrapper:a.selected?.imageWrapper||a.imageWrapper};(0,j0.useLayoutEffect)(()=>{if(!f.current)return;let w=f.current.querySelector("[data-selected=true]");w&&w.scrollIntoView({behavior:t||"instant",block:"nearest",inline:"center"})},[m]);let b=[];for(let w of d){let E=[],T=d[m]===w;for(let S of w){let R=h[S];E.push((0,Gd.jsx)("div",{className:T?g.item:a.item,children:(0,Gd.jsx)(FE,{classes:T?g:a,canvasId:R.id,size:i,dereference:e,showLabel:r,figure:l,placeholder:(0,Gd.jsx)("div",{style:{height:128,width:128}}),fallback:u})},S))}if(n){b.push(E);continue}b.push((0,Gd.jsx)("div",{onClick:S=>{y(d.indexOf(w))},"data-selected":T,className:T?g.row:a.row,children:E},w.join("-")))}return(0,Gd.jsx)("div",{ref:f,className:a.container,children:b})}function qE(){let t=$e(),e=zt(t,r=>r.completeRequest),n=zt(t,r=>r.polygonState.currentTool),i=zt(t,r=>r.polygonState.selectedStamp),a=zt(t,r=>r.switchTool);return{completeRequest:e,currentTool:n,selectedStamp:i,switchTool:a}}var ii=N(tt(),1),Ik={draw:!0,polygon:!0,line:!0,lineBox:!0,box:!0,triangle:!0,hexagon:!0,circle:!0,delete:!0,pen:!0};function Nk({showShapes:t=!0,enabled:e=Ik,classNames:n={},icons:i={}}){let{currentTool:a,switchTool:r,selectedStamp:l}=qE();return(0,ii.jsxs)(ii.Fragment,{children:[a,(0,ii.jsx)("button",{className:n.button,onClick:r.pointer,"data-active":a==="pointer",children:i.PointerIcon||"Pointer"}),(0,ii.jsx)("button",{className:n.button,onClick:r.hand,"data-active":a==="hand",children:i.HandIcon||"Hand"}),t?(0,ii.jsxs)(ii.Fragment,{children:[e.box&&(0,ii.jsx)("button",{className:n.button,onClick:r.box,"data-active":a==="box",children:i.BoxIcon||"Box"}),e.pen&&(0,ii.jsx)("button",{className:n.button,onClick:r.pen,"data-active":a==="pen",children:i.PenIcon||"Pen"}),e.draw&&(0,ii.jsx)("button",{className:n.button,onClick:r.draw,"data-active":a==="pencil",children:i.DrawIcon||"Draw"}),e.line&&(0,ii.jsx)("button",{className:n.button,onClick:r.line,"data-active":a==="line",children:i.LineIcon||"Line"}),e.lineBox&&(0,ii.jsx)("button",{className:n.button,onClick:r.lineBox,"data-active":a==="lineBox",children:i.LineBoxIcon||"LineBox"}),e.triangle&&(0,ii.jsx)("button",{className:n.button,onClick:r.triangle,"data-active":a==="stamp"&&l?.id==="triangle",children:i.TriangleIcon||"Triangle"}),e.hexagon&&(0,ii.jsx)("button",{className:n.button,onClick:r.hexagon,"data-active":a==="stamp"&&l?.id==="hexagon",children:i.HexagonIcon||"Hexagon"}),e.circle&&(0,ii.jsx)("button",{className:n.button,"data-active":a==="stamp"&&l?.id==="circle",onClick:r.circle,children:i.CircleIcon||"Circle"})]}):null,e.delete&&(0,ii.jsx)("button",{className:n.button,onClick:r.remove,children:i.DeleteForeverIcon||"Delete"})]})}var F4=N(tt(),1);function Lk({annotation:t,children:e}){return(0,F4.jsx)(Li,{value:{annotation:t},children:e})}var q4=N(tt(),1);function Dk({annotationPage:t,children:e}){return(0,q4.jsx)(Li,{value:{annotationPage:t},children:e})}var U4=N(tt(),1);function Pk({collection:t,children:e}){return(0,U4.jsx)(Li,{value:{collection:t},children:e})}function Bk(t,e={}){return Go(e)}var ul=N(ct(),1);function Hk({canvasId:t}={}){let e=kv(),n=Hl(),i=(0,ul.useMemo)(()=>t?[t]:e?[e.id]:n.map(h=>h.id),[t,e,n]),[a,r]=(0,ul.useState)({}),l=Op();(0,ul.useEffect)(()=>{let h=d=>{let m=d.partOf.canvasId;m&&r(y=>({...y,[m]:d.choice}))};return l.on("choice-change",h),()=>{l.off("choice-change",h)}},[]);let u=(0,ul.useMemo)(()=>{let h=[];for(let d of i){let m=a[d];m&&h.push({canvasId:d,choice:m})}return h},[i,a]),f=(0,ul.useMemo)(()=>({makeChoice:(h,d)=>{l.emit("make-choice",{choiceId:h,...d})}}),[l]);return{choices:u,actions:f}}function Fk(t,e=!1){}function qk(t){let n=wi().manifest,i=t?t.map(a=>typeof a=="string"?a:a?.id):[];return _e(a=>{let r=n?a.iiif.entities.Manifest[n]:void 0,l=r?.items||[];if(typeof t>"u")return l;let u=[];for(let f of r?.items||[])i.indexOf(f.id)!==-1&&u.push(f);return u},[i.join("/")])}var V4=N(ct(),1);function Uk(t,e=[]){let{id:n,selector:i}=t,a=wi(),r=n||a.collection,l=_e(u=>r?u.iiif.entities.Collection[r]:void 0,[r]);return(0,V4.useMemo)(()=>{if(l)return i?i(l):l},[l,i,...e])}var k0=N(ct(),1);function Vk(){let t=$e(),e=zt(t,i=>i.completeRequest),n=zt(t,i=>i.cancelRequest);return(0,k0.useMemo)(()=>({saveAnnotation:()=>{(0,k0.startTransition)(()=>{e()})},cancelRequest:n}),[e,n])}var j4=N(ct(),1);function jk({requestId:t}={}){let e=$e(),n=zt(e,u=>u.metadata),i=zt(e,u=>u.tool.requestId),a=t||i,r=zt(e,u=>u.setMetadata),l=(0,j4.useCallback)(u=>r(u,a||void 0),[r,a]);return[a?n[a]||{}:{},l]}function kk(t){let e=$e(),n=zt(e,i=>i.tool.requestId);pu("polygons.start-transition",i=>{t.requestId&&n!==t.requestId||t?.onStart?.(i.transitionIntent)},[n,t.requestId]),pu("polygons.end-transition",i=>{t.requestId&&n!==t.requestId||t?.onEnd?.(i.transitionIntent,i.response)},[n,t.requestId]),pu("polygons.transition",i=>{t.requestId&&n!==t.requestId||t?.onTransition?.(i.transitionIntent)},[n,t.requestId])}var G0=N(ct(),1);function Gk(t,e,n,i,a=[]){let r=ce(),l=(0,G0.useMemo)(()=>up(r),[r]);(0,G0.useEffect)(()=>{let u=t;return u?(l.addEventListener(u,e,n,i),()=>{l.removeEventListener(u,e,n)}):()=>{}},[l,t,e,...a])}function Yk(t,e){let{id:n,isLoaded:i,error:a,resource:r,requestId:l,cached:u}=If(t,e);return{id:n,isLoaded:i,error:a,manifest:r,requestId:l,cached:u}}var Yr=N(ct(),1);function UE({cacheKey:t}={}){let e=Wt(),n=Go(),i=ce(),a=zd(),r=nP(),[l,u]=(0,Yr.useState)(void 0),[f,h]=(0,Yr.useState)(!1),[d,m]=(0,Yr.useState)("idle"),[y,g]=(0,Yr.useState)(void 0),b=e?e.id:"undefined",w=(0,Yr.useMemo)(()=>{try{if(e&&n.length){let T=n[0],S=i.get(T.body[0]),A=gs(S)[0];return A&&a(A,{width:A.width||e.width,height:A.height||e.height},!0)||void 0}}catch(T){console.error(T)}},[b,t,e]),E=d==="success"&&l?l:w;return(0,Yr.useEffect)(()=>{(async()=>{try{if(e&&n.length){let T=n[0],S=i.get(T.body[0]),A=gs(S)[0];if(!A)return;h(!0),m("loading");try{let M=await r(A,{width:A.width||e.width,height:A.height||e.height})||void 0;u(M),m("success"),h(!1)}catch(M){m("error"),g(M)}}}catch(T){m("error"),g(T)}})()},[b,t]),(0,Yr.useMemo)(()=>({data:E,isFetching:f,status:d,error:y}),[E,f,d,y])}function Xk(){let t=UE();return{isLoading:t.isFetching,tile:t.data?{id:t.data.id||t.data["@id"],width:t.data.width,height:t.data.height,imageService:t.data,thumbnail:void 0}:null}}var Y0=N(ct(),1);function Qk({supports:t=["empty","images","media","3d-model","textual-content","complex-timeline"]}={}){let e=ce(),n=Wt(),i=Go(),a=(0,Y0.useMemo)(()=>Od(e),[e]),r=(0,Y0.useMemo)(()=>a.getPaintables(i),[a,i]);return(0,Y0.useMemo)(()=>kp({canvas:n,loadImageService:l=>l,paintables:r,supports:t}),[n,r,t])}var k4=N(ct(),1);function Kk(){let t=ce();return(0,k4.useMemo)(()=>Zs(t),[t])}var ai=N(ct(),1);var Kp=[.6,.02,0,.75],VE=16,jE={linear:[0,0,1,1],"ease-in":[.42,0,1,1],"ease-out":[0,0,.58,1],"ease-in-out":[.42,0,.58,1],"ease-in-cubic":Kp,"ease-out-cubic":[.215,.61,.355,1]};function kE(t,e,n){let i=Math.max(0,Math.min(1,n));return{x:t.x+(e.x-t.x)*i,y:t.y+(e.y-t.y)*i,width:t.width+(e.width-t.width)*i,height:t.height+(e.height-t.height)*i}}function GE(t,e){let n=[],i=t;for(let a of e)n.push({from:i,to:a}),i=a;return n}function Yd([t,e,n,i]){let a=3*t,r=3*(n-t)-a,l=1-a-r,u=3*e,f=3*(i-e)-u,h=1-u-f;function d(b){return((l*b+r)*b+a)*b}function m(b){return((h*b+f)*b+u)*b}function y(b){return(3*l*b+2*r)*b+a}function g(b,w=1e-6){let E=b;for(let R=0;R<8;R++){let A=d(E)-b;if(Math.abs(A)<w)return E;let M=y(E);if(Math.abs(M)<1e-6)break;E=E-A/M}let T=0,S=1;for(E=b;T<S;){let R=d(E);if(Math.abs(R-b)<w)return E;b>R?T=E:S=E,E=(S-T)*.5+T}return E}return b=>{if(b<=0)return 0;if(b>=1)return 1;let w=g(b);return m(w)}}function YE(t,e){if(!e||e.length===0)return{index:-1,t:0};if(Number.isNaN(t)||!isFinite(t))return{index:-1,t:0};if(t<0)return{index:-1,t:0};if(t>=e.length)return{index:e.length,t:0};let n=Math.floor(t),i=t-n;return{index:n,t:i}}function Zk(t){let{initial:e,regions:n,progress:i,getProgress:a,enabled:r=!0,easing:l,reportEveryFrame:u=!1,pollInterval:f=VE,loop:h=!1,onEnter:d,onExit:m,onProgress:y,jumpTo:g}=t,b=(0,ai.useMemo)(()=>GE(e,n),[e,n]),[w,E]=(0,ai.useState)(()=>-1),[T,S]=(0,ai.useState)(0),R=(0,ai.useRef)(-1),A=(0,ai.useRef)(0),M=(0,ai.useRef)(!0),z=(0,ai.useRef)(()=>{});(0,ai.useEffect)(()=>(M.current=!0,()=>{M.current=!1}),[]);let I=(0,ai.useMemo)(()=>{if(!l)return Yd(Kp);if(typeof l=="function")return l;if(Array.isArray(l)&&l.length===4)return Yd(l);let X=jE[l];return X?Yd(X):Yd(Kp)},[l]),L=(0,ai.useCallback)(X=>{if(!(X<0||X>=b.length)&&(E(X),R.current=X,A.current=0,S(0),d))try{d(X)}catch{}},[b,d]);(0,ai.useEffect)(()=>{z.current=L,g&&g(L)},[L,g]);function H(X){let{index:mt,t:lt}=YE(X,b),it=mt;if(h&&b.length>0){let xt=b.length;it=(mt%xt+xt)%xt}let yt=I(lt);if(it!==R.current){if(R.current>=0&&m)try{m(R.current)}catch{}if(it>=0&&d)try{d(it)}catch{}R.current=it,M.current&&E(it)}if(A.current=yt,M.current&&(u||it!==w)&&S(yt),y&&it>=0)try{y(it,yt)}catch{}}(0,ai.useEffect)(()=>{r&&typeof i=="number"&&H(i)},[i,r]),(0,ai.useEffect)(()=>{if(!r||typeof a!="function")return;let X=null,mt=()=>{try{let lt=a();H(lt)}catch{}};return mt(),X=setInterval(mt,f),()=>clearInterval(X)},[a,r,f]);let V=w>=0&&w<b.length?b[w]:void 0,nt=V?kE(V.from,V.to,A.current):void 0;return{transitions:b,currentIndex:w,currentTransition:V,t:A.current,rect:nt,jumpTo:L}}var zu=N(ct(),1);function Wk(t,e={}){let{axis:n="y",offset:i=0,steps:a=1,enabled:r=!0}=e,[l,u]=(0,zu.useState)(0),f=(0,zu.useRef)(-1),h=(0,zu.useRef)(null);return(0,zu.useEffect)(()=>{if(!r||!t||!t.current)return;let d=t.current,m=()=>{let g=n==="y"?d.scrollTop:d.scrollLeft,b=n==="y"?d.clientHeight:d.clientWidth,E=(n==="y"?d.scrollHeight:d.scrollWidth)-b,S=(E<=0?0:Math.max(0,Math.min(1,(g+i)/E)))*a;S!==f.current&&(f.current=S,u(S)),h.current=null},y=()=>{h.current===null&&(h.current=requestAnimationFrame(m))};return d.addEventListener("scroll",y,{passive:!0}),m(),()=>{d.removeEventListener("scroll",y),h.current!==null&&cancelAnimationFrame(h.current)}},[t,n,i,a,r]),l}function Jk(t,e){let{x:n,y:i,width:a,height:r}=t,{x:l,y:u}=e,{width:f,height:h}=e;return n+a>l&&n<l+f&&i+r>u&&i<u+h}var $k=!0,XE="Invariant failed";function G4(t,e){if(!t){if($k)throw new Error(XE);var n=typeof e=="function"?e():e,i=n?"".concat(XE,": ").concat(n):XE;throw new Error(i)}}function tG(t,e){let n=t.boundingBox||Ks(t.polygon);if(t.polygon&&!Rd(t.polygon.points)){let i=t.target||Ed(t.polygon,e);return G4(i?.type==="SvgSelector"),{type:"SvgSelector",points:t.polygon.points,spatial:{unit:"pixel",...n||{}},svgShape:t.polygon.open?"polyline":"polygon",svg:i.value}}return{type:"BoxSelector",spatial:n}}return p6(eG);})();
|
|
136
142
|
/*! Bundled license information:
|
|
137
143
|
|
|
138
144
|
react/cjs/react-jsx-runtime.production.js:
|