react-iiif-vault 2.0.9 → 2.0.10

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.
@@ -1,27 +1,27 @@
1
- "use strict";var ReactIIIFVault=(()=>{var IP=Object.create;var am=Object.defineProperty;var DP=Object.getOwnPropertyDescriptor;var LP=Object.getOwnPropertyNames;var PP=Object.getPrototypeOf,BP=Object.prototype.hasOwnProperty;var ui=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),HP=(t,e)=>{for(var n in e)am(t,n,{get:e[n],enumerable:!0})},Hw=(t,e,n,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of LP(e))!BP.call(t,a)&&a!==n&&am(t,a,{get:()=>e[a],enumerable:!(i=DP(e,a))||i.enumerable});return t};var _=(t,e,n)=>(n=t!=null?IP(PP(t)):{},Hw(e||!t||!t.__esModule?am(n,"default",{value:t,enumerable:!0}):n,t)),UP=t=>Hw(am({},"__esModule",{value:!0}),t);var nt=ui((QF,Qw)=>{"use strict";Qw.exports=React});var Kw=ui(lm=>{"use strict";var pB=Symbol.for("react.transitional.element"),mB=Symbol.for("react.fragment");function Xw(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:pB,type:t,key:i,ref:e!==void 0?e:null,props:n}}lm.Fragment=mB;lm.jsx=Xw;lm.jsxs=Xw});var Y=ui((KF,Zw)=>{"use strict";Zw.exports=Kw()});var dM=ui(fM=>{"use strict";var Uu=nt();function P6(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var B6=typeof Object.is=="function"?Object.is:P6,H6=Uu.useState,U6=Uu.useEffect,V6=Uu.useLayoutEffect,j6=Uu.useDebugValue;function q6(t,e){var n=e(),i=H6({inst:{value:n,getSnapshot:e}}),a=i[0].inst,o=i[1];return V6(function(){a.value=n,a.getSnapshot=e,ib(a)&&o({inst:a})},[t,n,e]),U6(function(){return ib(a)&&o({inst:a}),t(function(){ib(a)&&o({inst:a})})},[t]),j6(n),n}function ib(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!B6(t,n)}catch{return!0}}function F6(t,e){return e()}var G6=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?F6:q6;fM.useSyncExternalStore=Uu.useSyncExternalStore!==void 0?Uu.useSyncExternalStore:G6});var pM=ui((BG,hM)=>{"use strict";hM.exports=dM()});var gM=ui(mM=>{"use strict";var jm=nt(),k6=pM();function Y6(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var Q6=typeof Object.is=="function"?Object.is:Y6,X6=k6.useSyncExternalStore,K6=jm.useRef,Z6=jm.useEffect,J6=jm.useMemo,W6=jm.useDebugValue;mM.useSyncExternalStoreWithSelector=function(t,e,n,i,a){var o=K6(null);if(o.current===null){var s={hasValue:!1,value:null};o.current=s}else s=o.current;o=J6(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,Q6(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=X6(t,o[0],o[1]);return Z6(function(){s.hasValue=!0,s.value=u},[u]),W6(u),u}});var vM=ui((UG,yM)=>{"use strict";yM.exports=gM()});var YM=ui(Le=>{"use strict";function Sb(t,e){var n=t.length;t.push(e);t:for(;0<n;){var i=n-1>>>1,a=t[i];if(0<Qm(a,e))t[i]=e,t[n]=a,n=i;else break t}}function lo(t){return t.length===0?null:t[0]}function Km(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>Qm(u,n))d<a&&0>Qm(p,u)?(t[i]=p,t[d]=n,i=d):(t[i]=u,t[s]=n,i=s);else if(d<a&&0>Qm(p,n))t[i]=p,t[d]=n,i=d;else break t}}return e}function Qm(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"?(BM=performance,Le.unstable_now=function(){return BM.now()}):(gb=Date,HM=gb.now(),Le.unstable_now=function(){return gb.now()-HM});var BM,gb,HM,Po=[],Ur=[],hH=1,ya=null,ni=3,bb=!1,ad=!1,od=!1,xb=!1,jM=typeof setTimeout=="function"?setTimeout:null,qM=typeof clearTimeout=="function"?clearTimeout:null,UM=typeof setImmediate<"u"?setImmediate:null;function Xm(t){for(var e=lo(Ur);e!==null;){if(e.callback===null)Km(Ur);else if(e.startTime<=t)Km(Ur),e.sortIndex=e.expirationTime,Sb(Po,e);else break;e=lo(Ur)}}function Eb(t){if(od=!1,Xm(t),!ad)if(lo(Po)!==null)ad=!0,Qu||(Qu=!0,Yu());else{var e=lo(Ur);e!==null&&Rb(Eb,e.startTime-t)}}var Qu=!1,rd=-1,FM=5,GM=-1;function kM(){return xb?!0:!(Le.unstable_now()-GM<FM)}function yb(){if(xb=!1,Qu){var t=Le.unstable_now();GM=t;var e=!0;try{t:{ad=!1,od&&(od=!1,qM(rd),rd=-1),bb=!0;var n=ni;try{e:{for(Xm(t),ya=lo(Po);ya!==null&&!(ya.expirationTime>t&&kM());){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,Xm(t),e=!0;break e}ya===lo(Po)&&Km(Po),Xm(t)}else Km(Po);ya=lo(Po)}if(ya!==null)e=!0;else{var o=lo(Ur);o!==null&&Rb(Eb,o.startTime-t),e=!1}}break t}finally{ya=null,ni=n,bb=!1}e=void 0}}finally{e?Yu():Qu=!1}}}var Yu;typeof UM=="function"?Yu=function(){UM(yb)}:typeof MessageChannel<"u"?(vb=new MessageChannel,VM=vb.port2,vb.port1.onmessage=yb,Yu=function(){VM.postMessage(null)}):Yu=function(){jM(yb,0)};var vb,VM;function Rb(t,e){rd=jM(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"):FM=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(){xb=!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:hH++,callback:e,priorityLevel:t,startTime:n,expirationTime:a,sortIndex:-1},n>i?(t.sortIndex=n,Sb(Ur,t),lo(Po)===null&&t===lo(Ur)&&(od?(qM(rd),rd=-1):od=!0,Rb(Eb,n-i))):(t.sortIndex=a,Sb(Po,t),ad||bb||(ad=!0,Qu||(Qu=!0,Yu()))),t};Le.unstable_shouldYield=kM;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 Ab=ui((Hk,QM)=>{"use strict";QM.exports=YM()});var XM=ui((Uk,ld)=>{"use strict";ld.exports=function(t){function e(r,l,c,h){return new H4(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,N=y.child;N;){if(N===c){w=!0,c=y,h=b;break}if(N===h){w=!0,h=y,c=b;break}N=N.sibling}if(!w){for(N=b.child;N;){if(N===c){w=!0,c=b,h=y;break}if(N===h){w=!0,h=b,c=y;break}N=N.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=iw&&r[iw]||r["@@iterator"],typeof r=="function"?r:null)}function f(r){if(r==null)return null;if(typeof r=="function")return r.$$typeof===F4?null:r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case iu:return"Fragment";case oS:return"Profiler";case ew:return"StrictMode";case lS:return"Suspense";case sS:return"SuspenseList";case cS:return"Activity"}if(typeof r=="object")switch(r.$$typeof){case nu:return"Portal";case Er:return r.displayName||"Context";case nw:return(r._context.displayName||"Context")+".Consumer";case rS:var l=r.render;return r=r.displayName,r||(r=l.displayName||l.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case uS:return l=r.displayName||null,l!==null?l:f(r.type)||"Memo";case Rr:l=r._payload,r=r._init;try{return f(r(l))}catch{}}return null}function m(r){return{current:r}}function g(r){0>ru||(r.current=gS[ru],gS[ru]=null,ru--)}function v(r,l){ru++,gS[ru]=r.current,r.current=l}function S(r){return r>>>=0,r===0?32:31-(yP(r)/vP|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 C(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 N=h&134217727;return N!==0?(h=N&~b,h!==0?y=E(h):(w&=N,w!==0?y=E(w):c||(c=N&~r,c!==0&&(y=E(c))))):(N=h&~b,N!==0?y=E(N):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 R(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 A(){var r=Up;return Up<<=1,!(Up&62914560)&&(Up=4194304),r}function T(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 N=r.entanglements,k=r.expirationTimes,et=r.hiddenUpdates;for(c=w&~c;0<c;){var ct=31-Hi(c),ot=1<<ct;N[ct]=0,k[ct]=-1;var gt=et[ct];if(gt!==null)for(et[ct]=null,ct=0;ct<gt.length;ct++){var Pt=gt[ct];Pt!==null&&(Pt.lane&=-536870913)}c&=~ot}h!==0&&D(r,h,0),b!==0&&y===0&&r.tag!==0&&(r.suspendedLanes|=b&~(w&~l))}function D(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 I(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:B(c),c&(r.suspendedLanes|l)?0:c}function B(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 W(r){if(typeof RP=="function"&&AP(r),Ui&&typeof Ui.setStrictMode=="function")try{Ui.setStrictMode(wf,r)}catch{}}function it(r,l){return r===l&&(r!==0||1/r===1/l)||r!==r&&l!==l}function K(r){if(SS===void 0)try{throw Error()}catch(c){var l=c.stack.trim().match(/\n( *(at )?)/);SS=l&&l[1]||"",Ow=-1<c.stack.indexOf(`
1
+ "use strict";var ReactIIIFVault=(()=>{var XB=Object.create;var sm=Object.defineProperty;var KB=Object.getOwnPropertyDescriptor;var ZB=Object.getOwnPropertyNames;var WB=Object.getPrototypeOf,JB=Object.prototype.hasOwnProperty;var ui=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),$B=(t,e)=>{for(var n in e)sm(t,n,{get:e[n],enumerable:!0})},Zw=(t,e,n,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of ZB(e))!JB.call(t,a)&&a!==n&&sm(t,a,{get:()=>e[a],enumerable:!(i=KB(e,a))||i.enumerable});return t};var _=(t,e,n)=>(n=t!=null?XB(WB(t)):{},Zw(e||!t||!t.__esModule?sm(n,"default",{value:t,enumerable:!0}):n,t)),tP=t=>Zw(sm({},"__esModule",{value:!0}),t);var nt=ui((cF,l2)=>{"use strict";l2.exports=React});var u2=ui(hm=>{"use strict";var zP=Symbol.for("react.transitional.element"),NP=Symbol.for("react.fragment");function s2(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:zP,type:t,key:i,ref:e!==void 0?e:null,props:n}}hm.Fragment=NP;hm.jsx=s2;hm.jsxs=s2});var Y=ui((dF,c2)=>{"use strict";c2.exports=u2()});var CM=ui(TM=>{"use strict";var Fu=nt();function X6(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var K6=typeof Object.is=="function"?Object.is:X6,Z6=Fu.useState,W6=Fu.useEffect,J6=Fu.useLayoutEffect,$6=Fu.useDebugValue;function tH(t,e){var n=e(),i=Z6({inst:{value:n,getSnapshot:e}}),a=i[0].inst,o=i[1];return J6(function(){a.value=n,a.getSnapshot=e,pb(a)&&o({inst:a})},[t,n,e]),W6(function(){return pb(a)&&o({inst:a}),t(function(){pb(a)&&o({inst:a})})},[t]),$6(n),n}function pb(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!K6(t,n)}catch{return!0}}function eH(t,e){return e()}var nH=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?eH:tH;TM.useSyncExternalStore=Fu.useSyncExternalStore!==void 0?Fu.useSyncExternalStore:nH});var MM=ui((tk,wM)=>{"use strict";wM.exports=CM()});var _M=ui(OM=>{"use strict";var Xm=nt(),iH=MM();function aH(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var oH=typeof Object.is=="function"?Object.is:aH,rH=iH.useSyncExternalStore,lH=Xm.useRef,sH=Xm.useEffect,uH=Xm.useMemo,cH=Xm.useDebugValue;OM.useSyncExternalStoreWithSelector=function(t,e,n,i,a){var o=lH(null);if(o.current===null){var s={hasValue:!1,value:null};o.current=s}else s=o.current;o=uH(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,oH(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=rH(t,o[0],o[1]);return sH(function(){s.hasValue=!0,s.value=u},[u]),cH(u),u}});var NM=ui((nk,zM)=>{"use strict";zM.exports=_M()});var rO=ui(Le=>{"use strict";function _b(t,e){var n=t.length;t.push(e);t:for(;0<n;){var i=n-1>>>1,a=t[i];if(0<tg(a,e))t[i]=e,t[n]=a,n=i;else break t}}function lo(t){return t.length===0?null:t[0]}function ng(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>tg(u,n))d<a&&0>tg(p,u)?(t[i]=p,t[d]=n,i=d):(t[i]=u,t[s]=n,i=s);else if(d<a&&0>tg(p,n))t[i]=p,t[d]=n,i=d;else break t}}return e}function tg(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"?(WM=performance,Le.unstable_now=function(){return WM.now()}):(wb=Date,JM=wb.now(),Le.unstable_now=function(){return wb.now()-JM});var WM,wb,JM,Bo=[],jr=[],TH=1,ya=null,ni=3,zb=!1,sd=!1,ud=!1,Nb=!1,eO=typeof setTimeout=="function"?setTimeout:null,nO=typeof clearTimeout=="function"?clearTimeout:null,$M=typeof setImmediate<"u"?setImmediate:null;function eg(t){for(var e=lo(jr);e!==null;){if(e.callback===null)ng(jr);else if(e.startTime<=t)ng(jr),e.sortIndex=e.expirationTime,_b(Bo,e);else break;e=lo(jr)}}function Ib(t){if(ud=!1,eg(t),!sd)if(lo(Bo)!==null)sd=!0,Wu||(Wu=!0,Zu());else{var e=lo(jr);e!==null&&Db(Ib,e.startTime-t)}}var Wu=!1,cd=-1,iO=5,aO=-1;function oO(){return Nb?!0:!(Le.unstable_now()-aO<iO)}function Mb(){if(Nb=!1,Wu){var t=Le.unstable_now();aO=t;var e=!0;try{t:{sd=!1,ud&&(ud=!1,nO(cd),cd=-1),zb=!0;var n=ni;try{e:{for(eg(t),ya=lo(Bo);ya!==null&&!(ya.expirationTime>t&&oO());){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,eg(t),e=!0;break e}ya===lo(Bo)&&ng(Bo),eg(t)}else ng(Bo);ya=lo(Bo)}if(ya!==null)e=!0;else{var o=lo(jr);o!==null&&Db(Ib,o.startTime-t),e=!1}}break t}finally{ya=null,ni=n,zb=!1}e=void 0}}finally{e?Zu():Wu=!1}}}var Zu;typeof $M=="function"?Zu=function(){$M(Mb)}:typeof MessageChannel<"u"?(Ob=new MessageChannel,tO=Ob.port2,Ob.port1.onmessage=Mb,Zu=function(){tO.postMessage(null)}):Zu=function(){eO(Mb,0)};var Ob,tO;function Db(t,e){cd=eO(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"):iO=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(){Nb=!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:TH++,callback:e,priorityLevel:t,startTime:n,expirationTime:a,sortIndex:-1},n>i?(t.sortIndex=n,_b(jr,t),lo(Bo)===null&&t===lo(jr)&&(ud?(nO(cd),cd=-1):ud=!0,Db(Ib,n-i))):(t.sortIndex=a,_b(Bo,t),sd||zb||(sd=!0,Wu||(Wu=!0,Zu()))),t};Le.unstable_shouldYield=oO;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 Lb=ui((eY,lO)=>{"use strict";lO.exports=rO()});var sO=ui((nY,fd)=>{"use strict";fd.exports=function(t){function e(r,l,c,h){return new $4(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=mw&&r[mw]||r["@@iterator"],typeof r=="function"?r:null)}function f(r){if(r==null)return null;if(typeof r=="function")return r.$$typeof===a5?null:r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case ru:return"Fragment";case dS:return"Profiler";case hw:return"StrictMode";case pS:return"Suspense";case mS:return"SuspenseList";case yS:return"Activity"}if(typeof r=="object")switch(r.$$typeof){case ou:return"Portal";case Er:return r.displayName||"Context";case pw:return(r._context.displayName||"Context")+".Consumer";case hS:var l=r.render;return r=r.displayName,r||(r=l.displayName||l.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case gS: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=AS[uu],AS[uu]=null,uu--)}function v(r,l){uu++,AS[uu]=r.current,r.current=l}function S(r){return r>>>=0,r===0?32:31-(NB(r)/IB|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=Fp;return Fp<<=1,!(Fp&62914560)&&(Fp=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 HB=="function"&&UB(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(CS===void 0)try{throw Error()}catch(c){var l=c.stack.trim().match(/\n( *(at )?)/);CS=l&&l[1]||"",jw=-1<c.stack.indexOf(`
2
2
  at`)?" (<anonymous>)":-1<c.stack.indexOf("@")?"@unknown:0:0":""}return`
3
- `+SS+r+Ow}function tt(r,l){if(!r||bS)return"";bS=!0;var c=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var h={DetermineComponentFrameRoot:function(){try{if(l){var ot=function(){throw Error()};if(Object.defineProperty(ot.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ot,[])}catch(Pt){var gt=Pt}Reflect.construct(r,[],ot)}else{try{ot.call()}catch(Pt){gt=Pt}r.call(ot.prototype)}}else{try{throw Error()}catch(Pt){gt=Pt}(ot=r())&&typeof ot.catch=="function"&&ot.catch(function(){})}}catch(Pt){if(Pt&&gt&&typeof Pt.stack=="string")return[Pt.stack,gt.stack]}return[null,null]}};h.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var y=Object.getOwnPropertyDescriptor(h.DetermineComponentFrameRoot,"name");y&&y.configurable&&Object.defineProperty(h.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var b=h.DetermineComponentFrameRoot(),w=b[0],N=b[1];if(w&&N){var k=w.split(`
4
- `),et=N.split(`
3
+ `+CS+r+jw}function tt(r,l){if(!r||wS)return"";wS=!0;var c=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var h={DetermineComponentFrameRoot:function(){try{if(l){var ot=function(){throw Error()};if(Object.defineProperty(ot.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ot,[])}catch(Bt){var gt=Bt}Reflect.construct(r,[],ot)}else{try{ot.call()}catch(Bt){gt=Bt}r.call(ot.prototype)}}else{try{throw Error()}catch(Bt){gt=Bt}(ot=r())&&typeof ot.catch=="function"&&ot.catch(function(){})}}catch(Bt){if(Bt&&gt&&typeof Bt.stack=="string")return[Bt.stack,gt.stack]}return[null,null]}};h.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var y=Object.getOwnPropertyDescriptor(h.DetermineComponentFrameRoot,"name");y&&y.configurable&&Object.defineProperty(h.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var b=h.DetermineComponentFrameRoot(),w=b[0],I=b[1];if(w&&I){var k=w.split(`
4
+ `),et=I.split(`
5
5
  `);for(y=h=0;h<k.length&&!k[h].includes("DetermineComponentFrameRoot");)h++;for(;y<et.length&&!et[y].includes("DetermineComponentFrameRoot");)y++;if(h===k.length||y===et.length)for(h=k.length-1,y=et.length-1;1<=h&&0<=y&&k[h]!==et[y];)y--;for(;1<=h&&0<=y;h--,y--)if(k[h]!==et[y]){if(h!==1||y!==1)do if(h--,y--,0>y||k[h]!==et[y]){var ct=`
6
- `+k[h].replace(" at new "," at ");return r.displayName&&ct.includes("<anonymous>")&&(ct=ct.replace("<anonymous>",r.displayName)),ct}while(1<=h&&0<=y);break}}}finally{bS=!1,Error.prepareStackTrace=c}return(c=r?r.displayName||r.name:"")?K(c):""}function ut(r,l){switch(r.tag){case 26:case 27:case 5:return K(r.type);case 16:return K("Lazy");case 13:return r.child!==l&&l!==null?K("Suspense Fallback"):K("Suspense");case 19:return K("SuspenseList");case 0:case 15:return tt(r.type,!1);case 11:return tt(r.type.render,!1);case 1:return tt(r.type,!0);case 31:return K("Activity");default:return""}}function xt(r){try{var l="",c=null;do l+=ut(r,c),c=r,r=r.return;while(r);return l}catch(h){return`
6
+ `+k[h].replace(" at new "," at ");return r.displayName&&ct.includes("<anonymous>")&&(ct=ct.replace("<anonymous>",r.displayName)),ct}while(1<=h&&0<=y);break}}}finally{wS=!1,Error.prepareStackTrace=c}return(c=r?r.displayName||r.name:"")?X(c):""}function ut(r,l){switch(r.tag){case 26:case 27:case 5:return X(r.type);case 16:return X("Lazy");case 13:return r.child!==l&&l!==null?X("Suspense Fallback"):X("Suspense");case 19:return X("SuspenseList");case 0:case 15:return tt(r.type,!1);case 11:return tt(r.type.render,!1);case 1:return tt(r.type,!0);case 31:return X("Activity");default:return""}}function xt(r){try{var l="",c=null;do l+=ut(r,c),c=r,r=r.return;while(r);return l}catch(h){return`
7
7
  Error generating stack: `+h.message+`
8
- `+h.stack}}function lt(r,l){if(typeof r=="object"&&r!==null){var c=_w.get(r);return c!==void 0?c:(l={value:r,source:l,stack:xt(l)},_w.set(r,l),l)}return{value:r,source:l,stack:xt(l)}}function ft(r,l){su[uu++]=Mf,su[uu++]=jp,jp=r,Mf=l}function Rt(r,l,c){ua[ca++]=no,ua[ca++]=io,ua[ca++]=Ar,Ar=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 X(r){r.return!==null&&(ft(r,1),Rt(r,1,0))}function Ct(r){for(;r===jp;)jp=su[--uu],su[uu]=null,Mf=su[--uu],su[uu]=null;for(;r===Ar;)Ar=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++]=Ar,no=l.id,io=l.overflow,Ar=r}function ce(r,l){v(Tr,l),v(Of,r),v(Vn,null),r=Y4(l),g(Vn),v(Vn,r)}function le(){g(Vn),g(Of),g(Tr)}function pe(r){r.memoizedState!==null&&v(qp,r);var l=Vn.current,c=Q4(l,r.type);l!==c&&(v(Of,r),v(Vn,c))}function De(r){Of.current===r&&(g(Vn),g(Of)),qp.current===r&&(g(qp),Ro?ql._currentValue=au:ql._currentValue2=au)}function ne(r){var l=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Mn(lt(l,r)),xS}function Di(r,l){if(!$n)throw Error(i(175));Q5(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||gw(r.type)&&!Pp(r.type,r.memoizedProps))&&Ue&&ne(r):l!==3&&(l!==5||gw(r.type)&&!Pp(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=W5(r)}else if(l===31){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(i(317));Ue=J5(r)}else Ue=En&&l===27?B5(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){Ro?(v(Fp,l._currentValue),l._currentValue=c):(v(Fp,l._currentValue2),l._currentValue2=c)}function It(r){var l=Fp.current;Ro?r._currentValue=l:r._currentValue2=l,g(Fp)}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 N=b;b=y;for(var k=0;k<l.length;k++)if(N.context===l[k]){b.lanes|=c,N=b.alternate,N!==null&&(N.lanes|=c),te(b.return,c,r),h||(w=null);break t}b=N.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 N=y.type;Vi(y.pendingProps.value,w.value)||(r!==null?r.push(N):r=[N])}}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(ql):r=[ql])}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(Ro?l._currentValue:l._currentValue2,r.memoizedValue))return!0;r=r.next}return!1}function bn(r){Fl=r,To=null,r=r.dependencies,r!==null&&(r.firstContext=null)}function P(r){return dt(Fl,r)}function Q(r,l){return Fl===null&&bn(r),dt(r,l)}function dt(r,l){var c=Ro?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 CP,data:new Map,refCount:0}}function vt(r){r.refCount--,r.refCount===0&&wP(MP,function(){r.controller.abort()})}function j(){}function L(r){r!==cu&&r.next===null&&(cu===null?Gp=cu=r:cu=cu.next=r),kp=!0,ES||(ES=!0,Z())}function $(r,l){if(!RS&&kp){RS=!0;do for(var c=!1,h=Gp;h!==null;){if(!l)if(r!==0){var y=h.pendingLanes;if(y===0)var b=0;else{var w=h.suspendedLanes,N=h.pingedLanes;b=(1<<31-Hi(42|r)+1)-1,b&=y&~(w&~N),b=b&201326741?b&201326741|1:b?b|2:0}b!==0&&(c=!0,G(h,b))}else b=Qt,b=C(h,h===Re?b:0,h.cancelPendingCommit!==null||h.timeoutHandle!==jl),!(b&3)||R(h,b)||(c=!0,G(h,b));h=h.next}while(c);RS=!1}}function at(){Nt()}function Nt(){kp=ES=!1;var r=0;Gl!==0&&n5()&&(r=Gl);for(var l=Si(),c=null,h=Gp;h!==null;){var y=h.next,b=Lt(h,l);b===0?(h.next=null,c===null?Gp=y:c.next=y,y===null&&(cu=c)):(c=h,(r!==0||b&3)&&(kp=!0)),h=y}Rn!==0&&Rn!==5||$(r,!1),Gl!==0&&(Gl=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),N=1<<w,k=y[w];k===-1?(!(N&c)||N&h)&&(y[w]=x(N,l)):k<=l&&(r.expiredLanes|=N),b&=~N}if(l=Re,c=Qt,c=C(r,r===l?c:0,r.cancelPendingCommit!==null||r.timeoutHandle!==jl),h=r.callbackNode,c===0||r===l&&(fe===2||fe===9)||r.cancelPendingCommit!==null)return h!==null&&h!==null&&yS(h),r.callbackNode=null,r.callbackPriority=0;if(!(c&3)||R(r,c)){if(l=c&-c,l===r.callbackPriority)return l;switch(h!==null&&yS(h),U(c)){case 2:case 8:c=xP;break;case 32:c=vS;break;case 268435456:c=EP;break;default:c=vS}return h=jt.bind(null,r),c=Vp(c,h),r.callbackPriority=l,r.callbackNode=c,l}return h!==null&&h!==null&&yS(h),r.callbackPriority=2,r.callbackNode=null,2}function jt(r,l){if(Rn!==0&&Rn!==5)return r.callbackNode=null,r.callbackPriority=0,null;var c=r.callbackNode;if(Rf()&&r.callbackNode!==c)return null;var h=Qt;return h=C(r,r===Re?h:0,r.cancelPendingCommit!==null||r.timeoutHandle!==jl),h===0?null:(_C(r,h,l),Lt(r,Si()),r.callbackNode!=null&&r.callbackNode===c?jt.bind(null,r):null)}function G(r,l){if(Rf())return null;_C(r,l,!0)}function Z(){u5?c5(function(){Ft&6?Vp(ww,at):Nt()}):Vp(ww,at)}function mt(){if(Gl===0){var r=fu;r===0&&(r=Bp,Bp<<=1,!(Bp&261888)&&(Bp=256)),Gl=r}return Gl}function yt(r,l){if(_f===null){var c=_f=[];AS=0,fu=mt(),du={status:"pending",value:void 0,then:function(h){c.push(h)}}}return AS++,l.then(pt,pt),l}function pt(){if(--AS===0&&_f!==null){du!==null&&(du.status="fulfilled");var r=_f;_f=null,fu=0,du=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=kl.current;return r!==null?r:Re.pooledCache}function ye(r,l){l===null?v(kl,kl.current):v(kl,l.pool)}function ve(){var r=Ee();return r===null?null:{parent:Ro?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(!TP.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,Dl(r),r;default:if(typeof l.status=="string")l.then(j,j);else{if(r=Re,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,Dl(r),r}throw Yl=l,hu}}function yi(r){try{var l=r._init;return l(r._payload)}catch(c){throw c!==null&&typeof c=="object"&&typeof c.then=="function"?(Yl=c,hu):c}}function $a(){if(Yl===null)throw Error(i(459));var r=Yl;return Yl=null,r}function Dl(r){if(r===hu||r===Yp)throw Error(i(483))}function Ll(r){var l=zf;return zf+=1,pu===null&&(pu=[]),xn(pu,r,l)}function mr(r,l){l=l.props.ref,r.ref=l!==void 0?l:null}function fp(r,l){throw l.$$typeof===j4?Error(i(525)):(r=Object.prototype.toString.call(l),Error(i(31,r==="[object Object]"?"object with keys {"+Object.keys(l).join(", ")+"}":r)))}function eT(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 N(V,H,F,rt){return H===null||H.tag!==6?(H=eS(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===iu?ct(V,H,F.props.children,rt,F.key):H!==null&&(H.elementType===Mt||typeof Mt=="object"&&Mt!==null&&Mt.$$typeof===Rr&&yi(Mt)===H.type)?(H=y(H,F.props),mr(H,F),H.return=V,H):(H=Ip(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=nS(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=Vl(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=eS(""+H,V.mode,F),H.return=V,H;if(typeof H=="object"&&H!==null){switch(H.$$typeof){case Dp:return F=Ip(H.type,H.key,H.props,null,V.mode,F),mr(F,H),F.return=V,F;case nu:return H=nS(H,V.mode,F),H.return=V,H;case Rr:return H=yi(H),ot(V,H,F)}if(Lp(H)||p(H))return H=Vl(H,V.mode,F,null),H.return=V,H;if(typeof H.then=="function")return ot(V,Ll(H),F);if(H.$$typeof===Er)return ot(V,Q(V,H),F);fp(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:N(V,H,""+F,rt);if(typeof F=="object"&&F!==null){switch(F.$$typeof){case Dp:return F.key===Mt?k(V,H,F,rt):null;case nu:return F.key===Mt?et(V,H,F,rt):null;case Rr:return F=yi(F),gt(V,H,F,rt)}if(Lp(F)||p(F))return Mt!==null?null:ct(V,H,F,rt,null);if(typeof F.then=="function")return gt(V,H,Ll(F),rt);if(F.$$typeof===Er)return gt(V,H,Q(V,F),rt);fp(V,F)}return null}function Pt(V,H,F,rt,Mt){if(typeof rt=="string"&&rt!==""||typeof rt=="number"||typeof rt=="bigint")return V=V.get(F)||null,N(H,V,""+rt,Mt);if(typeof rt=="object"&&rt!==null){switch(rt.$$typeof){case Dp:return V=V.get(rt.key===null?F:rt.key)||null,k(H,V,rt,Mt);case nu:return V=V.get(rt.key===null?F:rt.key)||null,et(H,V,rt,Mt);case Rr:return rt=yi(rt),Pt(V,H,F,rt,Mt)}if(Lp(rt)||p(rt))return V=V.get(F)||null,ct(H,V,rt,Mt,null);if(typeof rt.then=="function")return Pt(V,H,F,Ll(rt),Mt);if(rt.$$typeof===Er)return Pt(V,H,F,Q(H,rt),Mt);fp(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&&ft(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&&ft(V,ae),Mt}for(Ot=h(Ot);ae<F.length;ae++)zn=Pt(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&&ft(V,ae),Mt}function Hf(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&&ft(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&&ft(V,ae),Mt}for(Ot=h(Ot);!oe.done;ae++,oe=F.next())oe=Pt(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(NP){return l(V,NP)}),Kt&&ft(V,ae),Mt}function Zl(V,H,F,rt){if(typeof F=="object"&&F!==null&&F.type===iu&&F.key===null&&(F=F.props.children),typeof F=="object"&&F!==null){switch(F.$$typeof){case Dp:t:{for(var Mt=F.key;H!==null;){if(H.key===Mt){if(Mt=F.type,Mt===iu){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===Rr&&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===iu?(rt=Vl(F.props.children,V.mode,rt,F.key),rt.return=V,V=rt):(rt=Ip(F.type,F.key,F.props,null,V.mode,rt),mr(rt,F),rt.return=V,V=rt)}return w(V);case nu: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=nS(F,V.mode,rt),rt.return=V,V=rt}return w(V);case Rr:return F=yi(F),Zl(V,H,F,rt)}if(Lp(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),Hf(V,H,F,rt)}if(typeof F.then=="function")return Zl(V,H,Ll(F),rt);if(F.$$typeof===Er)return Zl(V,H,Q(V,F),rt);fp(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=eS(F,V.mode,rt),rt.return=V,V=rt),w(V)):c(V,H)}return function(V,H,F,rt){try{zf=0;var Mt=Zl(V,H,F,rt);return pu=null,Mt}catch(Ot){if(Ot===hu||Ot===Yp)throw Ot;var je=e(29,Ot,null,V.mode);return je.lanes=rt,je.return=V,je}finally{}}}function dp(){for(var r=mu,l=CS=mu=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&&nT(c,y,b)}}function hp(r,l,c,h){da[mu++]=r,da[mu++]=l,da[mu++]=c,da[mu++]=h,CS|=h,r.lanes|=h,r=r.alternate,r!==null&&(r.lanes|=h)}function l0(r,l,c,h){return hp(r,l,c,h),pp(r)}function Pl(r,l){return hp(r,null,null,l),pp(r)}function nT(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 pp(r){if(50<Bf)throw Bf=0,HS=null,Error(i(185));for(var l=r.return;l!==null;)r=l,l=r.return;return r.tag===3?r.stateNode:null}function s0(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function u0(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=pp(r),nT(r,null,c),l}return hp(r,h,l,c),pp(r)}function df(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,I(r,c)}}function c0(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 hf(){if(wS){var r=du;if(r!==null)throw r}}function pf(r,l,c,h){wS=!1;var y=r.updateQueue;wr=!1;var b=y.firstBaseUpdate,w=y.lastBaseUpdate,N=y.shared.pending;if(N!==null){y.shared.pending=null;var k=N,et=k.next;k.next=null,w===null?b=et:w.next=et,w=k;var ct=r.alternate;ct!==null&&(ct=ct.updateQueue,N=ct.lastBaseUpdate,N!==w&&(N===null?ct.firstBaseUpdate=et:N.next=et,ct.lastBaseUpdate=k))}if(b!==null){var ot=y.baseState;w=0,ct=et=k=null,N=b;do{var gt=N.lane&-536870913,Pt=gt!==N.lane;if(Pt?(Qt&gt)===gt:(h&gt)===gt){gt!==0&&gt===fu&&(wS=!0),ct!==null&&(ct=ct.next={lane:0,tag:N.tag,payload:N.payload,callback:null,next:null});t:{var qn=r,Hf=N;gt=l;var Zl=c;switch(Hf.tag){case 1:if(qn=Hf.payload,typeof qn=="function"){ot=qn.call(Zl,ot,gt);break t}ot=qn;break t;case 3:qn.flags=qn.flags&-65537|128;case 0:if(qn=Hf.payload,gt=typeof qn=="function"?qn.call(Zl,ot,gt):qn,gt==null)break t;ot=aS({},ot,gt);break t;case 2:wr=!0}}gt=N.callback,gt!==null&&(r.flags|=64,Pt&&(r.flags|=8192),Pt=y.callbacks,Pt===null?y.callbacks=[gt]:Pt.push(gt))}else Pt={lane:gt,tag:N.tag,payload:N.payload,callback:N.callback,next:null},ct===null?(et=ct=Pt,k=ot):ct=ct.next=Pt,w|=gt;if(N=N.next,N===null){if(N=y.shared.pending,N===null)break;Pt=N,N=Pt.next,Pt.next=null,y.lastBaseUpdate=Pt,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 iT(r,l){if(typeof r!="function")throw Error(i(191,r));r.call(l)}function aT(r,l){var c=r.callbacks;if(c!==null)for(r.callbacks=null,r=0;r<c.length;r++)iT(c[r],l)}function oT(r,l){r=Mo,v(Xp,r),v(gu,l),Mo=r|l.baseLanes}function f0(){v(Xp,Mo),v(gu,gu.current)}function d0(){Mo=Xp.current,g(gu),g(Xp)}function vr(r){var l=r.alternate;v(nn,nn.current&1),v(ji,r),ha===null&&(l===null||gu.current!==null||l.memoizedState!==null)&&(ha=r)}function h0(r){v(nn,nn.current),v(ji,r),ha===null&&(ha=r)}function rT(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 mp(r){for(var l=r;l!==null;){if(l.tag===13){var c=l.memoizedState;if(c!==null&&(c=c.dehydrated,c===null||hS(c)||pS(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 p0(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 m0(r,l,c,h,y,b){return Co=b,Bt=l,l.memoizedState=null,l.updateQueue=null,l.lanes=0,wt.H=r===null||r.memoizedState===null?Iw:MS,Xl=!1,b=c(h,y),Xl=!1,yu&&(b=sT(l,c,h,y)),lT(r),b}function lT(r){wt.H=If;var l=Se!==null&&Se.next!==null;if(Co=0,sn=Se=Bt=null,Kp=!1,Nf=0,vu=null,l)throw Error(i(300));r===null||un||(r=r.dependencies,r!==null&&tn(r)&&(un=!0))}function sT(r,l,c,h){Bt=r;var y=0;do{if(yu&&(vu=null),Nf=0,yu=!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=Dw,b=l(c,h)}while(yu);return b}function y4(){var r=wt.H,l=r.useState()[0];return l=typeof l.then=="function"?mf(l):l,r=r.useState()[0],(Se!==null?Se.memoizedState:null)!==r&&(Bt.flags|=1024),l}function g0(){var r=Zp!==0;return Zp=0,r}function y0(r,l,c){l.updateQueue=r.updateQueue,l.flags&=-2053,r.lanes&=~c}function v0(r){if(Kp){for(r=r.memoizedState;r!==null;){var l=r.queue;l!==null&&(l.pending=null),r=r.next}Kp=!1}Co=0,sn=Se=Bt=null,yu=!1,Nf=Zp=0,vu=null}function li(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return sn===null?Bt.memoizedState=sn=r:sn=sn.next=r,sn}function en(){if(Se===null){var r=Bt.alternate;r=r!==null?r.memoizedState:null}else r=Se.next;var l=sn===null?Bt.memoizedState:sn.next;if(l!==null)sn=l,Se=r;else{if(r===null)throw Bt.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?Bt.memoizedState=sn=r:sn=sn.next=r}return sn}function gp(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function mf(r){var l=Nf;return Nf+=1,vu===null&&(vu=[]),r=xn(vu,r,l),l=Bt,(sn===null?l.memoizedState:sn.next)===null&&(l=l.alternate,wt.H=l===null||l.memoizedState===null?Iw:MS),r}function yp(r){if(r!==null&&typeof r=="object"){if(typeof r.then=="function")return mf(r);if(r.$$typeof===Er)return P(r)}throw Error(i(438,String(r)))}function S0(r){var l=null,c=Bt.updateQueue;if(c!==null&&(l=c.memoCache),l==null){var h=Bt.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=gp(),Bt.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]=q4;return l.index++,c}function vo(r,l){return typeof l=="function"?l(r):l}function vp(r){var l=en();return b0(l,Se,r)}function b0(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 N=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===fu&&(ct=!0);else if((Co&gt)===gt){et=et.next,gt===fu&&(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?(N=k=ot,w=b):k=k.next=ot,Bt.lanes|=gt,Or|=gt;ot=et.action,Xl&&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?(N=k=gt,w=b):k=k.next=gt,Bt.lanes|=ot,Or|=ot;et=et.next}while(et!==null&&et!==l);if(k===null?w=b:k.next=N,!Vi(b,r.memoizedState)&&(un=!0,ct&&(c=du,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 x0(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 uT(r,l,c){var h=Bt,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,A0(dT.bind(null,h,y,r),[r]),y.getSnapshot!==l||w||sn!==null&&sn.memoizedState.tag&1){if(h.flags|=2048,Ws(9,{destroy:void 0},fT.bind(null,h,y,c,l),null),Re===null)throw Error(i(349));b||Co&127||cT(h,l,c)}return c}function cT(r,l,c){r.flags|=16384,r={getSnapshot:l,value:c},l=Bt.updateQueue,l===null?(l=gp(),Bt.updateQueue=l,l.stores=[r]):(c=l.stores,c===null?l.stores=[r]:c.push(r))}function fT(r,l,c,h){l.value=c,l.getSnapshot=h,hT(l)&&pT(r)}function dT(r,l,c){return c(function(){hT(l)&&pT(r)})}function hT(r){var l=r.getSnapshot;r=r.value;try{var c=l();return!Vi(r,c)}catch{return!0}}function pT(r){var l=Pl(r,2);l!==null&&vi(l,r,2)}function E0(r){var l=li();if(typeof r=="function"){var c=r;if(r=c(),Xl){W(!0);try{c()}finally{W(!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,b0(r,Se,typeof h=="function"?h:vo)}function v4(r,l,c,h,y){if(xp(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,gT(l,b)):(b.next=c.next,l.pending=c.next=b)}}function gT(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 N=c(y,h),k=wt.S;k!==null&&k(w,N),yT(r,l,N)}catch(et){R0(r,l,et)}finally{b!==null&&w.types!==null&&(b.types=w.types),wt.T=b}}else try{b=c(y,h),yT(r,l,b)}catch(et){R0(r,l,et)}}function yT(r,l,c){c!==null&&typeof c=="object"&&typeof c.then=="function"?c.then(function(h){vT(r,l,h)},function(h){return R0(r,l,h)}):vT(r,l,c)}function vT(r,l,c){l.status="fulfilled",l.value=c,ST(l),r.state=c,l=r.pending,l!==null&&(c=l.next,c===l?r.pending=null:(c=c.next,l.next=c,gT(r,c)))}function R0(r,l,c){var h=r.pending;if(r.pending=null,h!==null){h=h.next;do l.status="rejected",l.reason=c,ST(l),l=l.next;while(l!==h)}r.action=null}function ST(r){r=r.listeners;for(var l=0;l<r.length;l++)(0,r[l])()}function bT(r,l){return l}function xT(r,l){if(Kt){var c=Re.formState;if(c!==null){t:{var h=Bt;if(Kt){if(Ue){var y=L5(Ue,fa);if(y){Ue=mw(y),h=P5(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:bT,lastRenderedState:l},c.queue=h,c=UT.bind(null,Bt,h),h.dispatch=c,h=E0(!1);var b=M0.bind(null,Bt,!1,h.queue);return h=li(),y={state:l,dispatch:null,action:r,pending:null},h.queue=y,c=v4.bind(null,Bt,y,b,c),y.dispatch=c,h.memoizedState=r,[l,c,!1]}function ET(r){var l=en();return RT(l,Se,r)}function RT(r,l,c){if(l=b0(r,l,bT)[0],r=vp(vo)[0],typeof l=="object"&&l!==null&&typeof l.then=="function")try{var h=mf(l)}catch(w){throw w===hu?Yp:w}else h=l;l=en();var y=l.queue,b=y.dispatch;return c!==l.memoizedState&&(Bt.flags|=2048,Ws(9,{destroy:void 0},S4.bind(null,y,c),null)),[h,b,r]}function S4(r,l){r.action=l}function AT(r){var l=en(),c=Se;if(c!==null)return RT(l,c,r);en(),l=l.memoizedState,c=en();var h=c.queue.dispatch;return c.memoizedState=r,[l,h,!1]}function Ws(r,l,c,h){return r={tag:r,create:c,deps:h,inst:l,next:null},l=Bt.updateQueue,l===null&&(l=gp(),Bt.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 TT(){return en().memoizedState}function Sp(r,l,c,h){var y=li();Bt.flags|=r,y.memoizedState=Ws(1|l,{destroy:void 0},c,h===void 0?null:h)}function bp(r,l,c,h){var y=en();h=h===void 0?null:h;var b=y.memoizedState.inst;Se!==null&&h!==null&&p0(h,Se.memoizedState.deps)?y.memoizedState=Ws(l,b,c,h):(Bt.flags|=r,y.memoizedState=Ws(1|l,b,c,h))}function CT(r,l){Sp(8390656,8,r,l)}function A0(r,l){bp(2048,8,r,l)}function b4(r){Bt.flags|=4;var l=Bt.updateQueue;if(l===null)l=gp(),Bt.updateQueue=l,l.events=[r];else{var c=l.events;c===null?l.events=[r]:c.push(r)}}function wT(r){var l=en().memoizedState;return b4({ref:l,nextImpl:r}),function(){if(Ft&2)throw Error(i(440));return l.impl.apply(void 0,arguments)}}function MT(r,l){return bp(4,2,r,l)}function OT(r,l){return bp(4,4,r,l)}function _T(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 zT(r,l,c){c=c!=null?c.concat([r]):null,bp(4,4,_T.bind(null,l,r),c)}function T0(){}function NT(r,l){var c=en();l=l===void 0?null:l;var h=c.memoizedState;return l!==null&&p0(l,h[1])?h[0]:(c.memoizedState=[r,l],r)}function IT(r,l){var c=en();l=l===void 0?null:l;var h=c.memoizedState;if(l!==null&&p0(l,h[1]))return h[0];if(h=r(),Xl){W(!0);try{r()}finally{W(!1)}}return c.memoizedState=[h,l],h}function C0(r,l,c){return c===void 0||Co&1073741824&&!(Qt&261930)?r.memoizedState=l:(r.memoizedState=c,r=OC(),Bt.lanes|=r,Or|=r,c)}function DT(r,l,c,h){return Vi(c,l)?c:gu.current!==null?(r=C0(r,c,h),Vi(r,l)||(un=!0),r):!(Co&42)||Co&1073741824&&!(Qt&261930)?(un=!0,r.memoizedState=c):(r=OC(),Bt.lanes|=r,Or|=r,l)}function LT(r,l,c,h,y){var b=Ao();On(b!==0&&8>b?b:8);var w=wt.T,N={};wt.T=N,M0(r,!1,l,c);try{var k=y(),et=wt.S;if(et!==null&&et(N,k),k!==null&&typeof k=="object"&&typeof k.then=="function"){var ct=Ut(k,h);gf(r,l,ct,Pi(r))}else gf(r,l,h,Pi(r))}catch(ot){gf(r,l,{then:function(){},status:"rejected",reason:ot},Pi())}finally{On(b),w!==null&&N.types!==null&&(w.types=N.types),wt.T=w}}function PT(r){var l=r.memoizedState;if(l!==null)return l;l={memoizedState:au,baseState:au,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:vo,lastRenderedState:au},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 w0(){return P(ql)}function BT(){return en().memoizedState}function HT(){return en().memoizedState}function x4(r){for(var l=r.return;l!==null;){switch(l.tag){case 24:case 3:var c=Pi();r=gr(c);var h=yr(l,r,c);h!==null&&(vi(h,l,c),df(h,l,c)),l={cache:ht()},r.payload=l;return}l=l.return}}function E4(r,l,c){var h=Pi();c={lane:h,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},xp(r)?VT(l,c):(c=l0(r,l,c,h),c!==null&&(vi(c,r,h),jT(c,l,h)))}function UT(r,l,c){var h=Pi();gf(r,l,c,h)}function gf(r,l,c,h){var y={lane:h,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null};if(xp(r))VT(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,N=b(w,c);if(y.hasEagerState=!0,y.eagerState=N,Vi(N,w))return hp(r,l,y,0),Re===null&&dp(),!1}catch{}finally{}if(c=l0(r,l,y,h),c!==null)return vi(c,r,h),jT(c,l,h),!0}return!1}function M0(r,l,c,h){if(h={lane:2,revertLane:mt(),gesture:null,action:h,hasEagerState:!1,eagerState:null,next:null},xp(r)){if(l)throw Error(i(479))}else l=l0(r,c,h,2),l!==null&&vi(l,r,2)}function xp(r){var l=r.alternate;return r===Bt||l!==null&&l===Bt}function VT(r,l){yu=Kp=!0;var c=r.pending;c===null?l.next=l:(l.next=c.next,c.next=l),r.pending=l}function jT(r,l,c){if(c&4194048){var h=l.lanes;h&=r.pendingLanes,c|=h,l.lanes=c,I(r,c)}}function O0(r,l,c,h){l=r.memoizedState,c=c(h,l),c=c==null?l:aS({},l,c),r.memoizedState=c,r.lanes===0&&(r.updateQueue.baseState=c)}function qT(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 FT(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&&OS.enqueueReplaceState(l,l.state,null)}function Bl(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=aS({},c));for(var y in r)c[y]===void 0&&(c[y]=r[y])}return c}function Ep(r,l){try{var c=r.onUncaughtError;c(l.value,{componentStack:l.stack})}catch(h){setTimeout(function(){throw h})}}function GT(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 _0(r,l,c){return c=gr(c),c.tag=3,c.payload={element:null},c.callback=function(){Ep(r,l)},c}function kT(r){return r=gr(r),r.tag=3,r}function YT(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(){GT(l,c,h)}}var w=c.stateNode;w!==null&&typeof w.componentDidCatch=="function"&&(r.callback=function(){GT(l,c,h),typeof y!="function"&&(_r===null?_r=new Set([this]):_r.add(this));var N=h.stack;this.componentDidCatch(h.value,{componentStack:N!==null?N:""})})}function R4(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?zp():c.alternate===null&&Xe===0&&(Xe=3),c.flags&=-257,c.flags|=65536,c.lanes=y,h===Qp?c.flags|=16384:(l=c.updateQueue,l===null?c.updateQueue=new Set([h]):l.add(h),$0(r,h,y)),!1;case 22:return c.flags|=65536,h===Qp?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)),$0(r,h,y)),!1}throw Error(i(435,c.tag))}return $0(r,h,y),zp(),!1}if(Kt)return l=ji.current,l!==null?(!(l.flags&65536)&&(l.flags|=256),l.flags|=65536,l.lanes=y,h!==xS&&(r=Error(i(422),{cause:h}),Mn(lt(r,c)))):(h!==xS&&(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=_0(r.stateNode,h,y),c0(r,y),Xe!==4&&(Xe=2)),!1;var b=Error(i(520),{cause:h});if(b=lt(b,c),Lf===null?Lf=[b]:Lf.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=_0(c.stateNode,h,r),c0(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=kT(y),YT(y,r,c,h),c0(c,y),!1}c=c.return}while(c!==null);return!1}function Un(r,l,c,h){l.child=r===null?Nw(l,null,c,h):Ql(l,r.child,c,h)}function QT(r,l,c,h,y){c=c.render;var b=l.ref;if("ref"in h){var w={};for(var N in h)N!=="ref"&&(w[N]=h[N])}else w=h;return bn(l),h=m0(r,l,c,w,b,y),N=g0(),r!==null&&!un?(y0(r,l,y),So(r,l,y)):(Kt&&N&&X(l),l.flags|=1,Un(r,l,h,y),l.child)}function XT(r,l,c,h,y){if(r===null){var b=c.type;return typeof b=="function"&&!tS(b)&&b.defaultProps===void 0&&c.compare===null?(l.tag=15,l.type=b,KT(r,l,b,h,y)):(r=Ip(c.type,null,h,l,l.mode,y),r.ref=l.ref,r.return=l,l.child=r)}if(b=r.child,!B0(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 KT(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,B0(r,y))r.flags&131072&&(un=!0);else return l.lanes=r.lanes,So(r,l,y)}return z0(r,l,c,h,y)}function ZT(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 JT(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?oT(l,b):f0(),rT(l);else return h=l.lanes=536870912,JT(r,l,b!==null?b.baseLanes|c:c,c,h)}else b!==null?(ye(l,b.cachePool),oT(l,b),Sr(l),l.memoizedState=null):(r!==null&&ye(l,null),f0(),Sr(l));return Un(r,l,y,c),l.child}function yf(r,l){return r!==null&&r.tag===22||l.stateNode!==null||(l.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.sibling}function JT(r,l,c,h,y){var b=Ee();return b=b===null?null:{parent:Ro?Ve._currentValue:Ve._currentValue2,pool:b},l.memoizedState={baseLanes:c,cachePool:b},r!==null&&ye(l,null),f0(),rT(l),r!==null&&Zn(r,l,h,!0),l.childLanes=y,null}function Rp(r,l){return l=Tp({mode:l.mode,children:l.children},r.mode),l.ref=r.ref,r.child=l,l.return=r,l}function WT(r,l,c){return Ql(l,r.child,null,c),r=Rp(l,l.pendingProps),r.flags|=2,Li(l),l.memoizedState=null,r}function A4(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=Rp(l,h),l.lanes=536870912,yf(null,r);if(h0(l),(r=Ue)?(r=k5(r,fa),r!==null&&(l.memoizedState={dehydrated:r,treeContext:Ar!==null?{id:no,overflow:io}:null,retryLane:536870912,hydrationErrors:null},c=KC(r),c.return=l,l.child=c,jn=l,Ue=null)):r=null,r===null)throw ne(l);return l.lanes=536870912,null}return Rp(l,h)}var b=r.memoizedState;if(b!==null){var w=b.dehydrated;if(h0(l),y)if(l.flags&256)l.flags&=-257,l=WT(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=Re,h!==null&&(w=q(h,c),w!==0&&w!==b.retryLane))throw b.retryLane=w,Pl(r,w),vi(h,r,w),_S;zp(),l=WT(r,l,c)}else r=b.treeContext,$n&&(Ue=V5(w),jn=l,Kt=!0,Cr=null,fa=!1,r!==null&&ee(l,r)),l=Rp(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 Ap(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 z0(r,l,c,h,y){return bn(l),c=m0(r,l,c,h,void 0,y),h=g0(),r!==null&&!un?(y0(r,l,y),So(r,l,y)):(Kt&&h&&X(l),l.flags|=1,Un(r,l,c,y),l.child)}function $T(r,l,c,h,y,b){return bn(l),l.updateQueue=null,c=sT(l,h,c,y),lT(r),h=g0(),r!==null&&!un?(y0(r,l,b),So(r,l,b)):(Kt&&h&&X(l),l.flags|=1,Un(r,l,c,b),l.child)}function tC(r,l,c,h,y){if(bn(l),l.stateNode===null){var b=lu,w=c.contextType;typeof w=="object"&&w!==null&&(b=P(w)),b=new c(h,b),l.memoizedState=b.state!==null&&b.state!==void 0?b.state:null,b.updater=OS,l.stateNode=b,b._reactInternals=l,b=l.stateNode,b.props=h,b.state=l.memoizedState,b.refs={},s0(l),w=c.contextType,b.context=typeof w=="object"&&w!==null?P(w):lu,b.state=l.memoizedState,w=c.getDerivedStateFromProps,typeof w=="function"&&(O0(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&&OS.enqueueReplaceState(b,b.state,null),pf(l,h,b,y),hf(),b.state=l.memoizedState),typeof b.componentDidMount=="function"&&(l.flags|=4194308),h=!0}else if(r===null){b=l.stateNode;var N=l.memoizedProps,k=Bl(c,N);b.props=k;var et=b.context,ct=c.contextType;w=lu,typeof ct=="object"&&ct!==null&&(w=P(ct));var ot=c.getDerivedStateFromProps;ct=typeof ot=="function"||typeof b.getSnapshotBeforeUpdate=="function",N=l.pendingProps!==N,ct||typeof b.UNSAFE_componentWillReceiveProps!="function"&&typeof b.componentWillReceiveProps!="function"||(N||et!==w)&&FT(l,b,h,w),wr=!1;var gt=l.memoizedState;b.state=gt,pf(l,h,b,y),hf(),et=l.memoizedState,N||gt!==et||wr?(typeof ot=="function"&&(O0(l,c,ot,h),et=l.memoizedState),(k=wr||qT(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,u0(r,l),w=l.memoizedProps,ct=Bl(c,w),b.props=ct,ot=l.pendingProps,gt=b.context,et=c.contextType,k=lu,typeof et=="object"&&et!==null&&(k=P(et)),N=c.getDerivedStateFromProps,(et=typeof N=="function"||typeof b.getSnapshotBeforeUpdate=="function")||typeof b.UNSAFE_componentWillReceiveProps!="function"&&typeof b.componentWillReceiveProps!="function"||(w!==ot||gt!==k)&&FT(l,b,h,k),wr=!1,gt=l.memoizedState,b.state=gt,pf(l,h,b,y),hf();var Pt=l.memoizedState;w!==ot||gt!==Pt||wr||r!==null&&r.dependencies!==null&&tn(r.dependencies)?(typeof N=="function"&&(O0(l,c,N,h),Pt=l.memoizedState),(ct=wr||qT(l,c,ct,h,gt,Pt,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,Pt,k),typeof b.UNSAFE_componentWillUpdate=="function"&&b.UNSAFE_componentWillUpdate(h,Pt,k)),typeof b.componentDidUpdate=="function"&&(l.flags|=4),typeof b.getSnapshotBeforeUpdate=="function"&&(l.flags|=1024)):(typeof b.componentDidUpdate!="function"||w===r.memoizedProps&&gt===r.memoizedState||(l.flags|=4),typeof b.getSnapshotBeforeUpdate!="function"||w===r.memoizedProps&&gt===r.memoizedState||(l.flags|=1024),l.memoizedProps=h,l.memoizedState=Pt),b.props=h,b.state=Pt,b.context=k,h=ct):(typeof b.componentDidUpdate!="function"||w===r.memoizedProps&&gt===r.memoizedState||(l.flags|=4),typeof b.getSnapshotBeforeUpdate!="function"||w===r.memoizedProps&&gt===r.memoizedState||(l.flags|=1024),h=!1)}return b=h,Ap(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=Ql(l,r.child,null,y),l.child=Ql(l,null,c,y)):Un(r,l,c,y),l.memoizedState=b.state,r=l.child):r=So(r,l,y),r}function eC(r,l,c,h){return ge(),l.flags|=256,Un(r,l,c,h),l.child}function N0(r){return{baseLanes:r,cachePool:ve()}}function I0(r,l,c){return r=r!==null?r.childLanes&~c:0,l&&(r|=Fi),r}function nC(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=Y5(r,fa),r!==null&&(l.memoizedState={dehydrated:r,treeContext:Ar!==null?{id:no,overflow:io}:null,retryLane:536870912,hydrationErrors:null},c=KC(r),c.return=l,l.child=c,jn=l,Ue=null)):r=null,r===null)throw ne(l);return pS(r)?l.lanes=32:l.lanes=536870912,null}var N=h.children;return h=h.fallback,y?(Sr(l),y=l.mode,N=Tp({mode:"hidden",children:N},y),h=Vl(h,y,c,null),N.return=l,h.return=l,N.sibling=h,l.child=N,h=l.child,h.memoizedState=N0(c),h.childLanes=I0(r,w,c),l.memoizedState=zS,yf(null,h)):(vr(l),D0(l,N))}var k=r.memoizedState;if(k!==null&&(N=k.dehydrated,N!==null)){if(b)l.flags&256?(vr(l),l.flags&=-257,l=L0(r,l,c)):l.memoizedState!==null?(Sr(l),l.child=r.child,l.flags|=128,l=null):(Sr(l),N=h.fallback,y=l.mode,h=Tp({mode:"visible",children:h.children},y),N=Vl(N,y,c,null),N.flags|=2,h.return=l,N.return=l,h.sibling=N,l.child=h,Ql(l,r.child,null,c),h=l.child,h.memoizedState=N0(c),h.childLanes=I0(r,w,c),l.memoizedState=zS,l=yf(null,h));else if(vr(l),pS(N))w=I5(N).digest,h=Error(i(419)),h.stack="",h.digest=w,Mn({value:h,source:null,stack:null}),l=L0(r,l,c);else if(un||Zn(r,l,c,!1),w=(c&r.childLanes)!==0,un||w){if(w=Re,w!==null&&(h=q(w,c),h!==0&&h!==k.retryLane))throw k.retryLane=h,Pl(r,h),vi(w,r,h),_S;hS(N)||zp(),l=L0(r,l,c)}else hS(N)?(l.flags|=192,l.child=r.child,l=null):(r=k.treeContext,$n&&(Ue=j5(N),jn=l,Kt=!0,Cr=null,fa=!1,r!==null&&ee(l,r)),l=D0(l,h.children),l.flags|=4096);return l}return y?(Sr(l),N=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?N=Eo(b,N):(N=Vl(N,y,c,null),N.flags|=2),N.return=l,h.return=l,h.sibling=N,l.child=h,yf(null,h),h=l.child,N=r.child.memoizedState,N===null?N=N0(c):(y=N.cachePool,y!==null?(k=Ro?Ve._currentValue:Ve._currentValue2,y=y.parent!==k?{parent:k,pool:k}:y):y=ve(),N={baseLanes:N.baseLanes|c,cachePool:y}),h.memoizedState=N,h.childLanes=I0(r,w,c),l.memoizedState=zS,yf(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 D0(r,l){return l=Tp({mode:"visible",children:l},r.mode),l.return=r,r.child=l}function Tp(r,l){return r=e(22,r,null,l),r.lanes=0,r}function L0(r,l,c){return Ql(l,r.child,null,c),r=D0(l,l.pendingProps.children),r.flags|=2,l.memoizedState=null,r}function iC(r,l,c){r.lanes|=l;var h=r.alternate;h!==null&&(h.lanes|=l),te(r.return,l,c)}function P0(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 aC(r,l,c){var h=l.pendingProps,y=h.revealOrder,b=h.tail;h=h.children;var w=nn.current,N=(w&2)!==0;if(N?(w=w&1|2,l.flags|=128):w&=1,v(nn,w),Un(r,l,h,c),h=Kt?Mf:0,!N&&r!==null&&r.flags&128)t:for(r=l.child;r!==null;){if(r.tag===13)r.memoizedState!==null&&iC(r,c,l);else if(r.tag===19)iC(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&&mp(r)===null&&(y=c),c=c.sibling;c=y,c===null?(y=l.child,l.child=null):(y=c.sibling,c.sibling=null),P0(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&&mp(r)===null){l.child=y;break}r=y.sibling,y.sibling=c,c=y,y=r}P0(l,!0,c,null,b,h);break;case"together":P0(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 B0(r,l){return r.lanes&l?!0:(r=r.dependencies,!!(r!==null&&tn(r)))}function T4(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,h0(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?nC(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 aC(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,ZT(r,l,c,l.pendingProps);case 24:St(l,Ve,r.memoizedState.cache)}return So(r,l,c)}function oC(r,l,c){if(r!==null)if(r.memoizedProps!==l.pendingProps)un=!0;else{if(!B0(r,c)&&!(l.flags&128))return un=!1,T4(r,l,c);un=!!(r.flags&131072)}else un=!1,Kt&&l.flags&1048576&&Rt(l,Mf,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")tS(r)?(h=Bl(r,h),l.tag=1,l=tC(null,l,r,h,c)):(l.tag=0,l=z0(null,l,r,h,c));else{if(r!=null){var y=r.$$typeof;if(y===rS){l.tag=11,l=QT(null,l,r,h,c);break t}else if(y===uS){l.tag=14,l=XT(null,l,r,h,c);break t}}throw l=f(r)||r,Error(i(306,l,""))}}return l;case 0:return z0(r,l,l.type,l.pendingProps,c);case 1:return h=l.type,y=Bl(h,l.pendingProps),tC(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,u0(r,l),pf(l,b,null,c);var w=l.memoizedState;if(b=w.cache,St(l,Ve,b),b!==y.cache&&Hn(l,[Ve],c,!0),hf(),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=eC(r,l,b,c);break t}else if(b!==h){h=lt(Error(i(424)),l),Mn(h),l=eC(r,l,b,c);break t}else for($n&&(Ue=U5(l.stateNode.containerInfo),jn=l,Kt=!0,Cr=null,fa=!0),c=Nw(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 Ap(r,l),r===null?(c=vw(l.type,null,l.pendingProps,null))?l.memoizedState=c:Kt||(l.stateNode=dP(l.type,l.pendingProps,Tr.current,l)):l.memoizedState=vw(l.type,r.memoizedProps,l.pendingProps,r.memoizedState),null;case 27:if(En)return pe(l),r===null&&En&&Kt&&(h=l.stateNode=Aw(l.type,l.pendingProps,Tr.current,Vn.current,!1),jn=l,fa=!0,Ue=q5(l.type,h,Ue)),Un(r,l,l.pendingProps.children,c),Ap(r,l),r===null&&(l.flags|=4194304),l.child;case 5:return r===null&&Kt&&(uP(l.type,l.pendingProps,Vn.current),(y=h=Ue)&&(h=F5(h,l.type,l.pendingProps,fa),h!==null?(l.stateNode=h,jn=l,Ue=H5(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,Pp(y,b)?h=null:w!==null&&Pp(y,w)&&(l.flags|=32),l.memoizedState!==null&&(y=m0(r,l,y4,null,null,c),Ro?ql._currentValue=y:ql._currentValue2=y),Ap(r,l),Un(r,l,h,c),l.child;case 6:return r===null&&Kt&&(cP(l.pendingProps,Vn.current),(r=c=Ue)&&(c=G5(c,l.pendingProps,fa),c!==null?(l.stateNode=c,jn=l,Ue=null,r=!0):r=!1),r||ne(l)),null;case 13:return nC(r,l,c);case 4:return ce(l,l.stateNode.containerInfo),h=l.pendingProps,r===null?l.child=Ql(l,null,h,c):Un(r,l,h,c),l.child;case 11:return QT(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=P(y),h=h(y),l.flags|=1,Un(r,l,h,c),l.child;case 14:return XT(r,l,l.type,l.pendingProps,c);case 15:return KT(r,l,l.type,l.pendingProps,c);case 19:return aC(r,l,c);case 31:return A4(r,l,c);case 22:return ZT(r,l,c,l.pendingProps);case 24:return bn(l),h=P(Ve),r===null?(y=Ee(),y===null&&(y=Re,b=ht(),y.pooledCache=b,b.refCount++,b!==null&&(y.pooledCacheLanes|=c),y=b),l.memoizedState={parent:h,cache:y},s0(l),St(l,Ve,y)):(r.lanes&c&&(u0(r,l),pf(l,null,null,c),hf()),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 Cp(r){eo&&(r.flags|=8)}function rC(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 H0(r,l,c,h){if(Wn)for(c=l.child;c!==null;){if(c.tag===5||c.tag===6)fS(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=hw(b,y.type,y.memoizedProps)),fS(r,b)}else if(y.tag===6)b=y.stateNode,c&&h&&(b=pw(b,y.memoizedProps)),fS(r,b);else if(y.tag!==4){if(y.tag===22&&y.memoizedState!==null)b=y.child,b!==null&&(b.return=y),H0(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 lC(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=hw(w,b.type,b.memoizedProps)),fw(r,w)}else if(b.tag===6)w=b.stateNode,c&&h&&(w=pw(w,b.memoizedProps)),fw(r,w);else if(b.tag!==4){if(b.tag===22&&b.memoizedState!==null)y=b.child,y!==null&&(y.return=b),lC(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 sC(r,l){if(eo&&rC(r,l)){r=l.stateNode;var c=r.containerInfo,h=cw();lC(h,l,!1,!1),r.pendingChildren=h,za(l),N5(c,h)}}function U0(r,l,c,h){if(Wn)r.memoizedProps!==h&&za(l);else if(eo){var y=r.stateNode,b=r.memoizedProps;if((r=rC(r,l))||b!==h){var w=Vn.current;b=z5(y,c,b,h,!r,null),b===y?l.stateNode=y:(Cp(l),ow(b,c,h,w)&&za(l),l.stateNode=b,r&&H0(b,l,!1,!1))}else l.stateNode=y}}function V0(r,l,c,h,y){if(r.mode&32&&(c===null?a5(l,h):o5(l,c,h))){if(r.flags|=16777216,(y&335544128)===y||dS(l,h))if(lw(r.stateNode,l,h))r.flags|=8192;else if(DC())r.flags|=8192;else throw Yl=Qp,TS}else r.flags&=-16777217}function uC(r,l){if(pP(l)){if(r.flags|=16777216,!Rw(l))if(DC())r.flags|=8192;else throw Yl=Qp,TS}else r.flags&=-16777217}function wp(r,l){l!==null&&(r.flags|=4),r.flags&16384&&(l=r.tag!==22?A():536870912,r.lanes|=l,xu|=l)}function vf(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 C4(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())),sC(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),uC(l,b)):(Oe(l),V0(l,y,null,h,c))):b?b!==r.memoizedState?(za(l),Oe(l),uC(l,b)):(Oe(l),l.flags&=-16777217):(b=r.memoizedProps,Wn?b!==h&&za(l):U0(r,l,y,h),Oe(l),V0(l,y,b,h,c)),null}case 27:if(En){if(De(l),c=Tr.current,y=l.type,r!==null&&l.stateNode!=null)Wn?r.memoizedProps!==h&&za(l):U0(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=Aw(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)U0(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),iP(l.stateNode,y,h,b)&&(l.flags|=64);else{var w=Z4(y,h,Tr.current,b,l);Cp(l),H0(w,l,!1,!1),l.stateNode=w,ow(w,y,h,b)&&za(l)}}return Oe(l),V0(l,l.type,r===null?null:r.memoizedProps,l.pendingProps,c),null;case 6:if(r&&l.stateNode!=null)c=r.memoizedProps,Wn?c!==h&&za(l):eo&&(c!==h?(r=Tr.current,c=Vn.current,Cp(l),l.stateNode=rw(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}X5(r,c,l,h)||ne(l,!0)}else Cp(l),l.stateNode=rw(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));K5(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));Z5(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),wp(l,l.updateQueue),Oe(l),null);case 4:return le(),sC(r,l),r===null&&t5(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)vf(h,!1);else{if(Xe!==0||r!==null&&r.flags&128)for(r=l.child;r!==null;){if(b=mp(r),b!==null){for(l.flags|=128,vf(h,!1),r=b.updateQueue,l.updateQueue=r,wp(l,r),l.subtreeFlags=0,r=c,c=l.child;c!==null;)XC(c,r),c=c.sibling;return v(nn,nn.current&1|2),Kt&&ft(l,h.treeForkCount),l.child}r=r.sibling}h.tail!==null&&Si()>Pf&&(l.flags|=128,y=!0,vf(h,!1),l.lanes=4194304)}else{if(!y)if(r=mp(b),r!==null){if(l.flags|=128,y=!0,r=r.updateQueue,l.updateQueue=r,wp(l,r),vf(h,!0),h.tail===null&&h.tailMode==="hidden"&&!b.alternate&&!Kt)return Oe(l),null}else 2*Si()-h.renderingStartTime>Pf&&c!==536870912&&(l.flags|=128,y=!0,vf(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&&ft(l,h.treeForkCount),r):(Oe(l),null);case 22:case 23:return Li(l),d0(),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&&wp(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(kl),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 w4(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),d0(),r!==null&&g(kl),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 cC(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),d0(),r!==null&&g(kl);break;case 24:It(Ve)}}function Sf(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(N){ie(l,l.return,N)}}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,N=w.destroy;if(N!==void 0){w.destroy=void 0,y=l;var k=c,et=N;try{et()}catch(ct){ie(y,k,ct)}}}h=h.next}while(h!==b)}}catch(ct){ie(l,l.return,ct)}}function fC(r){var l=r.updateQueue;if(l!==null){var c=r.stateNode;try{aT(l,c)}catch(h){ie(r,r.return,h)}}}function dC(r,l,c){c.props=Bl(r.type,r.memoizedProps),c.state=r.memoizedState;try{c.componentWillUnmount()}catch(h){ie(r,l,h)}}function bf(r,l){try{var c=r.ref;if(c!==null){switch(r.tag){case 26:case 27:case 5:var h=Af(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 hC(r){var l=r.type,c=r.memoizedProps,h=r.stateNode;try{b5(h,l,c,r)}catch(y){ie(r,r.return,y)}}function j0(r,l,c){try{x5(r.stateNode,r.type,c,l,r)}catch(h){ie(r,r.return,h)}}function pC(r){return r.tag===5||r.tag===3||(Da?r.tag===26:!1)||(En?r.tag===27&&ou(r.type):!1)||r.tag===4}function q0(r){t:for(;;){for(;r.sibling===null;){if(r.return===null||pC(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&&ou(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 F0(r,l,c){var h=r.tag;if(h===5||h===6)r=r.stateNode,l?R5(c,r,l):v5(c,r);else if(h!==4&&(En&&h===27&&ou(r.type)&&(c=r.stateNode,l=null),r=r.child,r!==null))for(F0(r,l,c),r=r.sibling;r!==null;)F0(r,l,c),r=r.sibling}function Mp(r,l,c){var h=r.tag;if(h===5||h===6)r=r.stateNode,l?E5(c,r,l):y5(c,r);else if(h!==4&&(En&&h===27&&ou(r.type)&&(c=r.stateNode),r=r.child,r!==null))for(Mp(r,l,c),r=r.sibling;r!==null;)Mp(r,l,c),r=r.sibling}function mC(r,l,c){r=r.containerInfo;try{dw(r,c)}catch(h){ie(l,l.return,h)}}function gC(r){var l=r.stateNode,c=r.memoizedProps;try{gP(r.type,c,l,r)}catch(h){ie(r,r.return,h)}}function M4(r,l){for(X4(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=Bl(h.type,y);l=b.getSnapshotBeforeUpdate(w,c),b.__reactInternalSnapshotBeforeUpdate=l}catch(N){ie(h,h.return,N)}}break;case 3:l&1024&&Wn&&_5(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 yC(r,l,c){var h=c.flags;switch(c.tag){case 0:case 11:case 15:bo(r,c),h&4&&Sf(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=Bl(c.type,l.memoizedProps);l=l.memoizedState;try{r.componentDidUpdate(y,l,r.__reactInternalSnapshotBeforeUpdate)}catch(w){ie(c,c.return,w)}}h&64&&fC(c),h&512&&bf(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=Af(c.child.stateNode);break;case 1:r=c.child.stateNode}try{aT(h,r)}catch(w){ie(c,c.return,w)}}break;case 27:En&&l===null&&h&4&&gC(c);case 26:case 5:if(bo(r,c),l===null){if(h&4)hC(c);else if(h&64){r=c.type,l=c.memoizedProps,y=c.stateNode;try{$5(y,r,l,c)}catch(w){ie(c,c.return,w)}}}h&512&&bf(c,c.return);break;case 12:bo(r,c);break;case 31:bo(r,c),h&4&&SC(r,c);break;case 13:bo(r,c),h&4&&bC(r,c),h&64&&(h=c.memoizedState,h!==null&&(h=h.dehydrated,h!==null&&(c=L4.bind(null,c),D5(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 vC(r){var l=r.alternate;l!==null&&(r.alternate=null,vC(l)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(l=r.stateNode,l!==null&&i5(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;)G0(r,l,c),c=c.sibling}function G0(r,l,c){if(Ui&&typeof Ui.onCommitFiberUnmount=="function")try{Ui.onCommitFiberUnmount(wf,c)}catch{}switch(c.tag){case 26:if(Da){cn||to(c,l),Na(r,l,c),c.memoizedState?bw(c.memoizedState):c.stateNode&&Ew(c.stateNode);break}case 27:if(En){cn||to(c,l);var h=fn,y=bi;ou(c.type)&&(fn=c.stateNode,bi=!1),Na(r,l,c),Tw(c.stateNode),fn=h,bi=y;break}case 5:cn||to(c,l);case 6:if(Wn){if(h=fn,y=bi,fn=null,Na(r,l,c),fn=h,bi=y,fn!==null)if(bi)try{T5(fn,c.stateNode)}catch(b){ie(c,l,b)}else try{A5(fn,c.stateNode)}catch(b){ie(c,l,b)}}else Na(r,l,c);break;case 18:Wn&&fn!==null&&(bi?rP(fn,c.stateNode):oP(fn,c.stateNode));break;case 4:Wn?(h=fn,y=bi,fn=c.stateNode.containerInfo,bi=!0,Na(r,l,c),fn=h,bi=y):(eo&&mC(c.stateNode,c,cw()),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"&&dC(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 SC(r,l){if($n&&l.memoizedState===null&&(r=l.alternate,r!==null&&(r=r.memoizedState,r!==null))){r=r.dehydrated;try{eP(r)}catch(c){ie(l,l.return,c)}}}function bC(r,l){if($n&&l.memoizedState===null&&(r=l.alternate,r!==null&&(r=r.memoizedState,r!==null&&(r=r.dehydrated,r!==null))))try{nP(r)}catch(c){ie(l,l.return,c)}}function O4(r){switch(r.tag){case 31:case 13:case 19:var l=r.stateNode;return l===null&&(l=r.stateNode=new Lw),l;case 22:return r=r.stateNode,l=r._retryCache,l===null&&(l=r._retryCache=new Lw),l;default:throw Error(i(435,r.tag))}}function Op(r,l){var c=O4(r);l.forEach(function(h){if(!c.has(h)){c.add(h);var y=P4.bind(null,r,h);h.then(y,y)}})}function Jn(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(Wn){var N=w;t:for(;N!==null;){switch(N.tag){case 27:if(En){if(ou(N.type)){fn=N.stateNode,bi=!1;break t}break}case 5:fn=N.stateNode,bi=!1;break t;case 3:case 4:fn=N.stateNode.containerInfo,bi=!0;break t}N=N.return}if(fn===null)throw Error(i(160));G0(b,w,y),fn=null,bi=!1}else G0(b,w,y);b=y.alternate,b!==null&&(b.return=null),y.return=null}if(l.subtreeFlags&13886)for(l=l.child;l!==null;)xC(l,r),l=l.sibling}function xC(r,l){var c=r.alternate,h=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:Jn(l,r),si(r),h&4&&(br(3,r,r.return),Sf(3,r),br(5,r,r.return));break;case 1:Jn(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(Jn(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=fP(y,r.type,r.memoizedProps,r):xw(y,r.type,r.stateNode):r.stateNode=Sw(y,b,r.memoizedProps):h!==b?(h===null?c.stateNode!==null&&Ew(c.stateNode):bw(h),b===null?xw(y,r.type,r.stateNode):Sw(y,b,r.memoizedProps)):b===null&&r.stateNode!==null&&j0(r,r.memoizedProps,c.memoizedProps)}break}case 27:if(En){Jn(l,r),si(r),h&512&&(cn||c===null||to(c,c.return)),c!==null&&h&4&&j0(r,r.memoizedProps,c.memoizedProps);break}case 5:if(Jn(l,r),si(r),h&512&&(cn||c===null||to(c,c.return)),Wn){if(r.flags&32){y=r.stateNode;try{uw(y)}catch(ot){ie(r,r.return,ot)}}h&4&&r.stateNode!=null&&(y=r.memoizedProps,j0(r,y,c!==null?c.memoizedProps:y)),h&1024&&(NS=!0)}else eo&&r.alternate!==null&&(r.alternate.stateNode=r.stateNode);break;case 6:if(Jn(l,r),si(r),h&4&&Wn){if(r.stateNode===null)throw Error(i(162));h=r.memoizedProps,c=c!==null?c.memoizedProps:h,y=r.stateNode;try{S5(y,c,h)}catch(ot){ie(r,r.return,ot)}}break;case 3:if(Da?(hP(),y=La,La=mS(l.containerInfo),Jn(l,r),La=y):Jn(l,r),si(r),h&4){if(Wn&&$n&&c!==null&&c.memoizedState.isDehydrated)try{tP(l.containerInfo)}catch(ot){ie(r,r.return,ot)}if(eo){h=l.containerInfo,c=l.pendingChildren;try{dw(h,c)}catch(ot){ie(r,r.return,ot)}}}NS&&(NS=!1,EC(r));break;case 4:Da?(c=La,La=mS(r.stateNode.containerInfo),Jn(l,r),si(r),La=c):(Jn(l,r),si(r)),h&4&&eo&&mC(r.stateNode,r,r.stateNode.pendingChildren);break;case 12:Jn(l,r),si(r);break;case 31:Jn(l,r),si(r),h&4&&(h=r.updateQueue,h!==null&&(r.updateQueue=null,Op(r,h)));break;case 13:Jn(l,r),si(r),r.child.flags&8192&&r.memoizedState!==null!=(c!==null&&c.memoizedState!==null)&&(nm=Si()),h&4&&(h=r.updateQueue,h!==null&&(r.updateQueue=null,Op(r,h)));break;case 22:y=r.memoizedState!==null;var w=c!==null&&c.memoizedState!==null,N=wo,k=cn;if(wo=N||y,cn=k||w,Jn(l,r),cn=k,wo=N,si(r),h&8192&&(l=r.stateNode,l._visibility=y?l._visibility&-2:l._visibility|1,y&&(c===null||w||wo||cn||Hl(r)),Wn)){t:if(c=null,Wn)for(l=r;;){if(l.tag===5||Da&&l.tag===26){if(c===null){w=c=l;try{b=w.stateNode,y?C5(b):M5(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?w5(et):O5(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?lP(ct):sP(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,Op(r,c))));break;case 19:Jn(l,r),si(r),h&4&&(h=r.updateQueue,h!==null&&(r.updateQueue=null,Op(r,h)));break;case 30:break;case 21:break;default:Jn(l,r),si(r)}}function si(r){var l=r.flags;if(l&2){try{for(var c,h=r.return;h!==null;){if(pC(h)){c=h;break}h=h.return}if(Wn){if(c==null)throw Error(i(160));switch(c.tag){case 27:if(En){var y=c.stateNode,b=q0(r);Mp(r,b,y);break}case 5:var w=c.stateNode;c.flags&32&&(uw(w),c.flags&=-33);var N=q0(r);Mp(r,N,w);break;case 3:case 4:var k=c.stateNode.containerInfo,et=q0(r);F0(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 EC(r){if(r.subtreeFlags&1024)for(r=r.child;r!==null;){var l=r;EC(l),l.tag===5&&l.flags&1024&&s5(l.stateNode),r=r.sibling}}function bo(r,l){if(l.subtreeFlags&8772)for(l=l.child;l!==null;)yC(r,l.alternate,l),l=l.sibling}function Hl(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),Hl(l);break;case 1:to(l,l.return);var c=l.stateNode;typeof c.componentWillUnmount=="function"&&dC(l,l.return,c),Hl(l);break;case 27:En&&Tw(l.stateNode);case 26:case 5:to(l,l.return),Hl(l);break;case 22:l.memoizedState===null&&Hl(l);break;case 30:Hl(l);break;default:Hl(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),Sf(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 N=h.stateNode;try{var k=y.shared.hiddenCallbacks;if(k!==null)for(y.shared.hiddenCallbacks=null,y=0;y<k.length;y++)iT(k[y],N)}catch(et){ie(h,h.return,et)}}c&&w&64&&fC(b),bf(b,b.return);break;case 27:En&&gC(b);case 26:case 5:xo(y,b,c),c&&h===null&&w&4&&hC(b),bf(b,b.return);break;case 12:xo(y,b,c);break;case 31:xo(y,b,c),c&&w&4&&SC(y,b);break;case 13:xo(y,b,c),c&&w&4&&bC(y,b);break;case 22:b.memoizedState===null&&xo(y,b,c),bf(b,b.return);break;case 30:break;default:xo(y,b,c)}l=l.sibling}}function k0(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 Y0(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;)RC(r,l,c,h),l=l.sibling}function RC(r,l,c,h){var y=l.flags;switch(l.tag){case 0:case 11:case 15:Ia(r,l,c,h),y&2048&&Sf(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,N=b.onPostCommit;typeof N=="function"&&N(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):xf(r,l):b._visibility&2?Ia(r,l,c,h):(b._visibility|=2,$s(r,l,c,h,(l.subtreeFlags&10256)!==0||!1)),y&2048&&k0(w,l);break;case 24:Ia(r,l,c,h),y&2048&&Y0(l.alternate,l);break;default:Ia(r,l,c,h)}}function $s(r,l,c,h,y){for(y=y&&((l.subtreeFlags&10256)!==0||!1),l=l.child;l!==null;){var b=r,w=l,N=c,k=h,et=w.flags;switch(w.tag){case 0:case 11:case 15:$s(b,w,N,k,y),Sf(8,w);break;case 23:break;case 22:var ct=w.stateNode;w.memoizedState!==null?ct._visibility&2?$s(b,w,N,k,y):xf(b,w):(ct._visibility|=2,$s(b,w,N,k,y)),y&&et&2048&&k0(w.alternate,w);break;case 24:$s(b,w,N,k,y),y&&et&2048&&Y0(w.alternate,w);break;default:$s(b,w,N,k,y)}l=l.sibling}}function xf(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:xf(c,h),y&2048&&k0(h.alternate,h);break;case 24:xf(c,h),y&2048&&Y0(h.alternate,h);break;default:xf(c,h)}l=l.sibling}}function Ul(r,l,c){if(r.subtreeFlags&Su)for(r=r.child;r!==null;)AC(r,l,c),r=r.sibling}function AC(r,l,c){switch(r.tag){case 26:if(Ul(r,l,c),r.flags&Su)if(r.memoizedState!==null)mP(c,La,r.memoizedState,r.memoizedProps);else{var h=r.stateNode,y=r.type;r=r.memoizedProps,((l&335544128)===l||dS(y,r))&&sw(c,h,y,r)}break;case 5:Ul(r,l,c),r.flags&Su&&(h=r.stateNode,y=r.type,r=r.memoizedProps,((l&335544128)===l||dS(y,r))&&sw(c,h,y,r));break;case 3:case 4:Da?(h=La,La=mS(r.stateNode.containerInfo),Ul(r,l,c),La=h):Ul(r,l,c);break;case 22:r.memoizedState===null&&(h=r.alternate,h!==null&&h.memoizedState!==null?(h=Su,Su=16777216,Ul(r,l,c),Su=h):Ul(r,l,c));break;default:Ul(r,l,c)}}function TC(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 Ef(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,wC(h,r)}TC(r)}if(r.subtreeFlags&10256)for(r=r.child;r!==null;)CC(r),r=r.sibling}function CC(r){switch(r.tag){case 0:case 11:case 15:Ef(r),r.flags&2048&&br(9,r,r.return);break;case 3:Ef(r);break;case 12:Ef(r);break;case 22:var l=r.stateNode;r.memoizedState!==null&&l._visibility&2&&(r.return===null||r.return.tag!==13)?(l._visibility&=-3,_p(r)):Ef(r);break;default:Ef(r)}}function _p(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,wC(h,r)}TC(r)}for(r=r.child;r!==null;){switch(l=r,l.tag){case 0:case 11:case 15:br(8,l,l.return),_p(l);break;case 22:c=l.stateNode,c._visibility&2&&(c._visibility&=-3,_p(l));break;default:_p(l)}r=r.sibling}}function wC(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(vC(h),h===c){_n=null;break t}if(y!==null){y.return=b,_n=y;break t}_n=b}}}function Q0(r){var l=$4(r);if(l!=null){if(typeof l.memoizedProps["data-testname"]!="string")throw Error(i(364));return l}if(r=f5(r),r===null)throw Error(i(362));return r.stateNode.current}function X0(r,l){var c=r.tag;switch(l.$$typeof){case Jp:if(r.type===l.value)return!0;break;case Wp: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||!Cf(h)){for(;w!=null&&X0(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 $p:if((c===5||c===26||c===27)&&p5(r.stateNode,l.value))return!0;break;case em:if((c===5||c===6||c===26||c===27)&&(r=h5(r),r!==null&&0<=r.indexOf(l.value)))return!0;break;case tm: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 K0(r){switch(r.$$typeof){case Jp:return"<"+(f(r.value)||"Unknown")+">";case Wp:return":has("+(K0(r)||"")+")";case $p:return'[role="'+r.value+'"]';case em:return'"'+r.value+'"';case tm:return'[data-testname="'+r.value+'"]';default:throw Error(i(365))}}function MC(r,l){var c=[];r=[r,0];for(var h=0;h<r.length;){var y=r[h++],b=y.tag,w=r[h++],N=l[w];if(b!==5&&b!==26&&b!==27||!Cf(y)){for(;N!=null&&X0(y,N);)w++,N=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 Z0(r,l){if(!Tf)throw Error(i(363));r=Q0(r),r=MC(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)Cf(h)||l.push(h.stateNode);else for(h=h.child;h!==null;)r.push(h),h=h.sibling}return l}function Pi(){return Ft&2&&Qt!==0?Qt&-Qt:wt.T!==null?mt():e5()}function OC(){if(Fi===0)if(!(Qt&536870912)||Kt){var r=Hp;Hp<<=1,!(Hp&3932160)&&(Hp=262144),Fi=r}else Fi=536870912;return r=ji.current,r!==null&&(r.flags|=32),Fi}function vi(r,l,c){(r===Re&&(fe===2||fe===9)||r.cancelPendingCommit!==null)&&(tu(r,0),xr(r,Qt,Fi,!1)),M(r,c),(!(Ft&2)||r!==Re)&&(r===Re&&(!(Ft&2)&&(Kl|=c),Xe===4&&xr(r,Qt,Fi,!1)),L(r))}function _C(r,l,c){if(Ft&6)throw Error(i(327));var h=!c&&(l&127)===0&&(l&r.expiredLanes)===0||R(r,l),y=h?N4(r,l):W0(r,l,!0),b=h;do{if(y===0){bu&&!h&&xr(r,l,0,!1);break}else{if(c=r.current.alternate,b&&!_4(c)){y=W0(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 N=r;y=Lf;var k=$n&&N.current.memoizedState.isDehydrated;if(k&&(tu(N,w).flags|=256),w=W0(N,w,!1),w!==2){if(IS&&!k){N.errorRecoveryDisabledLanes|=b,Kl|=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){tu(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=nm+300-Si(),10<y)){if(xr(h,l,Fi,!Mr),C(h,0,!0)!==0)break t;Oo=l,h.timeoutHandle=J4(zC.bind(null,h,c,xi,im,LS,l,Fi,Kl,xu,Mr,b,"Throttled",-0,0),y);break t}zC(h,c,xi,im,LS,l,Fi,Kl,xu,Mr,b,null,-0,0)}}break}while(!0);L(r)}function zC(r,l,c,h,y,b,w,N,k,et,ct,ot,gt,Pt){if(r.timeoutHandle=jl,ot=l.subtreeFlags,ot&8192||(ot&16785408)===16785408){ot=r5(),AC(l,b,ot);var qn=(b&62914560)===b?nm-Si():(b&4194048)===b?Pw-Si():0;if(qn=l5(ot,qn),qn!==null){Oo=b,r.cancelPendingCommit=qn(VC.bind(null,r,l,b,c,h,y,w,N,k,ct,ot,null,gt,Pt)),xr(r,b,w,!et);return}}VC(r,l,b,c,h,y,w,N,k)}function _4(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&=~DS,l&=~Kl,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&&D(r,c,l)}function NC(){return Ft&6?!0:($(0,!1),!1)}function J0(){if(Gt!==null){if(fe===0)var r=Gt.return;else r=Gt,To=Fl=null,v0(r),pu=null,zf=0,r=Gt;for(;r!==null;)cC(r.alternate,r),r=r.return;Gt=null}}function tu(r,l){var c=r.timeoutHandle;c!==jl&&(r.timeoutHandle=jl,W4(c)),c=r.cancelPendingCommit,c!==null&&(r.cancelPendingCommit=null,c()),Oo=0,J0(),Re=r,Gt=c=Eo(r.current,null),Qt=l,fe=0,qi=null,Mr=!1,bu=R(r,l),IS=!1,xu=Fi=DS=Kl=Or=Xe=0,xi=Lf=null,LS=!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,dp(),c}function IC(r,l){Bt=null,wt.H=If,l===hu||l===Yp?(l=$a(),fe=3):l===TS?(l=$a(),fe=4):fe=l===_S?8:l!==null&&typeof l=="object"&&typeof l.then=="function"?6:1,qi=l,Gt===null&&(Xe=1,Ep(r,lt(l,r.current)))}function DC(){var r=ji.current;return r===null?!0:(Qt&4194048)===Qt?ha===null:(Qt&62914560)===Qt||Qt&536870912?r===ha:!1}function LC(){var r=wt.H;return wt.H=If,r===null?If:r}function PC(){var r=wt.A;return wt.A=_P,r}function zp(){Xe=4,Mr||(Qt&4194048)!==Qt&&ji.current!==null||(bu=!0),!(Or&134217727)&&!(Kl&134217727)||Re===null||xr(Re,Qt,Fi,!1)}function W0(r,l,c){var h=Ft;Ft|=2;var y=LC(),b=PC();(Re!==r||Qt!==l)&&(im=null,tu(r,l)),l=!1;var w=Xe;t:do try{if(fe!==0&&Gt!==null){var N=Gt,k=qi;switch(fe){case 8:J0(),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,eu(r,N,k,et),c&&bu){w=0;break t}break;default:et=fe,fe=0,qi=null,eu(r,N,k,et)}}z4(),w=Xe;break}catch(ct){IC(r,ct)}while(!0);return l&&r.shellSuspendCounter++,To=Fl=null,Ft=h,wt.H=y,wt.A=b,Gt===null&&(Re=null,Qt=0,dp()),w}function z4(){for(;Gt!==null;)BC(Gt)}function N4(r,l){var c=Ft;Ft|=2;var h=LC(),y=PC();Re!==r||Qt!==l?(im=null,Pf=Si()+500,tu(r,l)):bu=R(r,l);t:do try{if(fe!==0&&Gt!==null){l=Gt;var b=qi;e:switch(fe){case 1:fe=0,qi=null,eu(r,l,b,1);break;case 2:case 9:if(He(b)){fe=0,qi=null,HC(l);break}l=function(){fe!==2&&fe!==9||Re!==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,HC(l)):(fe=0,qi=null,eu(r,l,b,7));break;case 5:var w=null;switch(Gt.tag){case 26:w=Gt.memoizedState;case 5:case 27:var N=Gt,k=N.type,et=N.pendingProps;if(w?Rw(w):lw(N.stateNode,k,et)){fe=0,qi=null;var ct=N.sibling;if(ct!==null)Gt=ct;else{var ot=N.return;ot!==null?(Gt=ot,Np(ot)):Gt=null}break e}}fe=0,qi=null,eu(r,l,b,5);break;case 6:fe=0,qi=null,eu(r,l,b,6);break;case 8:J0(),Xe=6;break t;default:throw Error(i(462))}}I4();break}catch(gt){IC(r,gt)}while(!0);return To=Fl=null,wt.H=h,wt.A=y,Ft=c,Gt!==null?0:(Re=null,Qt=0,dp(),Xe)}function I4(){for(;Gt!==null&&!SP();)BC(Gt)}function BC(r){var l=oC(r.alternate,r,Mo);r.memoizedProps=r.pendingProps,l===null?Np(r):Gt=l}function HC(r){var l=r,c=l.alternate;switch(l.tag){case 15:case 0:l=$T(c,l,l.pendingProps,l.type,void 0,Qt);break;case 11:l=$T(c,l,l.pendingProps,l.type.render,l.ref,Qt);break;case 5:v0(l);default:cC(c,l),l=Gt=XC(l,Mo),l=oC(c,l,Mo)}r.memoizedProps=r.pendingProps,l===null?Np(r):Gt=l}function eu(r,l,c,h){To=Fl=null,v0(l),pu=null,zf=0;var y=l.return;try{if(R4(r,y,l,c,Qt)){Xe=1,Ep(r,lt(c,r.current)),Gt=null;return}}catch(b){if(y!==null)throw Gt=y,b;Xe=1,Ep(r,lt(c,r.current)),Gt=null;return}l.flags&32768?(Kt||h===1?r=!0:bu||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))),UC(l,r)):Np(l)}function Np(r){var l=r;do{if(l.flags&32768){UC(l,Mr);return}r=l.return;var c=C4(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 UC(r,l){do{var c=w4(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 VC(r,l,c,h,y,b,w,N,k){r.cancelPendingCommit=null;do Rf();while(Rn!==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|=CS,z(r,c,b,w,N,k),r===Re&&(Gt=Re=null,Qt=0),Eu=l,zr=r,Oo=c,PS=b,BS=y,Bw=h,l.subtreeFlags&10256||l.flags&10256?(r.callbackNode=null,r.callbackPriority=0,B4(vS,function(){return kC(),null})):(r.callbackNode=null,r.callbackPriority=0),h=(l.flags&13878)!==0,l.subtreeFlags&13878||h){h=wt.T,wt.T=null,y=Ao(),On(2),w=Ft,Ft|=4;try{M4(r,l,c)}finally{Ft=w,On(y),wt.T=h}}Rn=1,jC(),qC(),FC()}}function jC(){if(Rn===1){Rn=0;var r=zr,l=Eu,c=(l.flags&13878)!==0;if(l.subtreeFlags&13878||c){c=wt.T,wt.T=null;var h=Ao();On(2);var y=Ft;Ft|=4;try{xC(l,r),K4(r.containerInfo)}finally{Ft=y,On(h),wt.T=c}}r.current=l,Rn=2}}function qC(){if(Rn===2){Rn=0;var r=zr,l=Eu,c=(l.flags&8772)!==0;if(l.subtreeFlags&8772||c){c=wt.T,wt.T=null;var h=Ao();On(2);var y=Ft;Ft|=4;try{yC(r,l.alternate,l)}finally{Ft=y,On(h),wt.T=c}}Rn=3}}function FC(){if(Rn===4||Rn===3){Rn=0,bP();var r=zr,l=Eu,c=Oo,h=Bw;l.subtreeFlags&10256||l.flags&10256?Rn=5:(Rn=0,Eu=zr=null,GC(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(wf,l,void 0,(l.current.flags&128)===128)}catch{}if(h!==null){l=wt.T,y=Ao(),On(2),wt.T=null;try{for(var b=r.onRecoverableError,w=0;w<h.length;w++){var N=h[w];b(N.value,{componentStack:N.stack})}}finally{wt.T=l,On(y)}}Oo&3&&Rf(),L(r),y=r.pendingLanes,c&261930&&y&42?r===HS?Bf++:(Bf=0,HS=r):Bf=0,$n&&aP(),$(0,!1)}}function GC(r,l){(r.pooledCacheLanes&=l)===0&&(l=r.pooledCache,l!=null&&(r.pooledCache=null,vt(l)))}function Rf(){return jC(),qC(),FC(),kC()}function kC(){if(Rn!==5)return!1;var r=zr,l=PS;PS=0;var c=U(Oo),h=32>c?32:c;c=wt.T;var y=Ao();try{On(h),wt.T=null,h=BS,BS=null;var b=zr,w=Oo;if(Rn=0,Eu=zr=null,Oo=0,Ft&6)throw Error(i(331));var N=Ft;if(Ft|=4,CC(b.current),RC(b,b.current,w,h),Ft=N,$(0,!1),Ui&&typeof Ui.onPostCommitFiberRoot=="function")try{Ui.onPostCommitFiberRoot(wf,b)}catch{}return!0}finally{On(y),wt.T=c,GC(r,l)}}function YC(r,l,c){l=lt(c,l),l=_0(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)YC(r,r,c);else for(;l!==null;){if(l.tag===3){YC(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=kT(2),h=yr(l,c,2),h!==null&&(YT(c,h,l,r),M(h,2),L(h));break}}l=l.return}}function $0(r,l,c){var h=r.pingCache;if(h===null){h=r.pingCache=new zP;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)||(IS=!0,y.add(c),r=D4.bind(null,r,l,c),l.then(r,r))}function D4(r,l,c){var h=r.pingCache;h!==null&&h.delete(l),r.pingedLanes|=r.suspendedLanes&c,r.warmLanes&=~c,Re===r&&(Qt&c)===c&&(Xe===4||Xe===3&&(Qt&62914560)===Qt&&300>Si()-nm?!(Ft&2)&&tu(r,0):DS|=c,xu===Qt&&(xu=0)),L(r)}function QC(r,l){l===0&&(l=A()),r=Pl(r,l),r!==null&&(M(r,l),L(r))}function L4(r){var l=r.memoizedState,c=0;l!==null&&(c=l.retryLane),QC(r,c)}function P4(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),QC(r,c)}function B4(r,l){return Vp(r,l)}function H4(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 tS(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 XC(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 Ip(r,l,c,h,y,b){var w=0;if(h=r,typeof r=="function")tS(r)&&(w=1);else if(typeof r=="string")w=Da&&En?yw(r,c,Vn.current)?26:Cw(r)?27:5:Da?yw(r,c,Vn.current)?26:5:En&&Cw(r)?27:5;else t:switch(r){case cS:return r=e(31,c,l,y),r.elementType=cS,r.lanes=b,r;case iu:return Vl(c.children,y,b,l);case ew:w=8,y|=24;break;case oS:return r=e(12,c,l,y|2),r.elementType=oS,r.lanes=b,r;case lS:return r=e(13,c,l,y),r.elementType=lS,r.lanes=b,r;case sS:return r=e(19,c,l,y),r.elementType=sS,r.lanes=b,r;default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case Er:w=10;break t;case nw:w=9;break t;case rS:w=11;break t;case uS:w=14;break t;case Rr: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 Vl(r,l,c,h){return r=e(7,r,h,l),r.lanes=c,r}function eS(r,l,c){return r=e(6,r,null,l),r.lanes=c,r}function KC(r){var l=e(18,null,null,0);return l.stateNode=r,l}function nS(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 U4(r,l,c,h,y,b,w,N,k){this.tag=1,this.containerInfo=r,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=jl,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=T(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=T(0),this.hiddenUpdates=T(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 ZC(r,l,c,h,y,b,w,N,k,et,ct,ot){return r=new U4(r,l,c,w,k,et,ct,ot,N),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},s0(b),r}function JC(r){return r?(r=lu,r):lu}function WC(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:Af(r.stateNode)}function $C(r,l,c,h,y,b){y=JC(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),df(c,r,l))}function tw(r,l){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var c=r.retryLane;r.retryLane=c!==0&&c<l?c:l}}function iS(r,l){tw(r,l),(r=r.alternate)&&tw(r,l)}var qt={},V4=nt(),Bi=Ab(),aS=Object.assign,j4=Symbol.for("react.element"),Dp=Symbol.for("react.transitional.element"),nu=Symbol.for("react.portal"),iu=Symbol.for("react.fragment"),ew=Symbol.for("react.strict_mode"),oS=Symbol.for("react.profiler"),nw=Symbol.for("react.consumer"),Er=Symbol.for("react.context"),rS=Symbol.for("react.forward_ref"),lS=Symbol.for("react.suspense"),sS=Symbol.for("react.suspense_list"),uS=Symbol.for("react.memo"),Rr=Symbol.for("react.lazy");Symbol.for("react.scope");var cS=Symbol.for("react.activity");Symbol.for("react.legacy_hidden"),Symbol.for("react.tracing_marker");var q4=Symbol.for("react.memo_cache_sentinel");Symbol.for("react.view_transition");var iw=Symbol.iterator,F4=Symbol.for("react.client.reference"),Lp=Array.isArray,wt=V4.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,G4=t.rendererVersion,k4=t.rendererPackageName,aw=t.extraDevToolsConfig,Af=t.getPublicInstance,Y4=t.getRootHostContext,Q4=t.getChildHostContext,X4=t.prepareForCommit,K4=t.resetAfterCommit,Z4=t.createInstance;t.cloneMutableInstance;var fS=t.appendInitialChild,ow=t.finalizeInitialChildren,Pp=t.shouldSetTextContent,rw=t.createTextInstance;t.cloneMutableTextInstance;var J4=t.scheduleTimeout,W4=t.cancelTimeout,jl=t.noTimeout,Ro=t.isPrimaryRenderer;t.warnsIfNotActing;var Wn=t.supportsMutation,eo=t.supportsPersistence,$n=t.supportsHydration,$4=t.getInstanceFromNode;t.beforeActiveInstanceBlur;var t5=t.preparePortalMount;t.prepareScopeUpdate,t.getInstanceFromScope;var On=t.setCurrentUpdatePriority,Ao=t.getCurrentUpdatePriority,e5=t.resolveUpdatePriority;t.trackSchedulerEvent,t.resolveEventType,t.resolveEventTimeStamp;var n5=t.shouldAttemptEagerTransition,i5=t.detachDeletedInstance;t.requestPostPaintCallback;var a5=t.maySuspendCommit,o5=t.maySuspendCommitOnUpdate,dS=t.maySuspendCommitInSyncRender,lw=t.preloadInstance,r5=t.startSuspendingCommit,sw=t.suspendInstance;t.suspendOnActiveViewTransition;var l5=t.waitForCommitToBeReady;t.getSuspendedCommitReason;var au=t.NotPendingTransition,ql=t.HostTransitionContext,s5=t.resetFormInstance;t.bindToConsole;var u5=t.supportsMicrotasks,c5=t.scheduleMicrotask,Tf=t.supportsTestSelectors,f5=t.findFiberRoot,d5=t.getBoundingRect,h5=t.getTextContent,Cf=t.isHiddenSubtree,p5=t.matchAccessibilityRole,m5=t.setFocusIfFocusable,g5=t.setupIntersectionObserver,y5=t.appendChild,v5=t.appendChildToContainer,S5=t.commitTextUpdate,b5=t.commitMount,x5=t.commitUpdate,E5=t.insertBefore,R5=t.insertInContainerBefore,A5=t.removeChild,T5=t.removeChildFromContainer,uw=t.resetTextContent,C5=t.hideInstance,w5=t.hideTextInstance,M5=t.unhideInstance,O5=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 _5=t.clearContainer;t.createFragmentInstance,t.updateFragmentInstanceFiber,t.commitNewChildToFragmentInstance,t.deleteChildFromFragmentInstance;var z5=t.cloneInstance,cw=t.createContainerChildSet,fw=t.appendChildToContainerChildSet,N5=t.finalizeContainerChildren,dw=t.replaceContainerChildren,hw=t.cloneHiddenInstance,pw=t.cloneHiddenTextInstance,hS=t.isSuspenseInstancePending,pS=t.isSuspenseInstanceFallback,I5=t.getSuspenseInstanceFallbackErrorDetails,D5=t.registerSuspenseInstanceRetry,L5=t.canHydrateFormStateMarker,P5=t.isFormStateMarkerMatching,mw=t.getNextHydratableSibling,B5=t.getNextHydratableSiblingAfterSingleton,H5=t.getFirstHydratableChild,U5=t.getFirstHydratableChildWithinContainer,V5=t.getFirstHydratableChildWithinActivityInstance,j5=t.getFirstHydratableChildWithinSuspenseInstance,q5=t.getFirstHydratableChildWithinSingleton,F5=t.canHydrateInstance,G5=t.canHydrateTextInstance,k5=t.canHydrateActivityInstance,Y5=t.canHydrateSuspenseInstance,Q5=t.hydrateInstance,X5=t.hydrateTextInstance,K5=t.hydrateActivityInstance,Z5=t.hydrateSuspenseInstance,J5=t.getNextHydratableInstanceAfterActivityInstance,W5=t.getNextHydratableInstanceAfterSuspenseInstance,$5=t.commitHydratedInstance,tP=t.commitHydratedContainer,eP=t.commitHydratedActivityInstance,nP=t.commitHydratedSuspenseInstance,iP=t.finalizeHydratedChildren,aP=t.flushHydrationEvents;t.clearActivityBoundary;var oP=t.clearSuspenseBoundary;t.clearActivityBoundaryFromContainer;var rP=t.clearSuspenseBoundaryFromContainer,lP=t.hideDehydratedBoundary,sP=t.unhideDehydratedBoundary,gw=t.shouldDeleteUnhydratedTailInstances;t.diffHydratedPropsForDevWarnings,t.diffHydratedTextForDevWarnings,t.describeHydratableInstanceForDevWarnings;var uP=t.validateHydratableInstance,cP=t.validateHydratableTextInstance,Da=t.supportsResources,yw=t.isHostHoistableType,mS=t.getHoistableRoot,vw=t.getResource,Sw=t.acquireResource,bw=t.releaseResource,fP=t.hydrateHoistable,xw=t.mountHoistable,Ew=t.unmountHoistable,dP=t.createHoistableInstance,hP=t.prepareToCommitHoistables,pP=t.mayResourceSuspendCommit,Rw=t.preloadResource,mP=t.suspendResource,En=t.supportsSingletons,Aw=t.resolveSingletonInstance,gP=t.acquireSingletonInstance,Tw=t.releaseSingletonInstance,Cw=t.isHostSingletonType,ou=t.isSingletonScope,gS=[],ru=-1,lu={},Hi=Math.clz32?Math.clz32:S,yP=Math.log,vP=Math.LN2,Bp=256,Hp=262144,Up=4194304,Vp=Bi.unstable_scheduleCallback,yS=Bi.unstable_cancelCallback,SP=Bi.unstable_shouldYield,bP=Bi.unstable_requestPaint,Si=Bi.unstable_now,ww=Bi.unstable_ImmediatePriority,xP=Bi.unstable_UserBlockingPriority,vS=Bi.unstable_NormalPriority,EP=Bi.unstable_IdlePriority,RP=Bi.log,AP=Bi.unstable_setDisableYieldValue,wf=null,Ui=null,Vi=typeof Object.is=="function"?Object.is:it,Mw=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)},TP=Object.prototype.hasOwnProperty,SS,Ow,bS=!1,_w=new WeakMap,su=[],uu=0,jp=null,Mf=0,ua=[],ca=0,Ar=null,no=1,io="",Vn=m(null),Of=m(null),Tr=m(null),qp=m(null),jn=null,Ue=null,Kt=!1,Cr=null,fa=!1,xS=Error(i(519)),Fp=m(null),Fl=null,To=null,CP=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()})}},wP=Bi.unstable_scheduleCallback,MP=Bi.unstable_NormalPriority,Ve={$$typeof:Er,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0},Gp=null,cu=null,ES=!1,kp=!1,RS=!1,Gl=0,_f=null,AS=0,fu=0,du=null,zw=wt.S;wt.S=function(r,l){Pw=Si(),typeof l=="object"&&l!==null&&typeof l.then=="function"&&yt(r,l),zw!==null&&zw(r,l)};var kl=m(null),hu=Error(i(460)),TS=Error(i(474)),Yp=Error(i(542)),Qp={then:function(){}},Yl=null,pu=null,zf=0,Ql=eT(!0),Nw=eT(!1),da=[],mu=0,CS=0,wr=!1,wS=!1,gu=m(null),Xp=m(0),ji=m(null),ha=null,nn=m(0),Co=0,Bt=null,Se=null,sn=null,Kp=!1,yu=!1,Xl=!1,Zp=0,Nf=0,vu=null,OP=0,If={readContext:P,use:yp,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};If.useEffectEvent=Qe;var Iw={readContext:P,use:yp,useCallback:function(r,l){return li().memoizedState=[r,l===void 0?null:l],r},useContext:P,useEffect:CT,useImperativeHandle:function(r,l,c){c=c!=null?c.concat([r]):null,Sp(4194308,4,_T.bind(null,l,r),c)},useLayoutEffect:function(r,l){return Sp(4194308,4,r,l)},useInsertionEffect:function(r,l){Sp(4,2,r,l)},useMemo:function(r,l){var c=li();l=l===void 0?null:l;var h=r();if(Xl){W(!0);try{r()}finally{W(!1)}}return c.memoizedState=[h,l],h},useReducer:function(r,l,c){var h=li();if(c!==void 0){var y=c(l);if(Xl){W(!0);try{c(l)}finally{W(!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=E4.bind(null,Bt,r),[h.memoizedState,r]},useRef:function(r){var l=li();return r={current:r},l.memoizedState=r},useState:function(r){r=E0(r);var l=r.queue,c=UT.bind(null,Bt,l);return l.dispatch=c,[r.memoizedState,c]},useDebugValue:T0,useDeferredValue:function(r,l){var c=li();return C0(c,r,l)},useTransition:function(){var r=E0(!1);return r=LT.bind(null,Bt,r.queue,!0,!1),li().memoizedState=r,[!1,r]},useSyncExternalStore:function(r,l,c){var h=Bt,y=li();if(Kt){if(c===void 0)throw Error(i(407));c=c()}else{if(c=l(),Re===null)throw Error(i(349));Qt&127||cT(h,l,c)}y.memoizedState=c;var b={value:c,getSnapshot:l};return y.queue=b,CT(dT.bind(null,h,b,r),[r]),h.flags|=2048,Ws(9,{destroy:void 0},fT.bind(null,h,b,c,l),null),c},useId:function(){var r=li(),l=Re.identifierPrefix;if(Kt){var c=io,h=no;c=(h&~(1<<32-Hi(h)-1)).toString(32)+c,l="_"+l+"R_"+c,c=Zp++,0<c&&(l+="H"+c.toString(32)),l+="_"}else c=OP++,l="_"+l+"r_"+c.toString(32)+"_";return r.memoizedState=l},useHostTransitionStatus:w0,useFormState:xT,useActionState:xT,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=M0.bind(null,Bt,!0,c),c.dispatch=l,[r,l]},useMemoCache:S0,useCacheRefresh:function(){return li().memoizedState=x4.bind(null,Bt)},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)}}},MS={readContext:P,use:yp,useCallback:NT,useContext:P,useEffect:A0,useImperativeHandle:zT,useInsertionEffect:MT,useLayoutEffect:OT,useMemo:IT,useReducer:vp,useRef:TT,useState:function(){return vp(vo)},useDebugValue:T0,useDeferredValue:function(r,l){var c=en();return DT(c,Se.memoizedState,r,l)},useTransition:function(){var r=vp(vo)[0],l=en().memoizedState;return[typeof r=="boolean"?r:mf(r),l]},useSyncExternalStore:uT,useId:BT,useHostTransitionStatus:w0,useFormState:ET,useActionState:ET,useOptimistic:function(r,l){var c=en();return mT(c,Se,r,l)},useMemoCache:S0,useCacheRefresh:HT};MS.useEffectEvent=wT;var Dw={readContext:P,use:yp,useCallback:NT,useContext:P,useEffect:A0,useImperativeHandle:zT,useInsertionEffect:MT,useLayoutEffect:OT,useMemo:IT,useReducer:x0,useRef:TT,useState:function(){return x0(vo)},useDebugValue:T0,useDeferredValue:function(r,l){var c=en();return Se===null?C0(c,r,l):DT(c,Se.memoizedState,r,l)},useTransition:function(){var r=x0(vo)[0],l=en().memoizedState;return[typeof r=="boolean"?r:mf(r),l]},useSyncExternalStore:uT,useId:BT,useHostTransitionStatus:w0,useFormState:AT,useActionState:AT,useOptimistic:function(r,l){var c=en();return Se!==null?mT(c,Se,r,l):(c.baseState=r,[r,c.queue.dispatch])},useMemoCache:S0,useCacheRefresh:HT};Dw.useEffectEvent=wT;var OS={enqueueSetState:function(r,l,c){r=r._reactInternals;var h=Pi(),y=gr(h);y.payload=l,c!=null&&(y.callback=c),l=yr(r,y,h),l!==null&&(vi(l,r,h),df(l,r,h))},enqueueReplaceState:function(r,l,c){r=r._reactInternals;var h=Pi(),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),df(l,r,h))},enqueueForceUpdate:function(r,l){r=r._reactInternals;var c=Pi(),h=gr(c);h.tag=2,l!=null&&(h.callback=l),l=yr(r,h,c),l!==null&&(vi(l,r,c),df(l,r,c))}},_S=Error(i(461)),un=!1,zS={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null},wo=!1,cn=!1,NS=!1,Lw=typeof WeakSet=="function"?WeakSet:Set,_n=null,fn=null,bi=!1,La=null,Su=8192,_P={getCacheForType:function(r){var l=P(Ve),c=l.data.get(r);return c===void 0&&(c=r(),l.data.set(r,c)),c},cacheSignal:function(){return P(Ve).controller.signal}},Jp=0,Wp=1,$p=2,tm=3,em=4;if(typeof Symbol=="function"&&Symbol.for){var Df=Symbol.for;Jp=Df("selector.component"),Wp=Df("selector.has_pseudo_class"),$p=Df("selector.role"),tm=Df("selector.test_id"),em=Df("selector.text")}var zP=typeof WeakMap=="function"?WeakMap:Map,Ft=0,Re=null,Gt=null,Qt=0,fe=0,qi=null,Mr=!1,bu=!1,IS=!1,Mo=0,Xe=0,Or=0,Kl=0,DS=0,Fi=0,xu=0,Lf=null,xi=null,LS=!1,nm=0,Pw=0,Pf=1/0,im=null,_r=null,Rn=0,zr=null,Eu=null,Oo=0,PS=0,BS=null,Bw=null,Bf=0,HS=null;return qt.attemptContinuousHydration=function(r){if(r.tag===13||r.tag===31){var l=Pl(r,67108864);l!==null&&vi(l,r,67108864),iS(r,67108864)}},qt.attemptHydrationAtCurrentPriority=function(r){if(r.tag===13||r.tag===31){var l=Pi();l=B(l);var c=Pl(r,l);c!==null&&vi(c,r,l),iS(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)&&(Pf=Si()+500,$(0,!1))}}break;case 31:case 13:l=Pl(r,2),l!==null&&vi(l,r,2),NC(),iS(r,2)}},qt.batchedUpdates=function(r,l){return r(l)},qt.createComponentSelector=function(r){return{$$typeof:Jp,value:r}},qt.createContainer=function(r,l,c,h,y,b,w,N,k,et){return ZC(r,l,!1,null,c,h,b,null,w,N,k,et)},qt.createHasPseudoClassSelector=function(r){return{$$typeof:Wp,value:r}},qt.createHydrationContainer=function(r,l,c,h,y,b,w,N,k,et,ct,ot,gt,Pt){return r=ZC(c,h,!0,r,y,b,N,Pt,k,et,ct,ot),r.context=JC(null),c=r.current,h=Pi(),h=B(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:nu,key:h==null?null:""+h,children:r,containerInfo:l,implementation:c}},qt.createRoleSelector=function(r){return{$$typeof:$p,value:r}},qt.createTestNameSelector=function(r){return{$$typeof:tm,value:r}},qt.createTextSelector=function(r){return{$$typeof:em,value:r}},qt.defaultOnCaughtError=function(r){console.error(r)},qt.defaultOnRecoverableError=function(r){Mw(r)},qt.defaultOnUncaughtError=function(r){Mw(r)},qt.deferredUpdates=function(r){var l=wt.T,c=Ao();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=Ao();try{return On(2),wt.T=null,r(l,c,h,y)}finally{On(w),wt.T=b,Ft===0&&(Pf=Si()+500)}},qt.findAllNodes=Z0,qt.findBoundingRects=function(r,l){if(!Tf)throw Error(i(363));l=Z0(r,l),r=[];for(var c=0;c<l.length;c++)r.push(d5(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,N=l-1;0<=N;N--)if(l!==N){var k=r[N],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=WC,qt.findHostInstanceWithNoPortals=function(r){return r=s(r),r=r!==null?d(r):null,r===null?null:Af(r.stateNode)},qt.findHostInstanceWithWarning=function(r){return WC(r)},qt.flushPassiveEffects=Rf,qt.flushSyncFromReconciler=function(r){var l=Ft;Ft|=1;var c=wt.T,h=Ao();try{if(On(2),wt.T=null,r)return r()}finally{On(h),wt.T=c,Ft=l,!(Ft&6)&&$(0,!1)}},qt.flushSyncWork=NC,qt.focusWithin=function(r,l){if(!Tf)throw Error(i(363));for(r=Q0(r),l=MC(r,l),l=Array.from(l),r=0;r<l.length;){var c=l[r++],h=c.tag;if(!Cf(c)){if((h===5||h===26||h===27)&&m5(c.stateNode))return!0;for(c=c.child;c!==null;)l.push(c),c=c.sibling}}return!1},qt.getFindAllNodesFailureDescription=function(r,l){if(!Tf)throw Error(i(363));var c=0,h=[];r=[Q0(r),0];for(var y=0;y<r.length;){var b=r[y++],w=b.tag,N=r[y++],k=l[N];if((w!==5&&w!==26&&w!==27||!Cf(b))&&(X0(b,k)&&(h.push(K0(k)),N++,N>c&&(c=N)),N<l.length))for(b=b.child;b!==null;)r.push(b,N),b=b.sibling}if(c<l.length){for(r=[];c<l.length;c++)r.push(K0(l[c]));return`findAllNodes was able to match part of the selector:
8
+ `+h.stack}}function lt(r,l){if(typeof r=="object"&&r!==null){var c=qw.get(r);return c!==void 0?c:(l={value:r,source:l,stack:xt(l)},qw.set(r,l),l)}return{value:r,source:l,stack:xt(l)}}function dt(r,l){fu[du++]=Nf,fu[du++]=kp,kp=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===kp;)kp=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=l5(l),g(Vn),v(Vn,r)}function le(){g(Vn),g(If),g(Tr)}function pe(r){r.memoizedState!==null&&v(Yp,r);var l=Vn.current,c=s5(l,r.type);l!==c&&(v(If,r),v(Vn,c))}function De(r){If.current===r&&(g(Vn),g(If)),Yp.current===r&&(g(Yp),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)),MS}function Di(r,l){if(!$n)throw Error(i(175));sB(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||Mw(r.type)&&!Vp(r.type,r.memoizedProps))&&Ue&&ne(r):l!==3&&(l!==5||Mw(r.type)&&!Vp(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=hB(r)}else if(l===31){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(i(317));Ue=dB(r)}else Ue=En&&l===27?J5(r.type,Ue):jn?ww(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(Qp,l._currentValue),l._currentValue=c):(v(Qp,l._currentValue2),l._currentValue2=c)}function It(r){var l=Qp.current;Ao?r._currentValue=l:r._currentValue2=l,g(Qp)}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===Yp.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 jB,data:new Map,refCount:0}}function vt(r){r.refCount--,r.refCount===0&&qB(FB,function(){r.controller.abort()})}function j(){}function L(r){r!==hu&&r.next===null&&(hu===null?Xp=hu=r:hu=hu.next=r),Kp=!0,OS||(OS=!0,Z())}function $(r,l){if(!_S&&Kp){_S=!0;do for(var c=!1,h=Xp;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);_S=!1}}function it(){Nt()}function Nt(){Kp=OS=!1;var r=0;Yl!==0&&y5()&&(r=Yl);for(var l=Si(),c=null,h=Xp;h!==null;){var y=h.next,b=Lt(h,l);b===0?(h.next=null,c===null?Xp=y:c.next=y,y===null&&(hu=c)):(c=h,(r!==0||b&3)&&(Kp=!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&&RS(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&&RS(h),U(c)){case 2:case 8:c=BB;break;case 32:c=TS;break;case 268435456:c=PB;break;default:c=TS}return h=jt.bind(null,r),c=Gp(c,h),r.callbackPriority=l,r.callbackNode=c,l}return h!==null&&h!==null&&RS(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:(qC(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;qC(r,l,!0)}function Z(){R5?T5(function(){Ft&6?Gp(Uw,it):Nt()}):Gp(Uw,it)}function mt(){if(Yl===0){var r=pu;r===0&&(r=jp,jp<<=1,!(jp&261888)&&(jp=256)),Yl=r}return Yl}function yt(r,l){if(Df===null){var c=Df=[];zS=0,pu=mt(),mu={status:"pending",value:void 0,then:function(h){c.push(h)}}}return zS++,l.then(pt,pt),l}function pt(){if(--zS===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(!VB.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===Zp)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 mp(r,l){throw l.$$typeof===n5?Error(i(525)):(r=Object.prototype.toString.call(l),Error(i(31,r==="[object Object]"?"object with keys {"+Object.keys(l).join(", ")+"}":r)))}function hT(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=sS(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=Pp(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=uS(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=sS(""+H,V.mode,F),H.return=V,H;if(typeof H=="object"&&H!==null){switch(H.$$typeof){case Hp:return F=Pp(H.type,H.key,H.props,null,V.mode,F),mr(F,H),F.return=V,F;case ou:return H=uS(H,V.mode,F),H.return=V,H;case Ar:return H=yi(H),ot(V,H,F)}if(Up(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);mp(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 Hp: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(Up(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);mp(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 Hp: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(Up(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);mp(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(QB){return l(V,QB)}),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 Hp: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=Pp(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=uS(F,V.mode,rt),rt.return=V,V=rt}return w(V);case Ar:return F=yi(F),Jl(V,H,F,rt)}if(Up(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);mp(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=sS(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===Zp)throw Ot;var je=e(29,Ot,null,V.mode);return je.lanes=rt,je.return=V,je}finally{}}}function gp(){for(var r=vu,l=IS=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&&pT(c,y,b)}}function yp(r,l,c,h){da[vu++]=r,da[vu++]=l,da[vu++]=c,da[vu++]=h,IS|=h,r.lanes|=h,r=r.alternate,r!==null&&(r.lanes|=h)}function p0(r,l,c,h){return yp(r,l,c,h),vp(r)}function Hl(r,l){return yp(r,null,null,l),vp(r)}function pT(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 vp(r){if(50<jf)throw jf=0,kS=null,Error(i(185));for(var l=r.return;l!==null;)r=l,l=r.return;return r.tag===3?r.stateNode:null}function m0(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function g0(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=vp(r),pT(r,null,c),l}return yp(r,h,l,c),vp(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 y0(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(DS){var r=mu;if(r!==null)throw r}}function vf(r,l,c,h){DS=!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)===gt:(h&gt)===gt){gt!==0&&gt===pu&&(DS=!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=fS({},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 mT(r,l){if(typeof r!="function")throw Error(i(191,r));r.call(l)}function gT(r,l){var c=r.callbacks;if(c!==null)for(r.callbacks=null,r=0;r<c.length;r++)mT(c[r],l)}function yT(r,l){r=Mo,v(Jp,r),v(Su,l),Mo=r|l.baseLanes}function v0(){v(Jp,Mo),v(Su,Su.current)}function S0(){Mo=Jp.current,g(Su),g(Jp)}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 b0(r){v(nn,nn.current),v(ji,r),ha===null&&(ha=r)}function vT(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 Sp(r){for(var l=r;l!==null;){if(l.tag===13){var c=l.memoizedState;if(c!==null&&(c=c.dehydrated,c===null||bS(c)||xS(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 x0(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 E0(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?kw:LS,Zl=!1,b=c(h,y),Zl=!1,bu&&(b=bT(l,c,h,y)),ST(r),b}function ST(r){wt.H=Pf;var l=Se!==null&&Se.next!==null;if(Co=0,sn=Se=Pt=null,$p=!1,Bf=0,xu=null,l)throw Error(i(300));r===null||un||(r=r.dependencies,r!==null&&tn(r)&&(un=!0))}function bT(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=Yw,b=l(c,h)}while(bu);return b}function N4(){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 A0(){var r=tm!==0;return tm=0,r}function R0(r,l,c){l.updateQueue=r.updateQueue,l.flags&=-2053,r.lanes&=~c}function T0(r){if($p){for(r=r.memoizedState;r!==null;){var l=r.queue;l!==null&&(l.pending=null),r=r.next}$p=!1}Co=0,sn=Se=Pt=null,bu=!1,Bf=tm=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 bp(){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?kw:LS),r}function xp(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 C0(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=bp(),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]=i5;return l.index++,c}function vo(r,l){return typeof l=="function"?l(r):l}function Ep(r){var l=en();return w0(l,Se,r)}function w0(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)===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 M0(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 xT(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,z0(RT.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},AT.bind(null,h,y,c,l),null),Ae===null)throw Error(i(349));b||Co&127||ET(h,l,c)}return c}function ET(r,l,c){r.flags|=16384,r={getSnapshot:l,value:c},l=Pt.updateQueue,l===null?(l=bp(),Pt.updateQueue=l,l.stores=[r]):(c=l.stores,c===null?l.stores=[r]:c.push(r))}function AT(r,l,c,h){l.value=c,l.getSnapshot=h,TT(l)&&CT(r)}function RT(r,l,c){return c(function(){TT(l)&&CT(r)})}function TT(r){var l=r.getSnapshot;r=r.value;try{var c=l();return!Vi(r,c)}catch{return!0}}function CT(r){var l=Hl(r,2);l!==null&&vi(l,r,2)}function O0(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 wT(r,l,c,h){return r.baseState=c,w0(r,Se,typeof h=="function"?h:vo)}function I4(r,l,c,h,y){if(Tp(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,MT(l,b)):(b.next=c.next,l.pending=c.next=b)}}function MT(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),OT(r,l,I)}catch(et){_0(r,l,et)}finally{b!==null&&w.types!==null&&(b.types=w.types),wt.T=b}}else try{b=c(y,h),OT(r,l,b)}catch(et){_0(r,l,et)}}function OT(r,l,c){c!==null&&typeof c=="object"&&typeof c.then=="function"?c.then(function(h){_T(r,l,h)},function(h){return _0(r,l,h)}):_T(r,l,c)}function _T(r,l,c){l.status="fulfilled",l.value=c,zT(l),r.state=c,l=r.pending,l!==null&&(c=l.next,c===l?r.pending=null:(c=c.next,l.next=c,MT(r,c)))}function _0(r,l,c){var h=r.pending;if(r.pending=null,h!==null){h=h.next;do l.status="rejected",l.reason=c,zT(l),l=l.next;while(l!==h)}r.action=null}function zT(r){r=r.listeners;for(var l=0;l<r.length;l++)(0,r[l])()}function NT(r,l){return l}function IT(r,l){if(Kt){var c=Ae.formState;if(c!==null){t:{var h=Pt;if(Kt){if(Ue){var y=Z5(Ue,fa);if(y){Ue=ww(y),h=W5(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:NT,lastRenderedState:l},c.queue=h,c=WT.bind(null,Pt,h),h.dispatch=c,h=O0(!1);var b=L0.bind(null,Pt,!1,h.queue);return h=li(),y={state:l,dispatch:null,action:r,pending:null},h.queue=y,c=I4.bind(null,Pt,y,b,c),y.dispatch=c,h.memoizedState=r,[l,c,!1]}function DT(r){var l=en();return LT(l,Se,r)}function LT(r,l,c){if(l=w0(r,l,NT)[0],r=Ep(vo)[0],typeof l=="object"&&l!==null&&typeof l.then=="function")try{var h=Sf(l)}catch(w){throw w===gu?Zp: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},D4.bind(null,y,c),null)),[h,b,r]}function D4(r,l){r.action=l}function BT(r){var l=en(),c=Se;if(c!==null)return LT(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=bp(),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 PT(){return en().memoizedState}function Ap(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 Rp(r,l,c,h){var y=en();h=h===void 0?null:h;var b=y.memoizedState.inst;Se!==null&&h!==null&&x0(h,Se.memoizedState.deps)?y.memoizedState=eu(l,b,c,h):(Pt.flags|=r,y.memoizedState=eu(1|l,b,c,h))}function HT(r,l){Ap(8390656,8,r,l)}function z0(r,l){Rp(2048,8,r,l)}function L4(r){Pt.flags|=4;var l=Pt.updateQueue;if(l===null)l=bp(),Pt.updateQueue=l,l.events=[r];else{var c=l.events;c===null?l.events=[r]:c.push(r)}}function UT(r){var l=en().memoizedState;return L4({ref:l,nextImpl:r}),function(){if(Ft&2)throw Error(i(440));return l.impl.apply(void 0,arguments)}}function VT(r,l){return Rp(4,2,r,l)}function jT(r,l){return Rp(4,4,r,l)}function qT(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 FT(r,l,c){c=c!=null?c.concat([r]):null,Rp(4,4,qT.bind(null,l,r),c)}function N0(){}function GT(r,l){var c=en();l=l===void 0?null:l;var h=c.memoizedState;return l!==null&&x0(l,h[1])?h[0]:(c.memoizedState=[r,l],r)}function kT(r,l){var c=en();l=l===void 0?null:l;var h=c.memoizedState;if(l!==null&&x0(l,h[1]))return h[0];if(h=r(),Zl){J(!0);try{r()}finally{J(!1)}}return c.memoizedState=[h,l],h}function I0(r,l,c){return c===void 0||Co&1073741824&&!(Qt&261930)?r.memoizedState=l:(r.memoizedState=c,r=jC(),Pt.lanes|=r,Or|=r,c)}function YT(r,l,c,h){return Vi(c,l)?c:Su.current!==null?(r=I0(r,c,h),Vi(r,l)||(un=!0),r):!(Co&42)||Co&1073741824&&!(Qt&261930)?(un=!0,r.memoizedState=c):(r=jC(),Pt.lanes|=r,Or|=r,l)}function QT(r,l,c,h,y){var b=Ro();On(b!==0&&8>b?b:8);var w=wt.T,I={};wt.T=I,L0(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 XT(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 D0(){return B(Gl)}function KT(){return en().memoizedState}function ZT(){return en().memoizedState}function B4(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 P4(r,l,c){var h=Bi();c={lane:h,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},Tp(r)?JT(l,c):(c=p0(r,l,c,h),c!==null&&(vi(c,r,h),$T(c,l,h)))}function WT(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(Tp(r))JT(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 yp(r,l,y,0),Ae===null&&gp(),!1}catch{}finally{}if(c=p0(r,l,y,h),c!==null)return vi(c,r,h),$T(c,l,h),!0}return!1}function L0(r,l,c,h){if(h={lane:2,revertLane:mt(),gesture:null,action:h,hasEagerState:!1,eagerState:null,next:null},Tp(r)){if(l)throw Error(i(479))}else l=p0(r,c,h,2),l!==null&&vi(l,r,2)}function Tp(r){var l=r.alternate;return r===Pt||l!==null&&l===Pt}function JT(r,l){bu=$p=!0;var c=r.pending;c===null?l.next=l:(l.next=c.next,c.next=l),r.pending=l}function $T(r,l,c){if(c&4194048){var h=l.lanes;h&=r.pendingLanes,c|=h,l.lanes=c,D(r,c)}}function B0(r,l,c,h){l=r.memoizedState,c=c(h,l),c=c==null?l:fS({},l,c),r.memoizedState=c,r.lanes===0&&(r.updateQueue.baseState=c)}function tC(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 eC(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&&BS.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=fS({},c));for(var y in r)c[y]===void 0&&(c[y]=r[y])}return c}function Cp(r,l){try{var c=r.onUncaughtError;c(l.value,{componentStack:l.stack})}catch(h){setTimeout(function(){throw h})}}function nC(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 P0(r,l,c){return c=gr(c),c.tag=3,c.payload={element:null},c.callback=function(){Cp(r,l)},c}function iC(r){return r=gr(r),r.tag=3,r}function aC(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(){nC(l,c,h)}}var w=c.stateNode;w!==null&&typeof w.componentDidCatch=="function"&&(r.callback=function(){nC(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 H4(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?Lp():c.alternate===null&&Xe===0&&(Xe=3),c.flags&=-257,c.flags|=65536,c.lanes=y,h===Wp?c.flags|=16384:(l=c.updateQueue,l===null?c.updateQueue=new Set([h]):l.add(h),rS(r,h,y)),!1;case 22:return c.flags|=65536,h===Wp?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)),rS(r,h,y)),!1}throw Error(i(435,c.tag))}return rS(r,h,y),Lp(),!1}if(Kt)return l=ji.current,l!==null?(!(l.flags&65536)&&(l.flags|=256),l.flags|=65536,l.lanes=y,h!==MS&&(r=Error(i(422),{cause:h}),Mn(lt(r,c)))):(h!==MS&&(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=P0(r.stateNode,h,y),y0(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=P0(c.stateNode,h,r),y0(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=iC(y),aC(y,r,c,h),y0(c,y),!1}c=c.return}while(c!==null);return!1}function Un(r,l,c,h){l.child=r===null?Gw(l,null,c,h):Kl(l,r.child,c,h)}function oC(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=E0(r,l,c,w,b,y),I=A0(),r!==null&&!un?(R0(r,l,y),So(r,l,y)):(Kt&&I&&K(l),l.flags|=1,Un(r,l,h,y),l.child)}function rC(r,l,c,h,y){if(r===null){var b=c.type;return typeof b=="function"&&!lS(b)&&b.defaultProps===void 0&&c.compare===null?(l.tag=15,l.type=b,lC(r,l,b,h,y)):(r=Pp(c.type,null,h,l,l.mode,y),r.ref=l.ref,r.return=l,l.child=r)}if(b=r.child,!G0(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 lC(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,G0(r,y))r.flags&131072&&(un=!0);else return l.lanes=r.lanes,So(r,l,y)}return H0(r,l,c,h,y)}function sC(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 uC(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?yT(l,b):v0(),vT(l);else return h=l.lanes=536870912,uC(r,l,b!==null?b.baseLanes|c:c,c,h)}else b!==null?(ye(l,b.cachePool),yT(l,b),Sr(l),l.memoizedState=null):(r!==null&&ye(l,null),v0(),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 uC(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),v0(),vT(l),r!==null&&Zn(r,l,h,!0),l.childLanes=y,null}function wp(r,l){return l=Op({mode:l.mode,children:l.children},r.mode),l.ref=r.ref,r.child=l,l.return=r,l}function cC(r,l,c){return Kl(l,r.child,null,c),r=wp(l,l.pendingProps),r.flags|=2,Li(l),l.memoizedState=null,r}function U4(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=wp(l,h),l.lanes=536870912,xf(null,r);if(b0(l),(r=Ue)?(r=rB(r,fa),r!==null&&(l.memoizedState={dehydrated:r,treeContext:Rr!==null?{id:no,overflow:io}:null,retryLane:536870912,hydrationErrors:null},c=lw(r),c.return=l,l.child=c,jn=l,Ue=null)):r=null,r===null)throw ne(l);return l.lanes=536870912,null}return wp(l,h)}var b=r.memoizedState;if(b!==null){var w=b.dehydrated;if(b0(l),y)if(l.flags&256)l.flags&=-257,l=cC(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),PS;Lp(),l=cC(r,l,c)}else r=b.treeContext,$n&&(Ue=eB(w),jn=l,Kt=!0,Cr=null,fa=!1,r!==null&&ee(l,r)),l=wp(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 Mp(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 H0(r,l,c,h,y){return bn(l),c=E0(r,l,c,h,void 0,y),h=A0(),r!==null&&!un?(R0(r,l,y),So(r,l,y)):(Kt&&h&&K(l),l.flags|=1,Un(r,l,c,y),l.child)}function fC(r,l,c,h,y,b){return bn(l),l.updateQueue=null,c=bT(l,h,c,y),ST(r),h=A0(),r!==null&&!un?(R0(r,l,b),So(r,l,b)):(Kt&&h&&K(l),l.flags|=1,Un(r,l,c,b),l.child)}function dC(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=BS,l.stateNode=b,b._reactInternals=l,b=l.stateNode,b.props=h,b.state=l.memoizedState,b.refs={},m0(l),w=c.contextType,b.context=typeof w=="object"&&w!==null?B(w):cu,b.state=l.memoizedState,w=c.getDerivedStateFromProps,typeof w=="function"&&(B0(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&&BS.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)&&eC(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"&&(B0(l,c,ot,h),et=l.memoizedState),(k=wr||tC(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,g0(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)&&eC(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"&&(B0(l,c,I,h),Bt=l.memoizedState),(ct=wr||tC(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&&gt===r.memoizedState||(l.flags|=4),typeof b.getSnapshotBeforeUpdate!="function"||w===r.memoizedProps&&gt===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&&gt===r.memoizedState||(l.flags|=4),typeof b.getSnapshotBeforeUpdate!="function"||w===r.memoizedProps&&gt===r.memoizedState||(l.flags|=1024),h=!1)}return b=h,Mp(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 hC(r,l,c,h){return ge(),l.flags|=256,Un(r,l,c,h),l.child}function U0(r){return{baseLanes:r,cachePool:ve()}}function V0(r,l,c){return r=r!==null?r.childLanes&~c:0,l&&(r|=Fi),r}function pC(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=lB(r,fa),r!==null&&(l.memoizedState={dehydrated:r,treeContext:Rr!==null?{id:no,overflow:io}:null,retryLane:536870912,hydrationErrors:null},c=lw(r),c.return=l,l.child=c,jn=l,Ue=null)):r=null,r===null)throw ne(l);return xS(r)?l.lanes=32:l.lanes=536870912,null}var I=h.children;return h=h.fallback,y?(Sr(l),y=l.mode,I=Op({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=U0(c),h.childLanes=V0(r,w,c),l.memoizedState=HS,xf(null,h)):(vr(l),j0(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=q0(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=Op({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=U0(c),h.childLanes=V0(r,w,c),l.memoizedState=HS,l=xf(null,h));else if(vr(l),xS(I))w=X5(I).digest,h=Error(i(419)),h.stack="",h.digest=w,Mn({value:h,source:null,stack:null}),l=q0(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),PS;bS(I)||Lp(),l=q0(r,l,c)}else bS(I)?(l.flags|=192,l.child=r.child,l=null):(r=k.treeContext,$n&&(Ue=nB(I),jn=l,Kt=!0,Cr=null,fa=!1,r!==null&&ee(l,r)),l=j0(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=U0(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=V0(r,w,c),l.memoizedState=HS,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 j0(r,l){return l=Op({mode:"visible",children:l},r.mode),l.return=r,r.child=l}function Op(r,l){return r=e(22,r,null,l),r.lanes=0,r}function q0(r,l,c){return Kl(l,r.child,null,c),r=j0(l,l.pendingProps.children),r.flags|=2,l.memoizedState=null,r}function mC(r,l,c){r.lanes|=l;var h=r.alternate;h!==null&&(h.lanes|=l),te(r.return,l,c)}function F0(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 gC(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&&mC(r,c,l);else if(r.tag===19)mC(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&&Sp(r)===null&&(y=c),c=c.sibling;c=y,c===null?(y=l.child,l.child=null):(y=c.sibling,c.sibling=null),F0(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&&Sp(r)===null){l.child=y;break}r=y.sibling,y.sibling=c,c=y,y=r}F0(l,!0,c,null,b,h);break;case"together":F0(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 G0(r,l){return r.lanes&l?!0:(r=r.dependencies,!!(r!==null&&tn(r)))}function V4(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,b0(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?pC(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 gC(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,sC(r,l,c,l.pendingProps);case 24:St(l,Ve,r.memoizedState.cache)}return So(r,l,c)}function yC(r,l,c){if(r!==null)if(r.memoizedProps!==l.pendingProps)un=!0;else{if(!G0(r,c)&&!(l.flags&128))return un=!1,V4(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")lS(r)?(h=Ul(r,h),l.tag=1,l=dC(null,l,r,h,c)):(l.tag=0,l=H0(null,l,r,h,c));else{if(r!=null){var y=r.$$typeof;if(y===hS){l.tag=11,l=oC(null,l,r,h,c);break t}else if(y===gS){l.tag=14,l=rC(null,l,r,h,c);break t}}throw l=f(r)||r,Error(i(306,l,""))}}return l;case 0:return H0(r,l,l.type,l.pendingProps,c);case 1:return h=l.type,y=Ul(h,l.pendingProps),dC(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,g0(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=hC(r,l,b,c);break t}else if(b!==h){h=lt(Error(i(424)),l),Mn(h),l=hC(r,l,b,c);break t}else for($n&&(Ue=tB(l.stateNode.containerInfo),jn=l,Kt=!0,Cr=null,fa=!0),c=Gw(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 Mp(r,l),r===null?(c=_w(l.type,null,l.pendingProps,null))?l.memoizedState=c:Kt||(l.stateNode=wB(l.type,l.pendingProps,Tr.current,l)):l.memoizedState=_w(l.type,r.memoizedProps,l.pendingProps,r.memoizedState),null;case 27:if(En)return pe(l),r===null&&En&&Kt&&(h=l.stateNode=Bw(l.type,l.pendingProps,Tr.current,Vn.current,!1),jn=l,fa=!0,Ue=iB(l.type,h,Ue)),Un(r,l,l.pendingProps.children,c),Mp(r,l),r===null&&(l.flags|=4194304),l.child;case 5:return r===null&&Kt&&(RB(l.type,l.pendingProps,Vn.current),(y=h=Ue)&&(h=aB(h,l.type,l.pendingProps,fa),h!==null?(l.stateNode=h,jn=l,Ue=$5(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,Vp(y,b)?h=null:w!==null&&Vp(y,w)&&(l.flags|=32),l.memoizedState!==null&&(y=E0(r,l,N4,null,null,c),Ao?Gl._currentValue=y:Gl._currentValue2=y),Mp(r,l),Un(r,l,h,c),l.child;case 6:return r===null&&Kt&&(TB(l.pendingProps,Vn.current),(r=c=Ue)&&(c=oB(c,l.pendingProps,fa),c!==null?(l.stateNode=c,jn=l,Ue=null,r=!0):r=!1),r||ne(l)),null;case 13:return pC(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 oC(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 rC(r,l,l.type,l.pendingProps,c);case 15:return lC(r,l,l.type,l.pendingProps,c);case 19:return gC(r,l,c);case 31:return U4(r,l,c);case 22:return sC(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},m0(l),St(l,Ve,y)):(r.lanes&c&&(g0(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 _p(r){eo&&(r.flags|=8)}function vC(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 k0(r,l,c,h){if(Jn)for(c=l.child;c!==null;){if(c.tag===5||c.tag===6)vS(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=Tw(b,y.type,y.memoizedProps)),vS(r,b)}else if(y.tag===6)b=y.stateNode,c&&h&&(b=Cw(b,y.memoizedProps)),vS(r,b);else if(y.tag!==4){if(y.tag===22&&y.memoizedState!==null)b=y.child,b!==null&&(b.return=y),k0(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 SC(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=Tw(w,b.type,b.memoizedProps)),Aw(r,w)}else if(b.tag===6)w=b.stateNode,c&&h&&(w=Cw(w,b.memoizedProps)),Aw(r,w);else if(b.tag!==4){if(b.tag===22&&b.memoizedState!==null)y=b.child,y!==null&&(y.return=b),SC(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 bC(r,l){if(eo&&vC(r,l)){r=l.stateNode;var c=r.containerInfo,h=Ew();SC(h,l,!1,!1),r.pendingChildren=h,za(l),Q5(c,h)}}function Y0(r,l,c,h){if(Jn)r.memoizedProps!==h&&za(l);else if(eo){var y=r.stateNode,b=r.memoizedProps;if((r=vC(r,l))||b!==h){var w=Vn.current;b=Y5(y,c,b,h,!r,null),b===y?l.stateNode=y:(_p(l),yw(b,c,h,w)&&za(l),l.stateNode=b,r&&k0(b,l,!1,!1))}else l.stateNode=y}}function Q0(r,l,c,h,y){if(r.mode&32&&(c===null?S5(l,h):b5(l,c,h))){if(r.flags|=16777216,(y&335544128)===y||SS(l,h))if(Sw(r.stateNode,l,h))r.flags|=8192;else if(YC())r.flags|=8192;else throw Xl=Wp,NS}else r.flags&=-16777217}function xC(r,l){if(OB(l)){if(r.flags|=16777216,!Lw(l))if(YC())r.flags|=8192;else throw Xl=Wp,NS}else r.flags&=-16777217}function zp(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 j4(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())),bC(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),xC(l,b)):(Oe(l),Q0(l,y,null,h,c))):b?b!==r.memoizedState?(za(l),Oe(l),xC(l,b)):(Oe(l),l.flags&=-16777217):(b=r.memoizedProps,Jn?b!==h&&za(l):Y0(r,l,y,h),Oe(l),Q0(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):Y0(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=Bw(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)Y0(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),vB(l.stateNode,y,h,b)&&(l.flags|=64);else{var w=f5(y,h,Tr.current,b,l);_p(l),k0(w,l,!1,!1),l.stateNode=w,yw(w,y,h,b)&&za(l)}}return Oe(l),Q0(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,_p(l),l.stateNode=vw(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}uB(r,c,l,h)||ne(l,!0)}else _p(l),l.stateNode=vw(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));cB(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));fB(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),zp(l,l.updateQueue),Oe(l),null);case 4:return le(),bC(r,l),r===null&&m5(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=Sp(r),b!==null){for(l.flags|=128,Ef(h,!1),r=b.updateQueue,l.updateQueue=r,zp(l,r),l.subtreeFlags=0,r=c,c=l.child;c!==null;)rw(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=Sp(b),r!==null){if(l.flags|=128,y=!0,r=r.updateQueue,l.updateQueue=r,zp(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),S0(),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&&zp(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 q4(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),S0(),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 EC(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),S0(),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 AC(r){var l=r.updateQueue;if(l!==null){var c=r.stateNode;try{gT(l,c)}catch(h){ie(r,r.return,h)}}}function RC(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 TC(r){var l=r.type,c=r.memoizedProps,h=r.stateNode;try{L5(h,l,c,r)}catch(y){ie(r,r.return,y)}}function X0(r,l,c){try{B5(r.stateNode,r.type,c,l,r)}catch(h){ie(r,r.return,h)}}function CC(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 K0(r){t:for(;;){for(;r.sibling===null;){if(r.return===null||CC(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 Z0(r,l,c){var h=r.tag;if(h===5||h===6)r=r.stateNode,l?H5(c,r,l):I5(c,r);else if(h!==4&&(En&&h===27&&su(r.type)&&(c=r.stateNode,l=null),r=r.child,r!==null))for(Z0(r,l,c),r=r.sibling;r!==null;)Z0(r,l,c),r=r.sibling}function Np(r,l,c){var h=r.tag;if(h===5||h===6)r=r.stateNode,l?P5(c,r,l):N5(c,r);else if(h!==4&&(En&&h===27&&su(r.type)&&(c=r.stateNode),r=r.child,r!==null))for(Np(r,l,c),r=r.sibling;r!==null;)Np(r,l,c),r=r.sibling}function wC(r,l,c){r=r.containerInfo;try{Rw(r,c)}catch(h){ie(l,l.return,h)}}function MC(r){var l=r.stateNode,c=r.memoizedProps;try{zB(r.type,c,l,r)}catch(h){ie(r,r.return,h)}}function F4(r,l){for(u5(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&&k5(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 OC(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&&AC(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{gT(h,r)}catch(w){ie(c,c.return,w)}}break;case 27:En&&l===null&&h&4&&MC(c);case 26:case 5:if(bo(r,c),l===null){if(h&4)TC(c);else if(h&64){r=c.type,l=c.memoizedProps,y=c.stateNode;try{pB(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&&zC(r,c);break;case 13:bo(r,c),h&4&&NC(r,c),h&64&&(h=c.memoizedState,h!==null&&(h=h.dehydrated,h!==null&&(c=Z4.bind(null,c),K5(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 _C(r){var l=r.alternate;l!==null&&(r.alternate=null,_C(l)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(l=r.stateNode,l!==null&&v5(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;)W0(r,l,c),c=c.sibling}function W0(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?Nw(c.memoizedState):c.stateNode&&Dw(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),Pw(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{V5(fn,c.stateNode)}catch(b){ie(c,l,b)}else try{U5(fn,c.stateNode)}catch(b){ie(c,l,b)}}else Na(r,l,c);break;case 18:Jn&&fn!==null&&(bi?xB(fn,c.stateNode):bB(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&&wC(c.stateNode,c,Ew()),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"&&RC(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 zC(r,l){if($n&&l.memoizedState===null&&(r=l.alternate,r!==null&&(r=r.memoizedState,r!==null))){r=r.dehydrated;try{gB(r)}catch(c){ie(l,l.return,c)}}}function NC(r,l){if($n&&l.memoizedState===null&&(r=l.alternate,r!==null&&(r=r.memoizedState,r!==null&&(r=r.dehydrated,r!==null))))try{yB(r)}catch(c){ie(l,l.return,c)}}function G4(r){switch(r.tag){case 31:case 13:case 19:var l=r.stateNode;return l===null&&(l=r.stateNode=new Qw),l;case 22:return r=r.stateNode,l=r._retryCache,l===null&&(l=r._retryCache=new Qw),l;default:throw Error(i(435,r.tag))}}function Ip(r,l){var c=G4(r);l.forEach(function(h){if(!c.has(h)){c.add(h);var y=W4.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));W0(b,w,y),fn=null,bi=!1}else W0(b,w,y);b=y.alternate,b!==null&&(b.return=null),y.return=null}if(l.subtreeFlags&13886)for(l=l.child;l!==null;)IC(l,r),l=l.sibling}function IC(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=CB(y,r.type,r.memoizedProps,r):Iw(y,r.type,r.stateNode):r.stateNode=zw(y,b,r.memoizedProps):h!==b?(h===null?c.stateNode!==null&&Dw(c.stateNode):Nw(h),b===null?Iw(y,r.type,r.stateNode):zw(y,b,r.memoizedProps)):b===null&&r.stateNode!==null&&X0(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&&X0(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{xw(y)}catch(ot){ie(r,r.return,ot)}}h&4&&r.stateNode!=null&&(y=r.memoizedProps,X0(r,y,c!==null?c.memoizedProps:y)),h&1024&&(US=!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{D5(y,c,h)}catch(ot){ie(r,r.return,ot)}}break;case 3:if(Da?(MB(),y=La,La=ES(l.containerInfo),Wn(l,r),La=y):Wn(l,r),si(r),h&4){if(Jn&&$n&&c!==null&&c.memoizedState.isDehydrated)try{mB(l.containerInfo)}catch(ot){ie(r,r.return,ot)}if(eo){h=l.containerInfo,c=l.pendingChildren;try{Rw(h,c)}catch(ot){ie(r,r.return,ot)}}}US&&(US=!1,DC(r));break;case 4:Da?(c=La,La=ES(r.stateNode.containerInfo),Wn(l,r),si(r),La=c):(Wn(l,r),si(r)),h&4&&eo&&wC(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,Ip(r,h)));break;case 13:Wn(l,r),si(r),r.child.flags&8192&&r.memoizedState!==null!=(c!==null&&c.memoizedState!==null)&&(rm=Si()),h&4&&(h=r.updateQueue,h!==null&&(r.updateQueue=null,Ip(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?j5(b):F5(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?q5(et):G5(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?EB(ct):AB(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,Ip(r,c))));break;case 19:Wn(l,r),si(r),h&4&&(h=r.updateQueue,h!==null&&(r.updateQueue=null,Ip(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(CC(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=K0(r);Np(r,b,y);break}case 5:var w=c.stateNode;c.flags&32&&(xw(w),c.flags&=-33);var I=K0(r);Np(r,I,w);break;case 3:case 4:var k=c.stateNode.containerInfo,et=K0(r);Z0(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 DC(r){if(r.subtreeFlags&1024)for(r=r.child;r!==null;){var l=r;DC(l),l.tag===5&&l.flags&1024&&A5(l.stateNode),r=r.sibling}}function bo(r,l){if(l.subtreeFlags&8772)for(l=l.child;l!==null;)OC(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"&&RC(l,l.return,c),Vl(l);break;case 27:En&&Pw(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++)mT(k[y],I)}catch(et){ie(h,h.return,et)}}c&&w&64&&AC(b),Rf(b,b.return);break;case 27:En&&MC(b);case 26:case 5:xo(y,b,c),c&&h===null&&w&4&&TC(b),Rf(b,b.return);break;case 12:xo(y,b,c);break;case 31:xo(y,b,c),c&&w&4&&zC(y,b);break;case 13:xo(y,b,c),c&&w&4&&NC(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 J0(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 $0(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;)LC(r,l,c,h),l=l.sibling}function LC(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&&J0(w,l);break;case 24:Ia(r,l,c,h),y&2048&&$0(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&&J0(w.alternate,w);break;case 24:nu(b,w,I,k,y),y&&et&2048&&$0(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&&J0(h.alternate,h);break;case 24:Tf(c,h),y&2048&&$0(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;)BC(r,l,c),r=r.sibling}function BC(r,l,c){switch(r.tag){case 26:if(jl(r,l,c),r.flags&Eu)if(r.memoizedState!==null)_B(c,La,r.memoizedState,r.memoizedProps);else{var h=r.stateNode,y=r.type;r=r.memoizedProps,((l&335544128)===l||SS(y,r))&&bw(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||SS(y,r))&&bw(c,h,y,r));break;case 3:case 4:Da?(h=La,La=ES(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 PC(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,UC(h,r)}PC(r)}if(r.subtreeFlags&10256)for(r=r.child;r!==null;)HC(r),r=r.sibling}function HC(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,Dp(r)):Cf(r);break;default:Cf(r)}}function Dp(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,UC(h,r)}PC(r)}for(r=r.child;r!==null;){switch(l=r,l.tag){case 0:case 11:case 15:br(8,l,l.return),Dp(l);break;case 22:c=l.stateNode,c._visibility&2&&(c._visibility&=-3,Dp(l));break;default:Dp(l)}r=r.sibling}}function UC(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(_C(h),h===c){_n=null;break t}if(y!==null){y.return=b,_n=y;break t}_n=b}}}function tS(r){var l=p5(r);if(l!=null){if(typeof l.memoizedProps["data-testname"]!="string")throw Error(i(364));return l}if(r=C5(r),r===null)throw Error(i(362));return r.stateNode.current}function eS(r,l){var c=r.tag;switch(l.$$typeof){case em:if(r.type===l.value)return!0;break;case nm: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&&eS(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 im:if((c===5||c===26||c===27)&&O5(r.stateNode,l.value))return!0;break;case om:if((c===5||c===6||c===26||c===27)&&(r=M5(r),r!==null&&0<=r.indexOf(l.value)))return!0;break;case am: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 nS(r){switch(r.$$typeof){case em:return"<"+(f(r.value)||"Unknown")+">";case nm:return":has("+(nS(r)||"")+")";case im:return'[role="'+r.value+'"]';case om:return'"'+r.value+'"';case am:return'[data-testname="'+r.value+'"]';default:throw Error(i(365))}}function VC(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&&eS(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 iS(r,l){if(!Of)throw Error(i(363));r=tS(r),r=VC(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():g5()}function jC(){if(Fi===0)if(!(Qt&536870912)||Kt){var r=qp;qp<<=1,!(qp&3932160)&&(qp=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 qC(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?Q4(r,l):oS(r,l,!0),b=h;do{if(y===0){Au&&!h&&xr(r,l,0,!1);break}else{if(c=r.current.alternate,b&&!k4(c)){y=oS(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=oS(I,w,!1),w!==2){if(VS&&!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=rm+300-Si(),10<y)){if(xr(h,l,Fi,!Mr),T(h,0,!0)!==0)break t;Oo=l,h.timeoutHandle=d5(FC.bind(null,h,c,xi,lm,qS,l,Fi,Wl,Ru,Mr,b,"Throttled",-0,0),y);break t}FC(h,c,xi,lm,qS,l,Fi,Wl,Ru,Mr,b,null,-0,0)}}break}while(!0);L(r)}function FC(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=x5(),BC(l,b,ot);var qn=(b&62914560)===b?rm-Si():(b&4194048)===b?Xw-Si():0;if(qn=E5(ot,qn),qn!==null){Oo=b,r.cancelPendingCommit=qn(JC.bind(null,r,l,b,c,h,y,w,I,k,ct,ot,null,gt,Bt)),xr(r,b,w,!et);return}}JC(r,l,b,c,h,y,w,I,k)}function k4(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&=~jS,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 GC(){return Ft&6?!0:($(0,!1),!1)}function aS(){if(Gt!==null){if(fe===0)var r=Gt.return;else r=Gt,To=kl=null,T0(r),yu=null,Lf=0,r=Gt;for(;r!==null;)EC(r.alternate,r),r=r.return;Gt=null}}function iu(r,l){var c=r.timeoutHandle;c!==Fl&&(r.timeoutHandle=Fl,h5(c)),c=r.cancelPendingCommit,c!==null&&(r.cancelPendingCommit=null,c()),Oo=0,aS(),Ae=r,Gt=c=Eo(r.current,null),Qt=l,fe=0,qi=null,Mr=!1,Au=A(r,l),VS=!1,Ru=Fi=jS=Wl=Or=Xe=0,xi=Uf=null,qS=!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,gp(),c}function kC(r,l){Pt=null,wt.H=Pf,l===gu||l===Zp?(l=$a(),fe=3):l===NS?(l=$a(),fe=4):fe=l===PS?8:l!==null&&typeof l=="object"&&typeof l.then=="function"?6:1,qi=l,Gt===null&&(Xe=1,Cp(r,lt(l,r.current)))}function YC(){var r=ji.current;return r===null?!0:(Qt&4194048)===Qt?ha===null:(Qt&62914560)===Qt||Qt&536870912?r===ha:!1}function QC(){var r=wt.H;return wt.H=Pf,r===null?Pf:r}function XC(){var r=wt.A;return wt.A=kB,r}function Lp(){Xe=4,Mr||(Qt&4194048)!==Qt&&ji.current!==null||(Au=!0),!(Or&134217727)&&!(Wl&134217727)||Ae===null||xr(Ae,Qt,Fi,!1)}function oS(r,l,c){var h=Ft;Ft|=2;var y=QC(),b=XC();(Ae!==r||Qt!==l)&&(lm=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:aS(),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)}}Y4(),w=Xe;break}catch(ct){kC(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,gp()),w}function Y4(){for(;Gt!==null;)KC(Gt)}function Q4(r,l){var c=Ft;Ft|=2;var h=QC(),y=XC();Ae!==r||Qt!==l?(lm=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,ZC(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,ZC(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?Lw(w):Sw(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,Bp(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:aS(),Xe=6;break t;default:throw Error(i(462))}}X4();break}catch(gt){kC(r,gt)}while(!0);return To=kl=null,wt.H=h,wt.A=y,Ft=c,Gt!==null?0:(Ae=null,Qt=0,gp(),Xe)}function X4(){for(;Gt!==null&&!DB();)KC(Gt)}function KC(r){var l=yC(r.alternate,r,Mo);r.memoizedProps=r.pendingProps,l===null?Bp(r):Gt=l}function ZC(r){var l=r,c=l.alternate;switch(l.tag){case 15:case 0:l=fC(c,l,l.pendingProps,l.type,void 0,Qt);break;case 11:l=fC(c,l,l.pendingProps,l.type.render,l.ref,Qt);break;case 5:T0(l);default:EC(c,l),l=Gt=rw(l,Mo),l=yC(c,l,Mo)}r.memoizedProps=r.pendingProps,l===null?Bp(r):Gt=l}function au(r,l,c,h){To=kl=null,T0(l),yu=null,Lf=0;var y=l.return;try{if(H4(r,y,l,c,Qt)){Xe=1,Cp(r,lt(c,r.current)),Gt=null;return}}catch(b){if(y!==null)throw Gt=y,b;Xe=1,Cp(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))),WC(l,r)):Bp(l)}function Bp(r){var l=r;do{if(l.flags&32768){WC(l,Mr);return}r=l.return;var c=j4(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 WC(r,l){do{var c=q4(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 JC(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|=IS,z(r,c,b,w,I,k),r===Ae&&(Gt=Ae=null,Qt=0),Tu=l,zr=r,Oo=c,FS=b,GS=y,Kw=h,l.subtreeFlags&10256||l.flags&10256?(r.callbackNode=null,r.callbackPriority=0,J4(TS,function(){return iw(),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{F4(r,l,c)}finally{Ft=w,On(y),wt.T=h}}An=1,$C(),tw(),ew()}}function $C(){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{IC(l,r),c5(r.containerInfo)}finally{Ft=y,On(h),wt.T=c}}r.current=l,An=2}}function tw(){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{OC(r,l.alternate,l)}finally{Ft=y,On(h),wt.T=c}}An=3}}function ew(){if(An===4||An===3){An=0,LB();var r=zr,l=Tu,c=Oo,h=Kw;l.subtreeFlags&10256||l.flags&10256?An=5:(An=0,Tu=zr=null,nw(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===kS?jf++:(jf=0,kS=r):jf=0,$n&&SB(),$(0,!1)}}function nw(r,l){(r.pooledCacheLanes&=l)===0&&(l=r.pooledCache,l!=null&&(r.pooledCache=null,vt(l)))}function wf(){return $C(),tw(),ew(),iw()}function iw(){if(An!==5)return!1;var r=zr,l=FS;FS=0;var c=U(Oo),h=32>c?32:c;c=wt.T;var y=Ro();try{On(h),wt.T=null,h=GS,GS=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,HC(b.current),LC(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,nw(r,l)}}function aw(r,l,c){l=lt(c,l),l=P0(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)aw(r,r,c);else for(;l!==null;){if(l.tag===3){aw(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=iC(2),h=yr(l,c,2),h!==null&&(aC(c,h,l,r),M(h,2),L(h));break}}l=l.return}}function rS(r,l,c){var h=r.pingCache;if(h===null){h=r.pingCache=new YB;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)||(VS=!0,y.add(c),r=K4.bind(null,r,l,c),l.then(r,r))}function K4(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()-rm?!(Ft&2)&&iu(r,0):jS|=c,Ru===Qt&&(Ru=0)),L(r)}function ow(r,l){l===0&&(l=R()),r=Hl(r,l),r!==null&&(M(r,l),L(r))}function Z4(r){var l=r.memoizedState,c=0;l!==null&&(c=l.retryLane),ow(r,c)}function W4(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),ow(r,c)}function J4(r,l){return Gp(r,l)}function $4(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 lS(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 rw(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 Pp(r,l,c,h,y,b){var w=0;if(h=r,typeof r=="function")lS(r)&&(w=1);else if(typeof r=="string")w=Da&&En?Ow(r,c,Vn.current)?26:Hw(r)?27:5:Da?Ow(r,c,Vn.current)?26:5:En&&Hw(r)?27:5;else t:switch(r){case yS:return r=e(31,c,l,y),r.elementType=yS,r.lanes=b,r;case ru:return ql(c.children,y,b,l);case hw:w=8,y|=24;break;case dS:return r=e(12,c,l,y|2),r.elementType=dS,r.lanes=b,r;case pS:return r=e(13,c,l,y),r.elementType=pS,r.lanes=b,r;case mS:return r=e(19,c,l,y),r.elementType=mS,r.lanes=b,r;default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case Er:w=10;break t;case pw:w=9;break t;case hS:w=11;break t;case gS: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 sS(r,l,c){return r=e(6,r,null,l),r.lanes=c,r}function lw(r){var l=e(18,null,null,0);return l.stateNode=r,l}function uS(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 t5(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 sw(r,l,c,h,y,b,w,I,k,et,ct,ot){return r=new t5(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},m0(b),r}function uw(r){return r?(r=cu,r):cu}function cw(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 fw(r,l,c,h,y,b){y=uw(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 dw(r,l){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var c=r.retryLane;r.retryLane=c!==0&&c<l?c:l}}function cS(r,l){dw(r,l),(r=r.alternate)&&dw(r,l)}var qt={},e5=nt(),Pi=Lb(),fS=Object.assign,n5=Symbol.for("react.element"),Hp=Symbol.for("react.transitional.element"),ou=Symbol.for("react.portal"),ru=Symbol.for("react.fragment"),hw=Symbol.for("react.strict_mode"),dS=Symbol.for("react.profiler"),pw=Symbol.for("react.consumer"),Er=Symbol.for("react.context"),hS=Symbol.for("react.forward_ref"),pS=Symbol.for("react.suspense"),mS=Symbol.for("react.suspense_list"),gS=Symbol.for("react.memo"),Ar=Symbol.for("react.lazy");Symbol.for("react.scope");var yS=Symbol.for("react.activity");Symbol.for("react.legacy_hidden"),Symbol.for("react.tracing_marker");var i5=Symbol.for("react.memo_cache_sentinel");Symbol.for("react.view_transition");var mw=Symbol.iterator,a5=Symbol.for("react.client.reference"),Up=Array.isArray,wt=e5.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,o5=t.rendererVersion,r5=t.rendererPackageName,gw=t.extraDevToolsConfig,Mf=t.getPublicInstance,l5=t.getRootHostContext,s5=t.getChildHostContext,u5=t.prepareForCommit,c5=t.resetAfterCommit,f5=t.createInstance;t.cloneMutableInstance;var vS=t.appendInitialChild,yw=t.finalizeInitialChildren,Vp=t.shouldSetTextContent,vw=t.createTextInstance;t.cloneMutableTextInstance;var d5=t.scheduleTimeout,h5=t.cancelTimeout,Fl=t.noTimeout,Ao=t.isPrimaryRenderer;t.warnsIfNotActing;var Jn=t.supportsMutation,eo=t.supportsPersistence,$n=t.supportsHydration,p5=t.getInstanceFromNode;t.beforeActiveInstanceBlur;var m5=t.preparePortalMount;t.prepareScopeUpdate,t.getInstanceFromScope;var On=t.setCurrentUpdatePriority,Ro=t.getCurrentUpdatePriority,g5=t.resolveUpdatePriority;t.trackSchedulerEvent,t.resolveEventType,t.resolveEventTimeStamp;var y5=t.shouldAttemptEagerTransition,v5=t.detachDeletedInstance;t.requestPostPaintCallback;var S5=t.maySuspendCommit,b5=t.maySuspendCommitOnUpdate,SS=t.maySuspendCommitInSyncRender,Sw=t.preloadInstance,x5=t.startSuspendingCommit,bw=t.suspendInstance;t.suspendOnActiveViewTransition;var E5=t.waitForCommitToBeReady;t.getSuspendedCommitReason;var lu=t.NotPendingTransition,Gl=t.HostTransitionContext,A5=t.resetFormInstance;t.bindToConsole;var R5=t.supportsMicrotasks,T5=t.scheduleMicrotask,Of=t.supportsTestSelectors,C5=t.findFiberRoot,w5=t.getBoundingRect,M5=t.getTextContent,_f=t.isHiddenSubtree,O5=t.matchAccessibilityRole,_5=t.setFocusIfFocusable,z5=t.setupIntersectionObserver,N5=t.appendChild,I5=t.appendChildToContainer,D5=t.commitTextUpdate,L5=t.commitMount,B5=t.commitUpdate,P5=t.insertBefore,H5=t.insertInContainerBefore,U5=t.removeChild,V5=t.removeChildFromContainer,xw=t.resetTextContent,j5=t.hideInstance,q5=t.hideTextInstance,F5=t.unhideInstance,G5=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 k5=t.clearContainer;t.createFragmentInstance,t.updateFragmentInstanceFiber,t.commitNewChildToFragmentInstance,t.deleteChildFromFragmentInstance;var Y5=t.cloneInstance,Ew=t.createContainerChildSet,Aw=t.appendChildToContainerChildSet,Q5=t.finalizeContainerChildren,Rw=t.replaceContainerChildren,Tw=t.cloneHiddenInstance,Cw=t.cloneHiddenTextInstance,bS=t.isSuspenseInstancePending,xS=t.isSuspenseInstanceFallback,X5=t.getSuspenseInstanceFallbackErrorDetails,K5=t.registerSuspenseInstanceRetry,Z5=t.canHydrateFormStateMarker,W5=t.isFormStateMarkerMatching,ww=t.getNextHydratableSibling,J5=t.getNextHydratableSiblingAfterSingleton,$5=t.getFirstHydratableChild,tB=t.getFirstHydratableChildWithinContainer,eB=t.getFirstHydratableChildWithinActivityInstance,nB=t.getFirstHydratableChildWithinSuspenseInstance,iB=t.getFirstHydratableChildWithinSingleton,aB=t.canHydrateInstance,oB=t.canHydrateTextInstance,rB=t.canHydrateActivityInstance,lB=t.canHydrateSuspenseInstance,sB=t.hydrateInstance,uB=t.hydrateTextInstance,cB=t.hydrateActivityInstance,fB=t.hydrateSuspenseInstance,dB=t.getNextHydratableInstanceAfterActivityInstance,hB=t.getNextHydratableInstanceAfterSuspenseInstance,pB=t.commitHydratedInstance,mB=t.commitHydratedContainer,gB=t.commitHydratedActivityInstance,yB=t.commitHydratedSuspenseInstance,vB=t.finalizeHydratedChildren,SB=t.flushHydrationEvents;t.clearActivityBoundary;var bB=t.clearSuspenseBoundary;t.clearActivityBoundaryFromContainer;var xB=t.clearSuspenseBoundaryFromContainer,EB=t.hideDehydratedBoundary,AB=t.unhideDehydratedBoundary,Mw=t.shouldDeleteUnhydratedTailInstances;t.diffHydratedPropsForDevWarnings,t.diffHydratedTextForDevWarnings,t.describeHydratableInstanceForDevWarnings;var RB=t.validateHydratableInstance,TB=t.validateHydratableTextInstance,Da=t.supportsResources,Ow=t.isHostHoistableType,ES=t.getHoistableRoot,_w=t.getResource,zw=t.acquireResource,Nw=t.releaseResource,CB=t.hydrateHoistable,Iw=t.mountHoistable,Dw=t.unmountHoistable,wB=t.createHoistableInstance,MB=t.prepareToCommitHoistables,OB=t.mayResourceSuspendCommit,Lw=t.preloadResource,_B=t.suspendResource,En=t.supportsSingletons,Bw=t.resolveSingletonInstance,zB=t.acquireSingletonInstance,Pw=t.releaseSingletonInstance,Hw=t.isHostSingletonType,su=t.isSingletonScope,AS=[],uu=-1,cu={},Hi=Math.clz32?Math.clz32:S,NB=Math.log,IB=Math.LN2,jp=256,qp=262144,Fp=4194304,Gp=Pi.unstable_scheduleCallback,RS=Pi.unstable_cancelCallback,DB=Pi.unstable_shouldYield,LB=Pi.unstable_requestPaint,Si=Pi.unstable_now,Uw=Pi.unstable_ImmediatePriority,BB=Pi.unstable_UserBlockingPriority,TS=Pi.unstable_NormalPriority,PB=Pi.unstable_IdlePriority,HB=Pi.log,UB=Pi.unstable_setDisableYieldValue,zf=null,Ui=null,Vi=typeof Object.is=="function"?Object.is:at,Vw=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)},VB=Object.prototype.hasOwnProperty,CS,jw,wS=!1,qw=new WeakMap,fu=[],du=0,kp=null,Nf=0,ua=[],ca=0,Rr=null,no=1,io="",Vn=m(null),If=m(null),Tr=m(null),Yp=m(null),jn=null,Ue=null,Kt=!1,Cr=null,fa=!1,MS=Error(i(519)),Qp=m(null),kl=null,To=null,jB=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()})}},qB=Pi.unstable_scheduleCallback,FB=Pi.unstable_NormalPriority,Ve={$$typeof:Er,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0},Xp=null,hu=null,OS=!1,Kp=!1,_S=!1,Yl=0,Df=null,zS=0,pu=0,mu=null,Fw=wt.S;wt.S=function(r,l){Xw=Si(),typeof l=="object"&&l!==null&&typeof l.then=="function"&&yt(r,l),Fw!==null&&Fw(r,l)};var Ql=m(null),gu=Error(i(460)),NS=Error(i(474)),Zp=Error(i(542)),Wp={then:function(){}},Xl=null,yu=null,Lf=0,Kl=hT(!0),Gw=hT(!1),da=[],vu=0,IS=0,wr=!1,DS=!1,Su=m(null),Jp=m(0),ji=m(null),ha=null,nn=m(0),Co=0,Pt=null,Se=null,sn=null,$p=!1,bu=!1,Zl=!1,tm=0,Bf=0,xu=null,GB=0,Pf={readContext:B,use:xp,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 kw={readContext:B,use:xp,useCallback:function(r,l){return li().memoizedState=[r,l===void 0?null:l],r},useContext:B,useEffect:HT,useImperativeHandle:function(r,l,c){c=c!=null?c.concat([r]):null,Ap(4194308,4,qT.bind(null,l,r),c)},useLayoutEffect:function(r,l){return Ap(4194308,4,r,l)},useInsertionEffect:function(r,l){Ap(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=P4.bind(null,Pt,r),[h.memoizedState,r]},useRef:function(r){var l=li();return r={current:r},l.memoizedState=r},useState:function(r){r=O0(r);var l=r.queue,c=WT.bind(null,Pt,l);return l.dispatch=c,[r.memoizedState,c]},useDebugValue:N0,useDeferredValue:function(r,l){var c=li();return I0(c,r,l)},useTransition:function(){var r=O0(!1);return r=QT.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||ET(h,l,c)}y.memoizedState=c;var b={value:c,getSnapshot:l};return y.queue=b,HT(RT.bind(null,h,b,r),[r]),h.flags|=2048,eu(9,{destroy:void 0},AT.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=tm++,0<c&&(l+="H"+c.toString(32)),l+="_"}else c=GB++,l="_"+l+"r_"+c.toString(32)+"_";return r.memoizedState=l},useHostTransitionStatus:D0,useFormState:IT,useActionState:IT,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=L0.bind(null,Pt,!0,c),c.dispatch=l,[r,l]},useMemoCache:C0,useCacheRefresh:function(){return li().memoizedState=B4.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)}}},LS={readContext:B,use:xp,useCallback:GT,useContext:B,useEffect:z0,useImperativeHandle:FT,useInsertionEffect:VT,useLayoutEffect:jT,useMemo:kT,useReducer:Ep,useRef:PT,useState:function(){return Ep(vo)},useDebugValue:N0,useDeferredValue:function(r,l){var c=en();return YT(c,Se.memoizedState,r,l)},useTransition:function(){var r=Ep(vo)[0],l=en().memoizedState;return[typeof r=="boolean"?r:Sf(r),l]},useSyncExternalStore:xT,useId:KT,useHostTransitionStatus:D0,useFormState:DT,useActionState:DT,useOptimistic:function(r,l){var c=en();return wT(c,Se,r,l)},useMemoCache:C0,useCacheRefresh:ZT};LS.useEffectEvent=UT;var Yw={readContext:B,use:xp,useCallback:GT,useContext:B,useEffect:z0,useImperativeHandle:FT,useInsertionEffect:VT,useLayoutEffect:jT,useMemo:kT,useReducer:M0,useRef:PT,useState:function(){return M0(vo)},useDebugValue:N0,useDeferredValue:function(r,l){var c=en();return Se===null?I0(c,r,l):YT(c,Se.memoizedState,r,l)},useTransition:function(){var r=M0(vo)[0],l=en().memoizedState;return[typeof r=="boolean"?r:Sf(r),l]},useSyncExternalStore:xT,useId:KT,useHostTransitionStatus:D0,useFormState:BT,useActionState:BT,useOptimistic:function(r,l){var c=en();return Se!==null?wT(c,Se,r,l):(c.baseState=r,[r,c.queue.dispatch])},useMemoCache:C0,useCacheRefresh:ZT};Yw.useEffectEvent=UT;var BS={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))}},PS=Error(i(461)),un=!1,HS={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null},wo=!1,cn=!1,US=!1,Qw=typeof WeakSet=="function"?WeakSet:Set,_n=null,fn=null,bi=!1,La=null,Eu=8192,kB={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}},em=0,nm=1,im=2,am=3,om=4;if(typeof Symbol=="function"&&Symbol.for){var Hf=Symbol.for;em=Hf("selector.component"),nm=Hf("selector.has_pseudo_class"),im=Hf("selector.role"),am=Hf("selector.test_id"),om=Hf("selector.text")}var YB=typeof WeakMap=="function"?WeakMap:Map,Ft=0,Ae=null,Gt=null,Qt=0,fe=0,qi=null,Mr=!1,Au=!1,VS=!1,Mo=0,Xe=0,Or=0,Wl=0,jS=0,Fi=0,Ru=0,Uf=null,xi=null,qS=!1,rm=0,Xw=0,Vf=1/0,lm=null,_r=null,An=0,zr=null,Tu=null,Oo=0,FS=0,GS=null,Kw=null,jf=0,kS=null;return qt.attemptContinuousHydration=function(r){if(r.tag===13||r.tag===31){var l=Hl(r,67108864);l!==null&&vi(l,r,67108864),cS(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),cS(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),GC(),cS(r,2)}},qt.batchedUpdates=function(r,l){return r(l)},qt.createComponentSelector=function(r){return{$$typeof:em,value:r}},qt.createContainer=function(r,l,c,h,y,b,w,I,k,et){return sw(r,l,!1,null,c,h,b,null,w,I,k,et)},qt.createHasPseudoClassSelector=function(r){return{$$typeof:nm,value:r}},qt.createHydrationContainer=function(r,l,c,h,y,b,w,I,k,et,ct,ot,gt,Bt){return r=sw(c,h,!0,r,y,b,I,Bt,k,et,ct,ot),r.context=uw(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:im,value:r}},qt.createTestNameSelector=function(r){return{$$typeof:am,value:r}},qt.createTextSelector=function(r){return{$$typeof:om,value:r}},qt.defaultOnCaughtError=function(r){console.error(r)},qt.defaultOnRecoverableError=function(r){Vw(r)},qt.defaultOnUncaughtError=function(r){Vw(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=iS,qt.findBoundingRects=function(r,l){if(!Of)throw Error(i(363));l=iS(r,l),r=[];for(var c=0;c<l.length;c++)r.push(w5(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=cw,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 cw(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=GC,qt.focusWithin=function(r,l){if(!Of)throw Error(i(363));for(r=tS(r),l=VC(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)&&_5(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=[tS(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))&&(eS(b,k)&&(h.push(nS(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(nS(l[c]));return`findAllNodes was able to match part of the selector:
9
9
  `+(h.join(" > ")+`
10
10
 
11
11
  No matching component was found for:
12
- `)+r.join(" > ")}return null},qt.getPublicRootInstance=function(r){if(r=r.current,!r.child)return null;switch(r.child.tag){case 27:case 5:return Af(r.child.stateNode);default:return r.child.stateNode}},qt.injectIntoDevTools=function(){var r={bundleType:0,version:G4,rendererPackageName:k4,currentDispatcherRef:wt,reconcilerVersion:"19.2.0"};if(aw!==null&&(r.rendererConfig=aw),typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")r=!1;else{var l=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(l.isDisabled||!l.supportsFiber)r=!0;else{try{wf=l.inject(r),Ui=l}catch{}r=!!l.checkDCE}}return r},qt.isAlreadyRendering=function(){return(Ft&6)!==0},qt.observeVisibleRects=function(r,l,c,h){if(!Tf)throw Error(i(363));r=Z0(r,l);var y=g5(r,c,h).disconnect;return{disconnect:function(){y()}}},qt.shouldError=function(){return null},qt.shouldSuspend=function(){return!1},qt.startHostTransition=function(r,l,c,h){if(r.tag!==5)throw Error(i(476));var y=PT(r).queue;LT(r,y,l,au,c===null?n:function(){var b=PT(r);return b.next===null&&(b=r.alternate.memoizedState),gf(r,b.next.queue,{},Pi()),c(h)})},qt.updateContainer=function(r,l,c,h){var y=l.current,b=Pi();return $C(y,b,r,l,c,h),b},qt.updateContainerSync=function(r,l,c,h){return $C(l.current,2,r,l,c,h),2},qt};ld.exports.default=ld.exports;Object.defineProperty(ld.exports,"__esModule",{value:!0})});var ZM=ui((Vk,KM)=>{"use strict";KM.exports=XM()});var ds=ui((rY,VO)=>{"use strict";VO.exports=ReactDOM});var W3=ui(My=>{"use strict";var Cn=Ab(),dz=nt(),fU=ds();function J(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 hz(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function Kd(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 pz(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 mz(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 jO(t){if(Kd(t)!==t)throw Error(J(188))}function dU(t){var e=t.alternate;if(!e){if(e=Kd(t),e===null)throw Error(J(188));return e!==t?null:t}for(var n=t,i=e;;){var a=n.return;if(a===null)break;var o=a.alternate;if(o===null){if(i=a.return,i!==null){n=i;continue}break}if(a.child===o.child){for(o=a.child;o;){if(o===n)return jO(a),t;if(o===i)return jO(a),e;o=o.sibling}throw Error(J(188))}if(n.return!==i.return)n=a,i=o;else{for(var s=!1,u=a.child;u;){if(u===n){s=!0,n=a,i=o;break}if(u===i){s=!0,i=a,n=o;break}u=u.sibling}if(!s){for(u=o.child;u;){if(u===n){s=!0,n=o,i=a;break}if(u===i){s=!0,i=o,n=a;break}u=u.sibling}if(!s)throw Error(J(189))}}if(n.alternate!==i)throw Error(J(190))}if(n.tag!==3)throw Error(J(188));return n.stateNode.current===n?t:e}function gz(t){var e=t.tag;if(e===5||e===26||e===27||e===6)return t;for(t=t.child;t!==null;){if(e=gz(t),e!==null)return e;t=t.sibling}return null}var Ne=Object.assign,hU=Symbol.for("react.element"),ag=Symbol.for("react.transitional.element"),yd=Symbol.for("react.portal"),nc=Symbol.for("react.fragment"),yz=Symbol.for("react.strict_mode"),dx=Symbol.for("react.profiler"),vz=Symbol.for("react.consumer"),ko=Symbol.for("react.context"),lE=Symbol.for("react.forward_ref"),hx=Symbol.for("react.suspense"),px=Symbol.for("react.suspense_list"),sE=Symbol.for("react.memo"),qr=Symbol.for("react.lazy");Symbol.for("react.scope");var mx=Symbol.for("react.activity");Symbol.for("react.legacy_hidden");Symbol.for("react.tracing_marker");var pU=Symbol.for("react.memo_cache_sentinel");Symbol.for("react.view_transition");var qO=Symbol.iterator;function cd(t){return t===null||typeof t!="object"?null:(t=qO&&t[qO]||t["@@iterator"],typeof t=="function"?t:null)}var mU=Symbol.for("react.client.reference");function gx(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===mU?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case nc:return"Fragment";case dx:return"Profiler";case yz:return"StrictMode";case hx:return"Suspense";case px:return"SuspenseList";case mx:return"Activity"}if(typeof t=="object")switch(t.$$typeof){case yd:return"Portal";case ko:return t.displayName||"Context";case vz:return(t._context.displayName||"Context")+".Consumer";case lE:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case sE:return e=t.displayName||null,e!==null?e:gx(t.type)||"Memo";case qr:e=t._payload,t=t._init;try{return gx(t(e))}catch{}}return null}var vd=Array.isArray,_t=dz.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ue=fU.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,vs={pending:!1,data:null,method:null,action:null},yx=[],ic=-1;function ho(t){return{current:t}}function Dn(t){0>ic||(t.current=yx[ic],yx[ic]=null,ic--)}function Me(t,e){ic++,yx[ic]=t.current,t.current=e}var fo=ho(null),Ld=ho(null),$r=ho(null),Bg=ho(null);function Hg(t,e){switch(Me($r,e),Me(Ld,t),Me(fo,null),e.nodeType){case 9:case 11:t=(t=e.documentElement)&&(t=t.namespaceURI)?K_(t):0;break;default:if(t=e.tagName,e=e.namespaceURI)e=K_(e),t=H3(e,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}Dn(fo),Me(fo,t)}function xc(){Dn(fo),Dn(Ld),Dn($r)}function vx(t){t.memoizedState!==null&&Me(Bg,t);var e=fo.current,n=H3(e,t.type);e!==n&&(Me(Ld,t),Me(fo,n))}function Ug(t){Ld.current===t&&(Dn(fo),Dn(Ld)),Bg.current===t&&(Dn(Bg),Yd._currentValue=vs)}var Ib,FO;function ps(t){if(Ib===void 0)try{throw Error()}catch(n){var e=n.stack.trim().match(/\n( *(at )?)/);Ib=e&&e[1]||"",FO=-1<n.stack.indexOf(`
12
+ `)+r.join(" > ")}return null},qt.getPublicRootInstance=function(r){if(r=r.current,!r.child)return null;switch(r.child.tag){case 27:case 5:return Mf(r.child.stateNode);default:return r.child.stateNode}},qt.injectIntoDevTools=function(){var r={bundleType:0,version:o5,rendererPackageName:r5,currentDispatcherRef:wt,reconcilerVersion:"19.2.0"};if(gw!==null&&(r.rendererConfig=gw),typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")r=!1;else{var l=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(l.isDisabled||!l.supportsFiber)r=!0;else{try{zf=l.inject(r),Ui=l}catch{}r=!!l.checkDCE}}return r},qt.isAlreadyRendering=function(){return(Ft&6)!==0},qt.observeVisibleRects=function(r,l,c,h){if(!Of)throw Error(i(363));r=iS(r,l);var y=z5(r,c,h).disconnect;return{disconnect:function(){y()}}},qt.shouldError=function(){return null},qt.shouldSuspend=function(){return!1},qt.startHostTransition=function(r,l,c,h){if(r.tag!==5)throw Error(i(476));var y=XT(r).queue;QT(r,y,l,lu,c===null?n:function(){var b=XT(r);return b.next===null&&(b=r.alternate.memoizedState),bf(r,b.next.queue,{},Bi()),c(h)})},qt.updateContainer=function(r,l,c,h){var y=l.current,b=Bi();return fw(y,b,r,l,c,h),b},qt.updateContainerSync=function(r,l,c,h){return fw(l.current,2,r,l,c,h),2},qt};fd.exports.default=fd.exports;Object.defineProperty(fd.exports,"__esModule",{value:!0})});var cO=ui((iY,uO)=>{"use strict";uO.exports=sO()});var ms=ui((AY,t_)=>{"use strict";t_.exports=ReactDOM});var dI=ui(Ly=>{"use strict";var Cn=Lb(),Cz=nt(),AU=ms();function W(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 wz(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function $d(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 Mz(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 Oz(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 e_(t){if($d(t)!==t)throw Error(W(188))}function RU(t){var e=t.alternate;if(!e){if(e=$d(t),e===null)throw Error(W(188));return e!==t?null:t}for(var n=t,i=e;;){var a=n.return;if(a===null)break;var o=a.alternate;if(o===null){if(i=a.return,i!==null){n=i;continue}break}if(a.child===o.child){for(o=a.child;o;){if(o===n)return e_(a),t;if(o===i)return e_(a),e;o=o.sibling}throw Error(W(188))}if(n.return!==i.return)n=a,i=o;else{for(var s=!1,u=a.child;u;){if(u===n){s=!0,n=a,i=o;break}if(u===i){s=!0,i=a,n=o;break}u=u.sibling}if(!s){for(u=o.child;u;){if(u===n){s=!0,n=o,i=a;break}if(u===i){s=!0,i=o,n=a;break}u=u.sibling}if(!s)throw Error(W(189))}}if(n.alternate!==i)throw Error(W(190))}if(n.tag!==3)throw Error(W(188));return n.stateNode.current===n?t:e}function _z(t){var e=t.tag;if(e===5||e===26||e===27||e===6)return t;for(t=t.child;t!==null;){if(e=_z(t),e!==null)return e;t=t.sibling}return null}var Ne=Object.assign,TU=Symbol.for("react.element"),fg=Symbol.for("react.transitional.element"),xd=Symbol.for("react.portal"),rc=Symbol.for("react.fragment"),zz=Symbol.for("react.strict_mode"),Ax=Symbol.for("react.profiler"),Nz=Symbol.for("react.consumer"),ko=Symbol.for("react.context"),vE=Symbol.for("react.forward_ref"),Rx=Symbol.for("react.suspense"),Tx=Symbol.for("react.suspense_list"),SE=Symbol.for("react.memo"),Gr=Symbol.for("react.lazy");Symbol.for("react.scope");var Cx=Symbol.for("react.activity");Symbol.for("react.legacy_hidden");Symbol.for("react.tracing_marker");var CU=Symbol.for("react.memo_cache_sentinel");Symbol.for("react.view_transition");var n_=Symbol.iterator;function pd(t){return t===null||typeof t!="object"?null:(t=n_&&t[n_]||t["@@iterator"],typeof t=="function"?t:null)}var wU=Symbol.for("react.client.reference");function wx(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===wU?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case rc:return"Fragment";case Ax:return"Profiler";case zz:return"StrictMode";case Rx:return"Suspense";case Tx:return"SuspenseList";case Cx:return"Activity"}if(typeof t=="object")switch(t.$$typeof){case xd:return"Portal";case ko:return t.displayName||"Context";case Nz:return(t._context.displayName||"Context")+".Consumer";case vE:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case SE:return e=t.displayName||null,e!==null?e:wx(t.type)||"Memo";case Gr:e=t._payload,t=t._init;try{return wx(t(e))}catch{}}return null}var Ed=Array.isArray,_t=Cz.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ue=AU.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,xs={pending:!1,data:null,method:null,action:null},Mx=[],lc=-1;function ho(t){return{current:t}}function Dn(t){0>lc||(t.current=Mx[lc],Mx[lc]=null,lc--)}function Me(t,e){lc++,Mx[lc]=t.current,t.current=e}var fo=ho(null),Ud=ho(null),el=ho(null),Gg=ho(null);function kg(t,e){switch(Me(el,e),Me(Ud,t),Me(fo,null),e.nodeType){case 9:case 11:t=(t=e.documentElement)&&(t=t.namespaceURI)?uz(t):0;break;default:if(t=e.tagName,e=e.namespaceURI)e=uz(e),t=J3(e,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}Dn(fo),Me(fo,t)}function Tc(){Dn(fo),Dn(Ud),Dn(el)}function Ox(t){t.memoizedState!==null&&Me(Gg,t);var e=fo.current,n=J3(e,t.type);e!==n&&(Me(Ud,t),Me(fo,n))}function Yg(t){Ud.current===t&&(Dn(fo),Dn(Ud)),Gg.current===t&&(Dn(Gg),Zd._currentValue=xs)}var Gb,i_;function ys(t){if(Gb===void 0)try{throw Error()}catch(n){var e=n.stack.trim().match(/\n( *(at )?)/);Gb=e&&e[1]||"",i_=-1<n.stack.indexOf(`
13
13
  at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
14
- `+Ib+t+FO}var Db=!1;function Lb(t,e){if(!t||Db)return"";Db=!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(v){var g=v}Reflect.construct(t,[],m)}else{try{m.call()}catch(v){g=v}t.call(m.prototype)}}else{try{throw Error()}catch(v){g=v}(m=t())&&typeof m.catch=="function"&&m.catch(function(){})}}catch(v){if(v&&g&&typeof v.stack=="string")return[v.stack,g.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 o=i.DetermineComponentFrameRoot(),s=o[0],u=o[1];if(s&&u){var d=s.split(`
14
+ `+Gb+t+i_}var kb=!1;function Yb(t,e){if(!t||kb)return"";kb=!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(v){var g=v}Reflect.construct(t,[],m)}else{try{m.call()}catch(v){g=v}t.call(m.prototype)}}else{try{throw Error()}catch(v){g=v}(m=t())&&typeof m.catch=="function"&&m.catch(function(){})}}catch(v){if(v&&g&&typeof v.stack=="string")return[v.stack,g.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 o=i.DetermineComponentFrameRoot(),s=o[0],u=o[1];if(s&&u){var d=s.split(`
15
15
  `),p=u.split(`
16
16
  `);for(a=i=0;i<d.length&&!d[i].includes("DetermineComponentFrameRoot");)i++;for(;a<p.length&&!p[a].includes("DetermineComponentFrameRoot");)a++;if(i===d.length||a===p.length)for(i=d.length-1,a=p.length-1;1<=i&&0<=a&&d[i]!==p[a];)a--;for(;1<=i&&0<=a;i--,a--)if(d[i]!==p[a]){if(i!==1||a!==1)do if(i--,a--,0>a||d[i]!==p[a]){var f=`
17
- `+d[i].replace(" at new "," at ");return t.displayName&&f.includes("<anonymous>")&&(f=f.replace("<anonymous>",t.displayName)),f}while(1<=i&&0<=a);break}}}finally{Db=!1,Error.prepareStackTrace=n}return(n=t?t.displayName||t.name:"")?ps(n):""}function gU(t,e){switch(t.tag){case 26:case 27:case 5:return ps(t.type);case 16:return ps("Lazy");case 13:return t.child!==e&&e!==null?ps("Suspense Fallback"):ps("Suspense");case 19:return ps("SuspenseList");case 0:case 15:return Lb(t.type,!1);case 11:return Lb(t.type.render,!1);case 1:return Lb(t.type,!0);case 31:return ps("Activity");default:return""}}function GO(t){try{var e="",n=null;do e+=gU(t,n),n=t,t=t.return;while(t);return e}catch(i){return`
17
+ `+d[i].replace(" at new "," at ");return t.displayName&&f.includes("<anonymous>")&&(f=f.replace("<anonymous>",t.displayName)),f}while(1<=i&&0<=a);break}}}finally{kb=!1,Error.prepareStackTrace=n}return(n=t?t.displayName||t.name:"")?ys(n):""}function MU(t,e){switch(t.tag){case 26:case 27:case 5:return ys(t.type);case 16:return ys("Lazy");case 13:return t.child!==e&&e!==null?ys("Suspense Fallback"):ys("Suspense");case 19:return ys("SuspenseList");case 0:case 15:return Yb(t.type,!1);case 11:return Yb(t.type.render,!1);case 1:return Yb(t.type,!0);case 31:return ys("Activity");default:return""}}function a_(t){try{var e="",n=null;do e+=MU(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 Sx=Object.prototype.hasOwnProperty,uE=Cn.unstable_scheduleCallback,Pb=Cn.unstable_cancelCallback,yU=Cn.unstable_shouldYield,vU=Cn.unstable_requestPaint,Wi=Cn.unstable_now,SU=Cn.unstable_getCurrentPriorityLevel,Sz=Cn.unstable_ImmediatePriority,bz=Cn.unstable_UserBlockingPriority,Vg=Cn.unstable_NormalPriority,bU=Cn.unstable_LowPriority,xz=Cn.unstable_IdlePriority,xU=Cn.log,EU=Cn.unstable_setDisableYieldValue,Zd=null,$i=null;function Xr(t){if(typeof xU=="function"&&EU(t),$i&&typeof $i.setStrictMode=="function")try{$i.setStrictMode(Zd,t)}catch{}}var ta=Math.clz32?Math.clz32:TU,RU=Math.log,AU=Math.LN2;function TU(t){return t>>>=0,t===0?32:31-(RU(t)/AU|0)|0}var og=256,rg=262144,lg=4194304;function ms(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 dy(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=ms(i):(s&=u,s!==0?a=ms(s):n||(n=u&~t,n!==0&&(a=ms(n))))):(u=i&~o,u!==0?a=ms(u):s!==0?a=ms(s):n||(n=i&~t,n!==0&&(a=ms(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 Jd(t,e){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&e)===0}function CU(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 Ez(){var t=lg;return lg<<=1,!(lg&62914560)&&(lg=4194304),t}function Bb(t){for(var e=[],n=0;31>n;n++)e.push(t);return e}function Wd(t,e){t.pendingLanes|=e,e!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function wU(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&&Rz(t,i,0),o!==0&&a===0&&t.tag!==0&&(t.suspendedLanes|=o&~(s&~e))}function Rz(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 Az(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 Tz(t,e){var n=e&-e;return n=n&42?1:cE(n),n&(t.suspendedLanes|e)?0:n}function cE(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 fE(t){return t&=-t,2<t?8<t?t&134217727?32:268435456:8:2}function Cz(){var t=ue.p;return t!==0?t:(t=window.event,t===void 0?32:K3(t.type))}function kO(t,e){var n=ue.p;try{return ue.p=t,e()}finally{ue.p=n}}var dl=Math.random().toString(36).slice(2),Gn="__reactFiber$"+dl,Mi="__reactProps$"+dl,Nc="__reactContainer$"+dl,bx="__reactEvents$"+dl,MU="__reactListeners$"+dl,OU="__reactHandles$"+dl,YO="__reactResources$"+dl,$d="__reactMarker$"+dl;function dE(t){delete t[Gn],delete t[Mi],delete t[bx],delete t[MU],delete t[OU]}function ac(t){var e=t[Gn];if(e)return e;for(var n=t.parentNode;n;){if(e=n[Nc]||n[Gn]){if(n=e.alternate,e.child!==null||n!==null&&n.child!==null)for(t=tz(t);t!==null;){if(n=t[Gn])return n;t=tz(t)}return e}t=n,n=t.parentNode}return null}function Ic(t){if(t=t[Gn]||t[Nc]){var e=t.tag;if(e===5||e===6||e===13||e===31||e===26||e===27||e===3)return t}return null}function Sd(t){var e=t.tag;if(e===5||e===26||e===27||e===6)return t.stateNode;throw Error(J(33))}function pc(t){var e=t[YO];return e||(e=t[YO]={hoistableStyles:new Map,hoistableScripts:new Map}),e}function In(t){t[$d]=!0}var wz=new Set,Mz={};function Ms(t,e){Ec(t,e),Ec(t+"Capture",e)}function Ec(t,e){for(Mz[t]=e,t=0;t<e.length;t++)wz.add(e[t])}var _U=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]*$"),QO={},XO={};function zU(t){return Sx.call(XO,t)?!0:Sx.call(QO,t)?!1:_U.test(t)?XO[t]=!0:(QO[t]=!0,!1)}function Eg(t,e,n){if(zU(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 sg(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 Oz(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function NU(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 xx(t){if(!t._valueTracker){var e=Oz(t)?"checked":"value";t._valueTracker=NU(t,e,""+t[e])}}function _z(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),i="";return t&&(i=Oz(t)?t.checked?"true":"false":t.value),t=i,t!==n?(e.setValue(t),!0):!1}function jg(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 IU=/[\n"\\]/g;function Ea(t){return t.replace(IU,function(e){return"\\"+e.charCodeAt(0).toString(16)+" "})}function Ex(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?Rx(t,s,Sa(e)):n!=null?Rx(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 zz(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)){xx(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),xx(t)}function Rx(t,e,n){e==="number"&&jg(t.ownerDocument)===t||t.defaultValue===""+n||(t.defaultValue=""+n)}function mc(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 Nz(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 Iz(t,e,n,i){if(e==null){if(i!=null){if(n!=null)throw Error(J(92));if(vd(i)){if(1<i.length)throw Error(J(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),xx(t)}function Rc(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var DU=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 KO(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||DU.has(e)?e==="float"?t.cssFloat=n:t[e]=(""+n).trim():t[e]=n+"px"}function Dz(t,e,n){if(e!=null&&typeof e!="object")throw Error(J(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&&KO(t,a,i)}else for(var o in e)e.hasOwnProperty(o)&&KO(t,o,e[o])}function hE(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 LU=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"]]),PU=/^[\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 Rg(t){return PU.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}function Yo(){}var Ax=null;function pE(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var oc=null,gc=null;function ZO(t){var e=Ic(t);if(e&&(t=e.stateNode)){var n=t[Mi]||null;t:switch(t=e.stateNode,e.type){case"input":if(Ex(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(J(90));Ex(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&&_z(i)}break t;case"textarea":Nz(t,n.value,n.defaultValue);break t;case"select":e=n.value,e!=null&&mc(t,!!n.multiple,e,!1)}}}var Hb=!1;function Lz(t,e,n){if(Hb)return t(e,n);Hb=!0;try{var i=t(e);return i}finally{if(Hb=!1,(oc!==null||gc!==null)&&(Ay(),oc&&(e=oc,t=gc,gc=oc=null,ZO(e),t)))for(e=0;e<t.length;e++)ZO(t[e])}}function Pd(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(J(231,e,typeof n));return n}var Jo=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Tx=!1;if(Jo)try{Ju={},Object.defineProperty(Ju,"passive",{get:function(){Tx=!0}}),window.addEventListener("test",Ju,Ju),window.removeEventListener("test",Ju,Ju)}catch{Tx=!1}var Ju,Kr=null,mE=null,Ag=null;function Pz(){if(Ag)return Ag;var t,e=mE,n=e.length,i,a="value"in Kr?Kr.value:Kr.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 Ag=a.slice(t,1<i?1-i:void 0)}function Tg(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 ug(){return!0}function JO(){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)?ug:JO,this.isPropagationStopped=JO,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=ug)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=ug)},persist:function(){},isPersistent:ug}),e}var Os={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},hy=Oi(Os),th=Ne({},Os,{view:0,detail:0}),BU=Oi(th),Ub,Vb,fd,py=Ne({},th,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:gE,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!==fd&&(fd&&t.type==="mousemove"?(Ub=t.screenX-fd.screenX,Vb=t.screenY-fd.screenY):Vb=Ub=0,fd=t),Ub)},movementY:function(t){return"movementY"in t?t.movementY:Vb}}),WO=Oi(py),HU=Ne({},py,{dataTransfer:0}),UU=Oi(HU),VU=Ne({},th,{relatedTarget:0}),jb=Oi(VU),jU=Ne({},Os,{animationName:0,elapsedTime:0,pseudoElement:0}),qU=Oi(jU),FU=Ne({},Os,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),GU=Oi(FU),kU=Ne({},Os,{data:0}),$O=Oi(kU),YU={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},QU={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"},XU={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function KU(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):(t=XU[t])?!!e[t]:!1}function gE(){return KU}var ZU=Ne({},th,{key:function(t){if(t.key){var e=YU[t.key]||t.key;if(e!=="Unidentified")return e}return t.type==="keypress"?(t=Tg(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?QU[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:gE,charCode:function(t){return t.type==="keypress"?Tg(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?Tg(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),JU=Oi(ZU),WU=Ne({},py,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),t_=Oi(WU),$U=Ne({},th,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:gE}),tV=Oi($U),eV=Ne({},Os,{propertyName:0,elapsedTime:0,pseudoElement:0}),nV=Oi(eV),iV=Ne({},py,{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}),aV=Oi(iV),oV=Ne({},Os,{newState:0,oldState:0}),rV=Oi(oV),lV=[9,13,27,32],yE=Jo&&"CompositionEvent"in window,Ed=null;Jo&&"documentMode"in document&&(Ed=document.documentMode);var sV=Jo&&"TextEvent"in window&&!Ed,Bz=Jo&&(!yE||Ed&&8<Ed&&11>=Ed),e_=" ",n_=!1;function Hz(t,e){switch(t){case"keyup":return lV.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Uz(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var rc=!1;function uV(t,e){switch(t){case"compositionend":return Uz(e);case"keypress":return e.which!==32?null:(n_=!0,e_);case"textInput":return t=e.data,t===e_&&n_?null:t;default:return null}}function cV(t,e){if(rc)return t==="compositionend"||!yE&&Hz(t,e)?(t=Pz(),Ag=mE=Kr=null,rc=!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 Bz&&e.locale!=="ko"?null:e.data;default:return null}}var fV={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 i_(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e==="input"?!!fV[t.type]:e==="textarea"}function Vz(t,e,n,i){oc?gc?gc.push(i):gc=[i]:oc=i,e=oy(e,"onChange"),0<e.length&&(n=new hy("onChange","change",null,n,i),t.push({event:n,listeners:e}))}var Rd=null,Bd=null;function dV(t){L3(t,0)}function my(t){var e=Sd(t);if(_z(e))return t}function a_(t,e){if(t==="change")return e}var jz=!1;Jo&&(Jo?(fg="oninput"in document,fg||(qb=document.createElement("div"),qb.setAttribute("oninput","return;"),fg=typeof qb.oninput=="function"),cg=fg):cg=!1,jz=cg&&(!document.documentMode||9<document.documentMode));var cg,fg,qb;function o_(){Rd&&(Rd.detachEvent("onpropertychange",qz),Bd=Rd=null)}function qz(t){if(t.propertyName==="value"&&my(Bd)){var e=[];Vz(e,Bd,t,pE(t)),Lz(dV,e)}}function hV(t,e,n){t==="focusin"?(o_(),Rd=e,Bd=n,Rd.attachEvent("onpropertychange",qz)):t==="focusout"&&o_()}function pV(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return my(Bd)}function mV(t,e){if(t==="click")return my(e)}function gV(t,e){if(t==="input"||t==="change")return my(e)}function yV(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var na=typeof Object.is=="function"?Object.is:yV;function Hd(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(!Sx.call(e,a)||!na(t[a],e[a]))return!1}return!0}function r_(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function l_(t,e){var n=r_(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=r_(n)}}function Fz(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?Fz(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function Gz(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var e=jg(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=jg(t.document)}return e}function vE(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 vV=Jo&&"documentMode"in document&&11>=document.documentMode,lc=null,Cx=null,Ad=null,wx=!1;function s_(t,e,n){var i=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;wx||lc==null||lc!==jg(i)||(i=lc,"selectionStart"in i&&vE(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}),Ad&&Hd(Ad,i)||(Ad=i,i=oy(Cx,"onSelect"),0<i.length&&(e=new hy("onSelect","select",null,e,n),t.push({event:e,listeners:i}),e.target=lc)))}function hs(t,e){var n={};return n[t.toLowerCase()]=e.toLowerCase(),n["Webkit"+t]="webkit"+e,n["Moz"+t]="moz"+e,n}var sc={animationend:hs("Animation","AnimationEnd"),animationiteration:hs("Animation","AnimationIteration"),animationstart:hs("Animation","AnimationStart"),transitionrun:hs("Transition","TransitionRun"),transitionstart:hs("Transition","TransitionStart"),transitioncancel:hs("Transition","TransitionCancel"),transitionend:hs("Transition","TransitionEnd")},Fb={},kz={};Jo&&(kz=document.createElement("div").style,"AnimationEvent"in window||(delete sc.animationend.animation,delete sc.animationiteration.animation,delete sc.animationstart.animation),"TransitionEvent"in window||delete sc.transitionend.transition);function _s(t){if(Fb[t])return Fb[t];if(!sc[t])return t;var e=sc[t],n;for(n in e)if(e.hasOwnProperty(n)&&n in kz)return Fb[t]=e[n];return t}var Yz=_s("animationend"),Qz=_s("animationiteration"),Xz=_s("animationstart"),SV=_s("transitionrun"),bV=_s("transitionstart"),xV=_s("transitioncancel"),Kz=_s("transitionend"),Zz=new Map,Mx="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(" ");Mx.push("scrollEnd");function Ga(t,e){Zz.set(t,e),Ms(e,[t])}var qg=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=[],uc=0,SE=0;function gy(){for(var t=uc,e=SE=uc=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&&Jz(n,a,o)}}function yy(t,e,n,i){va[uc++]=t,va[uc++]=e,va[uc++]=n,va[uc++]=i,SE|=i,t.lanes|=i,t=t.alternate,t!==null&&(t.lanes|=i)}function bE(t,e,n,i){return yy(t,e,n,i),Fg(t)}function zs(t,e){return yy(t,null,null,e),Fg(t)}function Jz(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 Fg(t){if(50<Id)throw Id=0,Kx=null,Error(J(185));for(var e=t.return;e!==null;)t=e,e=t.return;return t.tag===3?t.stateNode:null}var cc={};function EV(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 EV(t,e,n,i)}function xE(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 Wz(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 Cg(t,e,n,i,a,o){var s=0;if(i=t,typeof t=="function")xE(t)&&(s=1);else if(typeof t=="string")s=T8(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 nc:return Ss(n.children,a,o,e);case yz:s=8,a|=24;break;case dx:return t=Zi(12,n,e,a|2),t.elementType=dx,t.lanes=o,t;case hx:return t=Zi(13,n,e,a),t.elementType=hx,t.lanes=o,t;case px:return t=Zi(19,n,e,a),t.elementType=px,t.lanes=o,t;default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case ko:s=10;break t;case vz:s=9;break t;case lE:s=11;break t;case sE:s=14;break t;case qr:s=16,i=null;break t}s=29,n=Error(J(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 Ss(t,e,n,i){return t=Zi(7,t,i,e),t.lanes=n,t}function Gb(t,e,n){return t=Zi(6,t,null,e),t.lanes=n,t}function $z(t){var e=Zi(18,null,null,0);return e.stateNode=t,e}function kb(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 u_=new WeakMap;function Ra(t,e){if(typeof t=="object"&&t!==null){var n=u_.get(t);return n!==void 0?n:(e={value:t,source:e,stack:GO(e)},u_.set(t,e),e)}return{value:t,source:e,stack:GO(e)}}var fc=[],dc=0,Gg=null,Ud=0,ba=[],xa=0,sl=null,so=1,uo="";function Fo(t,e){fc[dc++]=Ud,fc[dc++]=Gg,Gg=t,Ud=e}function tN(t,e,n){ba[xa++]=so,ba[xa++]=uo,ba[xa++]=sl,sl=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 EE(t){t.return!==null&&(Fo(t,1),tN(t,1,0))}function RE(t){for(;t===Gg;)Gg=fc[--dc],fc[dc]=null,Ud=fc[--dc],fc[dc]=null;for(;t===sl;)sl=ba[--xa],ba[xa]=null,uo=ba[--xa],ba[xa]=null,so=ba[--xa],ba[xa]=null}function eN(t,e){ba[xa++]=so,ba[xa++]=uo,ba[xa++]=sl,so=e.id,uo=e.overflow,sl=t}var kn=null,ze=null,Jt=!1,tl=null,Aa=!1,Ox=Error(J(519));function ul(t){var e=Error(J(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Vd(Ra(e,t)),Ox}function c_(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<Gd.length;n++)kt(Gd[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),zz(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),Iz(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||B3(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||ul(t,!0)}function f_(t){for(kn=t.return;kn;)switch(kn.tag){case 5:case 31:case 13:Aa=!1;return;case 27:case 3:Aa=!0;return;default:kn=kn.return}}function Wu(t){if(t!==kn)return!1;if(!Jt)return f_(t),Jt=!0,!1;var e=t.tag,n;if((n=e!==3&&e!==27)&&((n=e===5)&&(n=t.type,n=!(n!=="form"&&n!=="button")||tE(t.type,t.memoizedProps)),n=!n),n&&ze&&ul(t),f_(t),e===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(J(317));ze=$_(t)}else if(e===31){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(J(317));ze=$_(t)}else e===27?(e=ze,hl(t.type)?(t=aE,aE=null,ze=t):ze=e):ze=kn?Ca(t.stateNode.nextSibling):null;return!0}function Rs(){ze=kn=null,Jt=!1}function Yb(){var t=tl;return t!==null&&(Ci===null?Ci=t:Ci.push.apply(Ci,t),tl=null),t}function Vd(t){tl===null?tl=[t]:tl.push(t)}var _x=ho(null),Ns=null,Qo=null;function Gr(t,e,n){Me(_x,e._currentValue),e._currentValue=n}function Ko(t){t._currentValue=_x.current,Dn(_x)}function zx(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 Nx(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),zx(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(J(341));s.lanes|=n,o=s.alternate,o!==null&&(o.lanes|=n),zx(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 Dc(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(J(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===Bg.current){if(s=a.alternate,s===null)throw Error(J(387));s.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(t!==null?t.push(Yd):t=[Yd])}a=a.return}t!==null&&Nx(e,t,n,i),e.flags|=262144}function kg(t){for(t=t.firstContext;t!==null;){if(!na(t.context._currentValue,t.memoizedValue))return!0;t=t.next}return!1}function As(t){Ns=t,Qo=null,t=t.dependencies,t!==null&&(t.firstContext=null)}function Yn(t){return nN(Ns,t)}function dg(t,e){return Ns===null&&As(t),nN(t,e)}function nN(t,e){var n=e._currentValue;if(e={context:e,memoizedValue:n,next:null},Qo===null){if(t===null)throw Error(J(308));Qo=e,t.dependencies={lanes:0,firstContext:e},t.flags|=524288}else Qo=Qo.next=e;return n}var RV=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()})}},AV=Cn.unstable_scheduleCallback,TV=Cn.unstable_NormalPriority,mn={$$typeof:ko,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function AE(){return{controller:new RV,data:new Map,refCount:0}}function eh(t){t.refCount--,t.refCount===0&&AV(TV,function(){t.controller.abort()})}var Td=null,Ix=0,Ac=0,yc=null;function CV(t,e){if(Td===null){var n=Td=[];Ix=0,Ac=KE(),yc={status:"pending",value:void 0,then:function(i){n.push(i)}}}return Ix++,e.then(d_,d_),e}function d_(){if(--Ix===0&&Td!==null){yc!==null&&(yc.status="fulfilled");var t=Td;Td=null,Ac=0,yc=null;for(var e=0;e<t.length;e++)(0,t[e])()}}function wV(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 h_=_t.S;_t.S=function(t,e){g3=Wi(),typeof e=="object"&&e!==null&&typeof e.then=="function"&&CV(t,e),h_!==null&&h_(t,e)};var bs=ho(null);function TE(){var t=bs.current;return t!==null?t:Te.pooledCache}function wg(t,e){e===null?Me(bs,bs.current):Me(bs,e.pool)}function iN(){var t=TE();return t===null?null:{parent:mn._currentValue,pool:t}}var Lc=Error(J(460)),CE=Error(J(474)),vy=Error(J(542)),Yg={then:function(){}};function p_(t){return t=t.status,t==="fulfilled"||t==="rejected"}function aN(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,g_(t),t;default:if(typeof e.status=="string")e.then(Yo,Yo);else{if(t=Te,t!==null&&100<t.shellSuspendCounter)throw Error(J(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,g_(t),t}throw xs=e,Lc}}function gs(t){try{var e=t._init;return e(t._payload)}catch(n){throw n!==null&&typeof n=="object"&&typeof n.then=="function"?(xs=n,Lc):n}}var xs=null;function m_(){if(xs===null)throw Error(J(459));var t=xs;return xs=null,t}function g_(t){if(t===Lc||t===vy)throw Error(J(483))}var vc=null,jd=0;function hg(t){var e=jd;return jd+=1,vc===null&&(vc=[]),aN(vc,t,e)}function dd(t,e){e=e.props.ref,t.ref=e!==void 0?e:null}function pg(t,e){throw e.$$typeof===hU?Error(J(525)):(t=Object.prototype.toString.call(e),Error(J(31,t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)))}function oN(t){function e(R,x){if(t){var A=R.deletions;A===null?(R.deletions=[x],R.flags|=16):A.push(x)}}function n(R,x){if(!t)return null;for(;x!==null;)e(R,x),x=x.sibling;return null}function i(R){for(var x=new Map;R!==null;)R.key!==null?x.set(R.key,R):x.set(R.index,R),R=R.sibling;return x}function a(R,x){return R=Xo(R,x),R.index=0,R.sibling=null,R}function o(R,x,A){return R.index=A,t?(A=R.alternate,A!==null?(A=A.index,A<x?(R.flags|=67108866,x):A):(R.flags|=67108866,x)):(R.flags|=1048576,x)}function s(R){return t&&R.alternate===null&&(R.flags|=67108866),R}function u(R,x,A,T){return x===null||x.tag!==6?(x=Gb(A,R.mode,T),x.return=R,x):(x=a(x,A),x.return=R,x)}function d(R,x,A,T){var M=A.type;return M===nc?f(R,x,A.props.children,T,A.key):x!==null&&(x.elementType===M||typeof M=="object"&&M!==null&&M.$$typeof===qr&&gs(M)===x.type)?(x=a(x,A.props),dd(x,A),x.return=R,x):(x=Cg(A.type,A.key,A.props,null,R.mode,T),dd(x,A),x.return=R,x)}function p(R,x,A,T){return x===null||x.tag!==4||x.stateNode.containerInfo!==A.containerInfo||x.stateNode.implementation!==A.implementation?(x=kb(A,R.mode,T),x.return=R,x):(x=a(x,A.children||[]),x.return=R,x)}function f(R,x,A,T,M){return x===null||x.tag!==7?(x=Ss(A,R.mode,T,M),x.return=R,x):(x=a(x,A),x.return=R,x)}function m(R,x,A){if(typeof x=="string"&&x!==""||typeof x=="number"||typeof x=="bigint")return x=Gb(""+x,R.mode,A),x.return=R,x;if(typeof x=="object"&&x!==null){switch(x.$$typeof){case ag:return A=Cg(x.type,x.key,x.props,null,R.mode,A),dd(A,x),A.return=R,A;case yd:return x=kb(x,R.mode,A),x.return=R,x;case qr:return x=gs(x),m(R,x,A)}if(vd(x)||cd(x))return x=Ss(x,R.mode,A,null),x.return=R,x;if(typeof x.then=="function")return m(R,hg(x),A);if(x.$$typeof===ko)return m(R,dg(R,x),A);pg(R,x)}return null}function g(R,x,A,T){var M=x!==null?x.key:null;if(typeof A=="string"&&A!==""||typeof A=="number"||typeof A=="bigint")return M!==null?null:u(R,x,""+A,T);if(typeof A=="object"&&A!==null){switch(A.$$typeof){case ag:return A.key===M?d(R,x,A,T):null;case yd:return A.key===M?p(R,x,A,T):null;case qr:return A=gs(A),g(R,x,A,T)}if(vd(A)||cd(A))return M!==null?null:f(R,x,A,T,null);if(typeof A.then=="function")return g(R,x,hg(A),T);if(A.$$typeof===ko)return g(R,x,dg(R,A),T);pg(R,A)}return null}function v(R,x,A,T,M){if(typeof T=="string"&&T!==""||typeof T=="number"||typeof T=="bigint")return R=R.get(A)||null,u(x,R,""+T,M);if(typeof T=="object"&&T!==null){switch(T.$$typeof){case ag:return R=R.get(T.key===null?A:T.key)||null,d(x,R,T,M);case yd:return R=R.get(T.key===null?A:T.key)||null,p(x,R,T,M);case qr:return T=gs(T),v(R,x,A,T,M)}if(vd(T)||cd(T))return R=R.get(A)||null,f(x,R,T,M,null);if(typeof T.then=="function")return v(R,x,A,hg(T),M);if(T.$$typeof===ko)return v(R,x,A,dg(x,T),M);pg(x,T)}return null}function S(R,x,A,T){for(var M=null,z=null,D=x,I=x=0,q=null;D!==null&&I<A.length;I++){D.index>I?(q=D,D=null):q=D.sibling;var B=g(R,D,A[I],T);if(B===null){D===null&&(D=q);break}t&&D&&B.alternate===null&&e(R,D),x=o(B,x,I),z===null?M=B:z.sibling=B,z=B,D=q}if(I===A.length)return n(R,D),Jt&&Fo(R,I),M;if(D===null){for(;I<A.length;I++)D=m(R,A[I],T),D!==null&&(x=o(D,x,I),z===null?M=D:z.sibling=D,z=D);return Jt&&Fo(R,I),M}for(D=i(D);I<A.length;I++)q=v(D,R,I,A[I],T),q!==null&&(t&&q.alternate!==null&&D.delete(q.key===null?I:q.key),x=o(q,x,I),z===null?M=q:z.sibling=q,z=q);return t&&D.forEach(function(U){return e(R,U)}),Jt&&Fo(R,I),M}function E(R,x,A,T){if(A==null)throw Error(J(151));for(var M=null,z=null,D=x,I=x=0,q=null,B=A.next();D!==null&&!B.done;I++,B=A.next()){D.index>I?(q=D,D=null):q=D.sibling;var U=g(R,D,B.value,T);if(U===null){D===null&&(D=q);break}t&&D&&U.alternate===null&&e(R,D),x=o(U,x,I),z===null?M=U:z.sibling=U,z=U,D=q}if(B.done)return n(R,D),Jt&&Fo(R,I),M;if(D===null){for(;!B.done;I++,B=A.next())B=m(R,B.value,T),B!==null&&(x=o(B,x,I),z===null?M=B:z.sibling=B,z=B);return Jt&&Fo(R,I),M}for(D=i(D);!B.done;I++,B=A.next())B=v(D,R,I,B.value,T),B!==null&&(t&&B.alternate!==null&&D.delete(B.key===null?I:B.key),x=o(B,x,I),z===null?M=B:z.sibling=B,z=B);return t&&D.forEach(function(W){return e(R,W)}),Jt&&Fo(R,I),M}function C(R,x,A,T){if(typeof A=="object"&&A!==null&&A.type===nc&&A.key===null&&(A=A.props.children),typeof A=="object"&&A!==null){switch(A.$$typeof){case ag:t:{for(var M=A.key;x!==null;){if(x.key===M){if(M=A.type,M===nc){if(x.tag===7){n(R,x.sibling),T=a(x,A.props.children),T.return=R,R=T;break t}}else if(x.elementType===M||typeof M=="object"&&M!==null&&M.$$typeof===qr&&gs(M)===x.type){n(R,x.sibling),T=a(x,A.props),dd(T,A),T.return=R,R=T;break t}n(R,x);break}else e(R,x);x=x.sibling}A.type===nc?(T=Ss(A.props.children,R.mode,T,A.key),T.return=R,R=T):(T=Cg(A.type,A.key,A.props,null,R.mode,T),dd(T,A),T.return=R,R=T)}return s(R);case yd:t:{for(M=A.key;x!==null;){if(x.key===M)if(x.tag===4&&x.stateNode.containerInfo===A.containerInfo&&x.stateNode.implementation===A.implementation){n(R,x.sibling),T=a(x,A.children||[]),T.return=R,R=T;break t}else{n(R,x);break}else e(R,x);x=x.sibling}T=kb(A,R.mode,T),T.return=R,R=T}return s(R);case qr:return A=gs(A),C(R,x,A,T)}if(vd(A))return S(R,x,A,T);if(cd(A)){if(M=cd(A),typeof M!="function")throw Error(J(150));return A=M.call(A),E(R,x,A,T)}if(typeof A.then=="function")return C(R,x,hg(A),T);if(A.$$typeof===ko)return C(R,x,dg(R,A),T);pg(R,A)}return typeof A=="string"&&A!==""||typeof A=="number"||typeof A=="bigint"?(A=""+A,x!==null&&x.tag===6?(n(R,x.sibling),T=a(x,A),T.return=R,R=T):(n(R,x),T=Gb(A,R.mode,T),T.return=R,R=T),s(R)):n(R,x)}return function(R,x,A,T){try{jd=0;var M=C(R,x,A,T);return vc=null,M}catch(D){if(D===Lc||D===vy)throw D;var z=Zi(29,D,null,R.mode);return z.lanes=T,z.return=R,z}finally{}}}var Ts=oN(!0),rN=oN(!1),Fr=!1;function wE(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Dx(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 el(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function nl(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=Fg(t),Jz(t,null,n),e}return yy(t,i,e,n),Fg(t)}function Cd(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,Az(t,n)}}function Qb(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 Lx=!1;function wd(){if(Lx){var t=yc;if(t!==null)throw t}}function Md(t,e,n,i){Lx=!1;var a=t.updateQueue;Fr=!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===Ac&&(Lx=!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 C=n;switch(E.tag){case 1:if(S=E.payload,typeof S=="function"){m=S.call(C,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(C,m,g):S,g==null)break t;m=Ne({},m,g);break t;case 2:Fr=!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),fl|=s,t.lanes=s,t.memoizedState=m}}function lN(t,e){if(typeof t!="function")throw Error(J(191,t));t.call(e)}function sN(t,e){var n=t.callbacks;if(n!==null)for(t.callbacks=null,t=0;t<n.length;t++)lN(n[t],e)}var Tc=ho(null),Qg=ho(0);function y_(t,e){t=er,Me(Qg,t),Me(Tc,e),er=t|e.baseLanes}function Px(){Me(Qg,er),Me(Tc,Tc.current)}function ME(){er=Qg.current,Dn(Tc),Dn(Qg)}var ia=ho(null),Ta=null;function kr(t){var e=t.alternate;Me(rn,rn.current&1),Me(ia,t),Ta===null&&(e===null||Tc.current!==null||e.memoizedState!==null)&&(Ta=t)}function Bx(t){Me(rn,rn.current),Me(ia,t),Ta===null&&(Ta=t)}function uN(t){t.tag===22?(Me(rn,rn.current),Me(ia,t),Ta===null&&(Ta=t)):Yr(t)}function Yr(){Me(rn,rn.current),Me(ia,ia.current)}function Ki(t){Dn(ia),Ta===t&&(Ta=null),Dn(rn)}var rn=ho(0);function Xg(t){for(var e=t;e!==null;){if(e.tag===13){var n=e.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||nE(n)||iE(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 Wo=0,Ht=null,xe=null,hn=null,Kg=!1,Sc=!1,Cs=!1,Zg=0,qd=0,bc=null,MV=0;function Je(){throw Error(J(321))}function OE(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 _E(t,e,n,i,a,o){return Wo=o,Ht=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,_t.H=t===null||t.memoizedState===null?VN:jE,Cs=!1,o=n(i,a),Cs=!1,Sc&&(o=fN(e,n,i,a)),cN(t),o}function cN(t){_t.H=Fd;var e=xe!==null&&xe.next!==null;if(Wo=0,hn=xe=Ht=null,Kg=!1,qd=0,bc=null,e)throw Error(J(300));t===null||gn||(t=t.dependencies,t!==null&&kg(t)&&(gn=!0))}function fN(t,e,n,i){Ht=t;var a=0;do{if(Sc&&(bc=null),qd=0,Sc=!1,25<=a)throw Error(J(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=jN,o=e(n,i)}while(Sc);return o}function OV(){var t=_t.H,e=t.useState()[0];return e=typeof e.then=="function"?nh(e):e,t=t.useState()[0],(xe!==null?xe.memoizedState:null)!==t&&(Ht.flags|=1024),e}function zE(){var t=Zg!==0;return Zg=0,t}function NE(t,e,n){e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~n}function IE(t){if(Kg){for(t=t.memoizedState;t!==null;){var e=t.queue;e!==null&&(e.pending=null),t=t.next}Kg=!1}Wo=0,hn=xe=Ht=null,Sc=!1,qd=Zg=0,bc=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(J(467)):Error(J(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 Sy(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function nh(t){var e=qd;return qd+=1,bc===null&&(bc=[]),t=aN(bc,t,e),e=Ht,(hn===null?e.memoizedState:hn.next)===null&&(e=e.alternate,_t.H=e===null||e.memoizedState===null?VN:jE),t}function by(t){if(t!==null&&typeof t=="object"){if(typeof t.then=="function")return nh(t);if(t.$$typeof===ko)return Yn(t)}throw Error(J(438,String(t)))}function DE(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=Sy(),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]=pU;return e.index++,n}function $o(t,e){return typeof e=="function"?e(t):e}function Mg(t){var e=ln();return LE(e,xe,t)}function LE(t,e,n){var i=t.queue;if(i===null)throw Error(J(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:(Wo&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===Ac&&(f=!0);else if((Wo&g)===g){p=p.next,g===Ac&&(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,fl|=g;m=p.action,Cs&&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,fl|=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=yc,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 Xb(t){var e=ln(),n=e.queue;if(n===null)throw Error(J(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 dN(t,e,n){var i=Ht,a=ln(),o=Jt;if(o){if(n===void 0)throw Error(J(407));n=n()}else n=e();var s=!na((xe||a).memoizedState,n);if(s&&(a.memoizedState=n,gn=!0),a=a.queue,PE(mN.bind(null,i,a,t),[t]),a.getSnapshot!==e||s||hn!==null&&hn.memoizedState.tag&1){if(i.flags|=2048,Cc(9,{destroy:void 0},pN.bind(null,i,a,n,e),null),Te===null)throw Error(J(349));o||Wo&127||hN(i,e,n)}return n}function hN(t,e,n){t.flags|=16384,t={getSnapshot:e,value:n},e=Ht.updateQueue,e===null?(e=Sy(),Ht.updateQueue=e,e.stores=[t]):(n=e.stores,n===null?e.stores=[t]:n.push(t))}function pN(t,e,n,i){e.value=n,e.getSnapshot=i,gN(e)&&yN(t)}function mN(t,e,n){return n(function(){gN(e)&&yN(t)})}function gN(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!na(t,n)}catch{return!0}}function yN(t){var e=zs(t,2);e!==null&&wi(e,t,2)}function Hx(t){var e=di();if(typeof t=="function"){var n=t;if(t=n(),Cs){Xr(!0);try{n()}finally{Xr(!1)}}}return e.memoizedState=e.baseState=t,e.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:$o,lastRenderedState:t},e}function vN(t,e,n,i){return t.baseState=n,LE(t,xe,typeof i=="function"?i:$o)}function _V(t,e,n,i,a){if(Ey(t))throw Error(J(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,SN(e,o)):(o.next=n.next,e.pending=n.next=o)}}function SN(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),v_(t,e,u)}catch(p){Ux(t,e,p)}finally{o!==null&&s.types!==null&&(o.types=s.types),_t.T=o}}else try{o=n(a,i),v_(t,e,o)}catch(p){Ux(t,e,p)}}function v_(t,e,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(i){S_(t,e,i)},function(i){return Ux(t,e,i)}):S_(t,e,n)}function S_(t,e,n){e.status="fulfilled",e.value=n,bN(e),t.state=n,e=t.pending,e!==null&&(n=e.next,n===e?t.pending=null:(n=n.next,e.next=n,SN(t,n)))}function Ux(t,e,n){var i=t.pending;if(t.pending=null,i!==null){i=i.next;do e.status="rejected",e.reason=n,bN(e),e=e.next;while(e!==i)}t.action=null}function bN(t){t=t.listeners;for(var e=0;e<t.length;e++)(0,t[e])()}function xN(t,e){return e}function b_(t,e){if(Jt){var n=Te.formState;if(n!==null){t:{var i=Ht;if(Jt){if(ze){e:{for(var a=ze,o=Aa;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}}ul(i)}i=!1}i&&(e=n[0])}}return n=di(),n.memoizedState=n.baseState=e,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:xN,lastRenderedState:e},n.queue=i,n=BN.bind(null,Ht,i),i.dispatch=n,i=Hx(!1),o=VE.bind(null,Ht,!1,i.queue),i=di(),a={state:e,dispatch:null,action:t,pending:null},i.queue=a,n=_V.bind(null,Ht,a,o,n),a.dispatch=n,i.memoizedState=t,[e,n,!1]}function x_(t){var e=ln();return EN(e,xe,t)}function EN(t,e,n){if(e=LE(t,e,xN)[0],t=Mg($o)[0],typeof e=="object"&&e!==null&&typeof e.then=="function")try{var i=nh(e)}catch(s){throw s===Lc?vy:s}else i=e;e=ln();var a=e.queue,o=a.dispatch;return n!==e.memoizedState&&(Ht.flags|=2048,Cc(9,{destroy:void 0},zV.bind(null,a,n),null)),[i,o,t]}function zV(t,e){t.action=e}function E_(t){var e=ln(),n=xe;if(n!==null)return EN(e,n,t);ln(),e=e.memoizedState,n=ln();var i=n.queue.dispatch;return n.memoizedState=t,[e,i,!1]}function Cc(t,e,n,i){return t={tag:t,create:n,deps:i,inst:e,next:null},e=Ht.updateQueue,e===null&&(e=Sy(),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 RN(){return ln().memoizedState}function Og(t,e,n,i){var a=di();Ht.flags|=t,a.memoizedState=Cc(1|e,{destroy:void 0},n,i===void 0?null:i)}function xy(t,e,n,i){var a=ln();i=i===void 0?null:i;var o=a.memoizedState.inst;xe!==null&&i!==null&&OE(i,xe.memoizedState.deps)?a.memoizedState=Cc(e,o,n,i):(Ht.flags|=t,a.memoizedState=Cc(1|e,o,n,i))}function R_(t,e){Og(8390656,8,t,e)}function PE(t,e){xy(2048,8,t,e)}function NV(t){Ht.flags|=4;var e=Ht.updateQueue;if(e===null)e=Sy(),Ht.updateQueue=e,e.events=[t];else{var n=e.events;n===null?e.events=[t]:n.push(t)}}function AN(t){var e=ln().memoizedState;return NV({ref:e,nextImpl:t}),function(){if(se&2)throw Error(J(440));return e.impl.apply(void 0,arguments)}}function TN(t,e){return xy(4,2,t,e)}function CN(t,e){return xy(4,4,t,e)}function wN(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 MN(t,e,n){n=n!=null?n.concat([t]):null,xy(4,4,wN.bind(null,e,t),n)}function BE(){}function ON(t,e){var n=ln();e=e===void 0?null:e;var i=n.memoizedState;return e!==null&&OE(e,i[1])?i[0]:(n.memoizedState=[t,e],t)}function _N(t,e){var n=ln();e=e===void 0?null:e;var i=n.memoizedState;if(e!==null&&OE(e,i[1]))return i[0];if(i=t(),Cs){Xr(!0);try{t()}finally{Xr(!1)}}return n.memoizedState=[i,e],i}function HE(t,e,n){return n===void 0||Wo&1073741824&&!(Xt&261930)?t.memoizedState=e:(t.memoizedState=n,t=v3(),Ht.lanes|=t,fl|=t,n)}function zN(t,e,n,i){return na(n,e)?n:Tc.current!==null?(t=HE(t,n,i),na(t,e)||(gn=!0),t):!(Wo&42)||Wo&1073741824&&!(Xt&261930)?(gn=!0,t.memoizedState=n):(t=v3(),Ht.lanes|=t,fl|=t,e)}function NN(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,VE(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=wV(d,i);Od(t,e,f,ea(t))}else Od(t,e,i,ea(t))}catch(m){Od(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 IV(){}function Vx(t,e,n,i){if(t.tag!==5)throw Error(J(476));var a=IN(t).queue;NN(t,a,e,vs,n===null?IV:function(){return DN(t),n(i)})}function IN(t){var e=t.memoizedState;if(e!==null)return e;e={memoizedState:vs,baseState:vs,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:$o,lastRenderedState:vs},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 DN(t){var e=IN(t);e.next===null&&(e=t.alternate.memoizedState),Od(t,e.next.queue,{},ea())}function UE(){return Yn(Yd)}function LN(){return ln().memoizedState}function PN(){return ln().memoizedState}function DV(t){for(var e=t.return;e!==null;){switch(e.tag){case 24:case 3:var n=ea();t=el(n);var i=nl(e,t,n);i!==null&&(wi(i,e,n),Cd(i,e,n)),e={cache:AE()},t.payload=e;return}e=e.return}}function LV(t,e,n){var i=ea();n={lane:i,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Ey(t)?HN(e,n):(n=bE(t,e,n,i),n!==null&&(wi(n,t,i),UN(n,e,i)))}function BN(t,e,n){var i=ea();Od(t,e,n,i)}function Od(t,e,n,i){var a={lane:i,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Ey(t))HN(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 yy(t,e,a,0),Te===null&&gy(),!1}catch{}finally{}if(n=bE(t,e,a,i),n!==null)return wi(n,t,i),UN(n,e,i),!0}return!1}function VE(t,e,n,i){if(i={lane:2,revertLane:KE(),gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},Ey(t)){if(e)throw Error(J(479))}else e=bE(t,n,i,2),e!==null&&wi(e,t,2)}function Ey(t){var e=t.alternate;return t===Ht||e!==null&&e===Ht}function HN(t,e){Sc=Kg=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function UN(t,e,n){if(n&4194048){var i=e.lanes;i&=t.pendingLanes,n|=i,e.lanes=n,Az(t,n)}}var Fd={readContext:Yn,use:by,useCallback:Je,useContext:Je,useEffect:Je,useImperativeHandle:Je,useLayoutEffect:Je,useInsertionEffect:Je,useMemo:Je,useReducer:Je,useRef:Je,useState:Je,useDebugValue:Je,useDeferredValue:Je,useTransition:Je,useSyncExternalStore:Je,useId:Je,useHostTransitionStatus:Je,useFormState:Je,useActionState:Je,useOptimistic:Je,useMemoCache:Je,useCacheRefresh:Je};Fd.useEffectEvent=Je;var VN={readContext:Yn,use:by,useCallback:function(t,e){return di().memoizedState=[t,e===void 0?null:e],t},useContext:Yn,useEffect:R_,useImperativeHandle:function(t,e,n){n=n!=null?n.concat([t]):null,Og(4194308,4,wN.bind(null,e,t),n)},useLayoutEffect:function(t,e){return Og(4194308,4,t,e)},useInsertionEffect:function(t,e){Og(4,2,t,e)},useMemo:function(t,e){var n=di();e=e===void 0?null:e;var i=t();if(Cs){Xr(!0);try{t()}finally{Xr(!1)}}return n.memoizedState=[i,e],i},useReducer:function(t,e,n){var i=di();if(n!==void 0){var a=n(e);if(Cs){Xr(!0);try{n(e)}finally{Xr(!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=LV.bind(null,Ht,t),[i.memoizedState,t]},useRef:function(t){var e=di();return t={current:t},e.memoizedState=t},useState:function(t){t=Hx(t);var e=t.queue,n=BN.bind(null,Ht,e);return e.dispatch=n,[t.memoizedState,n]},useDebugValue:BE,useDeferredValue:function(t,e){var n=di();return HE(n,t,e)},useTransition:function(){var t=Hx(!1);return t=NN.bind(null,Ht,t.queue,!0,!1),di().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,e,n){var i=Ht,a=di();if(Jt){if(n===void 0)throw Error(J(407));n=n()}else{if(n=e(),Te===null)throw Error(J(349));Xt&127||hN(i,e,n)}a.memoizedState=n;var o={value:n,getSnapshot:e};return a.queue=o,R_(mN.bind(null,i,o,t),[t]),i.flags|=2048,Cc(9,{destroy:void 0},pN.bind(null,i,o,n,e),null),n},useId:function(){var t=di(),e=Te.identifierPrefix;if(Jt){var n=uo,i=so;n=(i&~(1<<32-ta(i)-1)).toString(32)+n,e="_"+e+"R_"+n,n=Zg++,0<n&&(e+="H"+n.toString(32)),e+="_"}else n=MV++,e="_"+e+"r_"+n.toString(32)+"_";return t.memoizedState=e},useHostTransitionStatus:UE,useFormState:b_,useActionState:b_,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=VE.bind(null,Ht,!0,n),n.dispatch=e,[t,e]},useMemoCache:DE,useCacheRefresh:function(){return di().memoizedState=DV.bind(null,Ht)},useEffectEvent:function(t){var e=di(),n={impl:t};return e.memoizedState=n,function(){if(se&2)throw Error(J(440));return n.impl.apply(void 0,arguments)}}},jE={readContext:Yn,use:by,useCallback:ON,useContext:Yn,useEffect:PE,useImperativeHandle:MN,useInsertionEffect:TN,useLayoutEffect:CN,useMemo:_N,useReducer:Mg,useRef:RN,useState:function(){return Mg($o)},useDebugValue:BE,useDeferredValue:function(t,e){var n=ln();return zN(n,xe.memoizedState,t,e)},useTransition:function(){var t=Mg($o)[0],e=ln().memoizedState;return[typeof t=="boolean"?t:nh(t),e]},useSyncExternalStore:dN,useId:LN,useHostTransitionStatus:UE,useFormState:x_,useActionState:x_,useOptimistic:function(t,e){var n=ln();return vN(n,xe,t,e)},useMemoCache:DE,useCacheRefresh:PN};jE.useEffectEvent=AN;var jN={readContext:Yn,use:by,useCallback:ON,useContext:Yn,useEffect:PE,useImperativeHandle:MN,useInsertionEffect:TN,useLayoutEffect:CN,useMemo:_N,useReducer:Xb,useRef:RN,useState:function(){return Xb($o)},useDebugValue:BE,useDeferredValue:function(t,e){var n=ln();return xe===null?HE(n,t,e):zN(n,xe.memoizedState,t,e)},useTransition:function(){var t=Xb($o)[0],e=ln().memoizedState;return[typeof t=="boolean"?t:nh(t),e]},useSyncExternalStore:dN,useId:LN,useHostTransitionStatus:UE,useFormState:E_,useActionState:E_,useOptimistic:function(t,e){var n=ln();return xe!==null?vN(n,xe,t,e):(n.baseState=t,[t,n.queue.dispatch])},useMemoCache:DE,useCacheRefresh:PN};jN.useEffectEvent=AN;function Kb(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 jx={enqueueSetState:function(t,e,n){t=t._reactInternals;var i=ea(),a=el(i);a.payload=e,n!=null&&(a.callback=n),e=nl(t,a,i),e!==null&&(wi(e,t,i),Cd(e,t,i))},enqueueReplaceState:function(t,e,n){t=t._reactInternals;var i=ea(),a=el(i);a.tag=1,a.payload=e,n!=null&&(a.callback=n),e=nl(t,a,i),e!==null&&(wi(e,t,i),Cd(e,t,i))},enqueueForceUpdate:function(t,e){t=t._reactInternals;var n=ea(),i=el(n);i.tag=2,e!=null&&(i.callback=e),e=nl(t,i,n),e!==null&&(wi(e,t,n),Cd(e,t,n))}};function A_(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?!Hd(n,i)||!Hd(a,o):!0}function T_(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&&jx.enqueueReplaceState(e,e.state,null)}function ws(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 qN(t){qg(t)}function FN(t){console.error(t)}function GN(t){qg(t)}function Jg(t,e){try{var n=t.onUncaughtError;n(e.value,{componentStack:e.stack})}catch(i){setTimeout(function(){throw i})}}function C_(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 qx(t,e,n){return n=el(n),n.tag=3,n.payload={element:null},n.callback=function(){Jg(t,e)},n}function kN(t){return t=el(t),t.tag=3,t}function YN(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(){C_(e,n,i)}}var s=n.stateNode;s!==null&&typeof s.componentDidCatch=="function"&&(t.callback=function(){C_(e,n,i),typeof a!="function"&&(il===null?il=new Set([this]):il.add(this));var u=i.stack;this.componentDidCatch(i.value,{componentStack:u!==null?u:""})})}function PV(t,e,n,i,a){if(n.flags|=32768,i!==null&&typeof i=="object"&&typeof i.then=="function"){if(e=n.alternate,e!==null&&Dc(e,n,a,!0),n=ia.current,n!==null){switch(n.tag){case 31:case 13:return Ta===null?ny():n.alternate===null&&We===0&&(We=3),n.flags&=-257,n.flags|=65536,n.lanes=a,i===Yg?n.flags|=16384:(e=n.updateQueue,e===null?n.updateQueue=new Set([i]):e.add(i),rx(t,i,a)),!1;case 22:return n.flags|=65536,i===Yg?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)),rx(t,i,a)),!1}throw Error(J(435,n.tag))}return rx(t,i,a),ny(),!1}if(Jt)return e=ia.current,e!==null?(!(e.flags&65536)&&(e.flags|=256),e.flags|=65536,e.lanes=a,i!==Ox&&(t=Error(J(422),{cause:i}),Vd(Ra(t,n)))):(i!==Ox&&(e=Error(J(423),{cause:i}),Vd(Ra(e,n))),t=t.current.alternate,t.flags|=65536,a&=-a,t.lanes|=a,i=Ra(i,n),a=qx(t.stateNode,i,a),Qb(t,a),We!==4&&(We=2)),!1;var o=Error(J(520),{cause:i});if(o=Ra(o,n),Nd===null?Nd=[o]:Nd.push(o),We!==4&&(We=2),e===null)return!0;i=Ra(i,n),n=e;do{switch(n.tag){case 3:return n.flags|=65536,t=a&-a,n.lanes|=t,t=qx(n.stateNode,i,t),Qb(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"&&(il===null||!il.has(o))))return n.flags|=65536,a&=-a,n.lanes|=a,a=kN(a),YN(a,t,n,i),Qb(n,a),!1}n=n.return}while(n!==null);return!1}var qE=Error(J(461)),gn=!1;function Fn(t,e,n,i){e.child=t===null?rN(e,null,n,i):Ts(e,t.child,n,i)}function w_(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 As(e),i=_E(t,e,n,s,o,a),u=zE(),t!==null&&!gn?(NE(t,e,a),tr(t,e,a)):(Jt&&u&&EE(e),e.flags|=1,Fn(t,e,i,a),e.child)}function M_(t,e,n,i,a){if(t===null){var o=n.type;return typeof o=="function"&&!xE(o)&&o.defaultProps===void 0&&n.compare===null?(e.tag=15,e.type=o,QN(t,e,o,i,a)):(t=Cg(n.type,null,i,e,e.mode,a),t.ref=e.ref,t.return=e,e.child=t)}if(o=t.child,!FE(t,a)){var s=o.memoizedProps;if(n=n.compare,n=n!==null?n:Hd,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 QN(t,e,n,i,a){if(t!==null){var o=t.memoizedProps;if(Hd(o,i)&&t.ref===e.ref)if(gn=!1,e.pendingProps=i=o,FE(t,a))t.flags&131072&&(gn=!0);else return e.lanes=t.lanes,tr(t,e,a)}return Fx(t,e,n,i,a)}function XN(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 O_(t,e,o,n,i)}if(n&536870912)e.memoizedState={baseLanes:0,cachePool:null},t!==null&&wg(e,o!==null?o.cachePool:null),o!==null?y_(e,o):Px(),uN(e);else return i=e.lanes=536870912,O_(t,e,o!==null?o.baseLanes|n:n,n,i)}else o!==null?(wg(e,o.cachePool),y_(e,o),Yr(e),e.memoizedState=null):(t!==null&&wg(e,null),Px(),Yr(e));return Fn(t,e,a,n),e.child}function bd(t,e){return t!==null&&t.tag===22||e.stateNode!==null||(e.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),e.sibling}function O_(t,e,n,i,a){var o=TE();return o=o===null?null:{parent:mn._currentValue,pool:o},e.memoizedState={baseLanes:n,cachePool:o},t!==null&&wg(e,null),Px(),uN(e),t!==null&&Dc(t,e,i,!0),e.childLanes=a,null}function _g(t,e){return e=Wg({mode:e.mode,children:e.children},t.mode),e.ref=t.ref,t.child=e,e.return=t,e}function __(t,e,n){return Ts(e,t.child,null,n),t=_g(e,e.pendingProps),t.flags|=2,Ki(e),e.memoizedState=null,t}function BV(t,e,n){var i=e.pendingProps,a=(e.flags&128)!==0;if(e.flags&=-129,t===null){if(Jt){if(i.mode==="hidden")return t=_g(e,i),e.lanes=536870912,bd(null,t);if(Bx(e),(t=ze)?(t=V3(t,Aa),t=t!==null&&t.data==="&"?t:null,t!==null&&(e.memoizedState={dehydrated:t,treeContext:sl!==null?{id:so,overflow:uo}:null,retryLane:536870912,hydrationErrors:null},n=$z(t),n.return=e,e.child=n,kn=e,ze=null)):t=null,t===null)throw ul(e);return e.lanes=536870912,null}return _g(e,i)}var o=t.memoizedState;if(o!==null){var s=o.dehydrated;if(Bx(e),a)if(e.flags&256)e.flags&=-257,e=__(t,e,n);else if(e.memoizedState!==null)e.child=t.child,e.flags|=128,e=null;else throw Error(J(558));else if(gn||Dc(t,e,n,!1),a=(n&t.childLanes)!==0,gn||a){if(i=Te,i!==null&&(s=Tz(i,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,zs(t,s),wi(i,t,s),qE;ny(),e=__(t,e,n)}else t=o.treeContext,ze=Ca(s.nextSibling),kn=e,Jt=!0,tl=null,Aa=!1,t!==null&&eN(e,t),e=_g(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 zg(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(J(284));(t===null||t.ref!==n)&&(e.flags|=4194816)}}function Fx(t,e,n,i,a){return As(e),n=_E(t,e,n,i,void 0,a),i=zE(),t!==null&&!gn?(NE(t,e,a),tr(t,e,a)):(Jt&&i&&EE(e),e.flags|=1,Fn(t,e,n,a),e.child)}function z_(t,e,n,i,a,o){return As(e),e.updateQueue=null,n=fN(e,i,n,a),cN(t),i=zE(),t!==null&&!gn?(NE(t,e,o),tr(t,e,o)):(Jt&&i&&EE(e),e.flags|=1,Fn(t,e,n,o),e.child)}function N_(t,e,n,i,a){if(As(e),e.stateNode===null){var o=cc,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=jx,e.stateNode=o,o._reactInternals=e,o=e.stateNode,o.props=i,o.state=e.memoizedState,o.refs={},wE(e),s=n.contextType,o.context=typeof s=="object"&&s!==null?Yn(s):cc,o.state=e.memoizedState,s=n.getDerivedStateFromProps,typeof s=="function"&&(Kb(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&&jx.enqueueReplaceState(o,o.state,null),Md(e,i,o,a),wd(),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=ws(n,u);o.props=d;var p=o.context,f=n.contextType;s=cc,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)&&T_(e,o,i,s),Fr=!1;var g=e.memoizedState;o.state=g,Md(e,i,o,a),wd(),p=e.memoizedState,u||g!==p||Fr?(typeof m=="function"&&(Kb(e,n,m,i),p=e.memoizedState),(d=Fr||A_(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,Dx(t,e),s=e.memoizedProps,f=ws(n,s),o.props=f,m=e.pendingProps,g=o.context,p=n.contextType,d=cc,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)&&T_(e,o,i,d),Fr=!1,g=e.memoizedState,o.state=g,Md(e,i,o,a),wd();var v=e.memoizedState;s!==m||g!==v||Fr||t!==null&&t.dependencies!==null&&kg(t.dependencies)?(typeof u=="function"&&(Kb(e,n,u,i),v=e.memoizedState),(f=Fr||A_(e,n,f,i,g,v,d)||t!==null&&t.dependencies!==null&&kg(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,zg(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=Ts(e,t.child,null,a),e.child=Ts(e,null,n,a)):Fn(t,e,n,a),e.memoizedState=o.state,t=e.child):t=tr(t,e,a),t}function I_(t,e,n,i){return Rs(),e.flags|=256,Fn(t,e,n,i),e.child}var Zb={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Jb(t){return{baseLanes:t,cachePool:iN()}}function Wb(t,e,n){return t=t!==null?t.childLanes&~n:0,e&&(t|=Ji),t}function KN(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(Jt){if(a?kr(e):Yr(e),(t=ze)?(t=V3(t,Aa),t=t!==null&&t.data!=="&"?t:null,t!==null&&(e.memoizedState={dehydrated:t,treeContext:sl!==null?{id:so,overflow:uo}:null,retryLane:536870912,hydrationErrors:null},n=$z(t),n.return=e,e.child=n,kn=e,ze=null)):t=null,t===null)throw ul(e);return iE(t)?e.lanes=32:e.lanes=536870912,null}var u=i.children;return i=i.fallback,a?(Yr(e),a=e.mode,u=Wg({mode:"hidden",children:u},a),i=Ss(i,a,n,null),u.return=e,i.return=e,u.sibling=i,e.child=u,i=e.child,i.memoizedState=Jb(n),i.childLanes=Wb(t,s,n),e.memoizedState=Zb,bd(null,i)):(kr(e),Gx(e,u))}var d=t.memoizedState;if(d!==null&&(u=d.dehydrated,u!==null)){if(o)e.flags&256?(kr(e),e.flags&=-257,e=$b(t,e,n)):e.memoizedState!==null?(Yr(e),e.child=t.child,e.flags|=128,e=null):(Yr(e),u=i.fallback,a=e.mode,i=Wg({mode:"visible",children:i.children},a),u=Ss(u,a,n,null),u.flags|=2,i.return=e,u.return=e,i.sibling=u,e.child=i,Ts(e,t.child,null,n),i=e.child,i.memoizedState=Jb(n),i.childLanes=Wb(t,s,n),e.memoizedState=Zb,e=bd(null,i));else if(kr(e),iE(u)){if(s=u.nextSibling&&u.nextSibling.dataset,s)var p=s.dgst;s=p,i=Error(J(419)),i.stack="",i.digest=s,Vd({value:i,source:null,stack:null}),e=$b(t,e,n)}else if(gn||Dc(t,e,n,!1),s=(n&t.childLanes)!==0,gn||s){if(s=Te,s!==null&&(i=Tz(s,n),i!==0&&i!==d.retryLane))throw d.retryLane=i,zs(t,i),wi(s,t,i),qE;nE(u)||ny(),e=$b(t,e,n)}else nE(u)?(e.flags|=192,e.child=t.child,e=null):(t=d.treeContext,ze=Ca(u.nextSibling),kn=e,Jt=!0,tl=null,Aa=!1,t!==null&&eN(e,t),e=Gx(e,i.children),e.flags|=4096);return e}return a?(Yr(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=Ss(u,a,n,null),u.flags|=2),u.return=e,i.return=e,i.sibling=u,e.child=i,bd(null,i),i=e.child,u=t.child.memoizedState,u===null?u=Jb(n):(a=u.cachePool,a!==null?(d=mn._currentValue,a=a.parent!==d?{parent:d,pool:d}:a):a=iN(),u={baseLanes:u.baseLanes|n,cachePool:a}),i.memoizedState=u,i.childLanes=Wb(t,s,n),e.memoizedState=Zb,bd(t.child,i)):(kr(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 Gx(t,e){return e=Wg({mode:"visible",children:e},t.mode),e.return=t,t.child=e}function Wg(t,e){return t=Zi(22,t,null,e),t.lanes=0,t}function $b(t,e,n){return Ts(e,t.child,null,n),t=Gx(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function D_(t,e,n){t.lanes|=e;var i=t.alternate;i!==null&&(i.lanes|=e),zx(t.return,e,n)}function tx(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 ZN(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=Jt?Ud:0,!u&&t!==null&&t.flags&128)t:for(t=e.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&D_(t,n,e);else if(t.tag===19)D_(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&&Xg(t)===null&&(a=n),n=n.sibling;n=a,n===null?(a=e.child,e.child=null):(a=n.sibling,n.sibling=null),tx(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&&Xg(t)===null){e.child=a;break}t=a.sibling,a.sibling=n,n=a,a=t}tx(e,!0,n,null,o,i);break;case"together":tx(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),fl|=e.lanes,!(n&e.childLanes))if(t!==null){if(Dc(t,e,n,!1),(n&e.childLanes)===0)return null}else return null;if(t!==null&&e.child!==t.child)throw Error(J(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 FE(t,e){return t.lanes&e?!0:(t=t.dependencies,!!(t!==null&&kg(t)))}function HV(t,e,n){switch(e.tag){case 3:Hg(e,e.stateNode.containerInfo),Gr(e,mn,t.memoizedState.cache),Rs();break;case 27:case 5:vx(e);break;case 4:Hg(e,e.stateNode.containerInfo);break;case 10:Gr(e,e.type,e.memoizedProps.value);break;case 31:if(e.memoizedState!==null)return e.flags|=128,Bx(e),null;break;case 13:var i=e.memoizedState;if(i!==null)return i.dehydrated!==null?(kr(e),e.flags|=128,null):n&e.child.childLanes?KN(t,e,n):(kr(e),t=tr(t,e,n),t!==null?t.sibling:null);kr(e);break;case 19:var a=(t.flags&128)!==0;if(i=(n&e.childLanes)!==0,i||(Dc(t,e,n,!1),i=(n&e.childLanes)!==0),a){if(i)return ZN(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,XN(t,e,n,e.pendingProps);case 24:Gr(e,mn,t.memoizedState.cache)}return tr(t,e,n)}function JN(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps)gn=!0;else{if(!FE(t,n)&&!(e.flags&128))return gn=!1,HV(t,e,n);gn=!!(t.flags&131072)}else gn=!1,Jt&&e.flags&1048576&&tN(e,Ud,e.index);switch(e.lanes=0,e.tag){case 16:t:{var i=e.pendingProps;if(t=gs(e.elementType),e.type=t,typeof t=="function")xE(t)?(i=ws(t,i),e.tag=1,e=N_(null,e,t,i,n)):(e.tag=0,e=Fx(null,e,t,i,n));else{if(t!=null){var a=t.$$typeof;if(a===lE){e.tag=11,e=w_(null,e,t,i,n);break t}else if(a===sE){e.tag=14,e=M_(null,e,t,i,n);break t}}throw e=gx(t)||t,Error(J(306,e,""))}}return e;case 0:return Fx(t,e,e.type,e.pendingProps,n);case 1:return i=e.type,a=ws(i,e.pendingProps),N_(t,e,i,a,n);case 3:t:{if(Hg(e,e.stateNode.containerInfo),t===null)throw Error(J(387));i=e.pendingProps;var o=e.memoizedState;a=o.element,Dx(t,e),Md(e,i,null,n);var s=e.memoizedState;if(i=s.cache,Gr(e,mn,i),i!==o.cache&&Nx(e,[mn],n,!0),wd(),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=I_(t,e,i,n);break t}else if(i!==a){a=Ra(Error(J(424)),e),Vd(a),e=I_(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,Jt=!0,tl=null,Aa=!0,n=rN(e,null,i,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Rs(),i===a){e=tr(t,e,n);break t}Fn(t,e,i,n)}e=e.child}return e;case 26:return zg(t,e),t===null?(n=nz(e.type,null,e.pendingProps,null))?e.memoizedState=n:Jt||(n=e.type,t=e.pendingProps,i=ry($r.current).createElement(n),i[Gn]=e,i[Mi]=t,Qn(i,n,t),In(i),e.stateNode=i):e.memoizedState=nz(e.type,t.memoizedProps,e.pendingProps,t.memoizedState),null;case 27:return vx(e),t===null&&Jt&&(i=e.stateNode=j3(e.type,e.pendingProps,$r.current),kn=e,Aa=!0,a=ze,hl(e.type)?(aE=a,ze=Ca(i.firstChild)):ze=a),Fn(t,e,e.pendingProps.children,n),zg(t,e),t===null&&(e.flags|=4194304),e.child;case 5:return t===null&&Jt&&((a=i=ze)&&(i=d8(i,e.type,e.pendingProps,Aa),i!==null?(e.stateNode=i,kn=e,ze=Ca(i.firstChild),Aa=!1,a=!0):a=!1),a||ul(e)),vx(e),a=e.type,o=e.pendingProps,s=t!==null?t.memoizedProps:null,i=o.children,tE(a,o)?i=null:s!==null&&tE(a,s)&&(e.flags|=32),e.memoizedState!==null&&(a=_E(t,e,OV,null,null,n),Yd._currentValue=a),zg(t,e),Fn(t,e,i,n),e.child;case 6:return t===null&&Jt&&((t=n=ze)&&(n=h8(n,e.pendingProps,Aa),n!==null?(e.stateNode=n,kn=e,ze=null,t=!0):t=!1),t||ul(e)),null;case 13:return KN(t,e,n);case 4:return Hg(e,e.stateNode.containerInfo),i=e.pendingProps,t===null?e.child=Ts(e,null,i,n):Fn(t,e,i,n),e.child;case 11:return w_(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,Gr(e,e.type,i.value),Fn(t,e,i.children,n),e.child;case 9:return a=e.type._context,i=e.pendingProps.children,As(e),a=Yn(a),i=i(a),e.flags|=1,Fn(t,e,i,n),e.child;case 14:return M_(t,e,e.type,e.pendingProps,n);case 15:return QN(t,e,e.type,e.pendingProps,n);case 19:return ZN(t,e,n);case 31:return BV(t,e,n);case 22:return XN(t,e,n,e.pendingProps);case 24:return As(e),i=Yn(mn),t===null?(a=TE(),a===null&&(a=Te,o=AE(),a.pooledCache=o,o.refCount++,o!==null&&(a.pooledCacheLanes|=n),a=o),e.memoizedState={parent:i,cache:a},wE(e),Gr(e,mn,a)):(t.lanes&n&&(Dx(t,e),Md(e,null,null,n),wd()),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),Gr(e,mn,i)):(i=o.cache,Gr(e,mn,i),i!==a.cache&&Nx(e,[mn],n,!0))),Fn(t,e,e.pendingProps.children,n),e.child;case 29:throw e.pendingProps}throw Error(J(156,e.tag))}function Uo(t){t.flags|=4}function ex(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(x3())t.flags|=8192;else throw xs=Yg,CE}else t.flags&=-16777217}function L_(t,e){if(e.type!=="stylesheet"||e.state.loading&4)t.flags&=-16777217;else if(t.flags|=16777216,!G3(e))if(x3())t.flags|=8192;else throw xs=Yg,CE}function mg(t,e){e!==null&&(t.flags|=4),t.flags&16384&&(e=t.tag!==22?Ez():536870912,t.lanes|=e,wc|=e)}function hd(t,e){if(!Jt)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 UV(t,e,n){var i=e.pendingProps;switch(RE(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),xc(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(t===null||t.child===null)&&(Wu(e)?Uo(e):t===null||t.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,Yb())),_e(e),null;case 26:var a=e.type,o=e.memoizedState;return t===null?(Uo(e),o!==null?(_e(e),L_(e,o)):(_e(e),ex(e,a,null,i,n))):o?o!==t.memoizedState?(Uo(e),_e(e),L_(e,o)):(_e(e),e.flags&=-16777217):(t=t.memoizedProps,t!==i&&Uo(e),_e(e),ex(e,a,t,i,n)),null;case 27:if(Ug(e),n=$r.current,a=e.type,t!==null&&e.stateNode!=null)t.memoizedProps!==i&&Uo(e);else{if(!i){if(e.stateNode===null)throw Error(J(166));return _e(e),null}t=fo.current,Wu(e)?c_(e,t):(t=j3(a,i,n),e.stateNode=t,Uo(e))}return _e(e),null;case 5:if(Ug(e),a=e.type,t!==null&&e.stateNode!=null)t.memoizedProps!==i&&Uo(e);else{if(!i){if(e.stateNode===null)throw Error(J(166));return _e(e),null}if(o=fo.current,Wu(e))c_(e,o);else{var s=ry($r.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),ex(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(J(166));if(t=$r.current,Wu(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||B3(t.nodeValue,n)),t||ul(e,!0)}else t=ry(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=Wu(e),n!==null){if(t===null){if(!i)throw Error(J(318));if(t=e.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(J(557));t[Gn]=e}else Rs(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;_e(e),t=!1}else n=Yb(),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(J(558))}return _e(e),null;case 13:if(i=e.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(a=Wu(e),i!==null&&i.dehydrated!==null){if(t===null){if(!a)throw Error(J(318));if(a=e.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(J(317));a[Gn]=e}else Rs(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;_e(e),a=!1}else a=Yb(),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),mg(e,e.updateQueue),_e(e),null);case 4:return xc(),t===null&&ZE(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)hd(i,!1);else{if(We!==0||t!==null&&t.flags&128)for(t=e.child;t!==null;){if(o=Xg(t),o!==null){for(e.flags|=128,hd(i,!1),t=o.updateQueue,e.updateQueue=t,mg(e,t),e.subtreeFlags=0,t=n,n=e.child;n!==null;)Wz(n,t),n=n.sibling;return Me(rn,rn.current&1|2),Jt&&Fo(e,i.treeForkCount),e.child}t=t.sibling}i.tail!==null&&Wi()>ty&&(e.flags|=128,a=!0,hd(i,!1),e.lanes=4194304)}else{if(!a)if(t=Xg(o),t!==null){if(e.flags|=128,a=!0,t=t.updateQueue,e.updateQueue=t,mg(e,t),hd(i,!0),i.tail===null&&i.tailMode==="hidden"&&!o.alternate&&!Jt)return _e(e),null}else 2*Wi()-i.renderingStartTime>ty&&n!==536870912&&(e.flags|=128,a=!0,hd(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=Wi(),t.sibling=null,n=rn.current,Me(rn,a?n&1|2:n&1),Jt&&Fo(e,i.treeForkCount),t):(_e(e),null);case 22:case 23:return Ki(e),ME(),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&&mg(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(bs),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(J(156,e.tag))}function VV(t,e){switch(RE(e),e.tag){case 1:return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return Ko(mn),xc(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 26:case 27:case 5:return Ug(e),null;case 31:if(e.memoizedState!==null){if(Ki(e),e.alternate===null)throw Error(J(340));Rs()}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(J(340));Rs()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return Dn(rn),null;case 4:return xc(),null;case 10:return Ko(e.type),null;case 22:case 23:return Ki(e),ME(),t!==null&&Dn(bs),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 WN(t,e){switch(RE(e),e.tag){case 3:Ko(mn),xc();break;case 26:case 27:case 5:Ug(e);break;case 4:xc();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),ME(),t!==null&&Dn(bs);break;case 24:Ko(mn)}}function ih(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 cl(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 $N(t){var e=t.updateQueue;if(e!==null){var n=t.stateNode;try{sN(e,n)}catch(i){he(t,t.return,i)}}}function t3(t,e,n){n.props=ws(t.type,t.memoizedProps),n.state=t.memoizedState;try{n.componentWillUnmount()}catch(i){he(t,e,i)}}function _d(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 e3(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 nx(t,e,n){try{var i=t.stateNode;r8(i,t.type,n,e),i[Mi]=e}catch(a){he(t,t.return,a)}}function n3(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&hl(t.type)||t.tag===4}function ix(t){t:for(;;){for(;t.sibling===null;){if(t.return===null||n3(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&&hl(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 kx(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&&hl(t.type)&&(n=t.stateNode,e=null),t=t.child,t!==null))for(kx(t,e,n),t=t.sibling;t!==null;)kx(t,e,n),t=t.sibling}function $g(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&&hl(t.type)&&(n=t.stateNode),t=t.child,t!==null))for($g(t,e,n),t=t.sibling;t!==null;)$g(t,e,n),t=t.sibling}function i3(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,ax=!1,P_=typeof WeakSet=="function"?WeakSet:Set,Nn=null;function jV(t,e){if(t=t.containerInfo,Wx=cy,t=Gz(t),vE(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($x={focusedElem:t,selectionRange:n},cy=!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=ws(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)eE(t);else if(n===1)switch(t.nodeName){case"HEAD":case"HTML":case"BODY":eE(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(J(163))}if(t=e.sibling,t!==null){t.return=e.return,Nn=t;break}Nn=e.return}}function a3(t,e,n){var i=n.flags;switch(n.tag){case 0:case 11:case 15:jo(t,n),i&4&&ih(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=ws(n.type,e.memoizedProps);e=e.memoizedState;try{t.componentDidUpdate(a,e,t.__reactInternalSnapshotBeforeUpdate)}catch(s){he(n,n.return,s)}}i&64&&$N(n),i&512&&_d(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{sN(t,e)}catch(s){he(n,n.return,s)}}break;case 27:e===null&&i&4&&i3(n);case 26:case 5:jo(t,n),e===null&&i&4&&e3(n),i&512&&_d(n,n.return);break;case 12:jo(t,n);break;case 31:jo(t,n),i&4&&l3(t,n);break;case 13:jo(t,n),i&4&&s3(t,n),i&64&&(t=n.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(n=ZV.bind(null,n),p8(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 o3(t){var e=t.alternate;e!==null&&(t.alternate=null,o3(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&dE(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 Pe=null,Ti=!1;function Vo(t,e,n){for(n=n.child;n!==null;)r3(t,e,n),n=n.sibling}function r3(t,e,n){if($i&&typeof $i.onCommitFiberUnmount=="function")try{$i.onCommitFiberUnmount(Zd,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=Pe,a=Ti;hl(n.type)&&(Pe=n.stateNode,Ti=!1),Vo(t,e,n),Dd(n.stateNode),Pe=i,Ti=a;break;case 5:pn||co(n,e);case 6:if(i=Pe,a=Ti,Pe=null,Vo(t,e,n),Pe=i,Ti=a,Pe!==null)if(Ti)try{(Pe.nodeType===9?Pe.body:Pe.nodeName==="HTML"?Pe.ownerDocument.body:Pe).removeChild(n.stateNode)}catch(o){he(n,e,o)}else try{Pe.removeChild(n.stateNode)}catch(o){he(n,e,o)}break;case 18:Pe!==null&&(Ti?(t=Pe,J_(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,n.stateNode),zc(t)):J_(Pe,n.stateNode));break;case 4:i=Pe,a=Ti,Pe=n.stateNode.containerInfo,Ti=!0,Vo(t,e,n),Pe=i,Ti=a;break;case 0:case 11:case 14:case 15:cl(2,n,e),pn||cl(4,n,e),Vo(t,e,n);break;case 1:pn||(co(n,e),i=n.stateNode,typeof i.componentWillUnmount=="function"&&t3(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 l3(t,e){if(e.memoizedState===null&&(t=e.alternate,t!==null&&(t=t.memoizedState,t!==null))){t=t.dehydrated;try{zc(t)}catch(n){he(e,e.return,n)}}}function s3(t,e){if(e.memoizedState===null&&(t=e.alternate,t!==null&&(t=t.memoizedState,t!==null&&(t=t.dehydrated,t!==null))))try{zc(t)}catch(n){he(e,e.return,n)}}function qV(t){switch(t.tag){case 31:case 13:case 19:var e=t.stateNode;return e===null&&(e=t.stateNode=new P_),e;case 22:return t=t.stateNode,e=t._retryCache,e===null&&(e=t._retryCache=new P_),e;default:throw Error(J(435,t.tag))}}function gg(t,e){var n=qV(t);e.forEach(function(i){if(!n.has(i)){n.add(i);var a=JV.bind(null,t,i);i.then(a,a)}})}function Ri(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(hl(u.type)){Pe=u.stateNode,Ti=!1;break t}break;case 5:Pe=u.stateNode,Ti=!1;break t;case 3:case 4:Pe=u.stateNode.containerInfo,Ti=!0;break t}u=u.return}if(Pe===null)throw Error(J(160));r3(o,s,a),Pe=null,Ti=!1,o=a.alternate,o!==null&&(o.return=null),a.return=null}if(e.subtreeFlags&13886)for(e=e.child;e!==null;)u3(e,t),e=e.sibling}var Fa=null;function u3(t,e){var n=t.alternate,i=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:Ri(e,t),Ai(t),i&4&&(cl(3,t,t.return),ih(3,t),cl(5,t,t.return));break;case 1:Ri(e,t),Ai(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(Ri(e,t),Ai(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[$d]||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=az("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=az("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(J(468,i))}o[Gn]=t,In(o),i=o}t.stateNode=i}else oz(a,t.type,t.stateNode);else t.stateNode=iz(a,i,t.memoizedProps);else o!==i?(o===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):o.count--,i===null?oz(a,t.type,t.stateNode):iz(a,i,t.memoizedProps)):i===null&&t.stateNode!==null&&nx(t,t.memoizedProps,n.memoizedProps)}break;case 27:Ri(e,t),Ai(t),i&512&&(pn||n===null||co(n,n.return)),n!==null&&i&4&&nx(t,t.memoizedProps,n.memoizedProps);break;case 5:if(Ri(e,t),Ai(t),i&512&&(pn||n===null||co(n,n.return)),t.flags&32){a=t.stateNode;try{Rc(a,"")}catch(S){he(t,t.return,S)}}i&4&&t.stateNode!=null&&(a=t.memoizedProps,nx(t,a,n!==null?n.memoizedProps:a)),i&1024&&(ax=!0);break;case 6:if(Ri(e,t),Ai(t),i&4){if(t.stateNode===null)throw Error(J(162));i=t.memoizedProps,n=t.stateNode;try{n.nodeValue=i}catch(S){he(t,t.return,S)}}break;case 3:if(Dg=null,a=Fa,Fa=ly(e.containerInfo),Ri(e,t),Fa=a,Ai(t),i&4&&n!==null&&n.memoizedState.isDehydrated)try{zc(e.containerInfo)}catch(S){he(t,t.return,S)}ax&&(ax=!1,c3(t));break;case 4:i=Fa,Fa=ly(t.stateNode.containerInfo),Ri(e,t),Ai(t),Fa=i;break;case 12:Ri(e,t),Ai(t);break;case 31:Ri(e,t),Ai(t),i&4&&(i=t.updateQueue,i!==null&&(t.updateQueue=null,gg(t,i)));break;case 13:Ri(e,t),Ai(t),t.child.flags&8192&&t.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(Ry=Wi()),i&4&&(i=t.updateQueue,i!==null&&(t.updateQueue=null,gg(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,Ri(e,t),pn=f,Go=p,Ai(t),i&8192)t:for(e=t.stateNode,e._visibility=a?e._visibility&-2:e._visibility|1,a&&(n===null||d||Go||pn||ys(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?W_(v,!0):W_(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,gg(t,n))));break;case 19:Ri(e,t),Ai(t),i&4&&(i=t.updateQueue,i!==null&&(t.updateQueue=null,gg(t,i)));break;case 30:break;case 21:break;default:Ri(e,t),Ai(t)}}function Ai(t){var e=t.flags;if(e&2){try{for(var n,i=t.return;i!==null;){if(n3(i)){n=i;break}i=i.return}if(n==null)throw Error(J(160));switch(n.tag){case 27:var a=n.stateNode,o=ix(t);$g(t,o,a);break;case 5:var s=n.stateNode;n.flags&32&&(Rc(s,""),n.flags&=-33);var u=ix(t);$g(t,u,s);break;case 3:case 4:var d=n.stateNode.containerInfo,p=ix(t);kx(t,p,d);break;default:throw Error(J(161))}}catch(f){he(t,t.return,f)}t.flags&=-3}e&4096&&(t.flags&=-4097)}function c3(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var e=t;c3(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;)a3(t,e.alternate,e),e=e.sibling}function ys(t){for(t=t.child;t!==null;){var e=t;switch(e.tag){case 0:case 11:case 14:case 15:cl(4,e,e.return),ys(e);break;case 1:co(e,e.return);var n=e.stateNode;typeof n.componentWillUnmount=="function"&&t3(e,e.return,n),ys(e);break;case 27:Dd(e.stateNode);case 26:case 5:co(e,e.return),ys(e);break;case 22:e.memoizedState===null&&ys(e);break;case 30:ys(e);break;default:ys(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),ih(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++)lN(d[a],u)}catch(p){he(i,i.return,p)}}n&&s&64&&$N(o),_d(o,o.return);break;case 27:i3(o);case 26:case 5:qo(a,o,n),n&&i===null&&s&4&&e3(o),_d(o,o.return);break;case 12:qo(a,o,n);break;case 31:qo(a,o,n),n&&s&4&&l3(a,o);break;case 13:qo(a,o,n),n&&s&4&&s3(a,o);break;case 22:o.memoizedState===null&&qo(a,o,n),_d(o,o.return);break;case 30:break;default:qo(a,o,n)}e=e.sibling}}function GE(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&&eh(n))}function kE(t,e){t=null,e.alternate!==null&&(t=e.alternate.memoizedState.cache),e=e.memoizedState.cache,e!==t&&(e.refCount++,t!=null&&eh(t))}function qa(t,e,n,i){if(e.subtreeFlags&10256)for(e=e.child;e!==null;)f3(t,e,n,i),e=e.sibling}function f3(t,e,n,i){var a=e.flags;switch(e.tag){case 0:case 11:case 15:qa(t,e,n,i),a&2048&&ih(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&&eh(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):zd(t,e):o._visibility&2?qa(t,e,n,i):(o._visibility|=2,tc(t,e,n,i,(e.subtreeFlags&10256)!==0||!1)),a&2048&&GE(s,e);break;case 24:qa(t,e,n,i),a&2048&&kE(e.alternate,e);break;default:qa(t,e,n,i)}}function tc(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:tc(o,s,u,d,a),ih(8,s);break;case 23:break;case 22:var f=s.stateNode;s.memoizedState!==null?f._visibility&2?tc(o,s,u,d,a):zd(o,s):(f._visibility|=2,tc(o,s,u,d,a)),a&&p&2048&&GE(s.alternate,s);break;case 24:tc(o,s,u,d,a),a&&p&2048&&kE(s.alternate,s);break;default:tc(o,s,u,d,a)}e=e.sibling}}function zd(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:zd(n,i),a&2048&&GE(i.alternate,i);break;case 24:zd(n,i),a&2048&&kE(i.alternate,i);break;default:zd(n,i)}e=e.sibling}}var xd=8192;function $u(t,e,n){if(t.subtreeFlags&xd)for(t=t.child;t!==null;)d3(t,e,n),t=t.sibling}function d3(t,e,n){switch(t.tag){case 26:$u(t,e,n),t.flags&xd&&t.memoizedState!==null&&C8(n,Fa,t.memoizedState,t.memoizedProps);break;case 5:$u(t,e,n);break;case 3:case 4:var i=Fa;Fa=ly(t.stateNode.containerInfo),$u(t,e,n),Fa=i;break;case 22:t.memoizedState===null&&(i=t.alternate,i!==null&&i.memoizedState!==null?(i=xd,xd=16777216,$u(t,e,n),xd=i):$u(t,e,n));break;default:$u(t,e,n)}}function h3(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 pd(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,m3(i,t)}h3(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)p3(t),t=t.sibling}function p3(t){switch(t.tag){case 0:case 11:case 15:pd(t),t.flags&2048&&cl(9,t,t.return);break;case 3:pd(t);break;case 12:pd(t);break;case 22:var e=t.stateNode;t.memoizedState!==null&&e._visibility&2&&(t.return===null||t.return.tag!==13)?(e._visibility&=-3,Ng(t)):pd(t);break;default:pd(t)}}function Ng(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,m3(i,t)}h3(t)}for(t=t.child;t!==null;){switch(e=t,e.tag){case 0:case 11:case 15:cl(8,e,e.return),Ng(e);break;case 22:n=e.stateNode,n._visibility&2&&(n._visibility&=-3,Ng(e));break;default:Ng(e)}t=t.sibling}}function m3(t,e){for(;Nn!==null;){var n=Nn;switch(n.tag){case 0:case 11:case 15:cl(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:eh(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(o3(i),i===n){Nn=null;break t}if(a!==null){a.return=o,Nn=a;break t}Nn=o}}}var FV={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}},GV=typeof WeakMap=="function"?WeakMap:Map,se=0,Te=null,Yt=null,Xt=0,de=0,Xi=null,Zr=!1,Pc=!1,YE=!1,er=0,We=0,fl=0,Es=0,QE=0,Ji=0,wc=0,Nd=null,Ci=null,Yx=!1,Ry=0,g3=0,ty=1/0,ey=null,il=null,Tn=0,al=null,Mc=null,Zo=0,Qx=0,Xx=null,y3=null,Id=0,Kx=null;function ea(){return se&2&&Xt!==0?Xt&-Xt:_t.T!==null?KE():Cz()}function v3(){if(Ji===0)if(!(Xt&536870912)||Jt){var t=rg;rg<<=1,!(rg&3932160)&&(rg=262144),Ji=t}else Ji=536870912;return t=ia.current,t!==null&&(t.flags|=32),Ji}function wi(t,e,n){(t===Te&&(de===2||de===9)||t.cancelPendingCommit!==null)&&(Oc(t,0),Jr(t,Xt,Ji,!1)),Wd(t,n),(!(se&2)||t!==Te)&&(t===Te&&(!(se&2)&&(Es|=n),We===4&&Jr(t,Xt,Ji,!1)),po(t))}function S3(t,e,n){if(se&6)throw Error(J(327));var i=!n&&(e&127)===0&&(e&t.expiredLanes)===0||Jd(t,e),a=i?QV(t,e):ox(t,e,!0),o=i;do{if(a===0){Pc&&!i&&Jr(t,e,0,!1);break}else{if(n=t.current.alternate,o&&!kV(n)){a=ox(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=Nd;var d=u.current.memoizedState.isDehydrated;if(d&&(Oc(u,s).flags|=256),s=ox(u,s,!1),s!==2){if(YE&&!d){u.errorRecoveryDisabledLanes|=o,Es|=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){Oc(t,0),Jr(t,e,0,!0);break}t:{switch(i=t,o=a,o){case 0:case 1:throw Error(J(345));case 4:if((e&4194048)!==e)break;case 6:Jr(i,e,Ji,!Zr);break t;case 2:Ci=null;break;case 3:case 5:break;default:throw Error(J(329))}if((e&62914560)===e&&(a=Ry+300-Wi(),10<a)){if(Jr(i,e,Ji,!Zr),dy(i,0,!0)!==0)break t;Zo=e,i.timeoutHandle=U3(B_.bind(null,i,n,Ci,ey,Yx,e,Ji,Es,wc,Zr,o,"Throttled",-0,0),a);break t}B_(i,n,Ci,ey,Yx,e,Ji,Es,wc,Zr,o,null,-0,0)}}break}while(!0);po(t)}function B_(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},d3(e,o,m);var S=(o&62914560)===o?Ry-Wi():(o&4194048)===o?g3-Wi():0;if(S=w8(m,S),S!==null){Zo=o,t.cancelPendingCommit=S(U_.bind(null,t,e,o,n,i,a,s,u,d,f,m,null,g,v)),Jr(t,o,s,!p);return}}U_(t,e,o,n,i,a,s,u,d)}function kV(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 Jr(t,e,n,i){e&=~QE,e&=~Es,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&&Rz(t,n,e)}function Ay(){return se&6?!0:(ah(0,!1),!1)}function XE(){if(Yt!==null){if(de===0)var t=Yt.return;else t=Yt,Qo=Ns=null,IE(t),vc=null,jd=0,t=Yt;for(;t!==null;)WN(t.alternate,t),t=t.return;Yt=null}}function Oc(t,e){var n=t.timeoutHandle;n!==-1&&(t.timeoutHandle=-1,u8(n)),n=t.cancelPendingCommit,n!==null&&(t.cancelPendingCommit=null,n()),Zo=0,XE(),Te=t,Yt=n=Xo(t.current,null),Xt=e,de=0,Xi=null,Zr=!1,Pc=Jd(t,e),YE=!1,wc=Ji=QE=Es=fl=We=0,Ci=Nd=null,Yx=!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,gy(),n}function b3(t,e){Ht=null,_t.H=Fd,e===Lc||e===vy?(e=m_(),de=3):e===CE?(e=m_(),de=4):de=e===qE?8:e!==null&&typeof e=="object"&&typeof e.then=="function"?6:1,Xi=e,Yt===null&&(We=1,Jg(t,Ra(e,t.current)))}function x3(){var t=ia.current;return t===null?!0:(Xt&4194048)===Xt?Ta===null:(Xt&62914560)===Xt||Xt&536870912?t===Ta:!1}function E3(){var t=_t.H;return _t.H=Fd,t===null?Fd:t}function R3(){var t=_t.A;return _t.A=FV,t}function ny(){We=4,Zr||(Xt&4194048)!==Xt&&ia.current!==null||(Pc=!0),!(fl&134217727)&&!(Es&134217727)||Te===null||Jr(Te,Xt,Ji,!1)}function ox(t,e,n){var i=se;se|=2;var a=E3(),o=R3();(Te!==t||Xt!==e)&&(ey=null,Oc(t,e)),e=!1;var s=We;t:do try{if(de!==0&&Yt!==null){var u=Yt,d=Xi;switch(de){case 8:XE(),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,hc(t,u,d,p),n&&Pc){s=0;break t}break;default:p=de,de=0,Xi=null,hc(t,u,d,p)}}YV(),s=We;break}catch(f){b3(t,f)}while(!0);return e&&t.shellSuspendCounter++,Qo=Ns=null,se=i,_t.H=a,_t.A=o,Yt===null&&(Te=null,Xt=0,gy()),s}function YV(){for(;Yt!==null;)A3(Yt)}function QV(t,e){var n=se;se|=2;var i=E3(),a=R3();Te!==t||Xt!==e?(ey=null,ty=Wi()+500,Oc(t,e)):Pc=Jd(t,e);t:do try{if(de!==0&&Yt!==null){e=Yt;var o=Xi;e:switch(de){case 1:de=0,Xi=null,hc(t,e,o,1);break;case 2:case 9:if(p_(o)){de=0,Xi=null,H_(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:p_(o)?(de=0,Xi=null,H_(e)):(de=0,Xi=null,hc(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?G3(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,Ty(p)):Yt=null}break e}}de=0,Xi=null,hc(t,e,o,5);break;case 6:de=0,Xi=null,hc(t,e,o,6);break;case 8:XE(),We=6;break t;default:throw Error(J(462))}}XV();break}catch(f){b3(t,f)}while(!0);return Qo=Ns=null,_t.H=i,_t.A=a,se=n,Yt!==null?0:(Te=null,Xt=0,gy(),We)}function XV(){for(;Yt!==null&&!yU();)A3(Yt)}function A3(t){var e=JN(t.alternate,t,er);t.memoizedProps=t.pendingProps,e===null?Ty(t):Yt=e}function H_(t){var e=t,n=e.alternate;switch(e.tag){case 15:case 0:e=z_(n,e,e.pendingProps,e.type,void 0,Xt);break;case 11:e=z_(n,e,e.pendingProps,e.type.render,e.ref,Xt);break;case 5:IE(e);default:WN(n,e),e=Yt=Wz(e,er),e=JN(n,e,er)}t.memoizedProps=t.pendingProps,e===null?Ty(t):Yt=e}function hc(t,e,n,i){Qo=Ns=null,IE(e),vc=null,jd=0;var a=e.return;try{if(PV(t,a,e,n,Xt)){We=1,Jg(t,Ra(n,t.current)),Yt=null;return}}catch(o){if(a!==null)throw Yt=a,o;We=1,Jg(t,Ra(n,t.current)),Yt=null;return}e.flags&32768?(Jt||i===1?t=!0:Pc||Xt&536870912?t=!1:(Zr=t=!0,(i===2||i===9||i===3||i===6)&&(i=ia.current,i!==null&&i.tag===13&&(i.flags|=16384))),T3(e,t)):Ty(e)}function Ty(t){var e=t;do{if(e.flags&32768){T3(e,Zr);return}t=e.return;var n=UV(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);We===0&&(We=5)}function T3(t,e){do{var n=VV(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);We=6,Yt=null}function U_(t,e,n,i,a,o,s,u,d){t.cancelPendingCommit=null;do Cy();while(Tn!==0);if(se&6)throw Error(J(327));if(e!==null){if(e===t.current)throw Error(J(177));if(o=e.lanes|e.childLanes,o|=SE,wU(t,n,o,s,u,d),t===Te&&(Yt=Te=null,Xt=0),Mc=e,al=t,Zo=n,Qx=o,Xx=a,y3=i,e.subtreeFlags&10256||e.flags&10256?(t.callbackNode=null,t.callbackPriority=0,WV(Vg,function(){return _3(),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{jV(t,e,n)}finally{se=s,ue.p=a,_t.T=i}}Tn=1,C3(),w3(),M3()}}function C3(){if(Tn===1){Tn=0;var t=al,e=Mc,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{u3(e,t);var o=$x,s=Gz(t.containerInfo),u=o.focusedElem,d=o.selectionRange;if(s!==u&&u&&u.ownerDocument&&Fz(u.ownerDocument.documentElement,u)){if(d!==null&&vE(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),C=d.end===void 0?E:Math.min(d.end,S);!v.extend&&E>C&&(s=C,C=E,E=s);var R=l_(u,E),x=l_(u,C);if(R&&x&&(v.rangeCount!==1||v.anchorNode!==R.node||v.anchorOffset!==R.offset||v.focusNode!==x.node||v.focusOffset!==x.offset)){var A=m.createRange();A.setStart(R.node,R.offset),v.removeAllRanges(),E>C?(v.addRange(A),v.extend(x.node,x.offset)):(A.setEnd(x.node,x.offset),v.addRange(A))}}}}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 T=m[u];T.element.scrollLeft=T.left,T.element.scrollTop=T.top}}cy=!!Wx,$x=Wx=null}finally{se=a,ue.p=i,_t.T=n}}t.current=e,Tn=2}}function w3(){if(Tn===2){Tn=0;var t=al,e=Mc,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{a3(t,e.alternate,e)}finally{se=a,ue.p=i,_t.T=n}}Tn=3}}function M3(){if(Tn===4||Tn===3){Tn=0,vU();var t=al,e=Mc,n=Zo,i=y3;e.subtreeFlags&10256||e.flags&10256?Tn=5:(Tn=0,Mc=al=null,O3(t,t.pendingLanes));var a=t.pendingLanes;if(a===0&&(il=null),fE(n),e=e.stateNode,$i&&typeof $i.onCommitFiberRoot=="function")try{$i.onCommitFiberRoot(Zd,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&&Cy(),po(t),a=t.pendingLanes,n&261930&&a&42?t===Kx?Id++:(Id=0,Kx=t):Id=0,ah(0,!1)}}function O3(t,e){(t.pooledCacheLanes&=e)===0&&(e=t.pooledCache,e!=null&&(t.pooledCache=null,eh(e)))}function Cy(){return C3(),w3(),M3(),_3()}function _3(){if(Tn!==5)return!1;var t=al,e=Qx;Qx=0;var n=fE(Zo),i=_t.T,a=ue.p;try{ue.p=32>n?32:n,_t.T=null,n=Xx,Xx=null;var o=al,s=Zo;if(Tn=0,Mc=al=null,Zo=0,se&6)throw Error(J(331));var u=se;if(se|=4,p3(o.current),f3(o,o.current,s,n),se=u,ah(0,!1),$i&&typeof $i.onPostCommitFiberRoot=="function")try{$i.onPostCommitFiberRoot(Zd,o)}catch{}return!0}finally{ue.p=a,_t.T=i,O3(t,e)}}function V_(t,e,n){e=Ra(n,e),e=qx(t.stateNode,e,2),t=nl(t,e,2),t!==null&&(Wd(t,2),po(t))}function he(t,e,n){if(t.tag===3)V_(t,t,n);else for(;e!==null;){if(e.tag===3){V_(e,t,n);break}else if(e.tag===1){var i=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof i.componentDidCatch=="function"&&(il===null||!il.has(i))){t=Ra(n,t),n=kN(2),i=nl(e,n,2),i!==null&&(YN(n,i,e,t),Wd(i,2),po(i));break}}e=e.return}}function rx(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)||(YE=!0,a.add(n),t=KV.bind(null,t,e,n),e.then(t,t))}function KV(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&&(We===4||We===3&&(Xt&62914560)===Xt&&300>Wi()-Ry?!(se&2)&&Oc(t,0):QE|=n,wc===Xt&&(wc=0)),po(t)}function z3(t,e){e===0&&(e=Ez()),t=zs(t,e),t!==null&&(Wd(t,e),po(t))}function ZV(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),z3(t,n)}function JV(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(J(314))}i!==null&&i.delete(e),z3(t,n)}function WV(t,e){return uE(t,e)}var iy=null,ec=null,Zx=!1,ay=!1,lx=!1,Wr=0;function po(t){t!==ec&&t.next===null&&(ec===null?iy=ec=t:ec=ec.next=t),ay=!0,Zx||(Zx=!0,t8())}function ah(t,e){if(!lx&&ay){lx=!0;do for(var n=!1,i=iy;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,j_(i,o))}else o=Xt,o=dy(i,i===Te?o:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),!(o&3)||Jd(i,o)||(n=!0,j_(i,o));i=i.next}while(n);lx=!1}}function $V(){N3()}function N3(){ay=Zx=!1;var t=0;Wr!==0&&s8()&&(t=Wr);for(var e=Wi(),n=null,i=iy;i!==null;){var a=i.next,o=I3(i,e);o===0?(i.next=null,n===null?iy=a:n.next=a,a===null&&(ec=n)):(n=i,(t!==0||o&3)&&(ay=!0)),i=a}Tn!==0&&Tn!==5||ah(t,!1),Wr!==0&&(Wr=0)}function I3(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]=CU(u,e)):d<=e&&(t.expiredLanes|=u),o&=~u}if(e=Te,n=Xt,n=dy(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&&Pb(i),t.callbackNode=null,t.callbackPriority=0;if(!(n&3)||Jd(t,n)){if(e=n&-n,e===t.callbackPriority)return e;switch(i!==null&&Pb(i),fE(n)){case 2:case 8:n=bz;break;case 32:n=Vg;break;case 268435456:n=xz;break;default:n=Vg}return i=D3.bind(null,t),n=uE(n,i),t.callbackPriority=e,t.callbackNode=n,e}return i!==null&&i!==null&&Pb(i),t.callbackPriority=2,t.callbackNode=null,2}function D3(t,e){if(Tn!==0&&Tn!==5)return t.callbackNode=null,t.callbackPriority=0,null;var n=t.callbackNode;if(Cy()&&t.callbackNode!==n)return null;var i=Xt;return i=dy(t,t===Te?i:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),i===0?null:(S3(t,i,e),I3(t,Wi()),t.callbackNode!=null&&t.callbackNode===n?D3.bind(null,t):null)}function j_(t,e){if(Cy())return null;S3(t,e,!0)}function t8(){c8(function(){se&6?uE(Sz,$V):N3()})}function KE(){if(Wr===0){var t=Ac;t===0&&(t=og,og<<=1,!(og&261888)&&(og=256)),Wr=t}return Wr}function q_(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:Rg(""+t)}function F_(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 e8(t,e,n,i,a){if(e==="submit"&&n&&n.stateNode===a){var o=q_((a[Mi]||null).action),s=i.submitter;s&&(e=(e=s[Mi]||null)?q_(e.formAction):s.getAttribute("formAction"),e!==null&&(o=e,s=null));var u=new hy("action","action",null,i,a);t.push({event:u,listeners:[{instance:null,listener:function(){if(i.defaultPrevented){if(Wr!==0){var d=s?F_(a,s):new FormData(a);Vx(n,{pending:!0,data:d,method:a.method,action:o},null,d)}}else typeof o=="function"&&(u.preventDefault(),d=s?F_(a,s):new FormData(a),Vx(n,{pending:!0,data:d,method:a.method,action:o},o,d))},currentTarget:a}]})}}for(yg=0;yg<Mx.length;yg++)vg=Mx[yg],G_=vg.toLowerCase(),k_=vg[0].toUpperCase()+vg.slice(1),Ga(G_,"on"+k_);var vg,G_,k_,yg;Ga(Yz,"onAnimationEnd");Ga(Qz,"onAnimationIteration");Ga(Xz,"onAnimationStart");Ga("dblclick","onDoubleClick");Ga("focusin","onFocus");Ga("focusout","onBlur");Ga(SV,"onTransitionRun");Ga(bV,"onTransitionStart");Ga(xV,"onTransitionCancel");Ga(Kz,"onTransitionEnd");Ec("onMouseEnter",["mouseout","mouseover"]);Ec("onMouseLeave",["mouseout","mouseover"]);Ec("onPointerEnter",["pointerout","pointerover"]);Ec("onPointerLeave",["pointerout","pointerover"]);Ms("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Ms("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Ms("onBeforeInput",["compositionend","keypress","textInput","paste"]);Ms("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Ms("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Ms("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Gd="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(" "),n8=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Gd));function L3(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){qg(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){qg(f)}a.currentTarget=null,o=d}}}}function kt(t,e){var n=e[bx];n===void 0&&(n=e[bx]=new Set);var i=t+"__bubble";n.has(i)||(P3(e,t,2,!1),n.add(i))}function sx(t,e,n){var i=0;e&&(i|=4),P3(n,t,i,e)}var Sg="_reactListening"+Math.random().toString(36).slice(2);function ZE(t){if(!t[Sg]){t[Sg]=!0,wz.forEach(function(n){n!=="selectionchange"&&(n8.has(n)||sx(n,!1,t),sx(n,!0,t))});var e=t.nodeType===9?t:t.ownerDocument;e===null||e[Sg]||(e[Sg]=!0,sx("selectionchange",!1,e))}}function P3(t,e,n,i){switch(K3(e)){case 2:var a=_8;break;case 8:a=z8;break;default:a=tR}n=a.bind(null,e,n,t),a=void 0,!Tx||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 ux(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=ac(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}Lz(function(){var p=o,f=pE(n),m=[];t:{var g=Zz.get(t);if(g!==void 0){var v=hy,S=t;switch(t){case"keypress":if(Tg(n)===0)break t;case"keydown":case"keyup":v=JU;break;case"focusin":S="focus",v=jb;break;case"focusout":S="blur",v=jb;break;case"beforeblur":case"afterblur":v=jb;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=WO;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":v=UU;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":v=tV;break;case Yz:case Qz:case Xz:v=qU;break;case Kz:v=nV;break;case"scroll":case"scrollend":v=BU;break;case"wheel":v=aV;break;case"copy":case"cut":case"paste":v=GU;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":v=t_;break;case"toggle":case"beforetoggle":v=rV}var E=(e&4)!==0,C=!E&&(t==="scroll"||t==="scrollend"),R=E?g!==null?g+"Capture":null:g;E=[];for(var x=p,A;x!==null;){var T=x;if(A=T.stateNode,T=T.tag,T!==5&&T!==26&&T!==27||A===null||R===null||(T=Pd(x,R),T!=null&&E.push(kd(x,T,A))),C)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!==Ax&&(S=n.relatedTarget||n.fromElement)&&(ac(S)||S[Nc]))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?ac(S):null,S!==null&&(C=Kd(S),E=S.tag,S!==C||E!==5&&E!==27&&E!==6)&&(S=null)):(v=null,S=p),v!==S)){if(E=WO,T="onMouseLeave",R="onMouseEnter",x="mouse",(t==="pointerout"||t==="pointerover")&&(E=t_,T="onPointerLeave",R="onPointerEnter",x="pointer"),C=v==null?g:Sd(v),A=S==null?g:Sd(S),g=new E(T,x+"leave",v,n,f),g.target=C,g.relatedTarget=A,T=null,ac(f)===p&&(E=new E(R,x+"enter",S,n,f),E.target=A,E.relatedTarget=C,T=E),C=T,v&&S)e:{for(E=i8,R=v,x=S,A=0,T=R;T;T=E(T))A++;T=0;for(var M=x;M;M=E(M))T++;for(;0<A-T;)R=E(R),A--;for(;0<T-A;)x=E(x),T--;for(;A--;){if(R===x||x!==null&&R===x.alternate){E=R;break e}R=E(R),x=E(x)}E=null}else E=null;v!==null&&Y_(m,g,v,E,!1),S!==null&&C!==null&&Y_(m,C,S,E,!0)}}t:{if(g=p?Sd(p):window,v=g.nodeName&&g.nodeName.toLowerCase(),v==="select"||v==="input"&&g.type==="file")var z=a_;else if(i_(g))if(jz)z=gV;else{z=pV;var D=hV}else v=g.nodeName,!v||v.toLowerCase()!=="input"||g.type!=="checkbox"&&g.type!=="radio"?p&&hE(p.elementType)&&(z=a_):z=mV;if(z&&(z=z(t,p))){Vz(m,z,n,f);break t}D&&D(t,g,p),t==="focusout"&&p&&g.type==="number"&&p.memoizedProps.value!=null&&Rx(g,"number",g.value)}switch(D=p?Sd(p):window,t){case"focusin":(i_(D)||D.contentEditable==="true")&&(lc=D,Cx=p,Ad=null);break;case"focusout":Ad=Cx=lc=null;break;case"mousedown":wx=!0;break;case"contextmenu":case"mouseup":case"dragend":wx=!1,s_(m,n,f);break;case"selectionchange":if(vV)break;case"keydown":case"keyup":s_(m,n,f)}var I;if(yE)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 rc?Hz(t,n)&&(q="onCompositionEnd"):t==="keydown"&&n.keyCode===229&&(q="onCompositionStart");q&&(Bz&&n.locale!=="ko"&&(rc||q!=="onCompositionStart"?q==="onCompositionEnd"&&rc&&(I=Pz()):(Kr=f,mE="value"in Kr?Kr.value:Kr.textContent,rc=!0)),D=oy(p,q),0<D.length&&(q=new $O(q,t,null,n,f),m.push({event:q,listeners:D}),I?q.data=I:(I=Uz(n),I!==null&&(q.data=I)))),(I=sV?uV(t,n):cV(t,n))&&(q=oy(p,"onBeforeInput"),0<q.length&&(D=new $O("onBeforeInput","beforeinput",null,n,f),m.push({event:D,listeners:q}),D.data=I)),e8(m,t,p,n,f)}L3(m,e)})}function kd(t,e,n){return{instance:t,listener:e,currentTarget:n}}function oy(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=Pd(t,n),a!=null&&i.unshift(kd(t,a,o)),a=Pd(t,e),a!=null&&i.push(kd(t,a,o))),t.tag===3)return i;t=t.return}return[]}function i8(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function Y_(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=Pd(n,o),p!=null&&s.unshift(kd(n,p,d))):a||(p=Pd(n,o),p!=null&&s.push(kd(n,p,d)))),n=n.return}s.length!==0&&t.push({event:e,listeners:s})}var a8=/\r\n?/g,o8=/\u0000|\uFFFD/g;function Q_(t){return(typeof t=="string"?t:""+t).replace(a8,`
20
- `).replace(o8,"")}function B3(t,e){return e=Q_(e),Q_(t)===e}function be(t,e,n,i,a,o){switch(n){case"children":typeof i=="string"?e==="body"||e==="textarea"&&i===""||Rc(t,i):(typeof i=="number"||typeof i=="bigint")&&e!=="body"&&Rc(t,""+i);break;case"className":sg(t,"class",i);break;case"tabIndex":sg(t,"tabindex",i);break;case"dir":case"role":case"viewBox":case"width":case"height":sg(t,n,i);break;case"style":Dz(t,i,o);break;case"data":if(e!=="object"){sg(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=Rg(""+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=Rg(""+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(J(61));if(n=i.__html,n!=null){if(a.children!=null)throw Error(J(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=Rg(""+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),Eg(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":Eg(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=LU.get(n)||n,Eg(t,n,i))}}function Jx(t,e,n,i,a,o){switch(n){case"style":Dz(t,i,o);break;case"dangerouslySetInnerHTML":if(i!=null){if(typeof i!="object"||!("__html"in i))throw Error(J(61));if(n=i.__html,n!=null){if(a.children!=null)throw Error(J(60));t.innerHTML=n}}break;case"children":typeof i=="string"?Rc(t,i):(typeof i=="number"||typeof i=="bigint")&&Rc(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(!Mz.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,""):Eg(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(J(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(J(137,e));break;default:be(t,e,i,f,n,null)}}zz(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?mc(t,!!i,e,!1):n!=null&&mc(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(J(91));break;default:be(t,e,s,u,n,null)}Iz(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<Gd.length;i++)kt(Gd[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(J(137,e));default:be(t,e,p,i,n,null)}return;default:if(hE(e)){for(f in n)n.hasOwnProperty(f)&&(i=n[f],i!==void 0&&Jx(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 r8(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(J(137,e));break;default:v!==m&&be(t,e,g,v,i,m)}}Ex(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?mc(t,!!n,g,!1):!!i!=!!n&&(e!=null?mc(t,!!n,e,!0):mc(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(J(91));break;default:a!==o&&be(t,e,s,a,i,o)}Nz(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(J(137,e));break;default:be(t,e,p,g,i,v)}return;default:if(hE(e)){for(var C in n)g=n[C],n.hasOwnProperty(C)&&g!==void 0&&!i.hasOwnProperty(C)&&Jx(t,e,C,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||Jx(t,e,f,g,i,v);return}}for(var R in n)g=n[R],n.hasOwnProperty(R)&&g!=null&&!i.hasOwnProperty(R)&&be(t,e,R,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 X_(t){switch(t){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function l8(){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&&X_(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&&X_(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 Wx=null,$x=null;function ry(t){return t.nodeType===9?t:t.ownerDocument}function K_(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 H3(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 tE(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 cx=null;function s8(){var t=window.event;return t&&t.type==="popstate"?t===cx?!1:(cx=t,!0):(cx=null,!1)}var U3=typeof setTimeout=="function"?setTimeout:void 0,u8=typeof clearTimeout=="function"?clearTimeout:void 0,Z_=typeof Promise=="function"?Promise:void 0,c8=typeof queueMicrotask=="function"?queueMicrotask:typeof Z_<"u"?function(t){return Z_.resolve(null).then(t).catch(f8)}:U3;function f8(t){setTimeout(function(){throw t})}function hl(t){return t==="head"}function J_(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),zc(e);return}i--}else if(n==="$"||n==="$?"||n==="$~"||n==="$!"||n==="&")i++;else if(n==="html")Dd(t.ownerDocument.documentElement);else if(n==="head"){n=t.ownerDocument.head,Dd(n);for(var o=n.firstChild;o;){var s=o.nextSibling,u=o.nodeName;o[$d]||u==="SCRIPT"||u==="STYLE"||u==="LINK"&&o.rel.toLowerCase()==="stylesheet"||n.removeChild(o),o=s}}else n==="body"&&Dd(t.ownerDocument.body);n=a}while(n);zc(e)}function W_(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 eE(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":eE(n),dE(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}t.removeChild(n)}}function d8(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[$d])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 h8(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 V3(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 nE(t){return t.data==="$?"||t.data==="$~"}function iE(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState!=="loading"}function p8(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 aE=null;function $_(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 tz(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 j3(t,e,n){switch(e=ry(n),t){case"html":if(t=e.documentElement,!t)throw Error(J(452));return t;case"head":if(t=e.head,!t)throw Error(J(453));return t;case"body":if(t=e.body,!t)throw Error(J(454));return t;default:throw Error(J(451))}}function Dd(t){for(var e=t.attributes;e.length;)t.removeAttributeNode(e[0]);dE(t)}var wa=new Map,ez=new Set;function ly(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var nr=ue.d;ue.d={f:m8,r:g8,D:y8,C:v8,L:S8,m:b8,X:E8,S:x8,M:R8};function m8(){var t=nr.f(),e=Ay();return t||e}function g8(t){var e=Ic(t);e!==null&&e.tag===5&&e.type==="form"?DN(e):nr.r(t)}var Bc=typeof document>"u"?null:document;function q3(t,e,n){var i=Bc;if(i&&typeof e=="string"&&e){var a=Ea(e);a='link[rel="'+t+'"][href="'+a+'"]',typeof n=="string"&&(a+='[crossorigin="'+n+'"]'),ez.has(a)||(ez.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 y8(t){nr.D(t),q3("dns-prefetch",t,null)}function v8(t,e){nr.C(t,e),q3("preconnect",t,e)}function S8(t,e,n){nr.L(t,e,n);var i=Bc;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=_c(t);break;case"script":o=Hc(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(oh(o))||e==="script"&&i.querySelector(rh(o))||(e=i.createElement("link"),Qn(e,"link",t),In(e),i.head.appendChild(e)))}}function b8(t,e){nr.m(t,e);var n=Bc;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=Hc(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(rh(o)))return}i=n.createElement("link"),Qn(i,"link",t),In(i),n.head.appendChild(i)}}}function x8(t,e,n){nr.S(t,e,n);var i=Bc;if(i&&t){var a=pc(i).hoistableStyles,o=_c(t);e=e||"default";var s=a.get(o);if(!s){var u={loading:0,preload:null};if(s=i.querySelector(oh(o)))u.loading=5;else{t=Ne({rel:"stylesheet",href:t,"data-precedence":e},n),(n=wa.get(o))&&JE(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,Ig(s,e,i)}s={type:"stylesheet",instance:s,count:1,state:u},a.set(o,s)}}}function E8(t,e){nr.X(t,e);var n=Bc;if(n&&t){var i=pc(n).hoistableScripts,a=Hc(t),o=i.get(a);o||(o=n.querySelector(rh(a)),o||(t=Ne({src:t,async:!0},e),(e=wa.get(a))&&WE(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 R8(t,e){nr.M(t,e);var n=Bc;if(n&&t){var i=pc(n).hoistableScripts,a=Hc(t),o=i.get(a);o||(o=n.querySelector(rh(a)),o||(t=Ne({src:t,async:!0,type:"module"},e),(e=wa.get(a))&&WE(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 nz(t,e,n,i){var a=(a=$r.current)?ly(a):null;if(!a)throw Error(J(446));switch(t){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(e=_c(n.href),n=pc(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=_c(n.href);var o=pc(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(oh(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||A8(a,t,n,s.state))),e&&i===null)throw Error(J(528,""));return s}if(e&&i!==null)throw Error(J(529,""));return null;case"script":return e=n.async,n=n.src,typeof n=="string"&&e&&typeof e!="function"&&typeof e!="symbol"?(e=Hc(n),n=pc(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(J(444,t))}}function _c(t){return'href="'+Ea(t)+'"'}function oh(t){return'link[rel="stylesheet"]['+t+"]"}function F3(t){return Ne({},t,{"data-precedence":t.precedence,precedence:null})}function A8(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 Hc(t){return'[src="'+Ea(t)+'"]'}function rh(t){return"script[async]"+t}function iz(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),Ig(i,n.precedence,t),e.instance=i;case"stylesheet":a=_c(n.href);var o=t.querySelector(oh(a));if(o)return e.state.loading|=4,e.instance=o,In(o),o;i=F3(n),(a=wa.get(a))&&JE(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,Ig(o,n.precedence,t),e.instance=o;case"script":return o=Hc(n.src),(a=t.querySelector(rh(o)))?(e.instance=a,In(a),a):(i=n,(a=wa.get(o))&&(i=Ne({},n),WE(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(J(443,e.type))}else e.type==="stylesheet"&&!(e.state.loading&4)&&(i=e.instance,e.state.loading|=4,Ig(i,n.precedence,t));return e.instance}function Ig(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 JE(t,e){t.crossOrigin==null&&(t.crossOrigin=e.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=e.referrerPolicy),t.title==null&&(t.title=e.title)}function WE(t,e){t.crossOrigin==null&&(t.crossOrigin=e.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=e.referrerPolicy),t.integrity==null&&(t.integrity=e.integrity)}var Dg=null;function az(t,e,n){if(Dg===null){var i=new Map,a=Dg=new Map;a.set(n,i)}else a=Dg,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[$d]||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 oz(t,e,n){t=t.ownerDocument||t,t.head.insertBefore(n,e==="title"?t.querySelector("head > title"):null)}function T8(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 G3(t){return!(t.type==="stylesheet"&&!(t.state.loading&3))}function C8(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=_c(i.href),o=e.querySelector(oh(a));if(o){e=o._p,e!==null&&typeof e=="object"&&typeof e.then=="function"&&(t.count++,t=sy.bind(t),e.then(t,t)),n.state.loading|=4,n.instance=o,In(o);return}o=e.ownerDocument||e,i=F3(i),(a=wa.get(a))&&JE(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=sy.bind(t),e.addEventListener("load",n),e.addEventListener("error",n))}}var fx=0;function w8(t,e){return t.stylesheets&&t.count===0&&Lg(t,t.stylesheets),0<t.count||0<t.imgCount?function(n){var i=setTimeout(function(){if(t.stylesheets&&Lg(t,t.stylesheets),t.unsuspend){var o=t.unsuspend;t.unsuspend=null,o()}},6e4+e);0<t.imgBytes&&fx===0&&(fx=62500*l8());var a=setTimeout(function(){if(t.waitingForImages=!1,t.count===0&&(t.stylesheets&&Lg(t,t.stylesheets),t.unsuspend)){var o=t.unsuspend;t.unsuspend=null,o()}},(t.imgBytes>fx?50:800)+e);return t.unsuspend=n,function(){t.unsuspend=null,clearTimeout(i),clearTimeout(a)}}:null}function sy(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Lg(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var uy=null;function Lg(t,e){t.stylesheets=null,t.unsuspend!==null&&(t.count++,uy=new Map,e.forEach(M8,t),uy=null,sy.call(t))}function M8(t,e){if(!(e.state.loading&4)){var n=uy.get(t);if(n)var i=n.get(null);else{n=new Map,uy.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=sy.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 Yd={$$typeof:ko,Provider:null,Consumer:null,_currentValue:vs,_currentValue2:vs,_threadCount:0};function O8(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=Bb(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Bb(0),this.hiddenUpdates=Bb(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 k3(t,e,n,i,a,o,s,u,d,p,f,m){return t=new O8(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=AE(),e.refCount++,t.pooledCache=e,e.refCount++,o.memoizedState={element:i,isDehydrated:n,cache:e},wE(o),t}function Y3(t){return t?(t=cc,t):cc}function Q3(t,e,n,i,a,o){a=Y3(a),i.context===null?i.context=a:i.pendingContext=a,i=el(e),i.payload={element:n},o=o===void 0?null:o,o!==null&&(i.callback=o),n=nl(t,i,e),n!==null&&(wi(n,t,e),Cd(n,t,e))}function rz(t,e){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var n=t.retryLane;t.retryLane=n!==0&&n<e?n:e}}function $E(t,e){rz(t,e),(t=t.alternate)&&rz(t,e)}function X3(t){if(t.tag===13||t.tag===31){var e=zs(t,67108864);e!==null&&wi(e,t,67108864),$E(t,67108864)}}function lz(t){if(t.tag===13||t.tag===31){var e=ea();e=cE(e);var n=zs(t,e);n!==null&&wi(n,t,e),$E(t,e)}}var cy=!0;function _8(t,e,n,i){var a=_t.T;_t.T=null;var o=ue.p;try{ue.p=2,tR(t,e,n,i)}finally{ue.p=o,_t.T=a}}function z8(t,e,n,i){var a=_t.T;_t.T=null;var o=ue.p;try{ue.p=8,tR(t,e,n,i)}finally{ue.p=o,_t.T=a}}function tR(t,e,n,i){if(cy){var a=oE(i);if(a===null)ux(t,e,i,fy,n),sz(t,i);else if(I8(a,t,e,n,i))i.stopPropagation();else if(sz(t,i),e&4&&-1<N8.indexOf(t)){for(;a!==null;){var o=Ic(a);if(o!==null)switch(o.tag){case 3:if(o=o.stateNode,o.current.memoizedState.isDehydrated){var s=ms(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)&&(ty=Wi()+500,ah(0,!1))}}break;case 31:case 13:u=zs(o,2),u!==null&&wi(u,o,2),Ay(),$E(o,2)}if(o=oE(i),o===null&&ux(t,e,i,fy,n),o===a)break;a=o}a!==null&&i.stopPropagation()}else ux(t,e,i,null,n)}}function oE(t){return t=pE(t),eR(t)}var fy=null;function eR(t){if(fy=null,t=ac(t),t!==null){var e=Kd(t);if(e===null)t=null;else{var n=e.tag;if(n===13){if(t=pz(e),t!==null)return t;t=null}else if(n===31){if(t=mz(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 fy=t,null}function K3(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(SU()){case Sz:return 2;case bz:return 8;case Vg:case bU:return 32;case xz:return 268435456;default:return 32}default:return 32}}var rE=!1,ol=null,rl=null,ll=null,Qd=new Map,Xd=new Map,Qr=[],N8="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 sz(t,e){switch(t){case"focusin":case"focusout":ol=null;break;case"dragenter":case"dragleave":rl=null;break;case"mouseover":case"mouseout":ll=null;break;case"pointerover":case"pointerout":Qd.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":Xd.delete(e.pointerId)}}function md(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=Ic(e),e!==null&&X3(e)),t):(t.eventSystemFlags|=i,e=t.targetContainers,a!==null&&e.indexOf(a)===-1&&e.push(a),t)}function I8(t,e,n,i,a){switch(e){case"focusin":return ol=md(ol,t,e,n,i,a),!0;case"dragenter":return rl=md(rl,t,e,n,i,a),!0;case"mouseover":return ll=md(ll,t,e,n,i,a),!0;case"pointerover":var o=a.pointerId;return Qd.set(o,md(Qd.get(o)||null,t,e,n,i,a)),!0;case"gotpointercapture":return o=a.pointerId,Xd.set(o,md(Xd.get(o)||null,t,e,n,i,a)),!0}return!1}function Z3(t){var e=ac(t.target);if(e!==null){var n=Kd(e);if(n!==null){if(e=n.tag,e===13){if(e=pz(n),e!==null){t.blockedOn=e,kO(t.priority,function(){lz(n)});return}}else if(e===31){if(e=mz(n),e!==null){t.blockedOn=e,kO(t.priority,function(){lz(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 Pg(t){if(t.blockedOn!==null)return!1;for(var e=t.targetContainers;0<e.length;){var n=oE(t.nativeEvent);if(n===null){n=t.nativeEvent;var i=new n.constructor(n.type,n);Ax=i,n.target.dispatchEvent(i),Ax=null}else return e=Ic(n),e!==null&&X3(e),t.blockedOn=n,!1;e.shift()}return!0}function uz(t,e,n){Pg(t)&&n.delete(e)}function D8(){rE=!1,ol!==null&&Pg(ol)&&(ol=null),rl!==null&&Pg(rl)&&(rl=null),ll!==null&&Pg(ll)&&(ll=null),Qd.forEach(uz),Xd.forEach(uz)}function bg(t,e){t.blockedOn===e&&(t.blockedOn=null,rE||(rE=!0,Cn.unstable_scheduleCallback(Cn.unstable_NormalPriority,D8)))}var xg=null;function cz(t){xg!==t&&(xg=t,Cn.unstable_scheduleCallback(Cn.unstable_NormalPriority,function(){xg===t&&(xg=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(eR(i||n)===null)continue;break}var o=Ic(n);o!==null&&(t.splice(e,3),e-=3,Vx(o,{pending:!0,data:a,method:n.method,action:i},i,a))}}))}function zc(t){function e(d){return bg(d,t)}ol!==null&&bg(ol,t),rl!==null&&bg(rl,t),ll!==null&&bg(ll,t),Qd.forEach(e),Xd.forEach(e);for(var n=0;n<Qr.length;n++){var i=Qr[n];i.blockedOn===t&&(i.blockedOn=null)}for(;0<Qr.length&&(n=Qr[0],n.blockedOn===null);)Z3(n),n.blockedOn===null&&Qr.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||cz(n);else if(s){var u=null;if(o&&o.hasAttribute("formAction")){if(a=o,s=o[Mi]||null)u=s.formAction;else if(eR(a)!==null)continue}else u=s.action;typeof u=="function"?n[i+1]=u:(n.splice(i,3),i-=3),cz(n)}}}function J3(){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 nR(t){this._internalRoot=t}wy.prototype.render=nR.prototype.render=function(t){var e=this._internalRoot;if(e===null)throw Error(J(409));var n=e.current,i=ea();Q3(n,i,t,e,null,null)};wy.prototype.unmount=nR.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var e=t.containerInfo;Q3(t.current,2,null,t,null,null),Ay(),e[Nc]=null}};function wy(t){this._internalRoot=t}wy.prototype.unstable_scheduleHydration=function(t){if(t){var e=Cz();t={blockedOn:null,target:t,priority:e};for(var n=0;n<Qr.length&&e!==0&&e<Qr[n].priority;n++);Qr.splice(n,0,t),n===0&&Z3(t)}};var fz=dz.version;if(fz!=="19.2.0")throw Error(J(527,fz,"19.2.0"));ue.findDOMNode=function(t){var e=t._reactInternals;if(e===void 0)throw typeof t.render=="function"?Error(J(188)):(t=Object.keys(t).join(","),Error(J(268,t)));return t=dU(e),t=t!==null?gz(t):null,t=t===null?null:t.stateNode,t};var L8={bundleType:0,version:"19.2.0",rendererPackageName:"react-dom",currentDispatcherRef:_t,reconcilerVersion:"19.2.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&(gd=__REACT_DEVTOOLS_GLOBAL_HOOK__,!gd.isDisabled&&gd.supportsFiber))try{Zd=gd.inject(L8),$i=gd}catch{}var gd;My.createRoot=function(t,e){if(!hz(t))throw Error(J(299));var n=!1,i="",a=qN,o=FN,s=GN;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=k3(t,1,!1,null,null,n,i,null,a,o,s,J3),t[Nc]=e.current,ZE(t),new nR(e)};My.hydrateRoot=function(t,e,n){if(!hz(t))throw Error(J(299));var i=!1,a="",o=qN,s=FN,u=GN,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=k3(t,1,!0,e,n??null,i,a,d,o,s,u,J3),e.context=Y3(null),n=e.current,i=ea(),i=cE(i),a=el(i),a.callback=null,nl(n,a,i),n=i,e.current.lanes=n,Wd(e,n),po(e),t[Nc]=e.current,ZE(t),new wy(e)};My.version="19.2.0"});var eI=ui((sY,tI)=>{"use strict";function $3(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE($3)}catch(t){console.error(t)}}$3(),tI.exports=W3()});var u4=ui((Gnt,s4)=>{"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,C=Math.max,R=Math.min,x=function(){return S.Date.now()};function A(M){var z=typeof M;return!!M&&(z=="object"||z=="function")}function T(M){if(typeof M=="number")return M;if(function(I){return typeof I=="symbol"||function(q){return!!q&&typeof q=="object"}(I)&&E.call(I)=="[object Symbol]"}(M))return NaN;if(A(M)){var z=typeof M.valueOf=="function"?M.valueOf():M;M=A(z)?z+"":z}if(typeof M!="string")return M===0?M:+M;M=M.replace(u,"");var D=p.test(M);return D||f.test(M)?m(M.slice(2),D?2:8):d.test(M)?NaN:+M}a.exports=function(M,z,D){var I,q,B,U,W,it,K=0,tt=!1,ut=!1,xt=!0;if(typeof M!="function")throw new TypeError("Expected a function");function lt(ee){var ce=I,le=q;return I=q=void 0,K=ee,U=M.apply(le,ce)}function ft(ee){var ce=ee-it;return it===void 0||ce>=z||ce<0||ut&&ee-K>=B}function Rt(){var ee=x();if(ft(ee))return X(ee);W=setTimeout(Rt,function(ce){var le=z-(ce-it);return ut?R(le,B-(ce-K)):le}(ee))}function X(ee){return W=void 0,xt&&I?lt(ee):(I=q=void 0,U)}function Ct(){var ee=x(),ce=ft(ee);if(I=arguments,q=this,it=ee,ce){if(W===void 0)return function(le){return K=le,W=setTimeout(Rt,z),tt?lt(le):U}(it);if(ut)return W=setTimeout(Rt,z),lt(it)}return W===void 0&&(W=setTimeout(Rt,z)),U}return z=T(z)||0,A(D)&&(tt=!!D.leading,B=(ut="maxWait"in D)?C(T(D.maxWait)||0,z):B,xt="trailing"in D?!!D.trailing:xt),Ct.cancel=function(){W!==void 0&&clearTimeout(W),K=0,I=it=q=W=void 0},Ct.flush=function(){return W===void 0?U:X(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,C=typeof self=="object"&&self&&self.Object===Object&&self,R=E||C||Function("return this")(),x=Object.prototype.toString,A=Math.max,T=Math.min,M=function(){return R.Date.now()};function z(I){var q=typeof I;return!!I&&(q=="object"||q=="function")}function D(I){if(typeof I=="number")return I;if(function(U){return typeof U=="symbol"||function(W){return!!W&&typeof W=="object"}(U)&&x.call(U)==p}(I))return d;if(z(I)){var q=typeof I.valueOf=="function"?I.valueOf():I;I=z(q)?q+"":q}if(typeof I!="string")return I===0?I:+I;I=I.replace(f,"");var B=g.test(I);return B||v.test(I)?S(I.slice(2),B?2:8):m.test(I)?d:+I}a.exports=function(I,q,B){var U=!0,W=!0;if(typeof I!="function")throw new TypeError(u);return z(B)&&(U="leading"in B?!!B.leading:U,W="trailing"in B?!!B.trailing:W),function(it,K,tt){var ut,xt,lt,ft,Rt,X,Ct=0,ee=!1,ce=!1,le=!0;if(typeof it!="function")throw new TypeError(u);function pe(me){var ge=ut,$t=xt;return ut=xt=void 0,Ct=me,ft=it.apply($t,ge)}function De(me){var ge=me-X;return X===void 0||ge>=K||ge<0||ce&&me-Ct>=lt}function ne(){var me=M();if(De(me))return Di(me);Rt=setTimeout(ne,function(ge){var $t=K-(ge-X);return ce?T($t,lt-(ge-Ct)):$t}(me))}function Di(me){return Rt=void 0,le&&ut?pe(me):(ut=xt=void 0,ft)}function ri(){var me=M(),ge=De(me);if(ut=arguments,xt=this,X=me,ge){if(Rt===void 0)return function($t){return Ct=$t,Rt=setTimeout(ne,K),ee?pe($t):ft}(X);if(ce)return Rt=setTimeout(ne,K),pe(X)}return Rt===void 0&&(Rt=setTimeout(ne,K)),ft}return K=D(K)||0,z(tt)&&(ee=!!tt.leading,lt=(ce="maxWait"in tt)?A(D(tt.maxWait)||0,K):lt,le="trailing"in tt?!!tt.trailing:le),ri.cancel=function(){Rt!==void 0&&clearTimeout(Rt),Ct=0,ut=X=xt=Rt=void 0},ri.flush=function(){return Rt===void 0?ft:Di(M())},ri}(I,q,{leading:U,maxWait:q,trailing:W})}},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,C,R,x){if(x!==u){var A=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 A.name="Invariant Violation",A}}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:()=>X});let a=nt();var o=n.n(a),s=n(697);let u=ds();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 at=Object.getOwnPropertySymbols(j);L&&(at=at.filter(function(Nt){return Object.getOwnPropertyDescriptor(j,Nt).enumerable})),$.push.apply($,at)}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 at=L[$];at.enumerable=at.enumerable||!1,at.configurable=!0,"value"in at&&(at.writable=!0),Object.defineProperty(j,S(at.key),at)}}function S(j){var L=function($,at){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($,at){return $.__proto__=at,$},E(j,L)}function C(j){return C=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(L){return L.__proto__||Object.getPrototypeOf(L)},C(j)}var R=function(j){j.forEach(function(L){L.isIntersecting&&L.target.onVisible()})},x={},A=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,$,at,Nt,Lt=(at=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=C(at);if(Nt){var mt=C(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(R,{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);A.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])},A.defaultProps={className:"",placeholder:null,threshold:100,useIntersectionObserver:!0};let T=A;var M=n(296),z=n.n(M),D=n(96),I=n.n(D),q=function(j){var L=getComputedStyle(j,null);return L.getPropertyValue("overflow")+L.getPropertyValue("overflow-y")+L.getPropertyValue("overflow-x")};let B=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 W=["delayMethod","delayTime"];function it(){return it=Object.assign?Object.assign.bind():function(j){for(var L=1;L<arguments.length;L++){var $=arguments[L];for(var at in $)Object.prototype.hasOwnProperty.call($,at)&&(j[at]=$[at])}return j},it.apply(this,arguments)}function K(j,L){for(var $=0;$<L.length;$++){var at=L[$];at.enumerable=at.enumerable||!1,at.configurable=!0,"value"in at&&(at.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)}(at.key),U(Nt)==="symbol"?Nt:String(Nt)),at)}var Nt}function tt(j,L){return tt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function($,at){return $.__proto__=at,$},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 ft=function(){return typeof window>"u"?0:window.scrollX||window.pageXOffset},Rt=function(){return typeof window>"u"?0:window.scrollY||window.pageYOffset};let X=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 at,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=I()(pt,mt.delayTime)),yt.state={scrollPosition:{x:ft(),y:Rt()}},yt.baseComponentRef=o().createRef(),yt}return at=Z,(Nt=[{key:"componentDidMount",value:function(){this.addListeners()}},{key:"componentWillUnmount",value:function(){this.removeListeners()}},{key:"componentDidUpdate",value:function(){typeof window>"u"||this.useIntersectionObserver||B(d().findDOMNode(this.baseComponentRef.current))!==this.scrollElement&&(this.removeListeners(),this.addListeners())}},{key:"addListeners",value:function(){typeof window>"u"||this.useIntersectionObserver||(this.scrollElement=B(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:ft(),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,Dl,Ll={},mr=Object.keys(xn);for(Dl=0;Dl<mr.length;Dl++)$a=mr[Dl],yi.indexOf($a)>=0||(Ll[$a]=xn[$a]);return Ll}(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,W)),pt=this.useIntersectionObserver?null:this.state.scrollPosition;return o().createElement(j,it({forwardRef:this.baseComponentRef,scrollPosition:pt},yt))}}])&&K(at.prototype,Nt),Object.defineProperty(at,"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 at=L[$];at.enumerable=at.enumerable||!1,at.configurable=!0,"value"in at&&(at.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)}(at.key),Ct(Nt)==="symbol"?Nt:String(Nt)),at)}var Nt}function ce(j,L){return ce=Object.setPrototypeOf?Object.setPrototypeOf.bind():function($,at){return $.__proto__=at,$},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,$,at,Nt,Lt=(at=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(at);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(T,this.props)}}])&&ee(L.prototype,$),Object.defineProperty(L,"prototype",{writable:!1}),jt}(o().Component);let De=X(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 at=L[$];at.enumerable=at.enumerable||!1,at.configurable=!0,"value"in at&&(at.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)}(at.key),ne(Nt)==="symbol"?Nt:String(Nt)),at)}var Nt}function ri(j,L){return ri=Object.setPrototypeOf?Object.setPrototypeOf.bind():function($,at){return $.__proto__=at,$},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,$,at,Nt,Lt=(at=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(at);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(T,{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 at=Object.getOwnPropertySymbols(j);L&&(at=at.filter(function(Nt){return Object.getOwnPropertyDescriptor(j,Nt).enumerable})),$.push.apply($,at)}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(at){Zn(j,at,$[at])}):Object.getOwnPropertyDescriptors?Object.defineProperties(j,Object.getOwnPropertyDescriptors($)):te(Object($)).forEach(function(at){Object.defineProperty(j,at,Object.getOwnPropertyDescriptor($,at))})}return j}function Zn(j,L,$){return(L=P(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 at in $)Object.prototype.hasOwnProperty.call($,at)&&(j[at]=$[at])}return j},tn.apply(this,arguments)}function bn(j,L){for(var $=0;$<L.length;$++){var at=L[$];at.enumerable=at.enumerable||!1,at.configurable=!0,"value"in at&&(at.writable=!0),Object.defineProperty(j,P(at.key),at)}}function P(j){var L=function($,at){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($,at){return $.__proto__=at,$},Q(j,L)}function dt(j){return dt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(L){return L.__proto__||Object.getPrototypeOf(L)},dt(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,$,at,Nt,Lt=(at=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=dt(at);if(Nt){var mt=dt(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})(),s4.exports=i})()});var BF={};HP(BF,{AnnotationContext:()=>gF,AnnotationPageContext:()=>yF,AnnotationStyleProvider:()=>Rq,AtlasStoreProvider:()=>Gc,AtlasStoreReactContext:()=>Ls,Auth:()=>db,AuthProvider:()=>cb,AuthRContext:()=>ss,AuthReactContext:()=>TM,AuthReactContextActions:()=>CM,CanvasAnnotations:()=>oF,CanvasContext:()=>ma,CanvasPanel:()=>wn,CanvasStrategyProvider:()=>LA,CanvasWorldObject:()=>BA,CollectionContext:()=>vF,CombinedMetadata:()=>rF,ComplexTimelineProvider:()=>XR,ContextBridge:()=>Xh,ControlsReactContext:()=>Oh,CreateCustomShape:()=>jA,CustomContextBridge:()=>qL,CustomContextBridgeProvider:()=>q7,DEFAULT_BEZIER:()=>cp,DEFAULT_POLL_INTERVAL:()=>KA,DefaultEditingTools:()=>YL,EASING_PRESETS:()=>ZA,EventEmitterProvider:()=>Dj,EventsProvider:()=>j7,Image:()=>r4,ImageService:()=>sF,ImageServiceLoaderContext:()=>RD,InnerViewerProvider:()=>NM,LanguageProvider:()=>zq,LanguageString:()=>LD,LocaleString:()=>oa,ManifestContext:()=>$1,ManifestMetadata:()=>cF,MediaPlayerProvider:()=>wh,Metadata:()=>sp,PolygonSelector:()=>aF,RangeContext:()=>tb,ReactEmitterContext:()=>rv,ReactEventContext:()=>Xs,ReactVaultContext:()=>Br,RegionHighlight:()=>MR,Render3DModelStrategy:()=>BR,RenderAccompanyingCanvas:()=>HR,RenderAnnotation:()=>Bs,RenderAnnotationEditing:()=>AA,RenderAnnotationPage:()=>xl,RenderAnnotationStrategy:()=>FR,RenderAudioStrategy:()=>YR,RenderComplexTimelineStrategy:()=>WR,RenderEmptyStrategy:()=>$R,RenderImageStrategy:()=>tA,RenderSvgEditorControls:()=>mF,RenderTextualContentStrategy:()=>eA,RenderVideoStrategy:()=>iA,RenderYouTubeStrategy:()=>aA,ResizeWorldItem:()=>CR,ResourceProvider:()=>ci,ResourceReactContext:()=>qf,SelectorControllerProvider:()=>eF,SequenceThumbnails:()=>hF,SimpleViewerProvider:()=>pb,SimpleViewerReactContext:()=>Fu,SingleCanvasThumbnail:()=>YA,StrategyReactContext:()=>Rl,ThumbnailFallbackImage:()=>qs,TranslationProvider:()=>_q,TransliterationProvider:()=>Nq,VaultProvider:()=>Io,ViewerPresetContext:()=>Xa,VirtualAnnotationProvider:()=>qR,VisibleCanvasReactContext:()=>rs,annotationResponseToSelector:()=>PF,authDetailsForResource:()=>lb,buildTransitions:()=>WA,createAtlasStore:()=>vR,createAuthStateStore:()=>ob,createProbe:()=>rb,cubicBezierEasing:()=>ff,defaultEmitter:()=>VL,defaultSvgTheme:()=>YD,emptyActions:()=>TA,emptyStrategy:()=>CA,expandTarget:()=>an,findAllCanvasesInRange:()=>Um,findFirstCanvasFromRange:()=>lM,findManifestSelectedRange:()=>D6,findSelectedRange:()=>eb,flattenAnnotationPageIds:()=>wA,formatTime:()=>hv,get3dStrategy:()=>_A,getAtlasStoreByName:()=>xR,getComplexTimelineStrategy:()=>zA,getDefaultAnnotationStyles:()=>ER,getImageStrategy:()=>np,getManifestSequence:()=>Vm,getParsedTargetSelector:()=>Jh,getRenderingStrategy:()=>op,getStepFromProgress:()=>$A,getTextualContentStrategy:()=>ip,getVideoStrategy:()=>ap,getVisibleCanvasesFromCanvasId:()=>L6,hasAuth:()=>nH,interpolateRect:()=>JA,isBoxSelector:()=>xq,isImageApiSelector:()=>om,isRectangle:()=>qc,isSvgSelector:()=>$I,makeAccessServiceRequest:()=>ab,makeAccessTokenRequest:()=>Gm,parseRotation:()=>rm,parseSelector:()=>_o,parseSpecificResource:()=>F7,polygonToTarget:()=>Fc,requestToAnnotationResponse:()=>Eh,seraliseSupportedSelector:()=>cv,svgThemes:()=>tF,targetIntersects:()=>DF,unknownResponse:()=>Wh,unsupportedStrategy:()=>Be,useAnnotation:()=>Ah,useAnnotationPage:()=>OR,useAnnotationPageManager:()=>tp,useAnnotationStyles:()=>Rh,useAnnotationsAtTime:()=>SF,useAtlasContextMenu:()=>Zh,useAtlasStore:()=>Ie,useAuthActions:()=>wM,useAuthService:()=>MM,useAuthStore:()=>ju,useAuthToken:()=>aH,useAuthTokens:()=>sb,useCanvas:()=>zt,useCanvasChoices:()=>bF,useCanvasClock:()=>xF,useCanvasSequence:()=>nb,useCanvasStartTime:()=>Mh,useCanvasSubset:()=>EF,useClosestLanguage:()=>BD,useCollection:()=>RF,useComplexTimeline:()=>Oq,useContextBridge:()=>Qh,useContextMenuStore:()=>kL,useCreateLocaleString:()=>Iq,useCurrentAnnotationActions:()=>AF,useCurrentAnnotationMetadata:()=>TF,useCurrentAnnotationRequest:()=>RA,useCurrentAnnotationTransition:()=>CF,useCurrentAuth:()=>iH,useCustomContextBridge:()=>Yh,useDispatch:()=>UR,useEmitter:()=>gR,useEvent:()=>Ds,useEventEmitter:()=>Gh,useEventListener:()=>wF,useExistingVault:()=>Do,useExternalCollection:()=>MF,useExternalManifest:()=>W1,useExternalResource:()=>$f,useIIIFLanguage:()=>Av,useImage:()=>t0,useImageService:()=>XA,useImageServiceLoader:()=>_h,useImageTile:()=>OF,useIsAuthEnabled:()=>fb,useLoadImageService:()=>ep,useLocaleString:()=>HD,useManifest:()=>on,useMediaActions:()=>Tq,useMediaElements:()=>Cq,useMediaState:()=>Aq,usePaintables:()=>OA,usePaintingAnnotations:()=>dr,usePolygonHelper:()=>oA,useRange:()=>td,useRemoteStylesheet:()=>AR,useRenderControls:()=>hi,useRenderingStrategy:()=>IA,useRequestAnnotation:()=>VA,useResourceContext:()=>ti,useResourceEvents:()=>Ch,useResources:()=>MA,useSearchService:()=>hb,useSelectorController:()=>FA,useSelectorEmitter:()=>nF,useSelectorEvents:()=>qA,useSelectorHelper:()=>iF,useSimpleMediaPlayer:()=>Hs,useSimpleViewer:()=>us,useStaticRenderingStrategy:()=>_F,useStrategy:()=>Fe,useStyleHelper:()=>zF,useStyles:()=>Ps,useStylesheetStore:()=>eD,useSvgEditor:()=>rA,useSvgEditorControls:()=>QA,useThumbnail:()=>lr,useTranslations:()=>ZR,useTransliteration:()=>KR,useVault:()=>Vt,useVaultEffect:()=>GR,useVaultSelector:()=>re,useViewerPreset:()=>zh,useViewportScroll:()=>IF,useViewportTour:()=>NF,useVirtualAnnotationPage:()=>VR,useVirtualAnnotationPageContext:()=>jR,useVisibleCanvases:()=>ls});function Uf(t){"@babel/helpers - typeof";return Uf=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},Uf(t)}function VP(t,e){if(Uf(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var i=n.call(t,e||"default");if(Uf(i)!="object")return i;throw TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function jP(t){var e=VP(t,"string");return Uf(e)=="symbol"?e:e+""}function An(t,e,n){return(e=jP(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var qP=Object.create,Uw=Object.defineProperty,FP=Object.getOwnPropertyDescriptor,GP=Object.getOwnPropertyNames,kP=Object.getPrototypeOf,YP=Object.prototype.hasOwnProperty,US=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var QP=(t,e,n,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(var a=GP(e),o=0,s=a.length,u;o<s;o++)u=a[o],!YP.call(t,u)&&u!==n&&Uw(t,u,{get:(d=>e[d]).bind(null,u),enumerable:!(i=FP(e,u))||i.enumerable});return t},VS=(t,e,n)=>(n=t==null?{}:qP(kP(t)),QP(e||!t||!t.__esModule?Uw(n,"default",{value:t,enumerable:!0}):n,t));function XP(t,e,n,i=1){return new Gw(t,e,n).subdivide(i)}function KP(t,e,n,i,a=1){return new JP(new Float64Array([t.x,t.y,e.x,e.y,n.x,n.y,i.x,i.y])).subdivide(a)}function ZP(t){return t.x*t.x+t.y*t.y}function Vf(t){let e=.67;return t/(1-e+(e**4+.25*t*t)**.25)}function Ru(t){let e=.39;return t*(1-e+Math.sqrt(e*e+.25*t*t))}var Gw=class{constructor(t,e,n){An(this,"start",void 0),An(this,"control",void 0),An(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,v=Math.abs(f)/(Math.hypot(s,u)*Math.abs(g-m));return{x0:t,x2:a,scale:v,cross:f}}subdivide(t){let e=this.mapToBasic(),n=Vf(e.x0),i=Vf(e.x2),a=.5*Math.abs(i-n)*Math.sqrt(e.scale/t),o=Math.ceil(a),s=Ru(n),u=Ru(i),d=[0];for(let p=1;p<o;p++){let f=Ru(n+(i-n)*p/o),m=(f-s)/(u-s);d.push(m)}return d.push(1),d.map(p=>this.eval(p))}},JP=class kw{constructor(e){An(this,"c",void 0),this.c=e}weightsum(e,n,i,a){let o=e*this.c[0]+n*this.c[2]+i*this.c[4]+a*this.c[6],s=e*this.c[1]+n*this.c[3]+i*this.c[5]+a*this.c[7];return{x:o,y:s}}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 Gw({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 kw(i)}subdivide(e){let n=.1*e,i=e-n,a=Math.sqrt(i),o=ZP(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,C=(S+1)/s,R=this.subsegment(E,C).midpoint_quadbez(),x=R.mapToBasic(),A=Vf(x.x0),T=Vf(x.x2),M=Math.sqrt(x.scale),z=Math.abs(T-A)*M;if(Math.sign(x.x0)!=Math.sign(x.x2)){let D=a/M,I=a*Math.abs(T-A)/Vf(D);z=Math.max(z,I)}u.push({quad:R,a0:A,a2:T,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 C=u[v].a0,R=u[v].a2,x=Ru(C),A=Ru(R),T=C+(R-C)*(E-g)/u[v].val,M=Ru(T),z=(M-x)/(A-x);m.push(u[v].quad.eval(z))}return m.push({x:this.c[6],y:this.c[7]}),m}};function WP(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}}e[d]=f}return e}function Vw(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}var jS=new Map;function $P(t,e){if(jS.has(t))return jS.get(t);let n=WP(e);return jS.set(t,Object.fromEntries(Object.entries(n).map(([i,a])=>[i,a]))),n}function qS(t,e,n={}){if(!t||!e)return Vw(n||{});let i=Vw(n||{}),a=Object.entries(e);for(let[o,s]of a){if(!s)continue;let u=$P(o,s),d=Object.entries(u);for(let[p,f]of d)p===t&&Object.assign(i,f)}return i}var tB=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")}}(),jf=Math.PI*2,FS=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}},eB=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}]},jw=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)},nB=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,C=g*v-g*E-v*S;C<0&&(C=0),C/=g*E+v*S,C=Math.sqrt(C)*(s===u?-1:1);var R=C*a/o*m,x=C*-o/a*f,A=p*R-d*x+(t+n)/2,T=d*R+p*x+(e+i)/2,M=(f-R)/a,z=(m-x)/o,D=(-f-R)/a,I=(-m-x)/o,q=jw(1,0,M,z),B=jw(M,z,D,I);return u===0&&B>0&&(B-=jf),u===1&&B<0&&(B+=jf),[A,T,q,B]},iB=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*jf/360),E=Math.cos(d*jf/360),C=E*(e-i)/2+S*(n-a)/2,R=-S*(e-i)/2+E*(n-a)/2;if(C===0&&R===0)return[];o=Math.abs(o),s=Math.abs(s);var x=C**2/o**2+R**2/s**2;x>1&&(o*=Math.sqrt(x),s*=Math.sqrt(x));var A=nB(e,n,i,a,o,s,f,g,S,E,C,R),T=tB(A,4),M=T[0],z=T[1],D=T[2],I=T[3],q=Math.abs(I)/(jf/4);Math.abs(1-q)<1e-7&&(q=1);var B=Math.max(Math.ceil(q),1);I/=B;for(var U=0;U<B;U++)v.push(eB(D,I)),D+=I;return v.map(function(W){var it=FS(W[0],o,s,E,S,M,z),K=it.x,tt=it.y,ut=FS(W[1],o,s,E,S,M,z),xt=ut.x,lt=ut.y,ft=FS(W[2],o,s,E,S,M,z),Rt=ft.x,X=ft.y;return{x1:K,y1:tt,x2:xt,y2:lt,x:Rt,y:X}})},aB=iB,oB=US((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):[]}}),rB=US((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})}}),lB=VS(oB(),1),sB=VS(rB(),1);function uB(t){let e=(0,lB.default)(t),n=(0,sB.default)(e),i,a=0,o=0,s=0,u=0,d,p,f=0,m=0,g=[];for(let v=0;v<n.length;v++){let S=n[v],E=S[0];switch(E){case"M":a=S[1],o=S[2];break;case"H":S=["L",S[1],o];break;case"V":S=["L",a,S[1]];break;case"S":{let C=f,R=m;(i==="C"||i=="S")&&(C+=C-s,R+=R-u),S=["C",C,R,S[1],S[2],S[3],S[4]]}break;case"T":i==="Q"||i=="T"?(d=f*2-d,p=m*2-p):(d=f,p=m),S=["Q",d,p,S[1],S[2]];break;case"Q":d=S[1],p=S[2];break;case"A":{let C=aB({px:f,py:m,cx:S[6],cy:S[7],rx:S[1],ry:S[2],xAxisRotation:S[3],largeArcFlag:S[4],sweepFlag:S[5]});if(!C.length)continue;for(let[R,x]of C.entries())S=["C",x.x1,x.y1,x.x2,x.y2,x.x,x.y],R<C.length-1&&g.push(S);S=S}break;case"Z":S=["L",a,o];break}i=E,f=S[S.length-2],m=S[S.length-1],["C","Q","A"].indexOf(E)>-1?(s=S[S.length-4],u=S[S.length-3]):(s=f,u=m),g.push(S)}return g}var cB=/&?(xywh=)?(pixel:|percent:|pct:)?([0-9]+(?:\.[0-9]+)?),([0-9]+(?:\.[0-9]+)?),([0-9]+(?:\.[0-9]+)?),([0-9]+(?:\.[0-9]+)?)/,qw=/&?(t=)(npt:)?([0-9]+(\.[0-9]+)?)?(,([0-9]+(\.[0-9]+)?))?/,Fw=/^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},{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]=t.split("#");return u?_o({type:"FragmentSelector",value:u},{svgPreprocessor:n,iiifRenderingHints:i,domParser:e},{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(om(t)){let s=[];if(t.region){let u=_o({type:"FragmentSelector",value:"xywh="+t.region},{domParser:e,svgPreprocessor:n,iiifRenderingHints:i},{styleClass:o});s.push(...u.selectors)}return pa({selector:s[0],selectors:s,iiifRenderingHints:i?{...i,...t}:t})}if(t.type==="FragmentSelector"){let s=cB.exec(t.value);if(s){let d={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:qS(o,a)},p=t.value.match(qw);return p&&(d={type:"TemporalBoxSelector",spatial:d.spatial,temporal:{startTime:p[3]?Number.parseFloat(p[3]):0,endTime:p[6]?Number.parseFloat(p[6]):void 0},boxStyle:qS(o,a)}),pa({selector:d,selectors:[d],iiifRenderingHints:i})}let u=t.value.match(qw);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 g=e.parseFromString(t.value,"image/svg+xml").querySelector("svg");if(!g)return console.warn(`Illegal SVG selector: ${t.value}`),pa({selector:null,selectors:[],iiifRenderingHints:i});let v=Yw(g);v&&(s=v.points,f=v.shapeType,u=[Math.min(...s.map(S=>S[0])),Math.min(...s.map(S=>S[1])),Math.max(...s.map(S=>S[0])),Math.max(...s.map(S=>S[1]))],{style:d,svg:p}=hB(v.element)??{svg:p})}let m={type:"SvgSelector",svg:p,svgShape:f,style:d,boxStyle:qS(o,a,d),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:m,selectors:[m],iiifRenderingHints:i})}return pa({selector:null,selectors:[],iiifRenderingHints:i})}function fB(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 Yw(t){for(let e of Array.from(t.children))switch(e?.tagName.toLowerCase()){case"g":{let n=Yw(e);if(n)return n}continue;case"path":{let n=e.getAttribute("d");if(!n)continue;let i=uB(n);return{element:e,points:dB(i),shapeType:fB(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 dB(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(...KP({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(...XP({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 hB(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=Fw.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=Fw.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 om(t){if(!t)return!1;let e=t.type||t["@type"];return e==="iiif:ImageApiSelector"||e==="ImageApiSelector"}function pa(t){if(t.iiifRenderingHints){let e=t.iiifRenderingHints;if(e.rotation){let n=rm(`${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 rm(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]);if(typeof t=="string"){let[n,i]=t.split("#");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"&&t.source.includes("#")){let s=an(t.source,{...e,styleClass:n});t.source=s.source,i={selector:s.selector,selectors:s.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]=t.id.split("#");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 Zs=_(nt(),1);var Au=_(nt(),1),Jw=_(Y(),1),gB={collection:void 0,manifest:void 0,range:void 0,canvas:void 0,annotation:void 0,annotationPage:void 0},qf=Au.default.createContext(gB),ti=()=>(0,Au.useContext)(qf);function ci({value:t,children:e}){let n=ti(),i=(0,Au.useMemo)(()=>({...n,...t}),[t,n]);return(0,Jw.jsx)(qf.Provider,{value:i,children:e})}var Ww=_(Y(),1);function ma({canvas:t,children:e}){return(0,Ww.jsx)(ci,{value:{canvas:t},children:e})}var Bm=_(nt(),1);var t2={},$w=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)?g:Object.assign({},e,g),n.forEach(S=>S(e,v))}},a=()=>e,o=()=>p,s=f=>(n.add(f),()=>n.delete(f)),u=()=>{(t2.env?t2.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()},d={setState:i,getState:a,getInitialState:o,subscribe:s,destroy:u},p=e=t(i,a,d);return d},sm=t=>t?$w(t):$w;function um(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 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 yB(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 vB(t){var e=yB(t,"string");return Ff(e)=="symbol"?e:e+""}function ao(t,e,n){return(e=vB(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Pa(t){return Array.isArray(t)?t:t?[t]:[]}function Ba(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 cm(...t){return e=>t.reduce((n,i)=>i(n),e)}var GS=["Collection","Manifest","Canvas","AnnotationPage","AnnotationCollection","Annotation","ContentResource","Range","Service","Selector","Agent"];function e2(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=GS.indexOf(t.type);if(n!==-1)return GS[n]}if(t.profile)return"Service";throw Error("Resource type is not known")}var kS=class n2{constructor(e,n={}){ao(this,"traversals",void 0),ao(this,"options",void 0),ao(this,"_traverseManifest",cm(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",cm(this.traverseCanvasItems.bind(this),this.traverseLinking.bind(this),this.traverseDescriptive.bind(this),this.traverseLinkedCanvases.bind(this),this.traverseInlineAnnotationPages.bind(this))),ao(this,"_traverseAnnotationPage",cm(this.traverseAnnotationPageItems.bind(this),this.traverseLinking.bind(this),this.traverseDescriptive.bind(this))),ao(this,"_traverseRange",cm(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 n2({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=Pa(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=Pa(e.seeAlso).map(n=>this.traverseType(n,{parent:e},this.traversals.contentResource))),e.service&&(e.service=Pa(e.service).map(n=>this.traverseService(n))),e.services&&(e.services=Pa(e.services).map(n=>this.traverseService(n,e))),e.logo&&(e.logo=Pa(e.logo).map(n=>this.traverseType(n,{parent:e},this.traversals.contentResource))),e.homepage&&(e.homepage=Pa(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=Pa(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=Pa(i.service).map(a=>this.traverseService(a))),this.traverseType(i,{parent:n},this.traversals.service)}traverseUnknown(e,{parent:n,typeHint:i}={}){let a=e2(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 YS="http://library.stanford.edu/iiif/image-api/compliance.html#level0",QS="http://library.stanford.edu/iiif/image-api/compliance.html#level1",XS="http://library.stanford.edu/iiif/image-api/compliance.html#level2",KS="http://library.stanford.edu/iiif/image-api/conformance.html#level0",ZS="http://library.stanford.edu/iiif/image-api/conformance.html#level1",JS="http://library.stanford.edu/iiif/image-api/conformance.html#level2",WS="http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level0",$S="http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level1",t1="http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level2",e1="http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level0",n1="http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level1",i1="http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level2",a1="http://iiif.io/api/image/1/level0.json",o1="http://iiif.io/api/image/1/profiles/level0.json",r1="http://iiif.io/api/image/1/level1.json",l1="http://iiif.io/api/image/1/profiles/level1.json",s1="http://iiif.io/api/image/1/level2.json",u1="http://iiif.io/api/image/1/profiles/level2.json",c1="http://iiif.io/api/image/2/level0.json",f1="http://iiif.io/api/image/2/profiles/level0.json",d1="http://iiif.io/api/image/2/level1.json",h1="http://iiif.io/api/image/2/profiles/level1.json",p1="http://iiif.io/api/image/2/level2.json",m1="http://iiif.io/api/image/2/profiles/level2.json",g1="level0",y1="level1",v1="level2",S1="http://iiif.io/api/image/2/level0",b1="http://iiif.io/api/image/2/level1",x1="http://iiif.io/api/image/2/level2",Tu=[x1,XS,JS,t1,i1,s1,u1,p1,m1,v1],fm=[...Tu,b1,QS,ZS,$S,n1,r1,l1,d1,h1,y1],E1=[S1,b1,x1,YS,QS,XS,KS,ZS,JS,WS,$S,t1,e1,n1,i1,a1,o1,r1,l1,s1,u1,c1,f1,d1,h1,p1,m1,g1,y1,v1],R1=E1,A1=[S1,YS,KS,WS,e1,a1,o1,c1,f1,g1],i2={extraFormats:["jpg"],extraQualities:["default"],extraFeatures:["sizeByWhListed"]},a2={extraFormats:["jpg"],extraQualities:["default"],extraFeatures:["baseUriRedirect","cors","jsonldMediaType","regionByPx","regionSquare","sizeByWhListed","sizeByH","sizeByW","sizeByWh"]},o2={extraFormats:["jpg","png"],extraQualities:["default"],extraFeatures:["baseUriRedirect","cors","jsonldMediaType","regionByPct","regionByPx","regionSquare","rotationBy90s","sizeByWhListed","sizeByConfinedWh","sizeByH","sizeByPct","sizeByW","sizeByWh"]};var r2=["sc:Collection","sc:Manifest","sc:Canvas","sc:AnnotationList","oa:Annotation","sc:Range","sc:Layer","sc:Sequence","oa:Choice","Service","ContentResource"];function SB(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=r2.indexOf(t["@type"]);if(e!==-1)return r2[e]}if(t.profile)return"Service";if(t.format||t["@type"])return"ContentResource";throw Error("Resource type is not known")}var bB=class c2{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 c2({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),...(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=>this.traverseManifest(typeof n=="string"?{"@id":n,"@type":"sc:Manifest"}:n))),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=>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(SB(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)}},xB=["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"],C1={attributionLabel:"Attribution",lang:"none",providerId:"http://example.org/provider",providerName:""};function EB(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 Jl(t,e="none"){if(!t)return{none:[""]};let n=EB(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 f2(t){if(Array.isArray(t))return f2(t.find(e=>typeof e=="string"));if(Tu.indexOf(t)!==-1)return"level2";if(xB.indexOf(t)!==-1)return"level1";if(R1.indexOf(t)!==-1)return"level0";if(typeof t=="string")return t}function RB(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 AB(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 l2(t){for(let e of["sc","oa","dcterms","dctypes","iiif"])if(t.startsWith(`${e}:`))return t.slice(e.length+1);return t}var TB=["Collection","Manifest","Annotation","AnnotationPage","Range","Service"];function M1(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=AB(i);if(o)return o}if(a){let o=RB(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&&TB.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 CB=/http(s)?:\/\/(creativecommons.org|rightsstatements.org)[^"'\\<\n]+/gm;function wB(t){let e=t.match(CB);return e?e[0]:t}function MB(t,e="Rights/License",n="none"){let i=null,a=[],o=Array.isArray(t)?t:[t];for(let s of o){let u=s?wB(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 OB=["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 _B(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"),OB.indexOf(i)===-1&&n.push(i);if(e.length)return n.length===1?n[0]:n}}function zB(t){return t?t.map(e=>({label:Jl(e.label),value:Jl(e.value)})):[]}var s2=0;function d2(t,e){let n=encodeURI(t.id||t["@id"]||"").trim();return n&&e?`${n}/${e}`:n||(s2++,`http://example.org/${t["@type"]}${e?`/${e}`:""}/${s2}`)}function zo(t){let e=[...t.behavior||[]];t.viewingHint&&e.push(t.viewingHint);let n;return Array.isArray(t.motivation)?n=t.motivation.map(l2):t.motivation&&(n=l2(t.motivation)),{"@context":t["@context"]?_B(t["@context"]):void 0,id:(t["@id"]||d2(t)).trim(),type:M1(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]=MB(t.license),i=[...t.metadata?zB(t.metadata):[],...n];return{rights:e,metadata:i.length?i:void 0,label:t.label?Jl(t.label):void 0,requiredStatement:t.attribution?{label:Jl(C1.attributionLabel),value:Jl(t.attribution)}:void 0,navDate:t.navDate,summary:t.description?Jl(t.description):void 0,thumbnail:NB(t.thumbnail)}}function NB(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 IB(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:M1(i)});return n.length?n:void 0}function Ir(t){let e=t.related?Array.isArray(t.related)?t.related:[t.related]:[],n=t.contentLayer;return{provider:t.logo||e.length?[{id:C1.providerId,type:"Agent",homepage:e.length?[e[0]]:void 0,logo:t.logo?Array.isArray(t.logo)?t.logo:[t.logo]:void 0,label:Jl(C1.providerName)}]:void 0,partOf:IB(t),rendering:t.rendering,seeAlso:t.seeAlso,start:t.startCanvas,service:t.service?Pa(t.service):void 0,supplementary:n?[n]:void 0}}function DB(t){return{chars:t.chars,format:t.format?t.format:void 0,language:t.language}}function T1(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 LB(t){let e={};if(t.first){let n=T1(t.first,"Collection");n&&(e.first=n)}if((t.total||t.total===0)&&(e.total=t.total),t.prev){let n=T1(t.prev,"Collection");n&&(e.prev=n)}if(t.next){let n=T1(t.next,"Collection");n&&(e.next=n)}return e}function PB(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 BB(t){return Ba({...zo(t),...No(t),...Ir(t),...LB(t),items:PB(t.members)})}function HB(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),Ba({...o,...No(t),...Ir(t),viewingDirection:a,start:i,items:e,structures:UB(t.structures)})}function UB(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 VB(t){return Ba({...zo(t),...No(t),...Ir(t),annotations:t.otherContent&&t.otherContent.length?t.otherContent:void 0,items:t.images&&t.images.length?[{id:d2(t,"annotation-page"),type:"AnnotationPage",items:t.images}]:void 0})}function jB(t){return Ba({...zo(t),...No(t),...Ir(t),items:t.resources&&t.resources.length?t.resources:void 0})}function qB(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 FB(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:w1(n.selector)}}else return encodeURI(n["@id"]).trim()}return Ba({...zo(t),...No(t),...Ir(t),target:e(t.on),body:Array.isArray(t.resource)?t.resource.map(u2):u2(t.resource)})}function u2(t){return t.type==="Choice"?t:h2(t)}function h2(t){let e=t;return Ba({...zo(e),...No(e),...Ir(e),...DB(e)})}function GB(t){let e=[];return t.default&&t.default!=="rdf:nil"&&e.push(t.default),t.item&&t.item!=="rdf:nil"&&e.push(...t.item),Ba({...zo(t),...No(t),items:e})}function kB(t){return Ba({...zo(t),...No(t),...Ir(t),items:t.members})}function YB(t){let{"@id":e,"@type":n,"@context":i,profile:a,...o}=t,s={};return e&&(s["@id"]=e),s["@type"]=M1(t),s["@type"]==="unknown"&&(i&&i.length&&(s["@context"]=i),s["@type"]="Service"),a&&(s.profile=f2(a)),Ba({...s,...o})}function QB(t){return Ba({...zo(t),...No(t),...Ir(t)})}var XB=new bB({collection:[BB],manifest:[HB],canvas:[VB],annotationList:[jB],sequence:[qB],annotation:[FB],contentResource:[h2],choice:[GB],range:[kB],service:[YB],layer:[QB]});function p2(t){return t&&t["@context"]&&(t["@context"]==="http://iiif.io/api/presentation/2/context.json"||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"),XB.traverseUnknown(t)):t}function w1(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[w1(t.default),...(Array.isArray(t.item)?t.item:[t.item]).map(w1)];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 _u(t,e){let n=e||"unknown";if(!t)return;if(typeof t=="string")return{id:t,type:n};if(Gi(t))return _u(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 wu={},Ke="iiif-parser:hasPart",ki="iiif-parser:partOf",Mu="iiif-parser:isExternal",ga="__$UNSET$__",_1="__$UNWRAP$__",Et=[];Object.freeze(Et),Object.freeze(wu);function y2(t){if(t===wu||Object.keys(t).length===0)return!0;for(let e in t)return!1;return!0}function zu(t,e){if(e&&e["@explicit"]){let n={},i=Object.keys(e);for(let a of i)a===ki||a==="@explicit"||(y2(e[a])?n[a]=t[a]:n[a]=e[a]);return n}return t}function z1(t,e,n){let i=_u(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 z1(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[zu(s,u),s]}return[s,s]}var v2={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},S2={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},b2={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},x2={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"},E2={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"},R2={id:"https://iiif-parser/empty-agent",type:"Agent",label:{},logo:Et,seeAlso:Et,homepage:Et},A2={id:"https://iiif-parser/empty-service",type:"UnknownService"};function dm(t,e={}){if(Array.isArray(t))return dm(t[0]);if(typeof t=="string"){let[n,i]=t.split("#");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 dm(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;if(n?.includes("#")){let i=dm(n,e);i&&(t.selector=i.selector,t.source=i.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]=t.id.split("#");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 T2(){return{Collection:{},Manifest:{},Canvas:{},AnnotationPage:{},AnnotationCollection:{},Annotation:{},ContentResource:{},Range:{},Service:{},Selector:{},Agent:{}}}function C2(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 KB(t,e){return(n,i)=>{let a=t[n]?t[n]:{};return(o,s)=>{let u=C2(o,i||n);return u&&u.id&&n?(a[u.id]=a[u.id]?mm(a[u.id],u,{parent:s.parent,isTopLevel:e.id===u.id}):mm({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 pm(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]=pm(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]=pm(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 C of s)C!==Ke&&(S[C]=wu);for(let C of E)S[C]=u[C]}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]=wu;for(let S of o)f[S]=wu;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 mm(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 pm({...t},e,n)}function ZB(t){return(e,n)=>i=>{let{id:a,type:o}=C2(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 JB(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({},A2,e)}function WB(t){return e=>{t.Service=t.Service?t.Service:{};let n=e.id||e["@id"],i=JB(e);return i&&i.id&&(t.Service[i.id]?t.Service[n]=mm(t.Service[n],i):t.Service[n]=i),e}}function $B(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 O1(t){return e=>typeof e=="string"?{id:e,type:t}:e.id?e.type?e:{type:t,...e}:{id:`vault://${$B(e)}`,type:t,...e}}function Cu(t){return e=>({...t,...e})}function Gf(t){return Array.isArray(t)?t:[t]}function t6(t){return t.body&&(t.body=Gf(t.body)),t.seeAlso&&(t.seeAlso=Gf(t.seeAlso)),t.audience&&(t.audience=Gf(t.audience)),t.accessibility&&(t.accessibility=Gf(t.accessibility)),t.motivation&&(t.motivation=Gf(t.motivation)),t}function w2(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;if((t.id||"").indexOf("#")!==-1){let[a,o]=(t.id||"").split("#");t.id=a,o&&(i={type:"FragmentSelector",value:o})}return{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"?w2(n):n)),e}function n6(t){let e=Object.assign({},t);return e.start?(e.start=w2(e.start,{typeHint:"Canvas"}),e):t}function i6(t){let e=Object.assign({},t);return e.target?(e.target=dm(e.target,{typeHint:"Canvas"}),e):t}function M2(t){return t}function hm(t){return t.items===void 0&&(t[Mu]=!0),t}function N1(t){let e=p2(t),n=T2(),i={},a=KB(n,e),o=ZB(i),s=new kS({collection:[hm,Cu(b2),o("Collection"),a("Collection")],manifest:[hm,Cu(x2),n6,o("Manifest"),a("Manifest")],canvas:[Cu(S2),o("Canvas"),a("Canvas")],annotationPage:[hm,O1("AnnotationPage"),Cu(v2),o("AnnotationPage"),a("AnnotationPage")],annotation:[O1("Annotation"),t6,i6,o("Annotation"),a("Annotation")],contentResource:[O1("ContentResource"),o("ContentResource"),a("ContentResource")],range:[Cu(E2),e6,o("Range","Canvas"),a("Range","Canvas")],agent:[Cu(R2),o("Agent"),a("Agent")],specificResource:[M2],service:[WB(n)]}),u=s.traverseUnknown(e);return{entities:n,resource:u,mapping:i}}function O2(t){let e={};for(let[n,i]of t){if(n===_1&&i!==ga)return i;i!==ga&&i!=null&&(e[n]=i)}return e}function I1(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]=z1(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:O2(m.value)}return i(e)}function Ou(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 es(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 _2(t){return Array.isArray(t)?t.map(e=>_2(e)):typeof t=="string"?t:t.type&&t.type==="Canvas"?t.id:t}function Pr(t,e=!1){if(t)return t.length>1&&!e?t:t[0]||void 0}function a6(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 Wl(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",es(t.label)],["metadata",t.metadata&&t.metadata.length?t.metadata.map(n=>({label:es(n.label)||"",value:es(n.value)||""})):void 0],["description",es(t.summary)],["thumbnail",Pr(yield t.thumbnail)],["navDate",t.navDate],["logo",e?Pr(e.logo):void 0],["homepage",e?e.homepage:void 0],["attribution",t.requiredStatement?es(t.requiredStatement.value):void 0]]}function*kf(t){let e=t.start&&t.start.type&&t.start.type==="SpecificResource"?Ou(t.start):t.start;return[["seeAlso",Pr(yield t.seeAlso)],["service",Pr((t.service||[]).map(a6))],["rendering",Pr(yield t.rendering)],["startCanvas",e?e.id:void 0]]}function o6(t){return t.type==="SpecificResource"}function r6(t){return t&&t.type==="FragmentSelector"}function l6(t){if(t&&o6(t)){let e=t.id,n=t.selector?Array.isArray(t.selector)?t.selector[0]:t.selector:void 0;return r6(n)&&(e+="#"+n.value),e}return t?.id}var D1={Manifest:function*(t,e,{isTopLevel:n}){return[...n?[["@context","http://iiif.io/api/presentation/2/context.json"]]:[],...Wl(t,"sc:Manifest"),...yield*$l(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[...Wl(t,"sc:Canvas"),...yield*$l(t),...yield*kf(t),["images",n?[n.resources]:void 0],["annotations",t.annotations&&t.annotations.length?Pr(yield t.annotations):void 0]]},AnnotationPage:function*(t){return[...Wl(t,"sc:AnnotationList"),...yield*$l(t),["resources",t.items&&t.items.length?Pr(yield t.items):void 0]]},Annotation:function*(t){return[["@id",t.id],["@type","oa:Annotation"],["motivation","sc:painting"],["on",_2(t.target)],["resource",Pr(yield t.body,!0)]]},ContentResource:function*(t){switch(t.type){case"Image":return[...Wl(t,"dctypes:Image"),...yield*$l(t),...yield*kf(t)];case"Text":case"Dataset":default:return[...Wl(t,void 0),...yield*$l(t)]}},AnnotationCollection:function*(t){return[["@id",t.id],["@type","sc:Layer"],["label",es(t.label)]]},Collection:function*(t){return[...Wl(t,"sc:Collection"),...yield*$l(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":l6(i),"@type":a.type,label:o?o.label:void 0,within:t.id}),a.type==="Canvas"&&n.push(a.id)}}return[...Wl(t,"sc:Range"),...yield*$l(t),...yield*kf(t),["canvases",n.length===e.length?n:void 0],["members",n.length===e.length?void 0:e]]}};function ts(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 z2(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 m2(t){if(Array.isArray(t)||(t=t?[t]:[]),!(!t||t.length===0))return t.map(z2)}function*Dr(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*Lr(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(m2(t.service))],["services",dn(m2(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?Ou(t.start):t.start]]}var L1={Manifest:function*(t,e,{isTopLevel:n}){if(!n)return[...ts(t),...yield*Dr(t),["navPlace",t.navPlace]];let i="http://iiif.io/api/presentation/3/context.json";return(t.navPlace||g2(t))&&(i=["http://iiif.io/api/presentation/3/context.json","http://iiif.io/api/extension/navplace/context.json"]),[["@context",t["@context"]?t["@context"]:i],...ts(t),...yield*Dr(t),...yield*Lr(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]]:[...ts(t),...yield*Dr(t),...yield*Lr(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*Lr(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!==Mu),n=yield t.items;return[["id",t.id?.startsWith("vault://")?void 0:t.id],...e,...yield*Lr(t),["items",n.length||t[Mu]===!1?n:ga]]},Service:function*(t){return[[_1,z2(t)]]},Annotation:function*(t){let e=Object.entries(t).map(([i,a])=>i==="motivation"?[i,Array.isArray(a)?a[0]:a]:i==="target"?[i,Ou(a,{allowString:!0,allowSourceString:!0,allowedStringType:"Canvas"})]:[i,Array.isArray(a)?dn(a):a]).filter(([i])=>i!=="body"&&i!==Ke&&i!==Mu),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(Ou(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*Dr(t),...yield*Lr(t),["body",n.length===1?n[0]:n]]},ContentResource:function*(t){return s6([...ts(t),...yield*Dr(t),...yield*Lr(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||g2(t))&&(i=["http://iiif.io/api/extension/navplace/context.json","http://iiif.io/api/presentation/3/context.json"]),[["@context",i],...ts(t),...yield*Dr(t),...yield*Lr(t),["items",dn(yield t.items)],["navPlace",t.navPlace]]}return[...ts(t),...yield*Dr(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(Ou(n)):e.push(n);return[...ts(t),...yield*Dr(t),...yield*Lr(t),["items",e],["annotations",dn(yield t.annotations)],["navPlace",t.navPlace]]}};function s6(t,e){let n=Object.keys(e),i=t.map(([a])=>a);for(let a of n)a===Ke||a===Mu||i.indexOf(a)===-1&&e[a]!==void 0&&t.push([a,e[a]]);return t}function g2(t){if(!t.items||!Array.isArray(t.items))return!1;for(let e of t.items)if(e.navPlace)return!0;return!1}function N2(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}})}},gm="@iiif/IMPORT_ENTITIES",ym="@iiif/MODIFY_ENTITY_FIELD",vm="@iiif/REORDER_ENTITY_FIELD",Sm="@iiif/MOVE_ENTITY",Yf="@iiif/MOVE_ENTITIES",bm="@iiif/ADD_REFERENCE",Qf="@iiif/UPDATE_REFERENCE",xm="@iiif/CHANGE_REFERENCE_IDENTIFIER",Em="@iiif/REMOVE_REFERENCE",Rm="@iiif/ADD_METADATA",Am="@iiif/REMOVE_METADATA",Xf="@iiif/UPDATE_METADATA",Tm="@iiif/REORDER_METADATA",Cm=we(gm)(),I2=we(ym)(),D2=we(vm)(),L2=we(Sm)(),P2=we(Yf)(),B2=we(bm)(),H2=we(Em)(),U2=we(Qf)(),V2=we(xm)(),j2=we(Rm)(),q2=we(Xf)(),F2=we(Am)(),G2=we(Tm)(),ns={importEntities:Cm,modifyEntityField:I2,reorderEntityField:D2,addReference:B2,removeReference:H2,updateReference:U2,changeReferenceIdentifier:V2,addMetadata:j2,removeMetadata:F2,updateMetadata:q2,reorderMetadata:G2,moveEntity:L2,moveEntities:P2},wm="@iiif/ADD_MAPPING",Mm="@iiif/ADD_MAPPINGS",P1=we(wm)(),B1=we(Mm)();var Nu="RESOURCE_ERROR",Kf="RESOURCE_LOADING",Iu="RESOURCE_READY",Om="@iiif/REQUEST_RESOURCE",_m="@iiif/REQUEST_ERROR",zm="@iiif/REQUEST_MISMATCH",Nm="@iiif/REQUEST_COMPLETE",Im="@iiif/REQUEST_OFFLINE_RESOURCE",H1=we(Om)(),Zf=we(_m)(),U1=we(zm)(),V1=we(Nm)(),u6=we(Im)();var Du="@iiif/BATCH",Dm="@iiif/BATCH_IMPORT",Lu=we(Du)(),c6=we(Dm)();var j1="@iiif/SET_META_VALUE",q1="@iiif/SET_META_VALUE_DYNAMIC",F1="@iiif/UNSET_META_VALUE",f6=we(j1)(),d6=we(q1)(),h6=we(F1)(),G1={setMetaValue:f6,setMetaValueDynamic:d6,unsetMetaValue:h6};var p6=(t,e)=>{let{entities:n,resource:i,mapping:a}=N1(e);if(i.id===void 0)return[Zf({id:t,message:"ID is not defined in resource."})];let o=[Cm({entities:n}),B1({mapping:a})];return i.id!==t&&(o.push(P1({id:t,type:i.type})),o.push(U1({requestId:t,actualId:i.id}))),o.push(V1({id:t})),o},k2=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function m6(t,e){return!!(t===e||k2(t)&&k2(e))}function Y1(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(!m6(t[n],e[n]))return!1;return!0}function k1(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];if(o&&o[Ke]){let s=o[Ke].find(u=>n?u[ki]===n.id:u[ki]===o.id);return zu(o,s)}return o}function g6(t){return t&&typeof t.then=="function"}function Q1(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===Iu){let f=k1(u,i);if(f)return f}switch(d.loadingState){case Nu:break;case Kf: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===Nu){S();return}if(E.iiif.requests[i].loadingState===Iu){let C=k1(E,i);C?v(C):S()}}))}),new Promise((v,S)=>setTimeout(()=>{m=!0,S()},n*60*1e3))]);if(f&&f(),g)return g}catch{f&&f()}})()}}t.dispatch(H1({id:i}));let p=f=>{if(!f)return;!f.id&&!f["@id"]&&(f["@type"]&&(f["@id"]=i),f.id=i);let m=p6(i,f);return t.dispatch(Lu({actions:m})),k1(s.getState(),i)};try{let f=e(i,a);return g6(f)?(async()=>{try{let m=await f;return o&&(m=o(m)),p(m)}catch(m){throw t.dispatch(Zf({id:i,message:m.toString()})),m}})():p(o?o(f):f)}catch(f){throw t.dispatch(Zf({id:i,message:f.toString()})),f}}}function X1(){return{Collection:{},Manifest:{},Canvas:{},AnnotationPage:{},AnnotationCollection:{},Annotation:{},ContentResource:{},Range:{},Service:{},Selector:{},Agent:{}}}var Pu={},y6=(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}),v6=y6,Z1=new Map,Lm=t=>{let e=Z1.get(t);return e?Object.fromEntries(Object.entries(e.stores).map(([n,i])=>[n,i.getState()])):{}},S6=(t,e,n)=>{if(t===void 0)return{type:"untracked",connection:e.connect(n)};let i=Z1.get(n.name);if(i)return{type:"tracked",store:t,...i};let a={connection:e.connect(n),stores:{}};return Z1.set(n.name,a),{type:"tracked",store:t,...a}},b6=(t,e={})=>(n,i,a)=>{let{enabled:o,anonymousActionType:s,store:u,...d}=e,p;try{p=(o??(Pu.env?Pu.env.MODE:void 0)!=="production")&&window.__REDUX_DEVTOOLS_EXTENSION__}catch{}if(!p)return(Pu.env?Pu.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}=S6(u,p,d),g=!0;a.setState=(E,C,R)=>{let x=n(E,C);if(!g)return x;let A=R===void 0?{type:s||"anonymous"}:typeof R=="string"?{type:R}:R;return u===void 0?(f?.send(A,i()),x):(f?.send({...A,type:`${u}/${A.type}`},{...Lm(d.name),[u]:a.getState()}),x)};let v=(...E)=>{let C=g;g=!1,n(...E),g=C},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,C])=>[E,E===m.store?S:C.getState()])))),a.dispatchFromDevtools&&typeof a.dispatch=="function"){let E=!1,C=a.dispatch;a.dispatch=(...R)=>{(Pu.env?Pu.env.MODE:void 0)!=="production"&&R[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),C(...R)}}return f.subscribe(E=>{var C;switch(E.type){case"ACTION":if(typeof E.payload!="string"){console.error("[zustand devtools middleware] Unsupported action format");return}return K1(E.payload,R=>{if(R.type==="__setState"){if(u===void 0){v(R.state);return}Object.keys(R.state).length!==1&&console.error(`
19
+ `+i.stack}}var _x=Object.prototype.hasOwnProperty,bE=Cn.unstable_scheduleCallback,Qb=Cn.unstable_cancelCallback,OU=Cn.unstable_shouldYield,_U=Cn.unstable_requestPaint,Ji=Cn.unstable_now,zU=Cn.unstable_getCurrentPriorityLevel,Iz=Cn.unstable_ImmediatePriority,Dz=Cn.unstable_UserBlockingPriority,Qg=Cn.unstable_NormalPriority,NU=Cn.unstable_LowPriority,Lz=Cn.unstable_IdlePriority,IU=Cn.log,DU=Cn.unstable_setDisableYieldValue,th=null,$i=null;function Zr(t){if(typeof IU=="function"&&DU(t),$i&&typeof $i.setStrictMode=="function")try{$i.setStrictMode(th,t)}catch{}}var ta=Math.clz32?Math.clz32:PU,LU=Math.log,BU=Math.LN2;function PU(t){return t>>>=0,t===0?32:31-(LU(t)/BU|0)|0}var dg=256,hg=262144,pg=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 Sy(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 HU(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 Bz(){var t=pg;return pg<<=1,!(pg&62914560)&&(pg=4194304),t}function Xb(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 UU(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&&Pz(t,i,0),o!==0&&a===0&&t.tag!==0&&(t.suspendedLanes|=o&~(s&~e))}function Pz(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 Hz(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 Uz(t,e){var n=e&-e;return n=n&42?1:xE(n),n&(t.suspendedLanes|e)?0:n}function xE(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 EE(t){return t&=-t,2<t?8<t?t&134217727?32:268435456:8:2}function Vz(){var t=ue.p;return t!==0?t:(t=window.event,t===void 0?32:uI(t.type))}function o_(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,zx="__reactEvents$"+pl,VU="__reactListeners$"+pl,jU="__reactHandles$"+pl,r_="__reactResources$"+pl,ih="__reactMarker$"+pl;function AE(t){delete t[Gn],delete t[Mi],delete t[zx],delete t[VU],delete t[jU]}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=pz(t);t!==null;){if(n=t[Gn])return n;t=pz(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[r_];return e||(e=t[r_]={hoistableStyles:new Map,hoistableScripts:new Map}),e}function In(t){t[ih]=!0}var jz=new Set,qz={};function zs(t,e){Cc(t,e),Cc(t+"Capture",e)}function Cc(t,e){for(qz[t]=e,t=0;t<e.length;t++)jz.add(e[t])}var qU=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]*$"),l_={},s_={};function FU(t){return _x.call(s_,t)?!0:_x.call(l_,t)?!1:qU.test(t)?s_[t]=!0:(l_[t]=!0,!1)}function Og(t,e,n){if(FU(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 mg(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 Fz(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function GU(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 Nx(t){if(!t._valueTracker){var e=Fz(t)?"checked":"value";t._valueTracker=GU(t,e,""+t[e])}}function Gz(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),i="";return t&&(i=Fz(t)?t.checked?"true":"false":t.value),t=i,t!==n?(e.setValue(t),!0):!1}function Xg(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 kU=/[\n"\\]/g;function Ea(t){return t.replace(kU,function(e){return"\\"+e.charCodeAt(0).toString(16)+" "})}function Ix(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?Dx(t,s,Sa(e)):n!=null?Dx(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 kz(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)){Nx(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),Nx(t)}function Dx(t,e,n){e==="number"&&Xg(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 Yz(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 Qz(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),Nx(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 YU=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 u_(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||YU.has(e)?e==="float"?t.cssFloat=n:t[e]=(""+n).trim():t[e]=n+"px"}function Xz(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&&u_(t,a,i)}else for(var o in e)e.hasOwnProperty(o)&&u_(t,o,e[o])}function RE(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 QU=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"]]),XU=/^[\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 _g(t){return XU.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}function Yo(){}var Lx=null;function TE(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 c_(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(Ix(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));Ix(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&&Gz(i)}break t;case"textarea":Yz(t,n.value,n.defaultValue);break t;case"select":e=n.value,e!=null&&Sc(t,!!n.multiple,e,!1)}}}var Kb=!1;function Kz(t,e,n){if(Kb)return t(e,n);Kb=!0;try{var i=t(e);return i}finally{if(Kb=!1,(uc!==null||bc!==null)&&(zy(),uc&&(e=uc,t=bc,bc=uc=null,c_(e),t)))for(e=0;e<t.length;e++)c_(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"),Bx=!1;if(Wo)try{ec={},Object.defineProperty(ec,"passive",{get:function(){Bx=!0}}),window.addEventListener("test",ec,ec),window.removeEventListener("test",ec,ec)}catch{Bx=!1}var ec,Wr=null,CE=null,zg=null;function Zz(){if(zg)return zg;var t,e=CE,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 zg=a.slice(t,1<i?1-i:void 0)}function Ng(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 gg(){return!0}function f_(){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)?gg:f_,this.isPropagationStopped=f_,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=gg)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=gg)},persist:function(){},isPersistent:gg}),e}var Ns={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},by=Oi(Ns),ah=Ne({},Ns,{view:0,detail:0}),KU=Oi(ah),Zb,Wb,md,xy=Ne({},ah,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:wE,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"?(Zb=t.screenX-md.screenX,Wb=t.screenY-md.screenY):Wb=Zb=0,md=t),Zb)},movementY:function(t){return"movementY"in t?t.movementY:Wb}}),d_=Oi(xy),ZU=Ne({},xy,{dataTransfer:0}),WU=Oi(ZU),JU=Ne({},ah,{relatedTarget:0}),Jb=Oi(JU),$U=Ne({},Ns,{animationName:0,elapsedTime:0,pseudoElement:0}),tV=Oi($U),eV=Ne({},Ns,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),nV=Oi(eV),iV=Ne({},Ns,{data:0}),h_=Oi(iV),aV={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},oV={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"},rV={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function lV(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):(t=rV[t])?!!e[t]:!1}function wE(){return lV}var sV=Ne({},ah,{key:function(t){if(t.key){var e=aV[t.key]||t.key;if(e!=="Unidentified")return e}return t.type==="keypress"?(t=Ng(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?oV[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:wE,charCode:function(t){return t.type==="keypress"?Ng(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?Ng(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),uV=Oi(sV),cV=Ne({},xy,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),p_=Oi(cV),fV=Ne({},ah,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:wE}),dV=Oi(fV),hV=Ne({},Ns,{propertyName:0,elapsedTime:0,pseudoElement:0}),pV=Oi(hV),mV=Ne({},xy,{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}),gV=Oi(mV),yV=Ne({},Ns,{newState:0,oldState:0}),vV=Oi(yV),SV=[9,13,27,32],ME=Wo&&"CompositionEvent"in window,Cd=null;Wo&&"documentMode"in document&&(Cd=document.documentMode);var bV=Wo&&"TextEvent"in window&&!Cd,Wz=Wo&&(!ME||Cd&&8<Cd&&11>=Cd),m_=" ",g_=!1;function Jz(t,e){switch(t){case"keyup":return SV.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function $z(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var cc=!1;function xV(t,e){switch(t){case"compositionend":return $z(e);case"keypress":return e.which!==32?null:(g_=!0,m_);case"textInput":return t=e.data,t===m_&&g_?null:t;default:return null}}function EV(t,e){if(cc)return t==="compositionend"||!ME&&Jz(t,e)?(t=Zz(),zg=CE=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 Wz&&e.locale!=="ko"?null:e.data;default:return null}}var AV={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"?!!AV[t.type]:e==="textarea"}function tN(t,e,n,i){uc?bc?bc.push(i):bc=[i]:uc=i,e=dy(e,"onChange"),0<e.length&&(n=new by("onChange","change",null,n,i),t.push({event:n,listeners:e}))}var wd=null,jd=null;function RV(t){K3(t,0)}function Ey(t){var e=Ad(t);if(Gz(e))return t}function v_(t,e){if(t==="change")return e}var eN=!1;Wo&&(Wo?(vg="oninput"in document,vg||($b=document.createElement("div"),$b.setAttribute("oninput","return;"),vg=typeof $b.oninput=="function"),yg=vg):yg=!1,eN=yg&&(!document.documentMode||9<document.documentMode));var yg,vg,$b;function S_(){wd&&(wd.detachEvent("onpropertychange",nN),jd=wd=null)}function nN(t){if(t.propertyName==="value"&&Ey(jd)){var e=[];tN(e,jd,t,TE(t)),Kz(RV,e)}}function TV(t,e,n){t==="focusin"?(S_(),wd=e,jd=n,wd.attachEvent("onpropertychange",nN)):t==="focusout"&&S_()}function CV(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return Ey(jd)}function wV(t,e){if(t==="click")return Ey(e)}function MV(t,e){if(t==="input"||t==="change")return Ey(e)}function OV(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var na=typeof Object.is=="function"?Object.is:OV;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(!_x.call(e,a)||!na(t[a],e[a]))return!1}return!0}function b_(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function x_(t,e){var n=b_(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=b_(n)}}function iN(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?iN(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function aN(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var e=Xg(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=Xg(t.document)}return e}function OE(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 _V=Wo&&"documentMode"in document&&11>=document.documentMode,fc=null,Px=null,Md=null,Hx=!1;function E_(t,e,n){var i=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Hx||fc==null||fc!==Xg(i)||(i=fc,"selectionStart"in i&&OE(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=dy(Px,"onSelect"),0<i.length&&(e=new by("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")},tx={},oN={};Wo&&(oN=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(tx[t])return tx[t];if(!dc[t])return t;var e=dc[t],n;for(n in e)if(e.hasOwnProperty(n)&&n in oN)return tx[t]=e[n];return t}var rN=Is("animationend"),lN=Is("animationiteration"),sN=Is("animationstart"),zV=Is("transitionrun"),NV=Is("transitionstart"),IV=Is("transitioncancel"),uN=Is("transitionend"),cN=new Map,Ux="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(" ");Ux.push("scrollEnd");function Ga(t,e){cN.set(t,e),zs(e,[t])}var Kg=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,_E=0;function Ay(){for(var t=hc,e=_E=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&&fN(n,a,o)}}function Ry(t,e,n,i){va[hc++]=t,va[hc++]=e,va[hc++]=n,va[hc++]=i,_E|=i,t.lanes|=i,t=t.alternate,t!==null&&(t.lanes|=i)}function zE(t,e,n,i){return Ry(t,e,n,i),Zg(t)}function Ds(t,e){return Ry(t,null,null,e),Zg(t)}function fN(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 Zg(t){if(50<Pd)throw Pd=0,rE=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 DV(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 DV(t,e,n,i)}function NE(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 dN(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 Ig(t,e,n,i,a,o){var s=0;if(i=t,typeof t=="function")NE(t)&&(s=1);else if(typeof t=="string")s=P8(t,n,fo.current)?26:t==="html"||t==="head"||t==="body"?27:5;else t:switch(t){case Cx:return t=Zi(31,n,e,a),t.elementType=Cx,t.lanes=o,t;case rc:return Es(n.children,a,o,e);case zz:s=8,a|=24;break;case Ax:return t=Zi(12,n,e,a|2),t.elementType=Ax,t.lanes=o,t;case Rx:return t=Zi(13,n,e,a),t.elementType=Rx,t.lanes=o,t;case Tx:return t=Zi(19,n,e,a),t.elementType=Tx,t.lanes=o,t;default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case ko:s=10;break t;case Nz:s=9;break t;case vE:s=11;break t;case SE: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 ex(t,e,n){return t=Zi(6,t,null,e),t.lanes=n,t}function hN(t){var e=Zi(18,null,null,0);return e.stateNode=t,e}function nx(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 A_=new WeakMap;function Aa(t,e){if(typeof t=="object"&&t!==null){var n=A_.get(t);return n!==void 0?n:(e={value:t,source:e,stack:a_(e)},A_.set(t,e),e)}return{value:t,source:e,stack:a_(e)}}var mc=[],gc=0,Wg=null,Fd=0,ba=[],xa=0,cl=null,so=1,uo="";function Fo(t,e){mc[gc++]=Fd,mc[gc++]=Wg,Wg=t,Fd=e}function pN(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 IE(t){t.return!==null&&(Fo(t,1),pN(t,1,0))}function DE(t){for(;t===Wg;)Wg=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 mN(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,Vx=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)),Vx}function R_(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),kz(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),Qz(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||W3(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 T_(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 T_(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")||fE(t.type,t.memoizedProps)),n=!n),n&&ze&&fl(t),T_(t),e===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(W(317));ze=hz(t)}else if(e===31){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(W(317));ze=hz(t)}else e===27?(e=ze,ml(t.type)?(t=mE,mE=null,ze=t):ze=e):ze=kn?Ca(t.stateNode.nextSibling):null;return!0}function Cs(){ze=kn=null,Wt=!1}function ix(){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 jx=ho(null),Ls=null,Qo=null;function Yr(t,e,n){Me(jx,e._currentValue),e._currentValue=n}function Ko(t){t._currentValue=jx.current,Dn(jx)}function qx(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 Fx(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),qx(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),qx(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===Gg.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&&Fx(e,t,n,i),e.flags|=262144}function Jg(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 gN(Ls,t)}function Sg(t,e){return Ls===null&&ws(t),gN(t,e)}function gN(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 LV=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()})}},BV=Cn.unstable_scheduleCallback,PV=Cn.unstable_NormalPriority,mn={$$typeof:ko,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function LE(){return{controller:new LV,data:new Map,refCount:0}}function oh(t){t.refCount--,t.refCount===0&&BV(PV,function(){t.controller.abort()})}var Od=null,Gx=0,Mc=0,xc=null;function HV(t,e){if(Od===null){var n=Od=[];Gx=0,Mc=rA(),xc={status:"pending",value:void 0,then:function(i){n.push(i)}}}return Gx++,e.then(C_,C_),e}function C_(){if(--Gx===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 UV(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 w_=_t.S;_t.S=function(t,e){_3=Ji(),typeof e=="object"&&e!==null&&typeof e.then=="function"&&HV(t,e),w_!==null&&w_(t,e)};var As=ho(null);function BE(){var t=As.current;return t!==null?t:Te.pooledCache}function Dg(t,e){e===null?Me(As,As.current):Me(As,e.pool)}function yN(){var t=BE();return t===null?null:{parent:mn._currentValue,pool:t}}var Uc=Error(W(460)),PE=Error(W(474)),Ty=Error(W(542)),$g={then:function(){}};function M_(t){return t=t.status,t==="fulfilled"||t==="rejected"}function vN(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,__(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,__(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 O_(){if(Rs===null)throw Error(W(459));var t=Rs;return Rs=null,t}function __(t){if(t===Uc||t===Ty)throw Error(W(483))}var Ec=null,kd=0;function bg(t){var e=kd;return kd+=1,Ec===null&&(Ec=[]),vN(Ec,t,e)}function gd(t,e){e=e.props.ref,t.ref=e!==void 0?e:null}function xg(t,e){throw e.$$typeof===TU?Error(W(525)):(t=Object.prototype.toString.call(e),Error(W(31,t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)))}function SN(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=ex(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=Ig(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=nx(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=ex(""+x,A.mode,R),x.return=A,x;if(typeof x=="object"&&x!==null){switch(x.$$typeof){case fg:return R=Ig(x.type,x.key,x.props,null,A.mode,R),gd(R,x),R.return=A,R;case xd:return x=nx(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,bg(x),R);if(x.$$typeof===ko)return m(A,Sg(A,x),R);xg(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 fg: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,bg(R),C);if(R.$$typeof===ko)return g(A,x,Sg(A,R),C);xg(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 fg: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,bg(C),M);if(C.$$typeof===ko)return v(A,x,R,Sg(x,C),M);xg(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 fg: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=Ig(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=nx(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,bg(R),C);if(R.$$typeof===ko)return T(A,x,Sg(A,R),C);xg(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=ex(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===Ty)throw N;var z=Zi(29,N,null,A.mode);return z.lanes=C,z.return=A,z}finally{}}}var Ms=SN(!0),bN=SN(!1),kr=!1;function HE(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function kx(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=Zg(t),fN(t,null,n),e}return Ry(t,i,e,n),Zg(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,Hz(t,n)}}function ax(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 Yx=!1;function zd(){if(Yx){var t=xc;if(t!==null)throw t}}function Nd(t,e,n,i){Yx=!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&&(Yx=!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 xN(t,e){if(typeof t!="function")throw Error(W(191,t));t.call(e)}function EN(t,e){var n=t.callbacks;if(n!==null)for(t.callbacks=null,t=0;t<n.length;t++)xN(n[t],e)}var Oc=ho(null),ty=ho(0);function z_(t,e){t=er,Me(ty,t),Me(Oc,e),er=t|e.baseLanes}function Qx(){Me(ty,er),Me(Oc,Oc.current)}function UE(){er=ty.current,Dn(Oc),Dn(ty)}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 Xx(t){Me(rn,rn.current),Me(ia,t),Ta===null&&(Ta=t)}function AN(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 ey(t){for(var e=t;e!==null;){if(e.tag===13){var n=e.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||hE(n)||pE(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,ny=!1,Ac=!1,Os=!1,iy=0,Yd=0,Rc=null,VV=0;function We(){throw Error(W(321))}function VE(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 jE(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?t3:JE,Os=!1,o=n(i,a),Os=!1,Ac&&(o=TN(e,n,i,a)),RN(t),o}function RN(t){_t.H=Qd;var e=xe!==null&&xe.next!==null;if(Jo=0,hn=xe=Ht=null,ny=!1,Yd=0,Rc=null,e)throw Error(W(300));t===null||gn||(t=t.dependencies,t!==null&&Jg(t)&&(gn=!0))}function TN(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=e3,o=e(n,i)}while(Ac);return o}function jV(){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 qE(){var t=iy!==0;return iy=0,t}function FE(t,e,n){e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~n}function GE(t){if(ny){for(t=t.memoizedState;t!==null;){var e=t.queue;e!==null&&(e.pending=null),t=t.next}ny=!1}Jo=0,hn=xe=Ht=null,Ac=!1,Yd=iy=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 Cy(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function rh(t){var e=Yd;return Yd+=1,Rc===null&&(Rc=[]),t=vN(Rc,t,e),e=Ht,(hn===null?e.memoizedState:hn.next)===null&&(e=e.alternate,_t.H=e===null||e.memoizedState===null?t3:JE),t}function wy(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 kE(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=Cy(),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]=CU;return e.index++,n}function $o(t,e){return typeof e=="function"?e(t):e}function Lg(t){var e=ln();return YE(e,xe,t)}function YE(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 ox(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 CN(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,QE(ON.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},MN.bind(null,i,a,n,e),null),Te===null)throw Error(W(349));o||Jo&127||wN(i,e,n)}return n}function wN(t,e,n){t.flags|=16384,t={getSnapshot:e,value:n},e=Ht.updateQueue,e===null?(e=Cy(),Ht.updateQueue=e,e.stores=[t]):(n=e.stores,n===null?e.stores=[t]:n.push(t))}function MN(t,e,n,i){e.value=n,e.getSnapshot=i,_N(e)&&zN(t)}function ON(t,e,n){return n(function(){_N(e)&&zN(t)})}function _N(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!na(t,n)}catch{return!0}}function zN(t){var e=Ds(t,2);e!==null&&wi(e,t,2)}function Kx(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 NN(t,e,n,i){return t.baseState=n,YE(t,xe,typeof i=="function"?i:$o)}function qV(t,e,n,i,a){if(Oy(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,IN(e,o)):(o.next=n.next,e.pending=n.next=o)}}function IN(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),N_(t,e,u)}catch(p){Zx(t,e,p)}finally{o!==null&&s.types!==null&&(o.types=s.types),_t.T=o}}else try{o=n(a,i),N_(t,e,o)}catch(p){Zx(t,e,p)}}function N_(t,e,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(i){I_(t,e,i)},function(i){return Zx(t,e,i)}):I_(t,e,n)}function I_(t,e,n){e.status="fulfilled",e.value=n,DN(e),t.state=n,e=t.pending,e!==null&&(n=e.next,n===e?t.pending=null:(n=n.next,e.next=n,IN(t,n)))}function Zx(t,e,n){var i=t.pending;if(t.pending=null,i!==null){i=i.next;do e.status="rejected",e.reason=n,DN(e),e=e.next;while(e!==i)}t.action=null}function DN(t){t=t.listeners;for(var e=0;e<t.length;e++)(0,t[e])()}function LN(t,e){return e}function D_(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:LN,lastRenderedState:e},n.queue=i,n=WN.bind(null,Ht,i),i.dispatch=n,i=Kx(!1),o=WE.bind(null,Ht,!1,i.queue),i=di(),a={state:e,dispatch:null,action:t,pending:null},i.queue=a,n=qV.bind(null,Ht,a,o,n),a.dispatch=n,i.memoizedState=t,[e,n,!1]}function L_(t){var e=ln();return BN(e,xe,t)}function BN(t,e,n){if(e=YE(t,e,LN)[0],t=Lg($o)[0],typeof e=="object"&&e!==null&&typeof e.then=="function")try{var i=rh(e)}catch(s){throw s===Uc?Ty: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},FV.bind(null,a,n),null)),[i,o,t]}function FV(t,e){t.action=e}function B_(t){var e=ln(),n=xe;if(n!==null)return BN(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=Cy(),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 PN(){return ln().memoizedState}function Bg(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 My(t,e,n,i){var a=ln();i=i===void 0?null:i;var o=a.memoizedState.inst;xe!==null&&i!==null&&VE(i,xe.memoizedState.deps)?a.memoizedState=_c(e,o,n,i):(Ht.flags|=t,a.memoizedState=_c(1|e,o,n,i))}function P_(t,e){Bg(8390656,8,t,e)}function QE(t,e){My(2048,8,t,e)}function GV(t){Ht.flags|=4;var e=Ht.updateQueue;if(e===null)e=Cy(),Ht.updateQueue=e,e.events=[t];else{var n=e.events;n===null?e.events=[t]:n.push(t)}}function HN(t){var e=ln().memoizedState;return GV({ref:e,nextImpl:t}),function(){if(se&2)throw Error(W(440));return e.impl.apply(void 0,arguments)}}function UN(t,e){return My(4,2,t,e)}function VN(t,e){return My(4,4,t,e)}function jN(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 qN(t,e,n){n=n!=null?n.concat([t]):null,My(4,4,jN.bind(null,e,t),n)}function XE(){}function FN(t,e){var n=ln();e=e===void 0?null:e;var i=n.memoizedState;return e!==null&&VE(e,i[1])?i[0]:(n.memoizedState=[t,e],t)}function GN(t,e){var n=ln();e=e===void 0?null:e;var i=n.memoizedState;if(e!==null&&VE(e,i[1]))return i[0];if(i=t(),Os){Zr(!0);try{t()}finally{Zr(!1)}}return n.memoizedState=[i,e],i}function KE(t,e,n){return n===void 0||Jo&1073741824&&!(Xt&261930)?t.memoizedState=e:(t.memoizedState=n,t=N3(),Ht.lanes|=t,hl|=t,n)}function kN(t,e,n,i){return na(n,e)?n:Oc.current!==null?(t=KE(t,n,i),na(t,e)||(gn=!0),t):!(Jo&42)||Jo&1073741824&&!(Xt&261930)?(gn=!0,t.memoizedState=n):(t=N3(),Ht.lanes|=t,hl|=t,e)}function YN(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,WE(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=UV(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 kV(){}function Wx(t,e,n,i){if(t.tag!==5)throw Error(W(476));var a=QN(t).queue;YN(t,a,e,xs,n===null?kV:function(){return XN(t),n(i)})}function QN(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 XN(t){var e=QN(t);e.next===null&&(e=t.alternate.memoizedState),Id(t,e.next.queue,{},ea())}function ZE(){return Yn(Zd)}function KN(){return ln().memoizedState}function ZN(){return ln().memoizedState}function YV(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:LE()},t.payload=e;return}e=e.return}}function QV(t,e,n){var i=ea();n={lane:i,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Oy(t)?JN(e,n):(n=zE(t,e,n,i),n!==null&&(wi(n,t,i),$N(n,e,i)))}function WN(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(Oy(t))JN(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 Ry(t,e,a,0),Te===null&&Ay(),!1}catch{}finally{}if(n=zE(t,e,a,i),n!==null)return wi(n,t,i),$N(n,e,i),!0}return!1}function WE(t,e,n,i){if(i={lane:2,revertLane:rA(),gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},Oy(t)){if(e)throw Error(W(479))}else e=zE(t,n,i,2),e!==null&&wi(e,t,2)}function Oy(t){var e=t.alternate;return t===Ht||e!==null&&e===Ht}function JN(t,e){Ac=ny=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function $N(t,e,n){if(n&4194048){var i=e.lanes;i&=t.pendingLanes,n|=i,e.lanes=n,Hz(t,n)}}var Qd={readContext:Yn,use:wy,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 t3={readContext:Yn,use:wy,useCallback:function(t,e){return di().memoizedState=[t,e===void 0?null:e],t},useContext:Yn,useEffect:P_,useImperativeHandle:function(t,e,n){n=n!=null?n.concat([t]):null,Bg(4194308,4,jN.bind(null,e,t),n)},useLayoutEffect:function(t,e){return Bg(4194308,4,t,e)},useInsertionEffect:function(t,e){Bg(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=QV.bind(null,Ht,t),[i.memoizedState,t]},useRef:function(t){var e=di();return t={current:t},e.memoizedState=t},useState:function(t){t=Kx(t);var e=t.queue,n=WN.bind(null,Ht,e);return e.dispatch=n,[t.memoizedState,n]},useDebugValue:XE,useDeferredValue:function(t,e){var n=di();return KE(n,t,e)},useTransition:function(){var t=Kx(!1);return t=YN.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||wN(i,e,n)}a.memoizedState=n;var o={value:n,getSnapshot:e};return a.queue=o,P_(ON.bind(null,i,o,t),[t]),i.flags|=2048,_c(9,{destroy:void 0},MN.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=iy++,0<n&&(e+="H"+n.toString(32)),e+="_"}else n=VV++,e="_"+e+"r_"+n.toString(32)+"_";return t.memoizedState=e},useHostTransitionStatus:ZE,useFormState:D_,useActionState:D_,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=WE.bind(null,Ht,!0,n),n.dispatch=e,[t,e]},useMemoCache:kE,useCacheRefresh:function(){return di().memoizedState=YV.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)}}},JE={readContext:Yn,use:wy,useCallback:FN,useContext:Yn,useEffect:QE,useImperativeHandle:qN,useInsertionEffect:UN,useLayoutEffect:VN,useMemo:GN,useReducer:Lg,useRef:PN,useState:function(){return Lg($o)},useDebugValue:XE,useDeferredValue:function(t,e){var n=ln();return kN(n,xe.memoizedState,t,e)},useTransition:function(){var t=Lg($o)[0],e=ln().memoizedState;return[typeof t=="boolean"?t:rh(t),e]},useSyncExternalStore:CN,useId:KN,useHostTransitionStatus:ZE,useFormState:L_,useActionState:L_,useOptimistic:function(t,e){var n=ln();return NN(n,xe,t,e)},useMemoCache:kE,useCacheRefresh:ZN};JE.useEffectEvent=HN;var e3={readContext:Yn,use:wy,useCallback:FN,useContext:Yn,useEffect:QE,useImperativeHandle:qN,useInsertionEffect:UN,useLayoutEffect:VN,useMemo:GN,useReducer:ox,useRef:PN,useState:function(){return ox($o)},useDebugValue:XE,useDeferredValue:function(t,e){var n=ln();return xe===null?KE(n,t,e):kN(n,xe.memoizedState,t,e)},useTransition:function(){var t=ox($o)[0],e=ln().memoizedState;return[typeof t=="boolean"?t:rh(t),e]},useSyncExternalStore:CN,useId:KN,useHostTransitionStatus:ZE,useFormState:B_,useActionState:B_,useOptimistic:function(t,e){var n=ln();return xe!==null?NN(n,xe,t,e):(n.baseState=t,[t,n.queue.dispatch])},useMemoCache:kE,useCacheRefresh:ZN};e3.useEffectEvent=HN;function rx(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 Jx={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 H_(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 U_(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&&Jx.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 n3(t){Kg(t)}function i3(t){console.error(t)}function a3(t){Kg(t)}function ay(t,e){try{var n=t.onUncaughtError;n(e.value,{componentStack:e.stack})}catch(i){setTimeout(function(){throw i})}}function V_(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 $x(t,e,n){return n=il(n),n.tag=3,n.payload={element:null},n.callback=function(){ay(t,e)},n}function o3(t){return t=il(t),t.tag=3,t}function r3(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(){V_(e,n,i)}}var s=n.stateNode;s!==null&&typeof s.componentDidCatch=="function"&&(t.callback=function(){V_(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 XV(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?uy():n.alternate===null&&Je===0&&(Je=3),n.flags&=-257,n.flags|=65536,n.lanes=a,i===$g?n.flags|=16384:(e=n.updateQueue,e===null?n.updateQueue=new Set([i]):e.add(i),yx(t,i,a)),!1;case 22:return n.flags|=65536,i===$g?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)),yx(t,i,a)),!1}throw Error(W(435,n.tag))}return yx(t,i,a),uy(),!1}if(Wt)return e=ia.current,e!==null?(!(e.flags&65536)&&(e.flags|=256),e.flags|=65536,e.lanes=a,i!==Vx&&(t=Error(W(422),{cause:i}),Gd(Aa(t,n)))):(i!==Vx&&(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=$x(t.stateNode,i,a),ax(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=$x(n.stateNode,i,t),ax(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=o3(a),r3(a,t,n,i),ax(n,a),!1}n=n.return}while(n!==null);return!1}var $E=Error(W(461)),gn=!1;function Fn(t,e,n,i){e.child=t===null?bN(e,null,n,i):Ms(e,t.child,n,i)}function j_(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=jE(t,e,n,s,o,a),u=qE(),t!==null&&!gn?(FE(t,e,a),tr(t,e,a)):(Wt&&u&&IE(e),e.flags|=1,Fn(t,e,i,a),e.child)}function q_(t,e,n,i,a){if(t===null){var o=n.type;return typeof o=="function"&&!NE(o)&&o.defaultProps===void 0&&n.compare===null?(e.tag=15,e.type=o,l3(t,e,o,i,a)):(t=Ig(n.type,null,i,e,e.mode,a),t.ref=e.ref,t.return=e,e.child=t)}if(o=t.child,!tA(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 l3(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,tA(t,a))t.flags&131072&&(gn=!0);else return e.lanes=t.lanes,tr(t,e,a)}return tE(t,e,n,i,a)}function s3(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 F_(t,e,o,n,i)}if(n&536870912)e.memoizedState={baseLanes:0,cachePool:null},t!==null&&Dg(e,o!==null?o.cachePool:null),o!==null?z_(e,o):Qx(),AN(e);else return i=e.lanes=536870912,F_(t,e,o!==null?o.baseLanes|n:n,n,i)}else o!==null?(Dg(e,o.cachePool),z_(e,o),Xr(e),e.memoizedState=null):(t!==null&&Dg(e,null),Qx(),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 F_(t,e,n,i,a){var o=BE();return o=o===null?null:{parent:mn._currentValue,pool:o},e.memoizedState={baseLanes:n,cachePool:o},t!==null&&Dg(e,null),Qx(),AN(e),t!==null&&Hc(t,e,i,!0),e.childLanes=a,null}function Pg(t,e){return e=oy({mode:e.mode,children:e.children},t.mode),e.ref=t.ref,t.child=e,e.return=t,e}function G_(t,e,n){return Ms(e,t.child,null,n),t=Pg(e,e.pendingProps),t.flags|=2,Ki(e),e.memoizedState=null,t}function KV(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=Pg(e,i),e.lanes=536870912,Rd(null,t);if(Xx(e),(t=ze)?(t=tI(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=hN(t),n.return=e,e.child=n,kn=e,ze=null)):t=null,t===null)throw fl(e);return e.lanes=536870912,null}return Pg(e,i)}var o=t.memoizedState;if(o!==null){var s=o.dehydrated;if(Xx(e),a)if(e.flags&256)e.flags&=-257,e=G_(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=Uz(i,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,Ds(t,s),wi(i,t,s),$E;uy(),e=G_(t,e,n)}else t=o.treeContext,ze=Ca(s.nextSibling),kn=e,Wt=!0,nl=null,Ra=!1,t!==null&&mN(e,t),e=Pg(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 Hg(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 tE(t,e,n,i,a){return ws(e),n=jE(t,e,n,i,void 0,a),i=qE(),t!==null&&!gn?(FE(t,e,a),tr(t,e,a)):(Wt&&i&&IE(e),e.flags|=1,Fn(t,e,n,a),e.child)}function k_(t,e,n,i,a,o){return ws(e),e.updateQueue=null,n=TN(e,i,n,a),RN(t),i=qE(),t!==null&&!gn?(FE(t,e,o),tr(t,e,o)):(Wt&&i&&IE(e),e.flags|=1,Fn(t,e,n,o),e.child)}function Y_(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=Jx,e.stateNode=o,o._reactInternals=e,o=e.stateNode,o.props=i,o.state=e.memoizedState,o.refs={},HE(e),s=n.contextType,o.context=typeof s=="object"&&s!==null?Yn(s):pc,o.state=e.memoizedState,s=n.getDerivedStateFromProps,typeof s=="function"&&(rx(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&&Jx.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)&&U_(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"&&(rx(e,n,m,i),p=e.memoizedState),(d=kr||H_(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,kx(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)&&U_(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&&Jg(t.dependencies)?(typeof u=="function"&&(rx(e,n,u,i),v=e.memoizedState),(f=kr||H_(e,n,f,i,g,v,d)||t!==null&&t.dependencies!==null&&Jg(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,Hg(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 Q_(t,e,n,i){return Cs(),e.flags|=256,Fn(t,e,n,i),e.child}var lx={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function sx(t){return{baseLanes:t,cachePool:yN()}}function ux(t,e,n){return t=t!==null?t.childLanes&~n:0,e&&(t|=Wi),t}function u3(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=tI(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=hN(t),n.return=e,e.child=n,kn=e,ze=null)):t=null,t===null)throw fl(e);return pE(t)?e.lanes=32:e.lanes=536870912,null}var u=i.children;return i=i.fallback,a?(Xr(e),a=e.mode,u=oy({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=sx(n),i.childLanes=ux(t,s,n),e.memoizedState=lx,Rd(null,i)):(Qr(e),eE(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=cx(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=oy({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=sx(n),i.childLanes=ux(t,s,n),e.memoizedState=lx,e=Rd(null,i));else if(Qr(e),pE(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=cx(t,e,n)}else if(gn||Hc(t,e,n,!1),s=(n&t.childLanes)!==0,gn||s){if(s=Te,s!==null&&(i=Uz(s,n),i!==0&&i!==d.retryLane))throw d.retryLane=i,Ds(t,i),wi(s,t,i),$E;hE(u)||uy(),e=cx(t,e,n)}else hE(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&&mN(e,t),e=eE(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=sx(n):(a=u.cachePool,a!==null?(d=mn._currentValue,a=a.parent!==d?{parent:d,pool:d}:a):a=yN(),u={baseLanes:u.baseLanes|n,cachePool:a}),i.memoizedState=u,i.childLanes=ux(t,s,n),e.memoizedState=lx,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 eE(t,e){return e=oy({mode:"visible",children:e},t.mode),e.return=t,t.child=e}function oy(t,e){return t=Zi(22,t,null,e),t.lanes=0,t}function cx(t,e,n){return Ms(e,t.child,null,n),t=eE(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function X_(t,e,n){t.lanes|=e;var i=t.alternate;i!==null&&(i.lanes|=e),qx(t.return,e,n)}function fx(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 c3(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&&X_(t,n,e);else if(t.tag===19)X_(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&&ey(t)===null&&(a=n),n=n.sibling;n=a,n===null?(a=e.child,e.child=null):(a=n.sibling,n.sibling=null),fx(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&&ey(t)===null){e.child=a;break}t=a.sibling,a.sibling=n,n=a,a=t}fx(e,!0,n,null,o,i);break;case"together":fx(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 tA(t,e){return t.lanes&e?!0:(t=t.dependencies,!!(t!==null&&Jg(t)))}function ZV(t,e,n){switch(e.tag){case 3:kg(e,e.stateNode.containerInfo),Yr(e,mn,t.memoizedState.cache),Cs();break;case 27:case 5:Ox(e);break;case 4:kg(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,Xx(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?u3(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 c3(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,s3(t,e,n,e.pendingProps);case 24:Yr(e,mn,t.memoizedState.cache)}return tr(t,e,n)}function f3(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps)gn=!0;else{if(!tA(t,n)&&!(e.flags&128))return gn=!1,ZV(t,e,n);gn=!!(t.flags&131072)}else gn=!1,Wt&&e.flags&1048576&&pN(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")NE(t)?(i=_s(t,i),e.tag=1,e=Y_(null,e,t,i,n)):(e.tag=0,e=tE(null,e,t,i,n));else{if(t!=null){var a=t.$$typeof;if(a===vE){e.tag=11,e=j_(null,e,t,i,n);break t}else if(a===SE){e.tag=14,e=q_(null,e,t,i,n);break t}}throw e=wx(t)||t,Error(W(306,e,""))}}return e;case 0:return tE(t,e,e.type,e.pendingProps,n);case 1:return i=e.type,a=_s(i,e.pendingProps),Y_(t,e,i,a,n);case 3:t:{if(kg(e,e.stateNode.containerInfo),t===null)throw Error(W(387));i=e.pendingProps;var o=e.memoizedState;a=o.element,kx(t,e),Nd(e,i,null,n);var s=e.memoizedState;if(i=s.cache,Yr(e,mn,i),i!==o.cache&&Fx(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=Q_(t,e,i,n);break t}else if(i!==a){a=Aa(Error(W(424)),e),Gd(a),e=Q_(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=bN(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 Hg(t,e),t===null?(n=gz(e.type,null,e.pendingProps,null))?e.memoizedState=n:Wt||(n=e.type,t=e.pendingProps,i=hy(el.current).createElement(n),i[Gn]=e,i[Mi]=t,Qn(i,n,t),In(i),e.stateNode=i):e.memoizedState=gz(e.type,t.memoizedProps,e.pendingProps,t.memoizedState),null;case 27:return Ox(e),t===null&&Wt&&(i=e.stateNode=eI(e.type,e.pendingProps,el.current),kn=e,Ra=!0,a=ze,ml(e.type)?(mE=a,ze=Ca(i.firstChild)):ze=a),Fn(t,e,e.pendingProps.children,n),Hg(t,e),t===null&&(e.flags|=4194304),e.child;case 5:return t===null&&Wt&&((a=i=ze)&&(i=R8(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)),Ox(e),a=e.type,o=e.pendingProps,s=t!==null?t.memoizedProps:null,i=o.children,fE(a,o)?i=null:s!==null&&fE(a,s)&&(e.flags|=32),e.memoizedState!==null&&(a=jE(t,e,jV,null,null,n),Zd._currentValue=a),Hg(t,e),Fn(t,e,i,n),e.child;case 6:return t===null&&Wt&&((t=n=ze)&&(n=T8(n,e.pendingProps,Ra),n!==null?(e.stateNode=n,kn=e,ze=null,t=!0):t=!1),t||fl(e)),null;case 13:return u3(t,e,n);case 4:return kg(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 j_(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 q_(t,e,e.type,e.pendingProps,n);case 15:return l3(t,e,e.type,e.pendingProps,n);case 19:return c3(t,e,n);case 31:return KV(t,e,n);case 22:return s3(t,e,n,e.pendingProps);case 24:return ws(e),i=Yn(mn),t===null?(a=BE(),a===null&&(a=Te,o=LE(),a.pooledCache=o,o.refCount++,o!==null&&(a.pooledCacheLanes|=n),a=o),e.memoizedState={parent:i,cache:a},HE(e),Yr(e,mn,a)):(t.lanes&n&&(kx(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&&Fx(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 dx(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(L3())t.flags|=8192;else throw Rs=$g,PE}else t.flags&=-16777217}function K_(t,e){if(e.type!=="stylesheet"||e.state.loading&4)t.flags&=-16777217;else if(t.flags|=16777216,!aI(e))if(L3())t.flags|=8192;else throw Rs=$g,PE}function Eg(t,e){e!==null&&(t.flags|=4),t.flags&16384&&(e=t.tag!==22?Bz():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 WV(t,e,n){var i=e.pendingProps;switch(DE(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,ix())),_e(e),null;case 26:var a=e.type,o=e.memoizedState;return t===null?(Uo(e),o!==null?(_e(e),K_(e,o)):(_e(e),dx(e,a,null,i,n))):o?o!==t.memoizedState?(Uo(e),_e(e),K_(e,o)):(_e(e),e.flags&=-16777217):(t=t.memoizedProps,t!==i&&Uo(e),_e(e),dx(e,a,t,i,n)),null;case 27:if(Yg(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)?R_(e,t):(t=eI(a,i,n),e.stateNode=t,Uo(e))}return _e(e),null;case 5:if(Yg(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))R_(e,o);else{var s=hy(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),dx(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||W3(t.nodeValue,n)),t||fl(e,!0)}else t=hy(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=ix(),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=ix(),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),Eg(e,e.updateQueue),_e(e),null);case 4:return Tc(),t===null&&lA(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=ey(t),o!==null){for(e.flags|=128,yd(i,!1),t=o.updateQueue,e.updateQueue=t,Eg(e,t),e.subtreeFlags=0,t=n,n=e.child;n!==null;)dN(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()>ly&&(e.flags|=128,a=!0,yd(i,!1),e.lanes=4194304)}else{if(!a)if(t=ey(o),t!==null){if(e.flags|=128,a=!0,t=t.updateQueue,e.updateQueue=t,Eg(e,t),yd(i,!0),i.tail===null&&i.tailMode==="hidden"&&!o.alternate&&!Wt)return _e(e),null}else 2*Ji()-i.renderingStartTime>ly&&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),UE(),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&&Eg(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 JV(t,e){switch(DE(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 Yg(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),UE(),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 d3(t,e){switch(DE(e),e.tag){case 3:Ko(mn),Tc();break;case 26:case 27:case 5:Yg(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),UE(),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 h3(t){var e=t.updateQueue;if(e!==null){var n=t.stateNode;try{EN(e,n)}catch(i){he(t,t.return,i)}}}function p3(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 m3(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 hx(t,e,n){try{var i=t.stateNode;v8(i,t.type,n,e),i[Mi]=e}catch(a){he(t,t.return,a)}}function g3(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&ml(t.type)||t.tag===4}function px(t){t:for(;;){for(;t.sibling===null;){if(t.return===null||g3(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 nE(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(nE(t,e,n),t=t.sibling;t!==null;)nE(t,e,n),t=t.sibling}function ry(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(ry(t,e,n),t=t.sibling;t!==null;)ry(t,e,n),t=t.sibling}function y3(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,mx=!1,Z_=typeof WeakSet=="function"?WeakSet:Set,Nn=null;function $V(t,e){if(t=t.containerInfo,uE=yy,t=aN(t),OE(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(cE={focusedElem:t,selectionRange:n},yy=!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)dE(t);else if(n===1)switch(t.nodeName){case"HEAD":case"HTML":case"BODY":dE(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 v3(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&&h3(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{EN(t,e)}catch(s){he(n,n.return,s)}}break;case 27:e===null&&i&4&&y3(n);case 26:case 5:jo(t,n),e===null&&i&4&&m3(n),i&512&&Dd(n,n.return);break;case 12:jo(t,n);break;case 31:jo(t,n),i&4&&x3(t,n);break;case 13:jo(t,n),i&4&&E3(t,n),i&64&&(t=n.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(n=s8.bind(null,n),C8(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 S3(t){var e=t.alternate;e!==null&&(t.alternate=null,S3(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&AE(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;)b3(t,e,n),n=n.sibling}function b3(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,fz(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,n.stateNode),Lc(t)):fz(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"&&p3(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 x3(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 E3(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 t8(t){switch(t.tag){case 31:case 13:case 19:var e=t.stateNode;return e===null&&(e=t.stateNode=new Z_),e;case 22:return t=t.stateNode,e=t._retryCache,e===null&&(e=t._retryCache=new Z_),e;default:throw Error(W(435,t.tag))}}function Ag(t,e){var n=t8(t);e.forEach(function(i){if(!n.has(i)){n.add(i);var a=u8.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));b3(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;)A3(e,t),e=e.sibling}var Fa=null;function A3(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=vz("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=vz("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 Sz(a,t.type,t.stateNode);else t.stateNode=yz(a,i,t.memoizedProps);else o!==i?(o===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):o.count--,i===null?Sz(a,t.type,t.stateNode):yz(a,i,t.memoizedProps)):i===null&&t.stateNode!==null&&hx(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&&hx(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,hx(t,a,n!==null?n.memoizedProps:a)),i&1024&&(mx=!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(jg=null,a=Fa,Fa=py(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)}mx&&(mx=!1,R3(t));break;case 4:i=Fa,Fa=py(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,Ag(t,i)));break;case 13:Ai(e,t),Ri(t),t.child.flags&8192&&t.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(_y=Ji()),i&4&&(i=t.updateQueue,i!==null&&(t.updateQueue=null,Ag(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?dz(v,!0):dz(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,Ag(t,n))));break;case 19:Ai(e,t),Ri(t),i&4&&(i=t.updateQueue,i!==null&&(t.updateQueue=null,Ag(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(g3(i)){n=i;break}i=i.return}if(n==null)throw Error(W(160));switch(n.tag){case 27:var a=n.stateNode,o=px(t);ry(t,o,a);break;case 5:var s=n.stateNode;n.flags&32&&(wc(s,""),n.flags&=-33);var u=px(t);ry(t,u,s);break;case 3:case 4:var d=n.stateNode.containerInfo,p=px(t);nE(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 R3(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var e=t;R3(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;)v3(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"&&p3(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++)xN(d[a],u)}catch(p){he(i,i.return,p)}}n&&s&64&&h3(o),Dd(o,o.return);break;case 27:y3(o);case 26:case 5:qo(a,o,n),n&&i===null&&s&4&&m3(o),Dd(o,o.return);break;case 12:qo(a,o,n);break;case 31:qo(a,o,n),n&&s&4&&x3(a,o);break;case 13:qo(a,o,n),n&&s&4&&E3(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 eA(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 nA(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;)T3(t,e,n,i),e=e.sibling}function T3(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&&eA(s,e);break;case 24:qa(t,e,n,i),a&2048&&nA(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&&eA(s.alternate,s);break;case 24:ac(o,s,u,d,a),a&&p&2048&&nA(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&&eA(i.alternate,i);break;case 24:Ld(n,i),a&2048&&nA(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;)C3(t,e,n),t=t.sibling}function C3(t,e,n){switch(t.tag){case 26:ic(t,e,n),t.flags&Td&&t.memoizedState!==null&&H8(n,Fa,t.memoizedState,t.memoizedProps);break;case 5:ic(t,e,n);break;case 3:case 4:var i=Fa;Fa=py(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 w3(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,O3(i,t)}w3(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)M3(t),t=t.sibling}function M3(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,Ug(t)):vd(t);break;default:vd(t)}}function Ug(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,O3(i,t)}w3(t)}for(t=t.child;t!==null;){switch(e=t,e.tag){case 0:case 11:case 15:dl(8,e,e.return),Ug(e);break;case 22:n=e.stateNode,n._visibility&2&&(n._visibility&=-3,Ug(e));break;default:Ug(e)}t=t.sibling}}function O3(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(S3(i),i===n){Nn=null;break t}if(a!==null){a.return=o,Nn=a;break t}Nn=o}}}var e8={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}},n8=typeof WeakMap=="function"?WeakMap:Map,se=0,Te=null,Yt=null,Xt=0,de=0,Xi=null,Jr=!1,Vc=!1,iA=!1,er=0,Je=0,hl=0,Ts=0,aA=0,Wi=0,zc=0,Bd=null,Ci=null,iE=!1,_y=0,_3=0,ly=1/0,sy=null,ol=null,Tn=0,rl=null,Nc=null,Zo=0,aE=0,oE=null,z3=null,Pd=0,rE=null;function ea(){return se&2&&Xt!==0?Xt&-Xt:_t.T!==null?rA():Vz()}function N3(){if(Wi===0)if(!(Xt&536870912)||Wt){var t=hg;hg<<=1,!(hg&3932160)&&(hg=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 I3(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?o8(t,e):gx(t,e,!0),o=i;do{if(a===0){Vc&&!i&&$r(t,e,0,!1);break}else{if(n=t.current.alternate,o&&!i8(n)){a=gx(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=gx(u,s,!1),s!==2){if(iA&&!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=_y+300-Ji(),10<a)){if($r(i,e,Wi,!Jr),Sy(i,0,!0)!==0)break t;Zo=e,i.timeoutHandle=$3(W_.bind(null,i,n,Ci,sy,iE,e,Wi,Ts,zc,Jr,o,"Throttled",-0,0),a);break t}W_(i,n,Ci,sy,iE,e,Wi,Ts,zc,Jr,o,null,-0,0)}}break}while(!0);po(t)}function W_(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},C3(e,o,m);var S=(o&62914560)===o?_y-Ji():(o&4194048)===o?_3-Ji():0;if(S=U8(m,S),S!==null){Zo=o,t.cancelPendingCommit=S($_.bind(null,t,e,o,n,i,a,s,u,d,f,m,null,g,v)),$r(t,o,s,!p);return}}$_(t,e,o,n,i,a,s,u,d)}function i8(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&=~aA,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&&Pz(t,n,e)}function zy(){return se&6?!0:(sh(0,!1),!1)}function oA(){if(Yt!==null){if(de===0)var t=Yt.return;else t=Yt,Qo=Ls=null,GE(t),Ec=null,kd=0,t=Yt;for(;t!==null;)d3(t.alternate,t),t=t.return;Yt=null}}function Ic(t,e){var n=t.timeoutHandle;n!==-1&&(t.timeoutHandle=-1,x8(n)),n=t.cancelPendingCommit,n!==null&&(t.cancelPendingCommit=null,n()),Zo=0,oA(),Te=t,Yt=n=Xo(t.current,null),Xt=e,de=0,Xi=null,Jr=!1,Vc=eh(t,e),iA=!1,zc=Wi=aA=Ts=hl=Je=0,Ci=Bd=null,iE=!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,Ay(),n}function D3(t,e){Ht=null,_t.H=Qd,e===Uc||e===Ty?(e=O_(),de=3):e===PE?(e=O_(),de=4):de=e===$E?8:e!==null&&typeof e=="object"&&typeof e.then=="function"?6:1,Xi=e,Yt===null&&(Je=1,ay(t,Aa(e,t.current)))}function L3(){var t=ia.current;return t===null?!0:(Xt&4194048)===Xt?Ta===null:(Xt&62914560)===Xt||Xt&536870912?t===Ta:!1}function B3(){var t=_t.H;return _t.H=Qd,t===null?Qd:t}function P3(){var t=_t.A;return _t.A=e8,t}function uy(){Je=4,Jr||(Xt&4194048)!==Xt&&ia.current!==null||(Vc=!0),!(hl&134217727)&&!(Ts&134217727)||Te===null||$r(Te,Xt,Wi,!1)}function gx(t,e,n){var i=se;se|=2;var a=B3(),o=P3();(Te!==t||Xt!==e)&&(sy=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:oA(),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)}}a8(),s=Je;break}catch(f){D3(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,Ay()),s}function a8(){for(;Yt!==null;)H3(Yt)}function o8(t,e){var n=se;se|=2;var i=B3(),a=P3();Te!==t||Xt!==e?(sy=null,ly=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(M_(o)){de=0,Xi=null,J_(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:M_(o)?(de=0,Xi=null,J_(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?aI(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,Ny(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:oA(),Je=6;break t;default:throw Error(W(462))}}r8();break}catch(f){D3(t,f)}while(!0);return Qo=Ls=null,_t.H=i,_t.A=a,se=n,Yt!==null?0:(Te=null,Xt=0,Ay(),Je)}function r8(){for(;Yt!==null&&!OU();)H3(Yt)}function H3(t){var e=f3(t.alternate,t,er);t.memoizedProps=t.pendingProps,e===null?Ny(t):Yt=e}function J_(t){var e=t,n=e.alternate;switch(e.tag){case 15:case 0:e=k_(n,e,e.pendingProps,e.type,void 0,Xt);break;case 11:e=k_(n,e,e.pendingProps,e.type.render,e.ref,Xt);break;case 5:GE(e);default:d3(n,e),e=Yt=dN(e,er),e=f3(n,e,er)}t.memoizedProps=t.pendingProps,e===null?Ny(t):Yt=e}function yc(t,e,n,i){Qo=Ls=null,GE(e),Ec=null,kd=0;var a=e.return;try{if(XV(t,a,e,n,Xt)){Je=1,ay(t,Aa(n,t.current)),Yt=null;return}}catch(o){if(a!==null)throw Yt=a,o;Je=1,ay(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))),U3(e,t)):Ny(e)}function Ny(t){var e=t;do{if(e.flags&32768){U3(e,Jr);return}t=e.return;var n=WV(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 U3(t,e){do{var n=JV(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 $_(t,e,n,i,a,o,s,u,d){t.cancelPendingCommit=null;do Iy();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|=_E,UU(t,n,o,s,u,d),t===Te&&(Yt=Te=null,Xt=0),Nc=e,rl=t,Zo=n,aE=o,oE=a,z3=i,e.subtreeFlags&10256||e.flags&10256?(t.callbackNode=null,t.callbackPriority=0,c8(Qg,function(){return G3(),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{$V(t,e,n)}finally{se=s,ue.p=a,_t.T=i}}Tn=1,V3(),j3(),q3()}}function V3(){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{A3(e,t);var o=cE,s=aN(t.containerInfo),u=o.focusedElem,d=o.selectionRange;if(s!==u&&u&&u.ownerDocument&&iN(u.ownerDocument.documentElement,u)){if(d!==null&&OE(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=x_(u,E),x=x_(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}}yy=!!uE,cE=uE=null}finally{se=a,ue.p=i,_t.T=n}}t.current=e,Tn=2}}function j3(){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{v3(t,e.alternate,e)}finally{se=a,ue.p=i,_t.T=n}}Tn=3}}function q3(){if(Tn===4||Tn===3){Tn=0,_U();var t=rl,e=Nc,n=Zo,i=z3;e.subtreeFlags&10256||e.flags&10256?Tn=5:(Tn=0,Nc=rl=null,F3(t,t.pendingLanes));var a=t.pendingLanes;if(a===0&&(ol=null),EE(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&&Iy(),po(t),a=t.pendingLanes,n&261930&&a&42?t===rE?Pd++:(Pd=0,rE=t):Pd=0,sh(0,!1)}}function F3(t,e){(t.pooledCacheLanes&=e)===0&&(e=t.pooledCache,e!=null&&(t.pooledCache=null,oh(e)))}function Iy(){return V3(),j3(),q3(),G3()}function G3(){if(Tn!==5)return!1;var t=rl,e=aE;aE=0;var n=EE(Zo),i=_t.T,a=ue.p;try{ue.p=32>n?32:n,_t.T=null,n=oE,oE=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,M3(o.current),T3(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,F3(t,e)}}function tz(t,e,n){e=Aa(n,e),e=$x(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)tz(t,t,n);else for(;e!==null;){if(e.tag===3){tz(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=o3(2),i=al(e,n,2),i!==null&&(r3(n,i,e,t),nh(i,2),po(i));break}}e=e.return}}function yx(t,e,n){var i=t.pingCache;if(i===null){i=t.pingCache=new n8;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)||(iA=!0,a.add(n),t=l8.bind(null,t,e,n),e.then(t,t))}function l8(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()-_y?!(se&2)&&Ic(t,0):aA|=n,zc===Xt&&(zc=0)),po(t)}function k3(t,e){e===0&&(e=Bz()),t=Ds(t,e),t!==null&&(nh(t,e),po(t))}function s8(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),k3(t,n)}function u8(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),k3(t,n)}function c8(t,e){return bE(t,e)}var cy=null,oc=null,lE=!1,fy=!1,vx=!1,tl=0;function po(t){t!==oc&&t.next===null&&(oc===null?cy=oc=t:oc=oc.next=t),fy=!0,lE||(lE=!0,d8())}function sh(t,e){if(!vx&&fy){vx=!0;do for(var n=!1,i=cy;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,ez(i,o))}else o=Xt,o=Sy(i,i===Te?o:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),!(o&3)||eh(i,o)||(n=!0,ez(i,o));i=i.next}while(n);vx=!1}}function f8(){Y3()}function Y3(){fy=lE=!1;var t=0;tl!==0&&b8()&&(t=tl);for(var e=Ji(),n=null,i=cy;i!==null;){var a=i.next,o=Q3(i,e);o===0?(i.next=null,n===null?cy=a:n.next=a,a===null&&(oc=n)):(n=i,(t!==0||o&3)&&(fy=!0)),i=a}Tn!==0&&Tn!==5||sh(t,!1),tl!==0&&(tl=0)}function Q3(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]=HU(u,e)):d<=e&&(t.expiredLanes|=u),o&=~u}if(e=Te,n=Xt,n=Sy(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&&Qb(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&&Qb(i),EE(n)){case 2:case 8:n=Dz;break;case 32:n=Qg;break;case 268435456:n=Lz;break;default:n=Qg}return i=X3.bind(null,t),n=bE(n,i),t.callbackPriority=e,t.callbackNode=n,e}return i!==null&&i!==null&&Qb(i),t.callbackPriority=2,t.callbackNode=null,2}function X3(t,e){if(Tn!==0&&Tn!==5)return t.callbackNode=null,t.callbackPriority=0,null;var n=t.callbackNode;if(Iy()&&t.callbackNode!==n)return null;var i=Xt;return i=Sy(t,t===Te?i:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),i===0?null:(I3(t,i,e),Q3(t,Ji()),t.callbackNode!=null&&t.callbackNode===n?X3.bind(null,t):null)}function ez(t,e){if(Iy())return null;I3(t,e,!0)}function d8(){E8(function(){se&6?bE(Iz,f8):Y3()})}function rA(){if(tl===0){var t=Mc;t===0&&(t=dg,dg<<=1,!(dg&261888)&&(dg=256)),tl=t}return tl}function nz(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:_g(""+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 h8(t,e,n,i,a){if(e==="submit"&&n&&n.stateNode===a){var o=nz((a[Mi]||null).action),s=i.submitter;s&&(e=(e=s[Mi]||null)?nz(e.formAction):s.getAttribute("formAction"),e!==null&&(o=e,s=null));var u=new by("action","action",null,i,a);t.push({event:u,listeners:[{instance:null,listener:function(){if(i.defaultPrevented){if(tl!==0){var d=s?iz(a,s):new FormData(a);Wx(n,{pending:!0,data:d,method:a.method,action:o},null,d)}}else typeof o=="function"&&(u.preventDefault(),d=s?iz(a,s):new FormData(a),Wx(n,{pending:!0,data:d,method:a.method,action:o},o,d))},currentTarget:a}]})}}for(Rg=0;Rg<Ux.length;Rg++)Tg=Ux[Rg],az=Tg.toLowerCase(),oz=Tg[0].toUpperCase()+Tg.slice(1),Ga(az,"on"+oz);var Tg,az,oz,Rg;Ga(rN,"onAnimationEnd");Ga(lN,"onAnimationIteration");Ga(sN,"onAnimationStart");Ga("dblclick","onDoubleClick");Ga("focusin","onFocus");Ga("focusout","onBlur");Ga(zV,"onTransitionRun");Ga(NV,"onTransitionStart");Ga(IV,"onTransitionCancel");Ga(uN,"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(" "),p8=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Xd));function K3(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){Kg(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){Kg(f)}a.currentTarget=null,o=d}}}}function kt(t,e){var n=e[zx];n===void 0&&(n=e[zx]=new Set);var i=t+"__bubble";n.has(i)||(Z3(e,t,2,!1),n.add(i))}function Sx(t,e,n){var i=0;e&&(i|=4),Z3(n,t,i,e)}var Cg="_reactListening"+Math.random().toString(36).slice(2);function lA(t){if(!t[Cg]){t[Cg]=!0,jz.forEach(function(n){n!=="selectionchange"&&(p8.has(n)||Sx(n,!1,t),Sx(n,!0,t))});var e=t.nodeType===9?t:t.ownerDocument;e===null||e[Cg]||(e[Cg]=!0,Sx("selectionchange",!1,e))}}function Z3(t,e,n,i){switch(uI(e)){case 2:var a=q8;break;case 8:a=F8;break;default:a=fA}n=a.bind(null,e,n,t),a=void 0,!Bx||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 bx(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}Kz(function(){var p=o,f=TE(n),m=[];t:{var g=cN.get(t);if(g!==void 0){var v=by,S=t;switch(t){case"keypress":if(Ng(n)===0)break t;case"keydown":case"keyup":v=uV;break;case"focusin":S="focus",v=Jb;break;case"focusout":S="blur",v=Jb;break;case"beforeblur":case"afterblur":v=Jb;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=d_;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":v=WU;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":v=dV;break;case rN:case lN:case sN:v=tV;break;case uN:v=pV;break;case"scroll":case"scrollend":v=KU;break;case"wheel":v=gV;break;case"copy":case"cut":case"paste":v=nV;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":v=p_;break;case"toggle":case"beforetoggle":v=vV}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!==Lx&&(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=d_,C="onMouseLeave",A="onMouseEnter",x="mouse",(t==="pointerout"||t==="pointerover")&&(E=p_,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=m8,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&&rz(m,g,v,E,!1),S!==null&&T!==null&&rz(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=v_;else if(y_(g))if(eN)z=MV;else{z=CV;var N=TV}else v=g.nodeName,!v||v.toLowerCase()!=="input"||g.type!=="checkbox"&&g.type!=="radio"?p&&RE(p.elementType)&&(z=v_):z=wV;if(z&&(z=z(t,p))){tN(m,z,n,f);break t}N&&N(t,g,p),t==="focusout"&&p&&g.type==="number"&&p.memoizedProps.value!=null&&Dx(g,"number",g.value)}switch(N=p?Ad(p):window,t){case"focusin":(y_(N)||N.contentEditable==="true")&&(fc=N,Px=p,Md=null);break;case"focusout":Md=Px=fc=null;break;case"mousedown":Hx=!0;break;case"contextmenu":case"mouseup":case"dragend":Hx=!1,E_(m,n,f);break;case"selectionchange":if(_V)break;case"keydown":case"keyup":E_(m,n,f)}var D;if(ME)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?Jz(t,n)&&(q="onCompositionEnd"):t==="keydown"&&n.keyCode===229&&(q="onCompositionStart");q&&(Wz&&n.locale!=="ko"&&(cc||q!=="onCompositionStart"?q==="onCompositionEnd"&&cc&&(D=Zz()):(Wr=f,CE="value"in Wr?Wr.value:Wr.textContent,cc=!0)),N=dy(p,q),0<N.length&&(q=new h_(q,t,null,n,f),m.push({event:q,listeners:N}),D?q.data=D:(D=$z(n),D!==null&&(q.data=D)))),(D=bV?xV(t,n):EV(t,n))&&(q=dy(p,"onBeforeInput"),0<q.length&&(N=new h_("onBeforeInput","beforeinput",null,n,f),m.push({event:N,listeners:q}),N.data=D)),h8(m,t,p,n,f)}K3(m,e)})}function Kd(t,e,n){return{instance:t,listener:e,currentTarget:n}}function dy(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 m8(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function rz(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 g8=/\r\n?/g,y8=/\u0000|\uFFFD/g;function lz(t){return(typeof t=="string"?t:""+t).replace(g8,`
20
+ `).replace(y8,"")}function W3(t,e){return e=lz(e),lz(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":mg(t,"class",i);break;case"tabIndex":mg(t,"tabindex",i);break;case"dir":case"role":case"viewBox":case"width":case"height":mg(t,n,i);break;case"style":Xz(t,i,o);break;case"data":if(e!=="object"){mg(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=_g(""+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=_g(""+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=_g(""+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),Og(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":Og(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=QU.get(n)||n,Og(t,n,i))}}function sE(t,e,n,i,a,o){switch(n){case"style":Xz(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(!qz.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,""):Og(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)}}kz(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)}Qz(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(RE(e)){for(f in n)n.hasOwnProperty(f)&&(i=n[f],i!==void 0&&sE(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 v8(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)}}Ix(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)}Yz(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(RE(e)){for(var T in n)g=n[T],n.hasOwnProperty(T)&&g!==void 0&&!i.hasOwnProperty(T)&&sE(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||sE(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 sz(t){switch(t){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function S8(){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&&sz(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&&sz(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 uE=null,cE=null;function hy(t){return t.nodeType===9?t:t.ownerDocument}function uz(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 J3(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 fE(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 xx=null;function b8(){var t=window.event;return t&&t.type==="popstate"?t===xx?!1:(xx=t,!0):(xx=null,!1)}var $3=typeof setTimeout=="function"?setTimeout:void 0,x8=typeof clearTimeout=="function"?clearTimeout:void 0,cz=typeof Promise=="function"?Promise:void 0,E8=typeof queueMicrotask=="function"?queueMicrotask:typeof cz<"u"?function(t){return cz.resolve(null).then(t).catch(A8)}:$3;function A8(t){setTimeout(function(){throw t})}function ml(t){return t==="head"}function fz(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 dz(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 dE(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":dE(n),AE(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}t.removeChild(n)}}function R8(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 T8(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 tI(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 hE(t){return t.data==="$?"||t.data==="$~"}function pE(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState!=="loading"}function C8(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 mE=null;function hz(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 pz(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 eI(t,e,n){switch(e=hy(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]);AE(t)}var wa=new Map,mz=new Set;function py(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var nr=ue.d;ue.d={f:w8,r:M8,D:O8,C:_8,L:z8,m:N8,X:D8,S:I8,M:L8};function w8(){var t=nr.f(),e=zy();return t||e}function M8(t){var e=Pc(t);e!==null&&e.tag===5&&e.type==="form"?XN(e):nr.r(t)}var jc=typeof document>"u"?null:document;function nI(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+'"]'),mz.has(a)||(mz.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 O8(t){nr.D(t),nI("dns-prefetch",t,null)}function _8(t,e){nr.C(t,e),nI("preconnect",t,e)}function z8(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 N8(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 I8(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))&&sA(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,Vg(s,e,i)}s={type:"stylesheet",instance:s,count:1,state:u},a.set(o,s)}}}function D8(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))&&uA(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 L8(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))&&uA(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 gz(t,e,n,i){var a=(a=el.current)?py(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||B8(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 iI(t){return Ne({},t,{"data-precedence":t.precedence,precedence:null})}function B8(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 yz(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),Vg(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=iI(n),(a=wa.get(a))&&sA(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,Vg(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),uA(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,Vg(i,n.precedence,t));return e.instance}function Vg(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 sA(t,e){t.crossOrigin==null&&(t.crossOrigin=e.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=e.referrerPolicy),t.title==null&&(t.title=e.title)}function uA(t,e){t.crossOrigin==null&&(t.crossOrigin=e.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=e.referrerPolicy),t.integrity==null&&(t.integrity=e.integrity)}var jg=null;function vz(t,e,n){if(jg===null){var i=new Map,a=jg=new Map;a.set(n,i)}else a=jg,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 Sz(t,e,n){t=t.ownerDocument||t,t.head.insertBefore(n,e==="title"?t.querySelector("head > title"):null)}function P8(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 aI(t){return!(t.type==="stylesheet"&&!(t.state.loading&3))}function H8(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=my.bind(t),e.then(t,t)),n.state.loading|=4,n.instance=o,In(o);return}o=e.ownerDocument||e,i=iI(i),(a=wa.get(a))&&sA(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=my.bind(t),e.addEventListener("load",n),e.addEventListener("error",n))}}var Ex=0;function U8(t,e){return t.stylesheets&&t.count===0&&qg(t,t.stylesheets),0<t.count||0<t.imgCount?function(n){var i=setTimeout(function(){if(t.stylesheets&&qg(t,t.stylesheets),t.unsuspend){var o=t.unsuspend;t.unsuspend=null,o()}},6e4+e);0<t.imgBytes&&Ex===0&&(Ex=62500*S8());var a=setTimeout(function(){if(t.waitingForImages=!1,t.count===0&&(t.stylesheets&&qg(t,t.stylesheets),t.unsuspend)){var o=t.unsuspend;t.unsuspend=null,o()}},(t.imgBytes>Ex?50:800)+e);return t.unsuspend=n,function(){t.unsuspend=null,clearTimeout(i),clearTimeout(a)}}:null}function my(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)qg(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var gy=null;function qg(t,e){t.stylesheets=null,t.unsuspend!==null&&(t.count++,gy=new Map,e.forEach(V8,t),gy=null,my.call(t))}function V8(t,e){if(!(e.state.loading&4)){var n=gy.get(t);if(n)var i=n.get(null);else{n=new Map,gy.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=my.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 j8(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=Xb(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Xb(0),this.hiddenUpdates=Xb(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 oI(t,e,n,i,a,o,s,u,d,p,f,m){return t=new j8(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=LE(),e.refCount++,t.pooledCache=e,e.refCount++,o.memoizedState={element:i,isDehydrated:n,cache:e},HE(o),t}function rI(t){return t?(t=pc,t):pc}function lI(t,e,n,i,a,o){a=rI(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 bz(t,e){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var n=t.retryLane;t.retryLane=n!==0&&n<e?n:e}}function cA(t,e){bz(t,e),(t=t.alternate)&&bz(t,e)}function sI(t){if(t.tag===13||t.tag===31){var e=Ds(t,67108864);e!==null&&wi(e,t,67108864),cA(t,67108864)}}function xz(t){if(t.tag===13||t.tag===31){var e=ea();e=xE(e);var n=Ds(t,e);n!==null&&wi(n,t,e),cA(t,e)}}var yy=!0;function q8(t,e,n,i){var a=_t.T;_t.T=null;var o=ue.p;try{ue.p=2,fA(t,e,n,i)}finally{ue.p=o,_t.T=a}}function F8(t,e,n,i){var a=_t.T;_t.T=null;var o=ue.p;try{ue.p=8,fA(t,e,n,i)}finally{ue.p=o,_t.T=a}}function fA(t,e,n,i){if(yy){var a=gE(i);if(a===null)bx(t,e,i,vy,n),Ez(t,i);else if(k8(a,t,e,n,i))i.stopPropagation();else if(Ez(t,i),e&4&&-1<G8.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)&&(ly=Ji()+500,sh(0,!1))}}break;case 31:case 13:u=Ds(o,2),u!==null&&wi(u,o,2),zy(),cA(o,2)}if(o=gE(i),o===null&&bx(t,e,i,vy,n),o===a)break;a=o}a!==null&&i.stopPropagation()}else bx(t,e,i,null,n)}}function gE(t){return t=TE(t),dA(t)}var vy=null;function dA(t){if(vy=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=Mz(e),t!==null)return t;t=null}else if(n===31){if(t=Oz(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 vy=t,null}function uI(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(zU()){case Iz:return 2;case Dz:return 8;case Qg:case NU:return 32;case Lz:return 268435456;default:return 32}default:return 32}}var yE=!1,ll=null,sl=null,ul=null,Wd=new Map,Jd=new Map,Kr=[],G8="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 Ez(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&&sI(e)),t):(t.eventSystemFlags|=i,e=t.targetContainers,a!==null&&e.indexOf(a)===-1&&e.push(a),t)}function k8(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 cI(t){var e=sc(t.target);if(e!==null){var n=$d(e);if(n!==null){if(e=n.tag,e===13){if(e=Mz(n),e!==null){t.blockedOn=e,o_(t.priority,function(){xz(n)});return}}else if(e===31){if(e=Oz(n),e!==null){t.blockedOn=e,o_(t.priority,function(){xz(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 Fg(t){if(t.blockedOn!==null)return!1;for(var e=t.targetContainers;0<e.length;){var n=gE(t.nativeEvent);if(n===null){n=t.nativeEvent;var i=new n.constructor(n.type,n);Lx=i,n.target.dispatchEvent(i),Lx=null}else return e=Pc(n),e!==null&&sI(e),t.blockedOn=n,!1;e.shift()}return!0}function Az(t,e,n){Fg(t)&&n.delete(e)}function Y8(){yE=!1,ll!==null&&Fg(ll)&&(ll=null),sl!==null&&Fg(sl)&&(sl=null),ul!==null&&Fg(ul)&&(ul=null),Wd.forEach(Az),Jd.forEach(Az)}function wg(t,e){t.blockedOn===e&&(t.blockedOn=null,yE||(yE=!0,Cn.unstable_scheduleCallback(Cn.unstable_NormalPriority,Y8)))}var Mg=null;function Rz(t){Mg!==t&&(Mg=t,Cn.unstable_scheduleCallback(Cn.unstable_NormalPriority,function(){Mg===t&&(Mg=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(dA(i||n)===null)continue;break}var o=Pc(n);o!==null&&(t.splice(e,3),e-=3,Wx(o,{pending:!0,data:a,method:n.method,action:i},i,a))}}))}function Lc(t){function e(d){return wg(d,t)}ll!==null&&wg(ll,t),sl!==null&&wg(sl,t),ul!==null&&wg(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);)cI(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||Rz(n);else if(s){var u=null;if(o&&o.hasAttribute("formAction")){if(a=o,s=o[Mi]||null)u=s.formAction;else if(dA(a)!==null)continue}else u=s.action;typeof u=="function"?n[i+1]=u:(n.splice(i,3),i-=3),Rz(n)}}}function fI(){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 hA(t){this._internalRoot=t}Dy.prototype.render=hA.prototype.render=function(t){var e=this._internalRoot;if(e===null)throw Error(W(409));var n=e.current,i=ea();lI(n,i,t,e,null,null)};Dy.prototype.unmount=hA.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var e=t.containerInfo;lI(t.current,2,null,t,null,null),zy(),e[Bc]=null}};function Dy(t){this._internalRoot=t}Dy.prototype.unstable_scheduleHydration=function(t){if(t){var e=Vz();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&&cI(t)}};var Tz=Cz.version;if(Tz!=="19.2.0")throw Error(W(527,Tz,"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=RU(e),t=t!==null?_z(t):null,t=t===null?null:t.stateNode,t};var Q8={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(Q8),$i=bd}catch{}var bd;Ly.createRoot=function(t,e){if(!wz(t))throw Error(W(299));var n=!1,i="",a=n3,o=i3,s=a3;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=oI(t,1,!1,null,null,n,i,null,a,o,s,fI),t[Bc]=e.current,lA(t),new hA(e)};Ly.hydrateRoot=function(t,e,n){if(!wz(t))throw Error(W(299));var i=!1,a="",o=n3,s=i3,u=a3,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=oI(t,1,!0,e,n??null,i,a,d,o,s,u,fI),e.context=rI(null),n=e.current,i=ea(),i=xE(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,lA(t),new Dy(e)};Ly.version="19.2.0"});var mI=ui((TY,pI)=>{"use strict";function hI(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(hI)}catch(t){console.error(t)}}hI(),pI.exports=dI()});var R4=ui((sit,A4)=>{"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})(),A4.exports=i})()});var W9={};$B(W9,{AnnotationContext:()=>_9,AnnotationPageContext:()=>z9,AnnotationStyleProvider:()=>L7,AtlasStoreProvider:()=>Xc,AtlasStoreReactContext:()=>Hs,Auth:()=>Ab,AuthProvider:()=>xb,AuthRContext:()=>fs,AuthReactContext:()=>UM,AuthReactContextActions:()=>VM,CanvasAnnotations:()=>S9,CanvasContext:()=>ma,CanvasPanel:()=>wn,CanvasStrategyProvider:()=>QR,CanvasWorldObject:()=>KR,CollectionContext:()=>N9,CombinedMetadata:()=>b9,ComplexTimelineProvider:()=>oR,ContextBridge:()=>Jh,ControlsReactContext:()=>Ih,CreateCustomShape:()=>$R,CustomContextBridge:()=>n4,CustomContextBridgeProvider:()=>e9,DEFAULT_BEZIER:()=>pp,DEFAULT_POLL_INTERVAL:()=>lT,DefaultEditingTools:()=>r4,EASING_PRESETS:()=>sT,EventEmitterProvider:()=>Yj,EventsProvider:()=>t9,Image:()=>x4,ImageService:()=>E9,ImageServiceLoaderContext:()=>PD,InnerViewerProvider:()=>YM,LanguageProvider:()=>G7,LanguageString:()=>KD,LocaleString:()=>oa,ManifestContext:()=>cb,ManifestMetadata:()=>R9,MediaPlayerProvider:()=>zh,Metadata:()=>dp,PolygonSelector:()=>v9,RangeContext:()=>fb,ReactEmitterContext:()=>hv,ReactEventContext:()=>Ws,ReactVaultContext:()=>Ur,RegionHighlight:()=>UA,Render3DModelStrategy:()=>XA,RenderAccompanyingCanvas:()=>KA,RenderAnnotation:()=>Vs,RenderAnnotationEditing:()=>LR,RenderAnnotationPage:()=>Al,RenderAnnotationStrategy:()=>tR,RenderAudioStrategy:()=>iR,RenderComplexTimelineStrategy:()=>uR,RenderEmptyStrategy:()=>cR,RenderImageStrategy:()=>fR,RenderSvgEditorControls:()=>O9,RenderTextualContentStrategy:()=>dR,RenderVideoStrategy:()=>pR,RenderYouTubeStrategy:()=>mR,ResizeWorldItem:()=>PA,ResourceProvider:()=>ci,ResourceReactContext:()=>Yf,SelectorControllerProvider:()=>m9,SequenceThumbnails:()=>w9,SimpleViewerProvider:()=>Tb,SimpleViewerReactContext:()=>Qu,SingleCanvasThumbnail:()=>aT,StrategyReactContext:()=>Tl,ThumbnailFallbackImage:()=>ks,TranslationProvider:()=>F7,TransliterationProvider:()=>k7,VaultProvider:()=>Io,ViewerPresetContext:()=>Xa,VirtualAnnotationProvider:()=>$A,VisibleCanvasReactContext:()=>us,annotationResponseToSelector:()=>Z9,authDetailsForResource:()=>vb,buildTransitions:()=>cT,cachedParseCssToBoxStyleMap:()=>$S,convertBoxStyleToSelectorStyle:()=>t2,convertSelectorStyleToBoxStyle:()=>um,createAtlasStore:()=>OA,createAuthStateStore:()=>gb,createProbe:()=>yb,cubicBezierEasing:()=>mf,defaultEmitter:()=>t4,defaultSvgTheme:()=>rL,emptyActions:()=>BR,emptyStrategy:()=>PR,expandTarget:()=>an,findAllCanvasesInRange:()=>Ym,findFirstCanvasFromRange:()=>xM,findManifestSelectedRange:()=>Y6,findSelectedRange:()=>db,flattenAnnotationPageIds:()=>HR,formatTime:()=>bv,get3dStrategy:()=>jR,getAtlasStoreByName:()=>NA,getComplexTimelineStrategy:()=>FR,getDefaultAnnotationStyles:()=>IA,getImageStrategy:()=>rp,getManifestSequence:()=>Qm,getParsedTargetSelector:()=>ep,getRenderingStrategy:()=>up,getSelectorTransformAttributes:()=>Ir,getStepFromProgress:()=>fT,getTextualContentStrategy:()=>lp,getVideoStrategy:()=>sp,getVisibleCanvasesFromCanvasId:()=>Q6,hasAuth:()=>pH,interpolateRect:()=>uT,isBoxSelector:()=>I7,isImageApiSelector:()=>cm,isRectangle:()=>Yc,isSvgSelector:()=>hD,isValidCanvasFragment:()=>fm,makeAccessServiceRequest:()=>mb,makeAccessTokenRequest:()=>Wm,parseCssToBoxStyleMap:()=>KS,parseCssTransform:()=>WS,parseCssTransformOrigin:()=>ZS,parseCssTransformStyle:()=>JS,parseRotation:()=>dm,parseSelector:()=>_o,parseSpecificResource:()=>n9,polygonToTarget:()=>Qc,requestToAnnotationResponse:()=>Ch,resolveSelectorStyle:()=>Dr,seraliseSupportedSelector:()=>yv,splitCanvasFragment:()=>$l,svgThemes:()=>p9,targetIntersects:()=>X9,unknownResponse:()=>np,unsupportedStrategy:()=>Pe,useAnnotation:()=>Mh,useAnnotationPage:()=>VA,useAnnotationPageManager:()=>ap,useAnnotationStyles:()=>wh,useAnnotationsAtTime:()=>I9,useAtlasContextMenu:()=>tp,useAtlasStore:()=>Ie,useAuthActions:()=>jM,useAuthService:()=>qM,useAuthStore:()=>ku,useAuthToken:()=>gH,useAuthTokens:()=>Sb,useCanvas:()=>zt,useCanvasChoices:()=>D9,useCanvasClock:()=>L9,useCanvasSequence:()=>hb,useCanvasStartTime:()=>Nh,useCanvasSubset:()=>B9,useClosestLanguage:()=>WD,useCollection:()=>P9,useComplexTimeline:()=>q7,useContextBridge:()=>Wh,useContextMenuStore:()=>o4,useCreateLocaleString:()=>Y7,useCurrentAnnotationActions:()=>H9,useCurrentAnnotationMetadata:()=>U9,useCurrentAnnotationRequest:()=>DR,useCurrentAnnotationTransition:()=>V9,useCurrentAuth:()=>mH,useCustomContextBridge:()=>Zh,useDispatch:()=>ZA,useEmitter:()=>wA,useEvent:()=>Ps,useEventEmitter:()=>Xh,useEventListener:()=>j9,useExistingVault:()=>Do,useExternalCollection:()=>q9,useExternalManifest:()=>ub,useExternalResource:()=>id,useIIIFLanguage:()=>zv,useImage:()=>l0,useImageService:()=>rT,useImageServiceLoader:()=>Dh,useImageTile:()=>F9,useIsAuthEnabled:()=>Eb,useLoadImageService:()=>op,useLocaleString:()=>JD,useManifest:()=>on,useMediaActions:()=>P7,useMediaElements:()=>H7,useMediaState:()=>B7,usePaintables:()=>VR,usePaintingAnnotations:()=>dr,usePolygonHelper:()=>gR,useRange:()=>ad,useRemoteStylesheet:()=>LA,useRenderControls:()=>hi,useRenderingStrategy:()=>kR,useRequestAnnotation:()=>JR,useResourceContext:()=>ti,useResourceEvents:()=>_h,useResources:()=>UR,useSearchService:()=>Rb,useSelectorController:()=>eT,useSelectorEmitter:()=>g9,useSelectorEvents:()=>tT,useSelectorHelper:()=>y9,useSimpleMediaPlayer:()=>js,useSimpleViewer:()=>ds,useStaticRenderingStrategy:()=>G9,useStrategy:()=>Fe,useStyleHelper:()=>k9,useStyles:()=>Us,useStylesheetStore:()=>mD,useSvgEditor:()=>yR,useSvgEditorControls:()=>oT,useThumbnail:()=>lr,useTranslations:()=>lR,useTransliteration:()=>rR,useVault:()=>Vt,useVaultEffect:()=>eR,useVaultSelector:()=>re,useViewerPreset:()=>Lh,useViewportScroll:()=>Q9,useViewportTour:()=>Y9,useVirtualAnnotationPage:()=>WA,useVirtualAnnotationPageContext:()=>JA,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 eP(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 nP(t){var e=eP(t,"string");return Ff(e)=="symbol"?e:e+""}function Rn(t,e,n){return(e=nP(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var iP=Object.create,Ww=Object.defineProperty,aP=Object.getOwnPropertyDescriptor,oP=Object.getOwnPropertyNames,rP=Object.getPrototypeOf,lP=Object.prototype.hasOwnProperty,YS=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var sP=(t,e,n,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(var a=oP(e),o=0,s=a.length,u;o<s;o++)u=a[o],!lP.call(t,u)&&u!==n&&Ww(t,u,{get:(d=>e[d]).bind(null,u),enumerable:!(i=aP(e,u))||i.enumerable});return t},QS=(t,e,n)=>(n=t==null?{}:iP(rP(t)),sP(e||!t||!t.__esModule?Ww(n,"default",{value:t,enumerable:!0}):n,t));var uP=/^(-?(?:\d+|\d*\.\d+))(px|%)?$/,cP=/^(-?(?:\d+|\d*\.\d+))(deg|rad|turn)?$/,Jw=/([a-zA-Z0-9]+)\(([^)]*)\)/g;function fP(t){if(t==="%")return"percent";if(!t||t==="px")return"pixel"}function Cu(t){let e=uP.exec(t.trim());if(e)return{value:Number.parseFloat(e[1]),unit:fP(e[2])}}function dP(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 hP(t){let e=cP.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 XS(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 KS(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 um(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 t2(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 ZS(t){if(t)return dP(t)}function WS(t){let e={};if(!t)return e;e.transform=t;let n;for(Jw.lastIndex=0;(n=Jw.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=hP(a[0]||"");o!==void 0&&(e.rotation=o);continue}if(i==="translatex"){let o=Cu(a[0]||"");o&&(e.translate=XS(e.translate,{x:o.value,y:0,...o.unit?{unit:o.unit}:{}}));continue}if(i==="translatey"){let o=Cu(a[0]||"");o&&(e.translate=XS(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=XS(e.translate,u)}}}return e}function JS(t){let e=WS(t?.transform),n=ZS(t?.transformOrigin);return t?.transformOrigin&&(e.transformOrigin=t.transformOrigin),n&&(e.rotationOrigin=n),e}function Ir(t){let e=JS(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 $w=new Map;function $S(t,e){let n=$w.get(t);if(n?.css===e)return n.styleMap;let i=KS(e);return $w.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 um(n||{});let i=um(n||{}),a=Object.entries(e);for(let[o,s]of a){if(!s)continue;let u=$S(o,s),d=Object.entries(u);for(let[p,f]of d)p===t&&Object.assign(i,f)}return i}function pP(t,e,n,i=1){return new a2(t,e,n).subdivide(i)}function mP(t,e,n,i,a=1){return new yP(new Float64Array([t.x,t.y,e.x,e.y,n.x,n.y,i.x,i.y])).subdivide(a)}function gP(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 a2=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))}},yP=class o2{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 a2({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 o2(i)}subdivide(e){let n=.1*e,i=e-n,a=Math.sqrt(i),o=gP(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}},vP=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,t1=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}},SP=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}]},e2=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)},bP=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=e2(1,0,M,z),P=e2(M,z,N,D);return u===0&&P>0&&(P-=kf),u===1&&P<0&&(P+=kf),[R,C,q,P]},xP=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=vP(bP(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(SP(z,N)),z+=N;return v.map(function(U){var J=t1(U[0],o,s,E,S,C,M),at=J.x,X=J.y,tt=t1(U[1],o,s,E,S,C,M),ut=tt.x,xt=tt.y,lt=t1(U[2],o,s,E,S,C,M);return{x1:at,y1:X,x2:ut,y2:xt,x:lt.x,y:lt.y}})},EP=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 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):[]}}),AP=YS((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})}}),RP=QS(EP(),1),TP=QS(AP(),1);function CP(t){let e=(0,TP.default)((0,RP.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=xP({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 wP=/&?(xywh=)?(pixel:|percent:|pct:)?([0-9]+(?:\.[0-9]+)?),([0-9]+(?:\.[0-9]+)?),([0-9]+(?:\.[0-9]+)?),([0-9]+(?:\.[0-9]+)?)/,n2=/&?(t=)(npt:)?([0-9]+(\.[0-9]+)?)?(,([0-9]+(\.[0-9]+)?))?/,i2=/^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(cm(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=wP.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(n2);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(n2);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=r2(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}=_P(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 MP(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 r2(t){for(let e of Array.from(t.children))switch(e?.tagName.toLowerCase()){case"g":{let n=r2(e);if(n)return n}continue;case"path":{let n=e.getAttribute("d");if(!n)continue;let i=CP(n);return{element:e,points:OP(i),shapeType:MP(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 OP(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(...mP({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(...pP({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 _P(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 cm(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||!fm(n)?[t,""]:[e,n]}function fm(t){return t.includes("xywh=")||t.includes("t=")}function pa(t){if(t.iiifRenderingHints){let e=t.iiifRenderingHints;if(e.rotation){let n=dm(`${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 dm(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),f2=_(Y(),1),IP={collection:void 0,manifest:void 0,range:void 0,canvas:void 0,annotation:void 0,annotationPage:void 0},Yf=Mu.default.createContext(IP),ti=()=>(0,Mu.useContext)(Yf);function ci({value:t,children:e}){let n=ti(),i=(0,Mu.useMemo)(()=>({...n,...t}),[t,n]);return(0,f2.jsx)(Yf.Provider,{value:i,children:e})}var d2=_(Y(),1);function ma({canvas:t,children:e}){return(0,d2.jsx)(ci,{value:{canvas:t},children:e})}var Gm=_(nt(),1);var p2={},h2=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:()=>{(p2.env?p2.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},pm=t=>t?h2(t):h2;function mm(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 DP(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 LP(t){var e=DP(t,"string");return Qf(e)=="symbol"?e:e+""}function ao(t,e,n){return(e=LP(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 gm(...t){return e=>t.reduce((n,i)=>i(n),e)}var e1=["Collection","Manifest","Canvas","AnnotationPage","AnnotationCollection","Annotation","ContentResource","Range","Service","Selector","Agent"];function m2(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=e1.indexOf(t.type);if(n!==-1)return e1[n]}if(t.profile)return"Service";throw Error("Resource type is not known")}var n1=class g2{constructor(e,n={}){ao(this,"traversals",void 0),ao(this,"options",void 0),ao(this,"_traverseManifest",gm(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",gm(this.traverseCanvasItems.bind(this),this.traverseLinking.bind(this),this.traverseDescriptive.bind(this),this.traverseLinkedCanvases.bind(this),this.traverseInlineAnnotationPages.bind(this))),ao(this,"_traverseAnnotationPage",gm(this.traverseAnnotationPageItems.bind(this),this.traverseLinking.bind(this),this.traverseDescriptive.bind(this))),ao(this,"_traverseRange",gm(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=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=m2(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 i1="http://library.stanford.edu/iiif/image-api/compliance.html#level0",a1="http://library.stanford.edu/iiif/image-api/compliance.html#level1",o1="http://library.stanford.edu/iiif/image-api/compliance.html#level2",r1="http://library.stanford.edu/iiif/image-api/conformance.html#level0",l1="http://library.stanford.edu/iiif/image-api/conformance.html#level1",s1="http://library.stanford.edu/iiif/image-api/conformance.html#level2",u1="http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level0",c1="http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level1",f1="http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level2",d1="http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level0",h1="http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level1",p1="http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level2",m1="http://iiif.io/api/image/1/level0.json",g1="http://iiif.io/api/image/1/profiles/level0.json",y1="http://iiif.io/api/image/1/level1.json",v1="http://iiif.io/api/image/1/profiles/level1.json",S1="http://iiif.io/api/image/1/level2.json",b1="http://iiif.io/api/image/1/profiles/level2.json",x1="http://iiif.io/api/image/2/level0.json",E1="http://iiif.io/api/image/2/profiles/level0.json",A1="http://iiif.io/api/image/2/level1.json",R1="http://iiif.io/api/image/2/profiles/level1.json",T1="http://iiif.io/api/image/2/level2.json",C1="http://iiif.io/api/image/2/profiles/level2.json",w1="level0",M1="level1",O1="level2",_1="http://iiif.io/api/image/2/level0",z1="http://iiif.io/api/image/2/level1",N1="http://iiif.io/api/image/2/level2",Ou=[N1,o1,s1,f1,p1,S1,b1,T1,C1,O1],ym=[...Ou,z1,a1,l1,c1,h1,y1,v1,A1,R1,M1],I1=[_1,z1,N1,i1,a1,o1,r1,l1,s1,u1,c1,f1,d1,h1,p1,m1,g1,y1,v1,S1,b1,x1,E1,A1,R1,T1,C1,w1,M1,O1],D1=I1,L1=[_1,i1,r1,u1,d1,m1,g1,x1,E1,w1],y2={extraFormats:["jpg"],extraQualities:["default"],extraFeatures:["sizeByWhListed"]},v2={extraFormats:["jpg"],extraQualities:["default"],extraFeatures:["baseUriRedirect","cors","jsonldMediaType","regionByPx","regionSquare","sizeByWhListed","sizeByH","sizeByW","sizeByWh"]},S2={extraFormats:["jpg","png"],extraQualities:["default"],extraFeatures:["baseUriRedirect","cors","jsonldMediaType","regionByPct","regionByPx","regionSquare","rotationBy90s","sizeByWhListed","sizeByConfinedWh","sizeByH","sizeByPct","sizeByW","sizeByWh"]};var b2=["sc:Collection","sc:Manifest","sc:Canvas","sc:AnnotationList","oa:Annotation","sc:Range","sc:Layer","sc:Sequence","oa:Choice","Service","ContentResource"];function BP(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=b2.indexOf(t["@type"]);if(e!==-1)return b2[e]}if(t.profile)return"Service";if(t.format||t["@type"])return"ContentResource";throw Error("Resource type is not known")}var PP=class R2{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 R2({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(BP(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)}},HP=["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"],P1={attributionLabel:"Attribution",lang:"none",providerId:"http://example.org/provider",providerName:""};function UP(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=UP(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 T2(t){if(Array.isArray(t))return T2(t.find(e=>typeof e=="string"));if(Ou.indexOf(t)!==-1)return"level2";if(HP.indexOf(t)!==-1)return"level1";if(D1.indexOf(t)!==-1)return"level0";if(typeof t=="string")return t}function VP(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 jP(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 x2(t){for(let e of["sc","oa","dcterms","dctypes","iiif"])if(t.startsWith(`${e}:`))return t.slice(e.length+1);return t}var qP=["Collection","Manifest","Annotation","AnnotationPage","Range","Service"];function U1(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=jP(i);if(o)return o}if(a){let o=VP(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&&qP.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 FP=/^|["'\\>]http(s)?:\/\/(creativecommons.org|rightsstatements.org)\/[^"'\\<\n]+/gm;function GP(t){let e=t.match(FP);return e?e[0]:t}function kP(t,e="Rights/License",n="none"){let i=null,a=[],o=Array.isArray(t)?t:[t];for(let s of o){let u=s?GP(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 YP=["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 QP(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"),YP.indexOf(i)===-1&&n.push(i);if(e.length)return n.length===1?n[0]:n}}function XP(t){return t?t.map(e=>({label:ts(e.label),value:ts(e.value)})):[]}var E2=0;function C2(t,e){let n=encodeURI(t.id||t["@id"]||"").trim();return n&&e?`${n}/${e}`:n||(E2++,`http://example.org/${t["@type"]}${e?`/${e}`:""}/${E2}`)}function zo(t){let e=[...t.behavior||[]];t.viewingHint&&e.push(t.viewingHint);let n;return Array.isArray(t.motivation)?n=t.motivation.map(x2):t.motivation&&(n=x2(t.motivation)),{"@context":t["@context"]?QP(t["@context"]):void 0,id:(t["@id"]||C2(t)).trim(),type:U1(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]=kP(t.license),i=[...t.metadata?XP(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(P1.attributionLabel),value:ts(t.attribution)}:void 0,navDate:t.navDate,summary:t.description?ts(t.description):void 0,thumbnail:KP(t.thumbnail)}}function KP(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 ZP(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:U1(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:P1.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(P1.providerName)}]:void 0,partOf:ZP(t),rendering:t.rendering,seeAlso:t.seeAlso,start:t.startCanvas,service:t.service?Ba(t.service):void 0,supplementary:n?[n]:void 0}}function WP(t){return{chars:t.chars,format:t.format?t.format:void 0,language:t.language}}function B1(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 JP(t){let e={};if(t.first){let n=B1(t.first,"Collection");n&&(e.first=n)}if((t.total||t.total===0)&&(e.total=t.total),t.prev){let n=B1(t.prev,"Collection");n&&(e.prev=n)}if(t.next){let n=B1(t.next,"Collection");n&&(e.next=n)}return e}function $P(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 t6(t){return Pa({...zo(t),...No(t),...Lr(t),...JP(t),items:$P(t.members)})}function e6(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:n6(t.structures)})}function n6(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 i6(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:C2(t,"annotation-page"),type:"AnnotationPage",items:t.images}]:void 0})}function a6(t){return Pa({...zo(t),...No(t),...Lr(t),items:t.resources&&t.resources.length?t.resources:void 0})}function o6(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 r6(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:H1(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(A2):A2(t.resource)})}function A2(t){return t.type==="Choice"?t:w2(t)}function w2(t){let e=t;return Pa({...zo(e),...No(e),...Lr(e),...WP(e)})}function l6(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 s6(t){return Pa({...zo(t),...No(t),...Lr(t),items:t.members})}function u6(t){let{"@id":e,"@type":n,"@context":i,profile:a,...o}=t,s={};return e&&(s["@id"]=e),s["@type"]=U1(t),s["@type"]==="unknown"&&(i&&i.length&&(s["@context"]=i),s["@type"]="Service"),a&&(s.profile=T2(a)),Pa({...s,...o})}function c6(t){return Pa({...zo(t),...No(t),...Lr(t)})}var f6=new PP({collection:[t6],manifest:[e6],canvas:[i6],annotationList:[a6],sequence:[o6],annotation:[r6],contentResource:[w2],choice:[l6],range:[s6],service:[u6],layer:[c6]});function M2(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"),f6.traverseUnknown(t)):t}function H1(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[H1(t.default),...(Array.isArray(t.item)?t.item:[t.item]).map(H1)];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$__",j1="__$UNWRAP$__",Et=[];Object.freeze(Et),Object.freeze(zu);function z2(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"||(z2(e[a])?n[a]=t[a]:n[a]=e[a]);return n}return t}function q1(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 q1(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 N2={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},I2={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},D2={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},L2={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"},B2={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"},P2={id:"https://iiif-parser/empty-agent",type:"Agent",label:{},logo:Et,seeAlso:Et,homepage:Et},H2={id:"https://iiif-parser/empty-service",type:"UnknownService"};function vm(t){let[e,n]=(t||"").split("#");return!n||!d6(n)?[t||"",""]:[e,n]}function d6(t){return t.includes("xywh=")||t.includes("t=")}function Sm(t,e={}){if(Array.isArray(t))return Sm(t[0]);if(typeof t=="string"){let[n,i]=vm(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 Sm(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]=vm(n);if(i){let a=Sm(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]=vm(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 U2(){return{Collection:{},Manifest:{},Canvas:{},AnnotationPage:{},AnnotationCollection:{},Annotation:{},ContentResource:{},Range:{},Service:{},Selector:{},Agent:{}}}function V2(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 h6(t,e){return(n,i)=>{let a=t[n]?t[n]:{};return(o,s)=>{let u=V2(o,i||n);return u&&u.id&&n?(a[u.id]=a[u.id]?Em(a[u.id],u,{parent:s.parent,isTopLevel:e.id===u.id}):Em({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 xm(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]=xm(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]=xm(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 Em(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 xm({...t},e,n)}function p6(t){return(e,n)=>i=>{let{id:a,type:o}=V2(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 m6(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({},H2,e)}function g6(t){return e=>{t.Service=t.Service?t.Service:{};let n=e.id||e["@id"],i=m6(e);return i&&i.id&&(t.Service[i.id]?t.Service[n]=Em(t.Service[n],i):t.Service[n]=i),e}}function y6(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 V1(t){return e=>typeof e=="string"?{id:e,type:t}:e.id?e.type?e:{type:t,...e}:{id:`vault://${y6(e)}`,type:t,...e}}function _u(t){return e=>({...t,...e})}function Xf(t){return Array.isArray(t)?t:[t]}function v6(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 j2(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]=vm(t.id);return t.id=a,o&&o&&(i={type:"FragmentSelector",value:o}),{type:"SpecificResource",source:t,selector:i}}function S6(t){let e=Object.assign({},t);return t&&t.items&&(e.items=t.items.map(n=>typeof n=="string"||n.type==="Canvas"?j2(n):n)),e}function b6(t){let e=Object.assign({},t);return e.start?(e.start=j2(e.start,{typeHint:"Canvas"}),e):t}function x6(t){let e=Object.assign({},t);return e.target?(e.target=Sm(e.target,{typeHint:"Canvas"}),e):t}function q2(t){return t}function bm(t){return t.items===void 0&&(t[Nu]=!0),t}function F1(t){let e=M2(t),n=U2(),i={},a=h6(n,e),o=p6(i),s=new n1({collection:[bm,_u(D2),o("Collection"),a("Collection")],manifest:[bm,_u(L2),b6,o("Manifest"),a("Manifest")],canvas:[_u(I2),o("Canvas"),a("Canvas")],annotationPage:[bm,V1("AnnotationPage"),_u(N2),o("AnnotationPage"),a("AnnotationPage")],annotation:[V1("Annotation"),v6,x6,o("Annotation"),a("Annotation")],contentResource:[V1("ContentResource"),o("ContentResource"),a("ContentResource")],range:[_u(B2),S6,o("Range","Canvas"),a("Range","Canvas")],agent:[_u(P2),o("Agent"),a("Agent")],specificResource:[q2],service:[g6(n)]}),u=s.traverseUnknown(e);return{entities:n,resource:u,mapping:i}}function F2(t){let e={};for(let[n,i]of t){if(n===j1&&i!==ga)return i;i!==ga&&i!=null&&(e[n]=i)}return e}function G1(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]=q1(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:F2(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 G2(t){return Array.isArray(t)?t.map(e=>G2(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 E6(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(E6))],["rendering",Hr(yield t.rendering)],["startCanvas",e?e.id:void 0]]}function A6(t){return t.type==="SpecificResource"}function R6(t){return t&&t.type==="FragmentSelector"}function T6(t){if(t&&A6(t)){let e=t.id,n=t.selector?Array.isArray(t.selector)?t.selector[0]:t.selector:void 0;return R6(n)&&(e+="#"+n.value),e}return t?.id}var k1={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",G2(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":T6(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 k2(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 O2(t){if(Array.isArray(t)||(t=t?[t]:[]),!(!t||t.length===0))return t.map(k2)}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(O2(t.service))],["services",dn(O2(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 Y1={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||_2(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[[j1,k2(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 C6([...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||_2(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 C6(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 _2(t){if(!t.items||!Array.isArray(t.items))return!1;for(let e of t.items)if(e.navPlace)return!0;return!1}function Y2(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}})}},Am="@iiif/IMPORT_ENTITIES",Rm="@iiif/MODIFY_ENTITY_FIELD",Tm="@iiif/REORDER_ENTITY_FIELD",Cm="@iiif/MOVE_ENTITY",Zf="@iiif/MOVE_ENTITIES",wm="@iiif/ADD_REFERENCE",Wf="@iiif/UPDATE_REFERENCE",Mm="@iiif/CHANGE_REFERENCE_IDENTIFIER",Om="@iiif/REMOVE_REFERENCE",_m="@iiif/ADD_METADATA",zm="@iiif/REMOVE_METADATA",Jf="@iiif/UPDATE_METADATA",Nm="@iiif/REORDER_METADATA",Im=we(Am)(),Q2=we(Rm)(),X2=we(Tm)(),K2=we(Cm)(),Z2=we(Zf)(),W2=we(wm)(),J2=we(Om)(),$2=we(Wf)(),tM=we(Mm)(),eM=we(_m)(),nM=we(Jf)(),iM=we(zm)(),aM=we(Nm)(),os={importEntities:Im,modifyEntityField:Q2,reorderEntityField:X2,addReference:W2,removeReference:J2,updateReference:$2,changeReferenceIdentifier:tM,addMetadata:eM,removeMetadata:iM,updateMetadata:nM,reorderMetadata:aM,moveEntity:K2,moveEntities:Z2},Dm="@iiif/ADD_MAPPING",Lm="@iiif/ADD_MAPPINGS",Q1=we(Dm)(),X1=we(Lm)();var Bu="RESOURCE_ERROR",$f="RESOURCE_LOADING",Pu="RESOURCE_READY",Bm="@iiif/REQUEST_RESOURCE",Pm="@iiif/REQUEST_ERROR",Hm="@iiif/REQUEST_MISMATCH",Um="@iiif/REQUEST_COMPLETE",Vm="@iiif/REQUEST_OFFLINE_RESOURCE",K1=we(Bm)(),td=we(Pm)(),Z1=we(Hm)(),W1=we(Um)(),w6=we(Vm)();var Hu="@iiif/BATCH",jm="@iiif/BATCH_IMPORT",Uu=we(Hu)(),M6=we(jm)();var J1="@iiif/SET_META_VALUE",$1="@iiif/SET_META_VALUE_DYNAMIC",tb="@iiif/UNSET_META_VALUE",eb={setMetaValue:we(J1)(),setMetaValueDynamic:we($1)(),unsetMetaValue:we(tb)()};var O6=(t,e)=>{let{entities:n,resource:i,mapping:a}=F1(e);if(i.id===void 0)return[td({id:t,message:"ID is not defined in resource."})];let o=[Im({entities:n}),X1({mapping:a})];return i.id!==t&&(o.push(Q1({id:t,type:i.type})),o.push(Z1({requestId:t,actualId:i.id}))),o.push(W1({id:t})),o},oM=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function _6(t,e){return!!(t===e||oM(t)&&oM(e))}function ib(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(!_6(t[n],e[n]))return!1;return!0}function nb(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 z6(t){return t&&typeof t.then=="function"}function ab(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=nb(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=nb(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(K1({id:i}));let p=f=>{if(!f)return;!f.id&&!f["@id"]&&(f["@type"]&&(f["@id"]=i),f.id=i);let m=O6(i,f);return t.dispatch(Uu({actions:m})),nb(s.getState(),i)};try{let f=e(i,a);return z6(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 ob(){return{Collection:{},Manifest:{},Canvas:{},AnnotationPage:{},AnnotationCollection:{},Annotation:{},ContentResource:{},Range:{},Service:{},Selector:{},Agent:{}}}var Vu={},N6=(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}),lb=new Map,qm=t=>{let e=lb.get(t);return e?Object.fromEntries(Object.entries(e.stores).map(([n,i])=>[n,i.getState()])):{}},I6=(t,e,n)=>{if(t===void 0)return{type:"untracked",connection:e.connect(n)};let i=lb.get(n.name);if(i)return{type:"tracked",store:t,...i};let a={connection:e.connect(n),stores:{}};return lb.set(n.name,a),{type:"tracked",store:t,...a}},D6=(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}=I6(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}`},{...qm(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 rb(E.payload,T=>{if(T.type==="__setState"){if(u===void 0){v(T.state);return}Object.keys(T.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 x=R.state[u];if(x==null)return;JSON.stringify(a.getState())!==JSON.stringify(x)&&v(x);return}a.dispatchFromDevtools&&typeof a.dispatch=="function"&&a.dispatch(R)});case"DISPATCH":switch(E.payload.type){case"RESET":return v(S),u===void 0?f?.init(a.getState()):f?.init(Lm(d.name));case"COMMIT":if(u===void 0){f?.init(a.getState());return}return f?.init(Lm(d.name));case"ROLLBACK":return K1(E.state,R=>{if(u===void 0){v(R),f?.init(a.getState());return}v(R[u]),f?.init(Lm(d.name))});case"JUMP_TO_STATE":case"JUMP_TO_ACTION":return K1(E.state,R=>{if(u===void 0){v(R);return}JSON.stringify(a.getState())!==JSON.stringify(R[u])&&v(R[u])});case"IMPORT_STATE":{let{nextLiftedState:R}=E.payload,x=(C=R.computedStates.slice(-1)[0])?.state;if(!x)return;v(u===void 0?x:x[u]),f?.send(null,R);return}case"PAUSE_RECORDING":return g=!g}return}}),S},x6=b6,K1=(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)},E6=t=>(e,n,i)=>{let a=i.subscribe;return i.subscribe=(s,u,d)=>{let p=s;if(u){let f=d?.equalityFn||Object.is,m=s(i.getState());p=g=>{let v=s(g);if(!f(m,v)){let S=m;u(m=v,S)}},d?.fireImmediately&&u(m,m)}return a(p)},t(e,n,i)},R6=E6,A6=(t={},e)=>{switch(e.type){case wm:return{...t,[e.payload.id]:e.payload.type};case Mm:return{...t,...e.payload.mapping};default:return t}};function Jf(t,e,n,i){return!(!t[n]||!t[n][e]||!t[n][e][i]||!Array.isArray(t[n][e][i]))}function T6(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 C6(t,e,n){if(!t[e]||!Array.isArray(t[e]))return null;let i=n.index===void 0?t[e].findIndex(a=>a?_u(a)?.id===n.id:!1):n.index;return i===-1?null:{entity:t[e][i],index:i}}function Y2(t,e){if(!(!e?.id||!e?.type))return t[e.type]?.[e.id]}function Pm(t,e){return t===void 0?e:t}var Q2=(t=X1(),e)=>{let n=(i,a)=>({...t,[At(e).type]:{...t[At(e).type],[At(e).id]:{...i,...a}}});switch(e.type){case ym:{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 vm:{if(!Jf(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 Yf:{let i=At(e).subjects,a=At(e).from,o=At(e).to||a,s=Y2(t,a),u=o?.key||a.key;if(!Jf(t,a.id,a.type,a.key)||!Jf(t,o.id,o.type,o.key))return t;let d=[],p=[];if(i.type==="slice"){let R=i.startIndex,x=i.length;d=Array.from(s[a.key]),p=d.splice(R,x)}else{let R=Array.from(s[a.key]);for(let x of i.items){let A=C6(s,a.key,x);A&&(p.push(A.entity),R[A.index]=null),d=R.filter(T=>T!==null)}}let f={...s,[a.key]:d},m={...t,[a.type]:{...t[a.type],[a.id]:f}},g=Y2(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 Sm:return Q2(t,{type:Yf,payload:{subjects:{type:"list",items:[At(e).subject]},from:At(e).from,to:At(e).to}});case xm:{let{id:i,index:a,key:o,newIdentifier:s,reference:u,type:d}=At(e),p=t[d][i],f=_u(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=N2(g,s),E=Array.from(m);E.splice(Pm(a,E.length+1),1,S);let C=n(p,{[o]:E}),R={...v,id:s};R["iiif-parser:hasPart"]&&(R["iiif-parser:hasPart"]=R["iiif-parser:hasPart"].filter(A=>A["iiif-parser:partOf"]===i).map(A=>({...A,id:s})));let x={...C[f.type],[s]:R};return C[f.type]=x,C}case gm:{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]?T6(t[o][f],s[f]):s[f];d&&(a[o]=u)}}return a}case bm:{if(!Jf(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(Pm(At(e).index,a.length+1),0,At(e).reference),n(i,{[At(e).key]:a})}case Qf:case Em:{if(!Jf(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=Pm(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===Qf?a.splice(o,1,At(e).reference):a.splice(o,1),n(i,{[At(e).key]:a}))}case Rm:{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(Pm(e.payload.beforeIndex,a.length+1),0,{label:o.label,value:o.label}),n(i,{metadata:a})}case Tm:{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 Xf:case Am:{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===Xf?a.splice(o,1,{label:At(e).label,value:At(e).value}):a.splice(o,1),n(i,{metadata:a}))}default:return t}},w6=(t={},e)=>{switch(e.type){case Om:case Im:return{...t,[e.payload.id]:{requestUri:e.payload.id,loadingState:Kf,uriMismatch:!1,resourceUri:e.payload.id}};case zm: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 _m:return{...t,[e.payload.id]:{...t[e.payload.id]||{},loadingState:Nu,error:e.payload.message}};case Nm:return{...t,[e.payload.id]:{...t[e.payload.id]||{},loadingState:Iu,error:void 0}}}return t},M6=(t={},e)=>{let{id:n,updateValue:i,value:a,meta:o,key:s}=e&&e.payload||{};switch(e.type){case j1:return{...t,[n]:{...t[n]||{},[o]:{...t[n]&&t[n][o]||{},[s]:a}}};case q1: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 F1: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 X2(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 O6(t){return(e,n)=>n&&n.type===Du?n.payload.actions.reduce(t,e):n&&n.type===Dm?{...e,iiif:{...e.iiif,...n.payload.state}}:t(e,n)}var _6=X2({mapping:A6,entities:Q2,requests:w6,meta:M6});function z6(){return{iiif:{entities:X1(),meta:{},mapping:{},requests:{}}}}function K2(t={}){let{enableDevtools:e=!1,iiifStoreName:n="iiif",defaultState:i=z6(),customReducers:a={}}=t,o=O6(X2({[n]:_6,...a})),s=!!(typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__);return sm(R6((s?x6:(d,p)=>d)(v6(o,i),{enabled:e})))}function fi(t,e,n,i=!0){e[Bu]=e[Bu]||[],e[Bu].push(t);let a=new Map;Object.defineProperty(e,t,{enumerable:i,get(){if(e[as][t]===void 0)return;let o=e[as][t];if(!o)return o;let s=n.get(e[as][t],{parent:this.id?{id:this.id,type:this.type}:void 0});return a.has(s)||(a.clear(),a.set(s,os(s,n))),a.get(s)},set(o){e[as][t]!==o&&(this[is]?n.modifyEntityField({id:this.id,type:this.type},t,W2(o)):this[as][t]=o)}})}var as=Symbol.for("_refs_"),is=Symbol.for("_reactive_"),Bu=Symbol.for("_defined_"),Z2=Symbol.for("_parent_");function N6(t,e=!1,n){let i={id:"",type:"unknown",[Bu]:[],[as]:{},[Z2]:n||null,[is]:null,is(a){return typeof a=="string"?this.id===a:a.id?a.id===this.id:!1},reactive(){if(!this[is])return this[is]=this.subscribe(()=>this.refresh(),!0),()=>{this.unreactive()}},refresh(){if(this.id){let a=this.unwrap();for(let o of Object.keys(a||{}))this[Bu].includes(o)?this[as][o]=a[o]:this[o]=a[o]}},unreactive(){this[is]&&(this[is](),this[is]=null)},unwrap(){if(!this.id)throw Error("Invalid object");let a=this[Z2];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 I6(t){return!!t[Bu]}function W2(t){return Array.isArray(t)?t.map(e=>W2(e)):!t||!t.type?t:{id:t.id,type:t.type}}function os(t,e,n=!1,i){if(Array.isArray(t))return t.map(u=>os(u,e,n));if(!t||!t.type||!t.id)return t;let a=N6(e,n),o=Object.create(a),s=Object.assign(o,t);return n&&s.reactive(),s}function J2(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 Hu=class{constructor(t,e){An(this,"options",void 0),An(this,"store",void 0),An(this,"emitter",void 0),An(this,"isBatching",!1),An(this,"batchQueue",[]),An(this,"remoteFetcher",void 0),An(this,"staticFetcher",void 0),An(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||K2({customReducers:this.options.reducers,defaultState:this.options.defaultState,enableDevtools:this.options.enableDevtools}),this.emitter=um(),this.remoteFetcher=Q1(this,this.options.customFetcher),this.staticFetcher=Q1(this,(n,i)=>i)}batch(t){this.isBatching=!0;try{t(this),this.isBatching=!1,this.dispatch(Lu({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(Lu({actions:this.batchQueue}))}catch(e){throw this.batchQueue=[],this.isBatching=!1,e}this.batchQueue=[]}modifyEntityField(t,e,n){this.dispatch(ns.modifyEntityField({id:t.id,type:t.type,key:e,value:n}))}dispatch(t){if(this.isBatching)this.batchQueue.push(t);else{if(t.type===Du){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 I1(this.getState().iiif,t,e)}toPresentation2(t){return this.serialize(t,D1)}toPresentation3(t){return this.serialize(t,L1)}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=J2(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=J2(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];if(p&&p[Ke]){let f=p[Ke].find(m=>a?m[ki]===a:m[ki]===p.id);return zu(p,f)}return 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 Y1(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:Y1,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 os(this.get(t,e,a),this,i)}async loadObject(t,e){return os(await this.load(t,e),this)}async loadManifestObject(t,e){return os(await this.loadManifest(t,e),this)}async loadCollectionObject(t,e){return os(await this.loadCollection(t,e),this)}wrapObject(t){return os(this.get(t,{skipSelfReturn:!1}),this)}isWrapped(t){return I6(t)}setMetaValue([t,e,n],i){this.dispatch(typeof i=="function"?G1.setMetaValueDynamic({id:t,meta:e,key:n,updateValue:i}):G1.setMetaValue({id:t,meta:e,key:n,value:i}))}};function $2(){return typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}function Wf(t){let e=$2();try{let i=e.IIIF_VAULT;if(i)return i}catch{}let n=new Hu(t);try{e.IIIF_VAULT=n}catch{}return n}var J1=_(Y(),1),Br=Bm.default.createContext({vault:null,setVaultInstance:t=>{}});function Io({vault:t,vaultOptions:e,useGlobal:n,resources:i,children:a}){let[o,s]=(0,Bm.useState)(()=>t||(n?Wf(e):e?new Hu(e):new Hu));return(0,J1.jsx)(Br.Provider,{value:{vault:o,setVaultInstance:s},children:(0,J1.jsx)(ci,{value:i||{},children:a})})}var eM=_(nt(),1),nM=_(nt(),1);var tM=_(nt(),1),Vt=()=>{let{vault:t}=(0,tM.useContext)(Br);if(t===null)throw new Error("Vault not found. Ensure you have your provider set up correctly.");return t};var Hm=_(nt(),1);function re(t,e=[]){let n=Vt(),[i,a]=(0,Hm.useState)(()=>t(n.getState(),n));return(0,Hm.useEffect)(()=>n.subscribe(o=>t(o,n),o=>{a(o)},!1),e),i}var rs=nM.default.createContext([]);function ls(){let t=(0,eM.useContext)(rs);return re(e=>t.map(n=>e.iiif.entities.Canvas[n]).filter(Boolean),[t])}var iM=_(nt(),1);function Do(t){let e=(0,iM.useContext)(Br);return t||(e&&e.vault?e.vault:Wf())}var aM=_(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,aM.useMemo)(()=>{if(u)return i?i(u):u},[u,i,...e])}var zM=_(nt(),1),Ym=_(nt(),1);var Hr=_(nt(),1);function $f(t,{noCache:e=!1}={}){let n=typeof t=="string"?t:t.id,i=Do(),[a,o]=(0,Hr.useState)(n),[s,u]=(0,Hr.useState)(void 0),d=(0,Hr.useMemo)(()=>i.get(n,{skipSelfReturn:!0})||void 0,[n,i]),[p,f]=(0,Hr.useState)(d);return(0,Hr.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 W1(t,e){let{id:n,isLoaded:i,error:a,resource:o,requestId:s,cached:u}=$f(t,e);return{id:n,isLoaded:i,error:a,manifest:o,requestId:s,cached:u}}var oM=_(Y(),1);function $1({manifest:t,children:e}){return(0,oM.jsx)(ci,{value:{manifest:t},children:e})}var rM=_(Y(),1);function tb({range:t,children:e}){return(0,rM.jsx)(ci,{value:{range:t},children:e})}function lM(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=lM(t,t.get(n));if(i)return i}}return null}function Um(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(...Um(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 D6(t,e,n){for(let i of e.structures){let a=eb(t,t.get(i),n);if(a)return a}return null}function eb(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=eb(t,t.get(i),n);if(o)return o}}return null}function L6(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]=Vm(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(C=>g[C]);return[{id:o.id,type:"Canvas"}]}function Vm(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:Um(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 sM=_(nt(),1);function td(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,sM.useMemo)(()=>{if(s)return i?i(s):s},[s,i,...e])}function nb({startCanvas:t,disablePaging:e}){let n=Vt(),i=on(),a=td(),[o,s]=(0,Ha.useState)(void 0),u=a||i;if(!u)throw new Error("Nothing selected");let[d,p]=(0,Ha.useMemo)(()=>Vm(n,u,{disablePaging:e}),[n,u,e]),f=(0,Ha.useRef)(p);if(f.current!==p){let C=f.current[o][0],R=p.findIndex(x=>x.includes(C));f.current=p,s(R)}let m=(0,Ha.useCallback)(E=>{let C=p.findIndex(R=>R.includes(E));s(C===-1?0:C)},[d,p]),g=(0,Ha.useCallback)(E=>{let C=d.findIndex(R=>R.id===E);C!==-1?m(C):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 cM={},uM=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:()=>{(cM.env?cM.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?uM(t):uM;var xM=_(nt(),1),EM=_(vM(),1),qm={},{useDebugValue:$6}=xM.default,{useSyncExternalStoreWithSelector:tH}=EM.default,SM=!1,eH=t=>t;function bt(t,e=eH,n){(qm.env?qm.env.MODE:void 0)!=="production"&&n&&!SM&&(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"),SM=!0);let i=tH(t.subscribe,t.getState,t.getServerState||t.getInitialState,e,n);return $6(i),i}var bM=t=>{(qm.env?qm.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},Fm=t=>t?bM(t):bM;function nH(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 ob=()=>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}))})),ab(n.service).then(()=>{Gm(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=${RM()}`,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");Gm(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}))})),ab(o).then(()=>{Gm(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}))}})),rb=(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 lb(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 Gm(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 RM(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 ab(t){let e=`${t.id}?origin=${RM()}`,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 Vu=_(nt(),1);function AM(t){let e=(0,Vu.useMemo)(()=>lb(t),[t]),n=sb(e.services.access?.id),i=(0,Vu.useMemo)(()=>rb(e.services.probe,n),[e.services.probe]),a=bt(i);return(0,Vu.useEffect)(()=>{a.status==="unknown"&&!n&&a.probe()},[e.services.probe,a.status]),(0,Vu.useEffect)(()=>{n&&(a.setToken(n),a.probe())},[n]),[t,a,e.hasAuth]}var ed=_(Y(),1),ss=(0,Va.createContext)(null),TM=(0,Va.createContext)(null);TM.displayName="CurrentAuth";var CM=(0,Va.createContext)(null);CM.displayName="AuthActions";function cb({children:t}){let e=(0,Va.useMemo)(()=>ob(),[]);return(0,ed.jsx)(ss.Provider,{value:e,children:t})}function fb(){return!!(0,Va.useContext)(ss)}function ju(){let t=(0,Va.useContext)(ss);if(!t)throw new Error("useAuthActions must be used within a AuthProvider");return t}function wM(){let t=ju();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 iH(){let t=ju();return bt(t,e=>e)}function MM(t){let e=ju();return bt(e,i=>i.authItems.find(a=>a.service.id===t))}function sb(t){let e=ju();return bt(e,i=>i.authItems.find(a=>a.id===t)?.session?.token)}function aH(t){let e=ju();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 oH(t){let e=wM(),n=MM(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 ub(){return null}function db(t){let[e,n,i]=AM(t.resource),a=t.fallbackComponent||ub,o=t.loadingComponent||ub,s=t.errorComponent||ub,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,ed.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,ed.jsx)(o,{})),n.status==="success"&&(d=t.children(e));for(let f of p)d=(0,ed.jsx)(oH,{service:f,probeId:u.id,children:d},f.id);return d}var nd=_(nt(),1);var rH=t=>t.id||t["@id"];function lH(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 OM=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?rH(e):void 0,i=null;return Yi((a,o)=>({service:e,resources:[],lastQuery:{},loading:!1,error:!1,highlight:null,hasSearch:!!e,hasAutocomplete:e?!!lH(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 hb(){let t=on();return t?t.service.find(e=>e.profile==="SearchService1"||e.profile==="http://iiif.io/api/search/1/search"):void 0}var km=_(Y(),1),qu=(0,nd.createContext)(null);qu.displayName="Search";function _M(t){let e=hb();return t.store?(0,km.jsx)(qu.Provider,{value:t.store,children:t.children}):(0,km.jsx)(sH,{service:e,children:t.children})}function sH({service:t,children:e}){let n=(0,nd.useMemo)(()=>OM(t),[t]);return(0,km.jsx)(qu.Provider,{value:n,children:e})}var Ei=_(Y(),1),id=()=>{},Fu=(0,Ym.createContext)({setCurrentCanvasId:id,setCurrentCanvasIndex:id,nextCanvas:id,previousCanvas:id,items:[],sequence:[],setSequenceIndex:id,currentSequenceIndex:0,hasNext:!1,hasPrevious:!1});function NM(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}=nb({startCanvas:t.startCanvas,disablePaging:t.pagingEnabled===!1}),v=(0,Ym.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)(Fu.Provider,{value:v,children:(0,Ei.jsx)(rs.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 pb(t){let e=Do(t.vault),n=W1(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)(NM,{...t,children:t.children});return(0,Ei.jsx)(Io,{vault:e,children:(0,Ei.jsx)($1,{manifest:n.id,children:(0,Ei.jsx)(cb,{children:(0,Ei.jsx)(_M,{children:t.rangeId?(0,Ei.jsx)(tb,{range:t.rangeId,children:i}):i})})})})}function us(){return(0,zM.useContext)(Fu)}var Gu=(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 IM=(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)},DM=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 Xy=_(nt(),1),st=_(nt(),1),Ce=_(Y(),1);var Qi=_(nt(),1);function LM(t,e){let n;return(...i)=>{window.clearTimeout(n),n=window.setTimeout(()=>t(...i),e)}}function mb({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 R=()=>{if(!u.current.element)return;let{left:x,top:A,width:T,height:M,bottom:z,right:D,x:I,y:q}=u.current.element.getBoundingClientRect(),B={left:x,top:A,width:T,height:M,bottom:z,right:D,x:I,y:q};u.current.element instanceof HTMLElement&&i&&(B.height=u.current.element.offsetHeight,B.width=u.current.element.offsetWidth),Object.freeze(B),f.current&&!dH(u.current.lastBounds,B)&&s(u.current.lastBounds=B)};return[R,p?LM(R,p):R,d?LM(R,d):R]},[s,i,d,p]);function S(){u.current.scrollContainers&&(u.current.scrollContainers.forEach(R=>R.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(R=>R.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 C=R=>{!R||R===u.current.element||(S(),u.current.element=R,u.current.scrollContainers=PM(R),E())};return cH(v,!!e),uH(g),(0,Qi.useEffect)(()=>{S(),E()},[e,v,g]),(0,Qi.useEffect)(()=>S,[]),[C,o,m]}function uH(t){(0,Qi.useEffect)(()=>{let e=t;return window.addEventListener("resize",e),()=>void window.removeEventListener("resize",e)},[t])}function cH(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 PM(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,...PM(t.parentElement)]}var fH=["x","y","top","bottom","left","right","width","height"],dH=(t,e)=>fH.every(n=>t[n]===e[n]);var oR=_(ZM(),1);var pH=Object.defineProperty,mH=(t,e,n)=>e in t?pH(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Zm=(t,e,n)=>(mH(t,typeof e!="symbol"?e+"":e,n),n);function cs(t){return t.endsWith("info.json")?t:t.endsWith("/")?`${t}info.json`:`${t}/info.json`}var gH="http://library.stanford.edu/iiif/image-api/compliance.html#level0",tO="http://library.stanford.edu/iiif/image-api/compliance.html#level1",eO="http://library.stanford.edu/iiif/image-api/compliance.html#level2",yH="http://library.stanford.edu/iiif/image-api/conformance.html#level0",nO="http://library.stanford.edu/iiif/image-api/conformance.html#level1",iO="http://library.stanford.edu/iiif/image-api/conformance.html#level2",vH="http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level0",aO="http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level1",oO="http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level2",SH="http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level0",rO="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",bH="http://iiif.io/api/image/1/level0.json",xH="http://iiif.io/api/image/1/profiles/level0.json",sO="http://iiif.io/api/image/1/level1.json",uO="http://iiif.io/api/image/1/profiles/level1.json",cO="http://iiif.io/api/image/1/level2.json",fO="http://iiif.io/api/image/1/profiles/level2.json",EH="http://iiif.io/api/image/2/level0.json",RH="http://iiif.io/api/image/2/profiles/level0.json",dO="http://iiif.io/api/image/2/level1.json",hO="http://iiif.io/api/image/2/profiles/level1.json",pO="http://iiif.io/api/image/2/level2.json",mO="http://iiif.io/api/image/2/profiles/level2.json",AH="level0",gO="level1",yO="level2",TH="http://iiif.io/api/image/2/level0",vO="http://iiif.io/api/image/2/level1",SO="http://iiif.io/api/image/2/level2",CH="https://iiif.io/api/image/1.1/compliance/#level0",bO="https://iiif.io/api/image/1.1/compliance/#level1",xO="https://iiif.io/api/image/1.1/compliance/#level2",EO=[SO,eO,iO,oO,lO,cO,fO,pO,mO,yO,xO],RO=[...EO,vO,tO,nO,aO,rO,sO,uO,dO,hO,gO,bO],wH=[TH,vO,SO,gH,tO,eO,yH,nO,iO,vH,aO,oO,SH,rO,lO,bH,xH,sO,uO,cO,fO,EH,RH,dO,hO,pO,mO,AH,gO,yO,CH,bO,xO];var MH={extraFormats:["jpg"],extraQualities:["default"],extraFeatures:["sizeByWhListed"]},OH={extraFormats:["jpg"],extraQualities:["default"],extraFeatures:["baseUriRedirect","cors","jsonldMediaType","regionByPx","regionSquare","sizeByWhListed","sizeByH","sizeByW","sizeByWh"]},_H={extraFormats:["jpg","png"],extraQualities:["default"],extraFeatures:["baseUriRedirect","cors","jsonldMediaType","regionByPct","regionByPx","regionSquare","rotationBy90s","sizeByWhListed","sizeByConfinedWh","sizeByH","sizeByPct","sizeByW","sizeByWh"]};function zH(t){return EO.indexOf(t)!==-1?_H:RO.indexOf(t)!==-1?OH:MH}function NH(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=zH(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 IH(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 DH(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 LH(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 PH(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 BH(t,e=""){let{path:n,scheme:i,server:a,prefix:o}=PH(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:IH(f),size:DH(p),rotation:LH(d),quality:v[0],format:v[1]}}function HH(t){let e=BH(cs(t.id));if(e.type!=="info")throw new Error("Invalid service URL");let n=NH(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 UH(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 VH(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 Wm(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"&&wH.indexOf(n)!==-1)return!0;return!1}function jH(t){if(!Wm(t))return!1;let e=Array.isArray(t.profile)?t.profile:[t.profile];for(let n of e)if(typeof n=="string"){if(RO.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 Jm(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 Cb(t){return Wm(t)?Jm(0,t)?0:Jm(1,t)?1:Jm(2,t)?2:null:null}function AO(t){return(t["@context"]?Array.isArray(t["@context"])?t["@context"]:[t["@context"]]:[]).indexOf("http://iiif.io/api/image/3/context.json")!==-1}function qH(t){if(!jH(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:Cb(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:Cb(t),version:AO(t)?3:2})}}return e}function JM(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 FH(t){if(t["@type"])return t["@type"];if(t.type)return t.type}function GH(t){if(typeof t=="string")return JM(t);let e=FH(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}:JM(i):null}function kH(t){return Wm(t)?(t&&t.sizes?t.sizes:[]).map(e=>({id:Ze(t),type:"fixed-service",height:e.height,width:e.width,level:Cb(t),version:AO(t)?3:2})):[]}function WM(t){let e=[],n=t.length;for(let i=0;i<n;i++){let a=t[i];if(!a)continue;let o=kH(a);o.length&&e.push(...o);let s=qH(a);s.length&&e.push(...s)}return e}function TO(t){let e=t.service?Array.isArray(t.service)?t.service:[t.service]:[],n=e.length,i=[];for(let a=0;a<n;a++)Wm(e[a])&&i.push(e[a]);return i}function YH(t,e=!0,n){let i=[],a=GH(t);if(a===null)return i;let o=t;if(i.push(a),e&&o&&o.width&&o.height){let s=[],u=TO(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(...WM([f])))}}if(s.length)return i.push(...s),i}return o.service&&i.push(...WM(o.service)),i}function QH({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 XH({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 KH(t){return`${t.mirror?"!":""}${(t.angle||0)%360}`}function ZH(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,QH(o),XH(a),KH(s),`${d}.${u}`].filter(Boolean).join("/")}function Tb(t,e,n){let i=HH({"@context":t.version===3?"http://iiif.io/api/image/3/context.json":"http://iiif.io/api/image/2/context.json",id:cs(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:ZH(i),type:"fixed",width:e,height:n||t.height/(t.width||1)*e,unsafe:t.width>e}}function Xu(t){let e=t.replace(/(https?:\/\/)?(www.)?/i,"");return e.indexOf("/")!==-1?e.split("/")[0]:e}function JH(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 WH(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),JH(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=Tb(S,i.width,i.height);d(E,u)}else{a(()=>"Checking for an image from the tile source 3",2);let E=Tb(S,S.width,S.height);d(E,u)}if(S.type==="variable"&&S.maxWidth){let E=Tb({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 $H(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 tU(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 $M(t){return Jm(0,t)}var CO=class{constructor(t={}){Zm(this,"config",{verificationsRequired:1,approximateServices:!1,enableFetching:!0,disableThrottling:!1}),Zm(this,"fetchingCount",0),Zm(this,"imageServices",{}),Zm(this,"knownImageServers",{}),this.config=Object.assign(this.config,t)}setConfig(t){Object.assign(this.config,t)}sample(t,e,n=!0){let i=Xu(Ze(t)),a=cs(Ze(t)),o=this.knownImageServers[i];return this.imageServices[a]=Object.assign(t,{real:!0}),!o&&t.tiles&&!$M(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:UH(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=Xu(Ze(t)),o=this.knownImageServers[a],s=cs(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)||$M(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||$H(t.width,t.height,o.result.sampledTiles),sizes:i?.sizes||VH(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 WH(e,[()=>i,()=>a])}async getImageCandidates(t,e=!0){let n=t;if(e&&n&&n.height&&n.width){let i=TO(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 YH(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"]&&tU(e.sizes||[],n.sizes||[]);if(i){let a=Xu(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=cs(e);if(this.imageServices[n])return!0;let i=this.knownImageServers[Xu(e)];return!!(i&&!i.malformed&&i.verifications>=this.config.verificationsRequired)}async markAsMalformed(t){return this.knownImageServers[Xu(Ze(t))].malformed=!0,this.loadService(t,!0)}async fetchService(t,e=!1){let n=cs(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[Xu(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=cs(Ze(t));return this.imageServices[e]?this.imageServices[e]:this.config.approximateServices?this.predict(t):null}},jk=new CO;var $m={},Bo={get(t){return t},setMetaValue([t,e,n],i){let a=Bo.getResourceMeta(t,e),o=a?a[n]:void 0,s=typeof i=="function"?i(o):i;$m[t]={...$m[t]||{},[e]:{...($m[t]||{})[e]||{},[n]:s}}},getResourceMeta:(t,e)=>{let n=$m[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 eU(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 nU(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 iU(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 aU(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 oU(t,e=""){let{path:n,scheme:i,server:a,prefix:o}=aU(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:eU(f),size:nU(p),rotation:iU(d),quality:v,format:S}}function rU(t){return Tu.indexOf(t)!==-1?o2:fm.indexOf(t)!==-1?a2:i2}function lU(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=rU(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 wb(t){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 Ae(t){if(t["@id"])return t["@id"];if(t.id)return t.id}function sd(t){if(!t||!t.profile||!Ae(t))return!1;let e=Array.isArray(t.profile)?t.profile:[t.profile];for(let n of e)if(typeof n=="string"&&E1.indexOf(n)!==-1)return!0;return!1}function wO(t){if(!sd(t))return!1;let e=Array.isArray(t.profile)?t.profile:[t.profile];for(let n of e)if(typeof n=="string"){if(fm.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 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(n===void 0||i===void 0)throw 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 tg(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,sU(o),uU(a),cU(s),`${d}.${u}`].filter(Boolean).join("/")}function Vr(t){return t.endsWith("info.json")?t:t.endsWith("/")?`${t}info.json`:`${t}/info.json`}function eg(t){let e=oU(Vr(t.id));if(e.type!=="info")throw Error("Invalid service URL");let n=lU(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 MO(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 OO(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 Ku(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(Tu.includes(a))return!0}if(t===1){for(let a of i)if(fm.includes(a))return!0}if(t===0){for(let a of i)if(A1.includes(a))return!0}}}return!1}function ng(t){return sd(t)?Ku(2,t)?2:Ku(1,t)?1:Ku(0,t)?0:null:null}function jr(t){let e=t.service?Array.isArray(t.service)?t.service:[t.service]:[],n=e.length,i=[];for(let a=0;a<n;a++)sd(e[a])&&i.push(e[a]);return i}function _O(t){if(t["@type"])return t["@type"];if(t.type)return t.type}function fs(t){let e=t.replace(/(https?:\/\/)?(www.)?/i,"");return e.indexOf("/")===-1?e:e.split("/")[0]}function zO(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 ig(t,e,n){let i=eg({"@context":t.version===3?"http://iiif.io/api/image/3/context.json":"http://iiif.io/api/image/2/context.json",id:Vr(Ae(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:tg(i),type:"fixed",width:e,height:n||t.height/(t.width||1)*e,unsafe:t.width>e}}function NO(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 IO(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),NO(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=ig(S,i.width,i.height);d(E,u)}else{a(()=>"Checking for an image from the tile source 3",2);let E=ig(S,S.width,S.height);d(E,u)}if(S.type==="variable"&&S.maxWidth){let E=ig({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 _b(t){return(t["@context"]?Array.isArray(t["@context"])?t["@context"]:[t["@context"]]:[]).indexOf("http://iiif.io/api/image/3/context.json")!==-1}function DO(t){return sd(t)?(t&&t.sizes?t.sizes:[]).map(e=>({id:Ae(t),type:"fixed-service",height:e.height,width:e.width,level:ng(t),version:_b(t)?3:2})):[]}function LO(t){if(!wO(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:Ae(t),type:"variable",minWidth:0,minHeight:0,maxHeight:o.maxHeight||o.maxWidth,maxWidth:o.maxWidth||o.maxHeight,level:ng(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:Ae(t),type:"variable",minHeight:0,minWidth:0,maxHeight:s.height||s.width,maxWidth:s.width,level:ng(t),version:_b(t)?3:2})}}return e}function Mb(t){let e=[],n=t.length;for(let i=0;i<n;i++){let a=t[i];if(!a)continue;let o=DO(a);o.length&&e.push(...o);let s=LO(a);s.length&&e.push(...s)}return e}function Ob(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 ud(t){if(typeof t=="string")return Ob(t);let e=_O(t);if(e!=="Image"&&e!=="sc:Image")return null;let n=t,i=Ae(n);return i?i&&n.width&&n.height?{id:i,type:"fixed",width:n.width,height:n.height,unsafe:!0}:Ob(i):null}function PO(t,e=!0,n){let i=[],a=ud(t);if(a===null)return i;let o=t;if(i.push(a),e&&o&&o.width&&o.height){let s=[],u=jr(o);for(let d of u){let p={id:Ae(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(...Mb([f])))}}if(s.length)return i.push(...s),i}return o.service&&i.push(...Mb(o.service)),i}function BO(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 Zu=class{constructor(t={}){An(this,"config",{verificationsRequired:1,approximateServices:!1,enableFetching:!0,disableThrottling:!1}),An(this,"fetchingCount",0),An(this,"imageServices",{}),An(this,"knownImageServers",{}),this.config=Object.assign(this.config,t)}setConfig(t){Object.assign(this.config,t)}sample(t,e,n=!0){let i=fs(Ae(t)),a=Vr(Ae(t)),o=this.knownImageServers[i];return this.imageServices[a]=Object.assign(t,{real:!0}),!o&&t.tiles&&!wb(t)?(this.knownImageServers[i]={verifications:0,malformed:!1,root:i,preLoaded:n,sampledId:Ae(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:MO(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=fs(Ae(t)),o=this.knownImageServers[a],s=Vr(Ae(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&&wb(t.source)?null:(this.imageServices[s]||(this.imageServices[s]={"@context":o.result.context,"@id":Ae(t),id:Ae(t),protocol:"http://iiif.io/api/image",tiles:i?.tiles||zO(t.width,t.height,o.result.sampledTiles),sizes:i?.sizes||OO(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 IO(e,[()=>i,()=>a])}async getImageCandidates(t,e=!0){let n=t;if(e&&n&&n.height&&n.width){let i=jr(n);for(let a of i){let o={id:Ae(a),width:a.width?a.width:n.width,height:a.height?a.height:n.height,source:a};await this.loadService(o)}}return PO(t,e,this)}async verify(t){let e=this.predict(t,!1,!0),n=await this.fetchService(Ae(t));if(!e)return!1;let i=e.height===n.height&&e.width===n.width&&e["@context"]===n["@context"]&&BO(e.sizes||[],n.sizes||[]);if(i){let a=fs(Ae(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:Ae(t),n=Vr(e);if(this.imageServices[n])return!0;let i=this.knownImageServers[fs(e)];return!!(i&&!i.malformed&&i.verifications>=this.config.verificationsRequired)}async markAsMalformed(t){return this.knownImageServers[fs(Ae(t))].malformed=!0,this.loadService(t,!0)}async fetchService(t,e=!1){let n=Vr(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[fs(Ae(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(Ae(t),e);return this.fetchingCount--,i.real&&this.sample(i,t),i}loadServiceSync(t){let e=Vr(Ae(t));return this.imageServices[e]?this.imageServices[e]:this.config.approximateServices?this.predict(t):null}};function HO(t={}){let e=t.events||um(),n=t.loader||new Zu;return{store:sm((a,o)=>({loaded:{},loadServiceSync:(s,u,d)=>{let p=s.id||s["@id"],f=o().loaded[p];if(f&&f.status==="done")return f.service;if(f&&f.status==="loading")return null;if(f&&f.status==="error")throw Error("Failed to load image service");let m={id:Ae(s),width:s.width||u?.width||0,height:s.height||u?.height||0,source:s},g=n.loadServiceSync(m);return g?(a(v=>({loaded:{...v.loaded,[p]:{status:"done",service:g,real:!0}}})),e.emit("image-service.loaded",{id:p,service:g})):d&&o().loadService(s,u).then(()=>{}),g},loadService:async(s,u)=>{let d=s.id||s["@id"],p=o().loaded[d];if(p&&p.status==="done")return p.service;if(p&&p.status==="loading")return new Promise((f,m)=>{let g=v=>{v.id===d&&(e.off("image-service.loaded",g),f(v.service||s))};e.on("image-service.loaded",g)});if(p&&p.status==="error"&&!u?.force)throw Error("Failed to load image service");e.emit("image-service.loading",{id:d});try{let f={id:Ae(s),width:s.width||0,height:s.height||0,source:s},m=await n.loadService(f,u?.force);return a(g=>({loaded:{...g.loaded,[d]:{status:"done",service:m,real:m.real}}})),e.emit("image-service.loaded",{id:d,service:m}),m}catch(f){throw e.emit("image-service.error",{id:d,error:f}),f}}})),events:e}}var zb=HO();var UO=new Zu;function Nb(t=Bo,e={}){let n=e.imageServiceLoader||UO;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 g=ud(a);return g&&u.push(g),await n.getThumbnailFromResource(void 0,o,s,u)}let f=t.get(a,{skipSelfReturn:!1});if(typeof f=="string")return{best:ud(f),fallback:[],log:[]};if(!f)return await p();switch(await(async g=>{if(g&&g.thumbnail&&g.thumbnail.length){let v=t.get(g.thumbnail[0]),S=await n.getImageCandidates(v,s);S&&S.length&&u.push(...S)}})(f),f.type){case"Annotation":{let g=Array.isArray(f.body)?f.body:[f.body],v=t.get(g[0]);return d&&!v.width&&(v.width=d.width,v.height=d.height),await n.getThumbnailFromResource(v,o,s,u)}case"Canvas":{let g=f;return i(g.items[0],o,s,u,{width:g.width,height:g.height})}case"AnnotationPage":return i(f.items[0],o,s,u,d);case"Choice":{let g=f;return!g.items||g.items[0]?await p():i(g.items[0],o,s,u,d)}case"Collection":{let g=f,v=g.items[0];return v?i(v,o,s,u,d):await p()}case"Manifest":{let g=f,v=g.items[0];return v?i(v,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 P8=Object.create,gI=Object.defineProperty,B8=Object.getOwnPropertyDescriptor,H8=Object.getOwnPropertyNames,U8=Object.getPrototypeOf,V8=Object.prototype.hasOwnProperty,mh=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),j8=(t,e,n,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(var a=H8(e),o=0,s=a.length,u;o<s;o++)u=a[o],!V8.call(t,u)&&u!==n&&gI(t,u,{get:(d=>e[d]).bind(null,u),enumerable:!(i=B8(e,u))||i.enumerable});return t},q8=(t,e,n)=>(n=t==null?{}:P8(U8(t)),j8(e||!t||!t.__esModule?gI(n,"default",{value:t,enumerable:!0}):n,t)),Ky="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 F8(){return Ky.reduce((t,e)=>(t[e]=[],t),{})}var Uc=Ky.reduce((t,e)=>(t[e.slice(2).toLowerCase()]=e,t[e]=e,t),{}),Zy=(t=21)=>{let e="",n=crypto.getRandomValues(new Uint8Array(t));for(;t--;)e+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[n[t]&63];return e};function hh(t){"@babel/helpers - typeof";return hh=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},hh(t)}function G8(t,e){if(hh(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var i=n.call(t,e||"default");if(hh(i)!="object")return i;throw TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function k8(t){var e=G8(t,"string");return hh(e)=="symbol"?e:e+""}function O(t,e,n){return(e=k8(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=Uc[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=Uc[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=Zy(),this.eventHandlers=F8()}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(){}},yl=class rR 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 rR.fromImage("data:image/svg+xml;base64,"+btoa(e),n,i,a)}static fromImage(e,n,i,a){let o=new rR;return o.applyProps({uri:e,id:a,display:i,target:n}),o}getImageUrl(){return this.uri}},lR=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 Y8(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=sR(e[s].display.scale,t/(n||1));u<o&&(o=u,a=s)}return a}function sR(t,e){return Math.abs(t-e)}function Fy(t,e){let n=sR(t.x,e.x),i=sR(t.y,e.y);return Math.sqrt(n**2+i**2)}function Q8(t){let e=t.length;return t.indexOf("/info.json")===e-10?t.slice(0,-10):t}function Oy(t,e,n){return Math.min(Math.max(t,e),n)}var ph=class yI 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=Q8(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]=Oy(n[p+1],a,s),n[p+3]=Oy(n[p+3],a,s),n[p+2]=Oy(n[p+2],o,u),n[p+4]=Oy(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"]]:[],C=d===void 0?E.indexOf("http://iiif.io/api/image/3/context.json")!==-1:d;for(let x=0;x<g;x++)for(let A=0;A<m;A++){let T=A*i.width,M=x*i.height;S.addPoints(T*a,M*a,A===m-1?n.width:(T+i.width)*a,x===g-1?n.height:(M+i.height)*a),v.addPoints(T,M,A===m-1?p:T+i.width,x===g-1?f:M+i.height)}let R=new yI({url:e,scaleFactor:a,points:v.build(),displayPoints:S.build(),width:n.width,height:n.height,tileWidth:i.width,format:s,version3:C});return R.applyProps({service:o}),R}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=Gu(this.crop||this.points,e);return[[this,a,n]]}transform(e){ja(this.points,e)}getScheduledUpdates(e,n){return[]}},X8=class extends mo{constructor(...t){super(...t),O(this,"type","spacial-content")}getAllPointsAt(t,e,n){return[[this,this.points,e]]}},K8=class extends X8{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 yl&&(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 yl||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=Y8(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 _y(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 fR=class vI 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 vI;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)),Gu(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(Gu(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]=_y(s,u,n.x,n.y,this.rotation),[f,m]=_y(s,u,i.x,i.y,this.rotation),[g,v]=_y(s,u,a.x,a.y,this.rotation),[S,E]=_y(s,u,o.x,o.y,this.rotation),C=Math.min(d,f,g,S),R=Math.max(d,f,g,S),x=Math.min(p,m,v,E),A=Math.max(p,m,v,E);return Tt([e[0],C,x,R,A])}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=IM(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}},Jy=class SI 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 SI;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(DM(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 fR(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=Gu(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=Gu(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 zy=/([0-9]+(px|em)\s+)+(solid)\s+(.*)/g,Ny={},Z8=["backgroundColor","opacity","boxShadow","borderColor","borderWidth","borderStyle","outlineColor","outlineWidth","outlineOffset","outlineStyle"],ch=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=Zy(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=Ny[n]||zy.exec(n)||zy.exec(n);i&&(this._parsed.border.id=n,this._parsed.border.match=Ny[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=Ny[t.style.outline]||zy.exec(t.style.outline)||zy.exec(t.style.outline);i&&(this._parsed.outline.id=t.style.outline,this._parsed.outline.match=Ny[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 Z8)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++}},Vy=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,Iy=Math.sqrt,lh=Math.sin,nI=Math.cos,fh=Math.PI,Gy=1.70158,Dy=Gy*1.525,iI=Gy+1,aI=2*fh/3,oI=2*fh/4.5,Ly=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-nI(t*fh/2)},easeOutSine:function(t){return lh(t*fh/2)},easeInOutSine:function(t){return-(nI(fh*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-Iy(1-qe(t,2))},easeOutCirc:function(t){return Iy(1-qe(t-1,2))},easeInOutCirc:function(t){return t<.5?(1-Iy(1-qe(2*t,2)))/2:(Iy(1-qe(-2*t+2,2))+1)/2},easeInBack:function(t){return iI*t*t*t-Gy*t*t},easeOutBack:function(t){return 1+iI*qe(t-1,3)+Gy*qe(t-1,2)},easeInOutBack:function(t){return t<.5?qe(2*t,2)*((Dy+1)*2*t-Dy)/2:(qe(2*t-2,2)*((Dy+1)*(t*2-2)+Dy)+2)/2},easeInElastic:function(t){return t===0?0:t===1?1:-qe(2,10*t-10)*lh((t*10-10.75)*aI)},easeOutElastic:function(t){return t===0?0:t===1?1:qe(2,-10*t)*lh((t*10-.75)*aI)+1},easeInOutElastic:function(t){return t===0?0:t===1?1:t<.5?-(qe(2,20*t-10)*lh((20*t-11.125)*oI))/2:qe(2,-20*t+10)*lh((20*t-11.125)*oI)/2+1},easeInBounce:function(t){return 1-Ly(1-t)},easeOutBounce:Ly,easeInOutBounce:function(t){return t<.5?(1-Ly(1-2*t))/2:(1+Ly(2*t-1))/2}},J8=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 Wy=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",Zy()),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 C=m[E][0],R=m[E][1],x=m[E][2],A=x?ro(R,x,this.transformBuffer):R;this.renderer.prepareLayer(C,C.__parent&&x?ro(C.__parent.crop||C.__parent.points,x):A);let T=A.length/5;for(let M=0;M<T;M++){let z=M*5;A[z]!==0&&(this.renderer.paint(C,M,A[z+1],A[z+2],A[z+3]-A[z+1],A[z+4]-A[z+2]),this.hook("useAfterPaint",C))}this.renderer.finishLayer(C,R)}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 C=v[S-E-1]();C?C.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 J8(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,C=o.left*E,R=o.right*E,x=o.top*E,A=o.bottom*E;return{x:v-C,y:S-x,width:m+C+R,height:g+x+A}}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 T=this.getScaleFactor(!1);typeof t.homePaddingPx=="number"?o=s=u=d=t.homePaddingPx/T:(o=t.homePaddingPx.left?t.homePaddingPx.left/T:0,s=t.homePaddingPx.right?t.homePaddingPx.right/T:0,u=t.homePaddingPx.top?t.homePaddingPx.top/T:0,d=t.homePaddingPx.bottom?t.homePaddingPx.bottom/T:0)}if(this.world.hasActiveZone()){let T=this.world.getActiveZone();if(T){let M=e[3]-e[1]<T.points[3]-T.points[1],z=e[4]-e[2]<T.points[4]-T.points[2];return{minX:M?T.points[1]-n:T.points[1]+(T.points[3]-T.points[1])/2-(e[3]-e[1])/2,maxX:z?T.points[2]-n:T.points[2]+(T.points[4]-T.points[2])/2-(e[4]-e[2])/2,minY:M?T.points[3]+n:T.points[1]+(T.points[3]-T.points[1])/2-(e[3]-e[1])/2,maxY:z?T.points[4]+n:T.points[2]+(T.points[4]-T.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,C=S-v-E,R=Math.round(Math.max(m,g)),x=Math.round(Math.min(m,g)),A=Math.round(Math.max(E,C));return{minX:x,maxX:R,minY:Math.round(Math.min(E,C)),maxY:A}}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,C=s*a;this.world.width/E>this.world.height/C?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}},Py=/([0-9]+(px|em)\s+)+(solid)\s+(.*)/g,By={},W8=["backgroundColor","opacity","boxShadow","borderColor","borderWidth","borderStyle","outlineColor","outlineWidth","outlineOffset","outlineStyle"],bI=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=Zy(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=By[n]||Py.exec(n)||Py.exec(n);i&&(this._parsed.border.id=n,this._parsed.border.match=By[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=By[t.style.outline]||Py.exec(t.style.outline)||Py.exec(t.style.outline);i&&(this._parsed.outline.id=t.style.outline,this._parsed.outline.match=By[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 W8)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++}},sh=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,ky=typeof AbortController=="function"?AbortController:class{constructor(){this.signal=new xI}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})}},$8=typeof AbortSignal=="function",tj=typeof ky.AbortSignal=="function",xI=$8?AbortSignal:tj?ky.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))}},dR=new Set,iR=(t,e)=>{let n=`LRU_CACHE_OPTION_${t}`;$y(n)&&hR(n,`${t} option`,`options.${e}`,tv)},aR=(t,e)=>{let n=`LRU_CACHE_METHOD_${t}`;if($y(n)){let{prototype:i}=tv,{get:a}=Object.getOwnPropertyDescriptor(i,t);hR(n,`${t} method`,`cache.${e}()`,a)}},ej=(t,e)=>{let n=`LRU_CACHE_PROPERTY_${t}`;if($y(n)){let{prototype:i}=tv,{get:a}=Object.getOwnPropertyDescriptor(i,t);hR(n,`${t} property`,`cache.${e}`,a)}},EI=(...t)=>{typeof process=="object"&&process&&typeof process.emitWarning=="function"?process.emitWarning(...t):console.error(...t)},$y=t=>!dR.has(t),hR=(t,e,n,i)=>{dR.add(t),EI(`The ${e} is deprecated. Please use ${n} instead.`,"DeprecationWarning",t,i)},ml=t=>t&&t===Math.floor(t)&&t>0&&isFinite(t),RI=t=>ml(t)?t<=2**8?Uint8Array:t<=2**16?Uint16Array:t<=2**32?Uint32Array:t<=2**53-1?jy:null:null,jy=class extends Array{constructor(t){super(t),this.fill(0)}},nj=class{constructor(t){if(t===0)return[];this.heap=new(RI(t))(t),this.length=0}push(t){this.heap[this.length++]=t}pop(){return this.heap[--this.length]}},tv=class uR{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:C,fetchContext:R,noDeleteOnFetchRejection:x,noDeleteOnStaleGet:A,allowStaleOnFetchRejection:T,allowStaleOnFetchAbort:M,ignoreFetchAbort:z}=e,{length:D,maxAge:I,stale:q}=e instanceof uR?{}:e;if(n!==0&&!ml(n))throw TypeError("max option must be a nonnegative integer");let B=n?RI(n):Array;if(!B)throw Error("invalid max value: "+n);if(this.max=n,this.maxSize=v,this.maxEntrySize=S||this.maxSize,this.sizeCalculation=E||D,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=C||null,this.fetchMethod&&typeof this.fetchMethod!="function")throw TypeError("fetchMethod must be a function if specified");if(this.fetchContext=R,!this.fetchMethod&&R!==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 B(n),this.prev=new B(n),this.head=0,this.tail=0,this.free=new nj(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=!!T,this.allowStaleOnFetchAbort=!!M,this.ignoreFetchAbort=!!z,this.maxEntrySize!==0){if(this.maxSize!==0&&!ml(this.maxSize))throw TypeError("maxSize must be a positive integer if specified");if(!ml(this.maxEntrySize))throw TypeError("maxEntrySize must be a positive integer if specified");this.initializeSizeTracking()}if(this.allowStale=!!d||!!q,this.noDeleteOnStaleGet=!!A,this.updateAgeOnGet=!!s,this.updateAgeOnHas=!!u,this.ttlResolution=ml(a)||a===0?a:1,this.ttlAutopurge=!!o,this.ttl=i||I||0,this.ttl){if(!ml(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";$y(U)&&(dR.add(U),EI("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",U,uR))}q&&iR("stale","allowStale"),I&&iR("maxAge","ttl"),D&&iR("length","sizeCalculation")}getRemainingTTL(e){return this.has(e,{updateAgeOnHas:!1})?1/0:0}initializeTTLTracking(){this.ttls=new jy(this.max),this.starts=new jy(this.max),this.setItemTTL=(i,a,o=sh.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:sh.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=sh.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 jy(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(!ml(i))if(a){if(typeof a!="function")throw TypeError("sizeCalculation must be a function");if(i=a(n,e),!ml(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 aR("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=sh.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=sh.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 ky;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,C=i.ignoreFetchAbort&&v!==void 0;return i.status&&(E&&!S?(i.status.fetchAborted=!0,i.status.fetchError=s.signal.reason,C&&(i.status.fetchAbortIgnored=!0)):i.status.fetchResolved=!0),E&&!C&&!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,C=E||i.allowStaleOnFetchRejection,R=C||i.noDeleteOnFetchRejection;if(this.valList[n]===g&&(!R||g.__staleWhileFetching===void 0?this.delete(e):E||(this.valList[n]=g.__staleWhileFetching)),C)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:C,signal:R}={}){if(!this.fetchMethod)return C&&(C.fetch="get"),this.get(e,{allowStale:n,updateAgeOnGet:i,noDeleteOnStaleGet:a,status:C});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:C,signal:R},A=this.keyMap.get(e);if(A===void 0){C&&(C.fetch="miss");let T=this.backgroundFetch(e,A,x,S);return T.__returned=T}else{let T=this.valList[A];if(this.isBackgroundFetch(T)){let q=n&&T.__staleWhileFetching!==void 0;return C&&(C.fetch="inflight",q&&(C.returnedStale=!0)),q?T.__staleWhileFetching:T.__returned=T}let M=this.isStale(A);if(!E&&!M)return C&&(C.fetch="hit"),this.moveToTail(A),i&&this.updateItemAge(A),this.statusTTL(C,A),T;let z=this.backgroundFetch(e,A,x,S),D=z.__staleWhileFetching!==void 0,I=D&&n;return C&&(C.fetch=D&&M?"stale":"refresh",I&&M&&(C.returnedStale=!0)),I?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 aR("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 aR("reset","clear"),this.clear}get length(){return ej("length","size"),this.size}static get AbortController(){return ky}static get AbortSignal(){return xI}},ij=tv,rI=/(-?[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,lI={},aj=typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes("firefox"),Hy={},oj=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 ij({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 yl||t instanceof ph){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,Fy({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 aj?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 ch&&this.options.box,d=t instanceof bI&&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 C=lI[E]||rI.exec(E)||rI.exec(E);lI[E]=C,C&&(this.ctx.save(),this.ctx.shadowOffsetX=parseInt(C[1])*this.dpi*f,this.ctx.shadowOffsetY=parseInt(C[3])*this.dpi*f,this.ctx.shadowBlur=parseInt(C[5])*this.dpi*f,this.ctx.shadowColor=C[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||[],C=E.length;this.ctx.beginPath();for(let R=0;R<C;R++)this.ctx.lineTo(n+E[R][0]*this.lastKnownScale,i+E[R][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(Hy[t]&&Hy[t].naturalWidth>0){e(Hy[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),Hy[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 yl||t instanceof ph)&&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=[]}},AI=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()}},rj=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 yl&&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 lj=mh((t,e)=>{var n=!1,i,a,o,s,u,d,p,f,m,g,v,S,E,C,R;function x(){if(!n){n=!0;var T=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(T),z=/(Mac OS X)|(Windows)|(Linux)/.exec(T);if(S=/\b(iPhone|iP[ao]d)/.exec(T),E=/\b(iP[ao]d)/.exec(T),g=/Android/i.exec(T),C=/FBAN\/\w+;/i.exec(T),R=/Mobile/i.exec(T),v=!!/Win64/.exec(T),M){i=M[1]?parseFloat(M[1]):M[5]?parseFloat(M[5]):NaN,i&&document&&document.documentMode&&(i=document.documentMode);var D=/(?:Trident\/(\d+.\d+))/.exec(T);d=D?parseFloat(D[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(T),u=M&&M[1]?parseFloat(M[1]):NaN):u=NaN}else i=a=o=u=s=NaN;if(z){if(z[1]){var I=/(?:Mac OS X (\d+(?:[._]\d+)?))/.exec(T);p=I?parseFloat(I[1].replace("_",".")):!0}else p=!1;f=!!z[2],m=!!z[3]}else p=f=m=!1}}var A={ie:function(){return x()||i},ieCompatibilityMode:function(){return x()||d>i},ie64:function(){return A.ie()&&v},firefox:function(){return x()||a},opera:function(){return x()||o},webkit:function(){return x()||s},safari:function(){return A.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||R},nativeApp:function(){return x()||C},android:function(){return x()||g},ipad:function(){return x()||E}};e.exports=A}),sj=mh((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}}),uj=mh((t,e)=>{var n=sj(),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}),cj=mh((t,e)=>{var n=lj(),i=uj(),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}),fj=q8(mh((t,e)=>{e.exports=cj()})(),1),sI="scroll",dj={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},TI=(t={})=>({start:function(e){let{zoomWheelConstant:n,enableWheel:i,enableClickToZoom:a,ignoreSingleFingerTouch:o,enablePanOnWait:s,panOnWaitDelay:u,parentElement:d,requireMetaKeyForWheelZoom:p}={...dj,...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,R="",A(),A(void 0,"notice"),C=0}function g(){e.world.constraintBounds(),m()}function v(B){if(B.which>1){f.isPressing=!1;return}e.mode==="explore"&&(B.preventDefault(),f.pointerStart.x=B.atlas.x,f.pointerStart.y=B.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,C=0,R="";function x(B){if(e.mode==="explore"){if(B.atlasTouches.length===1&&(C=performance.now(),o==0&&B.preventDefault(),f.pointerStart.x=B.atlasTouches[0].x,f.pointerStart.y=B.atlasTouches[0].y),B.atlasTouches.length===2){R="gesture",B.preventDefault();let U=B.atlasTouches[0].x,W=B.atlasTouches[1].x;f.pointerStart.x=(U+W)/2;let it=B.atlasTouches[0].y,K=B.atlasTouches[1].y;f.pointerStart.y=(it+K)/2,E=Fy({x:B.touches[0].clientX,y:B.touches[0].clientY},{x:B.touches[1].clientX,y:B.touches[1].clientY})}e.transitionManager.stopTransition(),f.isPressing=!0}}function A(B,U="intent"){d&&(d.dataset[U]=B)}function T(B){let U=null,W=null,it=0;if(f.isPressing&&B.touches.length===2&&(U=(B.touches[0].clientX+B.touches[1].clientX)/2,W=(B.touches[0].clientY+B.touches[1].clientY)/2,it=Fy({x:B.touches[0].clientX,y:B.touches[0].clientY},{x:B.touches[1].clientX,y:B.touches[1].clientY})),A(R),f.isPressing&&B.touches.length===1){if(s&&(performance.now()-C<u&&R==""&&(R=sI),R==""&&(R="pan")),A(R),R==""&&o==1||R==sI){A("require-two-finger","notice");return}let K=B.touches[0];U=K.clientX,W=K.clientY}if(U!==null&&W!==null){let K=e.getRendererScreenPosition();if(K){let{x:tt,y:ut}=e.viewerToWorld(U-K.x,W-K.y),xt=it&&E?it/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=it}R=="pan"&&B.preventDefault()}function M(B){if(f.isPressing){let U=e.getRendererScreenPosition();if(U){let{x:W,y:it}=e.viewerToWorld(B.clientX-U.x,B.clientY-U.y);e.transitionManager.customTransition(K=>{K.from=Tt(e.target),K.to=ro(K.from,ei(f.pointerStart.x-W,f.pointerStart.y-it),f.mousemoveBuffer),K.elapsed_time=0,K.total_time=0,K.timingFunction=ir.easeInOutExpo,K.done=!1})}}}function z(B){e.mode==="explore"&&e.world.zoomIn(B.atlas)}function D(B){let U=1+(0,fj.default)(B).spinY/n;e.world.zoomTo(U,B.atlas,!0)}function I(B){return p&&B.metaKey==0?(A("meta-required","notice"),B.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",T),a&&(e.world.activatedEvents.push("onClick"),e.world.addEventListener("click",z)),i&&(e.world.activatedEvents.push("onWheel"),p&&d?.addEventListener("wheel",I,{passive:!0,capture:!0}),e.world.addEventListener("wheel",D));let q=e.world.addLayoutSubscriber((B,U)=>{if(B==="zone-changed"&&e.transitionManager.constrainBounds({transition:{duration:0}}),B==="zoom-to"&&U&&e.transitionManager.zoomTo(U.factor,{origin:U.point,stream:U.stream}),B==="go-home"){let W=U.immediate?{duration:0}:void 0,it=U?.paddingPx===void 0?e.homePaddingPx:U.paddingPx,K=e.getHomeTargetStrand({paddingPx:it});e.transitionManager.applyTransition(K,W,{duration:1e3,easing:ir.easeOutExpo,constrain:!0},{stream:!1}),e.updateNextFrame()}if(B==="goto-region"&&U){let W=U.immediate?{duration:0}:{};if(U.paddingPx!==void 0){let it=e.getScaleFactor(!1);if(typeof U.paddingPx=="number"){let K=U.paddingPx/it,tt={x:U.x,y:U.y,width:U.width,height:U.height,padding:K};e.transitionManager.goToRegion(tt,{transition:W})}else{let K=U.paddingPx.left?U.paddingPx.left/it:0,tt=U.paddingPx.right?U.paddingPx.right/it:0,ut=U.paddingPx.top?U.paddingPx.top/it:0,xt=U.paddingPx.bottom?U.paddingPx.bottom/it:0,lt={x:U.x-K,y:U.y-ut,width:U.width+K+tt,height:U.height+ut+xt};e.transitionManager.goToRegion(lt,{transition:W})}}else e.transitionManager.goToRegion(U,{transition:W})}B==="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",I,{passive:!0,capture:!0})),a&&e.world.removeEventListener("click",z),i&&e.world.removeEventListener("wheel",D),q()}},updatePosition(){}}),Vc=st.default.createContext("explore");Vc.displayName="Mode";var hj=()=>(0,st.useContext)(Vc);var ev=st.default.createContext(null);ev.displayName="Atlas";var nv=st.default.createContext(null);nv.displayName="Bounds";var Yy;if(typeof performance=="object"&&typeof performance.now=="function"){let t=performance;Yy=()=>t.now()}else{let t=Date,e=t.now();Yy=()=>t.now()-e}var uI=typeof oR.default=="function"?oR.default:null;function cI(t,e){t&&t.appendChild&&e&&t.appendChild(e)}function CI(t,e){t&&t.removeChild&&e&&t.removeChild(e)}function pj(t,e){return CI(t.world,e)}function mj(t,e,n){return wI(t.world,e,n)}function wI(t,e,n){t&&t instanceof Wy&&(t=t.world),t&&t.insertBefore&&t.insertBefore(e,n)}function MI(t,e,n){if(n&&(t.applyProps&&t.applyProps(n),t instanceof mo))for(let i of Ky){let a=i.slice(2).toLowerCase();n[i]!==e[i]&&(e[i]&&t.removeEventListener(a,e[i]),t.addEventListener(a,n[i]))}}function OI(t,e){let n=Object.keys(e),i=!1;for(let a of n)if(Ky.indexOf(a)!==-1){let o=Uc[a];if(o){if(t.activatedEvents.indexOf(o)!==-1)continue;i=!0,t.activatedEvents.push(o)}}i&&t.triggerEventActivation()}var Qy=new Map,fI={};function gj(t,{args:e=[],...n},i,a,o){if(!(i instanceof Wy)&&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=Jy.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 ch;break;case"shape":s=new bI;break;case"worldObject":case"world-object":s=new fR;break;case"worldImage":case"world-image":s=new yl;break;case"texture":s=new lR;break;case"compositeImage":case"composite-image":s=new K8({id:n.id,width:n.width,height:n.height,images:[],renderOptions:n.renderOptions});break;case"tiledImage":case"tiled-image":s=ph.fromTile(n.uri,n.display,n.tile,n.scaleFactor,void 0,n.format,n.useFloorCalc,n.version3);break;case"paragraph":s=new Vy,s.text=n.children;break;default:return}return OI(u,n),MI(s,{},n),s}function yj(t,e){if(e instanceof Jy)t.world=e;else if(e instanceof fR)t.world.appendChild(e);else if(e)throw Error("Invalid root")}var Uy=0,gl=uI?uI({unstable_now:Yy,now:Yy,createInstance:gj,removeChild:CI,appendChild:cI,appendInitialChild:cI,insertBefore:wI,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:yj,removeChildFromContainer:pj,createTextInstance(){},insertInContainerBefore:mj,prepareUpdate(t,e,n,i,a){return OI(a.world,i),i},commitUpdate(t,e,n,i,a){let o=i,s=n;typeof o=="string"&&(o=n),t.applyProps&&o&&MI(t,s,o)},finalizeInitialChildren(t){return t?.__handlers},getChildHostContext(){return fI},getRootHostContext(){return fI},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){Uy=t},getCurrentUpdatePriority(){return Uy},resolveUpdatePriority(){if(Uy!==0)return Uy;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;gl&&gl.injectIntoDevTools();function pR(t,e){let n=Qy.get(t);if(n){if(!gl)return;gl.updateContainer(null,n,null,()=>{Qy.delete(t),e&&e(t)})}}var dI={render(t,e){let n=Qy.get(e);if(gl)if(n)gl.updateContainer(t,n,null);else{let i=gl.createContainer(e,0,null,!1,null,"",()=>{},null);gl.updateContainer(t,i,null),Qy.set(e,i)}},unmountComponentAtNode(t,e){pR(t,e)}},dh=typeof window<"u"&&(window.document?.createElement||window.navigator?.product==="ReactNative")?Xy.useLayoutEffect:Xy.useEffect,vj=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 dh(()=>{if(a){let u=a.runtime;o!==u.mode&&(u.mode=o),dI.render((0,Ce.jsx)(st.default.StrictMode,{children:(0,Ce.jsx)(s,{children:(0,Ce.jsx)(nv.Provider,{value:i,children:(0,Ce.jsx)(Vc.Provider,{value:o,children:(0,Ce.jsx)(ev.Provider,{value:a,children:t})})})})}),u)}},[a,o,t]),dh(()=>{if(a){let u=a.runtime;return()=>{dI.unmountComponentAtNode(u)}}return()=>{}},[a]),null}),Sj=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 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(qm(d.name));case"COMMIT":if(u===void 0){f?.init(a.getState());return}return f?.init(qm(d.name));case"ROLLBACK":return rb(E.state,T=>{if(u===void 0){v(T),f?.init(a.getState());return}v(T[u]),f?.init(qm(d.name))});case"JUMP_TO_STATE":case"JUMP_TO_ACTION":return rb(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},rb=(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)},L6=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)},B6=(t={},e)=>{switch(e.type){case Dm:return{...t,[e.payload.id]:e.payload.type};case Lm: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 P6(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 H6(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 rM(t,e){if(!(!e?.id||!e?.type))return t[e.type]?.[e.id]}function Fm(t,e){return t===void 0?e:t}var lM=(t=ob(),e)=>{let n=(i,a)=>({...t,[At(e).type]:{...t[At(e).type],[At(e).id]:{...i,...a}}});switch(e.type){case Rm:{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 Tm:{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=rM(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=H6(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=rM(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 Cm:return lM(t,{type:Zf,payload:{subjects:{type:"list",items:[At(e).subject]},from:At(e).from,to:At(e).to}});case Mm:{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=Y2(g,s),E=Array.from(m);E.splice(Fm(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 Am:{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]?P6(t[o][f],s[f]):s[f];d&&(a[o]=u)}}return a}case wm:{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(Fm(At(e).index,a.length+1),0,At(e).reference),n(i,{[At(e).key]:a})}case Wf:case Om:{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=Fm(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 _m:{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(Fm(e.payload.beforeIndex,a.length+1),0,{label:o.label,value:o.label}),n(i,{metadata:a})}case Nm:{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 zm:{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}},U6=(t={},e)=>{switch(e.type){case Bm:case Vm:return{...t,[e.payload.id]:{requestUri:e.payload.id,loadingState:$f,uriMismatch:!1,resourceUri:e.payload.id}};case Hm: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 Pm:return{...t,[e.payload.id]:{...t[e.payload.id]||{},loadingState:Bu,error:e.payload.message}};case Um:return{...t,[e.payload.id]:{...t[e.payload.id]||{},loadingState:Pu,error:void 0}}}return t},V6=(t={},e)=>{let{id:n,updateValue:i,value:a,meta:o,key:s}=e&&e.payload||{};switch(e.type){case J1:return{...t,[n]:{...t[n]||{},[o]:{...t[n]&&t[n][o]||{},[s]:a}}};case $1: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 tb: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 sM(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 j6(t){return(e,n)=>n&&n.type===Hu?n.payload.actions.reduce(t,e):n&&n.type===jm?{...e,iiif:{...e.iiif,...n.payload.state}}:t(e,n)}var q6=sM({mapping:B6,entities:lM,requests:U6,meta:V6});function F6(){return{iiif:{entities:ob(),meta:{},mapping:{},requests:{}}}}function uM(t={}){let{enableDevtools:e=!1,iiifStoreName:n="iiif",defaultState:i=F6(),customReducers:a={}}=t,o=j6(sM({[n]:q6,...a}));return pm(L6((typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__?D6:(s,u)=>s)(N6(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,dM(o)):this[ls][t]=o)}})}var ls=Symbol.for("_refs_"),rs=Symbol.for("_reactive_"),ju=Symbol.for("_defined_"),cM=Symbol.for("_parent_");function G6(t,e=!1,n){let i={id:"",type:"unknown",[ju]:[],[ls]:{},[cM]: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[cM];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 k6(t){return!!t[ju]}function dM(t){return Array.isArray(t)?t.map(e=>dM(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=G6(e,n),o=Object.create(a),s=Object.assign(o,t);return n&&s.reactive(),s}function fM(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||uM({customReducers:this.options.reducers,defaultState:this.options.defaultState,enableDevtools:this.options.enableDevtools}),this.emitter=mm(),this.remoteFetcher=ab(this,this.options.customFetcher),this.staticFetcher=ab(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 G1(this.getState().iiif,t,e)}toPresentation2(t){return this.serialize(t,k1)}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(f=>this.get(f,n));let o=this.getState();if(Gi(t)&&!n.preserveSpecificResources&&(t=t.source),typeof t=="string"){let f=fM(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=fM(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 ib(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:ib,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 k6(t)}setMetaValue([t,e,n],i){this.dispatch(typeof i=="function"?eb.setMetaValueDynamic({id:t,meta:e,key:n,updateValue:i}):eb.setMetaValue({id:t,meta:e,key:n,value:i}))}};function hM(){return typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}function nd(t){let e=hM();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 sb=_(Y(),1),Ur=Gm.default.createContext({vault:null,setVaultInstance:t=>{}});function Io({vault:t,vaultOptions:e,useGlobal:n,resources:i,children:a}){let[o,s]=(0,Gm.useState)(()=>t||(n?nd(e):e?new qu(e):new qu));return(0,sb.jsx)(Ur.Provider,{value:{vault:o,setVaultInstance:s},children:(0,sb.jsx)(ci,{value:i||{},children:a})})}var mM=_(nt(),1),gM=_(nt(),1);var pM=_(nt(),1),Vt=()=>{let{vault:t}=(0,pM.useContext)(Ur);if(t===null)throw new Error("Vault not found. Ensure you have your provider set up correctly.");return t};var km=_(nt(),1);function re(t,e=[]){let n=Vt(),[i,a]=(0,km.useState)(()=>t(n.getState(),n));return(0,km.useEffect)(()=>n.subscribe(o=>t(o,n),o=>{a(o)},!1),e),i}var us=gM.default.createContext([]);function cs(){let t=(0,mM.useContext)(us);return re(e=>t.map(n=>e.iiif.entities.Canvas[n]).filter(Boolean),[t])}var yM=_(nt(),1);function Do(t){let e=(0,yM.useContext)(Ur);return t||(e&&e.vault?e.vault:nd())}var vM=_(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,vM.useMemo)(()=>{if(u)return i?i(u):u},[u,i,...e])}var kM=_(nt(),1),$m=_(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 ub(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 SM=_(Y(),1);function cb({manifest:t,children:e}){return(0,SM.jsx)(ci,{value:{manifest:t},children:e})}var bM=_(Y(),1);function fb({range:t,children:e}){return(0,bM.jsx)(ci,{value:{range:t},children:e})}function xM(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=xM(t,t.get(n));if(i)return i}}return null}function Ym(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(...Ym(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 Y6(t,e,n){for(let i of e.structures){let a=db(t,t.get(i),n);if(a)return a}return null}function db(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=db(t,t.get(i),n);if(o)return o}}return null}function Q6(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]=Qm(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 Qm(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:Ym(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 EM=_(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,EM.useMemo)(()=>{if(s)return i?i(s):s},[s,i,...e])}function hb({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)(()=>Qm(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 RM={},AM=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:()=>{(RM.env?RM.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?AM(t):AM;var LM=_(nt(),1),BM=_(NM(),1),Km={},{useDebugValue:fH}=LM.default,{useSyncExternalStoreWithSelector:dH}=BM.default,IM=!1,hH=t=>t;function bt(t,e=hH,n){(Km.env?Km.env.MODE:void 0)!=="production"&&n&&!IM&&(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"),IM=!0);let i=dH(t.subscribe,t.getState,t.getServerState||t.getInitialState,e,n);return fH(i),i}var DM=t=>{(Km.env?Km.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},Zm=t=>t?DM(t):DM;function pH(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 gb=()=>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}))})),mb(n.service).then(()=>{Wm(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=${PM()}`,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");Wm(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}))})),mb(o).then(()=>{Wm(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}))}})),yb=(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 vb(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 Wm(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 PM(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 mb(t){let e=`${t.id}?origin=${PM()}`,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 HM(t){let e=(0,Gu.useMemo)(()=>vb(t),[t]),n=Sb(e.services.access?.id),i=(0,Gu.useMemo)(()=>yb(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),UM=(0,Va.createContext)(null);UM.displayName="CurrentAuth";var VM=(0,Va.createContext)(null);VM.displayName="AuthActions";function xb({children:t}){let e=(0,Va.useMemo)(()=>gb(),[]);return(0,od.jsx)(fs.Provider,{value:e,children:t})}function Eb(){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 jM(){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 mH(){let t=ku();return bt(t,e=>e)}function qM(t){let e=ku();return bt(e,i=>i.authItems.find(a=>a.service.id===t))}function Sb(t){let e=ku();return bt(e,i=>i.authItems.find(a=>a.id===t)?.session?.token)}function gH(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 yH(t){let e=jM(),n=qM(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 bb(){return null}function Ab(t){let[e,n,i]=HM(t.resource),a=t.fallbackComponent||bb,o=t.loadingComponent||bb,s=t.errorComponent||bb,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)(yH,{service:f,probeId:u.id,children:d},f.id);return d}var rd=_(nt(),1);var vH=t=>t.id||t["@id"];function SH(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 FM=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?vH(e):void 0,i=null;return Yi((a,o)=>({service:e,resources:[],lastQuery:{},loading:!1,error:!1,highlight:null,hasSearch:!!e,hasAutocomplete:e?!!SH(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 Rb(){let t=on();return t?t.service.find(e=>e.profile==="SearchService1"||e.profile==="http://iiif.io/api/search/1/search"):void 0}var Jm=_(Y(),1),Yu=(0,rd.createContext)(null);Yu.displayName="Search";function GM(t){let e=Rb();return t.store?(0,Jm.jsx)(Yu.Provider,{value:t.store,children:t.children}):(0,Jm.jsx)(bH,{service:e,children:t.children})}function bH({service:t,children:e}){let n=(0,rd.useMemo)(()=>FM(t),[t]);return(0,Jm.jsx)(Yu.Provider,{value:n,children:e})}var Ei=_(Y(),1),ld=()=>{},Qu=(0,$m.createContext)({setCurrentCanvasId:ld,setCurrentCanvasIndex:ld,nextCanvas:ld,previousCanvas:ld,items:[],sequence:[],setSequenceIndex:ld,currentSequenceIndex:0,hasNext:!1,hasPrevious:!1});function YM(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}=hb({startCanvas:t.startCanvas,disablePaging:t.pagingEnabled===!1}),v=(0,$m.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 Tb(t){let e=Do(t.vault),n=ub(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)(YM,{...t,children:t.children});return(0,Ei.jsx)(Io,{vault:e,children:(0,Ei.jsx)(cb,{manifest:n.id,children:(0,Ei.jsx)(xb,{children:(0,Ei.jsx)(GM,{children:t.rangeId?(0,Ei.jsx)(fb,{range:t.rangeId,children:i}):i})})})})}function ds(){return(0,kM.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 QM=(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)},XM=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 ev=_(nt(),1),st=_(nt(),1),Ce=_(Y(),1);var Qi=_(nt(),1);function KM(t,e){let n;return(...i)=>{window.clearTimeout(n),n=window.setTimeout(()=>t(...i),e)}}function Cb({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&&!RH(u.current.lastBounds,P)&&s(u.current.lastBounds=P)};return[A,p?KM(A,p):A,d?KM(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=ZM(A),E())};return EH(v,!!e),xH(g),(0,Qi.useEffect)(()=>{S(),E()},[e,v,g]),(0,Qi.useEffect)(()=>S,[]),[T,o,m]}function xH(t){(0,Qi.useEffect)(()=>{let e=t;return window.addEventListener("resize",e),()=>void window.removeEventListener("resize",e)},[t])}function EH(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 ZM(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,...ZM(t.parentElement)]}var AH=["x","y","top","bottom","left","right","width","height"],RH=(t,e)=>AH.every(n=>t[n]===e[n]);var gA=_(cO(),1);var CH=Object.defineProperty,wH=(t,e,n)=>e in t?CH(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,ig=(t,e,n)=>(wH(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 MH="http://library.stanford.edu/iiif/image-api/compliance.html#level0",pO="http://library.stanford.edu/iiif/image-api/compliance.html#level1",mO="http://library.stanford.edu/iiif/image-api/compliance.html#level2",OH="http://library.stanford.edu/iiif/image-api/conformance.html#level0",gO="http://library.stanford.edu/iiif/image-api/conformance.html#level1",yO="http://library.stanford.edu/iiif/image-api/conformance.html#level2",_H="http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level0",vO="http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level1",SO="http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level2",zH="http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level0",bO="http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level1",xO="http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level2",NH="http://iiif.io/api/image/1/level0.json",IH="http://iiif.io/api/image/1/profiles/level0.json",EO="http://iiif.io/api/image/1/level1.json",AO="http://iiif.io/api/image/1/profiles/level1.json",RO="http://iiif.io/api/image/1/level2.json",TO="http://iiif.io/api/image/1/profiles/level2.json",DH="http://iiif.io/api/image/2/level0.json",LH="http://iiif.io/api/image/2/profiles/level0.json",CO="http://iiif.io/api/image/2/level1.json",wO="http://iiif.io/api/image/2/profiles/level1.json",MO="http://iiif.io/api/image/2/level2.json",OO="http://iiif.io/api/image/2/profiles/level2.json",BH="level0",_O="level1",zO="level2",PH="http://iiif.io/api/image/2/level0",NO="http://iiif.io/api/image/2/level1",IO="http://iiif.io/api/image/2/level2",HH="https://iiif.io/api/image/1.1/compliance/#level0",DO="https://iiif.io/api/image/1.1/compliance/#level1",LO="https://iiif.io/api/image/1.1/compliance/#level2",BO=[IO,mO,yO,SO,xO,RO,TO,MO,OO,zO,LO],PO=[...BO,NO,pO,gO,vO,bO,EO,AO,CO,wO,_O,DO],UH=[PH,NO,IO,MH,pO,mO,OH,gO,yO,_H,vO,SO,zH,bO,xO,NH,IH,EO,AO,RO,TO,DH,LH,CO,wO,MO,OO,BH,_O,zO,HH,DO,LO];var VH={extraFormats:["jpg"],extraQualities:["default"],extraFeatures:["sizeByWhListed"]},jH={extraFormats:["jpg"],extraQualities:["default"],extraFeatures:["baseUriRedirect","cors","jsonldMediaType","regionByPx","regionSquare","sizeByWhListed","sizeByH","sizeByW","sizeByWh"]},qH={extraFormats:["jpg","png"],extraQualities:["default"],extraFeatures:["baseUriRedirect","cors","jsonldMediaType","regionByPct","regionByPx","regionSquare","rotationBy90s","sizeByWhListed","sizeByConfinedWh","sizeByH","sizeByPct","sizeByW","sizeByWh"]};function FH(t){return BO.indexOf(t)!==-1?qH:PO.indexOf(t)!==-1?jH:VH}function GH(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=FH(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 kH(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 YH(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 QH(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 XH(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 KH(t,e=""){let{path:n,scheme:i,server:a,prefix:o}=XH(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:kH(f),size:YH(p),rotation:QH(d),quality:v[0],format:v[1]}}function ZH(t){let e=KH(hs(t.id));if(e.type!=="info")throw new Error("Invalid service URL");let n=GH(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 WH(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 JH(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 og(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"&&UH.indexOf(n)!==-1)return!0;return!1}function $H(t){if(!og(t))return!1;let e=Array.isArray(t.profile)?t.profile:[t.profile];for(let n of e)if(typeof n=="string"){if(PO.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 ag(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 Pb(t){return og(t)?ag(0,t)?0:ag(1,t)?1:ag(2,t)?2:null:null}function HO(t){return(t["@context"]?Array.isArray(t["@context"])?t["@context"]:[t["@context"]]:[]).indexOf("http://iiif.io/api/image/3/context.json")!==-1}function tU(t){if(!$H(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:Pb(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:Pb(t),version:HO(t)?3:2})}}return e}function fO(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 eU(t){if(t["@type"])return t["@type"];if(t.type)return t.type}function nU(t){if(typeof t=="string")return fO(t);let e=eU(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}:fO(i):null}function iU(t){return og(t)?(t&&t.sizes?t.sizes:[]).map(e=>({id:Ze(t),type:"fixed-service",height:e.height,width:e.width,level:Pb(t),version:HO(t)?3:2})):[]}function dO(t){let e=[],n=t.length;for(let i=0;i<n;i++){let a=t[i];if(!a)continue;let o=iU(a);o.length&&e.push(...o);let s=tU(a);s.length&&e.push(...s)}return e}function UO(t){let e=t.service?Array.isArray(t.service)?t.service:[t.service]:[],n=e.length,i=[];for(let a=0;a<n;a++)og(e[a])&&i.push(e[a]);return i}function aU(t,e=!0,n){let i=[],a=nU(t);if(a===null)return i;let o=t;if(i.push(a),e&&o&&o.width&&o.height){let s=[],u=UO(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(...dO([f])))}}if(s.length)return i.push(...s),i}return o.service&&i.push(...dO(o.service)),i}function oU({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 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 lU(t){return`${t.mirror?"!":""}${(t.angle||0)%360}`}function sU(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,oU(o),rU(a),lU(s),`${d}.${u}`].filter(Boolean).join("/")}function Bb(t,e,n){let i=ZH({"@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:sU(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 uU(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 cU(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),uU(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=Bb(S,i.width,i.height);d(E,u)}else{a(()=>"Checking for an image from the tile source 3",2);let E=Bb(S,S.width,S.height);d(E,u)}if(S.type==="variable"&&S.maxWidth){let E=Bb({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 fU(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 dU(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 hO(t){return ag(0,t)}var VO=class{constructor(t={}){ig(this,"config",{verificationsRequired:1,approximateServices:!1,enableFetching:!0,disableThrottling:!1}),ig(this,"fetchingCount",0),ig(this,"imageServices",{}),ig(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&&!hO(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:WH(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)||hO(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||fU(t.width,t.height,o.result.sampledTiles),sizes:i?.sizes||JH(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 cU(e,[()=>i,()=>a])}async getImageCandidates(t,e=!0){let n=t;if(e&&n&&n.height&&n.width){let i=UO(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 aU(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"]&&dU(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}},aY=new VO;var rg={},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;rg[t]={...rg[t]||{},[e]:{...(rg[t]||{})[e]||{},[n]:s}}},getResourceMeta:(t,e)=>{let n=rg[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 hU(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 pU(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 mU(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 gU(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 yU(t,e=""){let{path:n,scheme:i,server:a,prefix:o}=gU(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:hU(f),size:pU(p),rotation:mU(d),quality:v,format:S}}function vU(t){return Ou.indexOf(t)!==-1?S2:ym.indexOf(t)!==-1?v2:y2}function SU(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=vU(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 Hb(t){let e=Array.isArray(t.profile)?t.profile:[t.profile];for(let n of e)if(typeof n=="string"&&L1.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"&&I1.indexOf(n)!==-1)return!0;return!1}function jO(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(ym.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 bU({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 xU({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 EU(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: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,bU(o),xU(a),EU(s),`${d}.${u}`].filter(Boolean).join("/")}function qr(t){return t.endsWith("info.json")?t:t.endsWith("/")?`${t}info.json`:`${t}/info.json`}function sg(t){let e=yU(qr(t.id));if(e.type!=="info")throw Error("Invalid service URL");let n=SU(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 qO(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 FO(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(ym.includes(a))return!0}if(t===0){for(let a of i)if(L1.includes(a))return!0}}}return!1}function ug(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 GO(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 kO(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 cg(t,e,n){let i=sg({"@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:lg(i),type:"fixed",width:e,height:n||t.height/(t.width||1)*e,unsafe:t.width>e}}function YO(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 QO(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),YO(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(cg(S,i.width,i.height),u)):(a(()=>"Checking for an image from the tile source 3",2),d(cg(S,S.width,S.height),u))),S.type==="variable"&&S.maxWidth&&d(cg({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 jb(t){return(t["@context"]?Array.isArray(t["@context"])?t["@context"]:[t["@context"]]:[]).indexOf("http://iiif.io/api/image/3/context.json")!==-1}function XO(t){return dd(t)?(t&&t.sizes?t.sizes:[]).map(e=>({id:Re(t),type:"fixed-service",height:e.height,width:e.width,level:ug(t),version:jb(t)?3:2})):[]}function KO(t){if(!jO(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:ug(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:ug(t),version:jb(t)?3:2})}}return e}function Ub(t){let e=[],n=t.length;for(let i=0;i<n;i++){let a=t[i];if(!a)continue;let o=XO(a);o.length&&e.push(...o);let s=KO(a);s.length&&e.push(...s)}return e}function Vb(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 Vb(t);let e=GO(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}:Vb(i):null}function ZO(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(...Ub([f])))}}if(s.length)return i.push(...s),i}return o.service&&i.push(...Ub(o.service)),i}function WO(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&&!Hb(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:qO(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&&Hb(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||kO(t.width,t.height,o.result.sampledTiles),sizes:i?.sizes||FO(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 QO(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 ZO(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"]&&WO(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 JO(t={}){let e=t.events||mm(),n=t.loader||new tc;return{store:pm((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 qb=JO();var $O=new tc;function Fb(t=Po,e={}){let n=e.imageServiceLoader||$O;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 X8=Object.create,_I=Object.defineProperty,K8=Object.getOwnPropertyDescriptor,Z8=Object.getOwnPropertyNames,W8=Object.getPrototypeOf,J8=Object.prototype.hasOwnProperty,Sh=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),$8=(t,e,n,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(var a=Z8(e),o=0,s=a.length,u;o<s;o++)u=a[o],!J8.call(t,u)&&u!==n&&_I(t,u,{get:(d=>e[d]).bind(null,u),enumerable:!(i=K8(e,u))||i.enumerable});return t},tj=(t,e,n)=>(n=t==null?{}:X8(W8(t)),$8(e||!t||!t.__esModule?_I(n,"default",{value:t,enumerable:!0}):n,t)),nv="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 ej(){return nv.reduce((t,e)=>(t[e]=[],t),{})}var Fc=nv.reduce((t,e)=>(t[e.slice(2).toLowerCase()]=e,t[e]=e,t),{}),iv=(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 nj(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 ij(t){var e=nj(t,"string");return yh(e)=="symbol"?e:e+""}function O(t,e,n){return(e=ij(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=iv(),this.eventHandlers=ej()}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 yA 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 yA.fromImage("data:image/svg+xml;base64,"+btoa(e),n,i,a)}static fromImage(e,n,i,a){let o=new yA;return o.applyProps({uri:e,id:a,display:i,target:n}),o}getImageUrl(){return this.uri}},vA=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 aj(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=SA(e[s].display.scale,t/(n||1));u<o&&(o=u,a=s)}return a}function SA(t,e){return Math.abs(t-e)}function Zy(t,e){let n=SA(t.x,e.x),i=SA(t.y,e.y);return Math.sqrt(n**2+i**2)}function oj(t){let e=t.length;return t.indexOf("/info.json")===e-10?t.slice(0,-10):t}function By(t,e,n){return Math.min(Math.max(t,e),n)}var vh=class zI 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=oj(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]=By(n[p+1],a,s),n[p+3]=By(n[p+3],a,s),n[p+2]=By(n[p+2],o,u),n[p+4]=By(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 zI({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[]}},rj=class extends mo{constructor(...t){super(...t),O(this,"type","spacial-content")}getAllPointsAt(t,e,n){return[[this,this.points,e]]}},lj=class extends rj{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=aj(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 Py(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 EA=class NI 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 NI;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]=Py(s,u,n.x,n.y,this.rotation),[f,m]=Py(s,u,i.x,i.y,this.rotation),[g,v]=Py(s,u,a.x,a.y,this.rotation),[S,E]=Py(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=QM(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}},av=class II 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 II;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(XM(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 EA(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 Hy=/([0-9]+(px|em)\s+)+(solid)\s+(.*)/g,Uy={},sj=["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=iv(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=Uy[n]||Hy.exec(n)||Hy.exec(n);i&&(this._parsed.border.id=n,this._parsed.border.match=Uy[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=Uy[t.style.outline]||Hy.exec(t.style.outline)||Hy.exec(t.style.outline);i&&(this._parsed.outline.id=t.style.outline,this._parsed.outline.match=Uy[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 sj)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++}},Qy=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,Vy=Math.sqrt,fh=Math.sin,gI=Math.cos,mh=Math.PI,Wy=1.70158,jy=Wy*1.525,yI=Wy+1,vI=2*mh/3,SI=2*mh/4.5,qy=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-gI(t*mh/2)},easeOutSine:function(t){return fh(t*mh/2)},easeInOutSine:function(t){return-(gI(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-Vy(1-qe(t,2))},easeOutCirc:function(t){return Vy(1-qe(t-1,2))},easeInOutCirc:function(t){return t<.5?(1-Vy(1-qe(2*t,2)))/2:(Vy(1-qe(-2*t+2,2))+1)/2},easeInBack:function(t){return yI*t*t*t-Wy*t*t},easeOutBack:function(t){return 1+yI*qe(t-1,3)+Wy*qe(t-1,2)},easeInOutBack:function(t){return t<.5?qe(2*t,2)*((jy+1)*2*t-jy)/2:(qe(2*t-2,2)*((jy+1)*(t*2-2)+jy)+2)/2},easeInElastic:function(t){return t===0?0:t===1?1:-qe(2,10*t-10)*fh((t*10-10.75)*vI)},easeOutElastic:function(t){return t===0?0:t===1?1:qe(2,-10*t)*fh((t*10-.75)*vI)+1},easeInOutElastic:function(t){return t===0?0:t===1?1:t<.5?-(qe(2,20*t-10)*fh((20*t-11.125)*SI))/2:qe(2,-20*t+10)*fh((20*t-11.125)*SI)/2+1},easeInBounce:function(t){return 1-qy(1-t)},easeOutBounce:qy,easeInOutBounce:function(t){return t<.5?(1-qy(1-2*t))/2:(1+qy(2*t-1))/2}},uj=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 ov=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",iv()),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 uj(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}},Fy=/([0-9]+(px|em)\s+)+(solid)\s+(.*)/g,Gy={},cj=["backgroundColor","opacity","boxShadow","borderColor","borderWidth","borderStyle","outlineColor","outlineWidth","outlineOffset","outlineStyle"],DI=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=iv(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=Gy[n]||Fy.exec(n)||Fy.exec(n);i&&(this._parsed.border.id=n,this._parsed.border.match=Gy[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=Gy[t.style.outline]||Fy.exec(t.style.outline)||Fy.exec(t.style.outline);i&&(this._parsed.outline.id=t.style.outline,this._parsed.outline.match=Gy[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 cj)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,Jy=typeof AbortController=="function"?AbortController:class{constructor(){this.signal=new LI}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})}},fj=typeof AbortSignal=="function",dj=typeof Jy.AbortSignal=="function",LI=fj?AbortSignal:dj?Jy.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))}},AA=new Set,pA=(t,e)=>{let n=`LRU_CACHE_OPTION_${t}`;rv(n)&&RA(n,`${t} option`,`options.${e}`,lv)},mA=(t,e)=>{let n=`LRU_CACHE_METHOD_${t}`;if(rv(n)){let{prototype:i}=lv,{get:a}=Object.getOwnPropertyDescriptor(i,t);RA(n,`${t} method`,`cache.${e}()`,a)}},hj=(t,e)=>{let n=`LRU_CACHE_PROPERTY_${t}`;if(rv(n)){let{prototype:i}=lv,{get:a}=Object.getOwnPropertyDescriptor(i,t);RA(n,`${t} property`,`cache.${e}`,a)}},BI=(...t)=>{typeof process=="object"&&process&&typeof process.emitWarning=="function"?process.emitWarning(...t):console.error(...t)},rv=t=>!AA.has(t),RA=(t,e,n,i)=>{AA.add(t),BI(`The ${e} is deprecated. Please use ${n} instead.`,"DeprecationWarning",t,i)},yl=t=>t&&t===Math.floor(t)&&t>0&&isFinite(t),PI=t=>yl(t)?t<=2**8?Uint8Array:t<=2**16?Uint16Array:t<=2**32?Uint32Array:t<=2**53-1?Xy:null:null,Xy=class extends Array{constructor(t){super(t),this.fill(0)}},pj=class{constructor(t){if(t===0)return[];this.heap=new(PI(t))(t),this.length=0}push(t){this.heap[this.length++]=t}pop(){return this.heap[--this.length]}},lv=class bA{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 bA?{}:e;if(n!==0&&!yl(n))throw TypeError("max option must be a nonnegative integer");let P=n?PI(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 pj(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";rv(U)&&(AA.add(U),BI("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",U,bA))}q&&pA("stale","allowStale"),D&&pA("maxAge","ttl"),N&&pA("length","sizeCalculation")}getRemainingTTL(e){return this.has(e,{updateAgeOnHas:!1})?1/0:0}initializeTTLTracking(){this.ttls=new Xy(this.max),this.starts=new Xy(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 Xy(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 mA("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 Jy;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 mA("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 mA("reset","clear"),this.clear}get length(){return hj("length","size"),this.size}static get AbortController(){return Jy}static get AbortSignal(){return LI}},mj=lv,bI=/(-?[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,xI={},gj=typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes("firefox"),ky={},yj=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 mj({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,Zy({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 gj?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 DI&&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=xI[E]||bI.exec(E)||bI.exec(E);xI[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(ky[t]&&ky[t].naturalWidth>0){e(ky[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),ky[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=[]}},HI=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()}},vj=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 Sj=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}),bj=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}}),xj=Sh((t,e)=>{var n=bj(),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}),Ej=Sh((t,e)=>{var n=Sj(),i=xj(),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}),Aj=tj(Sh((t,e)=>{e.exports=Ej()})(),1),EI="scroll",Rj={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},UI=(t={})=>({start:function(e){let{zoomWheelConstant:n,enableWheel:i,enableClickToZoom:a,ignoreSingleFingerTouch:o,enablePanOnWait:s,panOnWaitDelay:u,parentElement:d,requireMetaKeyForWheelZoom:p}={...Rj,...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=Zy({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=Zy({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=EI),A==""&&(A="pan")),R(A),A==""&&o==1||A==EI){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,Aj.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 Tj=()=>(0,st.useContext)(Gc);var sv=st.default.createContext(null);sv.displayName="Atlas";var uv=st.default.createContext(null);uv.displayName="Bounds";var $y;if(typeof performance=="object"&&typeof performance.now=="function"){let t=performance;$y=()=>t.now()}else{let t=Date,e=t.now();$y=()=>t.now()-e}var AI=typeof gA.default=="function"?gA.default:null;function RI(t,e){t&&t.appendChild&&e&&t.appendChild(e)}function VI(t,e){t&&t.removeChild&&e&&t.removeChild(e)}function Cj(t,e){return VI(t.world,e)}function wj(t,e,n){return jI(t.world,e,n)}function jI(t,e,n){t&&t instanceof ov&&(t=t.world),t&&t.insertBefore&&t.insertBefore(e,n)}function qI(t,e,n){if(n&&(t.applyProps&&t.applyProps(n),t instanceof mo))for(let i of nv){let a=i.slice(2).toLowerCase();n[i]!==e[i]&&(e[i]&&t.removeEventListener(a,e[i]),t.addEventListener(a,n[i]))}}function FI(t,e){let n=Object.keys(e),i=!1;for(let a of n)if(nv.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 tv=new Map,TI={};function Mj(t,{args:e=[],...n},i,a,o){if(!(i instanceof ov)&&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=av.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 DI;break;case"worldObject":case"world-object":s=new EA;break;case"worldImage":case"world-image":s=new Sl;break;case"texture":s=new vA;break;case"compositeImage":case"composite-image":s=new lj({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 Qy,s.text=n.children;break;default:return}return FI(u,n),qI(s,{},n),s}function Oj(t,e){if(e instanceof av)t.world=e;else if(e instanceof EA)t.world.appendChild(e);else if(e)throw Error("Invalid root")}var Yy=0,vl=AI?AI({unstable_now:$y,now:$y,createInstance:Mj,removeChild:VI,appendChild:RI,appendInitialChild:RI,insertBefore:jI,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:Oj,removeChildFromContainer:Cj,createTextInstance(){},insertInContainerBefore:wj,prepareUpdate(t,e,n,i,a){return FI(a.world,i),i},commitUpdate(t,e,n,i,a){let o=i,s=n;typeof o=="string"&&(o=n),t.applyProps&&o&&qI(t,s,o)},finalizeInitialChildren(t){return t?.__handlers},getChildHostContext(){return TI},getRootHostContext(){return TI},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){Yy=t},getCurrentUpdatePriority(){return Yy},resolveUpdatePriority(){if(Yy!==0)return Yy;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 TA(t,e){let n=tv.get(t);if(n){if(!vl)return;vl.updateContainer(null,n,null,()=>{tv.delete(t),e&&e(t)})}}var CI={render(t,e){let n=tv.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),tv.set(e,i)}},unmountComponentAtNode(t,e){TA(t,e)}},gh=typeof window<"u"&&(window.document?.createElement||window.navigator?.product==="ReactNative")?ev.useLayoutEffect:ev.useEffect,_j=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),CI.render((0,Ce.jsx)(st.default.StrictMode,{children:(0,Ce.jsx)(s,{children:(0,Ce.jsx)(uv.Provider,{value:i,children:(0,Ce.jsx)(Gc.Provider,{value:o,children:(0,Ce.jsx)(sv.Provider,{value:a,children:t})})})})}),u)}},[a,o,t]),gh(()=>{if(a){let u=a.runtime;return()=>{CI.unmountComponentAtNode(u)}}return()=>{}},[a]),null}),zj=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",`
25
25
  precision mediump float;
26
26
 
27
27
  uniform sampler2D u_image;
@@ -54,16 +54,16 @@ Error generating stack: `+i.message+`
54
54
 
55
55
  v_texCoord = a_texCoord;
56
56
  }
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 yl||t instanceof ph)&&this.createImageHost(t),t instanceof lR&&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 lR){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 cR(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 _I=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+cR(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+cR(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])}},zI=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 _I({sheetPrefix:this.options.sheetPrefix}),this.options.inlineStyles||this.htmlContainer.appendChild(this.stylesheet.getElement()),this.options.background&&this.htmlContainer.classList.add(this.stylesheet.addStylesheet(`
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 vA&&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 vA){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 xA(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 GI=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+xA(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+xA(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])}},kI=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 GI({sheetPrefix:this.options.sheetPrefix}),this.options.inlineStyles||this.htmlContainer.appendChild(this.stylesheet.getElement()),this.options.background&&this.htmlContainer.classList.add(this.stylesheet.addStylesheet(`
58
58
  background: ${this.options.background};
59
59
  `)),this.classes={hostClassName:this.stylesheet.addStylesheet(`
60
60
  position: absolute;
61
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 Vy){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 ch&&(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 Vy||t instanceof ch&&(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 Vy||t instanceof ch)&&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(){}},mR=class qy{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=Uc[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=Uc[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&&Fy(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){qy.eventPool.atlas.x=n,qy.eventPool.atlas.y=i,e.atlas=qy.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(mR,"eventPool",{atlas:{x:0,y:0}});function NI({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?TI({minZoomFactor:.5,maxZoomFactor:3,enableClickToZoom:!1,parentElement:i,...o||{}}):void 0,S=new AI([s?new Sj(i,{dpi:u}):new oj(i,{dpi:u,debug:d,box:p,polygon:f}),a?new zI(a,{box:s||!p,text:!0,triggerResize:n}):void 0,m?new rj(m):void 0]),E=new Wy(S,new Jy(1024,1024),e,v?[v]:[],g),C=new mR(i,E);return{name:"default-preset",em:C,runtime:E,renderer:S,controller:v,canvas:i,navigator:m,unmount(){pR(E),E.stopControllers(),E.stop(),E.reset(),C&&C.stop()}}}var pl=1+Number.MIN_VALUE,bj=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 _I({sheetPrefix:this.options.sheetPrefix}),this.container.classList.add(this.stylesheet.addStylesheet(`
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 Qy){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 Qy||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 Qy||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(){}},CA=class Ky{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&&Zy(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){Ky.eventPool.atlas.x=n,Ky.eventPool.atlas.y=i,e.atlas=Ky.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(CA,"eventPool",{atlas:{x:0,y:0}});function YI({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?UI({minZoomFactor:.5,maxZoomFactor:3,enableClickToZoom:!1,parentElement:i,...o||{}}):void 0,S=new HI([s?new zj(i,{dpi:u}):new yj(i,{dpi:u,debug:d,box:p,polygon:f}),a?new kI(a,{box:s||!p,text:!0,triggerResize:n}):void 0,m?new vj(m):void 0]),E=new ov(S,new av(1024,1024),e,v?[v]:[],g),T=new CA(i,E);return{name:"default-preset",em:T,runtime:E,renderer:S,controller:v,canvas:i,navigator:m,unmount(){TA(E),E.stopControllers(),E.stop(),E.reset(),T&&T.stop()}}}var gl=1+Number.MIN_VALUE,Nj=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 GI({sheetPrefix:this.options.sheetPrefix}),this.container.classList.add(this.stylesheet.addStylesheet(`
63
63
  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 yl){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+pl).toFixed(2)}px;height:${(o+pl).toFixed(2)}px;`):(s.style.width=`${a+pl}px`,s.style.height=`${o+pl}px`),s.style.transform=`translate(${n}px, ${i}px)`}if(t instanceof ph){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+pl).toFixed(2)}px;height:${(o+pl).toFixed(2)}px;`):(s.style.width=`${a+pl}px`,s.style.height=`${o+pl}px`),s.style.transform=`translate(${n}px, ${i}px)`}}pendingUpdate(){return this.pending}prepareLayer(t){}finishLayer(t){}reset(){}};function xj({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?TI({minZoomFactor:.5,maxZoomFactor:3,enableClickToZoom:!1,parentElement:i,...o||{}}):void 0,u=new bj(i,{addPart:!1,setDraggableFalse:!1,imageClass:"atlas-static-image"}),d=a?new AI([u,new zI(a,{box:!0,text:!0,triggerResize:n})]):u,p=new Wy(d,new Jy(1024,1024),e,s?[s]:[]),f=new mR(i,p);return{name:"static-preset",em:f,runtime:p,renderer:d,controller:s,container:i,overlay:a,unmount(){pR(p),p.stopControllers(),p.stop(),f&&f.stop()}}}var Ej={"default-preset":NI,"static-preset":xj},Rj={};function Aj(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=Rj]=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=(Ej[u]||NI)({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 Tj(t){return(0,st.useMemo)(()=>cR(t),t)}var uh=st.default.forwardRef((t,e)=>(0,Ce.jsx)("div",{...t,ref:e,part:t.className}));function Cj(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 wj(t,e="",n=!1){let i=(0,st.useRef)(t);i.current&&n&&(console.log("Diff:",e,Cj(i.current,t)),i.current=t)}var hI=["brightness","contrast","grayscale","hueRotate","invert","saturate","sepia","blur"],Mj=(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:C,homeOnResize:R,homeCover:x,background:A,runtimeOptions:T,debug:M,filters:z,homePaddingPx:D,...I}=t;wj(t,"Atlas.tsx",t.debug);let[q,B]=(0,st.useState)(a),[U,W]=(0,st.useState)(!1),it=(0,st.useRef)(!1),K=(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]=mb({scroll:!0}),lt=(0,st.useRef)(),ft=St=>{lt.current=St,tt(St)},[Rt,X,Ct,ee]=Aj(K,{width:I.width,height:I.height,forceRefresh:xt,unstable_webglRenderer:s}),[ce,le]=(0,st.useState)("");(0,st.useEffect)(()=>{B(a)},[a]),(0,st.useEffect)(()=>{X&&X.em&&X.em.updateBounds()},[X,ut]),(0,st.useEffect)(()=>{X?.runtime.setOptions(T||{})},[T]),(0,st.useEffect)(()=>{X&&X.runtime&&(X.runtime.mode=q),U&&X&&(X.ready=!0)},[X,U,q]),(0,st.useEffect)(()=>{X&&(x||(X.runtime.manualHomePosition=!!C,X.runtime.setHomePosition(C)))},[X,x,C]),(0,st.useEffect)(()=>{X&&X.runtime.setHomePaddingPx(D)},[X,D]),(0,st.useEffect)(()=>{if(X){let St=X.runtime;St.resize(Ct.current.width,I.width,Ct.current.height,I.height),Ct.current.width=I.width,Ct.current.height=I.height,St.updateNextFrame(),Ct.current.didUpdate=!0}},[X,I.width,I.height,Ct]),(0,st.useEffect)(()=>{if(z&&X){let St=X.runtime,It=!1;St.hookOptions.enableFilters=!0;for(let te of hI)z[te]?z[te]!==X.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(X){let St=X.runtime;for(let It of hI)St.hookOptions.filters[It]=0;St.hookOptions.enableFilters=!1,St.updateNextFrame()}},[X,z]);function pe(){if(X&&(X.overlay&&(X.overlay.style.width=`${ut.width}px`,X.overlay.style.height=`${ut.height}px`),X.container&&(X.container.style.width=`${ut.width}px`,X.container.style.height=`${ut.height}px`),x)){let St=X.runtime.world.width,It=X.runtime.world.height,te=St/It,Hn=Ct.current.width,Zn=Ct.current.height,tn=Hn/Zn;if(te>tn){tn=Zn/Hn,X.runtime.manualHomePosition=!0;let bn=(St-It/tn)/2;x==="start"&&(bn=0),x==="end"&&(bn=St-It/tn);let P={x:bn,y:0,width:It/tn,height:It};X.runtime.setHomePosition(P)}else{let bn=(It-St/tn)/2;x==="start"&&(bn=0),x==="end"&&(bn=It-St/tn),X.runtime.manualHomePosition=!0;let P={x:0,y:bn,width:St,height:St/tn};X.runtime.setHomePosition(P)}R&&X.runtime.goHome({})}}dh(()=>{pe()},[X,t.runtimeOptions?.maxOverZoom,ut.height,ut.width,x]),dh(()=>{let St=()=>{if(X){let It=X.runtime;Ct.current.width!==I.width&&Ct.current.height!==I.height&&(It.resize(Ct.current.width,I.width,Ct.current.height,I.height),Ct.current.width=I.width,Ct.current.height=I.height,It.updateNextFrame(),Ct.current.didUpdate=!0)}};return window.addEventListener("resize",St),()=>window.removeEventListener("resize",St)},[X,I.height,I.width]);let De={width:120},ne=()=>{if(X&&X.navigator){let St=X.runtime.world.height,It=X.runtime.world.width,te=window.devicePixelRatio||1,Hn=De.width,Zn=De.width/It*St;X.navigator.width=Hn*te,X.navigator.height=Zn*te,X.navigator.style.width=Hn+"px",X.navigator.style.height=Zn+"px"}};dh(()=>{if(X){ne();let St=X.runtime;return St.world.addLayoutSubscriber(It=>{It==="recalculate-world-size"&&(ne(),pe(),St.resize(Ct.current.width,I.width,Ct.current.height,I.height))})}return()=>{}},[X,I.width,I.height]);let Di=(0,st.useCallback)(function(St){let It=()=>{W(!0)};return(0,st.useEffect)(()=>{if(X){X.runtime.goHome();let te=i&&i(X);te&&te.then?te.then(It):It();return}else throw Error("Invalid configuration - no runtime found")},[]),St.children},[X]);(0,st.useEffect)(()=>{if(X){let St=X.runtime;if(o)return St.world.addLayoutSubscriber(It=>{It==="recalculate-world-size"&&St.goHome()})}return()=>{}},[X,o]),(0,st.useEffect)(()=>X?X.runtime.registerHook("useBeforeFrame",()=>{if(Ct.current.didUpdate&&X.canvas){let St=window.devicePixelRatio||1,It=Ct.current.width,te=Ct.current.height;X.canvas.width=It*St,X.canvas.height=te*St,X.canvas.style.width=It+"px",X.canvas.style.height=te+"px",X.canvas.getContext("2d")?.scale(St,St),X&&X.em&&X.em.updateBounds(),Ct.current.didUpdate=!1}}):()=>{},[X,o]),(0,st.useEffect)(()=>{let St=()=>{X&&(B("sketch"),le("mode-sketch")),window.removeEventListener("keyup",St)},It=te=>{if(te.code==="Space"&&X&&X.runtime.mode==="sketch"){let Hn=te.target?.tagName?.toLowerCase();if(Hn==="input"||Hn==="textarea"||te.target?.isContentEditable)return;te.preventDefault(),B("explore"),le("mode-explore"),window.addEventListener("keyup",St)}};return window.addEventListener("keydown",It),()=>{window.removeEventListener("keydown",It),window.removeEventListener("keyup",St)}},[X]),it.current=!0;let{height:ri,width:me,...ge}=I,$t=Tj([I.width,I.height]),Mn=!0;return K&&Array.isArray(K)&&K.length>1&&K[1].interactive===!1&&(Mn=!1),A=A??"#000",lt.current&&(A=getComputedStyle(lt.current).getPropertyValue("--atlas-background")||A),(0,Ce.jsxs)(uh,{ref:ft,className:["atlas",d?"":`atlas-width-${$t}`,ce,S,`atlas-${Rt}`].filter(Boolean).join(" ").trim(),style:{...g,...d?{}:{width:I.width,height:I.height}},children:[Rt==="static-preset"?(0,Ce.jsx)(uh,{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":A}),(0,Ce.jsx)(uh,{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)(nv.Provider,{value:ut,children:(0,Ce.jsx)(Vc.Provider,{value:q,children:(0,Ce.jsx)(ev.Provider,{value:X,children:f})})})}):(0,Ce.jsx)(vj,{bounds:ut,preset:X,mode:q,setIsReady:W,onCreated:i,children:f})}),v?(0,Ce.jsx)(uh,{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: ${I.width}px; height: ${I.height}px; }`}):(0,Ce.jsx)("style",{children:`
65
- .atlas { position: relative; display: flex; background: ${A}; 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; }
66
- .atlas-width-${$t} { width: ${I.width}px; height: ${I.height}px; }
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 Ij({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?UI({minZoomFactor:.5,maxZoomFactor:3,enableClickToZoom:!1,parentElement:i,...o||{}}):void 0,u=new Nj(i,{addPart:!1,setDraggableFalse:!1,imageClass:"atlas-static-image"}),d=a?new HI([u,new kI(a,{box:!0,text:!0,triggerResize:n})]):u,p=new ov(d,new av(1024,1024),e,s?[s]:[]),f=new CA(i,p);return{name:"static-preset",em:f,runtime:p,renderer:d,controller:s,container:i,overlay:a,unmount(){TA(p),p.stopControllers(),p.stop(),f&&f.stop()}}}var Dj={"default-preset":YI,"static-preset":Ij},Lj={};function Bj(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=Lj]=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=(Dj[u]||YI)({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 Pj(t){return(0,st.useMemo)(()=>xA(t),t)}var hh=st.default.forwardRef((t,e)=>(0,Ce.jsx)("div",{...t,ref:e,part:t.className}));function Hj(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 Uj(t,e="",n=!1){let i=(0,st.useRef)(t);i.current&&n&&(console.log("Diff:",e,Hj(i.current,t)),i.current=t)}var wI=["brightness","contrast","grayscale","hueRotate","invert","saturate","sepia","blur"],Vj=(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;Uj(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]=Cb({scroll:!0}),lt=(0,st.useRef)(),dt=St=>{lt.current=St,tt(St)},[Rt,K,Ct,ee]=Bj(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 wI)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 wI)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=Pj([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)(uv.Provider,{value:ut,children:(0,Ce.jsx)(Gc.Provider,{value:q,children:(0,Ce.jsx)(sv.Provider,{value:K,children:f})})})}):(0,Ce.jsx)(_j,{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: ${R}; 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; }
66
+ .atlas-width-${$t} { width: ${D.width}px; height: ${D.height}px; }
67
67
  .atlas-canvas { flex: 1 1 0px; }
68
68
  .atlas-canvas:focus, .atlas-static-container:focus { outline: none }
69
69
  .atlas-canvas:focus-visible, .atlas-canvas-container:focus-visible { outline: var(--atlas-focus, 2px solid darkorange) }
@@ -75,16 +75,17 @@ Error generating stack: `+i.message+`
75
75
  .atlas-static-image { position: absolute; user-select: none; transform-origin: 0px 0px; }
76
76
  .atlas-navigator { position: absolute; top: var(--atlas-navigator-top, 10px); right: var(--atlas-navigator-bottom, 10px); left: var(--atlas-navigator-left); bottom: var(--atlas-navigator-bottom); opacity: .8 }
77
77
  .atlas-navigator-canvas { width: 100%; }
78
- `}),e]})});function Oj(t){return Number(t)==t?`${t}px`:t}var II=(0,st.memo)(function({resizeHash:t,aspectRatio:e,containerProps:n={},htmlChildren:i,...a}){let[o,s,u]=mb(),{height:d,width:p,...f}=a;(0,st.useEffect)(()=>{u()},[p,d,t,u]);let m=(0,st.useMemo)(()=>e?{width:s.width,height:s.width*(1/e)}:s,[s,e]);return(0,Ce.jsxs)(uh,{ref:o,className:"atlas-container",...n,children:[m.width?(0,Ce.jsx)(Mj,{width:m.width||100,height:m.height||100,...f,children:a.children}):null,a.hideInlineStyle?null:(0,Ce.jsx)("style",{children:`
78
+ `}),e]})});function jj(t){return Number(t)==t?`${t}px`:t}var QI=(0,st.memo)(function({resizeHash:t,aspectRatio:e,containerProps:n={},htmlChildren:i,...a}){let[o,s,u]=Cb(),{height:d,width:p,...f}=a;(0,st.useEffect)(()=>{u()},[p,d,t,u]);let m=(0,st.useMemo)(()=>e?{width:s.width,height:s.width*(1/e)}:s,[s,e]);return(0,Ce.jsxs)(hh,{ref:o,className:"atlas-container",...n,children:[m.width?(0,Ce.jsx)(Vj,{width:m.width||100,height:m.height||100,...f,children:a.children}):null,a.hideInlineStyle?null:(0,Ce.jsx)("style",{children:`
79
79
  .atlas-container {
80
80
  display: var(--atlas-container-display, block);
81
81
  flex: var(--atlas-container-flex, none);
82
82
  width: var(--atlas-container-width, ${p?`${p}px`:"100%"});
83
- height: var(--atlas-container-height, ${Oj(d||(e?m.height:512))})
83
+ height: var(--atlas-container-height, ${jj(d||(e?m.height:512))})
84
84
  }
85
- `}),i]})}),iv=()=>(0,st.useContext)(ev),av=()=>{let t=iv();return t?t.runtime:void 0};var DI=(t,e=[])=>{let n=av();(0,st.useEffect)(()=>n?n.registerHook("useFrame",t):()=>{},e)},ov=()=>{let t=iv();return t&&t.canvas?t.canvas:void 0};function _j(){return(0,st.useContext)(nv)}async function zj(t,e,n){if(st.version.startsWith("18.")||st.version.startsWith("19.")){let i=await Promise.resolve().then(()=>_(eI(),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(()=>_(ds(),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=av(),o=(0,st.useRef)(0),s=(0,st.useRef)(),u=(0,st.useRef)();return DI(()=>{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 zj(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 pI=(t,e,n=[])=>{let i=av();(0,st.useEffect)(()=>{if(i){let a=e,o=Uc[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 mI(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 Nj(){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 LI=(t,e)=>{let n=hj(),i=av(),a=_j(),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=Nj(),v=(0,st.useCallback)(x=>A=>{if(f.current=!0,p(!0),a&&i){let{top:T,left:M}=a,z=i.viewerToWorld(A.pageX-M,A.pageY-T);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 A=-x.west+x.east,T=-x.north+x.south,M=t.width+A,z=t.height+T;if(M/z>=S){let D=M-z*S,[I,q]=mI(x.east,x.west);x.west+=D*q,x.east-=D*I}else{let D=z-M/S,[I,q]=mI(x.north,x.south);x.north+=D*I,x.south-=D*q}},[t.width,t.height,S]);DI(()=>{u&&i&&i.updateNextFrame()}),(0,st.useEffect)(()=>{i&&i.updateNextFrame()},[i,d]);let C=(0,st.useCallback)(x=>{if(!i||!a||i.mode!=="sketch")return;let{top:A,left:T}=a,M=i.viewerToWorld(x.pageX-T,x.pageY-A),z=s.current,D=!t.maintainAspectRatio&&g.current.alt,I=!D&&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),D&&(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),D&&(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),D&&(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),D&&(m.current.north=-m.current.south)),(t.maintainAspectRatio||I)&&E(m.current),z){let q=m.current.west,B=m.current.north,U=t.width+m.current.east,W=t.height+m.current.south;z.points[1]=Math.min(q,U),z.points[2]=Math.min(B,W),z.points[3]=Math.max(q,U),z.points[4]=Math.max(B,W),i.updateNextFrame()}},[i,t.width,t.height,t.maintainAspectRatio,a]);pI("mousemove",C,[t.width,t.height,a]),pI("pointermove",C,[t.width,t.height,a]);let R=(0,st.useRef)();return(0,st.useEffect)(()=>{R.current=()=>{if(f.current){let x=m.current.west,A=m.current.north,T=t.width+m.current.east,M=t.height+m.current.south,z=Math.min(x,T),D=Math.min(A,M),I=Math.max(x,T),q=Math.max(A,M),B={x:(t.x||0)+z,y:(t.y||0)+D,width:I-z||1,height:q-D||1};t.maintainAspectRatio,e(B),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=()=>{R.current&&R.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:C,isEditing:d}};function gh(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 Is=_(nt(),1),PI=_(Y(),1),Ij=ka(),rv=(0,Is.createContext)(Ij);function Dj({children:t,emitter:e}){return(0,PI.jsx)(rv.Provider,{value:e,children:t})}function gR(){return(0,Is.useContext)(rv)}function Ds(t,e,n=[]){let i=(0,Is.useContext)(rv);(0,Is.useEffect)(()=>{let a=o=>{e(o)};return i.on(t,a),()=>{i.off(t,a)}},[i,t,...n])}function Lj(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 Pj(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 Bj(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),C=o+v*(u-o);return[E,C]}return null}function Hj(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}=Pj(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],C=u[S],R=Bj(m,g,E,C);if(R){let[x,A]=R,T=Math.sqrt((o-x)**2+(s-A)**2);T<=i&&a.push({type:"intersection",point:R,source:{lineIndex:p,polygon:e.polygon},distance:T})}}}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 Uj(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 Vj(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 vl(t,e,n=5,i){if(!e.slowState.snapEnabled)return e.snapTargets=[],e.activeSnapGuides=[],e.isSnapping=!1,e.snapPoint=null,null;let a=Hj(t,e,void 0);if(a.length===0)return e.snapTargets=[],e.activeSnapGuides=[],e.isSnapping=!1,e.snapPoint=null,null;let o=Uj(a);return e.snapTargets=o,e.activeSnapGuides=Vj(o.slice(0,n),e),e.isSnapping=!0,e.snapPoint=o[0].point,e.snapPoint}function jI(t){t.snapTargets=[],t.activeSnapGuides=[],t.isSnapping=!1,t.snapPoint=null}function jj(t){return t.isSnapping&&t.snapPoint!==null}function xh(t,e){return jj(e)&&e.snapPoint?e.snapPoint:t}var qj={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&&(vl(i,e,3),i=xh(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 BI(t,e){return Math.abs(t-e)}function aa(t,e){let n=BI(t[0],e[0]),i=BI(t[1],e[1]);return Math.sqrt(n**2+i**2)}function yR(t,e){return[t[0]-e[0],t[1]-e[1]]}function Fj(t,e){return t[0]*e[0]+t[1]*e[1]}function qI(t){return t[0]*t[0]+t[1]*t[1]}function lv(t,e){return qI(yR(t,e))}function FI(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 GI(t,e){let n,i,a,o;var s=(S,E,C,R,x)=>{if(R<=C+1)return;let A=C,T=0,M=S*S;n=[E[C],E[R]],i=yR(n[1],n[0]);let z=qI(i),D,I,q,B,U;for(let W=C+1;W<R;W++)D=yR(E[W],n[0]),B=Fj(D,i),B<=0?U=lv(E[W],n[0]):z<=B?U=lv(E[W],n[1]):(q=B/z,I=[n[0][0]+q*i[0],n[0][1]+q*i[1]],U=lv(E[W],I)),!(U<=T)&&(A=W,T=U);T>M&&(x[A]=1,s(S,E,C,A,x),s(S,E,A,R,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++)lv(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 Gj(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 kI(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 kj(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 uv(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 Yj(t){return t[0]*t[0]+t[1]*t[1]}function HI(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&&(kI(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=Yj([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 yh={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"],C={ne:v,nw:g,se:m,sw:S},R=[aa(t[0],v),aa(t[0],g),aa(t[0],m),aa(t[0],S)],x=Math.min(...R),A=R.indexOf(x),T=A===-1?null:E[A],M=T?C[T]:null;if(R[0]<a||R[1]<a||R[2]<a||R[3]<a){if(T){let[z,D]=o;(n.Meta||z>=M[0]-n.proximity*4&&D>=M[1]-n.proximity*4&&z<=M[0]+n.proximity*4&&D<=M[1]+n.proximity*4&&!(z>=M[0]-n.proximity*2&&D>=M[1]-n.proximity*2&&z<=M[0]+n.proximity*2&&D<=M[1]+n.proximity*2))&&(e.slowState.boxMode||(e.transitionRotate=!0)),e.transitionDirection=T}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],A=Math.atan2(a[1]-x[1],a[0]-x[0]),T=Math.atan2(s-x[1],o-x[0]),M=n.Shift,z=Math.PI/(n.Alt?4:12),D=T-A;M&&(D=Math.round(D/z)*z);let I=Math.cos(D),q=Math.sin(D),B=[];for(let U of e.polygon.points){let W=U[0]-x[0],it=U[1]-x[1],K=W*I-it*q,tt=W*q+it*I,ut=K+x[0],xt=tt+x[1];B.push(U.length===6?[ut,xt,U[2],U[3],U[4],U[5]]:[ut,xt])}e.transitionPoints=B,uv({points:B,iedges:null,boundingBox:null,isBezier:!1,bezierLines:[]}),e.transitionBoundingBox=e.polygon.boundingBox?{...e.polygon.boundingBox,rotation:D}: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,A=p*v,T=o-m[0],M=s-m[1],z=x*x+A*A,D=z>0?(T*x+M*A)/z:1;D=Math.max(D,.01),S=D,E=D}else{let x=0,A=0;switch(u){case"se":x=o-a[0],A=s-a[1];break;case"sw":x=a[0]-o,A=s-a[1];break;case"ne":x=o-a[0],A=a[1]-s;break;case"nw":x=a[0]-o,A=a[1]-s;break}f&&(x*=2,A*=2),S=(i.width+x)/i.width,E=(i.height+A)/i.height}let C=[];for(let x of e.polygon.points){let A=x[0]-m[0],T=x[1]-m[1],M=A*S,z=T*E,D=M+m[0],I=z+m[1];C.push(x.length===6?[D,I,x[2],x[3],x[4],x[5]]:[D,I])}e.transitionPoints=C;let R={points:C,iedges:null,boundingBox:null,bezierLines:[],isBezier:!1};uv(R),e.transitionBoundingBox=R.boundingBox},commit(t,e,n){let i=e.transitionPoints;return e.transitionPoints=null,e.transitionBoundingBox=null,e.transitionRotate=!1,{points:i}}},Qj={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"}:{}}},YI={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}}},Xj={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 YI.commit(t,e,n)}},QI={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&&(vl(i,e,3,e.closestLineIndex),i=xh(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}}},Kj={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:QI.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}}},Zj={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}}},Jj={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:[]}}},Wj={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:[]}}},$j={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:[]}}},tq={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&&(vl(i,e,3),i=xh(i,e)),e.transitionDraw.push(i)},commit(t,e,n){let i=e.slowState.currentTool==="pencil"?e.scale*1.5:e.scale*3,a=GI(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}}},eq={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]=FI(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}}},nq={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 yh.start?yh.start(t,e,n):void 0;if(e.selectedPoints.length<2){let[i,a,o]=kj(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 yh.transition(t,e,n);let i=e.transitionOrigin,a=t[0];!n.Shift&&e.slowState.snapEnabled&&(vl(a,e,3),a=xh(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 yh.commit(t,e,n);let i=e.transitionPoints;return e.transitionPoints=null,e.transitionBoundingBox=null,{points:i}}},XI={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]=FI(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}}},KI={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){XI.transition(t,e,n)},commit(t,e,n){let i=e.transitionPoints;return e.transitionPoints=null,e.transitionBoundingBox=null,{points:i}}},iq={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)}}},aq={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)}}},oq={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})}}},rq={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})}}},lq={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}}}},UI=10,sq={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<UI*UI)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}}},uq={type:"select-shape",label:"Select shape",trigger:{type:"click"},tools:["pointer","pen"],isValid(t,e,n){return KI.isValid(t,e,n)},commit(t,e,n){return{tool:"pointer",selectedPoints:e.polygon.points.map((i,a)=>a)}}},cq={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:vl(t[0],e,0)!==null},start(t,e,n){vl(t[0],e,5)},transition(t,e,n){let i=vl(t[0],e,5);i&&(e.pointer=i)},commit(t,e,n){jI(e)}},fq={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}}},ZI={id:"square",open:!1,points:[[0,0],[0,100],[100,100],[100,0]]},dq={id:"triangle",open:!1,points:[[50,0],[0,100],[100,100]]},hq={id:"pentagon",open:!1,points:[[0,0],[0,100],[100,100],[100,0],[50,-50]]},pq={id:"hexagon",open:!1,points:[[50,0],[0,25],[0,75],[50,100],[100,75],[100,25]]},mq={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]]},gq={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||ZI;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,C=[];for(let x of e.polygon.points){let A=x[0]-a[0],T=x[1]-a[1],M=A*S,z=T*E,D=M+a[0],I=z+a[1];if(x.length===6){C.push([D,I,x[2],x[3],x[4],x[5]]);continue}C.push([D,I])}e.transitionPoints=C;let R={points:C,iedges:null,boundingBox:null,bezierLines:[],isBezier:!1};uv(R),e.transitionBoundingBox=R.boundingBox},commit(t,e,n){return{isOpen:!1,points:e.transitionPoints,tool:"pointer"}}},yq={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 JI(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,C){S&&E.transitionBoundingBox&&C.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,C){S&&E.polygon.boundingBox&&C.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,C){if(S&&E.polygon.boundingBox&&C.showBoundingBox){let R=E.transitionBoundingBox||E.polygon.boundingBox;R.rotation?(S.style.transformOrigin=`${R.x+R.width/2}px ${R.y+R.height/2}px`,S.style.transform=`rotate(${Math.round(100*R.rotation*(180/Math.PI))/100}deg)`):S.style.transform="",S.setAttribute("points",[[R.x,R.y],[R.x+R.width,R.y],[R.x+R.width,R.y+R.height],[R.x,R.y+R.height]].map(x=>x.join(",")).join(" "))}}function u(S,E,C){S&&E.transitionPoints&&C.transitioning&&S.setAttribute("points",E.transitionPoints.map(R=>R.join(",")).join(" "))}function d(S,E,C){S&&E.closestLinePoint&&C.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,C){S&&E.closestLinePoint&&C.hasClosestLine&&S.setAttribute("transform",`translate(${E.closestLinePoint[0]}, ${E.closestLinePoint[1]})`)}function f(S,E,C){S&&E.selectionBox&&C.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,C){if(S&&E.pointer&&E.selectedPoints.length)if(C.actionIntentType==="close-shape"||C.actionIntentType==="close-shape-line"){let R=E.polygon.points[0],x=E.polygon.points[E.polygon.points.length-1];R&&x&&S.setAttribute("points",`${R.join(",")} ${x.join(",")}`)}else if(E.line)S.setAttribute("points",`${E.line[0].join(",")} ${E.line[1].join(",")}`);else{let R=E.polygon.points[E.selectedPoints[0]];R&&R.length&&S.setAttribute("points",`${E.pointer[0]},${E.pointer[1]} ${R.join(",")}`)}}function g(S,E,C,R=3){S&&E.transitionDraw.length&&S.setAttribute("points",GI(E.transitionDraw,R*E.scale).map(x=>x.join(",")).join(" "))}function v(S,E){S&&E.lineBox&&S.setAttribute("points",E.lineBox.map(C=>C.join(",")).join(" "))}return{updateTransitionBoundingBox:a,updateClosestLinePointTransform:p,updateBoundingBoxPolygon:s,updateBoundingBox:o,updateTransitionShape:u,updateClosestLinePoint:d,updateSelectBox:f,updatePointLine:m,updateDrawPreview:g,updateLineBox:v}}var vq=typeof window<"u"?window.requestAnimationFrame:t=>setTimeout(t,16),Sq=typeof window<"u"?window.cancelAnimationFrame:t=>clearTimeout(t);function VI(t){return!["hand","pointer"].includes(t)}var Sh=[yh,nq,eq,QI,KI,XI,tq,lq,gq,cq],bq=Sh.length,vh=[Qj,fq,YI,sq,Xj,Kj,qj,uq,Jj,$j],jc=[Wj,iq,aq,oq,rq,Zj,yq],bh={};Sh.forEach(t=>{bh[t.type]=t});vh.forEach(t=>{bh[t.type]=t});jc.forEach(t=>{bh[t.type]=t});var sv=10;function WI(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||Lj(),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:sv},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:VI(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(P){kI(P),P.isBezier&&S({bezierLines:P.bezierLines}),uv(P),m.shouldUpdate=!0}v(f.polygon);function S(P){let Q=Object.keys(P);if(Q.length===0)return;let dt=m.nextSlowState||f.slowState,ht=!1;if(Q.length===1&&Q[0]==="validIntentKeys"&&dt.validIntentKeys){let vt=Object.keys(dt.validIntentKeys),j=Object.keys(P.validIntentKeys||{});if(vt.length===j.length){for(let L of vt)dt.validIntentKeys[L]!==P.validIntentKeys[L]&&(ht=!0);if(!ht)return}}if(P.selectedPoints){let vt=Array.from(dt.selectedPoints||[]),j=Array.from(P.selectedPoints||[]);if(vt.length===j.length){for(let L of vt)if(!j.includes(L)){ht=!0;break}}else ht=!0;ht||delete P.selectedPoints}if(!(Q.length===1&&Q.includes("hasClosestLine")&&P.hasClosestLine===dt.hasClosestLine)){if(m.nextSlowState){m.nextSlowState={...m.nextSlowState,...P};return}m.nextSlowState={...f.slowState,...P}}}function E(P,Q=!1){m.time+=P,C(),R(),q(),I(),D(),U(),it(),W(),z(),m.renderFunc(f,f.slowState,P),!Q&&(m.animationFrame=vq(E))}function C(){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 P=Object.keys(f.slowState),Q={},dt={},ht=!1;for(let vt of P){let j=f.slowState[vt],L=m.nextSlowState[vt];j!==L?(ht=!0,Q[vt]=L,dt[vt]=L):Q[vt]=j}ht&&(f.slowState=Q,m.nextSlowState=null,m.setStateFunc(f.slowState),t?.customSetState?.(dt))}}function R(){let P=!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!==P&&S({showBoundingBox:P})}function x(P){f.selectedPoints=P.selectedPoints,S({selectedPoints:P.selectedPoints}),f.polygon.points=P.points,f.polygon.boundingBox=null,f.polygon.iedges=null,f.polygon.isBezier=null,v(f.polygon),S({closestPoint:null}),(P.isOpen===!0||P.isOpen===!1)&&(f.isOpen=P.isOpen,m.shouldUpdate=!0)}function A(){if(m.undoStackPointer===-1)return;m.undoStackPointer--;let P=m.undoStack[m.undoStackPointer];x(P)}function T(){if(m.undoStackPointer===m.undoStack.length-1)return;m.undoStackPointer++;let P=m.undoStack[m.undoStackPointer];x(P)}function M(P){m.undoStackPointer++,m.undoStack[m.undoStackPointer]=P,m.undoStack.length>15&&(m.undoStack.shift(),m.undoStackPointer--)}function z(){S({boxMode:Gj(f.polygon.points||[])})}function D(){if(!f.pointer||f.slowState.noShape){S({pointerInsideShape:!1});return}let[P,Q]=f.pointer,dt=f.polygon.points,ht=f.polygon.boundingBox;if(!ht){S({pointerInsideShape:!1});return}if(P<ht.x||P>ht.x+ht.width||Q<ht.y||Q>ht.height+ht.y){S({pointerInsideShape:!1});return}let vt=!1;for(let j=0,L=dt.length-1;j<dt.length;L=j++)dt[j][1]>Q!=dt[L][1]>Q&&P<(dt[L][0]-dt[j][0])*(Q-dt[j][1])/(dt[L][1]-dt[j][1])+dt[j][0]&&(vt=!vt);S({pointerInsideShape:vt})}function I(){if(f.slowState.noShape||!f.pointer||f.slowState.transitioning||!f.polygon.points||f.polygon.points.length===0)return;let[P,Q]=f.pointer,dt=f.polygon.points.map((ht,vt)=>{let j=ht[0]-P,L=ht[1]-Q;return[j*j+L*L,vt]}).sort((ht,vt)=>ht[0]-vt[0]);dt.length&&S({closestPoint:dt[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[P,Q,dt,ht]=HI(f.polygon,f.pointer),vt=ee()*ee();Q<vt&&(!f.isOpen||f.slowState.currentTool==="line"||f.polygon.points.length-1!==ht)?(f.closestLinePoint=P,f.closestLineDistance=Math.sqrt(Q),f.closestLineIndex=ht,S({hasClosestLine:!0})):(f.closestLinePoint=null,f.closestLineDistance=0,f.closestLineIndex=-1,S({hasClosestLine:!1}))}function B(P,Q=null){let dt={},ht=Q||(f.pointer?[f.pointer[0],f.pointer[1]]:null);for(let vt of[...Sh,...vh,...jc])vt.tools.includes(P)&&(ht&&vt.isValid([ht],f,K())?dt[vt.type]=vt.label:ht||(dt[vt.type]=vt.label));return dt}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 P=f.slowState.currentTool;Mn(P);let Q=!1;for(let vt=0;vt<bq;vt++){let j=Sh[vt];if(j.tools.includes(P)&&j.isValid(g.isPressed?[g.lastPress]:[f.pointer],f,K())){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 dt=!1;for(let vt=0;vt<vh.length;vt++){let j=vh[vt];if(j.tools.includes(P)&&ut(j)){if(m.actionIntent===j){dt=!0;break}S({actionIntentType:j.type}),m.actionIntent=j,dt=!0;break}}dt||m.actionIntent&&(m.actionIntent=null,S({actionIntentType:null}));let ht={};for(let vt=0;vt<jc.length;vt++){let j=jc[vt];j.trigger.type==="key"&&ut(j)&&(ht[j.trigger.key]=j.label)}S({validIntentKeys:ht})}function W(){let P=f.pointer;if(f.lineBox=null,!P||lt()||f.polygon.points.length!==2)return;let[Q,dt]=P,[ht,vt]=f.polygon.points[0],[j,L]=f.polygon.points[1],[$,at,Nt,Lt]=HI(f.polygon,P);if(!$)return;let jt=Q-$[0],G=dt-$[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 it(){let P=f.pointer;if(!P||!lt()||f.slowState.noShape)return;let Q=f.selectedPoints[0],dt=P;if(f.slowState.snapEnabled&&!f.slowState.modifiers.Shift?(vl(P,f,5),dt=xh(P,f)):jI(f),f.line=[f.polygon.points[Q],dt],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=P[0]-f.polygon.points[Q][0],j=P[1]-f.polygon.points[Q][1],L=Math.atan2(j,vt),$=Math.PI/4,at=Math.round((L-ht)/$)*$+ht,Nt=aa(f.polygon.points[Q],P),Lt=Math.cos(at)*Nt+f.polygon.points[Q][0],jt=Math.sin(at)*Nt+f.polygon.points[Q][1];f.line[1]=[Lt,jt]}}function K(){return f.slowState.modifiers}function tt(P){let Q=P.commit([g.lastPress],f,K());u.emit("polygons.end-transition",{transitionIntent:P.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(P){if(!P.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]),P.isValid(Q,f,K())}function xt(P){P==="Delete"&&(P="Backspace");let Q=f.slowState.currentTool;for(let dt of jc)if(!(dt.trigger.type!=="key"||dt.trigger.key!==P)&&dt.tools.includes(Q)&&ut(dt))return tt(dt),!0;return!1}function lt(){let P=f.polygon.points,Q=f.pointer;if(!f.isOpen||!P.length||f.selectedPoints.length!==1||!Q)return!1;let dt=f.selectedPoints[0],ht=dt===0,vt=dt===P.length-1;return ht||vt}let ft={reset(){S({modifiers:{Alt:!1,Shift:!1,Meta:!1,proximity:sv}})},getForType(P){let Q={};if(!P)return Q;let dt=bh[P];return!dt||!dt.modifiers?Q:dt.modifiers},set(P){P!=="Shift"&&P!=="Alt"&&P!=="Meta"||S({modifiers:{...m.nextSlowState?.modifiers||f.slowState.modifiers,[P]:!0}})},unset(P){P!=="Shift"&&P!=="Alt"&&P!=="Meta"||S({modifiers:{...m.nextSlowState?.modifiers||f.slowState.modifiers,[P]:!1}})}},Rt={set(P){let Q=P?P.id==="square"||P.id==="rectangle":!1;S({selectedStamp:P,boxMode:Q})},clear(){Rt.set(null)},square(){Rt.set(ZI)},triangle(){Rt.set(dq)},pentagon(){Rt.set(hq)},hexagon(){Rt.set(pq)},circle(){Rt.set(mq)}},X={down(P){let Q=a[P]||P;if(Q==="Shift"||Q==="Alt"||Q==="Meta")return ft.set(Q),!0;if(Q==="Control")return ft.set("Meta"),!0;if(Q==="z"&&f.slowState.modifiers.Meta)return f.slowState.modifiers.Shift?T():A(),!0;if(!f.slowState.modifiers.Meta&&!f.slowState.modifiers.Alt&&!f.slowState.transitioning){if(!o)return;let dt=Q.toUpperCase();if(d[dt]){let ht=d[dt];return $t(ht),!0}}return xt(Q)},up(P){let Q=a[P]||P;if(Q==="Control"){ft.unset("Meta");return}Q!=="Shift"&&Q!=="Alt"&&Q!=="Meta"||ft.unset(Q)}};function Ct(P){f.scale=P,S({modifiers:{...m.nextSlowState?.modifiers||f.slowState.modifiers,proximity:P*sv}})}function ee(){return sv*f.scale}let ce={set:P=>{m.renderFunc=P},start:(P,Q)=>{m.startTime=performance.now(),m.time=0,P&&(m.renderFunc=P),Q&&(Q(f.slowState),m.setStateFunc=Q),E(0)},stop:()=>{m.animationFrame&&(Sq(m.animationFrame),m.animationFrame=0)},step:(P=16)=>{E(P)}};function le(P){if(!P||!Array.isArray(P)||P.length===0)return;let Q=P[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(P,f,K()),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 dt=m.transitionIntent.start([g.lastPress],f,K());dt&&(dt.selectedPoints&&(f.selectedPoints=dt.selectedPoints,S({selectedPoints:dt.selectedPoints})),(dt.isOpen===!0||dt.isOpen===!1)&&(f.isOpen=dt.isOpen,m.shouldUpdate=!0),dt.points&&(f.polygon.points=dt.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,K()),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(P){f.polygon.points=P?.points||[],f.polygon.boundingBox=null,f.polygon.iedges=null,f.isOpen=P?.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:P===null,shapeId:P?.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),C()}function ri(P){if(!P)return"";let Q=bh[P];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(P){if(f.slowState.isToolSwitchingLocked||f.slowState.currentTool===P||!f.slowState.enabledTools.includes(P))return;let Q=f.slowState.lastCreationTool;if(VI(P)){if(f.slowState.isToolSwitchingLocked)return;Q=P}f.slowState.transitioning&&(f.transitionPoints=null,f.transitionBoundingBox=null,f.transitionDraw=[],f.line=null,f.lineBox=null,S({transitioning:!1}));let dt=B(P),ht=f.selectedPoints,vt=f.isOpen,j=f.slowState.selectedStamp;switch(P){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:dt}),S({currentTool:P,selectedPoints:ht,lastCreationTool:Q,boxMode:P==="box"}),f.selectedPoints=ht,f.isOpen=vt,Mn(P),U()}function Mn(P){let Q=P==="box"||P==="pointer"&&f.polygon.points.length>2&&f.selectedPoints.length===f.polygon.points.length&&!f.isOpen;S({showBoundingBox:Q})}function St(P){f.slowState.currentTool===P&&$t("pointer")}function It(P){f.slowState.currentTool===P?$t("pointer"):$t(P)}let te={undo:A,redo:T,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(P){S({canDelete:P})},setCanDeselect(P){tn(),S({canDeselect:P})},lockToolSwitching(){S({isToolSwitchingLocked:!0})},unlockToolSwitching(){S({isToolSwitchingLocked:!1})},toggleToolSwitching(){S({isToolSwitchingLocked:!f.slowState.isToolSwitchingLocked})},shortcuts:Object.fromEntries(Object.entries(d).map(([P,Q])=>[Q,P])),getValidIntents(P){let Q=P||f.slowState.currentTool;return{actions:vh.filter(dt=>dt.tools.includes(Q)),transitions:Sh.filter(dt=>dt.tools.includes(Q)),keys:jc.filter(dt=>dt.tools.includes(Q)),all:B(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((P,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:P=>{f.snapThreshold=Math.max(5,Math.min(50,P))},isActive:()=>f.isSnapping,getSnapPoint:()=>f.snapPoint,getActiveGuides:()=>f.activeSnapGuides,getTargets:()=>f.snapTargets};function tn(){S({selectedPoints:f.polygon.points.map((P,Q)=>Q)})}function bn(P){S({bounds:P})}return $t(i),{state:f,setState:S,emitter:u,modifiers:ft,stamps:Rt,history:te,key:X,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 qc(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 Sl(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 $I(t){return t.type==="SvgSelector"}function xq(t){return t.type==="BoxSelector"}function cv(t,e){if($I(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 Fc(t,e){if(!t||!t.points.length)return null;if(qc(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 cv({type:"BoxSelector",spatial:{x:a,y:o,width:s,height:u}},e)}return cv({type:"SvgSelector",points:t.points,svgShape:t.open?"polygon":"polyline"},e)}function Eh(t){if(t.type==="polygon"&&!t.noBox&&t.points&&qc(t.points)){let n=Sl({open:!1,points:t.points||[]});return Eh({...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:Sl({points:t.points||[],open:!1}),metadata:{},arguments:t.arguments||{},target:Fc({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:Fc({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 Eq={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 vR({events:t,enabledTools:e,keyboardShortcutMapping:n,keyboardShortcutsEnabled:i=!1,debug:a}){let o=Yi((u,d)=>{let p=null,m=WI({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:Eq,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},C=Eh(g);a&&console.log("requestAnnotation",{response:C,request:g});try{let{points:R=[],open:x=!0}=C.polygon||{},{requestId:A,canvasId:T=null,toolId:M}=v,z=M,D=d(),I=D.validRequestIds.includes(A),q=C.requestType;return a&&console.log("setting points",{requestType:q,points:R,open:x}),!I||D.tool.enabled?null:(m.setShape({id:A,points:R,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:A}),u({polygon:{id:A,points:R,open:x},mode:"sketch",requestType:q,tool:{enabled:!0,requestId:A,canvasId:T},requests:E}),z?D.switchTool[z]?.():R.length===0&&D.switchTool.box(),(typeof g.selectByDefault>"u"&&R.length&&q==="box"||g.selectByDefault)&&D.switchTool.pointer(),new Promise(B=>{let U=it=>{it.id===A&&(u(K=>({mode:"explore",tool:{requestId:null,enabled:!1,canvasId:null},requests:Object.fromEntries(Object.entries(K.requests).filter(([tt])=>tt!==A))})),t.off("atlas.request-cancelled",U),t.off("atlas.annotation-completed",W),B(null))},W=it=>{it.id===A&&(u(K=>({mode:"explore",tool:{requestId:null,enabled:!1,canvasId:null},requests:Object.fromEntries(Object.entries(K.requests).filter(([tt])=>tt!==A))})),t.off("atlas.annotation-completed",W),t.off("atlas.request-cancelled",U),B(it))};t.on("atlas.request-cancelled",U),t.on("atlas.annotation-completed",W)}))}catch(R){return console.error(R),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]||{}:{},C=d().polygonState.bounds,R=d().polygon;R&&(t.emit("atlas.annotation-completed",{id:R.id,polygon:R,requestType:d().requestType,target:Fc(R,C),canvasId:d().tool.canvasId,boundingBox:Sl(R),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 bR=_(Y(),1),Ls=(0,ar.createContext)(null);function Ie(){return(0,ar.useContext)(Ls)}var SR={};function xR(t="atlas"){return SR[t]?.getState()}function Gc({children:t,name:e="atlas",existing:n,atlasStoreConfig:i}){let a=gR(),o=(0,ar.useContext)(Ls),s=(0,ar.useMemo)(()=>n||o||vR({events:a,...i||{}}),[a,n,o]),u=bt(s,d=>d.mode);return(0,ar.useEffect)(()=>{let d=e;return d&&(SR[d]=s),()=>{d&&delete SR[d]}},[s,e]),(0,bR.jsx)(Ls.Provider,{value:s,children:(0,bR.jsx)(Vc.Provider,{value:u||"explore",children:t})})}var rD=_(nt(),1);var kc=_(nt(),1),tD=_(Y(),1);function ER(){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 RR=(0,kc.createContext)(ER());RR.displayName="AnnotationStyle";function Rh(){return(0,kc.useContext)(RR)}function Rq({theme:t,children:e}){let n=(0,kc.useMemo)(()=>t||ER(),[t]);return(0,tD.jsx)(RR.Provider,{value:n,children:e})}var nD=_(nt(),1);var Yc=_(nt(),1);var eD=Fm()((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
- `):o.value;if(p)return{id:u(p,d),type:"CssStylesheet",value:p}}if("id"in o&&o.id){let p=await s(o.id);return{id:o.id,type:"CssStylesheet",value:p}}}return null},async loadStylesheet(o){if(e().loading.includes(o))return"";try{let u=await fetch(o);if(!u.ok)throw new Error(`Failed to load stylesheet from ${o}`);let d=await u.text();return t(p=>({stylesheets:{...p.stylesheets,[o]:d}})),d}catch(u){return t(d=>({errors:[...d.errors,{url:o,error:u}]})),""}},setStylesheet(o,s){let u=s||a(o);return t(d=>({stylesheets:{...d.stylesheets,[u]:o}})),u}}});function AR(t){let[e,n]=(0,Yc.useState)(""),{loading:i,errors:a,stylesheets:o,parseStylesheet:s}=eD();return(0,Yc.useEffect)(()=>{t&&s(t).then(d=>{d?.id&&n(d.id)})},[t,s]),[(0,Yc.useMemo)(()=>{let d={};return e&&o[e]&&(d[e]=o[e]),d},[e,o]),{id:e,stylesheets:o,loading:i,errors:a}]}function Ah(t={},e=[]){let{id:n,selector:i}=t,a=ti(),o=Vt(),s=n||a.annotation,u=re(f=>s?f.iiif.entities.Annotation[s]:void 0,[s]),[d]=AR(u?.stylesheet),p=re(f=>u&&u.body?u.body.map(m=>m?m.type==="SpecificResource"?{...m,source:o.get(m)}:m?f.iiif.entities[m.type][m.id]:null:null).filter(Boolean):[],[u]);return(0,nD.useMemo)(()=>{if(!u)return;let f={...u,body:p,target:an(u.target,{typeMap:o.getState().iiif.mapping,loadedStylesheets:d})};return i?i(f):f},[u,i,p,d,...e])}var iD=_(nt(),1);function zt(t={},e=[]){let{id:n,selector:i}=t,a=ti(),o=n||a.canvas,s=re(u=>o?u.iiif.entities.Canvas[o]:void 0,[o]);return(0,iD.useMemo)(()=>{if(s)return i?i(s):s},[s,i,...e])}var TR=_(nt(),1);function Th(t=Bo){return{addEventListener(e,n,i,a){if(e)return t.setMetaValue([e.id,"eventManager",n],o=>{let s=o||[];for(let u of s)if(u.callback===i)return s;return[...s,{callback:i,scope:a}]}),i},removeEventListener(e,n,i){e&&t.setMetaValue([e.id,"eventManager",n],a=>(a||[]).filter(o=>o.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"),o={};if(a&&i)for(let s of Object.keys(a))o[s]=u=>{let d=t.get(i);for(let{callback:p,scope:f}of a[s]||[])(!f||n&&f.indexOf(n)!==-1)&&p(u,d)};return o}}}function Ch(t,e){let n=Vt(),i=(0,TR.useMemo)(()=>Th(n),[n]),a=re(()=>t&&t.id?n.getResourceMeta(t.id,"eventManager"):null,[t]);return(0,TR.useMemo)(()=>t?i.getListenersAsProps(t,e):{},[a,t,n,e])}var aD=_(nt(),1);function bl(t=Bo){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 Ps(t,e){let n=Vt(),i=(0,aD.useMemo)(()=>bl(n),[n]);return re(()=>{if(!t)return null;let a=i.getAppliedStyles(t.id);return a?e?a[e]:a:void 0},[t,e])}var oD=_(nt(),1);var go=_(nt(),1),yn=_(Y(),1);function CR({handleSize:t,resizable:e,onSave:n,children:i,maintainAspectRatio:a,disableCardinalControls:o,aspectRatio:s,...u}){let d=typeof t>"u"?a?12:8:t,{portalRef:p,mode:f,mouseEvent:m,isEditing:g}=LI({x:u.x||0,y:u.y||0,width:u.width,height:u.height,aspectRatio:s,maintainAspectRatio:a},n),v=(0,go.useMemo)(()=>m("translate"),[m]),S=(0,go.useMemo)(()=>m("east"),[m]),E=(0,go.useMemo)(()=>m("west"),[m]),C=(0,go.useMemo)(()=>m("south"),[m]),R=(0,go.useMemo)(()=>m("north"),[m]),x=(0,go.useMemo)(()=>m("south-east"),[m]),A=(0,go.useMemo)(()=>m("south-west"),[m]),T=(0,go.useMemo)(()=>m("north-east"),[m]),M=(0,go.useMemo)(()=>m("north-west"),[m]),z=f==="sketch",D={zIndex:999,boxShadow:"0px 2px 3px 0 rgba(0,0,0,0.2)",outline:"2px solid rgba(155,155,155,.7)",borderRadius:a||o?"50%":2,position:"absolute",background:"#fff",pointerEvents:g?"none":z?"initial":"none"};return(0,yn.jsx)(yn.Fragment,{children:(0,yn.jsxs)("world-object",{...u,children:[i,z&&e?(0,yn.jsx)(_i,{ref:p,target:{x:0,y:0,height:u.height,width:u.width},relative:!0,interactive:!1,children:z&&e?(0,yn.jsxs)(yn.Fragment,{children:[(0,yn.jsx)("div",{onMouseDown:v,onTouchStart:v,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:g?"none":z?"initial":"none"}}),a?null:(0,yn.jsxs)(yn.Fragment,{children:[(0,yn.jsx)("div",{title:"east",onTouchStart:S,onMouseDown:S,style:{...D,cursor:"e-resize",height:d*2,width:d,right:0,top:"50%",opacity:o?0:1,transform:`translate(${d/2}px, -${d}px)`}}),(0,yn.jsx)("div",{title:"west",onMouseDown:E,style:{...D,cursor:"w-resize",position:"absolute",height:d*2,width:d,left:0,top:"50%",opacity:o?0:1,transform:`translate(-${d/2}px, -${d}px)`}}),(0,yn.jsx)("div",{title:"north",onMouseDown:R,style:{...D,cursor:"n-resize",position:"absolute",height:d,width:d*2,left:"50%",top:0,opacity:o?0:1,transform:`translate(-${d}px, -${d/2}px)`}}),(0,yn.jsx)("div",{title:"south",onMouseDown:C,style:{...D,cursor:"s-resize",position:"absolute",height:d,width:d*2,left:"50%",bottom:0,opacity:o?0:1,transform:`translate(-${d}px, ${d/2}px)`}})]}),(0,yn.jsx)("div",{title:"north-east",onMouseDown:T,style:{...D,cursor:"ne-resize",position:"absolute",height:d,width:d,right:0,top:0,transform:`translate(${d/2}px, -${d/2}px)`}}),(0,yn.jsx)("div",{title:"south-east",onMouseDown:x,style:{...D,cursor:"se-resize",position:"absolute",height:d,width:d,bottom:0,right:0,transform:`translate(${d/2}px, ${d/2}px)`}}),(0,yn.jsx)("div",{title:"south-west",onMouseDown:A,style:{...D,cursor:"sw-resize",position:"absolute",height:d,width:d,bottom:0,left:0,transform:`translate(-${d/2}px, ${d/2}px)`}}),(0,yn.jsx)("div",{title:"north-west",onMouseDown:M,style:{...D,cursor:"nw-resize",position:"absolute",height:d,width:d,top:0,left:0,transform:`translate(-${d/2}px, -${d/2}px)`}})]}):null}):null]})})}var wR=_(Y(),1);function MR({id:t,interactive:e,region:n,onClick:i,onHover:a,onSave:o,aspectRatio:s,maintainAspectRatio:u,disableCardinalControls:d,isEditing:p,style:f={backgroundColor:"rgba(0,0,0,.5)"}}){let m=(0,oD.useCallback)(g=>{p&&o?.({id:n.id,x:n.x,y:n.y,height:n.height,width:n.width,...g})},[o,p,n.id,n.x,n.y,n.height,n.width]);return(0,wR.jsx)(CR,{id:t,x:n.x,y:n.y,width:n.width,aspectRatio:s,height:n.height,resizable:p,onSave:m,maintainAspectRatio:u,disableCardinalControls:d,children:(0,wR.jsx)("box",{interactive:e,onClick:g=>{g.preventDefault(),g.stopPropagation(),i?.(n)},relativeStyle:!0,onMouseEnter:()=>{a?.(n)},target:{x:0,y:0,width:n.width,height:n.height},style:f})})}var lD=_(Y(),1),Bs=({id:t,style:e,className:n,interactive:i,targetId:a,ignoreTargetId:o})=>{let s=Ah({id:t}),u=Ps(s,"atlas"),d=Ps(s,"html"),p=Ch(s,["atlas"]),f=zt(),m=Rh(),g=(0,rD.useMemo)(()=>gh(gh(gh(gh(e,u),s?.motivation?.includes("highlighting")?m.highlighted:m.default),s?.target?.selector?.boxStyle||{})),[e,u,m,s?.motivation,s?.target]),v=a||f?.id;return f&&s&&s.target&&s.target.selector&&(s.target.selector.type==="BoxSelector"||s.target.selector.type==="SvgSelector")&&s.target.source&&(o?!0:s.target.source.id===v||s.target.source===v)?(0,lD.jsx)(MR,{id:s.id,isEditing:!0,region:s.target.selector.spatial,style:g,className:d?.className||n,interactive:!!(d?.href||i),href:d?.href||null,title:d?.title||null,hrefTarget:d?.target||null,onClick:()=>{},...p}):null};var uD=_(nt(),1);var sD=_(nt(),1);function OR(t={},e=[]){let{id:n,selector:i}=t,a=ti(),o=n||a.annotationPage,s=re(u=>o?u.iiif.entities.AnnotationPage[o]:void 0,[o]);return(0,sD.useMemo)(()=>{if(s)return i?i(s):s},[s,...e])}var _R=_(Y(),1),xl=({className:t,page:e,targetId:n,ignoreTargetId:i})=>{let a=OR({id:e.id})||e,o=Ps(a,"atlas"),s=Ps(a,"html");return re(u=>a.id?u.iiif.entities.AnnotationPage[a.id]:null,[]),(0,_R.jsx)(uD.Fragment,{children:a.items?.map(u=>(0,_R.jsx)(Bs,{id:u.id,style:o,className:s?.className||t,targetId:n,ignoreTargetId:i},u.id))})};var El=_(nt(),1),fv=_(Y(),1),cD=(0,El.createContext)(null),fD=(0,El.createContext)(null),dD=(0,El.createContext)(null);function Aq(){let t=(0,El.useContext)(cD);if(!t)throw new Error("Ctx not found");return t}function Tq(){let t=(0,El.useContext)(fD);if(!t)throw new Error("Ctx not found");return t}function Cq(){let t=(0,El.useContext)(dD);if(!t)throw new Error("Ctx not found");return t}function wh({actions:t,state:e,children:n,currentTime:i,progress:a,element:o}){return(0,fv.jsx)(dD.Provider,{value:{currentTime:i,progress:a,element:o},children:(0,fv.jsx)(fD.Provider,{value:t,children:(0,fv.jsx)(cD.Provider,{value:e,children:n})})})}var mD=_(nt(),1);function hD(t,e,n=[],i=!1,a=[]){if(a.length&&(e=e.filter(s=>a.indexOf(s)===-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 o=t.indexOf("-")===-1?null:t.slice(0,t.indexOf("-"));if(o&&e.indexOf(o)!==-1)return o;for(let s of n)if(e.indexOf(s)!==-1)return s;if(!i&&t){let s=e.map(d=>d.indexOf("-")===-1?null:d.slice(0,d.indexOf("-"))),u=s.indexOf(t);if(u!==-1)return e[u];for(let d of n){let p=d.indexOf("-")===-1?null:d.slice(0,d.indexOf("-")),f=p?e.indexOf(p):-1;if(f!==-1)return e[f]}}return e.indexOf("none")===-1?e.indexOf("@none")===-1?e[0]:"@none":"none"}function zR(t,e,n={}){let{strictFallback:i=!1,defaultText:a="",separator:o=`
87
- `,fallbackLanguages:s=[],closest:u,skipLanguages:d}=n,p=Object.keys(t||{}),f=u?e:hD(e,p,s,i,d);if(!t)return a;if(typeof t=="string")return t;let m=f?t[f]:void 0;if(m&&f){if(typeof m=="string")return m;if(m.length===1&&m[0]===""){let g=n.skipLanguages||[];return zR(t,e,{...n,skipLanguages:[...g,f]})}return m.join(o)}return""}function dv(t,e={}){return zR(t,e.language||(typeof navigator<"u"?navigator.language:"en"),e)}var wq=pD();function pD(t={}){return(e,...n)=>{let i="";for(let a=0;a<e.length;a++)if(i+=e[a],a<n.length){let o=n[a];if(o==null)continue;typeof o=="string"?i+=o:i+=dv(o,t)}return i}}function NR(t){return t.type==="SpecificResource"?[t.source,{selector:t.selector}]:[t,{selector:null}]}function Qc(t=Bo){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}]=NR(g),E=t.get(v),C=(E.type||"unknown").toLowerCase();if(C==="choice"){let R=t.get(E.items,{parent:E.id}),x=o.length?o.map(A=>R.find(T=>T.id===A)).filter(Boolean):[R[0]];x.length===0&&x.push(R[0]),d.items.push({type:"single-choice",items:R.map(A=>({id:A.id,label:A.label,selected:x.indexOf(A)!==-1})),label:v.label}),m.push(...x);continue}u.indexOf(C)===-1&&u.push(C),p.push({type:C,annotationId:f.id,annotation:f,resource:E,target:f.target,selector:S})}}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 Mh(){let t=on(),e=zt();return(0,mD.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 gD(t){return{isMuted:!1,playRequested:!1,isPlaying:!1,isFinished:!1,volume:100,duration:t}}function Mq(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 hv(t){let e=Math.round(t);return`${Math.floor(e/60)}:${`${e%60}`.padStart(2,"0")}`}function Hs(t){let[e,n]=(0,$e.useReducer)(Mq,gD(t.duration));(0,$e.useEffect)(()=>{n({type:"RESET",state:gD(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=hv(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)(R=>{i.current&&(i.current.muted=!1,i.current.volume=R/100,n({type:"SET_VOLUME",volume:R}))},[]),E=(0,$e.useCallback)(R=>{i.current&&(i.current.currentTime=Math.max(0,Math.min(R*t.duration,t.duration)),u())},[]),C=(0,$e.useCallback)(R=>{if(i.current){let x=typeof R=="function"?R(i.current.currentTime):R;i.current.currentTime=Math.max(0,Math.min(x,t.duration)),u()}},[]);return(0,$e.useEffect)(()=>{let R=setInterval(()=>{u()},350);return()=>clearInterval(R)},[u,t.duration]),(0,$e.useEffect)(()=>{let R=()=>{n({type:"FINISHED"})},x=i.current;return x?.addEventListener("ended",R),()=>x?.removeEventListener("ended",R)},[]),[{element:i,currentTime:a,progress:o},e,{play:d,pause:f,playPause:p,mute:g,unmute:v,toggleMute:m,setVolume:S,setDurationPercent:E,setTime:C}]}var Us=_(nt(),1),IR=(0,Us.createContext)(()=>{}),DR=(0,Us.createContext)(()=>{});function Xn(t,e,n,i,a=[]){let o=(0,Us.useContext)(t==="portal"?DR:IR);(0,Us.useEffect)(()=>(t!=="none"&&o(e,n,i),()=>{o(e,null)}),[e,t,o,...a])}var mv=_(Y(),1);function LR({media:t,startTime:e,children:n}){let[{element:i,currentTime:a,progress:o},s,u]=Hs({duration:t.duration}),d=e?`${t.url}#t=${e}`:t.url;return(0,mv.jsxs)(wh,{state:s,actions:u,currentTime:a,progress:o,element:i,children:[(0,mv.jsx)("audio",{ref:i,src:d}),n]},t.url)}function pv({media:t,mediaControlsDeps:e,audioCopmonent:n=LR,children:i}){let a=Mh();return Xn("portal","audio",n,{media:t,startTime:a?a.startTime:null,children:i},[t,a,...e||[]]),null}var gv=_(nt(),1),Rl=(0,gv.createContext)(null);Rl.displayName="Strategy";function Fe(){let t=(0,gv.useContext)(Rl);if(!t)throw new Error("useStrategy must be used within a StrategyProvider");return t}var Al=_(Y(),1);function PR({model:t}){return(0,Al.jsxs)(Al.Fragment,{children:[(0,Al.jsx)("style",{children:`
85
+ `}),i]})}),cv=()=>(0,st.useContext)(sv),fv=()=>{let t=cv();return t?t.runtime:void 0};var XI=(t,e=[])=>{let n=fv();(0,st.useEffect)(()=>n?n.registerHook("useFrame",t):()=>{},e)},dv=()=>{let t=cv();return t&&t.canvas?t.canvas:void 0};function qj(){return(0,st.useContext)(uv)}async function Fj(t,e,n){if(st.version.startsWith("18.")||st.version.startsWith("19.")){let i=await Promise.resolve().then(()=>_(mI(),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=fv(),o=(0,st.useRef)(0),s=(0,st.useRef)(),u=(0,st.useRef)();return XI(()=>{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 Fj(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 MI=(t,e,n=[])=>{let i=fv();(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 OI(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,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 KI=(t,e)=>{let n=Tj(),i=fv(),a=qj(),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=Gj(),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]=OI(x.east,x.west);x.west+=N*q,x.east-=N*D}else{let N=z-M/S,[D,q]=OI(x.north,x.south);x.north+=N*D,x.south-=N*q}},[t.width,t.height,S]);XI(()=>{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]);MI("mousemove",T,[t.width,t.height,a]),MI("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),ZI=_(Y(),1),kj=ka(),hv=(0,Bs.createContext)(kj);function Yj({children:t,emitter:e}){return(0,ZI.jsx)(hv.Provider,{value:e,children:t})}function wA(){return(0,Bs.useContext)(hv)}function Ps(t,e,n=[]){let i=(0,Bs.useContext)(hv);(0,Bs.useEffect)(()=>{let a=o=>{e(o)};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 Xj(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 Kj(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 Zj(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}=Xj(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=Kj(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 Wj(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 Jj(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=Zj(t,e,void 0);if(a.length===0)return e.snapTargets=[],e.activeSnapGuides=[],e.isSnapping=!1,e.snapPoint=null,null;let o=Wj(a);return e.snapTargets=o,e.activeSnapGuides=Jj(o.slice(0,n),e),e.isSnapping=!0,e.snapPoint=o[0].point,e.snapPoint}function eD(t){t.snapTargets=[],t.activeSnapGuides=[],t.isSnapping=!1,t.snapPoint=null}function $j(t){return t.isSnapping&&t.snapPoint!==null}function Th(t,e){return $j(e)&&e.snapPoint?e.snapPoint:t}var t7={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 WI(t,e){return Math.abs(t-e)}function aa(t,e){let n=WI(t[0],e[0]),i=WI(t[1],e[1]);return Math.sqrt(n**2+i**2)}function MA(t,e){return[t[0]-e[0],t[1]-e[1]]}function e7(t,e){return t[0]*e[0]+t[1]*e[1]}function nD(t){return t[0]*t[0]+t[1]*t[1]}function pv(t,e){return nD(MA(t,e))}function iD(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 aD(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=MA(n[1],n[0]);let z=nD(i),N,D,q,P,U;for(let J=T+1;J<A;J++)N=MA(E[J],n[0]),P=e7(N,i),P<=0?U=pv(E[J],n[0]):z<=P?U=pv(E[J],n[1]):(q=P/z,D=[n[0][0]+q*i[0],n[0][1]+q*i[1]],U=pv(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++)pv(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 n7(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 oD(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 i7(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 gv(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 a7(t){return t[0]*t[0]+t[1]*t[1]}function JI(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&&(oD(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=a7([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,gv({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};gv(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}}},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"}:{}}},rD={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}}},r7={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 rD.commit(t,e,n)}},lD={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}}},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:lD.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}}},s7={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}}},u7={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:[]}}},c7={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:[]}}},d7={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=aD(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}}},h7={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]=iD(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}}},p7={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]=i7(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}}},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,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]=iD(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}}},uD={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}}},m7={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)}}},g7={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)}}},y7={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})}}},v7={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})}}},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],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}}}},$I=10,b7={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<$I*$I)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}}},x7={type:"select-shape",label:"Select shape",trigger:{type:"click"},tools:["pointer","pen"],isValid(t,e,n){return uD.isValid(t,e,n)},commit(t,e,n){return{tool:"pointer",selectedPoints:e.polygon.points.map((i,a)=>a)}}},E7={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){eD(e)}},A7={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}}},cD={id:"square",open:!1,points:[[0,0],[0,100],[100,100],[100,0]]},R7={id:"triangle",open:!1,points:[[50,0],[0,100],[100,100]]},T7={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]]},w7={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]]},M7={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||cD;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};gv(A),e.transitionBoundingBox=A.boundingBox},commit(t,e,n){return{isOpen:!1,points:e.transitionPoints,tool:"pointer"}}},O7={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 fD(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",aD(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 _7=typeof window<"u"?window.requestAnimationFrame:t=>setTimeout(t,16),z7=typeof window<"u"?window.cancelAnimationFrame:t=>clearTimeout(t);function tD(t){return!["hand","pointer"].includes(t)}var Ah=[xh,p7,h7,lD,uD,sD,d7,S7,M7,E7],N7=Ah.length,Eh=[o7,A7,rD,b7,r7,l7,t7,x7,u7,f7],kc=[c7,m7,g7,y7,v7,s7,O7],Rh={};Ah.forEach(t=>{Rh[t.type]=t});Eh.forEach(t=>{Rh[t.type]=t});kc.forEach(t=>{Rh[t.type]=t});var mv=10;function dD(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||Qj(),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:mv},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:tD(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){oD(B),B.isBezier&&S({bezierLines:B.bezierLines}),gv(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=_7(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:n7(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]=JI(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<N7;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]=JI(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)):eD(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:mv}})},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(cD)},triangle(){Rt.set(R7)},pentagon(){Rt.set(T7)},hexagon(){Rt.set(C7)},circle(){Rt.set(w7)}},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*mv}})}function ee(){return mv*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&&(z7(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(tD(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 hD(t){return t.type==="SvgSelector"}function I7(t){return t.type==="BoxSelector"}function yv(t,e){if(hD(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 yv({type:"BoxSelector",spatial:{x:a,y:o,width:s,height:u}},e)}return yv({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 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 OA({events:t,enabledTools:e,keyboardShortcutMapping:n,keyboardShortcutsEnabled:i=!1,debug:a}){let o=Yi((u,d)=>{let p=null,m=dD({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:D7,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 zA=_(Y(),1),Hs=(0,ar.createContext)(null);function Ie(){return(0,ar.useContext)(Hs)}var _A={};function NA(t="atlas"){return _A[t]?.getState()}function Xc({children:t,name:e="atlas",existing:n,atlasStoreConfig:i}){let a=wA(),o=(0,ar.useContext)(Hs),s=(0,ar.useMemo)(()=>n||o||OA({events:a,...i||{}}),[a,n,o]),u=bt(s,d=>d.mode);return(0,ar.useEffect)(()=>{let d=e;return d&&(_A[d]=s),()=>{d&&delete _A[d]}},[s,e]),(0,zA.jsx)(Hs.Provider,{value:s,children:(0,zA.jsx)(Gc.Provider,{value:u||"explore",children:t})})}var bD=_(nt(),1);var Kc=_(nt(),1),pD=_(Y(),1);function IA(){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 DA=(0,Kc.createContext)(IA());DA.displayName="AnnotationStyle";function wh(){return(0,Kc.useContext)(DA)}function L7({theme:t,children:e}){let n=(0,Kc.useMemo)(()=>t||IA(),[t]);return(0,pD.jsx)(DA.Provider,{value:n,children:e})}var gD=_(nt(),1);var Zc=_(nt(),1);var mD=Zm()((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
+ `):o.value;if(p)return{id:u(p,d),type:"CssStylesheet",value:p}}if("id"in o&&o.id){let p=await s(o.id);return{id:o.id,type:"CssStylesheet",value:p}}}return null},async loadStylesheet(o){if(e().loading.includes(o))return"";try{let u=await fetch(o);if(!u.ok)throw new Error(`Failed to load stylesheet from ${o}`);let d=await u.text();return t(p=>({stylesheets:{...p.stylesheets,[o]:d}})),d}catch(u){return t(d=>({errors:[...d.errors,{url:o,error:u}]})),""}},setStylesheet(o,s){let u=s||a(o);return t(d=>({stylesheets:{...d.stylesheets,[u]:o}})),u}}});function LA(t){let[e,n]=(0,Zc.useState)(""),{loading:i,errors:a,stylesheets:o,parseStylesheet:s}=mD();return(0,Zc.useEffect)(()=>{t&&s(t).then(d=>{d?.id&&n(d.id)})},[t,s]),[(0,Zc.useMemo)(()=>{let d={};return e&&o[e]&&(d[e]=o[e]),d},[e,o]),{id:e,stylesheets:o,loading:i,errors:a}]}function Mh(t={},e=[]){let{id:n,selector:i}=t,a=ti(),o=Vt(),s=n||a.annotation,u=re(f=>s?f.iiif.entities.Annotation[s]:void 0,[s]),[d]=LA(u?.stylesheet),p=re(f=>u&&u.body?u.body.map(m=>m?m.type==="SpecificResource"?{...m,source:o.get(m)}:m?f.iiif.entities[m.type][m.id]:null:null).filter(Boolean):[],[u]);return(0,gD.useMemo)(()=>{if(!u)return;let f={...u,body:p,target:an(u.target,{typeMap:o.getState().iiif.mapping,loadedStylesheets:d})};return i?i(f):f},[u,i,p,d,...e])}var yD=_(nt(),1);function zt(t={},e=[]){let{id:n,selector:i}=t,a=ti(),o=n||a.canvas,s=re(u=>o?u.iiif.entities.Canvas[o]:void 0,[o]);return(0,yD.useMemo)(()=>{if(s)return i?i(s):s},[s,i,...e])}var BA=_(nt(),1);function Oh(t=Po){return{addEventListener(e,n,i,a){if(e)return t.setMetaValue([e.id,"eventManager",n],o=>{let s=o||[];for(let u of s)if(u.callback===i)return s;return[...s,{callback:i,scope:a}]}),i},removeEventListener(e,n,i){e&&t.setMetaValue([e.id,"eventManager",n],a=>(a||[]).filter(o=>o.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"),o={};if(a&&i)for(let s of Object.keys(a))o[s]=u=>{let d=t.get(i);for(let{callback:p,scope:f}of a[s]||[])(!f||n&&f.indexOf(n)!==-1)&&p(u,d)};return o}}}function _h(t,e){let n=Vt(),i=(0,BA.useMemo)(()=>Oh(n),[n]),a=re(()=>t&&t.id?n.getResourceMeta(t.id,"eventManager"):null,[t]);return(0,BA.useMemo)(()=>t?i.getListenersAsProps(t,e):{},[a,t,n,e])}var vD=_(nt(),1);function El(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 Us(t,e){let n=Vt(),i=(0,vD.useMemo)(()=>El(n),[n]);return re(()=>{if(!t)return null;let a=i.getAppliedStyles(t.id);return a?e?a[e]:a:void 0},[t,e])}var SD=_(nt(),1);var go=_(nt(),1),yn=_(Y(),1);function PA({handleSize:t,resizable:e,onSave:n,children:i,maintainAspectRatio:a,disableCardinalControls:o,aspectRatio:s,...u}){let d=typeof t>"u"?a?12:8:t,{portalRef:p,mode:f,mouseEvent:m,isEditing:g}=KI({x:u.x||0,y:u.y||0,width:u.width,height:u.height,aspectRatio:s,maintainAspectRatio:a},n),v=(0,go.useMemo)(()=>m("translate"),[m]),S=(0,go.useMemo)(()=>m("east"),[m]),E=(0,go.useMemo)(()=>m("west"),[m]),T=(0,go.useMemo)(()=>m("south"),[m]),A=(0,go.useMemo)(()=>m("north"),[m]),x=(0,go.useMemo)(()=>m("south-east"),[m]),R=(0,go.useMemo)(()=>m("south-west"),[m]),C=(0,go.useMemo)(()=>m("north-east"),[m]),M=(0,go.useMemo)(()=>m("north-west"),[m]),z=f==="sketch",N={zIndex:999,boxShadow:"0px 2px 3px 0 rgba(0,0,0,0.2)",outline:"2px solid rgba(155,155,155,.7)",borderRadius:a||o?"50%":2,position:"absolute",background:"#fff",pointerEvents:g?"none":z?"initial":"none"};return(0,yn.jsx)(yn.Fragment,{children:(0,yn.jsxs)("world-object",{...u,children:[i,z&&e?(0,yn.jsx)(_i,{ref:p,target:{x:0,y:0,height:u.height,width:u.width},relative:!0,interactive:!1,children:z&&e?(0,yn.jsxs)(yn.Fragment,{children:[(0,yn.jsx)("div",{onMouseDown:v,onTouchStart:v,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:g?"none":z?"initial":"none"}}),a?null:(0,yn.jsxs)(yn.Fragment,{children:[(0,yn.jsx)("div",{title:"east",onTouchStart:S,onMouseDown:S,style:{...N,cursor:"e-resize",height:d*2,width:d,right:0,top:"50%",opacity:o?0:1,transform:`translate(${d/2}px, -${d}px)`}}),(0,yn.jsx)("div",{title:"west",onMouseDown:E,style:{...N,cursor:"w-resize",position:"absolute",height:d*2,width:d,left:0,top:"50%",opacity:o?0:1,transform:`translate(-${d/2}px, -${d}px)`}}),(0,yn.jsx)("div",{title:"north",onMouseDown:A,style:{...N,cursor:"n-resize",position:"absolute",height:d,width:d*2,left:"50%",top:0,opacity:o?0:1,transform:`translate(-${d}px, -${d/2}px)`}}),(0,yn.jsx)("div",{title:"south",onMouseDown:T,style:{...N,cursor:"s-resize",position:"absolute",height:d,width:d*2,left:"50%",bottom:0,opacity:o?0:1,transform:`translate(-${d}px, ${d/2}px)`}})]}),(0,yn.jsx)("div",{title:"north-east",onMouseDown:C,style:{...N,cursor:"ne-resize",position:"absolute",height:d,width:d,right:0,top:0,transform:`translate(${d/2}px, -${d/2}px)`}}),(0,yn.jsx)("div",{title:"south-east",onMouseDown:x,style:{...N,cursor:"se-resize",position:"absolute",height:d,width:d,bottom:0,right:0,transform:`translate(${d/2}px, ${d/2}px)`}}),(0,yn.jsx)("div",{title:"south-west",onMouseDown:R,style:{...N,cursor:"sw-resize",position:"absolute",height:d,width:d,bottom:0,left:0,transform:`translate(-${d/2}px, ${d/2}px)`}}),(0,yn.jsx)("div",{title:"north-west",onMouseDown:M,style:{...N,cursor:"nw-resize",position:"absolute",height:d,width:d,top:0,left:0,transform:`translate(-${d/2}px, -${d/2}px)`}})]}):null}):null]})})}var HA=_(Y(),1);function UA({id:t,interactive:e,region:n,onClick:i,onHover:a,onSave:o,aspectRatio:s,maintainAspectRatio:u,disableCardinalControls:d,isEditing:p,style:f={backgroundColor:"rgba(0,0,0,.5)"}}){let m=(0,SD.useCallback)(g=>{p&&o?.({id:n.id,x:n.x,y:n.y,height:n.height,width:n.width,...g})},[o,p,n.id,n.x,n.y,n.height,n.width]);return(0,HA.jsx)(PA,{id:t,x:n.x,y:n.y,width:n.width,aspectRatio:s,height:n.height,resizable:p,onSave:m,maintainAspectRatio:u,disableCardinalControls:d,children:(0,HA.jsx)("box",{interactive:e,onClick:g=>{g.preventDefault(),g.stopPropagation(),i?.(n)},relativeStyle:!0,onMouseEnter:()=>{a?.(n)},target:{x:0,y:0,width:n.width,height:n.height},style:f})})}var xD=_(Y(),1),Vs=({id:t,style:e,className:n,interactive:i,targetId:a,ignoreTargetId:o})=>{let s=Mh({id:t}),u=Us(s,"atlas"),d=Us(s,"html"),p=_h(s,["atlas"]),f=zt(),m=wh(),g=(0,bD.useMemo)(()=>bh(bh(bh(bh(e,u),s?.motivation?.includes("highlighting")?m.highlighted:m.default),s?.target?.selector?.boxStyle||{})),[e,u,m,s?.motivation,s?.target]),v=a||f?.id;return f&&s&&s.target&&s.target.selector&&(s.target.selector.type==="BoxSelector"||s.target.selector.type==="SvgSelector")&&s.target.source&&(o?!0:s.target.source.id===v||s.target.source===v)?(0,xD.jsx)(UA,{id:s.id,isEditing:!0,region:s.target.selector.spatial,style:g,className:d?.className||n,interactive:!!(d?.href||i),href:d?.href||null,title:d?.title||null,hrefTarget:d?.target||null,onClick:()=>{},...p}):null};var AD=_(nt(),1);var ED=_(nt(),1);function VA(t={},e=[]){let{id:n,selector:i}=t,a=ti(),o=n||a.annotationPage,s=re(u=>o?u.iiif.entities.AnnotationPage[o]:void 0,[o]);return(0,ED.useMemo)(()=>{if(s)return i?i(s):s},[s,...e])}var jA=_(Y(),1),Al=({className:t,page:e,targetId:n,ignoreTargetId:i})=>{let a=VA({id:e.id})||e,o=Us(a,"atlas"),s=Us(a,"html");return re(u=>a.id?u.iiif.entities.AnnotationPage[a.id]:null,[]),(0,jA.jsx)(AD.Fragment,{children:a.items?.map(u=>(0,jA.jsx)(Vs,{id:u.id,style:o,className:s?.className||t,targetId:n,ignoreTargetId:i},u.id))})};var Rl=_(nt(),1),vv=_(Y(),1),RD=(0,Rl.createContext)(null),TD=(0,Rl.createContext)(null),CD=(0,Rl.createContext)(null);function B7(){let t=(0,Rl.useContext)(RD);if(!t)throw new Error("Ctx not found");return t}function P7(){let t=(0,Rl.useContext)(TD);if(!t)throw new Error("Ctx not found");return t}function H7(){let t=(0,Rl.useContext)(CD);if(!t)throw new Error("Ctx not found");return t}function zh({actions:t,state:e,children:n,currentTime:i,progress:a,element:o}){return(0,vv.jsx)(CD.Provider,{value:{currentTime:i,progress:a,element:o},children:(0,vv.jsx)(TD.Provider,{value:t,children:(0,vv.jsx)(RD.Provider,{value:e,children:n})})})}var OD=_(nt(),1);function wD(t,e,n=[],i=!1,a=[]){if(a.length&&(e=e.filter(s=>a.indexOf(s)===-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 o=t.indexOf("-")===-1?null:t.slice(0,t.indexOf("-"));if(o&&e.indexOf(o)!==-1)return o;for(let s of n)if(e.indexOf(s)!==-1)return s;if(!i&&t){let s=e.map(u=>u.indexOf("-")===-1?null:u.slice(0,u.indexOf("-"))).indexOf(t);if(s!==-1)return e[s];for(let u of n){let d=u.indexOf("-")===-1?null:u.slice(0,u.indexOf("-")),p=d?e.indexOf(d):-1;if(p!==-1)return e[p]}}return e.indexOf("none")===-1?e.indexOf("@none")===-1?e[0]:"@none":"none"}function qA(t,e,n={}){let{strictFallback:i=!1,defaultText:a="",separator:o=`
87
+ `,fallbackLanguages:s=[],closest:u,skipLanguages:d}=n,p=u?e:wD(e,Object.keys(t||{}),s,i,d);if(!t)return a;if(typeof t=="string")return t;let f=p?t[p]:void 0;if(f&&p){if(typeof f=="string")return f;if(f.length===1&&f[0]===""){let m=n.skipLanguages||[];return qA(t,e,{...n,skipLanguages:[...m,p]})}return f.join(o)}return""}function Sv(t,e={}){return qA(t,e.language||(typeof navigator<"u"?navigator.language:"en"),e)}var U7=MD();function MD(t={}){return(e,...n)=>{let i="";for(let a=0;a<e.length;a++)if(i+=e[a],a<n.length){let o=n[a];if(o==null)continue;typeof o=="string"?i+=o:i+=Sv(o,t)}return i}}function FA(t){return t.type==="SpecificResource"?[t.source,{selector:t.selector,...t.styleClass?{styleClass:t.styleClass}:{}}]:[t,{selector:null}]}function V7(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(`
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}]=FA(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?V7(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,OD.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 _D(t){return{isMuted:!1,playRequested:!1,isPlaying:!1,isFinished:!1,volume:100,duration:t}}function j7(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 bv(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)(j7,_D(t.duration));(0,$e.useEffect)(()=>{n({type:"RESET",state:_D(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=bv(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),GA=(0,qs.createContext)(()=>{}),kA=(0,qs.createContext)(()=>{});function Xn(t,e,n,i,a=[]){let o=(0,qs.useContext)(t==="portal"?kA:GA);(0,qs.useEffect)(()=>(t!=="none"&&o(e,n,i),()=>{o(e,null)}),[e,t,o,...a])}var Ev=_(Y(),1);function YA({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,Ev.jsxs)(zh,{state:s,actions:u,currentTime:a,progress:o,element:i,children:[(0,Ev.jsx)("audio",{ref:i,src:d}),n]},t.url)}function xv({media:t,mediaControlsDeps:e,audioCopmonent:n=YA,children:i}){let a=Nh();return Xn("portal","audio",n,{media:t,startTime:a?a.startTime:null,children:i},[t,a,...e||[]]),null}var Av=_(nt(),1),Tl=(0,Av.createContext)(null);Tl.displayName="Strategy";function Fe(){let t=(0,Av.useContext)(Tl);if(!t)throw new Error("useStrategy must be used within a StrategyProvider");return t}var Cl=_(Y(),1);function QA({model:t}){return(0,Cl.jsxs)(Cl.Fragment,{children:[(0,Cl.jsx)("style",{children:`
88
89
  .model-container {
89
90
  position: absolute;
90
91
  top: 0;
@@ -97,10 +98,10 @@ Error generating stack: `+i.message+`
97
98
  justify-content: center;
98
99
  pointer-events: visible;
99
100
  }
100
- `}),(0,Al.jsx)("div",{className:"model-container",children:(0,Al.jsx)("model-viewer",{"interaction-prompt":"none",style:{width:"100%",height:"100%"},"camera-controls":"","ar-status":"not-presenting",src:t.id})})]})}function yv({model:t,name:e}){return Xn("overlay",`model-${e}`,PR,{model:t},[t]),null}var yD=_(Y(),1);function BR(){let{strategy:t}=Fe();return t.type!=="3d-model"?null:(0,yD.jsx)(yv,{model:t.model})}var vv=_(nt(),1),Oh=(0,vv.createContext)(null);Oh.displayName="Controls";function hi(){let t=(0,vv.useContext)(Oh);if(!t)throw new Error("useStrategy must be used within a StrategyProvider");return t}var or=_(Y(),1);function HR(){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)(Vs,{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)(Vs,{renderViewerControls:e,viewControlsDeps:n})}):null]})}var Xc=_(nt(),1);var rr=_(nt(),1);var vD=_(nt(),1);function UR(){let e=Vt().getStore();return(0,vD.useMemo)(()=>n=>e.dispatch(n),[e])}function SD(t){return typeof t!="string"&&t&&t.bindToVault}function VR(){let t=Vt(),e=(0,rr.useRef)([]),n=UR(),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(ns.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(SD(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(ns.addReference({id:i,type:"AnnotationPage",key:"items",reference:{id:u,type:"Annotation"},index:d})))}},[i]),s=(0,rr.useCallback)(u=>{i&&(SD(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(ns.removeReference({id:i,type:"AnnotationPage",key:"items",reference:{id:u,type:"Annotation"}})))},[i]);return[a,{addAnnotation:o,removeAnnotation:s}]}var xD=_(Y(),1),bD=(0,Xc.createContext)(null);function jR(){let t=(0,Xc.useContext)(bD);return[t.fullPage,{addAnnotation:t.addAnnotation,removeAnnotation:t.removeAnnotation}]}function qR({children:t}){let[e,{addAnnotation:n,removeAnnotation:i}]=VR();return(0,xD.jsx)(bD.Provider,{value:(0,Xc.useMemo)(()=>({fullPage:e,addAnnotation:n,removeAnnotation:i}),[e]),children:t})}var js=_(Y(),1);function FR({children:t}){let{strategy:e}=Fe(),[n]=jR();return e.type!=="images"?null:(0,js.jsxs)(js.Fragment,{children:[n?(0,js.jsx)(xl,{page:n}):null,e.annotations&&e.annotations.pages?e.annotations.pages.map(i=>(0,js.jsx)(xl,{page:i},i.id)):null,t]})}var Tl=_(nt(),1);var ED=_(nt(),1),GR=(t,e=[])=>{let n=Vt();(0,ED.useEffect)(()=>{t(n)},[n,...e])};var Sv=_(nt(),1);var RD=Sv.default.createContext(new Zu);function _h(){return(0,Sv.useContext)(RD)}function lr(t,e,{canvasId:n,manifestId:i}={}){let a=Vt(),o=_h(),s=(0,Tl.useMemo)(()=>Nb(a,{imageServiceLoader:o}),[a,o]),[u,d]=(0,Tl.useState)(),p=on(i?{id:i}:void 0),f=zt(n?{id:n}:void 0),m=f||p,g=(0,Tl.useRef)(!1);if((0,Tl.useEffect)(()=>(g.current=!1,()=>{g.current=!0}),[]),!m)throw new Error("Must be called under a manifest or canvas context.");return GR(v=>{s.getBestThumbnailAtSize(m,t,e).then(S=>{S.best&&!g.current&&d(S.best)})},[m]),u}var kR=_(Y(),1);function qs({x:t=0,y:e=0}){let n=zt(),i=lr({maxWidth:256,maxHeight:256});return!n||!i||i.type!=="fixed"?null:(0,kR.jsx)("world-object",{height:n.height,width:n.width,x:t,y:e,children:(0,kR.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 bv=_(Y(),1);function YR({as:t}){let{strategy:e}=Fe(),{renderMediaControls:n,mediaControlsDeps:i}=hi();return e.type!=="media"||e.media.type!=="Sound"?null:(0,bv.jsxs)(pv,{media:e.media,mediaControlsDeps:i,audioCopmonent:t,children:[(0,bv.jsx)(qs,{}),n?n(e):null]},e.media.url)}var wv=_(nt(),1);var xv=_(nt(),1);var AD=_(Y(),1),QR=(0,xv.createContext)(null);QR.displayName="ComplexTimeline";function XR({children:t,store:e}){return(0,AD.jsx)(QR.Provider,{value:e,children:t})}function Oq(t){let e=(0,xv.useContext)(QR);if(!e)throw new Error("useComplexTimeline must be used within a ComplexTimelineProvider");return bt(e,t)}function TD({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 CD({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=C.getState().visibleElements,A=i,T=[],M=Object.keys(A);for(let z of M){let D=A[z],I=x[z];D&&I&&T.push(D)}return T}function f(){return Object.keys(i).map(x=>i[x])}function m(R){a.currentTime&&(a.currentTime.innerHTML=hv(R),a.progress&&(a.progress.style.width=`${R/t.duration*100}%`))}let g=()=>{let R=C.getState(),x=R.currentPrime;if(!x)return;let A=i,T=R.visibleElements,M=Object.keys(A);for(let z of M){let D=A[z],I=T[z];if(D&&z!==x.id&&I){let q=u-I.time*1e3;Math.abs(u-I.time*1e3-D.currentTime*1e3)>300&&(D.currentTime=q/1e3)}}},v=(R=0)=>{let x=R-o,A=C.getState();if(A.isPlaying){let T=A.currentPrime;if(T){let I=i[T.id];I&&(I.paused?u+=x:u=(T.time+I.currentTime)*1e3)}else u+=x;let M=u/1e3;if(M>A.duration){C.getState().setTime(0),C.setState({isPlaying:!1}),S(),m(0);return}m(M);let[z,D]=TD({currentTime:M,currentKeyFrameIndex:A.nextKeyframeIndex,keyframes:A.complexTimeline.keyframes,targetTime:M});D.length&&A.applyKeyframes(z,D)}o=R,s=requestAnimationFrame(v)},S=()=>{s&&cancelAnimationFrame(s)},E=(R,x)=>{},C=Yi((R,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)),R({clockRunning:!0,clockStartRequests:x().clockStartRequests+1})},applyKeyframes(A,T){let M=x(),z={...M.visibleElements},D=M.currentPrime;for(let I of T)I.type==="enter"&&(z[I.id]=I,n.emit("complex-timeline.enter",{id:I.id})),I.type==="exit"&&(z[I.id]=null,n.emit("complex-timeline.exit",{id:I.id})),I.isPrime&&(D=I);R({nextKeyframeIndex:A,visibleElements:z,currentPrime:D})},stopClock:()=>{let A=x().clockStartRequests;if(A!==0){if(A===1){S(),d&&clearInterval(d),R({clockRunning:!1,clockStartRequests:0});return}R({clockStartRequests:A-1})}},setElement:(A,T)=>{i[A]=T;let M=Object.keys(i),z=x().complexTimeline;E(T,A),z.items.filter(I=>I.type!=="Image"&&I.type!=="Text").every(I=>M.includes(I.annotationId))&&!x().isReady&&(n.emit("complex-timeline.ready",{complexTimeline:z}),R({isReady:!0}))},removeElement:A=>{delete i[A]},mute(){for(let A of f())A.muted=!0;R({isMuted:!0})},unmute(){for(let A of f())A.muted=!1;R({isMuted:!1})},play(){if(!x().isPlaying){for(let T of p())T.play();R({isPlaying:!0})}},pause(){if(x().isPlaying){for(let T of p())T.pause();R({isPlaying:!1})}},playPause(){let A=x();A.isPlaying?A.pause():A.play()},setDurationPercent(A){let M=x().duration*A;x().setTime(M)},setTime(A){let T=x(),M=u/1e3,z=typeof A=="function"?A(M):A,D=T.nextKeyframeIndex;if(M>z){R({visibleElements:{},currentPrime:null});let K=Object.keys(T.visibleElements);for(let tt of K)n.emit("complex-timeline.exit",{id:tt});M=0,D=0}let[I,q]=TD({currentTime:M,currentKeyFrameIndex:D,keyframes:T.complexTimeline.keyframes,targetTime:z});T.applyKeyframes(I,q),u=z*1e3;let U=C.getState().visibleElements,W=i,it=Object.keys(U);for(let K of it){let tt=U[K];if(tt){let ut=W[K];ut&&(ut.currentTime=(u-tt.time*1e3)/1e3)}}m(z)},setVolume(A){for(let T of f())T.volume=Math.min(1,Math.max(0,A/100));R({volume:A})},toggleMute(){let A=x();A.isMuted?(A.unmute(),R({isMuted:!1})):(A.mute(),R({isMuted:!0}))},clearProgressElement(){a.progress=null},setProgressElement(A){a.progress=A},setCurrentTimeElement(A){a.currentTime=A},clearCurrentTimeElement(){a.currentTime=null}}));return n.on("complex-timeline.enter",R=>{let x=C.getState(),A=R.id,T=i[A];T&&x.isPlaying&&T.play()}),n.on("complex-timeline.exit",R=>{let x=C.getState(),A=R.id,T=i[A];T&&(T.currentTime=0,T.pause())}),C.getState().setTime(e),{store:C,emitter:n}}var Zc=_(nt(),1);var Ev=_(nt(),1);var wD=Ev.default.createContext(zb.store);wD.displayName="ImageServicesHelper";function Rv(){return(0,Ev.useContext)(wD)}function MD(t){let e=Rv();return bt(e,({loaded:n})=>n[t])}function Kc(){let t=Rv();return bt(t,({loadServiceSync:e})=>e)}function OD(){let t=Rv();return bt(t,({loaded:e})=>e)}function _D(){let t=Rv();return bt(t,({loadService:e})=>e)}var Qa=_(nt(),1),Ya=_(Y(),1),ND=Qa.default.createContext("en"),ID=Qa.default.createContext({}),DD=Qa.default.createContext(null);function _q(t){return(0,Ya.jsx)(ID.Provider,{value:t.translations,children:t.children})}function zq(t){return(0,Ya.jsx)(ND.Provider,{value:t.language,children:t.children})}function Nq(t){return(0,Ya.jsx)(DD.Provider,{value:t.convert,children:t.children})}function KR(){return Qa.default.useContext(DD)}function Av(){return Qa.default.useContext(ND)}function ZR(){return Qa.default.useContext(ID)}function zD(t){return t.indexOf("-")!==-1?t.slice(0,t.indexOf("-")):t}function LD({as:t,language:e,children:n,viewingDirection:i,...a}){let o=Av();return(0,Qa.useMemo)(()=>zD(o)===zD(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 PD(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 BD=(t,e=[])=>{let n=Av();return(0,Qa.useMemo)(()=>{let i=t();return PD(n,i,[])},[n,...e])};function Fs(t,e,n,i){return e?n?n(t[e]||e,i||"none"):t[e]||e:""}function HD(t,e,n=`
101
- `,i={}){let a=KR(),o=BD(()=>Object.keys(t||{}),[t]);return[(0,Qa.useMemo)(()=>{if(!t)return Fs(i,e,a)||"";if(typeof t=="string")return Fs(i,t,a);let s=o?t[o]:void 0;return s?typeof s=="string"?s:s.map(u=>Fs(i,u,a,o)).join(n):""},[o,e,t]),o]}function Iq(){let t=Av(),e=ZR(),n=KR();return function(a,o="",s=`
102
- `,u=e){let d=Object.keys(a||{}),p=PD(t,d,[]);if(!a)return Fs(u,o,n)||"";if(typeof a=="string")return Fs(u,a,n);let f=p?a[p]:void 0;return f?typeof f=="string"?Fs(u,f,n,p):f.map(m=>Fs(u,m,n,p)).join(typeof s<"u"?s:`
103
- `):""}}function oa({as:t,defaultText:e,enableDangerouslySetInnerHTML:n,children:i,separator:a,...o}){let s=ZR(),[u,d]=HD(i,e,a,s);return d?(0,Ya.jsx)(LD,{...o,as:t,language:d,title:n?void 0:u,dangerouslySetInnerHTML:n?{__html:u}:void 0,children:n?void 0:u}):t?(0,Ya.jsx)(t,{...o,children:u}):(0,Ya.jsx)("span",{...o,title:n?void 0:u,dangerouslySetInnerHTML:n?{__html:u}:void 0,children:n?void 0:u})}var Tv=_(nt(),1),Gs=_(Y(),1),JR=t=>{let e=t.format||"jpg",n=t.width/(t.crop?.width||t.tiles.width),i=t.tiles.imageService.sizes||[],a=t.enableThumbnail,o=t.enableSizes,s=(0,Tv.useMemo)(()=>{let p=t.tiles.imageService.id||t.tiles.imageService["@id"];return p?.endsWith("/info.json")?p.slice(0,-1*10):p},[t.tiles.imageService.id,t.tiles.imageService["@id"]]),u=(0,Tv.useMemo)(()=>{let p=t.tiles.imageService.tiles||[];if(!p.length){let f=t.width,m=[1],g=1;for(;2**g<f;)g=g*2,m.push(g);return(t.tiles.imageService.maxArea||t.tiles.imageService.maxWidth||t.tiles.imageService.maxHeight)&&Ku(2,t.tiles.imageService)?[{width:256,height:256,scaleFactors:m}]:Ku(2,t.tiles.imageService)?[{width:256,height:256,scaleFactors:m}]:[]}return p},[t.tiles.imageService,t.width]),d=(0,Tv.useMemo)(()=>{let p=t.tiles.imageService;return(p?p["@context"]?Array.isArray(p["@context"])?p["@context"]:[p["@context"]]:[]:[]).indexOf("http://iiif.io/api/image/3/context.json")!==-1},[t.tiles.imageService.id,t.tiles.imageService]);return(0,Gs.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,Gs.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,Gs.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,o&&i.map((p,f)=>(0,Gs.jsx)("world-image",{uri:`${s}/full/${p.width},${d?p.height:""}/0/default.${e}`,target:{width:t.tiles.width,height:t.tiles.height},display:{width:p.width,height:p.height},crop:t.crop},f)),u.map(p=>(p.scaleFactors||[]).map(f=>(0,Gs.jsx)("tiled-image",{uri:t.tiles.imageService.id,display:{width:t.tiles.width,height:t.tiles.height},format:e,tile:p,scaleFactor:f,crop:t.crop,version3:d},`${t.tiles.imageService.id}-tile-${f}`)))]},t.tiles.imageService.id)},t.tiles.imageService.id)};var Ma=_(Y(),1);function Dq({resource:t,heading:e,note:n,extra:i}){return i?(0,Ma.jsx)(_i,{target:{x:0,y:0,width:i.target?.spatial.width,height:i.target?.spatial.height},backgroundColor:"#333",relative:!0,children:(0,Ma.jsx)("div",{style:{display:"flex",alignContent:"center",justifyContent:"center",alignItems:"center",height:"100%",width:"100%",background:"#444",color:"#BBB"},children:(0,Ma.jsxs)("div",{children:[(0,Ma.jsx)(oa,{children:e||"Not authorised"}),n&&(0,Ma.jsx)("p",{children:(0,Ma.jsx)(oa,{children:n})}),(0,Ma.jsx)("p",{children:t.id||t["@id"]||"unknown"})]})})}):null}function UD({image:t,thumbnail:e,crop:n,enableSizes:i,enableThumbnail:a,renderOptions:o,rotation:s}){let u=fb(),d=Ae(t.service),p=MD(d),f=Kc(),m=p?.service;f(t.service,t);let g=m&&p?.status==="done",v=(m?.preferredFormats||[])[0],S=e&&e.type==="fixed"&&e.id&&!e.id.includes("/full/full/")&&!e.id.includes("/max/")?e:void 0;if(g===!1)return null;if(!u){let E=t.service,C=E.width||t.width||0,R=E.height||t.height||0,x=0,A=0,T=t.target?.spatial.width||C,M=t.target?.spatial.height||R;return(s===90||s===270)&&([T,M]=[M,T],M>T?A=-(M-T)/2:x=-(T-M)/2),(0,Ma.jsx)(JR,{enableThumbnail:a,renderOptions:o,rotation:s,tiles:{id:E.id||E["@id"]||"unknown",height:R,width:C,imageService:E,thumbnail:S},enableSizes:i,x,y:A,format:v,width:T,height:M,crop:n})}return(0,Ma.jsx)(db,{resource:t.service,errorComponent:Dq,extra:t,children:E=>{let C=E.width||t.width||0,R=E.height||t.height||0,x=0,A=0,T=t.target?.spatial.width||C,M=t.target?.spatial.height||R;return(s===90||s===270)&&([T,M]=[M,T],M<T?(A=-(M-T)/2,x=(T-M)/2):(A=(M-T)/2,x=-(T-M)/2)),(0,Ma.jsx)(JR,{enableThumbnail:a,renderOptions:o,tiles:{id:E.id||E["@id"]||"unknown",height:R,width:C,imageService:E,thumbnail:S},rotation:s,format:v,enableSizes:i,x,y:A,width:T,height:M,crop:n})}},t.id)}var Cl=_(Y(),1);function wl({id:t,image:e,thumbnail:n,isStatic:i,x:a=0,y:o=0,children:s,selector:u,onClick:d,enableSizes:p,enableAnnotations:f}){let m=(0,Zc.useMemo)(()=>{if(!(!u||u.spatial.x===0&&u.spatial.y===0))return u.spatial},[u]),g=(0,Zc.useMemo)(()=>{if(!e.annotation)return 0;let A=Array.isArray(e.annotation.body)?e.annotation.body?.[0]:e.annotation.body;if(A&&A.selector?.type==="ImageApiSelector")return Number(A.selector.rotation)},[e]),v=a+e.target.spatial.x,S=o+e.target.spatial.y,E=e.target.spatial.width,C=e.target.spatial.height,R=e.target.spatial.width,x=e.target.spatial.height;return(g===90||g===270)&&([E,C]=[C,E],[R,x]=[x,R]),(0,Cl.jsxs)("world-object",{x:v,y:S,width:E,height:C,onClick:d,rotation:g,children:[e.service?(0,Cl.jsxs)(Zc.Fragment,{children:[(0,Cl.jsx)(UD,{image:e,thumbnail:n,crop:m,enableSizes:p,rotation:g}),s]},"service"):(0,Cl.jsxs)(Zc.Fragment,{children:[(0,Cl.jsx)("world-image",{onClick:d,uri:e.id,target:{x:0,y:0,width:R,height:x},display:R&&x?{width:R,height:x}:void 0,crop:m}),s]},"no-service"),f&&e.annotationPages?e.annotationPages.map(A=>(0,Cl.jsx)(xl,{page:A,className:"image-service-annotation",ignoreTargetId:!0},A.id)):null]},t+(e.service?"server":"no-service"))}var sr=_(Y(),1);function Cv({strategy:t,onClickPaintingAnnotation:e}){return(0,sr.jsx)(sr.Fragment,{children:t.items.map((n,i)=>(0,sr.jsx)(sr.Fragment,{children:(0,sr.jsx)(_i,{onClick:e?a=>{a.stopPropagation(),e(n.annotationId,n,a)}:void 0,target:n.target?.spatial||void 0,children:(0,sr.jsx)("div",{"data-textual-content":!0,children:(0,sr.jsx)(oa,{enableDangerouslySetInnerHTML:!0,children:n.text})})},i)}))})}var Oa=_(Y(),1);function VD({strategy:t,children:e}){let{store:n}=(0,wv.useMemo)(()=>CD({complexTimeline:t}),[t]),i=bt(n,s=>s.isReady),a=bt(n,s=>s.visibleElements);function o(s){return u=>{u&&n.getState().setElement(s,u)}}return(0,wv.useLayoutEffect)(()=>{if(i){let{startClock:s,stopClock:u}=n.getState();return s(),()=>{u()}}},[t,i]),Xn("portal","custom-controls",XR,{store:n,children:e},[i]),(0,Oa.jsxs)(Oa.Fragment,{children:[t.items.map(s=>s.type!=="Image"||!a[s.annotationId]?null:(0,Oa.jsx)(wl,{image:s,id:s.annotationId},s.id)),t.items.map((s,u)=>s.type!=="Text"||!a[s.annotationId]?null:(0,Oa.jsx)(Cv,{strategy:{type:"textual-content",items:[s]}},u)),t.items.map((s,u)=>s.type!=="Video"||!s.target.spatial?null:(0,Oa.jsx)(_i,{target:s.target.spatial,children:(0,Oa.jsx)("video",{ref:o(s.annotationId),src:s.url,style:{height:"100%",width:"100%",opacity:a[s.annotationId]?1:0}})},u)),t.items.map((s,u)=>s.type!=="Sound"?null:(0,Oa.jsx)(_i,{children:(0,Oa.jsx)("audio",{ref:o(s.annotationId),src:s.url})},u)),t.highlights.map(({annotation:s})=>a[s.id]?(0,Oa.jsx)(Bs,{id:s.id,ignoreTargetId:!0,style:{outline:"3px solid red"},className:"image-service-annotation"},s.id):null)]})}var jD=_(Y(),1);function WR(){let{strategy:t}=Fe(),{renderComplexTimelineControls:e}=hi();return t.type!=="complex-timeline"?null:(0,jD.jsx)(VD,{strategy:t,children:e?e(t):null})}var qD=_(Y(),1);function Mv({style:t}){let e=zt();return!e||!e.height||!e.width?null:(0,qD.jsx)("box",{interactive:!1,target:{x:0,y:0,width:Number(e.width),height:Number(e.height)},style:t})}var FD=_(Y(),1);function $R({backgroundStyle:t,alwaysShowBackground:e}){let{strategy:n}=Fe();return n.type!=="empty"&&!e?null:(0,FD.jsx)(Mv,{style:t})}var Ov=_(nt(),1),Xa=(0,Ov.createContext)(null);function zh(){return(0,Ov.useContext)(Xa)}var Jc=_(Y(),1);function tA({isStatic:t=!1,enableSizes:e=!1,enableAnnotations:n=!0,onClickPaintingAnnotation:i,children:a}){let{strategy:o}=Fe(),{renderViewerControls:s,viewControlsDeps:u}=hi(),d=zt(),p=zh(),f=lr({maxWidth:256,maxHeight:256});return Xn(p&&o.type==="images"&&s?"overlay":"none",`canvas-portal-controls-${d?.id}`,Xa.Provider,s?{value:p||null,children:s(o)}:{},[d,p,o,...u||[]]),o.type!=="images"?null:(0,Jc.jsxs)(Jc.Fragment,{children:[o.images.map((m,g)=>(0,Jc.jsx)(wl,{isStatic:t,image:m,id:m.id,thumbnail:g===0?f:void 0,selector:m.selector,enableSizes:e,enableAnnotations:n,onClick:i?v=>{i(m.annotationId,m,v)}:void 0},m.id+g)),a]})}var Wc=_(Y(),1);function eA({onClickPaintingAnnotation:t,children:e}){let{strategy:n}=Fe(),{renderViewerControls:i,viewControlsDeps:a}=hi(),o=zh(),s=zt();return Xn(o&&n.type==="textual-content"&&i?"overlay":"none",`canvas-portal-controls-${s?.id}`,Xa.Provider,i?{value:o||null,children:i(n)}:{},[s,o,n,...a||[]]),n.type!=="textual-content"?null:(0,Wc.jsxs)(Wc.Fragment,{children:[(0,Wc.jsx)(Cv,{strategy:n,onClickPaintingAnnotation:t}),e]})}var Nh=_(Y(),1);function nA({element:t,media:e,startTime:n,playPause:i,poster:a}){let o="div",s=n?`${e.url}#t=${n}`:e.url;return(0,Nh.jsxs)(o,{className:"video-container",part:"video-container",onClick:i,children:[(0,Nh.jsx)("style",{children:`
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 Rv({model:t,name:e}){return Xn("overlay",`model-${e}`,QA,{model:t},[t]),null}var zD=_(Y(),1);function XA(){let{strategy:t}=Fe();return t.type!=="3d-model"?null:(0,zD.jsx)(Rv,{model:t.model})}var Tv=_(nt(),1),Ih=(0,Tv.createContext)(null);Ih.displayName="Controls";function hi(){let t=(0,Tv.useContext)(Ih);if(!t)throw new Error("useStrategy must be used within a StrategyProvider");return t}var or=_(Y(),1);function KA(){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 ND=_(nt(),1);function ZA(){let e=Vt().getStore();return(0,ND.useMemo)(()=>n=>e.dispatch(n),[e])}function ID(t){return typeof t!="string"&&t&&t.bindToVault}function WA(){let t=Vt(),e=(0,rr.useRef)([]),n=ZA(),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(ID(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&&(ID(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 LD=_(Y(),1),DD=(0,Jc.createContext)(null);function JA(){let t=(0,Jc.useContext)(DD);return[t.fullPage,{addAnnotation:t.addAnnotation,removeAnnotation:t.removeAnnotation}]}function $A({children:t}){let[e,{addAnnotation:n,removeAnnotation:i}]=WA();return(0,LD.jsx)(DD.Provider,{value:(0,Jc.useMemo)(()=>({fullPage:e,addAnnotation:n,removeAnnotation:i}),[e]),children:t})}var Gs=_(Y(),1);function tR({children:t}){let{strategy:e}=Fe(),[n]=JA();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 BD=_(nt(),1),eR=(t,e=[])=>{let n=Vt();(0,BD.useEffect)(()=>{t(n)},[n,...e])};var Cv=_(nt(),1);var PD=Cv.default.createContext(new tc);function Dh(){return(0,Cv.useContext)(PD)}function lr(t,e,{canvasId:n,manifestId:i}={}){let a=Vt(),o=Dh(),s=(0,wl.useMemo)(()=>Fb(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 eR(v=>{s.getBestThumbnailAtSize(m,t,e).then(S=>{S.best&&!g.current&&d(S.best)})},[m]),u}var nR=_(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,nR.jsx)("world-object",{height:n.height,width:n.width,x:t,y:e,children:(0,nR.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 wv=_(Y(),1);function iR({as:t}){let{strategy:e}=Fe(),{renderMediaControls:n,mediaControlsDeps:i}=hi();return e.type!=="media"||e.media.type!=="Sound"?null:(0,wv.jsxs)(xv,{media:e.media,mediaControlsDeps:i,audioCopmonent:t,children:[(0,wv.jsx)(ks,{}),n?n(e):null]},e.media.url)}var Dv=_(nt(),1);var Mv=_(nt(),1);var HD=_(Y(),1),aR=(0,Mv.createContext)(null);aR.displayName="ComplexTimeline";function oR({children:t,store:e}){return(0,HD.jsx)(aR.Provider,{value:e,children:t})}function q7(t){let e=(0,Mv.useContext)(aR);if(!e)throw new Error("useComplexTimeline must be used within a ComplexTimelineProvider");return bt(e,t)}function UD({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 VD({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=bv(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]=UD({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]=UD({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 Ov=_(nt(),1);var jD=Ov.default.createContext(qb.store);jD.displayName="ImageServicesHelper";function _v(){return(0,Ov.useContext)(jD)}function qD(t){let e=_v();return bt(e,({loaded:n})=>n[t])}function $c(){let t=_v();return bt(t,({loadServiceSync:e})=>e)}function FD(){let t=_v();return bt(t,({loaded:e})=>e)}function GD(){let t=_v();return bt(t,({loadService:e})=>e)}var Qa=_(nt(),1),Ya=_(Y(),1),YD=Qa.default.createContext("en"),QD=Qa.default.createContext({}),XD=Qa.default.createContext(null);function F7(t){return(0,Ya.jsx)(QD.Provider,{value:t.translations,children:t.children})}function G7(t){return(0,Ya.jsx)(YD.Provider,{value:t.language,children:t.children})}function k7(t){return(0,Ya.jsx)(XD.Provider,{value:t.convert,children:t.children})}function rR(){return Qa.default.useContext(XD)}function zv(){return Qa.default.useContext(YD)}function lR(){return Qa.default.useContext(QD)}function kD(t){return t.indexOf("-")!==-1?t.slice(0,t.indexOf("-")):t}function KD({as:t,language:e,children:n,viewingDirection:i,...a}){let o=zv();return(0,Qa.useMemo)(()=>kD(o)===kD(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 ZD(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 WD=(t,e=[])=>{let n=zv();return(0,Qa.useMemo)(()=>{let i=t();return ZD(n,i,[])},[n,...e])};function Ys(t,e,n,i){return e?n?n(t[e]||e,i||"none"):t[e]||e:""}function JD(t,e,n=`
102
+ `,i={}){let a=rR(),o=WD(()=>Object.keys(t||{}),[t]);return[(0,Qa.useMemo)(()=>{if(!t)return Ys(i,e,a)||"";if(typeof t=="string")return Ys(i,t,a);let s=o?t[o]:void 0;return s?typeof s=="string"?s:s.map(u=>Ys(i,u,a,o)).join(n):""},[o,e,t]),o]}function Y7(){let t=zv(),e=lR(),n=rR();return function(a,o="",s=`
103
+ `,u=e){let d=Object.keys(a||{}),p=ZD(t,d,[]);if(!a)return Ys(u,o,n)||"";if(typeof a=="string")return Ys(u,a,n);let f=p?a[p]:void 0;return f?typeof f=="string"?Ys(u,f,n,p):f.map(m=>Ys(u,m,n,p)).join(typeof s<"u"?s:`
104
+ `):""}}function oa({as:t,defaultText:e,enableDangerouslySetInnerHTML:n,children:i,separator:a,...o}){let s=lR(),[u,d]=JD(i,e,a,s);return d?(0,Ya.jsx)(KD,{...o,as:t,language:d,title:n?void 0:u,dangerouslySetInnerHTML:n?{__html:u}:void 0,children:n?void 0:u}):t?(0,Ya.jsx)(t,{...o,children:u}):(0,Ya.jsx)("span",{...o,title:n?void 0:u,dangerouslySetInnerHTML:n?{__html:u}:void 0,children:n?void 0:u})}var Nv=_(nt(),1),Qs=_(Y(),1),sR=t=>{let e=t.format||"jpg",n=t.width/(t.crop?.width||t.tiles.width),i=t.tiles.imageService.sizes||[],a=t.enableThumbnail,o=t.enableSizes,s=(0,Nv.useMemo)(()=>{let p=t.tiles.imageService.id||t.tiles.imageService["@id"];return p?.endsWith("/info.json")?p.slice(0,-1*10):p},[t.tiles.imageService.id,t.tiles.imageService["@id"]]),u=(0,Nv.useMemo)(()=>{let p=t.tiles.imageService.tiles||[];if(!p.length){let f=t.width,m=[1],g=1;for(;2**g<f;)g=g*2,m.push(g);return(t.tiles.imageService.maxArea||t.tiles.imageService.maxWidth||t.tiles.imageService.maxHeight)&&$u(2,t.tiles.imageService)?[{width:256,height:256,scaleFactors:m}]:$u(2,t.tiles.imageService)?[{width:256,height:256,scaleFactors:m}]:[]}return p},[t.tiles.imageService,t.width]),d=(0,Nv.useMemo)(()=>{let p=t.tiles.imageService;return(p?p["@context"]?Array.isArray(p["@context"])?p["@context"]:[p["@context"]]:[]:[]).indexOf("http://iiif.io/api/image/3/context.json")!==-1},[t.tiles.imageService.id,t.tiles.imageService]);return(0,Qs.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,Qs.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,Qs.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,o&&i.map((p,f)=>(0,Qs.jsx)("world-image",{uri:`${s}/full/${p.width},${d?p.height:""}/0/default.${e}`,target:{width:t.tiles.width,height:t.tiles.height},display:{width:p.width,height:p.height},crop:t.crop},f)),u.map(p=>(p.scaleFactors||[]).map(f=>(0,Qs.jsx)("tiled-image",{uri:t.tiles.imageService.id,display:{width:t.tiles.width,height:t.tiles.height},format:e,tile:p,scaleFactor:f,crop:t.crop,version3:d},`${t.tiles.imageService.id}-tile-${f}`)))]},t.tiles.imageService.id)},t.tiles.imageService.id)};var Ma=_(Y(),1);function Q7({resource:t,heading:e,note:n,extra:i}){return i?(0,Ma.jsx)(_i,{target:{x:0,y:0,width:i.target?.spatial.width,height:i.target?.spatial.height},backgroundColor:"#333",relative:!0,children:(0,Ma.jsx)("div",{style:{display:"flex",alignContent:"center",justifyContent:"center",alignItems:"center",height:"100%",width:"100%",background:"#444",color:"#BBB"},children:(0,Ma.jsxs)("div",{children:[(0,Ma.jsx)(oa,{children:e||"Not authorised"}),n&&(0,Ma.jsx)("p",{children:(0,Ma.jsx)(oa,{children:n})}),(0,Ma.jsx)("p",{children:t.id||t["@id"]||"unknown"})]})})}):null}function $D({image:t,thumbnail:e,crop:n,enableSizes:i,enableThumbnail:a,renderOptions:o,rotation:s}){let u=Eb(),d=Re(t.service),p=qD(d),f=$c(),m=p?.service;f(t.service,t);let g=m&&p?.status==="done",v=(m?.preferredFormats||[])[0],S=e&&e.type==="fixed"&&e.id&&!e.id.includes("/full/full/")&&!e.id.includes("/max/")?e:void 0;if(g===!1)return null;if(!u){let E=t.service,T=E.width||t.width||0,A=E.height||t.height||0,x=0,R=0,C=t.target?.spatial.width||T,M=t.target?.spatial.height||A,z=C,N=M;return(s===90||s===270)&&([C,M]=[M,C],x=(z-C)/2,R=(N-M)/2),(0,Ma.jsx)(sR,{enableThumbnail:a,renderOptions:o,rotation:s,tiles:{id:E.id||E["@id"]||"unknown",height:A,width:T,imageService:E,thumbnail:S},enableSizes:i,x,y:R,format:v,width:C,height:M,crop:n})}return(0,Ma.jsx)(Ab,{resource:t.service,errorComponent:Q7,extra:t,children:E=>{let T=E.width||t.width||0,A=E.height||t.height||0,x=0,R=0,C=t.target?.spatial.width||T,M=t.target?.spatial.height||A,z=C,N=M;return(s===90||s===270)&&([C,M]=[M,C],x=(z-C)/2,R=(N-M)/2),(0,Ma.jsx)(sR,{enableThumbnail:a,renderOptions:o,tiles:{id:E.id||E["@id"]||"unknown",height:A,width:T,imageService:E,thumbnail:S},rotation:s,format:v,enableSizes:i,x,y:R,width:C,height:M,crop:n})}},t.id)}var Ml=_(Y(),1);function Ol({id:t,image:e,thumbnail:n,isStatic:i,x:a=0,y:o=0,children:s,selector:u,onClick:d,enableSizes:p,enableAnnotations:f}){let m=(0,tf.useMemo)(()=>{if(!(!u||u.spatial.x===0&&u.spatial.y===0))return u.spatial},[u]),g=(0,tf.useMemo)(()=>{if(typeof e.rotation<"u")return e.rotation;if(!e.annotation)return 0;let C=Array.isArray(e.annotation.body)?e.annotation.body?.[0]:e.annotation.body;if(C&&C.selector?.type==="ImageApiSelector")return Number(C.selector.rotation)},[e]),v=!!e.service,S=a+e.target.spatial.x,E=o+e.target.spatial.y,T=e.target.spatial.width,A=e.target.spatial.height,x=e.target.spatial.width,R=e.target.spatial.height;return(g===90||g===270)&&([x,R]=[R,x],v||([T,A]=[A,T],S+=(e.target.spatial.width-T)/2,E+=(e.target.spatial.height-A)/2)),(0,Ml.jsxs)("world-object",{x:S,y:E,width:T,height:A,onClick:d,rotation:v?0:g,children:[e.service?(0,Ml.jsxs)(tf.Fragment,{children:[(0,Ml.jsx)($D,{image:e,thumbnail:n,crop:m,enableSizes:p,rotation:g}),s]},"service"):(0,Ml.jsxs)(tf.Fragment,{children:[(0,Ml.jsx)("world-image",{onClick:d,uri:e.id,target:{x:0,y:0,width:x,height:R},display:x&&R?{width:x,height:R}:void 0,crop:m}),s]},"no-service"),f&&e.annotationPages?e.annotationPages.map(C=>(0,Ml.jsx)(Al,{page:C,className:"image-service-annotation",ignoreTargetId:!0},C.id)):null]},t+(v?"server":"no-service"))}var sr=_(Y(),1);function Iv({strategy:t,onClickPaintingAnnotation:e}){return(0,sr.jsx)(sr.Fragment,{children:t.items.map((n,i)=>(0,sr.jsx)(sr.Fragment,{children:(0,sr.jsx)(_i,{onClick:e?a=>{a.stopPropagation(),e(n.annotationId,n,a)}:void 0,target:n.target?.spatial||void 0,children:(0,sr.jsx)("div",{"data-textual-content":!0,children:(0,sr.jsx)(oa,{enableDangerouslySetInnerHTML:!0,children:n.text})})},i)}))})}var Oa=_(Y(),1);function tL({strategy:t,children:e}){let{store:n}=(0,Dv.useMemo)(()=>VD({complexTimeline:t}),[t]),i=bt(n,s=>s.isReady),a=bt(n,s=>s.visibleElements);function o(s){return u=>{u&&n.getState().setElement(s,u)}}return(0,Dv.useLayoutEffect)(()=>{if(i){let{startClock:s,stopClock:u}=n.getState();return s(),()=>{u()}}},[t,i]),Xn("portal","custom-controls",oR,{store:n,children:e},[i]),(0,Oa.jsxs)(Oa.Fragment,{children:[t.items.map(s=>s.type!=="Image"||!a[s.annotationId]?null:(0,Oa.jsx)(Ol,{image:s,id:s.annotationId},s.id)),t.items.map((s,u)=>s.type!=="Text"||!a[s.annotationId]?null:(0,Oa.jsx)(Iv,{strategy:{type:"textual-content",items:[s]}},u)),t.items.map((s,u)=>s.type!=="Video"||!s.target.spatial?null:(0,Oa.jsx)(_i,{target:s.target.spatial,children:(0,Oa.jsx)("video",{ref:o(s.annotationId),src:s.url,style:{height:"100%",width:"100%",opacity:a[s.annotationId]?1:0}})},u)),t.items.map((s,u)=>s.type!=="Sound"?null:(0,Oa.jsx)(_i,{children:(0,Oa.jsx)("audio",{ref:o(s.annotationId),src:s.url})},u)),t.highlights.map(({annotation:s})=>a[s.id]?(0,Oa.jsx)(Vs,{id:s.id,ignoreTargetId:!0,style:{outline:"3px solid red"},className:"image-service-annotation"},s.id):null)]})}var eL=_(Y(),1);function uR(){let{strategy:t}=Fe(),{renderComplexTimelineControls:e}=hi();return t.type!=="complex-timeline"?null:(0,eL.jsx)(tL,{strategy:t,children:e?e(t):null})}var nL=_(Y(),1);function Lv({style:t}){let e=zt();return!e||!e.height||!e.width?null:(0,nL.jsx)("box",{interactive:!1,target:{x:0,y:0,width:Number(e.width),height:Number(e.height)},style:t})}var iL=_(Y(),1);function cR({backgroundStyle:t,alwaysShowBackground:e}){let{strategy:n}=Fe();return n.type!=="empty"&&!e?null:(0,iL.jsx)(Lv,{style:t})}var Bv=_(nt(),1),Xa=(0,Bv.createContext)(null);function Lh(){return(0,Bv.useContext)(Xa)}var ef=_(Y(),1);function fR({isStatic:t=!1,enableSizes:e=!1,enableAnnotations:n=!0,onClickPaintingAnnotation:i,children:a}){let{strategy:o}=Fe(),{renderViewerControls:s,viewControlsDeps:u}=hi(),d=zt(),p=Lh(),f=lr({maxWidth:256,maxHeight:256});return Xn(p&&o.type==="images"&&s?"overlay":"none",`canvas-portal-controls-${d?.id}`,Xa.Provider,s?{value:p||null,children:s(o)}:{},[d,p,o,...u||[]]),o.type!=="images"?null:(0,ef.jsxs)(ef.Fragment,{children:[o.images.map((m,g)=>(0,ef.jsx)(Ol,{isStatic:t,image:m,id:m.id,thumbnail:g===0?f:void 0,selector:m.selector,enableSizes:e,enableAnnotations:n,onClick:i?v=>{i(m.annotationId,m,v)}:void 0},m.id+g)),a]})}var nf=_(Y(),1);function dR({onClickPaintingAnnotation:t,children:e}){let{strategy:n}=Fe(),{renderViewerControls:i,viewControlsDeps:a}=hi(),o=Lh(),s=zt();return Xn(o&&n.type==="textual-content"&&i?"overlay":"none",`canvas-portal-controls-${s?.id}`,Xa.Provider,i?{value:o||null,children:i(n)}:{},[s,o,n,...a||[]]),n.type!=="textual-content"?null:(0,nf.jsxs)(nf.Fragment,{children:[(0,nf.jsx)(Iv,{strategy:n,onClickPaintingAnnotation:t}),e]})}var Bh=_(Y(),1);function hR({element:t,media:e,startTime:n,playPause:i,poster:a}){let o="div",s=n?`${e.url}#t=${n}`:e.url;return(0,Bh.jsxs)(o,{className:"video-container",part:"video-container",onClick:i,children:[(0,Bh.jsx)("style",{children:`
104
105
  .video-container {
105
106
  position: absolute;
106
107
  top: 0;
@@ -113,7 +114,7 @@ Error generating stack: `+i.message+`
113
114
  justify-content: center;
114
115
  pointer-events: visible;
115
116
  }
116
- `}),(0,Nh.jsx)("video",{poster:a,ref:t,src:s,style:{width:"100%",objectFit:"contain"}})]})}function _v({media:t,mediaControlsDeps:e,children:n,videoComponent:i=nA,captions:a}){let o=zt(),s=Mh(),u=o&&o.placeholderCanvas&&o.placeholderCanvas.id||void 0,d=lr({},!1,{canvasId:u}),[{element:p,currentTime:f,progress:m},g,v]=Hs({duration:t.duration});return Xn("overlay","video-element",i,{element:p,media:t,playPause:v.playPause,poster:d?.id,canvas:o,startTime:s?s.startTime:null,captions:a},[d]),Xn("portal","custom-controls",wh,{state:g,actions:v,currentTime:f,progress:m,element:p,children:n},[f,g,t,...e||[]]),null}var zv=_(Y(),1);function iA({as:t}){let{strategy:e}=Fe(),{renderMediaControls:n,mediaControlsDeps:i}=hi();return e.type!=="media"||e.media.type!=="Video"?null:(0,zv.jsxs)(_v,{captions:e.captions,media:e.media,mediaControlsDeps:i,videoComponent:t,children:[(0,zv.jsx)(qs,{}),n?n(e):null]},e.media.url)}var GD=_(nt(),1),Ih=_(Y(),1);function Lq({element:t,media:e,playPause:n}){let i=(0,GD.useRef)(null);return e.youTubeId?(0,Ih.jsxs)("div",{className:"video-container",part:"video-container",onClick:n,children:[(0,Ih.jsx)("style",{children:`
117
+ `}),(0,Bh.jsx)("video",{poster:a,ref:t,src:s,style:{width:"100%",objectFit:"contain"}})]})}function Pv({media:t,mediaControlsDeps:e,children:n,videoComponent:i=hR,captions:a}){let o=zt(),s=Nh(),u=o&&o.placeholderCanvas&&o.placeholderCanvas.id||void 0,d=lr({},!1,{canvasId:u}),[{element:p,currentTime:f,progress:m},g,v]=js({duration:t.duration});return Xn("overlay","video-element",i,{element:p,media:t,playPause:v.playPause,poster:d?.id,canvas:o,startTime:s?s.startTime:null,captions:a},[d]),Xn("portal","custom-controls",zh,{state:g,actions:v,currentTime:f,progress:m,element:p,children:n},[f,g,t,...e||[]]),null}var Hv=_(Y(),1);function pR({as:t}){let{strategy:e}=Fe(),{renderMediaControls:n,mediaControlsDeps:i}=hi();return e.type!=="media"||e.media.type!=="Video"?null:(0,Hv.jsxs)(Pv,{captions:e.captions,media:e.media,mediaControlsDeps:i,videoComponent:t,children:[(0,Hv.jsx)(ks,{}),n?n(e):null]},e.media.url)}var aL=_(nt(),1),Ph=_(Y(),1);function X7({element:t,media:e,playPause:n}){let i=(0,aL.useRef)(null);return e.youTubeId?(0,Ph.jsxs)("div",{className:"video-container",part:"video-container",onClick:n,children:[(0,Ph.jsx)("style",{children:`
117
118
  .video-container {
118
119
  position: absolute;
119
120
  top: 0;
@@ -131,7 +132,7 @@ Error generating stack: `+i.message+`
131
132
  width: 100%;
132
133
  object-fit: contain;
133
134
  }
134
- `}),(0,Ih.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 kD({media:t,mediaControlsDeps:e,children:n}){let[{element:i,currentTime:a,progress:o},s,u]=Hs({duration:t.duration});return Xn("overlay","video-element",Lq,{element:i,media:t,playPause:u.playPause}),null}var Nv=_(Y(),1);function aA(){let{strategy:t}=Fe(),{renderMediaControls:e,mediaControlsDeps:n}=hi();return t.type!=="media"||t.media.type!=="VideoYouTube"?null:(0,Nv.jsxs)(kD,{media:t.media,mediaControlsDeps:n,children:[(0,Nv.jsx)(qs,{}),e?e(t):null]})}var Yv=_(nt(),1);var Ol=_(nt(),1);var ii=_(nt(),1);function oA(t){let e=Ie(),n=bt(e,o=>o.polygons),i=bt(e,o=>o.polygonState),a=bt(e,o=>o.polygon);return Ds("atlas.polygon-render",({state:o,slowState:s,dt:u})=>{t(o,s,u)}),{currentShape:a,state:i,helper:n}}var Wt=_(Y(),1),ur=JI(),YD={shapeFill:"#ffffff33",shapeStroke:"#000",lineStroke:"#000",ghostLineStroke:"#0F0",activeLineStroke:"#4D7EEA",boundingBoxDottedStroke:"#0007",boundingBoxStroke:"#fffA",controlFill:"#fff"};function rA(t){let{image:e}=t,n={...YD,...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,C]=(0,ii.useState)(!1),{helper:R,state:x,currentShape:A}=oA((U,W)=>{if(U.closestLineIndex,ur.updateTransitionBoundingBox(o.current,U,W),ur.updateBoundingBoxPolygon(i.current,U,W),ur.updateBoundingBoxPolygon(a.current,U,W),ur.updateTransitionShape(p.current,U,W),ur.updateClosestLinePointTransform(u.current,U,W),ur.updateSelectBox(s.current,U,W),ur.updatePointLine(f.current,U,W),ur.updateDrawPreview(d.current,U,W,3),ur.updateLineBox(m.current,U),S(U.transitionDirection),C(U.transitionRotate),U.closestLineIndex!==-1&&g.current){let it=U.polygon,K=it.points[U.closestLineIndex],tt=it.points[(U.closestLineIndex+1)%it.points.length];K&&tt&&g.current.setAttribute("points",`${K[0]},${K[1]} ${tt[0]},${tt[1]}`)}});(0,ii.useEffect)(()=>{let U=()=>{R.modifiers.reset()};return document.addEventListener("mouseleave",U),()=>{document.removeEventListener("mouseleave",U)}},[]);let T=(0,Wt.jsxs)(Wt.Fragment,{children:[(0,Wt.jsxs)("marker",{id:"dot",viewBox:"0 0 10 10",refX:"5",refY:"5",markerWidth:"5",markerHeight:"5",children:[(0,Wt.jsx)("circle",{cx:"5",cy:"5",r:"5",fill:n.lineStroke,className:"marker"}),(0,Wt.jsx)("circle",{cx:"5",cy:"5",r:"3",fill:n.controlFill})]}),(0,Wt.jsx)("marker",{id:"newdot",viewBox:"0 0 10 10",refX:"5",refY:"5",markerWidth:"5",markerHeight:"5",children:(0,Wt.jsx)("circle",{cx:"5",cy:"5",r:"5",fill:n.activeLineStroke,className:"marker"})}),(0,Wt.jsxs)("marker",{id:"selected",viewBox:"0 0 10 10",refX:"5",refY:"5",markerWidth:"5",markerHeight:"5",children:[(0,Wt.jsx)("circle",{cx:"5",cy:"5",r:"5",fill:n.lineStroke}),(0,Wt.jsx)("circle",{cx:"5",cy:"5",r:"3",fill:n.activeLineStroke})]}),(0,Wt.jsxs)("marker",{id:"resizer",viewBox:"0 0 10 10",refX:"5",refY:"5",markerWidth:"6",markerHeight:"6",children:[(0,Wt.jsx)("rect",{width:"10",height:"10",fill:n.lineStroke}),(0,Wt.jsx)("rect",{x:"1",y:"1",width:"8",height:"8",fill:n.controlFill})]})]}),M=A?A.open?"polyline":"polygon":null,z=!x.showBoundingBox&&x.closestPoint!==null&&x.actionIntentType==="select-point",D=x.actionIntentType==="add-open-point",I=x.transitionIntentType==="split-line",q=x.transitioning&&x.selectedStamp&&x.transitionIntentType==="stamp-shape",B=A&&M?(0,Wt.jsxs)(Wt.Fragment,{children:[(0,Wt.jsx)(M,{fill:(!x.transitioning||x.transitionIntentType==="select-multiple-points")&&!A.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:A.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,Wt.jsx)("polygon",{fill:n.shapeFill,ref:m,stroke:n.lineStroke,strokeWidth:2,vectorEffect:"non-scaling-stroke"}):null,x.transitionIntentType==="draw-shape"&&x.transitioning?(0,Wt.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,Wt.jsx)("polyline",{strokeWidth:2,vectorEffect:"non-scaling-stroke",stroke:"transparent",markerStart:"url(#selected)",markerMid:"url(#selected)",markerEnd:"url(#selected)",fill:"transparent",points:A.points.filter((U,W)=>x.selectedPoints?.includes(W)).map(U=>U.join(",")).join(" "),opacity:x.transitioning&&x.transitionIntentType==="move-shape"?0:1}):null,z&&!x.transitioning&&x.closestPoint!==null&&A.points[x.closestPoint]?(0,Wt.jsx)("polyline",{strokeWidth:2,vectorEffect:"non-scaling-stroke",stroke:"transparent",markerStart:"url(#selected)",markerMid:"url(#selected)",markerEnd:"url(#selected)",fill:n.activeLineStroke,points:`${A.points[x.closestPoint][0]},${A.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,Wt.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,Wt.jsx)("g",{children:(0,Wt.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,Wt.jsx)("g",{ref:u,children:(0,Wt.jsx)("polyline",{markerStart:"url(#newdot)",points:"0,0 1,1",vectorEffect:"non-scaling-stroke",stroke:"transparent",fill:"transparent",strokeWidth:2})}):null,x.transitioning?(0,Wt.jsx)(M,{ref:p,fill:A.open?"none":n.shapeFill,stroke:x.transitionIntentType==="stamp-shape"?n.activeLineStroke:n.shapeStroke,vectorEffect:"non-scaling-stroke",strokeWidth:(A.open,2)}):null,x.transitioning&&x.transitionIntentType==="select-multiple-points"?(0,Wt.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,Wt.jsxs)(Wt.Fragment,{children:[(0,Wt.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,Wt.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:R.state.slowState.currentTool,setCurrentTool:R.tools.setTool,helper:R,currentShape:A,state:x,isAddingPoint:D,isSplitting:I,isStamping:q,isHoveringPoint:z,transitionDirection:v,transitionRotate:E,defs:T,editor:B}}var Ml=_(Y(),1);function QD(t){let e=iv(),{image:n}=t,{helper:i,defs:a,editor:o,state:s,transitionDirection:u,isSplitting:d,transitionRotate:p,isHoveringPoint:f,isAddingPoint:m}=rA({image:t.image,theme:t.theme}),g=(0,Ol.useCallback)(E=>{E.button!==2&&i.pointer([[~~E.atlas.x,~~E.atlas.y]])},[i]),v=(0,Ol.useCallback)(E=>{E.button!==2&&i.pointerDown()},[i]),S=(0,Ol.useCallback)(E=>{E.button!==2&&i.pointerUp()},[i]);return(0,Ol.useEffect)(()=>{let E=C=>{i.key.up(C.key)};return document.addEventListener("keyup",E),()=>{document.removeEventListener("keyup",E)}},[i]),(0,Ol.useEffect)(()=>{let E=C=>{C.target&&["INPUT","TEXTAREA"].includes(C.target.tagName)||C.target?.isContentEditable||document.activeElement&&(document.activeElement instanceof HTMLInputElement||document.activeElement instanceof HTMLTextAreaElement||document.activeElement.isContentEditable)||i.key.down(C.key)};return document.addEventListener("keydown",E),()=>{document.removeEventListener("keydown",E)}},[i]),(0,Ol.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,Ml.jsx)("world-object",{height:n.height,width:n.width,onMouseMove:g,onMouseDown:v,onMouseUp:S,onMouseLeave:i.blur,children:(0,Ml.jsx)(_i,{relative:!0,interactive:!1,children:(0,Ml.jsx)("div",{className:"absolute top-0 right-0 left-0 bottom-0",children:(0,Ml.jsxs)("svg",{width:"100%",height:"100%",viewBox:`0 0 ${n.width} ${n.height}`,tabIndex:-1,children:[(0,Ml.jsx)("title",{children:"Annotation Editor"}),(0,Ml.jsx)("defs",{children:a}),o]})})})})}var GL=_(nt(),1);var Dt=_(nt(),1);function Iv(){return typeof window<"u"}function _l(t){return XD(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=(XD(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function XD(t){return Iv()?t instanceof Node||t instanceof pi(t).Node:!1}function Ge(t){return Iv()?t instanceof Element||t instanceof pi(t).Element:!1}function zi(t){return Iv()?t instanceof HTMLElement||t instanceof pi(t).HTMLElement:!1}function Dh(t){return!Iv()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof pi(t).ShadowRoot}var Pq=new Set(["inline","contents"]);function $c(t){let{overflow:e,overflowX:n,overflowY:i,display:a}=Ni(t);return/auto|scroll|overlay|hidden|clip/.test(e+i+n)&&!Pq.has(a)}var Bq=new Set(["table","td","th"]);function KD(t){return Bq.has(_l(t))}var Hq=[":popover-open",":modal"];function Lh(t){return Hq.some(e=>{try{return t.matches(e)}catch{return!1}})}var Uq=["transform","translate","scale","rotate","perspective"],Vq=["transform","translate","scale","rotate","perspective","filter"],jq=["paint","layout","strict","content"];function Dv(t){let e=tf(),n=Ge(t)?Ni(t):t;return Uq.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)||Vq.some(i=>(n.willChange||"").includes(i))||jq.some(i=>(n.contain||"").includes(i))}function ZD(t){let e=Ka(t);for(;zi(e)&&!Ja(e);){if(Dv(e))return e;if(Lh(e))return null;e=Ka(e)}return null}function tf(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}var qq=new Set(["html","body","#document"]);function Ja(t){return qq.has(_l(t))}function Ni(t){return pi(t).getComputedStyle(t)}function Ph(t){return Ge(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Ka(t){if(_l(t)==="html")return t;let e=t.assignedSlot||t.parentNode||Dh(t)&&t.host||Za(t);return Dh(e)?e.host:e}function JD(t){let e=Ka(t);return Ja(e)?t.ownerDocument?t.ownerDocument.body:t.body:zi(e)&&$c(e)?e:JD(e)}function ra(t,e,n){var i;e===void 0&&(e=[]),n===void 0&&(n=!0);let a=JD(t),o=a===((i=t.ownerDocument)==null?void 0:i.body),s=pi(a);if(o){let u=Lv(s);return e.concat(s,s.visualViewport||[],$c(a)?a:[],u&&n?ra(u):[])}return e.concat(a,ra(a,[],n))}function Lv(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}var qh=_(nt(),1),aL=_(nt(),1);var ef=Math.min,cr=Math.max,Hh=Math.round,Uh=Math.floor,Wa=t=>({x:t,y:t}),Fq={left:"right",right:"left",bottom:"top",top:"bottom"},Gq={start:"end",end:"start"};function lA(t,e,n){return cr(t,ef(e,n))}function Vh(t,e){return typeof t=="function"?t(e):t}function zl(t){return t.split("-")[0]}function jh(t){return t.split("-")[1]}function sA(t){return t==="x"?"y":"x"}function uA(t){return t==="y"?"height":"width"}var kq=new Set(["top","bottom"]);function fr(t){return kq.has(zl(t))?"y":"x"}function cA(t){return sA(fr(t))}function tL(t,e,n){n===void 0&&(n=!1);let i=jh(t),a=cA(t),o=uA(a),s=a==="x"?i===(n?"end":"start")?"right":"left":i==="start"?"bottom":"top";return e.reference[o]>e.floating[o]&&(s=Bh(s)),[s,Bh(s)]}function eL(t){let e=Bh(t);return[Pv(t),e,Pv(e)]}function Pv(t){return t.replace(/start|end/g,e=>Gq[e])}var WD=["left","right"],$D=["right","left"],Yq=["top","bottom"],Qq=["bottom","top"];function Xq(t,e,n){switch(t){case"top":case"bottom":return n?e?$D:WD:e?WD:$D;case"left":case"right":return e?Yq:Qq;default:return[]}}function nL(t,e,n,i){let a=jh(t),o=Xq(zl(t),n==="start",i);return a&&(o=o.map(s=>s+"-"+a),e&&(o=o.concat(o.map(Pv)))),o}function Bh(t){return t.replace(/left|right|bottom|top/g,e=>Fq[e])}function Kq(t){return{top:0,right:0,bottom:0,left:0,...t}}function iL(t){return typeof t!="number"?Kq(t):{top:t,right:t,bottom:t,left:t}}function ks(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 fA(t,e){if(!t||!e)return!1;let n=e.getRootNode==null?void 0:e.getRootNode();if(t.contains(e))return!0;if(n&&Dh(n)){let i=e;for(;i;){if(t===i)return!0;i=i.parentNode||i.host}}return!1}function nf(t){return"composedPath"in t?t.composedPath()[0]:t.target}function Bv(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 oL(t){return t.matches("html,body")}function dA(t){return t?.ownerDocument||document}function Fh(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,...Fh(t,a.id,n)])}function rL(t){return"nativeEvent"in t}var Zq=typeof document<"u",Jq=function(){},Hv=Zq?aL.useLayoutEffect:Jq,Wq={...qh};var $q=Wq.useInsertionEffect,t7=$q||(t=>t());function Ys(t){let e=qh.useRef(()=>{});return t7(()=>{e.current=t}),qh.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 EA=_(Y(),1);var DL=_(ds(),1);function lL(t,e,n){let{reference:i,floating:a}=t,o=fr(e),s=cA(e),u=uA(s),d=zl(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(jh(e)){case"start":v[s]-=g*(n&&p?-1:1);break;case"end":v[s]+=g*(n&&p?-1:1);break}return v}var sL=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}=lL(p,i,d),g=i,v={},S=0;for(let E=0;E<u.length;E++){let{name:C,fn:R}=u[E],{x,y:A,data:T,reset:M}=await R({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=A??m,v={...v,[C]:{...v[C],...T}},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}=lL(p,g,d)),E=-1)}return{x:f,y:m,placement:g,strategy:a,middlewareData:v}};async function hA(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}=Vh(e,t),S=iL(v),C=u[g?m==="floating"?"reference":"floating":m],R=ks(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(C)))==null||n?C:C.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,A=await(o.getOffsetParent==null?void 0:o.getOffsetParent(u.floating)),T=await(o.isElement==null?void 0:o.isElement(A))?await(o.getScale==null?void 0:o.getScale(A))||{x:1,y:1}:{x:1,y:1},M=ks(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:u,rect:x,offsetParent:A,strategy:d}):x);return{top:(R.top-M.top+S.top)/T.y,bottom:(M.bottom-R.bottom+S.bottom)/T.y,left:(R.left-M.left+S.left)/T.x,right:(M.right-R.right+S.right)/T.x}}var uL=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,...C}=Vh(t,e);if((n=o.arrow)!=null&&n.alignmentOffset)return{};let R=zl(a),x=fr(u),A=zl(u)===u,T=await(d.isRTL==null?void 0:d.isRTL(p.floating)),M=g||(A||!E?[Bh(u)]:eL(u)),z=S!=="none";!g&&z&&M.push(...nL(u,E,S,T));let D=[u,...M],I=await hA(e,C),q=[],B=((i=o.flip)==null?void 0:i.overflows)||[];if(f&&q.push(I[R]),m){let K=tL(a,s,T);q.push(I[K[0]],I[K[1]])}if(B=[...B,{placement:a,overflows:q}],!q.every(K=>K<=0)){var U,W;let K=(((U=o.flip)==null?void 0:U.index)||0)+1,tt=D[K];if(tt&&(!(m==="alignment"?x!==fr(tt):!1)||B.every(lt=>lt.overflows[0]>0&&fr(lt.placement)===x)))return{data:{index:K,overflows:B},reset:{placement:tt}};let ut=(W=B.filter(xt=>xt.overflows[0]<=0).sort((xt,lt)=>xt.overflows[1]-lt.overflows[1])[0])==null?void 0:W.placement;if(!ut)switch(v){case"bestFit":{var it;let xt=(it=B.filter(lt=>{if(z){let ft=fr(lt.placement);return ft===x||ft==="y"}return!0}).map(lt=>[lt.placement,lt.overflows.filter(ft=>ft>0).reduce((ft,Rt)=>ft+Rt,0)]).sort((lt,ft)=>lt[1]-ft[1])[0])==null?void 0:it[0];xt&&(ut=xt);break}case"initialPlacement":ut=u;break}if(a!==ut)return{reset:{placement:ut}}}return{}}}};var e7=new Set(["left","top"]);async function n7(t,e){let{placement:n,platform:i,elements:a}=t,o=await(i.isRTL==null?void 0:i.isRTL(a.floating)),s=zl(n),u=jh(n),d=fr(n)==="y",p=e7.has(s)?-1:1,f=o&&d?-1:1,m=Vh(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 cL=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 n7(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}}}}},fL=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:C=>{let{x:R,y:x}=C;return{x:R,y:x}}},...d}=Vh(t,e),p={x:n,y:i},f=await hA(e,d),m=fr(zl(a)),g=sA(m),v=p[g],S=p[m];if(o){let C=g==="y"?"top":"left",R=g==="y"?"bottom":"right",x=v+f[C],A=v-f[R];v=lA(x,v,A)}if(s){let C=m==="y"?"top":"left",R=m==="y"?"bottom":"right",x=S+f[C],A=S-f[R];S=lA(x,S,A)}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 pL(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=Hh(n)!==o||Hh(i)!==s;return u&&(n=o,i=s),{width:n,height:i,$:u}}function mA(t){return Ge(t)?t:t.contextElement}function af(t){let e=mA(t);if(!zi(e))return Wa(1);let n=e.getBoundingClientRect(),{width:i,height:a,$:o}=pL(e),s=(o?Hh(n.width):n.width)/i,u=(o?Hh(n.height):n.height)/a;return(!s||!Number.isFinite(s))&&(s=1),(!u||!Number.isFinite(u))&&(u=1),{x:s,y:u}}var i7=Wa(0);function mL(t){let e=pi(t);return!tf()||!e.visualViewport?i7:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function a7(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==pi(t)?!1:e}function Qs(t,e,n,i){e===void 0&&(e=!1),n===void 0&&(n=!1);let a=t.getBoundingClientRect(),o=mA(t),s=Wa(1);e&&(i?Ge(i)&&(s=af(i)):s=af(t));let u=a7(o,n,i)?mL(o):Wa(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=Lv(S);for(;E&&i&&v!==S;){let C=af(E),R=E.getBoundingClientRect(),x=Ni(E),A=R.left+(E.clientLeft+parseFloat(x.paddingLeft))*C.x,T=R.top+(E.clientTop+parseFloat(x.paddingTop))*C.y;d*=C.x,p*=C.y,f*=C.x,m*=C.y,d+=A,p+=T,S=pi(E),E=Lv(S)}}return ks({width:f,height:m,x:d,y:p})}function gA(t,e){let n=Ph(t).scrollLeft;return e?e.left+n:Qs(Za(t)).left+n}function gL(t,e,n){n===void 0&&(n=!1);let i=t.getBoundingClientRect(),a=i.left+e.scrollLeft-(n?0:gA(t,i)),o=i.top+e.scrollTop;return{x:a,y:o}}function o7(t){let{elements:e,rect:n,offsetParent:i,strategy:a}=t,o=a==="fixed",s=Za(i),u=e?Lh(e.floating):!1;if(i===s||u&&o)return n;let d={scrollLeft:0,scrollTop:0},p=Wa(1),f=Wa(0),m=zi(i);if((m||!m&&!o)&&((_l(i)!=="body"||$c(s))&&(d=Ph(i)),zi(i))){let v=Qs(i);p=af(i),f.x=v.x+i.clientLeft,f.y=v.y+i.clientTop}let g=s&&!m&&!o?gL(s,d,!0):Wa(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 r7(t){return Array.from(t.getClientRects())}function l7(t){let e=Za(t),n=Ph(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+gA(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 s7(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=tf();(!p||p&&e==="fixed")&&(u=a.offsetLeft,d=a.offsetTop)}return{width:o,height:s,x:u,y:d}}var u7=new Set(["absolute","fixed"]);function c7(t,e){let n=Qs(t,!0,e==="fixed"),i=n.top+t.clientTop,a=n.left+t.clientLeft,o=zi(t)?af(t):Wa(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 dL(t,e,n){let i;if(e==="viewport")i=s7(t,n);else if(e==="document")i=l7(Za(t));else if(Ge(e))i=c7(e,n);else{let a=mL(t);i={x:e.x-a.x,y:e.y-a.y,width:e.width,height:e.height}}return ks(i)}function yL(t,e){let n=Ka(t);return n===e||!Ge(n)||Ja(n)?!1:Ni(n).position==="fixed"||yL(n,e)}function f7(t,e){let n=e.get(t);if(n)return n;let i=ra(t,[],!1).filter(u=>Ge(u)&&_l(u)!=="body"),a=null,o=Ni(t).position==="fixed",s=o?Ka(t):t;for(;Ge(s)&&!Ja(s);){let u=Ni(s),d=Dv(s);!d&&u.position==="fixed"&&(a=null),(o?!d&&!a:!d&&u.position==="static"&&!!a&&u7.has(a.position)||$c(s)&&!d&&yL(t,s))?i=i.filter(f=>f!==s):a=u,s=Ka(s)}return e.set(t,i),i}function d7(t){let{element:e,boundary:n,rootBoundary:i,strategy:a}=t,s=[...n==="clippingAncestors"?Lh(e)?[]:f7(e,this._c):[].concat(n),i],u=s[0],d=s.reduce((p,f)=>{let m=dL(e,f,a);return p.top=cr(m.top,p.top),p.right=ef(m.right,p.right),p.bottom=ef(m.bottom,p.bottom),p.left=cr(m.left,p.left),p},dL(e,u,a));return{width:d.right-d.left,height:d.bottom-d.top,x:d.left,y:d.top}}function h7(t){let{width:e,height:n}=pL(t);return{width:e,height:n}}function p7(t,e,n){let i=zi(e),a=Za(e),o=n==="fixed",s=Qs(t,!0,o,e),u={scrollLeft:0,scrollTop:0},d=Wa(0);function p(){d.x=gA(a)}if(i||!i&&!o)if((_l(e)!=="body"||$c(a))&&(u=Ph(e)),i){let v=Qs(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?gL(a,u):Wa(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 pA(t){return Ni(t).position==="static"}function hL(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 vL(t,e){let n=pi(t);if(Lh(t))return n;if(!zi(t)){let a=Ka(t);for(;a&&!Ja(a);){if(Ge(a)&&!pA(a))return a;a=Ka(a)}return n}let i=hL(t,e);for(;i&&KD(i)&&pA(i);)i=hL(i,e);return i&&Ja(i)&&pA(i)&&!Dv(i)?n:i||ZD(t)||n}var m7=async function(t){let e=this.getOffsetParent||vL,n=this.getDimensions,i=await n(t.floating);return{reference:p7(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function g7(t){return Ni(t).direction==="rtl"}var yA={convertOffsetParentRelativeRectToViewportRelativeRect:o7,getDocumentElement:Za,getClippingRect:d7,getOffsetParent:vL,getElementRects:m7,getClientRects:r7,getDimensions:h7,getScale:af,isElement:Ge,isRTL:g7};function SL(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function y7(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=Uh(m),E=Uh(a.clientWidth-(f+g)),C=Uh(a.clientHeight-(m+v)),R=Uh(f),A={rootMargin:-S+"px "+-E+"px "+-C+"px "+-R+"px",threshold:cr(0,ef(1,d))||1},T=!0;function M(z){let D=z[0].intersectionRatio;if(D!==d){if(!T)return s();D?s(!1,D):i=setTimeout(()=>{s(!1,1e-7)},1e3)}D===1&&!SL(p,t.getBoundingClientRect())&&s(),T=!1}try{n=new IntersectionObserver(M,{...A,root:a.ownerDocument})}catch{n=new IntersectionObserver(M,A)}n.observe(t)}return s(!0),o}function Uv(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=mA(t),f=a||o?[...p?ra(p):[],...ra(e)]:[];f.forEach(R=>{a&&R.addEventListener("scroll",n,{passive:!0}),o&&R.addEventListener("resize",n)});let m=p&&u?y7(p,n):null,g=-1,v=null;s&&(v=new ResizeObserver(R=>{let[x]=R;x&&x.target===p&&v&&(v.unobserve(e),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var A;(A=v)==null||A.observe(e)})),n()}),p&&!d&&v.observe(p),v.observe(e));let S,E=d?Qs(t):null;d&&C();function C(){let R=Qs(t);E&&!SL(E,R)&&n(),E=R,S=requestAnimationFrame(C)}return n(),()=>{var R;f.forEach(x=>{a&&x.removeEventListener("scroll",n),o&&x.removeEventListener("resize",n)}),m?.(),(R=v)==null||R.disconnect(),v=null,d&&cancelAnimationFrame(S)}}var bL=cL;var xL=fL,EL=uL;var Vv=(t,e,n)=>{let i=new Map,a={platform:yA,...n},o={...a.platform,_c:i};return sL(t,e,{...a,platform:o})};var vn=_(nt(),1),TL=_(nt(),1),CL=_(ds(),1),v7=typeof document<"u",S7=function(){},jv=v7?TL.useLayoutEffect:S7;function qv(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(!qv(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)&&!qv(t[o],e[o]))return!1}return!0}return t!==t&&e!==e}function wL(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function RL(t,e){let n=wL(t);return Math.round(e*n)/n}function vA(t){let e=vn.useRef(t);return jv(()=>{e.current=t}),e}function ML(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);qv(g,i)||v(i);let[S,E]=vn.useState(null),[C,R]=vn.useState(null),x=vn.useCallback(lt=>{lt!==z.current&&(z.current=lt,E(lt))},[]),A=vn.useCallback(lt=>{lt!==D.current&&(D.current=lt,R(lt))},[]),T=o||S,M=s||C,z=vn.useRef(null),D=vn.useRef(null),I=vn.useRef(f),q=d!=null,B=vA(d),U=vA(a),W=vA(p),it=vn.useCallback(()=>{if(!z.current||!D.current)return;let lt={placement:e,strategy:n,middleware:g};U.current&&(lt.platform=U.current),Vv(z.current,D.current,lt).then(ft=>{let Rt={...ft,isPositioned:W.current!==!1};K.current&&!qv(I.current,Rt)&&(I.current=Rt,CL.flushSync(()=>{m(Rt)}))})},[g,e,n,U,W]);jv(()=>{p===!1&&I.current.isPositioned&&(I.current.isPositioned=!1,m(lt=>({...lt,isPositioned:!1})))},[p]);let K=vn.useRef(!1);jv(()=>(K.current=!0,()=>{K.current=!1}),[]),jv(()=>{if(T&&(z.current=T),M&&(D.current=M),T&&M){if(B.current)return B.current(T,M,it);it()}},[T,M,it,B,q]);let tt=vn.useMemo(()=>({reference:z,floating:D,setReference:x,setFloating:A}),[x,A]),ut=vn.useMemo(()=>({reference:T,floating:M}),[T,M]),xt=vn.useMemo(()=>{let lt={position:n,left:0,top:0};if(!ut.floating)return lt;let ft=RL(ut.floating,f.x),Rt=RL(ut.floating,f.y);return u?{...lt,transform:"translate("+ft+"px, "+Rt+"px)",...wL(ut.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:ft,top:Rt}},[n,u,ut.floating,f.x,f.y]);return vn.useMemo(()=>({...f,update:it,refs:tt,elements:ut,floatingStyles:xt}),[f,it,tt,ut,xt])}var Fv=(t,e)=>({...bL(t),options:[t,e]}),SA=(t,e)=>({...xL(t),options:[t,e]});var bA=(t,e)=>({...EL(t),options:[t,e]});var b7="data-floating-ui-focusable",OL="active",_L="selected",x7="ArrowLeft",E7="ArrowRight",R7="ArrowUp",A7="ArrowDown";var T7=[x7,E7],C7=[R7,A7],gW=[...T7,...C7];var w7={...Dt},zL=!1,M7=0,NL=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+M7++;function O7(){let[t,e]=Dt.useState(()=>zL?NL():void 0);return Hv(()=>{t==null&&e(NL())},[]),Dt.useEffect(()=>{zL=!0},[]),t}var _7=w7.useId,z7=_7||O7;function N7(){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 I7=Dt.createContext(null),D7=Dt.createContext(null),L7=()=>{var t;return((t=Dt.useContext(I7))==null?void 0:t.id)||null},LL=()=>Dt.useContext(D7);function P7(t){return"data-floating-ui-"+t}function B7(t){t.current!==-1&&(clearTimeout(t.current),t.current=-1)}var H7={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},U7={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},IL=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 PL(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=LL(),C=Ys(typeof d=="function"?d:()=>!1),R=typeof d=="function"?C:d,x=Dt.useRef(!1),{escapeKey:A,outsidePress:T}=IL(v),{escapeKey:M,outsidePress:z}=IL(S),D=Dt.useRef(!1),I=Dt.useRef(-1),q=Ys(tt=>{var ut;if(!n||!s||!u||tt.key!=="Escape"||D.current)return;let xt=(ut=o.current.floatingContext)==null?void 0:ut.nodeId,lt=E?Fh(E.nodesRef.current,xt):[];if(!A&&(tt.stopPropagation(),lt.length>0)){let ft=!0;if(lt.forEach(Rt=>{var X;if((X=Rt.context)!=null&&X.open&&!Rt.context.dataRef.current.__escapeKeyBubbles){ft=!1;return}}),!ft)return}i(!1,rL(tt)?tt.nativeEvent:tt,"escape-key")}),B=Ys(tt=>{var ut;let xt=()=>{var lt;q(tt),(lt=nf(tt))==null||lt.removeEventListener("keydown",xt)};(ut=nf(tt))==null||ut.addEventListener("keydown",xt)}),U=Ys(tt=>{var ut;let xt=o.current.insideReactTree;o.current.insideReactTree=!1;let lt=x.current;if(x.current=!1,p==="click"&&lt||xt||typeof R=="function"&&!R(tt))return;let ft=nf(tt),Rt="["+P7("inert")+"]",X=dA(a.floating).querySelectorAll(Rt),Ct=Ge(ft)?ft:null;for(;Ct&&!Ja(Ct);){let pe=Ka(Ct);if(Ja(pe)||!Ge(pe))break;Ct=pe}if(X.length&&Ge(ft)&&!oL(ft)&&!fA(ft,a.floating)&&Array.from(X).every(pe=>!fA(Ct,pe)))return;if(zi(ft)&&K){let pe=Ja(ft),De=Ni(ft),ne=/auto|scroll/,Di=pe||ne.test(De.overflowX),ri=pe||ne.test(De.overflowY),me=Di&&ft.clientWidth>0&&ft.scrollWidth>ft.clientWidth,ge=ri&&ft.clientHeight>0&&ft.scrollHeight>ft.clientHeight,$t=De.direction==="rtl",Mn=ge&&($t?tt.offsetX<=ft.offsetWidth-ft.clientWidth:tt.offsetX>ft.clientWidth),St=me&&tt.offsetY>ft.clientHeight;if(Mn||St)return}let ee=(ut=o.current.floatingContext)==null?void 0:ut.nodeId,ce=E&&Fh(E.nodesRef.current,ee).some(pe=>{var De;return Bv(tt,(De=pe.context)==null?void 0:De.elements.floating)});if(Bv(tt,a.floating)||Bv(tt,a.domReference)||ce)return;let le=E?Fh(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")}),W=Ys(tt=>{var ut;let xt=()=>{var lt;U(tt),(lt=nf(tt))==null||lt.removeEventListener(p,xt)};(ut=nf(tt))==null||ut.addEventListener(p,xt)});Dt.useEffect(()=>{if(!n||!s)return;o.current.__escapeKeyBubbles=A,o.current.__outsidePressBubbles=T;let tt=-1;function ut(X){i(!1,X,"ancestor-scroll")}function xt(){window.clearTimeout(tt),D.current=!0}function lt(){tt=window.setTimeout(()=>{D.current=!1},tf()?5:0)}let ft=dA(a.floating);u&&(ft.addEventListener("keydown",M?B:q,M),ft.addEventListener("compositionstart",xt),ft.addEventListener("compositionend",lt)),R&&ft.addEventListener(p,z?W: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(X=>{var Ct;return X!==((Ct=ft.defaultView)==null?void 0:Ct.visualViewport)}),Rt.forEach(X=>{X.addEventListener("scroll",ut,{passive:!0})}),()=>{u&&(ft.removeEventListener("keydown",M?B:q,M),ft.removeEventListener("compositionstart",xt),ft.removeEventListener("compositionend",lt)),R&&ft.removeEventListener(p,z?W:U,z),Rt.forEach(X=>{X.removeEventListener("scroll",ut)}),window.clearTimeout(tt)}},[o,a,u,R,p,n,i,g,s,A,T,q,M,B,U,z,W]),Dt.useEffect(()=>{o.current.insideReactTree=!1},[o,R,p]);let it=Dt.useMemo(()=>({onKeyDown:q,...f&&{[H7[m]]:tt=>{i(!1,tt.nativeEvent,"reference-press")},...m!=="click"&&{onClick(tt){i(!1,tt.nativeEvent,"reference-press")}}}}),[q,i,f,m]),K=Dt.useMemo(()=>({onKeyDown:q,onMouseDown(){x.current=!0},onMouseUp(){x.current=!0},[U7[p]]:()=>{o.current.insideReactTree=!0},onBlurCapture(){E||(B7(I),o.current.insideReactTree=!0,I.current=window.setTimeout(()=>{o.current.insideReactTree=!1}))}}),[q,p,o,E]);return Dt.useMemo(()=>s?{reference:it,floating:K}:{},[s,it,K])}function V7(t){let{open:e=!1,onOpenChange:n,elements:i}=t,a=z7(),o=Dt.useRef({}),[s]=Dt.useState(()=>N7()),u=L7()!=null,[d,p]=Dt.useState(i.reference),f=Ys((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 BL(t){t===void 0&&(t={});let{nodeId:e}=t,n=V7({...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=LL();Hv(()=>{f&&(m.current=f)},[f]);let v=ML({...t,elements:{...a,...u&&{reference:u}}}),S=Dt.useCallback(A=>{let T=Ge(A)?{getBoundingClientRect:()=>A.getBoundingClientRect(),getClientRects:()=>A.getClientRects(),contextElement:A}:A;d(T),v.refs.setReference(T)},[v.refs]),E=Dt.useCallback(A=>{(Ge(A)||A===null)&&(m.current=A,s(A)),(Ge(v.refs.reference.current)||v.refs.reference.current===null||A!==null&&!Ge(A))&&v.refs.setReference(A)},[v.refs]),C=Dt.useMemo(()=>({...v.refs,setReference:E,setPositionReference:S,domReference:m}),[v.refs,E,S]),R=Dt.useMemo(()=>({...v.elements,domReference:f}),[v.elements,f]),x=Dt.useMemo(()=>({...v,...i,refs:C,elements:R,nodeId:e}),[v,C,R,e,i]);return Hv(()=>{i.dataRef.current.floatingContext=x;let A=g?.nodesRef.current.find(T=>T.id===e);A&&(A.context=x)}),Dt.useMemo(()=>({...v,context:x,refs:C,elements:R}),[v,C,R,x])}function xA(t,e,n){let i=new Map,a=n==="item",o=t;if(a&&t){let{[OL]:s,[_L]:u,...d}=t;o=d}return{...n==="floating"&&{tabIndex:-1,[b7]:""},...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&&[OL,_L].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(C=>C(...S)).find(C=>C!==void 0)}}}else s[p]=f}),s),{})}}function HL(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=>xA(u,t,"reference"),e),o=Dt.useCallback(u=>xA(u,t,"floating"),n),s=Dt.useCallback(u=>xA(u,t,"item"),i);return Dt.useMemo(()=>({getReferenceProps:a,getFloatingProps:o,getItemProps:s}),[a,o,s])}var FL=_(ds(),1);var Ln=_(nt(),1);var UL=_(nt(),1),Gv=_(nt(),1);var jL=_(Y(),1),VL=ka(),Xs=(0,Gv.createContext)({emitter:VL});Xs.displayName="Events";function Gh(){return UL.default.useContext(Xs).emitter}function j7({emitter:t,children:e}){return(0,jL.jsx)(Xs.Provider,{value:(0,Gv.useMemo)(()=>({emitter:t}),[t]),children:e})}var la=_(Y(),1),kh=Ln.default.createContext({});function Yh(){let t=(0,Ln.useContext)(kh),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 qL(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 q7(t){let e=(0,Ln.useContext)(kh),n=(0,Ln.useMemo)(()=>({...e,...t.providers}),[t.providers]);return(0,la.jsx)(kh.Provider,{value:n,children:t.children})}function Qh(){return{VaultContext:(0,Ln.useContext)(Br),ResourceContext:(0,Ln.useContext)(qf),SimpleViewerReactContext:(0,Ln.useContext)(Fu),VisibleCanvasReactContext:(0,Ln.useContext)(rs),AuthRContext:(0,Ln.useContext)(ss),SearchReactContext:(0,Ln.useContext)(qu),ReactEventContext:(0,Ln.useContext)(Xs),ContextBridgeReactContext:(0,Ln.useContext)(kh),StrategyReactContext:(0,Ln.useContext)(Rl),AtlasStoreReactContext:(0,Ln.useContext)(Ls)}}function Xh(t){return(0,la.jsx)(Io,{vault:t.bridge.VaultContext.vault||void 0,resources:t.bridge.ResourceContext,children:(0,la.jsx)(rs.Provider,{value:t.bridge.VisibleCanvasReactContext,children:(0,la.jsx)(Fu.Provider,{value:t.bridge.SimpleViewerReactContext,children:(0,la.jsx)(Xs.Provider,{value:t.bridge.ReactEventContext,children:(0,la.jsx)(Ls.Provider,{value:t.bridge.AtlasStoreReactContext,children:(0,la.jsx)(ss.Provider,{value:t.bridge.AuthRContext,children:(0,la.jsx)(qu.Provider,{value:t.bridge.SearchReactContext,children:(0,la.jsx)(kh.Provider,{value:t.bridge.ContextBridgeReactContext,children:(0,la.jsx)(Rl.Provider,{value:t.bridge.StrategyReactContext,children:t.custom?(0,la.jsx)(qL,{...t.custom,children:t.children}):t.children})})})})})})})})})}var of=_(Y(),1);function kv({annotation:t,target:e,children:n,dismissable:i,isOpen:a,onOpenChange:o,placement:s}){let u=Qh(),d=Yh(),{refs:p,floatingStyles:f,context:m}=BL({open:a,onOpenChange:o,nodeId:t.id,placement:s||"bottom",middleware:[Fv(10),SA(),bA({mainAxis:!0})],whileElementsMounted:Uv}),g=PL(m),{getReferenceProps:v,getFloatingProps:S}=HL([i?g:null].filter(E=>E!==null));return(0,of.jsxs)(_i,{relative:!0,target:e,interactive:!1,children:[(0,of.jsx)("div",{ref:p.setReference,...v(),style:{position:"absolute",top:0,left:0,right:0,bottom:0,pointerEvents:"none"}}),(0,FL.createPortal)((0,of.jsx)(Xh,{bridge:u,custom:d,children:(0,of.jsx)("div",{ref:p.setFloating,style:f,...S(),children:n})}),document.getElementById("atlas-floating-ui"))]})}var Kh=_(Y(),1),kL=Fm()(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 Zh(t,e,n){let{isMenuOpen:i,setIsMenuOpen:a,close:o,open:s,menuPosition:u,setMenuPosition:d,toggle:p}=kL(),f=(0,GL.useCallback)(v=>{n&&(v.preventDefault(),v.stopPropagation(),p(v.atlas))},[p,n]);return[(0,Kh.jsx)(Kh.Fragment,{children:n&&i&&(0,Kh.jsx)(kv,{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 RA(){let t=Ie();return bt(t,e=>e.tool.requestId&&e.requests[e.tool.requestId]||null)}var ai=_(Y(),1);function AA({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,Yv.useMemo)(()=>Sl(o),[o]),v=RA(),[S,E]=Zh("editing-annotation",a?.id,e),C=v?.annotationPopup||n||(0,ai.jsx)(YL,{}),R=v?.svgTheme||t,x=()=>{d("sketch")};if(!f||!a||!m||!o)return null;let A=g&&o.id&&!p&&(s==="pointer"||s==="hand"||!o.open)?(0,ai.jsx)(kv,{annotation:o,target:g,children:C}):null,T="shape";return u==="explore"?(0,ai.jsxs)(ai.Fragment,{children:[(0,ai.jsx)(T,{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)(T,{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)"}}),A]}):(0,ai.jsxs)(ai.Fragment,{children:[e?(0,ai.jsx)(T,{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)(QD,{image:a,theme:R}),A,S]})}function YL(){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,Yv.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 Nl=_(nt(),1);var rf=_(nt(),1);function F7(t){return t.type==="SpecificResource"?[t.source,{selector:t.selector}]:[t,{selector:null}]}function Jh(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 TA={makeChoice:()=>{}},Wh={type:"unknown"},Be=t=>({type:"unknown",reason:t,annotations:{pages:[]}}),CA=(t,e)=>({type:"empty",width:t,height:e,annotations:{pages:[]},image:null,images:[]});var $h=_(nt(),1);function G7(t,e){let n=t?.iiif?.meta[e];return n?n.annotationPageManager:null}function QL(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=G7(n,o);s&&s.views&&s.views[t]&&i.push(o)}return i},[t,e])}function wA({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 k7(t,e){let n=t?.iiif?.meta[e];return n?n.annotationPageManager:null}function tp(t,e={}){let n=Vt(),i=on(),a=zt(),o=ls(),s=(0,$h.useMemo)(()=>wA({all:e.all,manifest:i,canvas:a,canvases:o}),[e.all,a,o,i]),u=QL(t,e.all?void 0:s),d=(0,$h.useCallback)(f=>{t&&n.setMetaValue([f,"annotationPageManager","views"],m=>m&&!m[t]?m:{...m||{},[t]:!1})},[t,n]),p=(0,$h.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 C=k7(g,E);C&&C.views&&C.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 MA(t,e){return re((n,i)=>i.get(t.map(a=>({id:a,type:e}))),[t,e])}var XL=_(nt(),1);var Y7=Yi((t,e)=>({loaded:{},setLoaded:(n,i="done")=>{t(a=>({loaded:{...a.loaded,[n]:i}}))}})),Q7=ka();Q7.on("loaded",t=>{Y7.getState().setLoaded(t.imageServiceId)});function ep(){let t=Kc(),e=OD();return[(0,XL.useCallback)((i,{height:a,width:o})=>i&&t(i,{height:a,width:o},!0),[t]),e]}var Ks=_(nt(),1);function dr(t={}){let e=Ah(),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 OA(t,e=[]){let n=Vt(),i=(0,Ks.useMemo)(()=>Qc(n),[]),a=dr({enableSingleAnnotation:t?.enableSingleAnnotation}),[o,s]=(0,Ks.useState)(t?.defaultChoices||[]),u=(0,Ks.useMemo)(()=>i.getPaintables(a,o),[n,a,o,...e]),p={makeChoice:(0,Ks.useCallback)((f,{deselectOthers:m=!0,deselect:g=!1}={})=>{u.choice&&s(v=>{if(g){let E=v.filter(C=>C!==f);if(E.length===0){let C=u.items[0].resource.id;return C?[C]:[]}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 X7=["model/gltf-binary"];function _A(t,e){let n=e.items[0],i=n.resource;return i.format?X7.indexOf(i.format)===-1?Be(`3D format: ${i.format} is unsupported`):{type:"3d-model",model:i,annotationId:n.annotationId,annotation:n.annotation}:Be("Unknown format")}function Qv(t,e){let n=e.items,i=n[0];if(n.length===0||!i)return Be("No audio");if(!t.duration)return Be("No duration on canvas");if(n.length>1)return Be("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:[]}}):Be("Unknown audio")}function hr(t){return t.replace(/^http:/,"https:")}function np(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 Be("No resource Identifier");let u;if(s.service){let C=jr(s);C[0]&&(u=n(C[0],t))}let d={type:"BoxSelector",spatial:{x:0,y:0,width:Number(t.width),height:Number(t.height)}},[p,f]=Jh(t,o.target),m=t.id?.split("?")[0]||"";if(!(hr(f.id||"")===hr(t.id)||hr(decodeURIComponent(f.id||""))===hr(t.id||"")||hr(f.id||"")===hr(m)||hr(decodeURIComponent(f.id||""))===hr(m)))continue;let g=o.resource.width&&o.resource.height?{type:"BoxSelector",spatial:{x:0,y:0,width:o.resource.width,height:o.resource.height}}:void 0,v=o.resource.type==="SpecificResource"?an(o.resource):null;if(o.selector){let C=an({type:"SpecificResource",source:o.resource,selector:o.selector});C&&(v=C)}let S=v&&v.selector&&(v.selector.type==="BoxSelector"||v.selector.type==="TemporalBoxSelector")?{type:"BoxSelector",spatial:{x:v.selector.spatial.x,y:v.selector.spatial.y,width:v.selector.spatial.width,height:v.selector.spatial.height}}:void 0;u&&!u.id&&(u.id=u["@id"]);let E={id:s.id,type:"Image",annotationId:o.annotationId,annotation:o.annotation,width:Number(p||S?s.width:t.width),height:Number(p||S?s.height:t.height),service:u,sizes:u&&u.sizes?u.sizes:s.width&&s.height?[{width:s.width,height:s.height}]:[],target:p&&p.type!=="PointSelector"?p:d,selector:S||{type:"BoxSelector",spatial:{x:0,y:0,width:Number(t.width),height:Number(t.height)}},annotationPages:o.resource.annotations||[]};i.push(E)}return{type:"images",image:i[0],images:i,choice:e.choice}}function KL(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=>KL(a,e,i))}return e}function ip(t,e){let n=[];return e.items.forEach(i=>{if(i.resource){let[a]=Jh(t,i.target);n.push({type:"Text",annotationId:i.annotationId,annotation:i.annotation,text:KL(i.resource),target:a})}}),{type:"textual-content",items:n}}var K7=/^.*(?:(?:youtu\.be\/|v\/|vi\/|u\/\w\/|embed\/|shorts\/)|(?:(?:watch)?\?vi?=|&vi?=))([^#&?]*).*/;function ap(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 Be("Only one video source supported");let d=a[0]?.resource,p=!!(d.service||[]).find(E=>(E.profile||"").includes("youtube.com"));if(!p&&u)return Be("Video does not have duration");if(!d)return Be("Unknown video");if((!d.format||d.format==="text/html")&&!p)return Be("Video does not have format");let f=[],m=n.get(t.annotations||[]);for(let E of m){let C=n.get(E.items||[]);for(let R of C)if((R.motivation?Array.isArray(R.motivation||"")?R.motivation:[R.motivation]:[]).includes("supplementing")){let A=n.get(R.body||[]);for(let T of A){let M=T;if(M.type==="Choice")for(let z of M.items){let D=n.get(z);D.format==="text/vtt"&&f.push({id:D.id,type:"Text",format:"text/vtt",label:D.label,language:D.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,R=(g.target.temporal.endTime||t.duration)-E;g.selector={type:"TemporalSelector",temporal:{startTime:0,endTime:R}}}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(K7);if(!E[1])return Be("Video is not known youtube video");g.youTubeId=E[1]}return{type:"media",media:g,annotations:{pages:[]},noSpatial:s,captions:f}}function zA(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=np(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=ip(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=ap(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=Qv(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 Xv={},NA={get(t){return t},setMetaValue([t,e,n],i){let a=NA.getResourceMeta(t,e),o=a?a[n]:void 0,s=typeof i=="function"?i(o):i;Xv[t]={...Xv[t]||{},[e]:{...(Xv[t]||{})[e]||{},[n]:s}}},getResourceMeta:(t,e)=>{let n=Xv[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 op({canvas:t,paintables:e,supports:n,loadImageService:i,vault:a=NA}){if(!t)return Wh;if(e.types.length===0)return n.indexOf("empty")!==-1?CA(t.width,t.height):Wh;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?Be("Complex timeline not supported"):zA(t,e,i,a);let o=e.types[0];return o==="image"?n.indexOf("images")===-1?Be("Image not supported"):np(t,e,i):o==="Model"||o==="model"?n.indexOf("3d-model")===-1?Be("3D not supported"):_A(t,e):o==="textualbody"?n.indexOf("textual-content")===-1?Be("Textual content not supported"):ip(t,e):o==="sound"||o==="audio"?n.indexOf("media")===-1?Be("Media not supported"):Qv(t,e):o==="video"?n.indexOf("media")===-1?Be("Media not supported"):ap(t,e,a):Wh}function IA(t){let e=on(),n=zt(),i=Vt(),a=Gh(),o=t?.emitter||a,[s,u]=ep(),{enabledPageIds:d}=tp(t?.annotationPageManagerId||e?.id||n?.id,{all:!1}),p=MA(d,"AnnotationPage"),f=t?.strategies||["empty","images","media","textual-content","complex-timeline"],[m,g]=OA(t,[u]);(0,rf.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,rf.useMemo)(()=>op({canvas:n,paintables:m,supports:f,loadImageService:s,vault:i}),[n,m,i,g.makeChoice]);return(0,rf.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,rf.useMemo)(()=>v.type==="unknown"?[v,TA]:[{...v,annotations:{pages:p}},g],[v,p])}var DA=_(Y(),1);function LA({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,Nl.useMemo)(()=>bl(v),[v]),[E,C]=IA({strategies:t||["images"],defaultChoices:n?.map(({id:T})=>T)}),R="choice"in E?E.choice:void 0;if((0,Nl.useEffect)(()=>{e&&e(C)},[E.annotations]),(0,Nl.useEffect)(()=>{i&&i(R)},[R]),(0,Nl.useEffect)(()=>{if(n)for(let T of n)typeof T.opacity<"u"&&S.applyStyles({id:T.id},"atlas",{opacity:T.opacity})},[n]),E.type==="unknown"&&f)throw new Error(E.reason||"Unknown strategy");let x=(0,Nl.useMemo)(()=>({renderMediaControls:o,mediaControlsDeps:a||[],renderViewerControls:s,viewControlsDeps:u||[],renderComplexTimelineControls:d,complexTimelineControlsDeps:p||[]}),[a,o,s,u,d,p]),A=(0,Nl.useMemo)(()=>({strategy:E,actions:C,choices:"choice"in E?E.choice:[]}),[E,g]);return(0,DA.jsx)(Oh.Provider,{value:x,children:(0,DA.jsx)(Rl.Provider,{value:A,children:m})})}var rp=_(nt(),1);var lf=_(nt(),1);var PA=(0,lf.createContext)(()=>{});function ZL(t){let e=zt(),n=(0,lf.useContext)(PA);(0,lf.useEffect)(()=>e&&e.id?(n(e.id,t),()=>n(e.id,-1)):()=>{},[e,t])}var JL=_(Y(),1);function BA({x:t=0,y:e=0,keepCanvasScale:n=!0,renderContextMenu:i,children:a}){let{strategy:o}=Fe(),s=zt(),u=Ie(),d=Ch(s,["deep-zoom"]),p=bt(u,E=>E.setCanvasRelativePosition),f=bt(u,E=>E.clearCanvasRelativePosition),[m,g]=Zh(`context-menu/${s?.id}`,s?.id,i),v=(0,rp.useMemo)(()=>n?1:Math.max(1,...o.type==="images"?o.images.map(E=>(E.width||0)/E.target?.spatial.width):[]),[n,o]);(0,rp.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,rp.useEffect)(()=>{s&&u.getState().reset()},[u,s]),ZL(v);let S=o.type==="images"?o.images.length:0;return s?(0,JL.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 Vs({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:C=!1,enableSizes:R=!1,enableYouTube:x=!0,onClickPaintingAnnotation:A,components:T={},children:M,annotationPopup:z,svgTheme:D,renderContextMenu:I,renderAnnotationContextMenu:q}){return(0,mi.jsxs)(LA,{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)(BA,{keepCanvasScale:C,x:t,y:e,renderContextMenu:I,children:[(0,mi.jsx)($R,{alwaysShowBackground:E,backgroundStyle:S}),(0,mi.jsx)(WR,{}),(0,mi.jsx)(eA,{}),(0,mi.jsx)(tA,{isStatic:o,enableSizes:R,onClickPaintingAnnotation:A}),(0,mi.jsx)(FR,{}),(0,mi.jsx)(BR,{}),(0,mi.jsx)(YR,{as:T.Audio}),(0,mi.jsx)(iA,{as:T.Video}),x?(0,mi.jsx)(aA,{}):null,(0,mi.jsx)(AA,{theme:D,renderContextMenu:q,children:z}),M]}),(0,mi.jsx)(HR,{})]})}var HA=_(Y(),1);function WL(t){let e=zt();return!e||!e.placeholderCanvas?null:(0,HA.jsx)(ma,{canvas:e.placeholderCanvas.id,children:(0,HA.jsx)(Vs,{renderViewerControls:t.renderViewerControls})})}var gi=_(nt(),1);var sa=_(nt()),Z7=(0,sa.createContext)(null),UA={didCatch:!1,error:null},sf=class extends sa.Component{constructor(e){super(e),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=UA}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(UA)}}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&&J7(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(UA)}}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)(Z7.Provider,{value:{didCatch:o,error:s,resetErrorBoundary:this.resetErrorBoundary}},u)}};function J7(){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 Kv=_(nt(),1);function $L(t,e=2e3){let{currentSequenceIndex:n,sequence:i,items:a}=us(),o=zt(),s=(0,Kv.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,Kv.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,C=S.y,R=S.width,x=S.height,A={x:Math.max(E,f.x),y:Math.max(C,f.y),width:Math.min(E+R,f.x+f.width)-Math.max(E,f.x),height:Math.min(C+x,f.y+f.height)-Math.max(C,f.y)};A.width<=0||A.height<=0||(g[v.id]={x:A.x-S.x,y:A.y-S.y,width:A.width,height:A.height}),u.setState({canvasViewports:g})}}}},e);return()=>{clearTimeout(p)}},[s,t,u,e])}var uf=_(Y(),1);function Zv({width:t,style:e,height:n,error:i,resetErrorBoundary:a}){return(0,uf.jsxs)("div",{style:{width:t,height:n,minHeight:500,...e||{},background:"#f9f9f9"},children:[(0,uf.jsx)("h3",{children:"Error occurred"}),(0,uf.jsx)("p",{children:i.message}),(0,uf.jsx)("button",{type:"button",onClick:a,children:"Reset"})]})}var ke=_(Y(),1);function Jv(t){let e=Ie();return(0,ke.jsx)(Gc,{name:t.name,existing:e,children:(0,ke.jsx)(W7,{...t})})}function W7({name:t,children:e,errorFallback:n,outerContainerProps:i={},worldScale:a,updateViewportTimeout:o,...s}){let u=Ie(),d=bt(u,it=>it.mode),p=bt(u,it=>it.setAtlasRuntime),[f,m]=(0,gi.useState)(),g=Yh(),v=Qh(),S=n||Zv,[E,C]=(0,gi.useState)({}),R=Object.entries(E),[x,A]=(0,gi.useState)({}),T=Object.entries(x),[M,z]=(0,gi.useState)({}),{worldScale:D,runtimeOptions:I}=(0,gi.useMemo)(()=>{if(Object.values(M).length===0)return{worldScale:1,runtimeOptions:s.runtimeOptions||{maxOverZoom:1}};let K=Math.max(...Object.values(M));return{worldScale:K,runtimeOptions:{maxOverZoom:K||1,...s.runtimeOptions||{}}}},[M,s.runtimeOptions]);$L(f?.runtime,o);let q=(0,gi.useCallback)((it,K)=>{z(tt=>{if(K===-1){let{[it]:ut,...xt}=tt;return xt}return{...tt,[it]:K}})},[]),B=(0,gi.useCallback)((it,K,tt)=>{C(({[it]:ut,...xt})=>K?{...xt,[it]:{element:K,props:tt}}:xt)},[]),U=(0,gi.useCallback)((it,K,tt)=>{A(({[it]:ut,...xt})=>K?{...xt,[it]:{element:K,props:tt}}:xt)},[]),W=(0,gi.useCallback)(it=>{m(it),p(it.runtime),s.onCreated&&s.onCreated(it)},[s.onCreated,p]);return(0,ke.jsxs)(sf,{resetKeys:[],fallbackRender:it=>(0,ke.jsx)(S,{...s,...it}),children:[(0,ke.jsx)(II,{...s,mode:d,containerProps:{style:{position:"relative"},...s.containerProps||{}},htmlChildren:(0,ke.jsx)(ke.Fragment,{children:R.map(([it,{element:K,props:tt}])=>(0,ke.jsx)(gi.default.Fragment,{children:(0,ke.jsx)(K,{...tt||{}})},it))}),onCreated:W,runtimeOptions:I,children:(0,ke.jsx)(Gc,{name:t,existing:u,children:(0,ke.jsx)(Xa.Provider,{value:f,children:(0,ke.jsx)(PA.Provider,{value:q,children:(0,ke.jsx)(IR.Provider,{value:B,children:(0,ke.jsx)(DR.Provider,{value:U,children:(0,ke.jsx)(Xh,{bridge:v,custom:g,children:(0,ke.jsx)(qR,{children:e})})})})})})})}),(0,ke.jsx)("div",{children:T.map(([it,{element:K,props:tt}])=>(0,ke.jsx)(gi.default.Fragment,{children:(0,ke.jsx)(K,{...tt||{}})},it))}),(0,ke.jsx)("div",{id:"atlas-floating-ui",style:{position:"relative",zIndex:999999}})]})}var oi=_(Y(),1),$7=(0,Zs.forwardRef)(function(e,n){let i=on(),a=ls(),o=us(),{ViewerControls:s,MediaControls:u,ComplexTimelineControls:d}=e.components||{};if((0,Zs.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,C=m||v,R=(0,Zs.useMemo)(()=>C?[...a].reverse():a,[a,C]);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:R.map((x,A)=>{let T=0,M=0;return!f&&!m?(T=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:A===0&&s?()=>(0,oi.jsx)(s,{}):void 0,renderMediaControls:A===0&&u?()=>(0,oi.jsx)(u,{}):void 0,annotationPopup:e.annotationPopup,renderContextMenu:e.renderContextMenu,keepCanvasScale:e.keepCanvasScale,renderComplexTimelineControls:A===0&&d?()=>(0,oi.jsx)(d,{}):void 0,renderAnnotationContextMenu:e.renderAnnotationContextMenu,x:T,y:M,svgTheme:e.svgTheme,...e.canvasProps||{},children:e.annotations},x.id)},x.id)})},e.reuseAtlas?"":o.currentSequenceIndex),e.children]})}),wn=(0,Zs.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:C,keepCanvasScale:R,renderAnnotationContextMenu:x,padding:A,...T},M){let z=Do();return(0,oi.jsx)(Gc,{name:v,children:(0,oi.jsx)(Io,{vault:z,children:(0,oi.jsx)(pb,{...T,children:(0,oi.jsx)($7,{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:C,keepCanvasScale:R,renderAnnotationContextMenu:x,padding:A,children:e})})})})});wn.RenderImage=wl;wn.RenderCanvas=Vs;wn.RenderAnnotationPage=xl;wn.RenderAnnotation=Bs;wn.Viewer=Jv;wn.CanvasBackground=Mv;wn.Audio=pv;wn.Video=_v;wn.Model=yv;wn.AudioHTML=LR;wn.VideoHTML=nA;wn.ModelHTML=PR;wn.PlaceholderCanvas=WL;wn.getAtlasStoreByName=xR;var t4=_(nt(),1);var _a=_(nt(),1);function VA(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,C]=(0,_a.useState)(null),R=a&&o!==E,x=a&&o===E,A=(0,_a.useCallback)(async(M,z)=>{if(E){let D=f.current;g(!0);let I=await u(M,{...z,requestId:E});if(I)return D?.(I),n(B=>B+1),g(!1),S(I),I;let q={id:E,cancelled:!0,...Eh(M)};return D?.(q),S(q),n(B=>B+1),g(!1),q}return null},[u,E]),T=(0,_a.useCallback)(()=>{S(null),g(!1)},[]);return(0,_a.useEffect)(()=>{let M=s();return C(M.requestId),()=>{M.clear()}},[e]),{id:e,busy:R,isPending:m,isActive:x,requestId:E,requestAnnotation:A,cancelRequest:()=>E?p(E):void 0,completeRequest:()=>E?d(E):void 0,reset:T,data:v}}var tF=[{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 jA(t){let{id:e,data:n,requestAnnotation:i,cancelRequest:a,isPending:o}=VA({onSuccess:s=>{t.updateShape(s.polygon)}});return(0,t4.useEffect)(()=>(i({type:"polygon",open:t.shape?.open,points:t.shape?.points}),()=>{a()}),[]),null}var Kn=_(nt(),1);var e4=_(Y(),1),Wv=(0,Kn.createContext)(ka());Wv.displayName="SelectorHelper";function eF({children:t}){return(0,e4.jsx)(Wv.Provider,{value:(0,Kn.useMemo)(()=>ka(),[]),children:t})}function nF(){return(0,Kn.useContext)(Wv)}function qA(t){let e=FA(),[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 FA(){let t=(0,Kn.useContext)(Wv);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 iF(){let t=FA();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 GA=_(Y(),1);function aF(t){let e=zt(),n=t.annotationBucket,i=t.readOnly,a=t.id,{onClick:o,isHighlighted:s}=qA(t.id),u=Rh(),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,GA.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,GA.jsx)(jA,{image:e,shape:t.polygon||{id:t.id,open:!0,points:[]},updateShape:t.updatePolygon,theme:t.theme,controlsHtmlId:t.controlsHtmlId,renderControls:t.renderControls})}var $v=_(nt(),1),lp=_(Y(),1),oF=(0,$v.forwardRef)(function({canvasId:e},n){let i=ov(),a=tp(e||i?.id),o=Vt();return(0,$v.useImperativeHandle)(n,()=>a,[e,i]),!i||a.enabledPageIds.length===0?null:(0,lp.jsx)(lp.Fragment,{children:a.enabledPageIds.map(s=>(0,lp.jsx)(wn.RenderAnnotationPage,{page:o.get(s)},s))})});var i4=_(nt(),1);var n4=_(nt(),1);var Sn=_(Y(),1);function sp({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,n4.useMemo)(()=>{let R=(e||[]).reduce((A,T)=>[...A,...T.keys],[]),x={};for(let A of t){let T=A?.label?Object.values(A.label):[];for(let M of T)if(M?.length&&(R.indexOf(`metadata.${M[0]}`)!==-1||R.length===0)&&A){let z=`metadata.${M[0]}`;x[z]=x[z]?x[z]:[],x[z].push(A);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((R,x)=>{let A=[];for(let M of R.keys)for(let z of E[M]||[]){let D=(0,Sn.jsx)(oa,{enableDangerouslySetInnerHTML:a,defaultText:d,separator:f,children:z.value},x+"__"+M);S?A.push(S(z,D)):A.push(D)}if(A.length===0)return null;let T=(0,Sn.jsx)(oa,{enableDangerouslySetInnerHTML:a,separator:f,defaultText:p,children:R.label});return(0,Sn.jsxs)("tr",{className:s.row,children:[(0,Sn.jsx)("td",{className:s.label,style:n?{minWidth:n}:{},children:v?v(R.label,T):T}),(0,Sn.jsx)("td",{className:s.value,children:A})]},x)})}),m]}):(0,Sn.jsxs)("table",{className:s.container,children:[g,(0,Sn.jsx)("tbody",{children:t?.length?t.map((R,x)=>{if(!R)return null;let A=(0,Sn.jsx)(oa,{enableDangerouslySetInnerHTML:a,defaultText:d,separator:f,children:R.label}),T=(0,Sn.jsx)(oa,{enableDangerouslySetInnerHTML:a,defaultText:d,separator:f,children:R.value});return(0,Sn.jsxs)("tr",{className:s.row,children:[(0,Sn.jsx)("td",{className:s.label,style:n?{minWidth:n}:{},children:v?v(R.label,A):A}),(0,Sn.jsx)("td",{className:s.value,children:S?S(R,T):T})]},x)}):null}),m]})}var a4=_(Y(),1);function rF(t){let e=on(),n=zt(),i=td(),a=(0,i4.useMemo)(()=>{let o=e?.metadata||[],s=n?.metadata||[],u=i?.metadata||[];return[...o,...s,...u]},[e,n,i]);return(0,a4.jsx)(sp,{metadata:a,...t})}var e0=_(nt(),1);var o4=_(nt(),1);function t0(t,e={},n=[]){return(0,o4.useMemo)(()=>{if(!t)return null;let i=e.quality;t&&t.extraQualities&&e.quality&&(t.extraQualities.includes(e.quality)||(i="default"));let a=eg(t);return tg({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 up=_(Y(),1);function lF(t){let e=typeof t.src=="string"?t.src:t.src.id,n=_h(),[i,a]=(0,e0.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=t0(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,e0.useEffect)(()=>()=>{a(!1)},[e]),s?(0,up.jsx)("img",{src:s,alt:t.alt,className:t.className,style:t.style}):(0,up.jsx)(r4,{...t,fetchImageService:!1})}function r4(t){if(t.fetchImageService)return(0,up.jsx)(lF,{...t});let e=typeof t.src=="string"?{id:t.src,profile:"level0"}:t.src,n=t0(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,up.jsx)("img",{src:n,alt:t.alt,className:t.className,style:t.style}):null}var n0=_(nt(),1);var pr=_(Y(),1);function sF({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,n0.useState)(),S=e||Zv,[E,C]=ep(),R=(0,n0.useMemo)(()=>{let A=C[t]?.status,T=E({id:t},{});return T?.height&&T.width&&A!=="loading"?{id:t,width:T.width,height:T.height,service:T,type:"Image",selector:{type:"BoxSelector",spatial:{x:0,y:0,width:T.width,height:T.height}},target:{type:"BoxSelector",spatial:{x:0,y:0,width:T.width,height:T.height}}}:null},[E,t,C]);if(!R||!R.height||!R.width)return null;let x=u?void 0:f.homePosition?f.homePosition.width/f.homePosition.height:R.width/R.height;return(0,pr.jsx)(sf,{resetKeys:[],fallbackRender:A=>(0,pr.jsx)(S,{...f,...A}),children:(0,pr.jsx)(Io,{vault:m,children:(0,pr.jsx)(Jv,{...f,aspectRatio:x,containerProps:{style:{position:"relative"},...f.containerProps||{}},onCreated:A=>{v(A),f.onCreated&&f.onCreated(A)},children:(0,pr.jsxs)(Xa.Provider,{value:g,children:[(0,pr.jsx)(wl,{image:R,id:R.id,isStatic:!n,x:d,y:p},R.id),(0,pr.jsx)(uF,{viewerPreset:g,renderViewerControls:o,image:R,src:t,viewControlsDeps:s}),a]})})})})}function uF({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 l4=_(Y(),1);function cF(t){let e=on();return(0,l4.jsx)(sp,{metadata:e?.metadata||[],...t})}var i0=_(nt(),1);var kA=_(u4(),1);var Ii=_(Y(),1),{LazyLoadComponent:fF}=kA||kA.default;function YA(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)(dF,{...t}),p=(0,Ii.jsx)(fF,{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 dF({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||dv(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 cf=_(Y(),1);function hF({scrollBehaviour:t,dereference:e,flat:n,size:i,classes:a={},showLabel:o,figure:s,fallback:u}){let d=(0,i0.useRef)(null),{items:p,sequence:f,currentSequenceIndex:m,setSequenceIndex:g}=us(),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,i0.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 C=[],R=f[m]===E;for(let x of E){let A=p[x];C.push((0,cf.jsx)("div",{className:R?v.item:a.item,children:(0,cf.jsx)(YA,{classes:R?v:a,canvasId:A.id,size:i,dereference:e,showLabel:o,figure:s,placeholder:(0,cf.jsx)("div",{style:{height:128,width:128}}),fallback:u})},x))}if(n){S.push(C);continue}S.push((0,cf.jsx)("div",{onClick:x=>{g(f.indexOf(E))},"data-selected":R,className:R?v.row:a.row,children:C},E.join("-")))}return(0,cf.jsx)("div",{ref:d,className:a.container,children:S})}function QA(){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 Pn=_(Y(),1),pF={draw:!0,polygon:!0,line:!0,lineBox:!0,box:!0,triangle:!0,hexagon:!0,circle:!0,delete:!0,pen:!0};function mF({showShapes:t=!0,enabled:e=pF,classNames:n={},icons:i={}}){let{currentTool:a,switchTool:o,selectedStamp:s}=QA();return(0,Pn.jsxs)(Pn.Fragment,{children:[a,(0,Pn.jsx)("button",{className:n.button,onClick:o.pointer,"data-active":a==="pointer",children:i.PointerIcon||"Pointer"}),(0,Pn.jsx)("button",{className:n.button,onClick:o.hand,"data-active":a==="hand",children:i.HandIcon||"Hand"}),t?(0,Pn.jsxs)(Pn.Fragment,{children:[e.box&&(0,Pn.jsx)("button",{className:n.button,onClick:o.box,"data-active":a==="box",children:i.BoxIcon||"Box"}),e.pen&&(0,Pn.jsx)("button",{className:n.button,onClick:o.pen,"data-active":a==="pen",children:i.PenIcon||"Pen"}),e.draw&&(0,Pn.jsx)("button",{className:n.button,onClick:o.draw,"data-active":a==="pencil",children:i.DrawIcon||"Draw"}),e.line&&(0,Pn.jsx)("button",{className:n.button,onClick:o.line,"data-active":a==="line",children:i.LineIcon||"Line"}),e.lineBox&&(0,Pn.jsx)("button",{className:n.button,onClick:o.lineBox,"data-active":a==="lineBox",children:i.LineBoxIcon||"LineBox"}),e.triangle&&(0,Pn.jsx)("button",{className:n.button,onClick:o.triangle,"data-active":a==="stamp"&&s?.id==="triangle",children:i.TriangleIcon||"Triangle"}),e.hexagon&&(0,Pn.jsx)("button",{className:n.button,onClick:o.hexagon,"data-active":a==="stamp"&&s?.id==="hexagon",children:i.HexagonIcon||"Hexagon"}),e.circle&&(0,Pn.jsx)("button",{className:n.button,"data-active":a==="stamp"&&s?.id==="circle",onClick:o.circle,children:i.CircleIcon||"Circle"})]}):null,e.delete&&(0,Pn.jsx)("button",{className:n.button,onClick:o.remove,children:i.DeleteForeverIcon||"Delete"})]})}var c4=_(Y(),1);function gF({annotation:t,children:e}){return(0,c4.jsx)(ci,{value:{annotation:t},children:e})}var f4=_(Y(),1);function yF({annotationPage:t,children:e}){return(0,f4.jsx)(ci,{value:{annotationPage:t},children:e})}var d4=_(Y(),1);function vF({collection:t,children:e}){return(0,d4.jsx)(ci,{value:{collection:t},children:e})}function SF(t,e={}){return dr(e)}var Il=_(nt(),1);function bF({canvasId:t}={}){let e=ov(),n=ls(),i=(0,Il.useMemo)(()=>t?[t]:e?[e.id]:n.map(p=>p.id),[t,e,n]),[a,o]=(0,Il.useState)({}),s=Gh();(0,Il.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,Il.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,Il.useMemo)(()=>({makeChoice:(p,f)=>{s.emit("make-choice",{choiceId:p,...f})}}),[s]);return{choices:u,actions:d}}function xF(t,e=!1){}function EF(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 h4=_(nt(),1);function RF(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,h4.useMemo)(()=>{if(s)return i?i(s):s},[s,i,...e])}var a0=_(nt(),1);function AF(){let t=Ie(),e=bt(t,i=>i.completeRequest),n=bt(t,i=>i.cancelRequest);return(0,a0.useMemo)(()=>({saveAnnotation:()=>{(0,a0.startTransition)(()=>{e()})},cancelRequest:n}),[e,n])}var p4=_(nt(),1);function TF({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,p4.useCallback)(u=>o(u,a||void 0),[o,a]);return[a?n[a]||{}:{},s]}function CF(t){let e=Ie(),n=bt(e,i=>i.tool.requestId);Ds("polygons.start-transition",i=>{t.requestId&&n!==t.requestId||t?.onStart?.(i.transitionIntent)},[n,t.requestId]),Ds("polygons.end-transition",i=>{t.requestId&&n!==t.requestId||t?.onEnd?.(i.transitionIntent,i.response)},[n,t.requestId]),Ds("polygons.transition",i=>{t.requestId&&n!==t.requestId||t?.onTransition?.(i.transitionIntent)},[n,t.requestId])}var o0=_(nt(),1);function wF(t,e,n,i,a=[]){let o=Vt(),s=(0,o0.useMemo)(()=>Th(o),[o]);(0,o0.useEffect)(()=>{let u=t;return u?(s.addEventListener(u,e,n,i),()=>{s.removeEventListener(u,e,n)}):()=>{}},[s,t,e,...a])}function MF(t,e){let{id:n,isLoaded:i,error:a,resource:o,requestId:s,cached:u}=$f(t,e);return{id:n,isLoaded:i,error:a,manifest:o,requestId:s,cached:u}}var yo=_(nt(),1);function XA({cacheKey:t}={}){let e=zt(),n=dr(),i=Vt(),a=Kc(),o=_D(),[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 R=n[0],x=i.get(R.body[0]),T=jr(x)[0];return T&&a(T,{width:T.width||e.width,height:T.height||e.height},!0)||void 0}}catch(R){console.error(R)}},[S,t,e]),C=f==="success"&&s?s:E;return(0,yo.useEffect)(()=>{(async()=>{try{if(e&&n.length){let R=n[0],x=i.get(R.body[0]),T=jr(x)[0];if(!T)return;p(!0),m("loading");try{let M=await o(T,{width:T.width||e.width,height:T.height||e.height})||void 0;u(M),m("success"),p(!1)}catch(M){m("error"),v(M)}}}catch(R){m("error"),v(R)}})()},[S,t]),(0,yo.useMemo)(()=>({data:C,isFetching:d,status:f,error:g}),[C,d,f,g])}function OF(){let t=XA();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 r0=_(nt(),1);function _F({supports:t=["empty","images","media","3d-model","textual-content","complex-timeline"]}={}){let e=Vt(),n=zt(),i=dr(),a=(0,r0.useMemo)(()=>Qc(e),[e]),o=(0,r0.useMemo)(()=>a.getPaintables(i),[a,i]);return(0,r0.useMemo)(()=>op({canvas:n,loadImageService:s=>s,paintables:o,supports:t}),[n,o,t])}var m4=_(nt(),1);function zF(){let t=Vt();return(0,m4.useMemo)(()=>bl(t),[t])}var Bn=_(nt(),1);var cp=[.6,.02,0,.75],KA=16,ZA={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":cp,"ease-out-cubic":[.215,.61,.355,1]};function JA(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 WA(t,e){let n=[],i=t;for(let a of e)n.push({from:i,to:a}),i=a;return n}function ff([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 C=S;for(let A=0;A<8;A++){let T=f(C)-S;if(Math.abs(T)<E)return C;let M=g(C);if(Math.abs(M)<1e-6)break;C=C-T/M}let R=0,x=1;for(C=S;R<x;){let A=f(C);if(Math.abs(A-S)<E)return C;S>A?R=C:x=C,C=(x-R)*.5+R}return C}return S=>{if(S<=0)return 0;if(S>=1)return 1;let E=v(S);return m(E)}}function $A(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 NF(t){let{initial:e,regions:n,progress:i,getProgress:a,enabled:o=!0,easing:s,reportEveryFrame:u=!1,pollInterval:d=KA,loop:p=!1,onEnter:f,onExit:m,onProgress:g,jumpTo:v}=t,S=(0,Bn.useMemo)(()=>WA(e,n),[e,n]),[E,C]=(0,Bn.useState)(()=>-1),[R,x]=(0,Bn.useState)(0),A=(0,Bn.useRef)(-1),T=(0,Bn.useRef)(0),M=(0,Bn.useRef)(!0),z=(0,Bn.useRef)(()=>{});(0,Bn.useEffect)(()=>(M.current=!0,()=>{M.current=!1}),[]);let D=(0,Bn.useMemo)(()=>{if(!s)return ff(cp);if(typeof s=="function")return s;if(Array.isArray(s)&&s.length===4)return ff(s);let W=ZA[s];return W?ff(W):ff(cp)},[s]),I=(0,Bn.useCallback)(W=>{if(!(W<0||W>=S.length)&&(C(W),A.current=W,T.current=0,x(0),f))try{f(W)}catch{}},[S,f]);(0,Bn.useEffect)(()=>{z.current=I,v&&v(I)},[I,v]);function q(W){let{index:it,t:K}=$A(W,S),tt=it;if(p&&S.length>0){let xt=S.length;tt=(it%xt+xt)%xt}let ut=D(K);if(tt!==A.current){if(A.current>=0&&m)try{m(A.current)}catch{}if(tt>=0&&f)try{f(tt)}catch{}A.current=tt,M.current&&C(tt)}if(T.current=ut,M.current&&(u||tt!==E)&&x(ut),g&&tt>=0)try{g(tt,ut)}catch{}}(0,Bn.useEffect)(()=>{o&&typeof i=="number"&&q(i)},[i,o]),(0,Bn.useEffect)(()=>{if(!o||typeof a!="function")return;let W=null,it=()=>{try{let K=a();q(K)}catch{}};return it(),W=setInterval(it,d),()=>clearInterval(W)},[a,o,d]);let B=E>=0&&E<S.length?S[E]:void 0,U=B?JA(B.from,B.to,T.current):void 0;return{transitions:S,currentIndex:E,currentTransition:B,t:T.current,rect:U,jumpTo:I}}var Js=_(nt(),1);function IF(t,e={}){let{axis:n="y",offset:i=0,steps:a=1,enabled:o=!0}=e,[s,u]=(0,Js.useState)(0),d=(0,Js.useRef)(-1),p=(0,Js.useRef)(null);return(0,Js.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,C=(n==="y"?f.scrollHeight:f.scrollWidth)-S,x=(C<=0?0:Math.max(0,Math.min(1,(v+i)/C)))*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 DF(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 LF=!0,tT="Invariant failed";function g4(t,e){if(!t){if(LF)throw new Error(tT);var n=typeof e=="function"?e():e,i=n?"".concat(tT,": ").concat(n):tT;throw new Error(i)}}function PF(t,e){let n=t.boundingBox||Sl(t.polygon);if(t.polygon&&!qc(t.polygon.points)){let i=t.target||Fc(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 UP(BF);})();
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 oL({media:t,mediaControlsDeps:e,children:n}){let[{element:i,currentTime:a,progress:o},s,u]=js({duration:t.duration});return Xn("overlay","video-element",X7,{element:i,media:t,playPause:u.playPause}),null}var Uv=_(Y(),1);function mR(){let{strategy:t}=Fe(),{renderMediaControls:e,mediaControlsDeps:n}=hi();return t.type!=="media"||t.media.type!=="VideoYouTube"?null:(0,Uv.jsxs)(oL,{media:t.media,mediaControlsDeps:n,children:[(0,Uv.jsx)(ks,{}),e?e(t):null]})}var $v=_(nt(),1);var zl=_(nt(),1);var ii=_(nt(),1);function gR(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=fD(),rL={shapeFill:"#ffffff33",shapeStroke:"#000",lineStroke:"#000",ghostLineStroke:"#0F0",activeLineStroke:"#4D7EEA",boundingBoxDottedStroke:"#0007",boundingBoxStroke:"#fffA",controlFill:"#fff"};function yR(t){let{image:e}=t,n={...rL,...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}=gR((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 lL(t){let e=cv(),{image:n}=t,{helper:i,defs:a,editor:o,state:s,transitionDirection:u,isSplitting:d,transitionRotate:p,isHoveringPoint:f,isAddingPoint:m}=yR({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 a4=_(nt(),1);var Dt=_(nt(),1);function Vv(){return typeof window<"u"}function Nl(t){return sL(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=(sL(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function sL(t){return Vv()?t instanceof Node||t instanceof pi(t).Node:!1}function Ge(t){return Vv()?t instanceof Element||t instanceof pi(t).Element:!1}function zi(t){return Vv()?t instanceof HTMLElement||t instanceof pi(t).HTMLElement:!1}function Hh(t){return!Vv()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof pi(t).ShadowRoot}var K7=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)&&!K7.has(a)}var Z7=new Set(["table","td","th"]);function uL(t){return Z7.has(Nl(t))}var W7=[":popover-open",":modal"];function Uh(t){return W7.some(e=>{try{return t.matches(e)}catch{return!1}})}var J7=["transform","translate","scale","rotate","perspective"],$7=["transform","translate","scale","rotate","perspective","filter"],tq=["paint","layout","strict","content"];function jv(t){let e=of(),n=Ge(t)?Ni(t):t;return J7.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)||$7.some(i=>(n.willChange||"").includes(i))||tq.some(i=>(n.contain||"").includes(i))}function cL(t){let e=Ka(t);for(;zi(e)&&!Wa(e);){if(jv(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 eq=new Set(["html","body","#document"]);function Wa(t){return eq.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 fL(t){let e=Ka(t);return Wa(e)?t.ownerDocument?t.ownerDocument.body:t.body:zi(e)&&af(e)?e:fL(e)}function ra(t,e,n){var i;e===void 0&&(e=[]),n===void 0&&(n=!0);let a=fL(t),o=a===((i=t.ownerDocument)==null?void 0:i.body),s=pi(a);if(o){let u=qv(s);return e.concat(s,s.visualViewport||[],af(a)?a:[],u&&n?ra(u):[])}return e.concat(a,ra(a,[],n))}function qv(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}var Yh=_(nt(),1),vL=_(nt(),1);var rf=Math.min,cr=Math.max,qh=Math.round,Fh=Math.floor,Ja=t=>({x:t,y:t}),nq={left:"right",right:"left",bottom:"top",top:"bottom"},iq={start:"end",end:"start"};function vR(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 SR(t){return t==="x"?"y":"x"}function bR(t){return t==="y"?"height":"width"}var aq=new Set(["top","bottom"]);function fr(t){return aq.has(Il(t))?"y":"x"}function xR(t){return SR(fr(t))}function pL(t,e,n){n===void 0&&(n=!1);let i=kh(t),a=xR(t),o=bR(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 mL(t){let e=jh(t);return[Fv(t),e,Fv(e)]}function Fv(t){return t.replace(/start|end/g,e=>iq[e])}var dL=["left","right"],hL=["right","left"],oq=["top","bottom"],rq=["bottom","top"];function lq(t,e,n){switch(t){case"top":case"bottom":return n?e?hL:dL:e?dL:hL;case"left":case"right":return e?oq:rq;default:return[]}}function gL(t,e,n,i){let a=kh(t),o=lq(Il(t),n==="start",i);return a&&(o=o.map(s=>s+"-"+a),e&&(o=o.concat(o.map(Fv)))),o}function jh(t){return t.replace(/left|right|bottom|top/g,e=>nq[e])}function sq(t){return{top:0,right:0,bottom:0,left:0,...t}}function yL(t){return typeof t!="number"?sq(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 ER(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 Gv(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 SL(t){return t.matches("html,body")}function AR(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 bL(t){return"nativeEvent"in t}var uq=typeof document<"u",cq=function(){},kv=uq?vL.useLayoutEffect:cq,fq={...Yh};var dq=fq.useInsertionEffect,hq=dq||(t=>t());function Ks(t){let e=Yh.useRef(()=>{});return hq(()=>{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 IR=_(Y(),1);var XL=_(ms(),1);function xL(t,e,n){let{reference:i,floating:a}=t,o=fr(e),s=xR(e),u=bR(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 EL=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}=xL(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}=xL(p,g,d)),E=-1)}return{x:f,y:m,placement:g,strategy:a,middlewareData:v}};async function RR(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=yL(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 AL=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)]:mL(u)),z=S!=="none";!g&&z&&M.push(...gL(u,E,S,C));let N=[u,...M],D=await RR(e,T),q=[],P=((i=o.flip)==null?void 0:i.overflows)||[];if(f&&q.push(D[A]),m){let X=pL(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 pq=new Set(["left","top"]);async function mq(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=pq.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 RL=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 mq(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}}}}},TL=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 RR(e,d),m=fr(Il(a)),g=SR(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=vR(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=vR(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 ML(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 CR(t){return Ge(t)?t:t.contextElement}function sf(t){let e=CR(t);if(!zi(e))return Ja(1);let n=e.getBoundingClientRect(),{width:i,height:a,$:o}=ML(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 gq=Ja(0);function OL(t){let e=pi(t);return!of()||!e.visualViewport?gq:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function yq(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=CR(t),s=Ja(1);e&&(i?Ge(i)&&(s=sf(i)):s=sf(t));let u=yq(o,n,i)?OL(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=qv(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=qv(S)}}return Xs({width:f,height:m,x:d,y:p})}function wR(t,e){let n=Vh(t).scrollLeft;return e?e.left+n:Zs(Za(t)).left+n}function _L(t,e,n){n===void 0&&(n=!1);let i=t.getBoundingClientRect(),a=i.left+e.scrollLeft-(n?0:wR(t,i)),o=i.top+e.scrollTop;return{x:a,y:o}}function vq(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?_L(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 Sq(t){return Array.from(t.getClientRects())}function bq(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+wR(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 xq(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 Eq=new Set(["absolute","fixed"]);function Aq(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 CL(t,e,n){let i;if(e==="viewport")i=xq(t,n);else if(e==="document")i=bq(Za(t));else if(Ge(e))i=Aq(e,n);else{let a=OL(t);i={x:e.x-a.x,y:e.y-a.y,width:e.width,height:e.height}}return Xs(i)}function zL(t,e){let n=Ka(t);return n===e||!Ge(n)||Wa(n)?!1:Ni(n).position==="fixed"||zL(n,e)}function Rq(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=jv(s);!d&&u.position==="fixed"&&(a=null),(o?!d&&!a:!d&&u.position==="static"&&!!a&&Eq.has(a.position)||af(s)&&!d&&zL(t,s))?i=i.filter(f=>f!==s):a=u,s=Ka(s)}return e.set(t,i),i}function Tq(t){let{element:e,boundary:n,rootBoundary:i,strategy:a}=t,s=[...n==="clippingAncestors"?Uh(e)?[]:Rq(e,this._c):[].concat(n),i],u=s[0],d=s.reduce((p,f)=>{let m=CL(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},CL(e,u,a));return{width:d.right-d.left,height:d.bottom-d.top,x:d.left,y:d.top}}function Cq(t){let{width:e,height:n}=ML(t);return{width:e,height:n}}function wq(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=wR(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?_L(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 TR(t){return Ni(t).position==="static"}function wL(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 NL(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)&&!TR(a))return a;a=Ka(a)}return n}let i=wL(t,e);for(;i&&uL(i)&&TR(i);)i=wL(i,e);return i&&Wa(i)&&TR(i)&&!jv(i)?n:i||cL(t)||n}var Mq=async function(t){let e=this.getOffsetParent||NL,n=this.getDimensions,i=await n(t.floating);return{reference:wq(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function Oq(t){return Ni(t).direction==="rtl"}var MR={convertOffsetParentRelativeRectToViewportRelativeRect:vq,getDocumentElement:Za,getClippingRect:Tq,getOffsetParent:NL,getElementRects:Mq,getClientRects:Sq,getDimensions:Cq,getScale:sf,isElement:Ge,isRTL:Oq};function IL(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function _q(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&&!IL(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 Yv(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=CR(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?_q(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&&!IL(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 DL=RL;var LL=TL,BL=AL;var Qv=(t,e,n)=>{let i=new Map,a={platform:MR,...n},o={...a.platform,_c:i};return EL(t,e,{...a,platform:o})};var vn=_(nt(),1),UL=_(nt(),1),VL=_(ms(),1),zq=typeof document<"u",Nq=function(){},Xv=zq?UL.useLayoutEffect:Nq;function Kv(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(!Kv(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)&&!Kv(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 PL(t,e){let n=jL(t);return Math.round(e*n)/n}function OR(t){let e=vn.useRef(t);return Xv(()=>{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);Kv(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=OR(d),U=OR(a),J=OR(p),at=vn.useCallback(()=>{if(!z.current||!N.current)return;let lt={placement:e,strategy:n,middleware:g};U.current&&(lt.platform=U.current),Qv(z.current,N.current,lt).then(dt=>{let Rt={...dt,isPositioned:J.current!==!1};X.current&&!Kv(D.current,Rt)&&(D.current=Rt,VL.flushSync(()=>{m(Rt)}))})},[g,e,n,U,J]);Xv(()=>{p===!1&&D.current.isPositioned&&(D.current.isPositioned=!1,m(lt=>({...lt,isPositioned:!1})))},[p]);let X=vn.useRef(!1);Xv(()=>(X.current=!0,()=>{X.current=!1}),[]),Xv(()=>{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=PL(ut.floating,f.x),Rt=PL(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 Zv=(t,e)=>({...DL(t),options:[t,e]}),_R=(t,e)=>({...LL(t),options:[t,e]});var zR=(t,e)=>({...BL(t),options:[t,e]});var Iq="data-floating-ui-focusable",FL="active",GL="selected",Dq="ArrowLeft",Lq="ArrowRight",Bq="ArrowUp",Pq="ArrowDown";var Hq=[Dq,Lq],Uq=[Bq,Pq],DJ=[...Hq,...Uq];var Vq={...Dt},kL=!1,jq=0,YL=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+jq++;function qq(){let[t,e]=Dt.useState(()=>kL?YL():void 0);return kv(()=>{t==null&&e(YL())},[]),Dt.useEffect(()=>{kL=!0},[]),t}var Fq=Vq.useId,Gq=Fq||qq;function kq(){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 Yq=Dt.createContext(null),Qq=Dt.createContext(null),Xq=()=>{var t;return((t=Dt.useContext(Yq))==null?void 0:t.id)||null},KL=()=>Dt.useContext(Qq);function Kq(t){return"data-floating-ui-"+t}function Zq(t){t.current!==-1&&(clearTimeout(t.current),t.current=-1)}var Wq={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},Jq={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,bL(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"&&lt||xt||typeof A=="function"&&!A(tt))return;let dt=lf(tt),Rt="["+Kq("inert")+"]",K=AR(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)&&!SL(dt)&&!ER(dt,a.floating)&&Array.from(K).every(pe=>!ER(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 Gv(tt,(De=pe.context)==null?void 0:De.elements.floating)});if(Gv(tt,a.floating)||Gv(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=AR(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&&{[Wq[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},[Jq[p]]:()=>{o.current.insideReactTree=!0},onBlurCapture(){E||(Zq(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 $q(t){let{open:e=!1,onOpenChange:n,elements:i}=t,a=Gq(),o=Dt.useRef({}),[s]=Dt.useState(()=>kq()),u=Xq()!=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=$q({...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();kv(()=>{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 kv(()=>{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 NR(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,[Iq]:""},...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=>NR(u,t,"reference"),e),o=Dt.useCallback(u=>NR(u,t,"floating"),n),s=Dt.useCallback(u=>NR(u,t,"item"),i);return Dt.useMemo(()=>({getReferenceProps:a,getFloatingProps:o,getItemProps:s}),[a,o,s])}var i4=_(ms(),1);var Ln=_(nt(),1);var $L=_(nt(),1),Wv=_(nt(),1);var e4=_(Y(),1),t4=ka(),Ws=(0,Wv.createContext)({emitter:t4});Ws.displayName="Events";function Xh(){return $L.default.useContext(Ws).emitter}function t9({emitter:t,children:e}){return(0,e4.jsx)(Ws.Provider,{value:(0,Wv.useMemo)(()=>({emitter:t}),[t]),children:e})}var la=_(Y(),1),Kh=Ln.default.createContext({});function Zh(){let t=(0,Ln.useContext)(Kh),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 e9(t){let e=(0,Ln.useContext)(Kh),n=(0,Ln.useMemo)(()=>({...e,...t.providers}),[t.providers]);return(0,la.jsx)(Kh.Provider,{value:n,children:t.children})}function Wh(){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)(Kh),StrategyReactContext:(0,Ln.useContext)(Tl),AtlasStoreReactContext:(0,Ln.useContext)(Hs)}}function Jh(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)(Kh.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);function Jv({annotation:t,target:e,children:n,dismissable:i,isOpen:a,onOpenChange:o,placement:s}){let u=Wh(),d=Zh(),{refs:p,floatingStyles:f,context:m}=WL({open:a,onOpenChange:o,nodeId:t.id,placement:s||"bottom",middleware:[Zv(10),_R(),zR({mainAxis:!0})],whileElementsMounted:Yv}),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,i4.createPortal)((0,uf.jsx)(Jh,{bridge:u,custom:d,children:(0,uf.jsx)("div",{ref:p.setFloating,style:f,...S(),children:n})}),document.getElementById("atlas-floating-ui"))]})}var $h=_(Y(),1),o4=Zm()(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 tp(t,e,n){let{isMenuOpen:i,setIsMenuOpen:a,close:o,open:s,menuPosition:u,setMenuPosition:d,toggle:p}=o4(),f=(0,a4.useCallback)(v=>{n&&(v.preventDefault(),v.stopPropagation(),p(v.atlas))},[p,n]);return[(0,$h.jsx)($h.Fragment,{children:n&&i&&(0,$h.jsx)(Jv,{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 DR(){let t=Ie();return bt(t,e=>e.tool.requestId&&e.requests[e.tool.requestId]||null)}var ai=_(Y(),1);function LR({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,$v.useMemo)(()=>xl(o),[o]),v=DR(),[S,E]=tp("editing-annotation",a?.id,e),T=v?.annotationPopup||n||(0,ai.jsx)(r4,{}),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)(Jv,{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)(lL,{image:a,theme:A}),R,S]})}function r4(){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,$v.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 n9(t){return t.type==="SpecificResource"?[t.source,{selector:t.selector}]:[t,{selector:null}]}function ep(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 BR={makeChoice:()=>{}},np={type:"unknown"},Pe=t=>({type:"unknown",reason:t,annotations:{pages:[]}}),PR=(t,e)=>({type:"empty",width:t,height:e,annotations:{pages:[]},image:null,images:[]});var ip=_(nt(),1);function i9(t,e){let n=t?.iiif?.meta[e];return n?n.annotationPageManager:null}function l4(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=i9(n,o);s&&s.views&&s.views[t]&&i.push(o)}return i},[t,e])}function HR({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 a9(t,e){let n=t?.iiif?.meta[e];return n?n.annotationPageManager:null}function ap(t,e={}){let n=Vt(),i=on(),a=zt(),o=cs(),s=(0,ip.useMemo)(()=>HR({all:e.all,manifest:i,canvas:a,canvases:o}),[e.all,a,o,i]),u=l4(t,e.all?void 0:s),d=(0,ip.useCallback)(f=>{t&&n.setMetaValue([f,"annotationPageManager","views"],m=>m&&!m[t]?m:{...m||{},[t]:!1})},[t,n]),p=(0,ip.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=a9(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 UR(t,e){return re((n,i)=>i.get(t.map(a=>({id:a,type:e}))),[t,e])}var s4=_(nt(),1);var o9=Yi((t,e)=>({loaded:{},setLoaded:(n,i="done")=>{t(a=>({loaded:{...a.loaded,[n]:i}}))}})),r9=ka();r9.on("loaded",t=>{o9.getState().setLoaded(t.imageServiceId)});function op(){let t=$c(),e=FD();return[(0,s4.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 VR(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 l9=["model/gltf-binary"];function jR(t,e){let n=e.items[0],i=n.resource;return i.format?l9.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 t0(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 u4(t){if(!(t?.type!=="ImageApiSelector"||typeof t.rotation>"u"))return qR(t.rotation)}function qR(t){if(t===null||typeof t>"u"||t==="")return;let e=Number(t);return Number.isFinite(e)?e:void 0}function s9(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 rp(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"?u4(o.resource.selector):void 0)??u4(o.selector)??qR(o.rotation)??qR(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]=ep(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}:{},...s9(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 c4(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=>c4(a,e,i))}return e}function lp(t,e){let n=[];return e.items.forEach(i=>{if(i.resource){let[a]=ep(t,i.target);n.push({type:"Text",annotationId:i.annotationId,annotation:i.annotation,text:c4(i.resource),target:a})}}),{type:"textual-content",items:n}}var u9=/^.*(?:(?:youtu\.be\/|v\/|vi\/|u\/\w\/|embed\/|shorts\/)|(?:(?:watch)?\?vi?=|&vi?=))([^#&?]*).*/;function sp(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(u9);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 FR(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=rp(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=lp(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=sp(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=t0(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 e0={},GR={get(t){return t},setMetaValue([t,e,n],i){let a=GR.getResourceMeta(t,e),o=a?a[n]:void 0,s=typeof i=="function"?i(o):i;e0[t]={...e0[t]||{},[e]:{...(e0[t]||{})[e]||{},[n]:s}}},getResourceMeta:(t,e)=>{let n=e0[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 up({canvas:t,paintables:e,supports:n,loadImageService:i,vault:a=GR}){if(!t)return np;if(e.types.length===0)return n.indexOf("empty")!==-1?PR(t.width,t.height):np;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"):FR(t,e,i,a);let o=e.types[0];return o==="image"?n.indexOf("images")===-1?Pe("Image not supported"):rp(t,e,i):o==="Model"||o==="model"?n.indexOf("3d-model")===-1?Pe("3D not supported"):jR(t,e):o==="textualbody"?n.indexOf("textual-content")===-1?Pe("Textual content not supported"):lp(t,e):o==="sound"||o==="audio"?n.indexOf("media")===-1?Pe("Media not supported"):t0(t,e):o==="video"?n.indexOf("media")===-1?Pe("Media not supported"):sp(t,e,a):np}function kR(t){let e=on(),n=zt(),i=Vt(),a=Xh(),o=t?.emitter||a,[s,u]=op(),{enabledPageIds:d}=ap(t?.annotationPageManagerId||e?.id||n?.id,{all:!1}),p=UR(d,"AnnotationPage"),f=t?.strategies||["empty","images","media","textual-content","complex-timeline"],[m,g]=VR(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)(()=>up({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,BR]:[{...v,annotations:{pages:p}},g],[v,p])}var YR=_(Y(),1);function QR({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]=kR({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,YR.jsx)(Ih.Provider,{value:x,children:(0,YR.jsx)(Tl.Provider,{value:R,children:m})})}var cp=_(nt(),1);var ff=_(nt(),1);var XR=(0,ff.createContext)(()=>{});function f4(t){let e=zt(),n=(0,ff.useContext)(XR);(0,ff.useEffect)(()=>e&&e.id?(n(e.id,t),()=>n(e.id,-1)):()=>{},[e,t])}var d4=_(Y(),1);function KR({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]=tp(`context-menu/${s?.id}`,s?.id,i),v=(0,cp.useMemo)(()=>n?1:Math.max(1,...o.type==="images"?o.images.map(E=>(E.width||0)/E.target?.spatial.width):[]),[n,o]);(0,cp.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,cp.useEffect)(()=>{s&&u.getState().reset()},[u,s]),f4(v);let S=o.type==="images"?o.images.length:0;return s?(0,d4.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)(QR,{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)(KR,{keepCanvasScale:T,x:t,y:e,renderContextMenu:D,children:[(0,mi.jsx)(cR,{alwaysShowBackground:E,backgroundStyle:S}),(0,mi.jsx)(uR,{}),(0,mi.jsx)(dR,{}),(0,mi.jsx)(fR,{isStatic:o,enableSizes:A,onClickPaintingAnnotation:R}),(0,mi.jsx)(tR,{}),(0,mi.jsx)(XA,{}),(0,mi.jsx)(iR,{as:C.Audio}),(0,mi.jsx)(pR,{as:C.Video}),x?(0,mi.jsx)(mR,{}):null,(0,mi.jsx)(LR,{theme:N,renderContextMenu:q,children:z}),M]}),(0,mi.jsx)(KA,{})]})}var ZR=_(Y(),1);function h4(t){let e=zt();return!e||!e.placeholderCanvas?null:(0,ZR.jsx)(ma,{canvas:e.placeholderCanvas.id,children:(0,ZR.jsx)(Fs,{renderViewerControls:t.renderViewerControls})})}var gi=_(nt(),1);var sa=_(nt()),c9=(0,sa.createContext)(null),WR={didCatch:!1,error:null},df=class extends sa.Component{constructor(e){super(e),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=WR}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(WR)}}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&&f9(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(WR)}}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)(c9.Provider,{value:{didCatch:o,error:s,resetErrorBoundary:this.resetErrorBoundary}},u)}};function f9(){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 n0=_(nt(),1);function p4(t,e=2e3){let{currentSequenceIndex:n,sequence:i,items:a}=ds(),o=zt(),s=(0,n0.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,n0.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 i0({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 a0(t){let e=Ie();return(0,ke.jsx)(Xc,{name:t.name,existing:e,children:(0,ke.jsx)(d9,{...t})})}function d9({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=Zh(),v=Wh(),S=n||i0,[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]);p4(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)(QI,{...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)(XR.Provider,{value:q,children:(0,ke.jsx)(GA.Provider,{value:P,children:(0,ke.jsx)(kA.Provider,{value:U,children:(0,ke.jsx)(Jh,{bridge:v,custom:g,children:(0,ke.jsx)($A,{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),h9=(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)(Tb,{...C,children:(0,oi.jsx)(h9,{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=a0;wn.CanvasBackground=Lv;wn.Audio=xv;wn.Video=Pv;wn.Model=Rv;wn.AudioHTML=YA;wn.VideoHTML=hR;wn.ModelHTML=QA;wn.PlaceholderCanvas=h4;wn.getAtlasStoreByName=NA;var m4=_(nt(),1);var _a=_(nt(),1);function JR(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 p9=[{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 $R(t){let{id:e,data:n,requestAnnotation:i,cancelRequest:a,isPending:o}=JR({onSuccess:s=>{t.updateShape(s.polygon)}});return(0,m4.useEffect)(()=>(i({type:"polygon",open:t.shape?.open,points:t.shape?.points}),()=>{a()}),[]),null}var Kn=_(nt(),1);var g4=_(Y(),1),o0=(0,Kn.createContext)(ka());o0.displayName="SelectorHelper";function m9({children:t}){return(0,g4.jsx)(o0.Provider,{value:(0,Kn.useMemo)(()=>ka(),[]),children:t})}function g9(){return(0,Kn.useContext)(o0)}function tT(t){let e=eT(),[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 eT(){let t=(0,Kn.useContext)(o0);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 y9(){let t=eT();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 nT=_(Y(),1);function v9(t){let e=zt(),n=t.annotationBucket,i=t.readOnly,a=t.id,{onClick:o,isHighlighted:s}=tT(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,nT.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,nT.jsx)($R,{image:e,shape:t.polygon||{id:t.id,open:!0,points:[]},updateShape:t.updatePolygon,theme:t.theme,controlsHtmlId:t.controlsHtmlId,renderControls:t.renderControls})}var r0=_(nt(),1),fp=_(Y(),1),S9=(0,r0.forwardRef)(function({canvasId:e},n){let i=dv(),a=ap(e||i?.id),o=Vt();return(0,r0.useImperativeHandle)(n,()=>a,[e,i]),!i||a.enabledPageIds.length===0?null:(0,fp.jsx)(fp.Fragment,{children:a.enabledPageIds.map(s=>(0,fp.jsx)(wn.RenderAnnotationPage,{page:o.get(s)},s))})});var v4=_(nt(),1);var y4=_(nt(),1);var Sn=_(Y(),1);function dp({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,y4.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 S4=_(Y(),1);function b9(t){let e=on(),n=zt(),i=ad(),a=(0,v4.useMemo)(()=>{let o=e?.metadata||[],s=n?.metadata||[],u=i?.metadata||[];return[...o,...s,...u]},[e,n,i]);return(0,S4.jsx)(dp,{metadata:a,...t})}var s0=_(nt(),1);var b4=_(nt(),1);function l0(t,e={},n=[]){return(0,b4.useMemo)(()=>{if(!t)return null;let i=e.quality;t&&t.extraQualities&&e.quality&&(t.extraQualities.includes(e.quality)||(i="default"));let a=sg(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 hp=_(Y(),1);function x9(t){let e=typeof t.src=="string"?t.src:t.src.id,n=Dh(),[i,a]=(0,s0.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=l0(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,s0.useEffect)(()=>()=>{a(!1)},[e]),s?(0,hp.jsx)("img",{src:s,alt:t.alt,className:t.className,style:t.style}):(0,hp.jsx)(x4,{...t,fetchImageService:!1})}function x4(t){if(t.fetchImageService)return(0,hp.jsx)(x9,{...t});let e=typeof t.src=="string"?{id:t.src,profile:"level0"}:t.src,n=l0(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,hp.jsx)("img",{src:n,alt:t.alt,className:t.className,style:t.style}):null}var u0=_(nt(),1);var pr=_(Y(),1);function E9({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,u0.useState)(),S=e||i0,[E,T]=op(),A=(0,u0.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)(a0,{...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)(A9,{viewerPreset:g,renderViewerControls:o,image:A,src:t,viewControlsDeps:s}),a]})})})})}function A9({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 E4=_(Y(),1);function R9(t){let e=on();return(0,E4.jsx)(dp,{metadata:e?.metadata||[],...t})}var c0=_(nt(),1);var iT=_(R4(),1);var Ii=_(Y(),1),{LazyLoadComponent:T9}=iT||iT.default;function aT(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)(C9,{...t}),p=(0,Ii.jsx)(T9,{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 C9({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||Sv(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 w9({scrollBehaviour:t,dereference:e,flat:n,size:i,classes:a={},showLabel:o,figure:s,fallback:u}){let d=(0,c0.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,c0.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)(aT,{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 oT(){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),M9={draw:!0,polygon:!0,line:!0,lineBox:!0,box:!0,triangle:!0,hexagon:!0,circle:!0,delete:!0,pen:!0};function O9({showShapes:t=!0,enabled:e=M9,classNames:n={},icons:i={}}){let{currentTool:a,switchTool:o,selectedStamp:s}=oT();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 T4=_(Y(),1);function _9({annotation:t,children:e}){return(0,T4.jsx)(ci,{value:{annotation:t},children:e})}var C4=_(Y(),1);function z9({annotationPage:t,children:e}){return(0,C4.jsx)(ci,{value:{annotationPage:t},children:e})}var w4=_(Y(),1);function N9({collection:t,children:e}){return(0,w4.jsx)(ci,{value:{collection:t},children:e})}function I9(t,e={}){return dr(e)}var Ll=_(nt(),1);function D9({canvasId:t}={}){let e=dv(),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=Xh();(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 L9(t,e=!1){}function B9(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 M4=_(nt(),1);function P9(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,M4.useMemo)(()=>{if(s)return i?i(s):s},[s,i,...e])}var f0=_(nt(),1);function H9(){let t=Ie(),e=bt(t,i=>i.completeRequest),n=bt(t,i=>i.cancelRequest);return(0,f0.useMemo)(()=>({saveAnnotation:()=>{(0,f0.startTransition)(()=>{e()})},cancelRequest:n}),[e,n])}var O4=_(nt(),1);function U9({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,O4.useCallback)(u=>o(u,a||void 0),[o,a]);return[a?n[a]||{}:{},s]}function V9(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 d0=_(nt(),1);function j9(t,e,n,i,a=[]){let o=Vt(),s=(0,d0.useMemo)(()=>Oh(o),[o]);(0,d0.useEffect)(()=>{let u=t;return u?(s.addEventListener(u,e,n,i),()=>{s.removeEventListener(u,e,n)}):()=>{}},[s,t,e,...a])}function q9(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 rT({cacheKey:t}={}){let e=zt(),n=dr(),i=Vt(),a=$c(),o=GD(),[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 F9(){let t=rT();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 h0=_(nt(),1);function G9({supports:t=["empty","images","media","3d-model","textual-content","complex-timeline"]}={}){let e=Vt(),n=zt(),i=dr(),a=(0,h0.useMemo)(()=>Wc(e),[e]),o=(0,h0.useMemo)(()=>a.getPaintables(i),[a,i]);return(0,h0.useMemo)(()=>up({canvas:n,loadImageService:s=>s,paintables:o,supports:t}),[n,o,t])}var _4=_(nt(),1);function k9(){let t=Vt();return(0,_4.useMemo)(()=>El(t),[t])}var Pn=_(nt(),1);var pp=[.6,.02,0,.75],lT=16,sT={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":pp,"ease-out-cubic":[.215,.61,.355,1]};function uT(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 cT(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 fT(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 Y9(t){let{initial:e,regions:n,progress:i,getProgress:a,enabled:o=!0,easing:s,reportEveryFrame:u=!1,pollInterval:d=lT,loop:p=!1,onEnter:f,onExit:m,onProgress:g,jumpTo:v}=t,S=(0,Pn.useMemo)(()=>cT(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(pp);if(typeof s=="function")return s;if(Array.isArray(s)&&s.length===4)return mf(s);let J=sT[s];return J?mf(J):mf(pp)},[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}=fT(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?uT(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 Q9(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 X9(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 K9=!0,dT="Invariant failed";function z4(t,e){if(!t){if(K9)throw new Error(dT);var n=typeof e=="function"?e():e,i=n?"".concat(dT,": ").concat(n):dT;throw new Error(i)}}function Z9(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 z4(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 tP(W9);})();
135
136
  /*! Bundled license information:
136
137
 
137
138
  react/cjs/react-jsx-runtime.production.js: