1
0
Fork 0
su-collab/script/openseadragon/openseadragon-annotorious.m...

30 lines
534 KiB
JavaScript

(function(ke,X){typeof exports=="object"&&typeof module!="undefined"?module.exports=X():typeof define=="function"&&define.amd?define(X):(ke=typeof globalThis!="undefined"?globalThis:ke||self,ke.OpenSeadragon=ke.OpenSeadragon||{},ke.OpenSeadragon.Annotorious=X())})(this,function(){"use strict";var Rx=Object.defineProperty;var Mx=(ke,X,xt)=>X in ke?Rx(ke,X,{enumerable:!0,configurable:!0,writable:!0,value:xt}):ke[X]=xt;var P=(ke,X,xt)=>(Mx(ke,typeof X!="symbol"?X+"":X,xt),xt);var ke,X,xt,yn,vs,ys,ws,Yn={},bs=[],od=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function ft(i,t){for(var e in t)i[e]=t[e];return i}function Ss(i){var t=i.parentNode;t&&t.removeChild(i)}function Oe(i,t,e){var n,r,o,s={};for(o in t)o=="key"?n=t[o]:o=="ref"?r=t[o]:s[o]=t[o];if(arguments.length>2&&(s.children=arguments.length>3?ke.call(arguments,2):e),typeof i=="function"&&i.defaultProps!=null)for(o in i.defaultProps)s[o]===void 0&&(s[o]=i.defaultProps[o]);return wn(i,s,n,r,null)}function wn(i,t,e,n,r){var o={type:i,props:t,key:e,ref:n,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:r==null?++xt:r};return r==null&&X.vnode!=null&&X.vnode(o),o}function ur(){return{current:null}}function nt(i){return i.children}function Pe(i,t){this.props=i,this.context=t}function jt(i,t){if(t==null)return i.__?jt(i.__,i.__.__k.indexOf(i)+1):null;for(var e;t<i.__k.length;t++)if((e=i.__k[t])!=null&&e.__e!=null)return e.__e;return typeof i.type=="function"?jt(i):null}function Es(i){var t,e;if((i=i.__)!=null&&i.__c!=null){for(i.__e=i.__c.base=null,t=0;t<i.__k.length;t++)if((e=i.__k[t])!=null&&e.__e!=null){i.__e=i.__c.base=e.__e;break}return Es(i)}}function cr(i){(!i.__d&&(i.__d=!0)&&yn.push(i)&&!Zn.__r++||ys!==X.debounceRendering)&&((ys=X.debounceRendering)||vs)(Zn)}function Zn(){for(var i;Zn.__r=yn.length;)i=yn.sort(function(t,e){return t.__v.__b-e.__v.__b}),yn=[],i.some(function(t){var e,n,r,o,s,a;t.__d&&(s=(o=(e=t).__v).__e,(a=e.__P)&&(n=[],(r=ft({},o)).__v=o.__v+1,hr(a,o,r,e.__n,a.ownerSVGElement!==void 0,o.__h!=null?[s]:null,n,s==null?jt(o):s,o.__h),Os(n,o),o.__e!=s&&Es(o)))})}function xs(i,t,e,n,r,o,s,a,l,u){var c,h,d,g,y,x,b,T=n&&n.__k||bs,f=T.length;for(e.__k=[],c=0;c<t.length;c++)if((g=e.__k[c]=(g=t[c])==null||typeof g=="boolean"?null:typeof g=="string"||typeof g=="number"||typeof g=="bigint"?wn(null,g,null,null,g):Array.isArray(g)?wn(nt,{children:g},null,null,null):g.__b>0?wn(g.type,g.props,g.key,null,g.__v):g)!=null){if(g.__=e,g.__b=e.__b+1,(d=T[c])===null||d&&g.key==d.key&&g.type===d.type)T[c]=void 0;else for(h=0;h<f;h++){if((d=T[h])&&g.key==d.key&&g.type===d.type){T[h]=void 0;break}d=null}hr(i,g,d=d||Yn,r,o,s,a,l,u),y=g.__e,(h=g.ref)&&d.ref!=h&&(b||(b=[]),d.ref&&b.push(d.ref,null,g),b.push(h,g.__c||y,g)),y!=null?(x==null&&(x=y),typeof g.type=="function"&&g.__k===d.__k?g.__d=l=_s(g,l,i):l=Ts(i,g,d,T,y,l),typeof e.type=="function"&&(e.__d=l)):l&&d.__e==l&&l.parentNode!=i&&(l=jt(d))}for(e.__e=x,c=f;c--;)T[c]!=null&&(typeof e.type=="function"&&T[c].__e!=null&&T[c].__e==e.__d&&(e.__d=jt(n,c+1)),Rs(T[c],T[c]));if(b)for(c=0;c<b.length;c++)Ds(b[c],b[++c],b[++c])}function _s(i,t,e){for(var n,r=i.__k,o=0;r&&o<r.length;o++)(n=r[o])&&(n.__=i,t=typeof n.type=="function"?_s(n,t,e):Ts(e,n,n,r,n.__e,t));return t}function pt(i,t){return t=t||[],i==null||typeof i=="boolean"||(Array.isArray(i)?i.some(function(e){pt(e,t)}):t.push(i)),t}function Ts(i,t,e,n,r,o){var s,a,l;if(t.__d!==void 0)s=t.__d,t.__d=void 0;else if(e==null||r!=o||r.parentNode==null)e:if(o==null||o.parentNode!==i)i.appendChild(r),s=null;else{for(a=o,l=0;(a=a.nextSibling)&&l<n.length;l+=2)if(a==r)break e;i.insertBefore(r,o),s=o}return s!==void 0?s:r.nextSibling}function sd(i,t,e,n,r){var o;for(o in e)o==="children"||o==="key"||o in t||Kn(i,o,null,e[o],n);for(o in t)r&&typeof t[o]!="function"||o==="children"||o==="key"||o==="value"||o==="checked"||e[o]===t[o]||Kn(i,o,t[o],e[o],n)}function Cs(i,t,e){t[0]==="-"?i.setProperty(t,e):i[t]=e==null?"":typeof e!="number"||od.test(t)?e:e+"px"}function Kn(i,t,e,n,r){var o;e:if(t==="style")if(typeof e=="string")i.style.cssText=e;else{if(typeof n=="string"&&(i.style.cssText=n=""),n)for(t in n)e&&t in e||Cs(i.style,t,"");if(e)for(t in e)n&&e[t]===n[t]||Cs(i.style,t,e[t])}else if(t[0]==="o"&&t[1]==="n")o=t!==(t=t.replace(/Capture$/,"")),t=t.toLowerCase()in i?t.toLowerCase().slice(2):t.slice(2),i.l||(i.l={}),i.l[t+o]=e,e?n||i.addEventListener(t,o?As:Ps,o):i.removeEventListener(t,o?As:Ps,o);else if(t!=="dangerouslySetInnerHTML"){if(r)t=t.replace(/xlink[H:h]/,"h").replace(/sName$/,"s");else if(t!=="href"&&t!=="list"&&t!=="form"&&t!=="tabIndex"&&t!=="download"&&t in i)try{i[t]=e==null?"":e;break e}catch{}typeof e=="function"||(e!=null&&(e!==!1||t[0]==="a"&&t[1]==="r")?i.setAttribute(t,e):i.removeAttribute(t))}}function Ps(i){this.l[i.type+!1](X.event?X.event(i):i)}function As(i){this.l[i.type+!0](X.event?X.event(i):i)}function hr(i,t,e,n,r,o,s,a,l){var u,c,h,d,g,y,x,b,T,f,E,A=t.type;if(t.constructor!==void 0)return null;e.__h!=null&&(l=e.__h,a=t.__e=e.__e,t.__h=null,o=[a]),(u=X.__b)&&u(t);try{e:if(typeof A=="function"){if(b=t.props,T=(u=A.contextType)&&n[u.__c],f=u?T?T.props.value:u.__:n,e.__c?x=(c=t.__c=e.__c).__=c.__E:("prototype"in A&&A.prototype.render?t.__c=c=new A(b,f):(t.__c=c=new Pe(b,f),c.constructor=A,c.render=ld),T&&T.sub(c),c.props=b,c.state||(c.state={}),c.context=f,c.__n=n,h=c.__d=!0,c.__h=[]),c.__s==null&&(c.__s=c.state),A.getDerivedStateFromProps!=null&&(c.__s==c.state&&(c.__s=ft({},c.__s)),ft(c.__s,A.getDerivedStateFromProps(b,c.__s))),d=c.props,g=c.state,h)A.getDerivedStateFromProps==null&&c.componentWillMount!=null&&c.componentWillMount(),c.componentDidMount!=null&&c.__h.push(c.componentDidMount);else{if(A.getDerivedStateFromProps==null&&b!==d&&c.componentWillReceiveProps!=null&&c.componentWillReceiveProps(b,f),!c.__e&&c.shouldComponentUpdate!=null&&c.shouldComponentUpdate(b,c.__s,f)===!1||t.__v===e.__v){c.props=b,c.state=c.__s,t.__v!==e.__v&&(c.__d=!1),c.__v=t,t.__e=e.__e,t.__k=e.__k,t.__k.forEach(function(C){C&&(C.__=t)}),c.__h.length&&s.push(c);break e}c.componentWillUpdate!=null&&c.componentWillUpdate(b,c.__s,f),c.componentDidUpdate!=null&&c.__h.push(function(){c.componentDidUpdate(d,g,y)})}c.context=f,c.props=b,c.state=c.__s,(u=X.__r)&&u(t),c.__d=!1,c.__v=t,c.__P=i,u=c.render(c.props,c.state,c.context),c.state=c.__s,c.getChildContext!=null&&(n=ft(ft({},n),c.getChildContext())),h||c.getSnapshotBeforeUpdate==null||(y=c.getSnapshotBeforeUpdate(d,g)),E=u!=null&&u.type===nt&&u.key==null?u.props.children:u,xs(i,Array.isArray(E)?E:[E],t,e,n,r,o,s,a,l),c.base=t.__e,t.__h=null,c.__h.length&&s.push(c),x&&(c.__E=c.__=null),c.__e=!1}else o==null&&t.__v===e.__v?(t.__k=e.__k,t.__e=e.__e):t.__e=ad(e.__e,t,e,n,r,o,s,l);(u=X.diffed)&&u(t)}catch(C){t.__v=null,(l||o!=null)&&(t.__e=a,t.__h=!!l,o[o.indexOf(a)]=null),X.__e(C,t,e)}}function Os(i,t){X.__c&&X.__c(t,i),i.some(function(e){try{i=e.__h,e.__h=[],i.some(function(n){n.call(e)})}catch(n){X.__e(n,e.__v)}})}function ad(i,t,e,n,r,o,s,a){var l,u,c,h=e.props,d=t.props,g=t.type,y=0;if(g==="svg"&&(r=!0),o!=null){for(;y<o.length;y++)if((l=o[y])&&"setAttribute"in l==!!g&&(g?l.localName===g:l.nodeType===3)){i=l,o[y]=null;break}}if(i==null){if(g===null)return document.createTextNode(d);i=r?document.createElementNS("http://www.w3.org/2000/svg",g):document.createElement(g,d.is&&d),o=null,a=!1}if(g===null)h===d||a&&i.data===d||(i.data=d);else{if(o=o&&ke.call(i.childNodes),u=(h=e.props||Yn).dangerouslySetInnerHTML,c=d.dangerouslySetInnerHTML,!a){if(o!=null)for(h={},y=0;y<i.attributes.length;y++)h[i.attributes[y].name]=i.attributes[y].value;(c||u)&&(c&&(u&&c.__html==u.__html||c.__html===i.innerHTML)||(i.innerHTML=c&&c.__html||""))}if(sd(i,d,h,r,a),c)t.__k=[];else if(y=t.props.children,xs(i,Array.isArray(y)?y:[y],t,e,n,r&&g!=="foreignObject",o,s,o?o[0]:e.__k&&jt(e,0),a),o!=null)for(y=o.length;y--;)o[y]!=null&&Ss(o[y]);a||("value"in d&&(y=d.value)!==void 0&&(y!==h.value||y!==i.value||g==="progress"&&!y)&&Kn(i,"value",y,h.value,!1),"checked"in d&&(y=d.checked)!==void 0&&y!==i.checked&&Kn(i,"checked",y,h.checked,!1))}return i}function Ds(i,t,e){try{typeof i=="function"?i(t):i.current=t}catch(n){X.__e(n,e)}}function Rs(i,t,e){var n,r;if(X.unmount&&X.unmount(i),(n=i.ref)&&(n.current&&n.current!==i.__e||Ds(n,null,t)),(n=i.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(o){X.__e(o,t)}n.base=n.__P=null}if(n=i.__k)for(r=0;r<n.length;r++)n[r]&&Rs(n[r],t,typeof i.type!="function");e||i.__e==null||Ss(i.__e),i.__e=i.__d=void 0}function ld(i,t,e){return this.constructor(i,e)}function bn(i,t,e){var n,r,o;X.__&&X.__(i,t),r=(n=typeof e=="function")?null:e&&e.__k||t.__k,o=[],hr(t,i=(!n&&e||t).__k=Oe(nt,null,[i]),r||Yn,Yn,t.ownerSVGElement!==void 0,!n&&e?[e]:r?null:t.firstChild?ke.call(t.childNodes):null,o,!n&&e?e:r?r.__e:t.firstChild,n),Os(o,i)}function Ms(i,t){bn(i,t,Ms)}function ud(i,t,e){var n,r,o,s=ft({},i.props);for(o in t)o=="key"?n=t[o]:o=="ref"?r=t[o]:s[o]=t[o];return arguments.length>2&&(s.children=arguments.length>3?ke.call(arguments,2):e),wn(i.type,s,n||i.key,r||i.ref,null)}function Sn(i,t){var e={__c:t="__cC"+ws++,__:i,Consumer:function(n,r){return n.children(r)},Provider:function(n){var r,o;return this.getChildContext||(r=[],(o={})[t]=this,this.getChildContext=function(){return o},this.shouldComponentUpdate=function(s){this.props.value!==s.value&&r.some(cr)},this.sub=function(s){r.push(s);var a=s.componentWillUnmount;s.componentWillUnmount=function(){r.splice(r.indexOf(s),1),a&&a.call(s)}}),n.children}};return e.Provider.__=e.Consumer.contextType=e}ke=bs.slice,X={__e:function(i,t){for(var e,n,r;t=t.__;)if((e=t.__c)&&!e.__)try{if((n=e.constructor)&&n.getDerivedStateFromError!=null&&(e.setState(n.getDerivedStateFromError(i)),r=e.__d),e.componentDidCatch!=null&&(e.componentDidCatch(i),r=e.__d),r)return e.__E=e}catch(o){i=o}throw i}},xt=0,Pe.prototype.setState=function(i,t){var e;e=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=ft({},this.state),typeof i=="function"&&(i=i(ft({},e),this.props)),i&&ft(e,i),i!=null&&this.__v&&(t&&this.__h.push(t),cr(this))},Pe.prototype.forceUpdate=function(i){this.__v&&(this.__e=!0,i&&this.__h.push(i),cr(this))},Pe.prototype.render=nt,yn=[],vs=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Zn.__r=0,ws=0;var Ft,Le,Fs,Gt=0,dr=[],ks=X.__b,Ls=X.__r,Bs=X.diffed,Is=X.__c,Ns=X.unmount;function qt(i,t){X.__h&&X.__h(Le,i,Gt||t),Gt=0;var e=Le.__H||(Le.__H={__:[],__h:[]});return i>=e.__.length&&e.__.push({}),e.__[i]}function mt(i){return Gt=1,fr(Us,i)}function fr(i,t,e){var n=qt(Ft++,2);return n.t=i,n.__c||(n.__=[e?e(t):Us(void 0,t),function(r){var o=n.t(n.__[0],r);n.__[0]!==o&&(n.__=[o,n.__[1]],n.__c.setState({}))}],n.__c=Le),n.__}function kt(i,t){var e=qt(Ft++,3);!X.__s&&gr(e.__H,t)&&(e.__=i,e.__H=t,Le.__H.__h.push(e))}function pr(i,t){var e=qt(Ft++,4);!X.__s&&gr(e.__H,t)&&(e.__=i,e.__H=t,Le.__h.push(e))}function ot(i){return Gt=5,gt(function(){return{current:i}},[])}function Hs(i,t,e){Gt=6,pr(function(){typeof i=="function"?i(t()):i&&(i.current=t())},e==null?e:e.concat(i))}function gt(i,t){var e=qt(Ft++,7);return gr(e.__H,t)&&(e.__=i(),e.__H=t,e.__h=i),e.__}function st(i,t){return Gt=8,gt(function(){return i},t)}function En(i){var t=Le.context[i.__c],e=qt(Ft++,9);return e.c=i,t?(e.__==null&&(e.__=!0,t.sub(Le)),t.props.value):i.__}function zs(i,t){X.useDebugValue&&X.useDebugValue(t?t(i):i)}function cd(i){var t=qt(Ft++,10),e=mt();return t.__=i,Le.componentDidCatch||(Le.componentDidCatch=function(n){t.__&&t.__(n),e[1](n)}),[e[0],function(){e[1](void 0)}]}function hd(){var i;for(dr.sort(function(t,e){return t.__v.__b-e.__v.__b});i=dr.pop();)if(i.__P)try{i.__H.__h.forEach(Jn),i.__H.__h.forEach(mr),i.__H.__h=[]}catch(t){i.__H.__h=[],X.__e(t,i.__v)}}X.__b=function(i){Le=null,ks&&ks(i)},X.__r=function(i){Ls&&Ls(i),Ft=0;var t=(Le=i.__c).__H;t&&(t.__h.forEach(Jn),t.__h.forEach(mr),t.__h=[])},X.diffed=function(i){Bs&&Bs(i);var t=i.__c;t&&t.__H&&t.__H.__h.length&&(dr.push(t)!==1&&Fs===X.requestAnimationFrame||((Fs=X.requestAnimationFrame)||function(e){var n,r=function(){clearTimeout(o),Vs&&cancelAnimationFrame(n),setTimeout(e)},o=setTimeout(r,100);Vs&&(n=requestAnimationFrame(r))})(hd)),Le=null},X.__c=function(i,t){t.some(function(e){try{e.__h.forEach(Jn),e.__h=e.__h.filter(function(n){return!n.__||mr(n)})}catch(n){t.some(function(r){r.__h&&(r.__h=[])}),t=[],X.__e(n,e.__v)}}),Is&&Is(i,t)},X.unmount=function(i){Ns&&Ns(i);var t,e=i.__c;e&&e.__H&&(e.__H.__.forEach(function(n){try{Jn(n)}catch(r){t=r}}),t&&X.__e(t,e.__v))};var Vs=typeof requestAnimationFrame=="function";function Jn(i){var t=Le,e=i.__c;typeof e=="function"&&(i.__c=void 0,e()),Le=t}function mr(i){var t=Le;i.__c=i.__(),Le=t}function gr(i,t){return!i||i.length!==t.length||t.some(function(e,n){return e!==i[n]})}function Us(i,t){return typeof t=="function"?t(i):t}function Ws(i,t){for(var e in t)i[e]=t[e];return i}function vr(i,t){for(var e in i)if(e!=="__source"&&!(e in t))return!0;for(var n in t)if(n!=="__source"&&i[n]!==t[n])return!0;return!1}function xn(i){this.props=i}function js(i,t){function e(r){var o=this.props.ref,s=o==r.ref;return!s&&o&&(o.call?o(null):o.current=null),t?!t(this.props,r)||!s:vr(this.props,r)}function n(r){return this.shouldComponentUpdate=e,Oe(i,r)}return n.displayName="Memo("+(i.displayName||i.name)+")",n.prototype.isReactComponent=!0,n.__f=!0,n}(xn.prototype=new Pe).isPureReactComponent=!0,xn.prototype.shouldComponentUpdate=function(i,t){return vr(this.props,i)||vr(this.state,t)};var Gs=X.__b;X.__b=function(i){i.type&&i.type.__f&&i.ref&&(i.props.ref=i.ref,i.ref=null),Gs&&Gs(i)};var dd=typeof Symbol!="undefined"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function yr(i){function t(e,n){var r=Ws({},e);return delete r.ref,i(r,(n=e.ref||n)&&(typeof n!="object"||"current"in n)?n:null)}return t.$$typeof=dd,t.render=t,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(i.displayName||i.name)+")",t}var qs=function(i,t){return i==null?null:pt(pt(i).map(t))},Xs={map:qs,forEach:qs,count:function(i){return i?pt(i).length:0},only:function(i){var t=pt(i);if(t.length!==1)throw"Children.only";return t[0]},toArray:pt},fd=X.__e;X.__e=function(i,t,e){if(i.then){for(var n,r=t;r=r.__;)if((n=r.__c)&&n.__c)return t.__e==null&&(t.__e=e.__e,t.__k=e.__k),n.__c(i,t)}fd(i,t,e)};var Ys=X.unmount;function _n(){this.__u=0,this.t=null,this.__b=null}function Zs(i){var t=i.__.__c;return t&&t.__e&&t.__e(i)}function Ks(i){var t,e,n;function r(o){if(t||(t=i()).then(function(s){e=s.default||s},function(s){n=s}),n)throw n;if(!e)throw t;return Oe(e,o)}return r.displayName="Lazy",r.__f=!0,r}function Xt(){this.u=null,this.o=null}X.unmount=function(i){var t=i.__c;t&&t.__R&&t.__R(),t&&i.__h===!0&&(i.type=null),Ys&&Ys(i)},(_n.prototype=new Pe).__c=function(i,t){var e=t.__c,n=this;n.t==null&&(n.t=[]),n.t.push(e);var r=Zs(n.__v),o=!1,s=function(){o||(o=!0,e.__R=null,r?r(a):a())};e.__R=s;var a=function(){if(!--n.__u){if(n.state.__e){var u=n.state.__e;n.__v.__k[0]=function h(d,g,y){return d&&(d.__v=null,d.__k=d.__k&&d.__k.map(function(x){return h(x,g,y)}),d.__c&&d.__c.__P===g&&(d.__e&&y.insertBefore(d.__e,d.__d),d.__c.__e=!0,d.__c.__P=y)),d}(u,u.__c.__P,u.__c.__O)}var c;for(n.setState({__e:n.__b=null});c=n.t.pop();)c.forceUpdate()}},l=t.__h===!0;n.__u++||l||n.setState({__e:n.__b=n.__v.__k[0]}),i.then(s,s)},_n.prototype.componentWillUnmount=function(){this.t=[]},_n.prototype.render=function(i,t){if(this.__b){if(this.__v.__k){var e=document.createElement("div"),n=this.__v.__k[0].__c;this.__v.__k[0]=function o(s,a,l){return s&&(s.__c&&s.__c.__H&&(s.__c.__H.__.forEach(function(u){typeof u.__c=="function"&&u.__c()}),s.__c.__H=null),(s=Ws({},s)).__c!=null&&(s.__c.__P===l&&(s.__c.__P=a),s.__c=null),s.__k=s.__k&&s.__k.map(function(u){return o(u,a,l)})),s}(this.__b,e,n.__O=n.__P)}this.__b=null}var r=t.__e&&Oe(nt,null,i.fallback);return r&&(r.__h=null),[Oe(nt,null,t.__e?null:i.children),r]};var Js=function(i,t,e){if(++e[1]===e[0]&&i.o.delete(t),i.props.revealOrder&&(i.props.revealOrder[0]!=="t"||!i.o.size))for(e=i.u;e;){for(;e.length>3;)e.pop()();if(e[1]<e[0])break;i.u=e=e[2]}};function pd(i){return this.getChildContext=function(){return i.context},i.children}function md(i){var t=this,e=i.i;t.componentWillUnmount=function(){bn(null,t.l),t.l=null,t.i=null},t.i&&t.i!==e&&t.componentWillUnmount(),i.__v?(t.l||(t.i=e,t.l={nodeType:1,parentNode:e,childNodes:[],appendChild:function(n){this.childNodes.push(n),t.i.appendChild(n)},insertBefore:function(n,r){this.childNodes.push(n),t.i.appendChild(n)},removeChild:function(n){this.childNodes.splice(this.childNodes.indexOf(n)>>>1,1),t.i.removeChild(n)}}),bn(Oe(pd,{context:t.context},i.__v),t.l)):t.l&&t.componentWillUnmount()}function wr(i,t){return Oe(md,{__v:i,i:t})}(Xt.prototype=new Pe).__e=function(i){var t=this,e=Zs(t.__v),n=t.o.get(i);return n[0]++,function(r){var o=function(){t.props.revealOrder?(n.push(r),Js(t,i,n)):r()};e?e(o):o()}},Xt.prototype.render=function(i){this.u=null,this.o=new Map;var t=pt(i.children);i.revealOrder&&i.revealOrder[0]==="b"&&t.reverse();for(var e=t.length;e--;)this.o.set(t[e],this.u=[1,0,this.u]);return i.children},Xt.prototype.componentDidUpdate=Xt.prototype.componentDidMount=function(){var i=this;this.o.forEach(function(t,e){Js(i,e,t)})};var Qs=typeof Symbol!="undefined"&&Symbol.for&&Symbol.for("react.element")||60103,gd=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|marker(?!H|W|U)|overline|paint|stop|strikethrough|stroke|text(?!L)|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,vd=typeof document!="undefined",yd=function(i){return(typeof Symbol!="undefined"&&typeof Symbol()=="symbol"?/fil|che|rad/i:/fil|che|ra/i).test(i)};function $s(i,t,e){return t.__k==null&&(t.textContent=""),bn(i,t),typeof e=="function"&&e(),i?i.__c:null}function ea(i,t,e){return Ms(i,t),typeof e=="function"&&e(),i?i.__c:null}Pe.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(i){Object.defineProperty(Pe.prototype,i,{configurable:!0,get:function(){return this["UNSAFE_"+i]},set:function(t){Object.defineProperty(this,i,{configurable:!0,writable:!0,value:t})}})});var ta=X.event;function wd(){}function bd(){return this.cancelBubble}function Sd(){return this.defaultPrevented}X.event=function(i){return ta&&(i=ta(i)),i.persist=wd,i.isPropagationStopped=bd,i.isDefaultPrevented=Sd,i.nativeEvent=i};var na,ia={configurable:!0,get:function(){return this.class}},ra=X.vnode;X.vnode=function(i){var t=i.type,e=i.props,n=e;if(typeof t=="string"){var r=t.indexOf("-")===-1;for(var o in n={},e){var s=e[o];vd&&o==="children"&&t==="noscript"||o==="value"&&"defaultValue"in e&&s==null||(o==="defaultValue"&&"value"in e&&e.value==null?o="value":o==="download"&&s===!0?s="":/ondoubleclick/i.test(o)?o="ondblclick":/^onchange(textarea|input)/i.test(o+t)&&!yd(e.type)?o="oninput":/^onfocus$/i.test(o)?o="onfocusin":/^onblur$/i.test(o)?o="onfocusout":/^on(Ani|Tra|Tou|BeforeInp)/.test(o)?o=o.toLowerCase():r&&gd.test(o)?o=o.replace(/[A-Z0-9]/,"-$&").toLowerCase():s===null&&(s=void 0),n[o]=s)}t=="select"&&n.multiple&&Array.isArray(n.value)&&(n.value=pt(e.children).forEach(function(a){a.props.selected=n.value.indexOf(a.props.value)!=-1})),t=="select"&&n.defaultValue!=null&&(n.value=pt(e.children).forEach(function(a){a.props.selected=n.multiple?n.defaultValue.indexOf(a.props.value)!=-1:n.defaultValue==a.props.value})),i.props=n,e.class!=e.className&&(ia.enumerable="className"in e,e.className!=null&&(n.class=e.className),Object.defineProperty(n,"className",ia))}i.$$typeof=Qs,ra&&ra(i)};var oa=X.__r;X.__r=function(i){oa&&oa(i),na=i.__c};var sa={ReactCurrentDispatcher:{current:{readContext:function(i){return na.__n[i.__c].props.value}}}},Ed="17.0.2";function aa(i){return Oe.bind(null,i)}function br(i){return!!i&&i.$$typeof===Qs}function la(i){return br(i)?ud.apply(null,arguments):i}function ua(i){return!!i.__k&&(bn(null,i),!0)}function ca(i){return i&&(i.base||i.nodeType===1&&i)||null}var ha=function(i,t){return i(t)},da=function(i,t){return i(t)},xd=nt,k={useState:mt,useReducer:fr,useEffect:kt,useLayoutEffect:pr,useRef:ot,useImperativeHandle:Hs,useMemo:gt,useCallback:st,useContext:En,useDebugValue:zs,version:"17.0.2",Children:Xs,render:$s,hydrate:ea,unmountComponentAtNode:ua,createPortal:wr,createElement:Oe,createContext:Sn,createFactory:aa,cloneElement:la,createRef:ur,Fragment:nt,isValidElement:br,findDOMNode:ca,Component:Pe,PureComponent:xn,memo:js,forwardRef:yr,flushSync:da,unstable_batchedUpdates:ha,StrictMode:nt,Suspense:_n,SuspenseList:Xt,lazy:Ks,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:sa},Sr=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",default:k,version:Ed,Children:Xs,render:$s,hydrate:ea,unmountComponentAtNode:ua,createPortal:wr,createFactory:aa,cloneElement:la,isValidElement:br,findDOMNode:ca,PureComponent:xn,memo:js,forwardRef:yr,flushSync:da,unstable_batchedUpdates:ha,StrictMode:xd,Suspense:_n,SuspenseList:Xt,lazy:Ks,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:sa,createElement:Oe,createContext:Sn,createRef:ur,Fragment:nt,Component:Pe,useState:mt,useReducer:fr,useEffect:kt,useLayoutEffect:pr,useRef:ot,useImperativeHandle:Hs,useMemo:gt,useCallback:st,useContext:En,useDebugValue:zs,useErrorBoundary:cd}),_t=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function _d(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}function Er(i){if(i.__esModule)return i;var t=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(i).forEach(function(e){var n=Object.getOwnPropertyDescriptor(i,e);Object.defineProperty(t,e,n.get?n:{enumerable:!0,get:function(){return i[e]}})}),t}var xr={exports:{}};function _r(){}_r.prototype={on:function(i,t,e){var n=this.e||(this.e={});return(n[i]||(n[i]=[])).push({fn:t,ctx:e}),this},once:function(i,t,e){var n=this;function r(){n.off(i,r),t.apply(e,arguments)}return r._=t,this.on(i,r,e)},emit:function(i){var t=[].slice.call(arguments,1),e=((this.e||(this.e={}))[i]||[]).slice(),n=0,r=e.length;for(n;n<r;n++)e[n].fn.apply(e[n].ctx,t);return this},off:function(i,t){var e=this.e||(this.e={}),n=e[i],r=[];if(n&&t)for(var o=0,s=n.length;o<s;o++)n[o].fn!==t&&n[o].fn._!==t&&r.push(n[o]);return r.length?e[i]=r:delete e[i],this}},xr.exports=_r,xr.exports.TinyEmitter=_r;var Qn=xr.exports,$n={exports:{}},fa={},Yt=Er(Sr),Tn={exports:{}},Td="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",Cd=Td,Pd=Cd;function pa(){}function ma(){}ma.resetWarningCache=pa;var Ad=function(){function i(n,r,o,s,a,l){if(l!==Pd){var u=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 u.name="Invariant Violation",u}}i.isRequired=i;function t(){return i}var e={array:i,bigint:i,bool:i,func:i,number:i,object:i,string:i,symbol:i,any:i,arrayOf:t,element:i,elementType:i,instanceOf:t,node:i,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:ma,resetWarningCache:pa};return e.PropTypes=e,e};Tn.exports=Ad();function ga(i){var t,e,n="";if(typeof i=="string"||typeof i=="number")n+=i;else if(typeof i=="object")if(Array.isArray(i))for(t=0;t<i.length;t++)i[t]&&(e=ga(i[t]))&&(n&&(n+=" "),n+=e);else for(t in i)i[t]&&(n&&(n+=" "),n+=t);return n}function va(){for(var i,t,e=0,n="";e<arguments.length;)(i=arguments[e++])&&(t=ga(i))&&(n&&(n+=" "),n+=t);return n}var Od=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",clsx:va,default:va}),Dd=Er(Od),xe={},at={};Object.defineProperty(at,"__esModule",{value:!0}),at.dontSetMe=Ld,at.findInArray=Rd,at.int=kd,at.isFunction=Md,at.isNum=Fd;function Rd(i,t){for(var e=0,n=i.length;e<n;e++)if(t.apply(t,[i[e],e,i]))return i[e]}function Md(i){return typeof i=="function"||Object.prototype.toString.call(i)==="[object Function]"}function Fd(i){return typeof i=="number"&&!isNaN(i)}function kd(i){return parseInt(i,10)}function Ld(i,t,e){if(i[t])return new Error("Invalid prop ".concat(t," passed to ").concat(e," - do not set this, set it on the child."))}var Lt={};Object.defineProperty(Lt,"__esModule",{value:!0}),Lt.browserPrefixToKey=wa,Lt.browserPrefixToStyle=Bd,Lt.default=void 0,Lt.getPrefix=ya;var Tr=["Moz","Webkit","O","ms"];function ya(){var i,t,e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"transform";if(typeof window=="undefined")return"";var n=(i=window.document)===null||i===void 0||(t=i.documentElement)===null||t===void 0?void 0:t.style;if(!n||e in n)return"";for(var r=0;r<Tr.length;r++)if(wa(e,Tr[r])in n)return Tr[r];return""}function wa(i,t){return t?"".concat(t).concat(Id(i)):i}function Bd(i,t){return t?"-".concat(t.toLowerCase(),"-").concat(i):i}function Id(i){for(var t="",e=!0,n=0;n<i.length;n++)e?(t+=i[n].toUpperCase(),e=!1):i[n]==="-"?e=!0:t+=i[n];return t}var Nd=ya();Lt.default=Nd;function Cr(i){return Cr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Cr(i)}Object.defineProperty(xe,"__esModule",{value:!0}),xe.addClassName=Ca,xe.addEvent=Vd,xe.addUserSelectStyles=Qd,xe.createCSSTransform=Yd,xe.createSVGTransform=Zd,xe.getTouch=Kd,xe.getTouchIdentifier=Jd,xe.getTranslation=Pr,xe.innerHeight=Gd,xe.innerWidth=qd,xe.matchesSelector=Ta,xe.matchesSelectorAndParentsTo=zd,xe.offsetXYFromParent=Xd,xe.outerHeight=Wd,xe.outerWidth=jd,xe.removeClassName=Pa,xe.removeEvent=Ud,xe.removeUserSelectStyles=$d;var qe=at,ba=Hd(Lt);function Sa(i){if(typeof WeakMap!="function")return null;var t=new WeakMap,e=new WeakMap;return(Sa=function(r){return r?e:t})(i)}function Hd(i,t){if(!t&&i&&i.__esModule)return i;if(i===null||Cr(i)!=="object"&&typeof i!="function")return{default:i};var e=Sa(t);if(e&&e.has(i))return e.get(i);var n={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in i)if(o!=="default"&&Object.prototype.hasOwnProperty.call(i,o)){var s=r?Object.getOwnPropertyDescriptor(i,o):null;s&&(s.get||s.set)?Object.defineProperty(n,o,s):n[o]=i[o]}return n.default=i,e&&e.set(i,n),n}function Ea(i,t){var e=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);t&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),e.push.apply(e,n)}return e}function xa(i){for(var t=1;t<arguments.length;t++){var e=arguments[t]!=null?arguments[t]:{};t%2?Ea(Object(e),!0).forEach(function(n){_a(i,n,e[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(e)):Ea(Object(e)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(e,n))})}return i}function _a(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}var ei="";function Ta(i,t){return ei||(ei=(0,qe.findInArray)(["matches","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector"],function(e){return(0,qe.isFunction)(i[e])})),(0,qe.isFunction)(i[ei])?i[ei](t):!1}function zd(i,t,e){var n=i;do{if(Ta(n,t))return!0;if(n===e)return!1;n=n.parentNode}while(n);return!1}function Vd(i,t,e,n){if(!!i){var r=xa({capture:!0},n);i.addEventListener?i.addEventListener(t,e,r):i.attachEvent?i.attachEvent("on"+t,e):i["on"+t]=e}}function Ud(i,t,e,n){if(!!i){var r=xa({capture:!0},n);i.removeEventListener?i.removeEventListener(t,e,r):i.detachEvent?i.detachEvent("on"+t,e):i["on"+t]=null}}function Wd(i){var t=i.clientHeight,e=i.ownerDocument.defaultView.getComputedStyle(i);return t+=(0,qe.int)(e.borderTopWidth),t+=(0,qe.int)(e.borderBottomWidth),t}function jd(i){var t=i.clientWidth,e=i.ownerDocument.defaultView.getComputedStyle(i);return t+=(0,qe.int)(e.borderLeftWidth),t+=(0,qe.int)(e.borderRightWidth),t}function Gd(i){var t=i.clientHeight,e=i.ownerDocument.defaultView.getComputedStyle(i);return t-=(0,qe.int)(e.paddingTop),t-=(0,qe.int)(e.paddingBottom),t}function qd(i){var t=i.clientWidth,e=i.ownerDocument.defaultView.getComputedStyle(i);return t-=(0,qe.int)(e.paddingLeft),t-=(0,qe.int)(e.paddingRight),t}function Xd(i,t,e){var n=t===t.ownerDocument.body,r=n?{left:0,top:0}:t.getBoundingClientRect(),o=(i.clientX+t.scrollLeft-r.left)/e,s=(i.clientY+t.scrollTop-r.top)/e;return{x:o,y:s}}function Yd(i,t){var e=Pr(i,t,"px");return _a({},(0,ba.browserPrefixToKey)("transform",ba.default),e)}function Zd(i,t){var e=Pr(i,t,"");return e}function Pr(i,t,e){var n=i.x,r=i.y,o="translate(".concat(n).concat(e,",").concat(r).concat(e,")");if(t){var s="".concat(typeof t.x=="string"?t.x:t.x+e),a="".concat(typeof t.y=="string"?t.y:t.y+e);o="translate(".concat(s,", ").concat(a,")")+o}return o}function Kd(i,t){return i.targetTouches&&(0,qe.findInArray)(i.targetTouches,function(e){return t===e.identifier})||i.changedTouches&&(0,qe.findInArray)(i.changedTouches,function(e){return t===e.identifier})}function Jd(i){if(i.targetTouches&&i.targetTouches[0])return i.targetTouches[0].identifier;if(i.changedTouches&&i.changedTouches[0])return i.changedTouches[0].identifier}function Qd(i){if(!!i){var t=i.getElementById("react-draggable-style-el");t||(t=i.createElement("style"),t.type="text/css",t.id="react-draggable-style-el",t.innerHTML=`.react-draggable-transparent-selection *::-moz-selection {all: inherit;}
`,t.innerHTML+=`.react-draggable-transparent-selection *::selection {all: inherit;}
`,i.getElementsByTagName("head")[0].appendChild(t)),i.body&&Ca(i.body,"react-draggable-transparent-selection")}}function $d(i){if(!!i)try{if(i.body&&Pa(i.body,"react-draggable-transparent-selection"),i.selection)i.selection.empty();else{var t=(i.defaultView||window).getSelection();t&&t.type!=="Caret"&&t.removeAllRanges()}}catch{}}function Ca(i,t){i.classList?i.classList.add(t):i.className.match(new RegExp("(?:^|\\s)".concat(t,"(?!\\S)")))||(i.className+=" ".concat(t))}function Pa(i,t){i.classList?i.classList.remove(t):i.className=i.className.replace(new RegExp("(?:^|\\s)".concat(t,"(?!\\S)"),"g"),"")}var lt={};Object.defineProperty(lt,"__esModule",{value:!0}),lt.canDragX=nf,lt.canDragY=rf,lt.createCoreData=sf,lt.createDraggableData=af,lt.getBoundPosition=ef,lt.getControlPosition=of,lt.snapToGrid=tf;var Xe=at,Zt=xe;function ef(i,t,e){if(!i.props.bounds)return[t,e];var n=i.props.bounds;n=typeof n=="string"?n:lf(n);var r=Ar(i);if(typeof n=="string"){var o=r.ownerDocument,s=o.defaultView,a;if(n==="parent"?a=r.parentNode:a=o.querySelector(n),!(a instanceof s.HTMLElement))throw new Error('Bounds selector "'+n+'" could not find an element.');var l=a,u=s.getComputedStyle(r),c=s.getComputedStyle(l);n={left:-r.offsetLeft+(0,Xe.int)(c.paddingLeft)+(0,Xe.int)(u.marginLeft),top:-r.offsetTop+(0,Xe.int)(c.paddingTop)+(0,Xe.int)(u.marginTop),right:(0,Zt.innerWidth)(l)-(0,Zt.outerWidth)(r)-r.offsetLeft+(0,Xe.int)(c.paddingRight)-(0,Xe.int)(u.marginRight),bottom:(0,Zt.innerHeight)(l)-(0,Zt.outerHeight)(r)-r.offsetTop+(0,Xe.int)(c.paddingBottom)-(0,Xe.int)(u.marginBottom)}}return(0,Xe.isNum)(n.right)&&(t=Math.min(t,n.right)),(0,Xe.isNum)(n.bottom)&&(e=Math.min(e,n.bottom)),(0,Xe.isNum)(n.left)&&(t=Math.max(t,n.left)),(0,Xe.isNum)(n.top)&&(e=Math.max(e,n.top)),[t,e]}function tf(i,t,e){var n=Math.round(t/i[0])*i[0],r=Math.round(e/i[1])*i[1];return[n,r]}function nf(i){return i.props.axis==="both"||i.props.axis==="x"}function rf(i){return i.props.axis==="both"||i.props.axis==="y"}function of(i,t,e){var n=typeof t=="number"?(0,Zt.getTouch)(i,t):null;if(typeof t=="number"&&!n)return null;var r=Ar(e),o=e.props.offsetParent||r.offsetParent||r.ownerDocument.body;return(0,Zt.offsetXYFromParent)(n||i,o,e.props.scale)}function sf(i,t,e){var n=i.state,r=!(0,Xe.isNum)(n.lastX),o=Ar(i);return r?{node:o,deltaX:0,deltaY:0,lastX:t,lastY:e,x:t,y:e}:{node:o,deltaX:t-n.lastX,deltaY:e-n.lastY,lastX:n.lastX,lastY:n.lastY,x:t,y:e}}function af(i,t){var e=i.props.scale;return{node:t.node,x:i.state.x+t.deltaX/e,y:i.state.y+t.deltaY/e,deltaX:t.deltaX/e,deltaY:t.deltaY/e,lastX:i.state.x,lastY:i.state.y}}function lf(i){return{left:i.left,top:i.top,right:i.right,bottom:i.bottom}}function Ar(i){var t=i.findDOMNode();if(!t)throw new Error("<DraggableCore>: Unmounted during event!");return t}var ti={},ni={};Object.defineProperty(ni,"__esModule",{value:!0}),ni.default=uf;function uf(){}function ii(i){return ii=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ii(i)}Object.defineProperty(ti,"__esModule",{value:!0}),ti.default=void 0;var Or=hf(Yt),Ye=Rr(Tn.exports),cf=Rr(Yt),Ve=xe,Tt=lt,Dr=at,Cn=Rr(ni);function Rr(i){return i&&i.__esModule?i:{default:i}}function Aa(i){if(typeof WeakMap!="function")return null;var t=new WeakMap,e=new WeakMap;return(Aa=function(r){return r?e:t})(i)}function hf(i,t){if(!t&&i&&i.__esModule)return i;if(i===null||ii(i)!=="object"&&typeof i!="function")return{default:i};var e=Aa(t);if(e&&e.has(i))return e.get(i);var n={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in i)if(o!=="default"&&Object.prototype.hasOwnProperty.call(i,o)){var s=r?Object.getOwnPropertyDescriptor(i,o):null;s&&(s.get||s.set)?Object.defineProperty(n,o,s):n[o]=i[o]}return n.default=i,e&&e.set(i,n),n}function Oa(i,t){return mf(i)||pf(i,t)||ff(i,t)||df()}function df(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ff(i,t){if(!!i){if(typeof i=="string")return Da(i,t);var e=Object.prototype.toString.call(i).slice(8,-1);if(e==="Object"&&i.constructor&&(e=i.constructor.name),e==="Map"||e==="Set")return Array.from(i);if(e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return Da(i,t)}}function Da(i,t){(t==null||t>i.length)&&(t=i.length);for(var e=0,n=new Array(t);e<t;e++)n[e]=i[e];return n}function pf(i,t){var e=i==null?null:typeof Symbol!="undefined"&&i[Symbol.iterator]||i["@@iterator"];if(e!=null){var n=[],r=!0,o=!1,s,a;try{for(e=e.call(i);!(r=(s=e.next()).done)&&(n.push(s.value),!(t&&n.length===t));r=!0);}catch(l){o=!0,a=l}finally{try{!r&&e.return!=null&&e.return()}finally{if(o)throw a}}return n}}function mf(i){if(Array.isArray(i))return i}function gf(i,t){if(!(i instanceof t))throw new TypeError("Cannot call a class as a function")}function Ra(i,t){for(var e=0;e<t.length;e++){var n=t[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(i,n.key,n)}}function vf(i,t,e){return t&&Ra(i.prototype,t),e&&Ra(i,e),Object.defineProperty(i,"prototype",{writable:!1}),i}function yf(i,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");i.prototype=Object.create(t&&t.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),Object.defineProperty(i,"prototype",{writable:!1}),t&&Mr(i,t)}function Mr(i,t){return Mr=Object.setPrototypeOf||function(n,r){return n.__proto__=r,n},Mr(i,t)}function wf(i){var t=Sf();return function(){var n=ri(i),r;if(t){var o=ri(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return bf(this,r)}}function bf(i,t){if(t&&(ii(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Ue(i)}function Ue(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function Sf(){if(typeof Reflect=="undefined"||!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 ri(i){return ri=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},ri(i)}function it(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}var rt={touch:{start:"touchstart",move:"touchmove",stop:"touchend"},mouse:{start:"mousedown",move:"mousemove",stop:"mouseup"}},Ct=rt.mouse,oi=function(i){yf(e,i);var t=wf(e);function e(){var n;gf(this,e);for(var r=arguments.length,o=new Array(r),s=0;s<r;s++)o[s]=arguments[s];return n=t.call.apply(t,[this].concat(o)),it(Ue(n),"state",{dragging:!1,lastX:NaN,lastY:NaN,touchIdentifier:null}),it(Ue(n),"mounted",!1),it(Ue(n),"handleDragStart",function(a){if(n.props.onMouseDown(a),!n.props.allowAnyClick&&typeof a.button=="number"&&a.button!==0)return!1;var l=n.findDOMNode();if(!l||!l.ownerDocument||!l.ownerDocument.body)throw new Error("<DraggableCore> not mounted on DragStart!");var u=l.ownerDocument;if(!(n.props.disabled||!(a.target instanceof u.defaultView.Node)||n.props.handle&&!(0,Ve.matchesSelectorAndParentsTo)(a.target,n.props.handle,l)||n.props.cancel&&(0,Ve.matchesSelectorAndParentsTo)(a.target,n.props.cancel,l))){a.type==="touchstart"&&a.preventDefault();var c=(0,Ve.getTouchIdentifier)(a);n.setState({touchIdentifier:c});var h=(0,Tt.getControlPosition)(a,c,Ue(n));if(h!=null){var d=h.x,g=h.y,y=(0,Tt.createCoreData)(Ue(n),d,g);(0,Cn.default)("DraggableCore: handleDragStart: %j",y),(0,Cn.default)("calling",n.props.onStart);var x=n.props.onStart(a,y);x===!1||n.mounted===!1||(n.props.enableUserSelectHack&&(0,Ve.addUserSelectStyles)(u),n.setState({dragging:!0,lastX:d,lastY:g}),(0,Ve.addEvent)(u,Ct.move,n.handleDrag),(0,Ve.addEvent)(u,Ct.stop,n.handleDragStop))}}}),it(Ue(n),"handleDrag",function(a){var l=(0,Tt.getControlPosition)(a,n.state.touchIdentifier,Ue(n));if(l!=null){var u=l.x,c=l.y;if(Array.isArray(n.props.grid)){var h=u-n.state.lastX,d=c-n.state.lastY,g=(0,Tt.snapToGrid)(n.props.grid,h,d),y=Oa(g,2);if(h=y[0],d=y[1],!h&&!d)return;u=n.state.lastX+h,c=n.state.lastY+d}var x=(0,Tt.createCoreData)(Ue(n),u,c);(0,Cn.default)("DraggableCore: handleDrag: %j",x);var b=n.props.onDrag(a,x);if(b===!1||n.mounted===!1){try{n.handleDragStop(new MouseEvent("mouseup"))}catch{var T=document.createEvent("MouseEvents");T.initMouseEvent("mouseup",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),n.handleDragStop(T)}return}n.setState({lastX:u,lastY:c})}}),it(Ue(n),"handleDragStop",function(a){if(!!n.state.dragging){var l=(0,Tt.getControlPosition)(a,n.state.touchIdentifier,Ue(n));if(l!=null){var u=l.x,c=l.y;if(Array.isArray(n.props.grid)){var h=u-n.state.lastX||0,d=c-n.state.lastY||0,g=(0,Tt.snapToGrid)(n.props.grid,h,d),y=Oa(g,2);h=y[0],d=y[1],u=n.state.lastX+h,c=n.state.lastY+d}var x=(0,Tt.createCoreData)(Ue(n),u,c),b=n.props.onStop(a,x);if(b===!1||n.mounted===!1)return!1;var T=n.findDOMNode();T&&n.props.enableUserSelectHack&&(0,Ve.removeUserSelectStyles)(T.ownerDocument),(0,Cn.default)("DraggableCore: handleDragStop: %j",x),n.setState({dragging:!1,lastX:NaN,lastY:NaN}),T&&((0,Cn.default)("DraggableCore: Removing handlers"),(0,Ve.removeEvent)(T.ownerDocument,Ct.move,n.handleDrag),(0,Ve.removeEvent)(T.ownerDocument,Ct.stop,n.handleDragStop))}}}),it(Ue(n),"onMouseDown",function(a){return Ct=rt.mouse,n.handleDragStart(a)}),it(Ue(n),"onMouseUp",function(a){return Ct=rt.mouse,n.handleDragStop(a)}),it(Ue(n),"onTouchStart",function(a){return Ct=rt.touch,n.handleDragStart(a)}),it(Ue(n),"onTouchEnd",function(a){return Ct=rt.touch,n.handleDragStop(a)}),n}return vf(e,[{key:"componentDidMount",value:function(){this.mounted=!0;var r=this.findDOMNode();r&&(0,Ve.addEvent)(r,rt.touch.start,this.onTouchStart,{passive:!1})}},{key:"componentWillUnmount",value:function(){this.mounted=!1;var r=this.findDOMNode();if(r){var o=r.ownerDocument;(0,Ve.removeEvent)(o,rt.mouse.move,this.handleDrag),(0,Ve.removeEvent)(o,rt.touch.move,this.handleDrag),(0,Ve.removeEvent)(o,rt.mouse.stop,this.handleDragStop),(0,Ve.removeEvent)(o,rt.touch.stop,this.handleDragStop),(0,Ve.removeEvent)(r,rt.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&(0,Ve.removeUserSelectStyles)(o)}}},{key:"findDOMNode",value:function(){var r,o,s;return(r=this.props)!==null&&r!==void 0&&r.nodeRef?(o=this.props)===null||o===void 0||(s=o.nodeRef)===null||s===void 0?void 0:s.current:cf.default.findDOMNode(this)}},{key:"render",value:function(){return Or.cloneElement(Or.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}}]),e}(Or.Component);ti.default=oi,it(oi,"displayName","DraggableCore"),it(oi,"propTypes",{allowAnyClick:Ye.default.bool,disabled:Ye.default.bool,enableUserSelectHack:Ye.default.bool,offsetParent:function(t,e){if(t[e]&&t[e].nodeType!==1)throw new Error("Draggable's offsetParent must be a DOM Node.")},grid:Ye.default.arrayOf(Ye.default.number),handle:Ye.default.string,cancel:Ye.default.string,nodeRef:Ye.default.object,onStart:Ye.default.func,onDrag:Ye.default.func,onStop:Ye.default.func,onMouseDown:Ye.default.func,scale:Ye.default.number,className:Dr.dontSetMe,style:Dr.dontSetMe,transform:Dr.dontSetMe}),it(oi,"defaultProps",{allowAnyClick:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1}),function(i){function t(F){return t=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(H){return typeof H}:function(H){return H&&typeof Symbol=="function"&&H.constructor===Symbol&&H!==Symbol.prototype?"symbol":typeof H},t(F)}Object.defineProperty(i,"__esModule",{value:!0}),Object.defineProperty(i,"DraggableCore",{enumerable:!0,get:function(){return u.default}}),i.default=void 0;var e=y(Yt),n=d(Tn.exports),r=d(Yt),o=d(Dd),s=xe,a=lt,l=at,u=d(ti),c=d(ni),h=["axis","bounds","children","defaultPosition","defaultClassName","defaultClassNameDragging","defaultClassNameDragged","position","positionOffset","scale"];function d(F){return F&&F.__esModule?F:{default:F}}function g(F){if(typeof WeakMap!="function")return null;var H=new WeakMap,U=new WeakMap;return(g=function(j){return j?U:H})(F)}function y(F,H){if(!H&&F&&F.__esModule)return F;if(F===null||t(F)!=="object"&&typeof F!="function")return{default:F};var U=g(H);if(U&&U.has(F))return U.get(F);var W={},j=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var $ in F)if($!=="default"&&Object.prototype.hasOwnProperty.call(F,$)){var ae=j?Object.getOwnPropertyDescriptor(F,$):null;ae&&(ae.get||ae.set)?Object.defineProperty(W,$,ae):W[$]=F[$]}return W.default=F,U&&U.set(F,W),W}function x(){return x=Object.assign||function(F){for(var H=1;H<arguments.length;H++){var U=arguments[H];for(var W in U)Object.prototype.hasOwnProperty.call(U,W)&&(F[W]=U[W])}return F},x.apply(this,arguments)}function b(F,H){if(F==null)return{};var U=T(F,H),W,j;if(Object.getOwnPropertySymbols){var $=Object.getOwnPropertySymbols(F);for(j=0;j<$.length;j++)W=$[j],!(H.indexOf(W)>=0)&&(!Object.prototype.propertyIsEnumerable.call(F,W)||(U[W]=F[W]))}return U}function T(F,H){if(F==null)return{};var U={},W=Object.keys(F),j,$;for($=0;$<W.length;$++)j=W[$],!(H.indexOf(j)>=0)&&(U[j]=F[j]);return U}function f(F,H){var U=Object.keys(F);if(Object.getOwnPropertySymbols){var W=Object.getOwnPropertySymbols(F);H&&(W=W.filter(function(j){return Object.getOwnPropertyDescriptor(F,j).enumerable})),U.push.apply(U,W)}return U}function E(F){for(var H=1;H<arguments.length;H++){var U=arguments[H]!=null?arguments[H]:{};H%2?f(Object(U),!0).forEach(function(W){G(F,W,U[W])}):Object.getOwnPropertyDescriptors?Object.defineProperties(F,Object.getOwnPropertyDescriptors(U)):f(Object(U)).forEach(function(W){Object.defineProperty(F,W,Object.getOwnPropertyDescriptor(U,W))})}return F}function A(F,H){return B(F)||I(F,H)||O(F,H)||C()}function C(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function O(F,H){if(!!F){if(typeof F=="string")return D(F,H);var U=Object.prototype.toString.call(F).slice(8,-1);if(U==="Object"&&F.constructor&&(U=F.constructor.name),U==="Map"||U==="Set")return Array.from(F);if(U==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(U))return D(F,H)}}function D(F,H){(H==null||H>F.length)&&(H=F.length);for(var U=0,W=new Array(H);U<H;U++)W[U]=F[U];return W}function I(F,H){var U=F==null?null:typeof Symbol!="undefined"&&F[Symbol.iterator]||F["@@iterator"];if(U!=null){var W=[],j=!0,$=!1,ae,we;try{for(U=U.call(F);!(j=(ae=U.next()).done)&&(W.push(ae.value),!(H&&W.length===H));j=!0);}catch(me){$=!0,we=me}finally{try{!j&&U.return!=null&&U.return()}finally{if($)throw we}}return W}}function B(F){if(Array.isArray(F))return F}function Z(F,H){if(!(F instanceof H))throw new TypeError("Cannot call a class as a function")}function Y(F,H){for(var U=0;U<H.length;U++){var W=H[U];W.enumerable=W.enumerable||!1,W.configurable=!0,"value"in W&&(W.writable=!0),Object.defineProperty(F,W.key,W)}}function V(F,H,U){return H&&Y(F.prototype,H),U&&Y(F,U),Object.defineProperty(F,"prototype",{writable:!1}),F}function K(F,H){if(typeof H!="function"&&H!==null)throw new TypeError("Super expression must either be null or a function");F.prototype=Object.create(H&&H.prototype,{constructor:{value:F,writable:!0,configurable:!0}}),Object.defineProperty(F,"prototype",{writable:!1}),H&&Q(F,H)}function Q(F,H){return Q=Object.setPrototypeOf||function(W,j){return W.__proto__=j,W},Q(F,H)}function le(F){var H=de();return function(){var W=pe(F),j;if(H){var $=pe(this).constructor;j=Reflect.construct(W,arguments,$)}else j=W.apply(this,arguments);return re(this,j)}}function re(F,H){if(H&&(t(H)==="object"||typeof H=="function"))return H;if(H!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return se(F)}function se(F){if(F===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return F}function de(){if(typeof Reflect=="undefined"||!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 pe(F){return pe=Object.setPrototypeOf?Object.getPrototypeOf:function(U){return U.__proto__||Object.getPrototypeOf(U)},pe(F)}function G(F,H,U){return H in F?Object.defineProperty(F,H,{value:U,enumerable:!0,configurable:!0,writable:!0}):F[H]=U,F}var Me=function(F){K(U,F);var H=le(U);function U(W){var j;return Z(this,U),j=H.call(this,W),G(se(j),"onDragStart",function($,ae){(0,c.default)("Draggable: onDragStart: %j",ae);var we=j.props.onStart($,(0,a.createDraggableData)(se(j),ae));if(we===!1)return!1;j.setState({dragging:!0,dragged:!0})}),G(se(j),"onDrag",function($,ae){if(!j.state.dragging)return!1;(0,c.default)("Draggable: onDrag: %j",ae);var we=(0,a.createDraggableData)(se(j),ae),me={x:we.x,y:we.y};if(j.props.bounds){var Qe=me.x,$e=me.y;me.x+=j.state.slackX,me.y+=j.state.slackY;var et=(0,a.getBoundPosition)(se(j),me.x,me.y),p=A(et,2),_=p[0],R=p[1];me.x=_,me.y=R,me.slackX=j.state.slackX+(Qe-me.x),me.slackY=j.state.slackY+($e-me.y),we.x=me.x,we.y=me.y,we.deltaX=me.x-j.state.x,we.deltaY=me.y-j.state.y}var N=j.props.onDrag($,we);if(N===!1)return!1;j.setState(me)}),G(se(j),"onDragStop",function($,ae){if(!j.state.dragging)return!1;var we=j.props.onStop($,(0,a.createDraggableData)(se(j),ae));if(we===!1)return!1;(0,c.default)("Draggable: onDragStop: %j",ae);var me={dragging:!1,slackX:0,slackY:0},Qe=Boolean(j.props.position);if(Qe){var $e=j.props.position,et=$e.x,p=$e.y;me.x=et,me.y=p}j.setState(me)}),j.state={dragging:!1,dragged:!1,x:W.position?W.position.x:W.defaultPosition.x,y:W.position?W.position.y:W.defaultPosition.y,prevPropsPosition:E({},W.position),slackX:0,slackY:0,isElementSVG:!1},W.position&&!(W.onDrag||W.onStop)&&console.warn("A `position` was applied to this <Draggable>, without drag handlers. This will make this component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the `position` of this element."),j}return V(U,[{key:"componentDidMount",value:function(){typeof window.SVGElement!="undefined"&&this.findDOMNode()instanceof window.SVGElement&&this.setState({isElementSVG:!0})}},{key:"componentWillUnmount",value:function(){this.setState({dragging:!1})}},{key:"findDOMNode",value:function(){var j,$,ae;return(j=($=this.props)===null||$===void 0||(ae=$.nodeRef)===null||ae===void 0?void 0:ae.current)!==null&&j!==void 0?j:r.default.findDOMNode(this)}},{key:"render",value:function(){var j,$=this.props;$.axis,$.bounds;var ae=$.children,we=$.defaultPosition,me=$.defaultClassName,Qe=$.defaultClassNameDragging,$e=$.defaultClassNameDragged,et=$.position,p=$.positionOffset;$.scale;var _=b($,h),R={},N=null,L=Boolean(et),J=!L||this.state.dragging,q=et||we,fe={x:(0,a.canDragX)(this)&&J?this.state.x:q.x,y:(0,a.canDragY)(this)&&J?this.state.y:q.y};this.state.isElementSVG?N=(0,s.createSVGTransform)(fe,p):R=(0,s.createCSSTransform)(fe,p);var Se=(0,o.default)(ae.props.className||"",me,(j={},G(j,Qe,this.state.dragging),G(j,$e,this.state.dragged),j));return e.createElement(u.default,x({},_,{onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop}),e.cloneElement(e.Children.only(ae),{className:Se,style:E(E({},ae.props.style),R),transform:N}))}}],[{key:"getDerivedStateFromProps",value:function(j,$){var ae=j.position,we=$.prevPropsPosition;return ae&&(!we||ae.x!==we.x||ae.y!==we.y)?((0,c.default)("Draggable: getDerivedStateFromProps %j",{position:ae,prevPropsPosition:we}),{x:ae.x,y:ae.y,prevPropsPosition:E({},ae)}):null}}]),U}(e.Component);i.default=Me,G(Me,"displayName","Draggable"),G(Me,"propTypes",E(E({},u.default.propTypes),{},{axis:n.default.oneOf(["both","x","y","none"]),bounds:n.default.oneOfType([n.default.shape({left:n.default.number,right:n.default.number,top:n.default.number,bottom:n.default.number}),n.default.string,n.default.oneOf([!1])]),defaultClassName:n.default.string,defaultClassNameDragging:n.default.string,defaultClassNameDragged:n.default.string,defaultPosition:n.default.shape({x:n.default.number,y:n.default.number}),positionOffset:n.default.shape({x:n.default.oneOfType([n.default.number,n.default.string]),y:n.default.oneOfType([n.default.number,n.default.string])}),position:n.default.shape({x:n.default.number,y:n.default.number}),className:l.dontSetMe,style:l.dontSetMe,transform:l.dontSetMe})),G(Me,"defaultProps",E(E({},u.default.defaultProps),{},{axis:"both",bounds:!1,defaultClassName:"react-draggable",defaultClassNameDragging:"react-draggable-dragging",defaultClassNameDragged:"react-draggable-dragged",defaultPosition:{x:0,y:0},scale:1}))}(fa);var Ma=fa,Fa=Ma.default,Ef=Ma.DraggableCore;$n.exports=Fa,$n.exports.default=Fa,$n.exports.DraggableCore=Ef;var xf=$n.exports,_f=["second","minute","hour","day","week","month","year"];function Tf(i,t){if(t===0)return["just now","right now"];var e=_f[Math.floor(t/2)];return i>1&&(e+="s"),[i+" "+e+" ago","in "+i+" "+e]}var Cf=["\u79D2","\u5206\u949F","\u5C0F\u65F6","\u5929","\u5468","\u4E2A\u6708","\u5E74"];function Pf(i,t){if(t===0)return["\u521A\u521A","\u7247\u523B\u540E"];var e=Cf[~~(t/2)];return[i+" "+e+"\u524D",i+" "+e+"\u540E"]}var Fr={},_e=function(i,t){Fr[i]=t},ka=function(i){return Fr[i]||Fr.en_US},Bt=[60,60,24,7,365/7/12,12];function La(i){return i instanceof Date?i:!isNaN(i)||/^\d+$/.test(i)?new Date(parseInt(i)):(i=(i||"").trim().replace(/\.\d+/,"").replace(/-/,"/").replace(/-/,"/").replace(/(\d)T(\d)/,"$1 $2").replace(/Z/," UTC").replace(/([+-]\d\d):?(\d\d)/," $1$2"),new Date(i))}function Ba(i,t){var e=i<0?1:0;i=Math.abs(i);for(var n=i,r=0;i>=Bt[r]&&r<Bt.length;r++)i/=Bt[r];return i=Math.floor(i),r*=2,i>(r===0?9:1)&&(r+=1),t(i,r,n)[e].replace("%s",i.toString())}function Ia(i,t){var e=t?La(t):new Date;return(+e-+La(i))/1e3}function Af(i){for(var t=1,e=0,n=Math.abs(i);i>=Bt[e]&&e<Bt.length;e++)i/=Bt[e],t*=Bt[e];return n=n%t,n=n?t-n:t,Math.ceil(n)}var Of=function(i,t,e){var n=Ia(i,e&&e.relativeDate);return Ba(n,ka(t))},Na="timeago-id";function Df(i){return i.getAttribute("datetime")}function Rf(i,t){i.setAttribute(Na,t)}function Ha(i){return parseInt(i.getAttribute(Na))}var kr={},Lr=function(i){clearTimeout(i),delete kr[i]};function za(i,t,e,n){Lr(Ha(i));var r=n.relativeDate,o=n.minInterval,s=Ia(t,r);i.innerText=Ba(s,e);var a=setTimeout(function(){za(i,t,e,n)},Math.min(Math.max(Af(s),o||1)*1e3,2147483647));kr[a]=0,Rf(i,a)}function Va(i){i?Lr(Ha(i)):Object.keys(kr).forEach(Lr)}function Mf(i,t,e){var n=i.length?i:[i];return n.forEach(function(r){za(r,Df(r),ka(t),e||{})}),n}_e("en_US",Tf),_e("zh_CN",Pf);var Ff=globalThis&&globalThis.__extends||function(){var i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var o in r)r.hasOwnProperty(o)&&(n[o]=r[o])},i(t,e)};return function(t,e){i(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),Br=globalThis&&globalThis.__assign||function(){return Br=Object.assign||function(i){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(i[r]=t[r])}return i},Br.apply(this,arguments)},kf=globalThis&&globalThis.__rest||function(i,t){var e={};for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&t.indexOf(n)<0&&(e[n]=i[n]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,n=Object.getOwnPropertySymbols(i);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(i,n[r])&&(e[n[r]]=i[n[r]]);return e},Lf=function(i){return""+(i instanceof Date?i.getTime():i)},Bf=function(i){Ff(t,i);function t(){var e=i!==null&&i.apply(this,arguments)||this;return e.dom=null,e}return t.prototype.componentDidMount=function(){this.renderTimeAgo()},t.prototype.componentDidUpdate=function(){this.renderTimeAgo()},t.prototype.renderTimeAgo=function(){var e=this.props,n=e.live,r=e.datetime,o=e.locale,s=e.opts;Va(this.dom),n!==!1&&(this.dom.setAttribute("datetime",Lf(r)),Mf(this.dom,o,s))},t.prototype.componentWillUnmount=function(){Va(this.dom)},t.prototype.render=function(){var e=this,n=this.props,r=n.datetime;n.live;var o=n.locale,s=n.opts,a=kf(n,["datetime","live","locale","opts"]);return Oe("time",Br({ref:function(l){e.dom=l}},a),Of(r,o,s))},t.defaultProps={live:!0,className:""},t}(xn);function If(i,t){const e=n=>{i.current&&!i.current.contains(event.target)&&t()};kt(()=>(document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)))}var Ua=Object.prototype.toString,Wa=function(t){var e=Ua.call(t),n=e==="[object Arguments]";return n||(n=e!=="[object Array]"&&t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&Ua.call(t.callee)==="[object Function]"),n},ja;if(!Object.keys){var si=Object.prototype.hasOwnProperty,Ga=Object.prototype.toString,Nf=Wa,qa=Object.prototype.propertyIsEnumerable,Hf=!qa.call({toString:null},"toString"),zf=qa.call(function(){},"prototype"),ai=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],Ir=function(i){var t=i.constructor;return t&&t.prototype===i},Vf={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},Uf=function(){if(typeof window=="undefined")return!1;for(var i in window)try{if(!Vf["$"+i]&&si.call(window,i)&&window[i]!==null&&typeof window[i]=="object")try{Ir(window[i])}catch{return!0}}catch{return!0}return!1}(),Wf=function(i){if(typeof window=="undefined"||!Uf)return Ir(i);try{return Ir(i)}catch{return!1}};ja=function(t){var e=t!==null&&typeof t=="object",n=Ga.call(t)==="[object Function]",r=Nf(t),o=e&&Ga.call(t)==="[object String]",s=[];if(!e&&!n&&!r)throw new TypeError("Object.keys called on a non-object");var a=zf&&n;if(o&&t.length>0&&!si.call(t,0))for(var l=0;l<t.length;++l)s.push(String(l));if(r&&t.length>0)for(var u=0;u<t.length;++u)s.push(String(u));else for(var c in t)!(a&&c==="prototype")&&si.call(t,c)&&s.push(String(c));if(Hf)for(var h=Wf(t),d=0;d<ai.length;++d)!(h&&ai[d]==="constructor")&&si.call(t,ai[d])&&s.push(ai[d]);return s}}var jf=ja,Gf=Array.prototype.slice,qf=Wa,Xa=Object.keys,li=Xa?function(t){return Xa(t)}:jf,Ya=Object.keys;li.shim=function(){if(Object.keys){var t=function(){var e=Object.keys(arguments);return e&&e.length===arguments.length}(1,2);t||(Object.keys=function(n){return qf(n)?Ya(Gf.call(n)):Ya(n)})}else Object.keys=li;return Object.keys||li};var Xf=li,Za=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},e=Symbol("test"),n=Object(e);if(typeof e=="string"||Object.prototype.toString.call(e)!=="[object Symbol]"||Object.prototype.toString.call(n)!=="[object Symbol]")return!1;var r=42;t[e]=r;for(e in t)return!1;if(typeof Object.keys=="function"&&Object.keys(t).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(t).length!==0)return!1;var o=Object.getOwnPropertySymbols(t);if(o.length!==1||o[0]!==e||!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var s=Object.getOwnPropertyDescriptor(t,e);if(s.value!==r||s.enumerable!==!0)return!1}return!0},Ka=typeof Symbol!="undefined"&&Symbol,Yf=Za,Ja=function(){return typeof Ka!="function"||typeof Symbol!="function"||typeof Ka("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:Yf()},Qa={foo:{}},Zf=Object,Kf=function(){return{__proto__:Qa}.foo===Qa.foo&&!({__proto__:null}instanceof Zf)},Jf="Function.prototype.bind called on incompatible ",Nr=Array.prototype.slice,Qf=Object.prototype.toString,$f="[object Function]",ep=function(t){var e=this;if(typeof e!="function"||Qf.call(e)!==$f)throw new TypeError(Jf+e);for(var n=Nr.call(arguments,1),r,o=function(){if(this instanceof r){var c=e.apply(this,n.concat(Nr.call(arguments)));return Object(c)===c?c:this}else return e.apply(t,n.concat(Nr.call(arguments)))},s=Math.max(0,e.length-n.length),a=[],l=0;l<s;l++)a.push("$"+l);if(r=Function("binder","return function ("+a.join(",")+"){ return binder.apply(this,arguments); }")(o),e.prototype){var u=function(){};u.prototype=e.prototype,r.prototype=new u,u.prototype=null}return r},tp=ep,Hr=Function.prototype.bind||tp,np=Hr,$a=np.call(Function.call,Object.prototype.hasOwnProperty),ue,Kt=SyntaxError,el=Function,Jt=TypeError,zr=function(i){try{return el('"use strict"; return ('+i+").constructor;")()}catch{}},It=Object.getOwnPropertyDescriptor;if(It)try{It({},"")}catch{It=null}var Vr=function(){throw new Jt},ip=It?function(){try{return arguments.callee,Vr}catch{try{return It(arguments,"callee").get}catch{return Vr}}}():Vr,Qt=Ja(),rp=Kf(),De=Object.getPrototypeOf||(rp?function(i){return i.__proto__}:null),$t={},op=typeof Uint8Array=="undefined"||!De?ue:De(Uint8Array),Nt={"%AggregateError%":typeof AggregateError=="undefined"?ue:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer=="undefined"?ue:ArrayBuffer,"%ArrayIteratorPrototype%":Qt&&De?De([][Symbol.iterator]()):ue,"%AsyncFromSyncIteratorPrototype%":ue,"%AsyncFunction%":$t,"%AsyncGenerator%":$t,"%AsyncGeneratorFunction%":$t,"%AsyncIteratorPrototype%":$t,"%Atomics%":typeof Atomics=="undefined"?ue:Atomics,"%BigInt%":typeof BigInt=="undefined"?ue:BigInt,"%BigInt64Array%":typeof BigInt64Array=="undefined"?ue:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array=="undefined"?ue:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView=="undefined"?ue:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array=="undefined"?ue:Float32Array,"%Float64Array%":typeof Float64Array=="undefined"?ue:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry=="undefined"?ue:FinalizationRegistry,"%Function%":el,"%GeneratorFunction%":$t,"%Int8Array%":typeof Int8Array=="undefined"?ue:Int8Array,"%Int16Array%":typeof Int16Array=="undefined"?ue:Int16Array,"%Int32Array%":typeof Int32Array=="undefined"?ue:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Qt&&De?De(De([][Symbol.iterator]())):ue,"%JSON%":typeof JSON=="object"?JSON:ue,"%Map%":typeof Map=="undefined"?ue:Map,"%MapIteratorPrototype%":typeof Map=="undefined"||!Qt||!De?ue:De(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise=="undefined"?ue:Promise,"%Proxy%":typeof Proxy=="undefined"?ue:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect=="undefined"?ue:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set=="undefined"?ue:Set,"%SetIteratorPrototype%":typeof Set=="undefined"||!Qt||!De?ue:De(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer=="undefined"?ue:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Qt&&De?De(""[Symbol.iterator]()):ue,"%Symbol%":Qt?Symbol:ue,"%SyntaxError%":Kt,"%ThrowTypeError%":ip,"%TypedArray%":op,"%TypeError%":Jt,"%Uint8Array%":typeof Uint8Array=="undefined"?ue:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray=="undefined"?ue:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array=="undefined"?ue:Uint16Array,"%Uint32Array%":typeof Uint32Array=="undefined"?ue:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap=="undefined"?ue:WeakMap,"%WeakRef%":typeof WeakRef=="undefined"?ue:WeakRef,"%WeakSet%":typeof WeakSet=="undefined"?ue:WeakSet};if(De)try{null.error}catch(i){var sp=De(De(i));Nt["%Error.prototype%"]=sp}var ap=function i(t){var e;if(t==="%AsyncFunction%")e=zr("async function () {}");else if(t==="%GeneratorFunction%")e=zr("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=zr("async function* () {}");else if(t==="%AsyncGenerator%"){var n=i("%AsyncGeneratorFunction%");n&&(e=n.prototype)}else if(t==="%AsyncIteratorPrototype%"){var r=i("%AsyncGenerator%");r&&De&&(e=De(r.prototype))}return Nt[t]=e,e},tl={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},Pn=Hr,ui=$a,lp=Pn.call(Function.call,Array.prototype.concat),up=Pn.call(Function.apply,Array.prototype.splice),nl=Pn.call(Function.call,String.prototype.replace),ci=Pn.call(Function.call,String.prototype.slice),cp=Pn.call(Function.call,RegExp.prototype.exec),hp=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,dp=/\\(\\)?/g,fp=function(t){var e=ci(t,0,1),n=ci(t,-1);if(e==="%"&&n!=="%")throw new Kt("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&e!=="%")throw new Kt("invalid intrinsic syntax, expected opening `%`");var r=[];return nl(t,hp,function(o,s,a,l){r[r.length]=a?nl(l,dp,"$1"):s||o}),r},pp=function(t,e){var n=t,r;if(ui(tl,n)&&(r=tl[n],n="%"+r[0]+"%"),ui(Nt,n)){var o=Nt[n];if(o===$t&&(o=ap(n)),typeof o=="undefined"&&!e)throw new Jt("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:r,name:n,value:o}}throw new Kt("intrinsic "+t+" does not exist!")},Be=function(t,e){if(typeof t!="string"||t.length===0)throw new Jt("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new Jt('"allowMissing" argument must be a boolean');if(cp(/^%?[^%]*%?$/,t)===null)throw new Kt("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=fp(t),r=n.length>0?n[0]:"",o=pp("%"+r+"%",e),s=o.name,a=o.value,l=!1,u=o.alias;u&&(r=u[0],up(n,lp([0,1],u)));for(var c=1,h=!0;c<n.length;c+=1){var d=n[c],g=ci(d,0,1),y=ci(d,-1);if((g==='"'||g==="'"||g==="`"||y==='"'||y==="'"||y==="`")&&g!==y)throw new Kt("property names with quotes must have matching quotes");if((d==="constructor"||!h)&&(l=!0),r+="."+d,s="%"+r+"%",ui(Nt,s))a=Nt[s];else if(a!=null){if(!(d in a)){if(!e)throw new Jt("base intrinsic for "+t+" exists, but the property is not available.");return}if(It&&c+1>=n.length){var x=It(a,d);h=!!x,h&&"get"in x&&!("originalValue"in x.get)?a=x.get:a=a[d]}else h=ui(a,d),a=a[d];h&&!l&&(Nt[s]=a)}}return a},mp=Be,Ur=mp("%Object.defineProperty%",!0),Wr=function(){if(Ur)try{return Ur({},"a",{value:1}),!0}catch{return!1}return!1};Wr.hasArrayLengthDefineBug=function(){if(!Wr())return null;try{return Ur([],"length",{value:1}).length!==1}catch{return!0}};var gp=Wr,vp=Xf,yp=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",wp=Object.prototype.toString,bp=Array.prototype.concat,il=Object.defineProperty,Sp=function(i){return typeof i=="function"&&wp.call(i)==="[object Function]"},Ep=gp(),rl=il&&Ep,xp=function(i,t,e,n){if(t in i){if(n===!0){if(i[t]===e)return}else if(!Sp(n)||!n())return}rl?il(i,t,{configurable:!0,enumerable:!1,value:e,writable:!0}):i[t]=e},ol=function(i,t){var e=arguments.length>2?arguments[2]:{},n=vp(t);yp&&(n=bp.call(n,Object.getOwnPropertySymbols(t)));for(var r=0;r<n.length;r+=1)xp(i,n[r],t[n[r]],e[n[r]])};ol.supportsDescriptors=!!rl;var en=ol,An={exports:{}};(function(i){var t=Hr,e=Be,n=e("%Function.prototype.apply%"),r=e("%Function.prototype.call%"),o=e("%Reflect.apply%",!0)||t.call(r,n),s=e("%Object.getOwnPropertyDescriptor%",!0),a=e("%Object.defineProperty%",!0),l=e("%Math.max%");if(a)try{a({},"a",{value:1})}catch{a=null}i.exports=function(h){var d=o(t,r,arguments);if(s&&a){var g=s(d,"length");g.configurable&&a(d,"length",{value:1+l(0,h.length-(arguments.length-1))})}return d};var u=function(){return o(t,n,arguments)};a?a(i.exports,"apply",{value:u}):i.exports.apply=u})(An);var sl=Be,al=An.exports,_p=al(sl("String.prototype.indexOf")),vt=function(t,e){var n=sl(t,!!e);return typeof n=="function"&&_p(t,".prototype.")>-1?al(n):n},Tp=Be,Cp=Tp("%TypeError%"),Pp=function(t,e){if(t==null)throw new Cp(e||"Cannot call method on "+t);return t},On=Pp,Ap=Be,ll=Ap("%Array%"),Op=!ll.isArray&&vt("Object.prototype.toString"),Dp=ll.isArray||function(t){return Op(t)==="[object Array]"},Rp=Dp,ul=Be,Mp=vt,Fp=ul("%TypeError%"),kp=Rp,Lp=ul("%Reflect.apply%",!0)||Mp("Function.prototype.apply"),Bp=function(t,e){var n=arguments.length>2?arguments[2]:[];if(!kp(n))throw new Fp("Assertion failed: optional `argumentsList`, if provided, must be a List");return Lp(t,e,n)},Ip={},Np=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",default:Ip}),Hp=Er(Np),jr=typeof Map=="function"&&Map.prototype,Gr=Object.getOwnPropertyDescriptor&&jr?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,hi=jr&&Gr&&typeof Gr.get=="function"?Gr.get:null,cl=jr&&Map.prototype.forEach,qr=typeof Set=="function"&&Set.prototype,Xr=Object.getOwnPropertyDescriptor&&qr?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,di=qr&&Xr&&typeof Xr.get=="function"?Xr.get:null,hl=qr&&Set.prototype.forEach,zp=typeof WeakMap=="function"&&WeakMap.prototype,Dn=zp?WeakMap.prototype.has:null,Vp=typeof WeakSet=="function"&&WeakSet.prototype,Rn=Vp?WeakSet.prototype.has:null,Up=typeof WeakRef=="function"&&WeakRef.prototype,dl=Up?WeakRef.prototype.deref:null,Wp=Boolean.prototype.valueOf,jp=Object.prototype.toString,Gp=Function.prototype.toString,qp=String.prototype.match,Yr=String.prototype.slice,Pt=String.prototype.replace,Xp=String.prototype.toUpperCase,fl=String.prototype.toLowerCase,pl=RegExp.prototype.test,ml=Array.prototype.concat,ut=Array.prototype.join,Yp=Array.prototype.slice,gl=Math.floor,Zr=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Kr=Object.getOwnPropertySymbols,Jr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,tn=typeof Symbol=="function"&&typeof Symbol.iterator=="object",We=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===tn?"object":"symbol")?Symbol.toStringTag:null,vl=Object.prototype.propertyIsEnumerable,yl=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(i){return i.__proto__}:null);function wl(i,t){if(i===1/0||i===-1/0||i!==i||i&&i>-1e3&&i<1e3||pl.call(/e/,t))return t;var e=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof i=="number"){var n=i<0?-gl(-i):gl(i);if(n!==i){var r=String(n),o=Yr.call(t,r.length+1);return Pt.call(r,e,"$&_")+"."+Pt.call(Pt.call(o,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Pt.call(t,e,"$&_")}var Qr=Hp,bl=Qr.custom,Sl=_l(bl)?bl:null,Zp=function i(t,e,n,r){var o=e||{};if(At(o,"quoteStyle")&&o.quoteStyle!=="single"&&o.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(At(o,"maxStringLength")&&(typeof o.maxStringLength=="number"?o.maxStringLength<0&&o.maxStringLength!==1/0:o.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var s=At(o,"customInspect")?o.customInspect:!0;if(typeof s!="boolean"&&s!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(At(o,"indent")&&o.indent!==null&&o.indent!==" "&&!(parseInt(o.indent,10)===o.indent&&o.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(At(o,"numericSeparator")&&typeof o.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var a=o.numericSeparator;if(typeof t=="undefined")return"undefined";if(t===null)return"null";if(typeof t=="boolean")return t?"true":"false";if(typeof t=="string")return Cl(t,o);if(typeof t=="number"){if(t===0)return 1/0/t>0?"0":"-0";var l=String(t);return a?wl(t,l):l}if(typeof t=="bigint"){var u=String(t)+"n";return a?wl(t,u):u}var c=typeof o.depth=="undefined"?5:o.depth;if(typeof n=="undefined"&&(n=0),n>=c&&c>0&&typeof t=="object")return $r(t)?"[Array]":"[Object]";var h=fm(o,n);if(typeof r=="undefined")r=[];else if(Tl(r,t)>=0)return"[Circular]";function d(K,Q,le){if(Q&&(r=Yp.call(r),r.push(Q)),le){var re={depth:o.depth};return At(o,"quoteStyle")&&(re.quoteStyle=o.quoteStyle),i(K,re,n+1,r)}return i(K,o,n+1,r)}if(typeof t=="function"&&!xl(t)){var g=rm(t),y=fi(t,d);return"[Function"+(g?": "+g:" (anonymous)")+"]"+(y.length>0?" { "+ut.call(y,", ")+" }":"")}if(_l(t)){var x=tn?Pt.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):Jr.call(t);return typeof t=="object"&&!tn?Mn(x):x}if(cm(t)){for(var b="<"+fl.call(String(t.nodeName)),T=t.attributes||[],f=0;f<T.length;f++)b+=" "+T[f].name+"="+El(Kp(T[f].value),"double",o);return b+=">",t.childNodes&&t.childNodes.length&&(b+="..."),b+="</"+fl.call(String(t.nodeName))+">",b}if($r(t)){if(t.length===0)return"[]";var E=fi(t,d);return h&&!dm(E)?"["+to(E,h)+"]":"[ "+ut.call(E,", ")+" ]"}if(Qp(t)){var A=fi(t,d);return!("cause"in Error.prototype)&&"cause"in t&&!vl.call(t,"cause")?"{ ["+String(t)+"] "+ut.call(ml.call("[cause]: "+d(t.cause),A),", ")+" }":A.length===0?"["+String(t)+"]":"{ ["+String(t)+"] "+ut.call(A,", ")+" }"}if(typeof t=="object"&&s){if(Sl&&typeof t[Sl]=="function"&&Qr)return Qr(t,{depth:c-n});if(s!=="symbol"&&typeof t.inspect=="function")return t.inspect()}if(om(t)){var C=[];return cl&&cl.call(t,function(K,Q){C.push(d(Q,t,!0)+" => "+d(K,t))}),Pl("Map",hi.call(t),C,h)}if(lm(t)){var O=[];return hl&&hl.call(t,function(K){O.push(d(K,t))}),Pl("Set",di.call(t),O,h)}if(sm(t))return eo("WeakMap");if(um(t))return eo("WeakSet");if(am(t))return eo("WeakRef");if(em(t))return Mn(d(Number(t)));if(nm(t))return Mn(d(Zr.call(t)));if(tm(t))return Mn(Wp.call(t));if($p(t))return Mn(d(String(t)));if(!Jp(t)&&!xl(t)){var D=fi(t,d),I=yl?yl(t)===Object.prototype:t instanceof Object||t.constructor===Object,B=t instanceof Object?"":"null prototype",Z=!I&&We&&Object(t)===t&&We in t?Yr.call(Ot(t),8,-1):B?"Object":"",Y=I||typeof t.constructor!="function"?"":t.constructor.name?t.constructor.name+" ":"",V=Y+(Z||B?"["+ut.call(ml.call([],Z||[],B||[]),": ")+"] ":"");return D.length===0?V+"{}":h?V+"{"+to(D,h)+"}":V+"{ "+ut.call(D,", ")+" }"}return String(t)};function El(i,t,e){var n=(e.quoteStyle||t)==="double"?'"':"'";return n+i+n}function Kp(i){return Pt.call(String(i),/"/g,"&quot;")}function $r(i){return Ot(i)==="[object Array]"&&(!We||!(typeof i=="object"&&We in i))}function Jp(i){return Ot(i)==="[object Date]"&&(!We||!(typeof i=="object"&&We in i))}function xl(i){return Ot(i)==="[object RegExp]"&&(!We||!(typeof i=="object"&&We in i))}function Qp(i){return Ot(i)==="[object Error]"&&(!We||!(typeof i=="object"&&We in i))}function $p(i){return Ot(i)==="[object String]"&&(!We||!(typeof i=="object"&&We in i))}function em(i){return Ot(i)==="[object Number]"&&(!We||!(typeof i=="object"&&We in i))}function tm(i){return Ot(i)==="[object Boolean]"&&(!We||!(typeof i=="object"&&We in i))}function _l(i){if(tn)return i&&typeof i=="object"&&i instanceof Symbol;if(typeof i=="symbol")return!0;if(!i||typeof i!="object"||!Jr)return!1;try{return Jr.call(i),!0}catch{}return!1}function nm(i){if(!i||typeof i!="object"||!Zr)return!1;try{return Zr.call(i),!0}catch{}return!1}var im=Object.prototype.hasOwnProperty||function(i){return i in this};function At(i,t){return im.call(i,t)}function Ot(i){return jp.call(i)}function rm(i){if(i.name)return i.name;var t=qp.call(Gp.call(i),/^function\s*([\w$]+)/);return t?t[1]:null}function Tl(i,t){if(i.indexOf)return i.indexOf(t);for(var e=0,n=i.length;e<n;e++)if(i[e]===t)return e;return-1}function om(i){if(!hi||!i||typeof i!="object")return!1;try{hi.call(i);try{di.call(i)}catch{return!0}return i instanceof Map}catch{}return!1}function sm(i){if(!Dn||!i||typeof i!="object")return!1;try{Dn.call(i,Dn);try{Rn.call(i,Rn)}catch{return!0}return i instanceof WeakMap}catch{}return!1}function am(i){if(!dl||!i||typeof i!="object")return!1;try{return dl.call(i),!0}catch{}return!1}function lm(i){if(!di||!i||typeof i!="object")return!1;try{di.call(i);try{hi.call(i)}catch{return!0}return i instanceof Set}catch{}return!1}function um(i){if(!Rn||!i||typeof i!="object")return!1;try{Rn.call(i,Rn);try{Dn.call(i,Dn)}catch{return!0}return i instanceof WeakSet}catch{}return!1}function cm(i){return!i||typeof i!="object"?!1:typeof HTMLElement!="undefined"&&i instanceof HTMLElement?!0:typeof i.nodeName=="string"&&typeof i.getAttribute=="function"}function Cl(i,t){if(i.length>t.maxStringLength){var e=i.length-t.maxStringLength,n="... "+e+" more character"+(e>1?"s":"");return Cl(Yr.call(i,0,t.maxStringLength),t)+n}var r=Pt.call(Pt.call(i,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,hm);return El(r,"single",t)}function hm(i){var t=i.charCodeAt(0),e={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return e?"\\"+e:"\\x"+(t<16?"0":"")+Xp.call(t.toString(16))}function Mn(i){return"Object("+i+")"}function eo(i){return i+" { ? }"}function Pl(i,t,e,n){var r=n?to(e,n):ut.call(e,", ");return i+" ("+t+") {"+r+"}"}function dm(i){for(var t=0;t<i.length;t++)if(Tl(i[t],`
`)>=0)return!1;return!0}function fm(i,t){var e;if(i.indent===" ")e=" ";else if(typeof i.indent=="number"&&i.indent>0)e=ut.call(Array(i.indent+1)," ");else return null;return{base:e,prev:ut.call(Array(t+1),e)}}function to(i,t){if(i.length===0)return"";var e=`
`+t.prev+t.base;return e+ut.call(i,","+e)+`
`+t.prev}function fi(i,t){var e=$r(i),n=[];if(e){n.length=i.length;for(var r=0;r<i.length;r++)n[r]=At(i,r)?t(i[r],i):""}var o=typeof Kr=="function"?Kr(i):[],s;if(tn){s={};for(var a=0;a<o.length;a++)s["$"+o[a]]=o[a]}for(var l in i)!At(i,l)||e&&String(Number(l))===l&&l<i.length||tn&&s["$"+l]instanceof Symbol||(pl.call(/[^\w$]/,l)?n.push(t(l,i)+": "+t(i[l],i)):n.push(l+": "+t(i[l],i)));if(typeof Kr=="function")for(var u=0;u<o.length;u++)vl.call(i,o[u])&&n.push("["+t(o[u])+"]: "+t(i[o[u]],i));return n}var Al=function(t){return typeof t=="string"||typeof t=="symbol"},pm=function(t){if(t===null)return"Null";if(typeof t=="undefined")return"Undefined";if(typeof t=="function"||typeof t=="object")return"Object";if(typeof t=="number")return"Number";if(typeof t=="boolean")return"Boolean";if(typeof t=="string")return"String"},mm=pm,Fn=function(t){return typeof t=="symbol"?"Symbol":typeof t=="bigint"?"BigInt":mm(t)},gm=Be,Ol=gm("%TypeError%"),vm=Zp,ym=Al,wm=Fn,Dl=function(t,e){if(wm(t)!=="Object")throw new Ol("Assertion failed: Type(O) is not Object");if(!ym(e))throw new Ol("Assertion failed: IsPropertyKey(P) is not true, got "+vm(e));return t[e]},bm=Be,Rl=bm("%TypeError%"),Sm=Al,Em=Fn,xm=function(t,e){if(Em(t)!=="Object")throw new Rl("Assertion failed: `O` must be an Object");if(!Sm(e))throw new Rl("Assertion failed: `P` must be a Property Key");return e in t},Ml=Function.prototype.toString,nn=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,no,pi;if(typeof nn=="function"&&typeof Object.defineProperty=="function")try{no=Object.defineProperty({},"length",{get:function(){throw pi}}),pi={},nn(function(){throw 42},null,no)}catch(i){i!==pi&&(nn=null)}else nn=null;var _m=/^\s*class\b/,io=function(t){try{var e=Ml.call(t);return _m.test(e)}catch{return!1}},ro=function(t){try{return io(t)?!1:(Ml.call(t),!0)}catch{return!1}},mi=Object.prototype.toString,Tm="[object Object]",Cm="[object Function]",Pm="[object GeneratorFunction]",Am="[object HTMLAllCollection]",Om="[object HTML document.all class]",Dm="[object HTMLCollection]",Rm=typeof Symbol=="function"&&!!Symbol.toStringTag,Mm=!(0 in[,]),oo=function(){return!1};if(typeof document=="object"){var Fm=document.all;mi.call(Fm)===mi.call(document.all)&&(oo=function(t){if((Mm||!t)&&(typeof t=="undefined"||typeof t=="object"))try{var e=mi.call(t);return(e===Am||e===Om||e===Dm||e===Tm)&&t("")==null}catch{}return!1})}var Fl=nn?function(t){if(oo(t))return!0;if(!t||typeof t!="function"&&typeof t!="object")return!1;try{nn(t,null,no)}catch(e){if(e!==pi)return!1}return!io(t)&&ro(t)}:function(t){if(oo(t))return!0;if(!t||typeof t!="function"&&typeof t!="object")return!1;if(Rm)return ro(t);if(io(t))return!1;var e=mi.call(t);return e!==Cm&&e!==Pm&&!/^\[object HTML/.test(e)?!1:ro(t)},km=Fl,kl=Be,Lm=kl("%Math%"),Bm=kl("%Number%"),Im=Bm.MAX_SAFE_INTEGER||Lm.pow(2,53)-1,Nm=Be,Hm=Nm("%Math.abs%"),zm=function(t){return Hm(t)},Vm=Fn,Um=Math.floor,Wm=function(t){return Vm(t)==="BigInt"?t:Um(t)},jm=function(t){return t===null||typeof t!="function"&&typeof t!="object"},Gm=function(t){return t===null||typeof t!="function"&&typeof t!="object"},qm=Za,so=function(){return qm()&&!!Symbol.toStringTag},Xm=Date.prototype.getDay,Ym=function(t){try{return Xm.call(t),!0}catch{return!1}},Zm=Object.prototype.toString,Km="[object Date]",Jm=so(),Qm=function(t){return typeof t!="object"||t===null?!1:Jm?Ym(t):Zm.call(t)===Km},ao={exports:{}},$m=Object.prototype.toString,eg=Ja();if(eg){var tg=Symbol.prototype.toString,ng=/^Symbol\(.*\)$/,ig=function(t){return typeof t.valueOf()!="symbol"?!1:ng.test(tg.call(t))};ao.exports=function(t){if(typeof t=="symbol")return!0;if($m.call(t)!=="[object Symbol]")return!1;try{return ig(t)}catch{return!1}}}else ao.exports=function(t){return!1};var rg=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol",lo=Gm,Ll=Fl,og=Qm,Bl=ao.exports,sg=function(t,e){if(typeof t=="undefined"||t===null)throw new TypeError("Cannot call method on "+t);if(typeof e!="string"||e!=="number"&&e!=="string")throw new TypeError('hint must be "string" or "number"');var n=e==="string"?["toString","valueOf"]:["valueOf","toString"],r,o,s;for(s=0;s<n.length;++s)if(r=t[n[s]],Ll(r)&&(o=r.call(t),lo(o)))return o;throw new TypeError("No default value")},ag=function(t,e){var n=t[e];if(n!==null&&typeof n!="undefined"){if(!Ll(n))throw new TypeError(n+" returned for property "+e+" of object "+t+" is not a function");return n}},lg=function(t){if(lo(t))return t;var e="default";arguments.length>1&&(arguments[1]===String?e="string":arguments[1]===Number&&(e="number"));var n;if(rg&&(Symbol.toPrimitive?n=ag(t,Symbol.toPrimitive):Bl(t)&&(n=Symbol.prototype.valueOf)),typeof n!="undefined"){var r=n.call(t,e);if(lo(r))return r;throw new TypeError("unable to convert exotic object to primitive")}return e==="default"&&(og(t)||Bl(t))&&(e="string"),sg(t,e==="default"?"number":e)},Il=lg,ug=function(t){return arguments.length>1?Il(t,arguments[1]):Il(t)},uo=vt,Nl=so(),Hl,zl,co,ho;if(Nl){Hl=uo("Object.prototype.hasOwnProperty"),zl=uo("RegExp.prototype.exec"),co={};var fo=function(){throw co};ho={toString:fo,valueOf:fo},typeof Symbol.toPrimitive=="symbol"&&(ho[Symbol.toPrimitive]=fo)}var cg=uo("Object.prototype.toString"),hg=Object.getOwnPropertyDescriptor,dg="[object RegExp]",fg=Nl?function(t){if(!t||typeof t!="object")return!1;var e=hg(t,"lastIndex"),n=e&&Hl(e,"value");if(!n)return!1;try{zl(t,ho)}catch(r){return r===co}}:function(t){return!t||typeof t!="object"&&typeof t!="function"?!1:cg(t)===dg},pg=vt,mg=Be,gg=fg,vg=pg("RegExp.prototype.exec"),yg=mg("%TypeError%"),wg=function(t){if(!gg(t))throw new yg("`regex` must be a RegExp");return function(n){return vg(t,n)!==null}},Vl=Be,bg=Vl("%String%"),Sg=Vl("%TypeError%"),Ul=function(t){if(typeof t=="symbol")throw new Sg("Cannot convert a Symbol value to a string");return bg(t)},Eg=On,xg=Ul,_g=vt,Wl=_g("String.prototype.replace"),jl=/^\s$/.test("\u180E"),Tg=jl?/^[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+/:/^[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+/,Cg=jl?/[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+$/:/[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+$/,Gl=function(){var t=xg(Eg(this));return Wl(Wl(t,Tg,""),Cg,"")},Pg=Gl,ql="\u200B",rn="\u180E",Xl=function(){return String.prototype.trim&&ql.trim()===ql&&rn.trim()===rn&&("_"+rn).trim()==="_"+rn&&(rn+"_").trim()===rn+"_"?String.prototype.trim:Pg},Ag=en,Og=Xl,Dg=function(){var t=Og();return Ag(String.prototype,{trim:t},{trim:function(){return String.prototype.trim!==t}}),t},Rg=An.exports,Mg=en,Fg=On,kg=Gl,Yl=Xl,Lg=Dg,Bg=Rg(Yl()),Zl=function(t){return Fg(t),Bg(t)};Mg(Zl,{getPolyfill:Yl,implementation:kg,shim:Lg});var Kl=Zl,gi=Be,po=gi("%Number%"),Ig=gi("%RegExp%"),Ng=gi("%TypeError%"),Jl=gi("%parseInt%"),Hg=vt,vi=wg,Ql=Hg("String.prototype.slice"),zg=vi(/^0b[01]+$/i),Vg=vi(/^0o[0-7]+$/i),Ug=vi(/^[-+]0x[0-9a-f]+$/i),Wg=["\x85","\u200B","\uFFFE"].join(""),jg=new Ig("["+Wg+"]","g"),Gg=vi(jg),qg=Kl,Xg=Fn,Yg=function i(t){if(Xg(t)!=="String")throw new Ng("Assertion failed: `argument` is not a String");if(zg(t))return po(Jl(Ql(t,2),2));if(Vg(t))return po(Jl(Ql(t,2),8));if(Gg(t)||Ug(t))return NaN;var e=qg(t);return e!==t?i(e):po(t)},$l=Be,eu=$l("%TypeError%"),tu=$l("%Number%"),Zg=jm,Kg=ug,Jg=Yg,Qg=function(t){var e=Zg(t)?t:Kg(t,tu);if(typeof e=="symbol")throw new eu("Cannot convert a Symbol value to a number");if(typeof e=="bigint")throw new eu("Conversion from 'BigInt' to 'number' is not allowed.");return typeof e=="string"?Jg(e):tu(e)},nu=Number.isNaN||function(t){return t!==t},$g=nu,ev=function(i){return(typeof i=="number"||typeof i=="bigint")&&!$g(i)&&i!==1/0&&i!==-1/0},tv=function(t){return t>=0?1:-1},nv=zm,iv=Wm,rv=Qg,ov=nu,sv=ev,av=tv,lv=function(t){var e=rv(t);if(ov(e)||e===0)return 0;if(!sv(e))return e;var n=iv(nv(e));return n===0?0:av(e)*n},iu=Im,uv=lv,cv=function(t){var e=uv(t);return e<=0?0:e>iu?iu:e},hv=Be,dv=hv("%TypeError%"),fv=Dl,pv=cv,mv=Fn,gv=function(t){if(mv(t)!=="Object")throw new dv("Assertion failed: `obj` must be an Object");return pv(fv(t,"length"))},vv=Be,yv=vv("%Object%"),wv=On,bv=function(t){return wv(t),yv(t)},Sv=String.prototype.valueOf,Ev=function(t){try{return Sv.call(t),!0}catch{return!1}},xv=Object.prototype.toString,_v="[object String]",Tv=so(),Cv=function(t){return typeof t=="string"?!0:typeof t!="object"?!1:Tv?Ev(t):xv.call(t)===_v},Pv=Be,Av=vt,Ov=Pv("%TypeError%"),Dv=Bp,Rv=Dl,Mv=xm,Fv=km,kv=gv,Lv=bv,Bv=Ul,Iv=Cv,Nv=Av("String.prototype.split"),ru=Object("a"),Hv=ru[0]!=="a"||!(0 in ru),ou=function(t){var e=Lv(this),n=Hv&&Iv(this)?Nv(this,""):e,r=kv(n);if(!Fv(t))throw new Ov("Array.prototype.forEach callback must be a function");var o;arguments.length>1&&(o=arguments[1]);for(var s=0;s<r;){var a=Bv(s),l=Mv(n,a);if(l){var u=Rv(n,a);Dv(t,o,[u,s,n])}s+=1}},zv=function(t){var e=!0,n=!0,r=!1;if(typeof t=="function"){try{t.call("f",function(o,s,a){typeof a!="object"&&(e=!1)}),t.call([null],function(){"use strict";n=typeof this=="string"},"x")}catch{r=!0}return!r&&e&&n}return!1},Vv=zv,Uv=ou,su=function(){var t=Array.prototype.forEach;return Vv(t)?t:Uv},Wv=en,jv=su,Gv=function(){var t=jv();return Wv(Array.prototype,{forEach:t},{forEach:function(){return Array.prototype.forEach!==t}}),t},qv=en,Xv=An.exports,Yv=vt,Zv=On,Kv=ou,au=su,Jv=au(),Qv=Gv,$v=Yv("Array.prototype.slice"),ey=Xv.apply(Jv),lu=function(t,e){return Zv(t),ey(t,$v(arguments,1))};qv(lu,{getPolyfill:au,implementation:Kv,shim:Qv});var ty=lu,ny=On,uu=vt,iy=uu("Object.prototype.propertyIsEnumerable"),ry=uu("Array.prototype.push"),cu=function(t){var e=ny(t),n=[];for(var r in e)iy(e,r)&&ry(n,[r,e[r]]);return n},oy=cu,hu=function(){return typeof Object.entries=="function"?Object.entries:oy},sy=hu,ay=en,ly=function(){var t=sy();return ay(Object,{entries:t},{entries:function(){return Object.entries!==t}}),t},uy=en,cy=An.exports,hy=cu,du=hu,dy=ly,fu=cy(du(),Object);uy(fu,{getPolyfill:du,implementation:hy,shim:dy});var fy=fu,yi=ty,mo=fy,pu=$a,py=Kl,my=function(t){},mu=String.prototype.replace,gu=String.prototype.split,wi="||||",go=function(i){var t=i%100,e=t%10;return t!==11&&e===1?0:2<=e&&e<=4&&!(t>=12&&t<=14)?1:2},vu={pluralTypes:{arabic:function(i){if(i<3)return i;var t=i%100;return t>=3&&t<=10?3:t>=11?4:5},bosnian_serbian:go,chinese:function(){return 0},croatian:go,french:function(i){return i>=2?1:0},german:function(i){return i!==1?1:0},russian:go,lithuanian:function(i){return i%10===1&&i%100!==11?0:i%10>=2&&i%10<=9&&(i%100<11||i%100>19)?1:2},czech:function(i){return i===1?0:i>=2&&i<=4?1:2},polish:function(i){if(i===1)return 0;var t=i%10;return 2<=t&&t<=4&&(i%100<10||i%100>=20)?1:2},icelandic:function(i){return i%10!==1||i%100===11?1:0},slovenian:function(i){var t=i%100;return t===1?0:t===2?1:t===3||t===4?2:3},romanian:function(i){if(i===1)return 0;var t=i%100;return i===0||t>=2&&t<=19?1:2}},pluralTypeToLanguages:{arabic:["ar"],bosnian_serbian:["bs-Latn-BA","bs-Cyrl-BA","srl-RS","sr-RS"],chinese:["id","id-ID","ja","ko","ko-KR","lo","ms","th","th-TH","zh"],croatian:["hr","hr-HR"],german:["fa","da","de","en","es","fi","el","he","hi-IN","hu","hu-HU","it","nl","no","pt","sv","tr"],french:["fr","tl","pt-br"],russian:["ru","ru-RU"],lithuanian:["lt"],czech:["cs","cs-CZ","sk"],polish:["pl"],icelandic:["is","mk"],slovenian:["sl-SL"],romanian:["ro"]}};function gy(i){var t={};return yi(mo(i),function(e){var n=e[0],r=e[1];yi(r,function(o){t[o]=n})}),t}function vy(i,t){var e=gy(i.pluralTypeToLanguages);return e[t]||e[gu.call(t,/-/,1)[0]]||e.en}function yy(i,t,e){return i.pluralTypes[t](e)}function wy(){var i={};return function(t,e){var n=i[e];return n&&!t.pluralTypes[n]&&(n=null,i[e]=n),n||(n=vy(t,e),n&&(i[e]=n)),n}}function yu(i){return i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function by(i){var t=i&&i.prefix||"%{",e=i&&i.suffix||"}";if(t===wi||e===wi)throw new RangeError('"'+wi+'" token is reserved for pluralization');return new RegExp(yu(t)+"(.*?)"+yu(e),"g")}var Sy=wy(),Ey=/%\{(.*?)\}/g;function vo(i,t,e,n,r,o){if(typeof i!="string")throw new TypeError("Polyglot.transformPhrase expects argument #1 to be string");if(t==null)return i;var s=i,a=n||Ey,l=o||mu,u=typeof t=="number"?{smart_count:t}:t;if(u.smart_count!=null&&i){var c=r||vu,h=gu.call(i,wi),d=e||"en",g=Sy(c,d),y=yy(c,g,u.smart_count);s=py(h[y]||h[0])}return s=l.call(s,a,function(x,b){return!pu(u,b)||u[b]==null?x:u[b]}),s}function yt(i){var t=i||{};this.phrases={},this.extend(t.phrases||{}),this.currentLocale=t.locale||"en";var e=t.allowMissing?vo:null;this.onMissingKey=typeof t.onMissingKey=="function"?t.onMissingKey:e,this.warn=t.warn||my,this.replaceImplementation=t.replace||mu,this.tokenRegex=by(t.interpolation),this.pluralRules=t.pluralRules||vu}yt.prototype.locale=function(i){return i&&(this.currentLocale=i),this.currentLocale},yt.prototype.extend=function(i,t){yi(mo(i||{}),function(e){var n=e[0],r=e[1],o=t?t+"."+n:n;typeof r=="object"?this.extend(r,o):this.phrases[o]=r},this)},yt.prototype.unset=function(i,t){typeof i=="string"?delete this.phrases[i]:yi(mo(i||{}),function(e){var n=e[0],r=e[1],o=t?t+"."+n:n;typeof r=="object"?this.unset(r,o):delete this.phrases[o]},this)},yt.prototype.clear=function(){this.phrases={}},yt.prototype.replace=function(i){this.clear(),this.extend(i)},yt.prototype.t=function(i,t){var e,n,r=t==null?{}:t;if(typeof this.phrases[i]=="string")e=this.phrases[i];else if(typeof r._=="string")e=r._;else if(this.onMissingKey){var o=this.onMissingKey;n=o(i,r,this.currentLocale,this.tokenRegex,this.pluralRules,this.replaceImplementation)}else this.warn('Missing translation for key: "'+i+'"'),n=i;return typeof e=="string"&&(n=vo(e,r,this.currentLocale,this.tokenRegex,this.pluralRules,this.replaceImplementation)),n},yt.prototype.has=function(i){return pu(this.phrases,i)},yt.transformPhrase=function(t,e,n){return vo(t,e,n)};var xy=yt,_y={"Add a comment...":"\u0625\u0636\u0627\u0641\u0629 \u062A\u0639\u0644\u064A\u0642","Add a reply...":"\u0625\u0636\u0627\u0641\u0629 \u0631\u062F","Add tag...":"\u0625\u0636\u0627\u0641\u0629 \u0639\u0644\u0627\u0645\u0629",Cancel:"\u0625\u0644\u063A\u0627\u0621",Close:"\u0625\u063A\u0644\u0627\u0642",Edit:"Edit",Delete:"Delete",Ok:"\u062A\u0645"},Ty={"Add a comment...":"Napsat koment\xE1\u0159...","Add a reply...":"Odpov\u011Bd\u011Bt...","Add tag...":"P\u0159idat \u0161t\xEDtek...",Cancel:"Zru\u0161it",Close:"Zav\u0159\xEDt",Edit:"Upravit",Delete:"Smazat",Ok:"Ok"},Cy={"Add a comment...":"Kommentar schreiben...","Add a reply...":"Antwort schreiben...","Add tag...":"Tag...",Cancel:"Abbrechen",Close:"Schliessen",Edit:"Bearbeiten",Delete:"L\xF6schen",Ok:"Ok"},Py={"Add a comment...":"\u03A3\u03C7\u03BF\u03BB\u03AF\u03B1\u03C3\u03B5...","Add a reply...":"\u0391\u03C0\u03AC\u03BD\u03C4\u03B7\u03C3\u03B5...","Add tag...":"\u03A0\u03C1\u03CC\u03C3\u03B8\u03B5\u03C3\u03B5 tag...",Cancel:"\u0386\u03BA\u03C5\u03C1\u03BF",Close:"\u039A\u03BB\u03B5\u03AF\u03C3\u03B9\u03BC\u03BF",Edit:"\u0395\u03C0\u03B5\u03BE\u03B5\u03C1\u03B3\u03B1\u03C3\u03AF\u03B1",Delete:"\u0394\u03B9\u03B1\u03B3\u03C1\u03B1\u03C6\u03AE",Ok:"Ok"},Ay={"Add a comment...":"Agregar un comentario...","Add a reply...":"Agregar una respuesta...","Add tag...":"Etiquetar...",Cancel:"Cancelar",Close:"Cerrar",Edit:"Editar",Delete:"Eliminar",Ok:"Ok"},Oy={"Add a comment...":"Lis\xE4\xE4 kommentti","Add a reply...":"Lis\xE4\xE4 vastaus","Add tag...":"Lis\xE4\xE4 tunniste",Cancel:"Peruuta",Close:"Sulje",Edit:"Muokkaa",Delete:"Poista",Ok:"Ok"},Dy={"Add a comment...":"Ajouter un commentaire...","Add a reply...":"Ajouter une r\xE9ponse...","Add tag...":"Ajouter une \xE9tiquette...",Cancel:"Annuler",Close:"Fermer",Edit:"\xC9diter",Delete:"Supprimer",Ok:"Ok"},Ry={"Add a comment...":"Engadir un comentario...","Add a reply...":"Engadir unha resposta...","Add tag...":"Etiquetar...",Cancel:"Cancelar",Close:"Pechar",Edit:"Edit",Delete:"Delete",Ok:"Ok"},My={"Add a comment...":"\u091F\u093F\u092A\u094D\u092A\u0923\u0940 \u091C\u094B\u0921\u093C\u0947\u0902","Add a reply...":"\u091C\u0935\u093E\u092C \u0926\u0947\u0902","Add tag...":"\u091F\u0948\u0917 \u0932\u0917\u093E\u090F\u0901",Cancel:"\u0930\u0926\u094D\u0926 \u0915\u0930\u0947\u0902",Close:"\u092C\u0902\u0926 \u0915\u0930\u0947\u0902",Edit:"\u0938\u0902\u092A\u093E\u0926\u093F\u0924 \u0915\u0930\u0947\u0902",Delete:"\u0939\u091F\u093E\u090F\u0901",Ok:"\u0920\u0940\u0915 \u0939\u0948"},Fy={"Add a comment...":"Commenta...","Add a reply...":"Rispondi...","Add tag...":"Aggiungi tag...",Cancel:"Annulla",Close:"Chiudi",Edit:"Edit",Delete:"Delete",Ok:"Ok"},ky={"Add a comment...":"\u30B3\u30E1\u30F3\u30C8\u3092\u8FFD\u52A0\u3059\u308B...","Add a reply...":"\u8FD4\u4FE1\u3059\u308B...","Add tag...":"\u30BF\u30B0\u3092\u8FFD\u52A0\u3059\u308B...",Cancel:"\u30AD\u30E3\u30F3\u30BB\u30EB",Close:"\u9589\u3058\u308B",Edit:"\u7DE8\u96C6",Delete:"\u524A\u9664",Ok:"Ok"},Ly={"Add a comment...":"\uB313\uAE00 \uCD94\uAC00","Add a reply...":"\uB2F5\uAE00 \uCD94\uAC00","Add tag...":"\uD0DC\uADF8 \uCD94\uAC00",Cancel:"\uCDE8\uC18C",Close:"\uB2EB\uAE30",Edit:"\uC218\uC815",Delete:"\uC0AD\uC81C",Ok:"\uD655\uC778"},By={"Add a comment...":"Commentaar toevoegen...","Add a reply...":"Antwoord toevoegen...","Add tag...":"Tag toevoegen...",Cancel:"Afbreken",Close:"Sluiten",Edit:"Bewerken",Delete:"Verwijderen",Ok:"Ok"},Iy={"Add a comment...":"Adicionar um coment\xE1rio...","Add a reply...":"Adicionar uma resposta...","Add tag...":"Etiquetar...",Cancel:"Cancelar",Close:"Fechar",Edit:"Editar",Delete:"Apagar",Ok:"Ok"},Ny={"Add a comment...":"\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u043A\u043E\u043C\u043C\u0435\u043D\u0442\u0430\u0440\u0438\u0439...","Add a reply...":"\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u043E\u0442\u0432\u0435\u0442...","Add tag...":"\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u0442\u044D\u0433...",Cancel:"\u041E\u0442\u043C\u0435\u043D\u0430",Close:"\u0417\u0430\u043A\u0440\u044B\u0442\u044C",Edit:"\u0420\u0435\u0434\u0430\u043A\u0442\u0438\u0440\u043E\u0432\u0430\u0442\u044C",Delete:"\u0423\u0434\u0430\u043B\u0438\u0442\u044C",Ok:"\u041E\u043A"},Hy={"Add a comment...":"Skriv en kommentar...","Add a reply...":"Skriv ett svar...","Add tag...":"Tagg...",Cancel:"Cancel",Close:"St\xE4ng",Edit:"Edit",Delete:"Delete",Ok:"Ok"},zy={"Add a comment...":"\u0E40\u0E1E\u0E34\u0E48\u0E21\u0E04\u0E2D\u0E21\u0E40\u0E21\u0E19\u0E15\u0E4C...","Add a reply...":"\u0E15\u0E2D\u0E1A\u0E01\u0E25\u0E31\u0E1A...","Add tag...":"\u0E40\u0E1E\u0E34\u0E48\u0E21\u0E41\u0E17\u0E47\u0E01...",Cancel:"\u0E22\u0E01\u0E40\u0E25\u0E34\u0E01",Close:"\u0E1B\u0E34\u0E14",Edit:"\u0E41\u0E01\u0E49\u0E44\u0E02",Delete:"\u0E25\u0E1A",Ok:"\u0E15\u0E01\u0E25\u0E07"},Vy={"Add a comment...":"Yorum ekle...","Add a reply...":"Cevap ekle...","Add tag...":"Tag Ekle...",Cancel:"\u0130ptal",Close:"Kapat",Edit:"D\xFCzenle",Delete:"Sil",Ok:"Tamam"},Uy={"Add a comment...":"\u062A\u0628\u0635\u0631\u06C1 \u06A9\u0631\u06CC\u06BA","Add a reply...":"\u062C\u0648\u0627\u0628 \u062F\u06CC\u06BA","Add tag...":"\u0679\u06CC\u06AF \u0644\u06AF\u0627\u0626\u06CC\u06BA",Cancel:"\u0645\u0646\u0633\u0648\u062E \u06A9\u0631\u06CC\u06BA",Close:"\u0628\u0646\u062F \u06A9\u0631\u06CC\u06BA",Edit:"\u062A\u0631\u0645\u06CC\u0645 \u06A9\u0631\u06CC\u06BA",Delete:"\u06C1\u0679\u0627\u0626\u06CC\u06BA",Ok:"\u0679\u06BE\u06CC\u06A9 \u06C1\u06D2"},Wy={"Add a comment...":"\u6DFB\u52A0\u8BC4\u8BBA...","Add a reply...":"\u6DFB\u52A0\u56DE\u590D...","Add tag...":"\u6DFB\u52A0\u6807\u7B7E...",Cancel:"\u53D6\u6D88",Close:"\u5173\u95ED",Edit:"\u7F16\u8F91",Delete:"\u5220\u9664",Ok:"\u786E\u8BA4"},jy={"Add a comment...":"\u6DFB\u52A0\u8A55\u8AD6...","Add a reply...":"\u6DFB\u52A0\u56DE\u8986...","Add tag...":"\u6DFB\u52A0\u6A19\u7C64...",Cancel:"\u53D6\u6D88",Close:"\u95DC\u9589",Edit:"\u7DE8\u8F2F",Delete:"\u522A\u9664",Ok:"\u78BA\u8A8D"},wu={};Object.defineProperty(wu,"__esModule",{value:!0});var yo=[["\u062B\u0627\u0646\u064A\u0629","\u062B\u0627\u0646\u064A\u062A\u064A\u0646","%s \u062B\u0648\u0627\u0646","%s \u062B\u0627\u0646\u064A\u0629"],["\u062F\u0642\u064A\u0642\u0629","\u062F\u0642\u064A\u0642\u062A\u064A\u0646","%s \u062F\u0642\u0627\u0626\u0642","%s \u062F\u0642\u064A\u0642\u0629"],["\u0633\u0627\u0639\u0629","\u0633\u0627\u0639\u062A\u064A\u0646","%s \u0633\u0627\u0639\u0627\u062A","%s \u0633\u0627\u0639\u0629"],["\u064A\u0648\u0645","\u064A\u0648\u0645\u064A\u0646","%s \u0623\u064A\u0627\u0645","%s \u064A\u0648\u0645\u0627\u064B"],["\u0623\u0633\u0628\u0648\u0639","\u0623\u0633\u0628\u0648\u0639\u064A\u0646","%s \u0623\u0633\u0627\u0628\u064A\u0639","%s \u0623\u0633\u0628\u0648\u0639\u0627\u064B"],["\u0634\u0647\u0631","\u0634\u0647\u0631\u064A\u0646","%s \u0623\u0634\u0647\u0631","%s \u0634\u0647\u0631\u0627\u064B"],["\u0639\u0627\u0645","\u0639\u0627\u0645\u064A\u0646","%s \u0623\u0639\u0648\u0627\u0645","%s \u0639\u0627\u0645\u0627\u064B"]];function Gy(i,t){return t<3?yo[i][t-1]:t>=3&&t<=10?yo[i][2]:yo[i][3]}function qy(i,t){if(t===0)return["\u0645\u0646\u0630 \u0644\u062D\u0638\u0627\u062A","\u0628\u0639\u062F \u0644\u062D\u0638\u0627\u062A"];var e=Gy(Math.floor(t/2),i);return["\u0645\u0646\u0630 "+e,"\u0628\u0639\u062F "+e]}var Xy=wu.default=qy,bu={};Object.defineProperty(bu,"__esModule",{value:!0});function Yy(i,t){var e=0,n=t==1||t==3||t==5||t==7||t==9||t==11||t==13;return n&&i>=5&&(e=1),[[["pr\xE1v\u011B te\u010F","pr\xE1v\u011B te\u010F"]],[["p\u0159ed %s vte\u0159inami","za %s vte\u0159iny"],["p\u0159ed %s vte\u0159inami","za %s vte\u0159in"]],[["p\u0159ed minutou","za minutu"]],[["p\u0159ed %s minutami","za %s minuty"],["p\u0159ed %s minutami","za %s minut"]],[["p\u0159ed hodinou","za hodinu"]],[["p\u0159ed %s hodinami","za %s hodiny"],["p\u0159ed %s hodinami","za %s hodin"]],[["v\u010Dera","z\xEDtra"]],[["p\u0159ed %s dny","za %s dny"],["p\u0159ed %s dny","za %s dn\u016F"]],[["minul\xFD t\xFDden","p\u0159\xED\u0161t\xED t\xFDden"]],[["p\u0159ed %s t\xFDdny","za %s t\xFDdny"],["p\u0159ed %s t\xFDdny","za %s t\xFDdn\u016F"]],[["minul\xFD m\u011Bs\xEDc","p\u0159\xEDst\xED m\u011Bs\xEDc"]],[["p\u0159ed %s m\u011Bs\xEDci","za %s m\u011Bs\xEDce"],["p\u0159ed %s m\u011Bs\xEDci","za %s m\u011Bs\xEDc\u016F"]],[["p\u0159ed rokem","p\u0159\xEDst\xED rok"]],[["p\u0159ed %s lety","za %s roky"],["p\u0159ed %s lety","za %s let"]]][t][e]}var Zy=bu.default=Yy,Su={};Object.defineProperty(Su,"__esModule",{value:!0});function Ky(i,t){return[["gerade eben","vor einer Weile"],["vor %s Sekunden","in %s Sekunden"],["vor 1 Minute","in 1 Minute"],["vor %s Minuten","in %s Minuten"],["vor 1 Stunde","in 1 Stunde"],["vor %s Stunden","in %s Stunden"],["vor 1 Tag","in 1 Tag"],["vor %s Tagen","in %s Tagen"],["vor 1 Woche","in 1 Woche"],["vor %s Wochen","in %s Wochen"],["vor 1 Monat","in 1 Monat"],["vor %s Monaten","in %s Monaten"],["vor 1 Jahr","in 1 Jahr"],["vor %s Jahren","in %s Jahren"]][t]}var Jy=Su.default=Ky,Eu={};Object.defineProperty(Eu,"__esModule",{value:!0});function Qy(i,t){return[["\u03BC\u03CC\u03BB\u03B9\u03C2 \u03C4\u03CE\u03C1\u03B1","\u03C3\u03B5 \u03BB\u03AF\u03B3\u03BF"],["%s \u03B4\u03B5\u03C5\u03C4\u03B5\u03C1\u03CC\u03BB\u03B5\u03C0\u03C4\u03B1 \u03C0\u03C1\u03B9\u03BD","\u03C3\u03B5 %s \u03B4\u03B5\u03C5\u03C4\u03B5\u03C1\u03CC\u03BB\u03B5\u03C0\u03C4\u03B1"],["1 \u03BB\u03B5\u03C0\u03C4\u03CC \u03C0\u03C1\u03B9\u03BD","\u03C3\u03B5 1 \u03BB\u03B5\u03C0\u03C4\u03CC"],["%s \u03BB\u03B5\u03C0\u03C4\u03AC \u03C0\u03C1\u03B9\u03BD","\u03C3\u03B5 %s \u03BB\u03B5\u03C0\u03C4\u03AC"],["1 \u03CE\u03C1\u03B1 \u03C0\u03C1\u03B9\u03BD","\u03C3\u03B5 1 \u03CE\u03C1\u03B1"],["%s \u03CE\u03C1\u03B5\u03C2 \u03C0\u03C1\u03B9\u03BD","\u03C3\u03B5 %s \u03CE\u03C1\u03B5\u03C2"],["1 \u03BC\u03AD\u03C1\u03B1 \u03C0\u03C1\u03B9\u03BD","\u03C3\u03B5 1 \u03BC\u03AD\u03C1\u03B1"],["%s \u03BC\u03AD\u03C1\u03B5\u03C2 \u03C0\u03C1\u03B9\u03BD","\u03C3\u03B5 %s \u03BC\u03AD\u03C1\u03B5\u03C2"],["1 \u03B5\u03B2\u03B4\u03BF\u03BC\u03AC\u03B4\u03B1 \u03C0\u03C1\u03B9\u03BD","\u03C3\u03B5 1 \u03B5\u03B2\u03B4\u03BF\u03BC\u03AC\u03B4\u03B1"],["%s \u03B5\u03B2\u03B4\u03BF\u03BC\u03AC\u03B4\u03B5\u03C2 \u03C0\u03C1\u03B9\u03BD","\u03C3\u03B5 %s \u03B5\u03B2\u03B4\u03BF\u03BC\u03AC\u03B4\u03B5\u03C2"],["1 \u03BC\u03AE\u03BD\u03B1 \u03C0\u03C1\u03B9\u03BD","\u03C3\u03B5 1 \u03BC\u03AE\u03BD\u03B1"],["%s \u03BC\u03AE\u03BD\u03B5\u03C2 \u03C0\u03C1\u03B9\u03BD","\u03C3\u03B5 %s \u03BC\u03AE\u03BD\u03B5\u03C2"],["1 \u03C7\u03C1\u03CC\u03BD\u03BF \u03C0\u03C1\u03B9\u03BD","\u03C3\u03B5 1 \u03C7\u03C1\u03CC\u03BD\u03BF"],["%s \u03C7\u03C1\u03CC\u03BD\u03B9\u03B1 \u03C0\u03C1\u03B9\u03BD","\u03C3\u03B5 %s \u03C7\u03C1\u03CC\u03BD\u03B9\u03B1"]][t]}var $y=Eu.default=Qy,xu={};Object.defineProperty(xu,"__esModule",{value:!0});function e0(i,t){return[["justo ahora","en un rato"],["hace %s segundos","en %s segundos"],["hace 1 minuto","en 1 minuto"],["hace %s minutos","en %s minutos"],["hace 1 hora","en 1 hora"],["hace %s horas","en %s horas"],["hace 1 d\xEDa","en 1 d\xEDa"],["hace %s d\xEDas","en %s d\xEDas"],["hace 1 semana","en 1 semana"],["hace %s semanas","en %s semanas"],["hace 1 mes","en 1 mes"],["hace %s meses","en %s meses"],["hace 1 a\xF1o","en 1 a\xF1o"],["hace %s a\xF1os","en %s a\xF1os"]][t]}var t0=xu.default=e0,_u={};Object.defineProperty(_u,"__esModule",{value:!0});function n0(i,t){return[["juuri \xE4sken","juuri nyt"],["%s sekuntia sitten","%s sekunnin p\xE4\xE4st\xE4"],["minuutti sitten","minuutin p\xE4\xE4st\xE4"],["%s minuuttia sitten","%s minuutin p\xE4\xE4st\xE4"],["tunti sitten","tunnin p\xE4\xE4st\xE4"],["%s tuntia sitten","%s tunnin p\xE4\xE4st\xE4"],["p\xE4iv\xE4 sitten","p\xE4iv\xE4n p\xE4\xE4st\xE4"],["%s p\xE4iv\xE4\xE4 sitten","%s p\xE4iv\xE4n p\xE4\xE4st\xE4"],["viikko sitten","viikon p\xE4\xE4st\xE4"],["%s viikkoa sitten","%s viikon p\xE4\xE4st\xE4"],["kuukausi sitten","kuukauden p\xE4\xE4st\xE4"],["%s kuukautta sitten","%s kuukauden p\xE4\xE4st\xE4"],["vuosi sitten","vuoden p\xE4\xE4st\xE4"],["%s vuotta sitten","%s vuoden p\xE4\xE4st\xE4"]][t]}var i0=_u.default=n0,Tu={};Object.defineProperty(Tu,"__esModule",{value:!0});function r0(i,t){return[["\xE0 l'instant","dans un instant"],["il y a %s secondes","dans %s secondes"],["il y a 1 minute","dans 1 minute"],["il y a %s minutes","dans %s minutes"],["il y a 1 heure","dans 1 heure"],["il y a %s heures","dans %s heures"],["il y a 1 jour","dans 1 jour"],["il y a %s jours","dans %s jours"],["il y a 1 semaine","dans 1 semaine"],["il y a %s semaines","dans %s semaines"],["il y a 1 mois","dans 1 mois"],["il y a %s mois","dans %s mois"],["il y a 1 an","dans 1 an"],["il y a %s ans","dans %s ans"]][t]}var o0=Tu.default=r0,Cu={};Object.defineProperty(Cu,"__esModule",{value:!0});function s0(i,t){return[["xusto agora","daqu\xED a un pouco"],["hai %s segundos","en %s segundos"],["hai 1 minuto","nun minuto"],["hai %s minutos","en %s minutos"],["hai 1 hora","nunha hora"],["hai %s horas","en %s horas"],["hai 1 d\xEDa","nun d\xEDa"],["hai %s d\xEDas","en %s d\xEDas"],["hai 1 semana","nunha semana"],["hai %s semanas","en %s semanas"],["hai 1 mes","nun mes"],["hai %s meses","en %s meses"],["hai 1 ano","nun ano"],["hai %s anos","en %s anos"]][t]}var a0=Cu.default=s0,Pu={};Object.defineProperty(Pu,"__esModule",{value:!0});function l0(i,t){return[["\u0905\u092D\u0940","\u0915\u0941\u091B \u0938\u092E\u092F"],["%s \u0938\u0947\u0915\u0902\u0921 \u092A\u0939\u0932\u0947","%s \u0938\u0947\u0915\u0902\u0921 \u092E\u0947\u0902"],["1 \u092E\u093F\u0928\u091F \u092A\u0939\u0932\u0947","1 \u092E\u093F\u0928\u091F \u092E\u0947\u0902"],["%s \u092E\u093F\u0928\u091F \u092A\u0939\u0932\u0947","%s \u092E\u093F\u0928\u091F \u092E\u0947\u0902"],["1 \u0918\u0902\u091F\u0947 \u092A\u0939\u0932\u0947","1 \u0918\u0902\u091F\u0947 \u092E\u0947\u0902"],["%s \u0918\u0902\u091F\u0947 \u092A\u0939\u0932\u0947","%s \u0918\u0902\u091F\u0947 \u092E\u0947\u0902"],["1 \u0926\u093F\u0928 \u092A\u0939\u0932\u0947","1 \u0926\u093F\u0928 \u092E\u0947\u0902"],["%s \u0926\u093F\u0928 \u092A\u0939\u0932\u0947","%s \u0926\u093F\u0928\u094B\u0902 \u092E\u0947\u0902"],["1 \u0938\u092A\u094D\u0924\u093E\u0939 \u092A\u0939\u0932\u0947","1 \u0938\u092A\u094D\u0924\u093E\u0939 \u092E\u0947\u0902"],["%s \u0939\u092B\u094D\u0924\u0947 \u092A\u0939\u0932\u0947","%s \u0939\u092B\u094D\u0924\u094B\u0902 \u092E\u0947\u0902"],["1 \u092E\u0939\u0940\u0928\u0947 \u092A\u0939\u0932\u0947","1 \u092E\u0939\u0940\u0928\u0947 \u092E\u0947\u0902"],["%s \u092E\u0939\u0940\u0928\u0947 \u092A\u0939\u0932\u0947","%s \u092E\u0939\u0940\u0928\u094B\u0902 \u092E\u0947\u0902"],["1 \u0938\u093E\u0932 \u092A\u0939\u0932\u0947","1 \u0938\u093E\u0932 \u092E\u0947\u0902"],["%s \u0938\u093E\u0932 \u092A\u0939\u0932\u0947","%s \u0938\u093E\u0932 \u092E\u0947\u0902"]][t]}var u0=Pu.default=l0,Au={};Object.defineProperty(Au,"__esModule",{value:!0});function c0(i,t){return[["poco fa","fra poco"],["%s secondi fa","fra %s secondi"],["un minuto fa","fra un minuto"],["%s minuti fa","fra %s minuti"],["un'ora fa","fra un'ora"],["%s ore fa","fra %s ore"],["un giorno fa","fra un giorno"],["%s giorni fa","fra %s giorni"],["una settimana fa","fra una settimana"],["%s settimane fa","fra %s settimane"],["un mese fa","fra un mese"],["%s mesi fa","fra %s mesi"],["un anno fa","fra un anno"],["%s anni fa","fra %s anni"]][t]}var h0=Au.default=c0,Ou={};Object.defineProperty(Ou,"__esModule",{value:!0});function d0(i,t){return[["\u3059\u3053\u3057\u524D","\u3059\u3050\u306B"],["%s\u79D2\u524D","%s\u79D2\u4EE5\u5185"],["1\u5206\u524D","1\u5206\u4EE5\u5185"],["%s\u5206\u524D","%s\u5206\u4EE5\u5185"],["1\u6642\u9593\u524D","1\u6642\u9593\u4EE5\u5185"],["%s\u6642\u9593\u524D","%s\u6642\u9593\u4EE5\u5185"],["1\u65E5\u524D","1\u65E5\u4EE5\u5185"],["%s\u65E5\u524D","%s\u65E5\u4EE5\u5185"],["1\u9031\u9593\u524D","1\u9031\u9593\u4EE5\u5185"],["%s\u9031\u9593\u524D","%s\u9031\u9593\u4EE5\u5185"],["1\u30F6\u6708\u524D","1\u30F6\u6708\u4EE5\u5185"],["%s\u30F6\u6708\u524D","%s\u30F6\u6708\u4EE5\u5185"],["1\u5E74\u524D","1\u5E74\u4EE5\u5185"],["%s\u5E74\u524D","%s\u5E74\u4EE5\u5185"]][t]}var f0=Ou.default=d0,Du={};Object.defineProperty(Du,"__esModule",{value:!0});function p0(i,t){return[["\uBC29\uAE08","\uACE7"],["%s\uCD08 \uC804","%s\uCD08 \uD6C4"],["1\uBD84 \uC804","1\uBD84 \uD6C4"],["%s\uBD84 \uC804","%s\uBD84 \uD6C4"],["1\uC2DC\uAC04 \uC804","1\uC2DC\uAC04 \uD6C4"],["%s\uC2DC\uAC04 \uC804","%s\uC2DC\uAC04 \uD6C4"],["1\uC77C \uC804","1\uC77C \uD6C4"],["%s\uC77C \uC804","%s\uC77C \uD6C4"],["1\uC8FC\uC77C \uC804","1\uC8FC\uC77C \uD6C4"],["%s\uC8FC\uC77C \uC804","%s\uC8FC\uC77C \uD6C4"],["1\uAC1C\uC6D4 \uC804","1\uAC1C\uC6D4 \uD6C4"],["%s\uAC1C\uC6D4 \uC804","%s\uAC1C\uC6D4 \uD6C4"],["1\uB144 \uC804","1\uB144 \uD6C4"],["%s\uB144 \uC804","%s\uB144 \uD6C4"]][t]}var m0=Du.default=p0,Ru={};Object.defineProperty(Ru,"__esModule",{value:!0});function g0(i,t){return[["recent","binnenkort"],["%s seconden geleden","binnen %s seconden"],["1 minuut geleden","binnen 1 minuut"],["%s minuten geleden","binnen %s minuten"],["1 uur geleden","binnen 1 uur"],["%s uur geleden","binnen %s uur"],["1 dag geleden","binnen 1 dag"],["%s dagen geleden","binnen %s dagen"],["1 week geleden","binnen 1 week"],["%s weken geleden","binnen %s weken"],["1 maand geleden","binnen 1 maand"],["%s maanden geleden","binnen %s maanden"],["1 jaar geleden","binnen 1 jaar"],["%s jaar geleden","binnen %s jaar"]][t]}var v0=Ru.default=g0,Mu={};Object.defineProperty(Mu,"__esModule",{value:!0});function y0(i,t){return[["agora mesmo","agora"],["h\xE1 %s segundos","em %s segundos"],["h\xE1 um minuto","em um minuto"],["h\xE1 %s minutos","em %s minutos"],["h\xE1 uma hora","em uma hora"],["h\xE1 %s horas","em %s horas"],["h\xE1 um dia","em um dia"],["h\xE1 %s dias","em %s dias"],["h\xE1 uma semana","em uma semana"],["h\xE1 %s semanas","em %s semanas"],["h\xE1 um m\xEAs","em um m\xEAs"],["h\xE1 %s meses","em %s meses"],["h\xE1 um ano","em um ano"],["h\xE1 %s anos","em %s anos"]][t]}var w0=Mu.default=y0,Fu={};Object.defineProperty(Fu,"__esModule",{value:!0});function Ht(i,t,e,n,r){var o=r%10,s=n;return r===1?s=i:o===1&&r>20?s=t:o>1&&o<5&&(r>20||r<10)&&(s=e),s}var ku=Ht.bind(null,"\u0441\u0435\u043A\u0443\u043D\u0434\u0443","%s \u0441\u0435\u043A\u0443\u043D\u0434\u0443","%s \u0441\u0435\u043A\u0443\u043D\u0434\u044B","%s \u0441\u0435\u043A\u0443\u043D\u0434"),Lu=Ht.bind(null,"\u043C\u0438\u043D\u0443\u0442\u0443","%s \u043C\u0438\u043D\u0443\u0442\u0443","%s \u043C\u0438\u043D\u0443\u0442\u044B","%s \u043C\u0438\u043D\u0443\u0442"),Bu=Ht.bind(null,"\u0447\u0430\u0441","%s \u0447\u0430\u0441","%s \u0447\u0430\u0441\u0430","%s \u0447\u0430\u0441\u043E\u0432"),Iu=Ht.bind(null,"\u0434\u0435\u043D\u044C","%s \u0434\u0435\u043D\u044C","%s \u0434\u043D\u044F","%s \u0434\u043D\u0435\u0439"),Nu=Ht.bind(null,"\u043D\u0435\u0434\u0435\u043B\u044E","%s \u043D\u0435\u0434\u0435\u043B\u044E","%s \u043D\u0435\u0434\u0435\u043B\u0438","%s \u043D\u0435\u0434\u0435\u043B\u044C"),Hu=Ht.bind(null,"\u043C\u0435\u0441\u044F\u0446","%s \u043C\u0435\u0441\u044F\u0446","%s \u043C\u0435\u0441\u044F\u0446\u0430","%s \u043C\u0435\u0441\u044F\u0446\u0435\u0432"),zu=Ht.bind(null,"\u0433\u043E\u0434","%s \u0433\u043E\u0434","%s \u0433\u043E\u0434\u0430","%s \u043B\u0435\u0442");function b0(i,t){switch(t){case 0:return["\u0442\u043E\u043B\u044C\u043A\u043E \u0447\u0442\u043E","\u0447\u0435\u0440\u0435\u0437 \u043D\u0435\u0441\u043A\u043E\u043B\u044C\u043A\u043E \u0441\u0435\u043A\u0443\u043D\u0434"];case 1:return[ku(i)+" \u043D\u0430\u0437\u0430\u0434","\u0447\u0435\u0440\u0435\u0437 "+ku(i)];case 2:case 3:return[Lu(i)+" \u043D\u0430\u0437\u0430\u0434","\u0447\u0435\u0440\u0435\u0437 "+Lu(i)];case 4:case 5:return[Bu(i)+" \u043D\u0430\u0437\u0430\u0434","\u0447\u0435\u0440\u0435\u0437 "+Bu(i)];case 6:return["\u0432\u0447\u0435\u0440\u0430","\u0437\u0430\u0432\u0442\u0440\u0430"];case 7:return[Iu(i)+" \u043D\u0430\u0437\u0430\u0434","\u0447\u0435\u0440\u0435\u0437 "+Iu(i)];case 8:case 9:return[Nu(i)+" \u043D\u0430\u0437\u0430\u0434","\u0447\u0435\u0440\u0435\u0437 "+Nu(i)];case 10:case 11:return[Hu(i)+" \u043D\u0430\u0437\u0430\u0434","\u0447\u0435\u0440\u0435\u0437 "+Hu(i)];case 12:case 13:return[zu(i)+" \u043D\u0430\u0437\u0430\u0434","\u0447\u0435\u0440\u0435\u0437 "+zu(i)];default:return["",""]}}var S0=Fu.default=b0,Vu={};Object.defineProperty(Vu,"__esModule",{value:!0});function E0(i,t){return[["just nu","om en stund"],["%s sekunder sedan","om %s sekunder"],["1 minut sedan","om 1 minut"],["%s minuter sedan","om %s minuter"],["1 timme sedan","om 1 timme"],["%s timmar sedan","om %s timmar"],["1 dag sedan","om 1 dag"],["%s dagar sedan","om %s dagar"],["1 vecka sedan","om 1 vecka"],["%s veckor sedan","om %s veckor"],["1 m\xE5nad sedan","om 1 m\xE5nad"],["%s m\xE5nader sedan","om %s m\xE5nader"],["1 \xE5r sedan","om 1 \xE5r"],["%s \xE5r sedan","om %s \xE5r"]][t]}var x0=Vu.default=E0,Uu={};Object.defineProperty(Uu,"__esModule",{value:!0});function _0(i,t){return[["\u0E40\u0E21\u0E37\u0E48\u0E2D\u0E2A\u0E31\u0E01\u0E04\u0E23\u0E39\u0E48\u0E19\u0E35\u0E49","\u0E2D\u0E35\u0E01\u0E2A\u0E31\u0E01\u0E04\u0E23\u0E39\u0E48"],["%s \u0E27\u0E34\u0E19\u0E32\u0E17\u0E35\u0E17\u0E35\u0E48\u0E41\u0E25\u0E49\u0E27","\u0E43\u0E19 %s \u0E27\u0E34\u0E19\u0E32\u0E17\u0E35"],["1 \u0E19\u0E32\u0E17\u0E35\u0E17\u0E35\u0E48\u0E41\u0E25\u0E49\u0E27","\u0E43\u0E19 1 \u0E19\u0E32\u0E17\u0E35"],["%s \u0E19\u0E32\u0E17\u0E35\u0E17\u0E35\u0E48\u0E41\u0E25\u0E49\u0E27","\u0E43\u0E19 %s \u0E19\u0E32\u0E17\u0E35"],["1 \u0E0A\u0E31\u0E48\u0E27\u0E42\u0E21\u0E07\u0E17\u0E35\u0E48\u0E41\u0E25\u0E49\u0E27","\u0E43\u0E19 1 \u0E0A\u0E31\u0E48\u0E27\u0E42\u0E21\u0E07"],["%s \u0E0A\u0E31\u0E48\u0E27\u0E42\u0E21\u0E07\u0E17\u0E35\u0E48\u0E41\u0E25\u0E49\u0E27","\u0E43\u0E19 %s \u0E0A\u0E31\u0E48\u0E27\u0E42\u0E21\u0E07"],["1 \u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E41\u0E25\u0E49\u0E27","\u0E43\u0E19 1 \u0E27\u0E31\u0E19"],["%s \u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E41\u0E25\u0E49\u0E27","\u0E43\u0E19 %s \u0E27\u0E31\u0E19"],["1 \u0E2D\u0E32\u0E17\u0E34\u0E15\u0E22\u0E4C\u0E17\u0E35\u0E48\u0E41\u0E25\u0E49\u0E27","\u0E43\u0E19 1 \u0E2D\u0E32\u0E17\u0E34\u0E15\u0E22\u0E4C"],["%s \u0E2D\u0E32\u0E17\u0E34\u0E15\u0E22\u0E4C\u0E17\u0E35\u0E48\u0E41\u0E25\u0E49\u0E27","\u0E43\u0E19 %s \u0E2D\u0E32\u0E17\u0E34\u0E15\u0E22\u0E4C"],["1 \u0E40\u0E14\u0E37\u0E2D\u0E19\u0E17\u0E35\u0E48\u0E41\u0E25\u0E49\u0E27","\u0E43\u0E19 1 \u0E40\u0E14\u0E37\u0E2D\u0E19"],["%s \u0E40\u0E14\u0E37\u0E2D\u0E19\u0E17\u0E35\u0E48\u0E41\u0E25\u0E49\u0E27","\u0E43\u0E19 %s \u0E40\u0E14\u0E37\u0E2D\u0E19"],["1 \u0E1B\u0E35\u0E17\u0E35\u0E48\u0E41\u0E25\u0E49\u0E27","\u0E43\u0E19 1 \u0E1B\u0E35"],["%s \u0E1B\u0E35\u0E17\u0E35\u0E48\u0E41\u0E25\u0E49\u0E27","\u0E43\u0E19 %s \u0E1B\u0E35"]][t]}var T0=Uu.default=_0,Wu={};Object.defineProperty(Wu,"__esModule",{value:!0});function C0(i,t){return[["az \xF6nce","\u015Fimdi"],["%s saniye \xF6nce","%s saniye i\xE7inde"],["1 dakika \xF6nce","1 dakika i\xE7inde"],["%s dakika \xF6nce","%s dakika i\xE7inde"],["1 saat \xF6nce","1 saat i\xE7inde"],["%s saat \xF6nce","%s saat i\xE7inde"],["1 g\xFCn \xF6nce","1 g\xFCn i\xE7inde"],["%s g\xFCn \xF6nce","%s g\xFCn i\xE7inde"],["1 hafta \xF6nce","1 hafta i\xE7inde"],["%s hafta \xF6nce","%s hafta i\xE7inde"],["1 ay \xF6nce","1 ay i\xE7inde"],["%s ay \xF6nce","%s ay i\xE7inde"],["1 y\u0131l \xF6nce","1 y\u0131l i\xE7inde"],["%s y\u0131l \xF6nce","%s y\u0131l i\xE7inde"]][t]}var P0=Wu.default=C0,ju={};Object.defineProperty(ju,"__esModule",{value:!0});var A0=["\u79D2","\u5206\u949F","\u5C0F\u65F6","\u5929","\u5468","\u4E2A\u6708","\u5E74"];function O0(i,t){if(t===0)return["\u521A\u521A","\u7247\u523B\u540E"];var e=A0[~~(t/2)];return[i+" "+e+"\u524D",i+" "+e+"\u540E"]}var D0=ju.default=O0,Gu={};Object.defineProperty(Gu,"__esModule",{value:!0});function R0(i,t){return[["\u525B\u525B","\u7247\u523B\u5F8C"],["%s \u79D2\u524D","%s \u79D2\u5F8C"],["1 \u5206\u9418\u524D","1 \u5206\u9418\u5F8C"],["%s \u5206\u9418\u524D","%s \u5206\u9418\u5F8C"],["1 \u5C0F\u6642\u524D","1 \u5C0F\u6642\u5F8C"],["%s \u5C0F\u6642\u524D","%s \u5C0F\u6642\u5F8C"],["1 \u5929\u524D","1 \u5929\u5F8C"],["%s \u5929\u524D","%s \u5929\u5F8C"],["1 \u9031\u524D","1 \u9031\u5F8C"],["%s \u9031\u524D","%s \u9031\u5F8C"],["1 \u500B\u6708\u524D","1 \u500B\u6708\u5F8C"],["%s \u500B\u6708\u524D","%s \u500B\u6708\u5F8C"],["1 \u5E74\u524D","1 \u5E74\u5F8C"],["%s \u5E74\u524D","%s \u5E74\u5F8C"]][t]}var M0=Gu.default=R0;const on={ar:_y,cs:Ty,de:Cy,el:Py,es:Ay,fi:Oy,fr:Dy,gl:Ry,hi:My,it:Fy,ja:ky,ko:Ly,nl:By,pt:Iy,ru:Ny,sv:Hy,th:zy,tr:Vy,ur:Uy,"zh-CN":Wy,"zh-TW":jy},F0=Object.keys(on),zt=new xy({allowMissing:!0});zt.init=(i,t)=>{zt.clear(),i&&(zt.locale(i),zt.extend(on[i])),t&&zt.extend(t)},_e("ar",Xy),_e("cs",Zy),_e("de",Jy),_e("el",$y),_e("es",t0),_e("fi",i0),_e("fr",o0),_e("gl",a0),_e("hi",u0),_e("it",h0),_e("ja",f0),_e("ko",m0),_e("nl",v0),_e("pt",w0),_e("ru",S0),_e("sv",x0),_e("th",T0),_e("tr",P0),_e("zh-CN",D0),_e("zh-TW",M0),zt.registerMessages=(i,t)=>{on[i]?on[i]={...on[i],...t}:on[i]=t};var Ze=zt,k0=i=>{const t=ot();return If(t,()=>i.onClickOutside()),k.createElement("ul",{ref:t,className:"r6o-comment-dropdown-menu"},k.createElement("li",{onClick:i.onEdit},Ze.t("Edit")),k.createElement("li",{onClick:i.onDelete},Ze.t("Delete")))},qu={},wo={},bo={exports:{}};/*!
autosize 4.0.4
license: MIT
http://www.jacklmoore.com/autosize
*/(function(i,t){(function(e,n){n(i,t)})(_t,function(e,n){var r=typeof Map=="function"?new Map:function(){var c=[],h=[];return{has:function(g){return c.indexOf(g)>-1},get:function(g){return h[c.indexOf(g)]},set:function(g,y){c.indexOf(g)===-1&&(c.push(g),h.push(y))},delete:function(g){var y=c.indexOf(g);y>-1&&(c.splice(y,1),h.splice(y,1))}}}(),o=function(h){return new Event(h,{bubbles:!0})};try{new Event("test")}catch{o=function(d){var g=document.createEvent("Event");return g.initEvent(d,!0,!1),g}}function s(c){if(!c||!c.nodeName||c.nodeName!=="TEXTAREA"||r.has(c))return;var h=null,d=null,g=null;function y(){var C=window.getComputedStyle(c,null);C.resize==="vertical"?c.style.resize="none":C.resize==="both"&&(c.style.resize="horizontal"),C.boxSizing==="content-box"?h=-(parseFloat(C.paddingTop)+parseFloat(C.paddingBottom)):h=parseFloat(C.borderTopWidth)+parseFloat(C.borderBottomWidth),isNaN(h)&&(h=0),f()}function x(C){{var O=c.style.width;c.style.width="0px",c.offsetWidth,c.style.width=O}c.style.overflowY=C}function b(C){for(var O=[];C&&C.parentNode&&C.parentNode instanceof Element;)C.parentNode.scrollTop&&O.push({node:C.parentNode,scrollTop:C.parentNode.scrollTop}),C=C.parentNode;return O}function T(){if(c.scrollHeight!==0){var C=b(c),O=document.documentElement&&document.documentElement.scrollTop;c.style.height="",c.style.height=c.scrollHeight+h+"px",d=c.clientWidth,C.forEach(function(D){D.node.scrollTop=D.scrollTop}),O&&(document.documentElement.scrollTop=O)}}function f(){T();var C=Math.round(parseFloat(c.style.height)),O=window.getComputedStyle(c,null),D=O.boxSizing==="content-box"?Math.round(parseFloat(O.height)):c.offsetHeight;if(D<C?O.overflowY==="hidden"&&(x("scroll"),T(),D=O.boxSizing==="content-box"?Math.round(parseFloat(window.getComputedStyle(c,null).height)):c.offsetHeight):O.overflowY!=="hidden"&&(x("hidden"),T(),D=O.boxSizing==="content-box"?Math.round(parseFloat(window.getComputedStyle(c,null).height)):c.offsetHeight),g!==D){g=D;var I=o("autosize:resized");try{c.dispatchEvent(I)}catch{}}}var E=function(){c.clientWidth!==d&&f()},A=function(C){window.removeEventListener("resize",E,!1),c.removeEventListener("input",f,!1),c.removeEventListener("keyup",f,!1),c.removeEventListener("autosize:destroy",A,!1),c.removeEventListener("autosize:update",f,!1),Object.keys(C).forEach(function(O){c.style[O]=C[O]}),r.delete(c)}.bind(c,{height:c.style.height,resize:c.style.resize,overflowY:c.style.overflowY,overflowX:c.style.overflowX,wordWrap:c.style.wordWrap});c.addEventListener("autosize:destroy",A,!1),"onpropertychange"in c&&"oninput"in c&&c.addEventListener("keyup",f,!1),window.addEventListener("resize",E,!1),c.addEventListener("input",f,!1),c.addEventListener("autosize:update",f,!1),c.style.overflowX="hidden",c.style.wordWrap="break-word",r.set(c,{destroy:A,update:f}),y()}function a(c){var h=r.get(c);h&&h.destroy()}function l(c){var h=r.get(c);h&&h.update()}var u=null;typeof window=="undefined"||typeof window.getComputedStyle!="function"?(u=function(h){return h},u.destroy=function(c){return c},u.update=function(c){return c}):(u=function(h,d){return h&&Array.prototype.forEach.call(h.length?h:[h],function(g){return s(g)}),h},u.destroy=function(c){return c&&Array.prototype.forEach.call(c.length?c:[c],a),c},u.update=function(c){return c&&Array.prototype.forEach.call(c.length?c:[c],l),c}),n.default=u,e.exports=n.default})})(bo,bo.exports);var L0=function(i,t,e){return e=window.getComputedStyle,(e?e(i):i.currentStyle)[t.replace(/-(\w)/gi,function(n,r){return r.toUpperCase()})]},B0=L0,So=B0;function I0(i){var t=So(i,"line-height"),e=parseFloat(t,10);if(t===e+""){var n=i.style.lineHeight;i.style.lineHeight=t+"em",t=So(i,"line-height"),e=parseFloat(t,10),n?i.style.lineHeight=n:delete i.style.lineHeight}if(t.indexOf("pt")!==-1?(e*=4,e/=3):t.indexOf("mm")!==-1?(e*=96,e/=25.4):t.indexOf("cm")!==-1?(e*=96,e/=2.54):t.indexOf("in")!==-1?e*=96:t.indexOf("pc")!==-1&&(e*=16),e=Math.round(e),t==="normal"){var r=i.nodeName,o=document.createElement(r);o.innerHTML="&nbsp;",r.toUpperCase()==="TEXTAREA"&&o.setAttribute("rows","1");var s=So(i,"font-size");o.style.fontSize=s,o.style.padding="0px",o.style.border="0px";var a=document.body;a.appendChild(o);var l=o.offsetHeight;e=l,a.removeChild(o)}return e}var N0=I0,H0=_t&&_t.__extends||function(){var i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(t,e){i(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),Eo=_t&&_t.__assign||Object.assign||function(i){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(i[r]=t[r])}return i},z0=_t&&_t.__rest||function(i,t){var e={};for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&t.indexOf(n)<0&&(e[n]=i[n]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,n=Object.getOwnPropertySymbols(i);r<n.length;r++)t.indexOf(n[r])<0&&(e[n[r]]=i[n[r]]);return e};wo.__esModule=!0;var bi=Yt,kn=Tn.exports,Si=bo.exports,V0=N0,U0=V0,Xu="autosize:resized",W0=function(i){H0(t,i);function t(){var e=i!==null&&i.apply(this,arguments)||this;return e.state={lineHeight:null},e.textarea=null,e.onResize=function(n){e.props.onResize&&e.props.onResize(n)},e.updateLineHeight=function(){e.textarea&&e.setState({lineHeight:U0(e.textarea)})},e.onChange=function(n){var r=e.props.onChange;e.currentValue=n.currentTarget.value,r&&r(n)},e}return t.prototype.componentDidMount=function(){var e=this,n=this.props,r=n.maxRows,o=n.async;typeof r=="number"&&this.updateLineHeight(),typeof r=="number"||o?setTimeout(function(){return e.textarea&&Si(e.textarea)}):this.textarea&&Si(this.textarea),this.textarea&&this.textarea.addEventListener(Xu,this.onResize)},t.prototype.componentWillUnmount=function(){this.textarea&&(this.textarea.removeEventListener(Xu,this.onResize),Si.destroy(this.textarea))},t.prototype.render=function(){var e=this,n=this,r=n.props;r.onResize;var o=r.maxRows;r.onChange;var s=r.style;r.innerRef;var a=r.children,l=z0(r,["onResize","maxRows","onChange","style","innerRef","children"]),u=n.state.lineHeight,c=o&&u?u*o:null;return bi.createElement("textarea",Eo({},l,{onChange:this.onChange,style:c?Eo({},s,{maxHeight:c}):s,ref:function(h){e.textarea=h,typeof e.props.innerRef=="function"?e.props.innerRef(h):e.props.innerRef&&(e.props.innerRef.current=h)}}),a)},t.prototype.componentDidUpdate=function(){this.textarea&&Si.update(this.textarea)},t.defaultProps={rows:1,async:!1},t.propTypes={rows:kn.number,maxRows:kn.number,onResize:kn.func,innerRef:kn.any,async:kn.bool},t}(bi.Component);wo.TextareaAutosize=bi.forwardRef(function(i,t){return bi.createElement(W0,Eo({},i,{innerRef:t}))}),function(i){i.__esModule=!0;var t=wo;i.default=t.TextareaAutosize}(qu);var j0=_d(qu);class Yu extends Pe{constructor(e){super(e);P(this,"onKeyDown",e=>{e.which===13&&e.ctrlKey&&this.props.onSaveAndClose()});P(this,"onKeyUp",e=>{e.which===46&&e.stopPropagation()});this.element=ur()}componentDidMount(){this.props.focus&&this.element.current&&this.element.current.focus({preventScroll:!0})}render(){return k.createElement(j0,{ref:this.element,className:"r6o-editable-text",value:this.props.content,placeholder:this.props.placeholder||Ze.t("Add a comment..."),disabled:!this.props.editable,onChange:this.props.onChange,onKeyUp:this.onKeyUp,onKeyDown:this.onKeyDown})}}function ne(){return ne=Object.assign?Object.assign.bind():function(i){for(var t=1;t<arguments.length;t++){var e=arguments[t];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(i[n]=e[n])}return i},ne.apply(this,arguments)}function G0(i){if(i.sheet)return i.sheet;for(var t=0;t<document.styleSheets.length;t++)if(document.styleSheets[t].ownerNode===i)return document.styleSheets[t]}function q0(i){var t=document.createElement("style");return t.setAttribute("data-emotion",i.key),i.nonce!==void 0&&t.setAttribute("nonce",i.nonce),t.appendChild(document.createTextNode("")),t.setAttribute("data-s",""),t}var X0=function(){function i(e){var n=this;this._insertTag=function(r){var o;n.tags.length===0?n.insertionPoint?o=n.insertionPoint.nextSibling:n.prepend?o=n.container.firstChild:o=n.before:o=n.tags[n.tags.length-1].nextSibling,n.container.insertBefore(r,o),n.tags.push(r)},this.isSpeedy=e.speedy===void 0?!0:e.speedy,this.tags=[],this.ctr=0,this.nonce=e.nonce,this.key=e.key,this.container=e.container,this.prepend=e.prepend,this.insertionPoint=e.insertionPoint,this.before=null}var t=i.prototype;return t.hydrate=function(n){n.forEach(this._insertTag)},t.insert=function(n){this.ctr%(this.isSpeedy?65e3:1)===0&&this._insertTag(q0(this));var r=this.tags[this.tags.length-1];if(this.isSpeedy){var o=G0(r);try{o.insertRule(n,o.cssRules.length)}catch{}}else r.appendChild(document.createTextNode(n));this.ctr++},t.flush=function(){this.tags.forEach(function(n){return n.parentNode&&n.parentNode.removeChild(n)}),this.tags=[],this.ctr=0},i}(),je="-ms-",Ei="-moz-",ve="-webkit-",Zu="comm",xo="rule",_o="decl",Y0="@import",Ku="@keyframes",Z0="@layer",K0=Math.abs,xi=String.fromCharCode,J0=Object.assign;function Q0(i,t){return Ie(i,0)^45?(((t<<2^Ie(i,0))<<2^Ie(i,1))<<2^Ie(i,2))<<2^Ie(i,3):0}function Ju(i){return i.trim()}function $0(i,t){return(i=t.exec(i))?i[0]:i}function ye(i,t,e){return i.replace(t,e)}function To(i,t){return i.indexOf(t)}function Ie(i,t){return i.charCodeAt(t)|0}function Ln(i,t,e){return i.slice(t,e)}function ct(i){return i.length}function Co(i){return i.length}function _i(i,t){return t.push(i),i}function ew(i,t){return i.map(t).join("")}var Ti=1,sn=1,Qu=0,Ge=0,Ce=0,an="";function Ci(i,t,e,n,r,o,s){return{value:i,root:t,parent:e,type:n,props:r,children:o,line:Ti,column:sn,length:s,return:""}}function Bn(i,t){return J0(Ci("",null,null,"",null,null,0),i,{length:-i.length},t)}function tw(){return Ce}function nw(){return Ce=Ge>0?Ie(an,--Ge):0,sn--,Ce===10&&(sn=1,Ti--),Ce}function Ke(){return Ce=Ge<Qu?Ie(an,Ge++):0,sn++,Ce===10&&(sn=1,Ti++),Ce}function ht(){return Ie(an,Ge)}function Pi(){return Ge}function In(i,t){return Ln(an,i,t)}function Nn(i){switch(i){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function $u(i){return Ti=sn=1,Qu=ct(an=i),Ge=0,[]}function ec(i){return an="",i}function Ai(i){return Ju(In(Ge-1,Po(i===91?i+2:i===40?i+1:i)))}function iw(i){for(;(Ce=ht())&&Ce<33;)Ke();return Nn(i)>2||Nn(Ce)>3?"":" "}function rw(i,t){for(;--t&&Ke()&&!(Ce<48||Ce>102||Ce>57&&Ce<65||Ce>70&&Ce<97););return In(i,Pi()+(t<6&&ht()==32&&Ke()==32))}function Po(i){for(;Ke();)switch(Ce){case i:return Ge;case 34:case 39:i!==34&&i!==39&&Po(Ce);break;case 40:i===41&&Po(i);break;case 92:Ke();break}return Ge}function ow(i,t){for(;Ke()&&i+Ce!==47+10;)if(i+Ce===42+42&&ht()===47)break;return"/*"+In(t,Ge-1)+"*"+xi(i===47?i:Ke())}function sw(i){for(;!Nn(ht());)Ke();return In(i,Ge)}function aw(i){return ec(Oi("",null,null,null,[""],i=$u(i),0,[0],i))}function Oi(i,t,e,n,r,o,s,a,l){for(var u=0,c=0,h=s,d=0,g=0,y=0,x=1,b=1,T=1,f=0,E="",A=r,C=o,O=n,D=E;b;)switch(y=f,f=Ke()){case 40:if(y!=108&&Ie(D,h-1)==58){To(D+=ye(Ai(f),"&","&\f"),"&\f")!=-1&&(T=-1);break}case 34:case 39:case 91:D+=Ai(f);break;case 9:case 10:case 13:case 32:D+=iw(y);break;case 92:D+=rw(Pi()-1,7);continue;case 47:switch(ht()){case 42:case 47:_i(lw(ow(Ke(),Pi()),t,e),l);break;default:D+="/"}break;case 123*x:a[u++]=ct(D)*T;case 125*x:case 59:case 0:switch(f){case 0:case 125:b=0;case 59+c:T==-1&&(D=ye(D,/\f/g,"")),g>0&&ct(D)-h&&_i(g>32?nc(D+";",n,e,h-1):nc(ye(D," ","")+";",n,e,h-2),l);break;case 59:D+=";";default:if(_i(O=tc(D,t,e,u,c,r,a,E,A=[],C=[],h),o),f===123)if(c===0)Oi(D,t,O,O,A,o,h,a,C);else switch(d===99&&Ie(D,3)===110?100:d){case 100:case 108:case 109:case 115:Oi(i,O,O,n&&_i(tc(i,O,O,0,0,r,a,E,r,A=[],h),C),r,C,h,a,n?A:C);break;default:Oi(D,O,O,O,[""],C,0,a,C)}}u=c=g=0,x=T=1,E=D="",h=s;break;case 58:h=1+ct(D),g=y;default:if(x<1){if(f==123)--x;else if(f==125&&x++==0&&nw()==125)continue}switch(D+=xi(f),f*x){case 38:T=c>0?1:(D+="\f",-1);break;case 44:a[u++]=(ct(D)-1)*T,T=1;break;case 64:ht()===45&&(D+=Ai(Ke())),d=ht(),c=h=ct(E=D+=sw(Pi())),f++;break;case 45:y===45&&ct(D)==2&&(x=0)}}return o}function tc(i,t,e,n,r,o,s,a,l,u,c){for(var h=r-1,d=r===0?o:[""],g=Co(d),y=0,x=0,b=0;y<n;++y)for(var T=0,f=Ln(i,h+1,h=K0(x=s[y])),E=i;T<g;++T)(E=Ju(x>0?d[T]+" "+f:ye(f,/&\f/g,d[T])))&&(l[b++]=E);return Ci(i,t,e,r===0?xo:a,l,u,c)}function lw(i,t,e){return Ci(i,t,e,Zu,xi(tw()),Ln(i,2,-2),0)}function nc(i,t,e,n){return Ci(i,t,e,_o,Ln(i,0,n),Ln(i,n+1,-1),n)}function ln(i,t){for(var e="",n=Co(i),r=0;r<n;r++)e+=t(i[r],r,i,t)||"";return e}function uw(i,t,e,n){switch(i.type){case Z0:if(i.children.length)break;case Y0:case _o:return i.return=i.return||i.value;case Zu:return"";case Ku:return i.return=i.value+"{"+ln(i.children,n)+"}";case xo:i.value=i.props.join(",")}return ct(e=ln(i.children,n))?i.return=i.value+"{"+e+"}":""}function cw(i){var t=Co(i);return function(e,n,r,o){for(var s="",a=0;a<t;a++)s+=i[a](e,n,r,o)||"";return s}}function hw(i){return function(t){t.root||(t=t.return)&&i(t)}}function dw(i){var t=Object.create(null);return function(e){return t[e]===void 0&&(t[e]=i(e)),t[e]}}var fw=function(t,e,n){for(var r=0,o=0;r=o,o=ht(),r===38&&o===12&&(e[n]=1),!Nn(o);)Ke();return In(t,Ge)},pw=function(t,e){var n=-1,r=44;do switch(Nn(r)){case 0:r===38&&ht()===12&&(e[n]=1),t[n]+=fw(Ge-1,e,n);break;case 2:t[n]+=Ai(r);break;case 4:if(r===44){t[++n]=ht()===58?"&\f":"",e[n]=t[n].length;break}default:t[n]+=xi(r)}while(r=Ke());return t},mw=function(t,e){return ec(pw($u(t),e))},ic=new WeakMap,gw=function(t){if(!(t.type!=="rule"||!t.parent||t.length<1)){for(var e=t.value,n=t.parent,r=t.column===n.column&&t.line===n.line;n.type!=="rule";)if(n=n.parent,!n)return;if(!(t.props.length===1&&e.charCodeAt(0)!==58&&!ic.get(n))&&!r){ic.set(t,!0);for(var o=[],s=mw(e,o),a=n.props,l=0,u=0;l<s.length;l++)for(var c=0;c<a.length;c++,u++)t.props[u]=o[l]?s[l].replace(/&\f/g,a[c]):a[c]+" "+s[l]}}},vw=function(t){if(t.type==="decl"){var e=t.value;e.charCodeAt(0)===108&&e.charCodeAt(2)===98&&(t.return="",t.value="")}};function rc(i,t){switch(Q0(i,t)){case 5103:return ve+"print-"+i+i;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return ve+i+i;case 5349:case 4246:case 4810:case 6968:case 2756:return ve+i+Ei+i+je+i+i;case 6828:case 4268:return ve+i+je+i+i;case 6165:return ve+i+je+"flex-"+i+i;case 5187:return ve+i+ye(i,/(\w+).+(:[^]+)/,ve+"box-$1$2"+je+"flex-$1$2")+i;case 5443:return ve+i+je+"flex-item-"+ye(i,/flex-|-self/,"")+i;case 4675:return ve+i+je+"flex-line-pack"+ye(i,/align-content|flex-|-self/,"")+i;case 5548:return ve+i+je+ye(i,"shrink","negative")+i;case 5292:return ve+i+je+ye(i,"basis","preferred-size")+i;case 6060:return ve+"box-"+ye(i,"-grow","")+ve+i+je+ye(i,"grow","positive")+i;case 4554:return ve+ye(i,/([^-])(transform)/g,"$1"+ve+"$2")+i;case 6187:return ye(ye(ye(i,/(zoom-|grab)/,ve+"$1"),/(image-set)/,ve+"$1"),i,"")+i;case 5495:case 3959:return ye(i,/(image-set\([^]*)/,ve+"$1$`$1");case 4968:return ye(ye(i,/(.+:)(flex-)?(.*)/,ve+"box-pack:$3"+je+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+ve+i+i;case 4095:case 3583:case 4068:case 2532:return ye(i,/(.+)-inline(.+)/,ve+"$1$2")+i;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(ct(i)-1-t>6)switch(Ie(i,t+1)){case 109:if(Ie(i,t+4)!==45)break;case 102:return ye(i,/(.+:)(.+)-([^]+)/,"$1"+ve+"$2-$3$1"+Ei+(Ie(i,t+3)==108?"$3":"$2-$3"))+i;case 115:return~To(i,"stretch")?rc(ye(i,"stretch","fill-available"),t)+i:i}break;case 4949:if(Ie(i,t+1)!==115)break;case 6444:switch(Ie(i,ct(i)-3-(~To(i,"!important")&&10))){case 107:return ye(i,":",":"+ve)+i;case 101:return ye(i,/(.+:)([^;!]+)(;|!.+)?/,"$1"+ve+(Ie(i,14)===45?"inline-":"")+"box$3$1"+ve+"$2$3$1"+je+"$2box$3")+i}break;case 5936:switch(Ie(i,t+11)){case 114:return ve+i+je+ye(i,/[svh]\w+-[tblr]{2}/,"tb")+i;case 108:return ve+i+je+ye(i,/[svh]\w+-[tblr]{2}/,"tb-rl")+i;case 45:return ve+i+je+ye(i,/[svh]\w+-[tblr]{2}/,"lr")+i}return ve+i+je+i+i}return i}var yw=function(t,e,n,r){if(t.length>-1&&!t.return)switch(t.type){case _o:t.return=rc(t.value,t.length);break;case Ku:return ln([Bn(t,{value:ye(t.value,"@","@"+ve)})],r);case xo:if(t.length)return ew(t.props,function(o){switch($0(o,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return ln([Bn(t,{props:[ye(o,/:(read-\w+)/,":"+Ei+"$1")]})],r);case"::placeholder":return ln([Bn(t,{props:[ye(o,/:(plac\w+)/,":"+ve+"input-$1")]}),Bn(t,{props:[ye(o,/:(plac\w+)/,":"+Ei+"$1")]}),Bn(t,{props:[ye(o,/:(plac\w+)/,je+"input-$1")]})],r)}return""})}},ww=[yw],bw=function(t){var e=t.key;if(e==="css"){var n=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(n,function(x){var b=x.getAttribute("data-emotion");b.indexOf(" ")!==-1&&(document.head.appendChild(x),x.setAttribute("data-s",""))})}var r=t.stylisPlugins||ww,o={},s,a=[];s=t.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+e+' "]'),function(x){for(var b=x.getAttribute("data-emotion").split(" "),T=1;T<b.length;T++)o[b[T]]=!0;a.push(x)});var l,u=[gw,vw];{var c,h=[uw,hw(function(x){c.insert(x)})],d=cw(u.concat(r,h)),g=function(b){return ln(aw(b),d)};l=function(b,T,f,E){c=f,g(b?b+"{"+T.styles+"}":T.styles),E&&(y.inserted[T.name]=!0)}}var y={key:e,sheet:new X0({key:e,container:s,nonce:t.nonce,speedy:t.speedy,prepend:t.prepend,insertionPoint:t.insertionPoint}),nonce:t.nonce,inserted:o,registered:{},insert:l};return y.sheet.hydrate(a),y},oc={exports:{}},be={};/** @license React v16.13.1
* react-is.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var Re=typeof Symbol=="function"&&Symbol.for,Ao=Re?Symbol.for("react.element"):60103,Oo=Re?Symbol.for("react.portal"):60106,Di=Re?Symbol.for("react.fragment"):60107,Ri=Re?Symbol.for("react.strict_mode"):60108,Mi=Re?Symbol.for("react.profiler"):60114,Fi=Re?Symbol.for("react.provider"):60109,ki=Re?Symbol.for("react.context"):60110,Do=Re?Symbol.for("react.async_mode"):60111,Li=Re?Symbol.for("react.concurrent_mode"):60111,Bi=Re?Symbol.for("react.forward_ref"):60112,Ii=Re?Symbol.for("react.suspense"):60113,Sw=Re?Symbol.for("react.suspense_list"):60120,Ni=Re?Symbol.for("react.memo"):60115,Hi=Re?Symbol.for("react.lazy"):60116,Ew=Re?Symbol.for("react.block"):60121,xw=Re?Symbol.for("react.fundamental"):60117,_w=Re?Symbol.for("react.responder"):60118,Tw=Re?Symbol.for("react.scope"):60119;function Je(i){if(typeof i=="object"&&i!==null){var t=i.$$typeof;switch(t){case Ao:switch(i=i.type,i){case Do:case Li:case Di:case Mi:case Ri:case Ii:return i;default:switch(i=i&&i.$$typeof,i){case ki:case Bi:case Hi:case Ni:case Fi:return i;default:return t}}case Oo:return t}}}function sc(i){return Je(i)===Li}be.AsyncMode=Do,be.ConcurrentMode=Li,be.ContextConsumer=ki,be.ContextProvider=Fi,be.Element=Ao,be.ForwardRef=Bi,be.Fragment=Di,be.Lazy=Hi,be.Memo=Ni,be.Portal=Oo,be.Profiler=Mi,be.StrictMode=Ri,be.Suspense=Ii,be.isAsyncMode=function(i){return sc(i)||Je(i)===Do},be.isConcurrentMode=sc,be.isContextConsumer=function(i){return Je(i)===ki},be.isContextProvider=function(i){return Je(i)===Fi},be.isElement=function(i){return typeof i=="object"&&i!==null&&i.$$typeof===Ao},be.isForwardRef=function(i){return Je(i)===Bi},be.isFragment=function(i){return Je(i)===Di},be.isLazy=function(i){return Je(i)===Hi},be.isMemo=function(i){return Je(i)===Ni},be.isPortal=function(i){return Je(i)===Oo},be.isProfiler=function(i){return Je(i)===Mi},be.isStrictMode=function(i){return Je(i)===Ri},be.isSuspense=function(i){return Je(i)===Ii},be.isValidElementType=function(i){return typeof i=="string"||typeof i=="function"||i===Di||i===Li||i===Mi||i===Ri||i===Ii||i===Sw||typeof i=="object"&&i!==null&&(i.$$typeof===Hi||i.$$typeof===Ni||i.$$typeof===Fi||i.$$typeof===ki||i.$$typeof===Bi||i.$$typeof===xw||i.$$typeof===_w||i.$$typeof===Tw||i.$$typeof===Ew)},be.typeOf=Je,oc.exports=be;var ac=oc.exports,Cw={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},Pw={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},lc={};lc[ac.ForwardRef]=Cw,lc[ac.Memo]=Pw;var Aw=!0;function uc(i,t,e){var n="";return e.split(" ").forEach(function(r){i[r]!==void 0?t.push(i[r]+";"):n+=r+" "}),n}var Ro=function(t,e,n){var r=t.key+"-"+e.name;(n===!1||Aw===!1)&&t.registered[r]===void 0&&(t.registered[r]=e.styles)},cc=function(t,e,n){Ro(t,e,n);var r=t.key+"-"+e.name;if(t.inserted[e.name]===void 0){var o=e;do t.insert(e===o?"."+r:"",o,t.sheet,!0),o=o.next;while(o!==void 0)}};function Ow(i){for(var t=0,e,n=0,r=i.length;r>=4;++n,r-=4)e=i.charCodeAt(n)&255|(i.charCodeAt(++n)&255)<<8|(i.charCodeAt(++n)&255)<<16|(i.charCodeAt(++n)&255)<<24,e=(e&65535)*1540483477+((e>>>16)*59797<<16),e^=e>>>24,t=(e&65535)*1540483477+((e>>>16)*59797<<16)^(t&65535)*1540483477+((t>>>16)*59797<<16);switch(r){case 3:t^=(i.charCodeAt(n+2)&255)<<16;case 2:t^=(i.charCodeAt(n+1)&255)<<8;case 1:t^=i.charCodeAt(n)&255,t=(t&65535)*1540483477+((t>>>16)*59797<<16)}return t^=t>>>13,t=(t&65535)*1540483477+((t>>>16)*59797<<16),((t^t>>>15)>>>0).toString(36)}var Dw={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},Rw=/[A-Z]|^ms/g,Mw=/_EMO_([^_]+?)_([^]*?)_EMO_/g,hc=function(t){return t.charCodeAt(1)===45},dc=function(t){return t!=null&&typeof t!="boolean"},Mo=dw(function(i){return hc(i)?i:i.replace(Rw,"-$&").toLowerCase()}),fc=function(t,e){switch(t){case"animation":case"animationName":if(typeof e=="string")return e.replace(Mw,function(n,r,o){return dt={name:r,styles:o,next:dt},r})}return Dw[t]!==1&&!hc(t)&&typeof e=="number"&&e!==0?e+"px":e},R1="Component selectors can only be used in conjunction with @emotion/babel-plugin, the swc Emotion plugin, or another Emotion-aware compiler transform.";function Hn(i,t,e){if(e==null)return"";if(e.__emotion_styles!==void 0)return e;switch(typeof e){case"boolean":return"";case"object":{if(e.anim===1)return dt={name:e.name,styles:e.styles,next:dt},e.name;if(e.styles!==void 0){var n=e.next;if(n!==void 0)for(;n!==void 0;)dt={name:n.name,styles:n.styles,next:dt},n=n.next;var r=e.styles+";";return r}return Fw(i,t,e)}case"function":{if(i!==void 0){var o=dt,s=e(i);return dt=o,Hn(i,t,s)}break}}if(t==null)return e;var a=t[e];return a!==void 0?a:e}function Fw(i,t,e){var n="";if(Array.isArray(e))for(var r=0;r<e.length;r++)n+=Hn(i,t,e[r])+";";else for(var o in e){var s=e[o];if(typeof s!="object")t!=null&&t[s]!==void 0?n+=o+"{"+t[s]+"}":dc(s)&&(n+=Mo(o)+":"+fc(o,s)+";");else if(Array.isArray(s)&&typeof s[0]=="string"&&(t==null||t[s[0]]===void 0))for(var a=0;a<s.length;a++)dc(s[a])&&(n+=Mo(o)+":"+fc(o,s[a])+";");else{var l=Hn(i,t,s);switch(o){case"animation":case"animationName":{n+=Mo(o)+":"+l+";";break}default:n+=o+"{"+l+"}"}}}return n}var pc=/label:\s*([^\s;\n{]+)\s*(;|$)/g,dt,Fo=function(t,e,n){if(t.length===1&&typeof t[0]=="object"&&t[0]!==null&&t[0].styles!==void 0)return t[0];var r=!0,o="";dt=void 0;var s=t[0];s==null||s.raw===void 0?(r=!1,o+=Hn(n,e,s)):o+=s[0];for(var a=1;a<t.length;a++)o+=Hn(n,e,t[a]),r&&(o+=s[a]);pc.lastIndex=0;for(var l="",u;(u=pc.exec(o))!==null;)l+="-"+u[1];var c=Ow(o)+l;return{name:c,styles:o,next:dt}},kw=function(t){return t()},Lw=Sr["useInsertionEffect"]?Sr["useInsertionEffect"]:!1,mc=Lw||kw,ko={}.hasOwnProperty,gc=Sn(typeof HTMLElement!="undefined"?bw({key:"css"}):null);gc.Provider;var vc=function(t){return yr(function(e,n){var r=En(gc);return t(e,r,n)})},yc=Sn({}),Lo="__EMOTION_TYPE_PLEASE_DO_NOT_USE__",Bw=function(t,e){var n={};for(var r in e)ko.call(e,r)&&(n[r]=e[r]);return n[Lo]=t,n},Iw=function(t){var e=t.cache,n=t.serialized,r=t.isStringTag;return Ro(e,n,r),mc(function(){return cc(e,n,r)}),null},Nw=vc(function(i,t,e){var n=i.css;typeof n=="string"&&t.registered[n]!==void 0&&(n=t.registered[n]);var r=i[Lo],o=[n],s="";typeof i.className=="string"?s=uc(t.registered,o,i.className):i.className!=null&&(s=i.className+" ");var a=Fo(o,void 0,En(yc));s+=t.key+"-"+a.name;var l={};for(var u in i)ko.call(i,u)&&u!=="css"&&u!==Lo&&(l[u]=i[u]);return l.ref=e,l.className=s,Oe(nt,null,Oe(Iw,{cache:t,serialized:a,isStringTag:typeof r=="string"}),Oe(r,l))}),Hw=Nw,ie=function(t,e){var n=arguments;if(e==null||!ko.call(e,"css"))return Oe.apply(void 0,n);var r=n.length,o=new Array(r);o[0]=Hw,o[1]=Bw(t,e);for(var s=2;s<r;s++)o[s]=n[s];return Oe.apply(null,o)};function Bo(){for(var i=arguments.length,t=new Array(i),e=0;e<i;e++)t[e]=arguments[e];return Fo(t)}var zw=function(){var t=Bo.apply(void 0,arguments),e="animation-"+t.name;return{name:e,styles:"@keyframes "+e+"{"+t.styles+"}",anim:1,toString:function(){return"_EMO_"+this.name+"_"+this.styles+"_EMO_"}}},Vw=function i(t){for(var e=t.length,n=0,r="";n<e;n++){var o=t[n];if(o!=null){var s=void 0;switch(typeof o){case"boolean":break;case"object":{if(Array.isArray(o))s=i(o);else{s="";for(var a in o)o[a]&&a&&(s&&(s+=" "),s+=a)}break}default:s=o}s&&(r&&(r+=" "),r+=s)}}return r};function Uw(i,t,e){var n=[],r=uc(i,n,e);return n.length<2?e:r+t(n)}var Ww=function(t){var e=t.cache,n=t.serializedArr;return mc(function(){for(var r=0;r<n.length;r++)cc(e,n[r],!1)}),null},jw=vc(function(i,t){var e=!1,n=[],r=function(){for(var u=arguments.length,c=new Array(u),h=0;h<u;h++)c[h]=arguments[h];var d=Fo(c,t.registered);return n.push(d),Ro(t,d,!1),t.key+"-"+d.name},o=function(){for(var u=arguments.length,c=new Array(u),h=0;h<u;h++)c[h]=arguments[h];return Uw(t.registered,r,Vw(c))},s={css:r,cx:o,theme:En(yc)},a=i.children(s);return e=!0,Oe(nt,null,Oe(Ww,{cache:t,serializedArr:n}),a)});function Gw(i,t){return t||(t=i.slice(0)),Object.freeze(Object.defineProperties(i,{raw:{value:Object.freeze(t)}}))}function Io(i,t){if(i==null)return{};var e={},n=Object.keys(i),r,o;for(o=0;o<n.length;o++)r=n[o],!(t.indexOf(r)>=0)&&(e[r]=i[r]);return e}function un(i,t){if(i==null)return{};var e=Io(i,t),n,r;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(i);for(r=0;r<o.length;r++)n=o[r],!(t.indexOf(n)>=0)&&(!Object.prototype.propertyIsEnumerable.call(i,n)||(e[n]=i[n]))}return e}function cn(i){return cn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},cn(i)}var wc={};Object.defineProperty(wc,"__esModule",{value:!0});var No=Object.assign||function(i){for(var t=1;t<arguments.length;t++){var e=arguments[t];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(i[n]=e[n])}return i},bc=function(){function i(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(t,e,n){return e&&i(t.prototype,e),n&&i(t,n),t}}(),Sc=Yt,zn=Ec(Sc),qw=Tn.exports,Ae=Ec(qw);function Ec(i){return i&&i.__esModule?i:{default:i}}function Xw(i,t){var e={};for(var n in i)t.indexOf(n)>=0||!Object.prototype.hasOwnProperty.call(i,n)||(e[n]=i[n]);return e}function Yw(i,t){if(!(i instanceof t))throw new TypeError("Cannot call a class as a function")}function Zw(i,t){if(!i)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&(typeof t=="object"||typeof t=="function")?t:i}function Kw(i,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof t);i.prototype=Object.create(t&&t.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(i,t):i.__proto__=t)}var xc={position:"absolute",top:0,left:0,visibility:"hidden",height:0,overflow:"scroll",whiteSpace:"pre"},Jw=["extraWidth","injectStyles","inputClassName","inputRef","inputStyle","minWidth","onAutosize","placeholderIsMinWidth"],Qw=function(t){return Jw.forEach(function(e){return delete t[e]}),t},_c=function(t,e){e.style.fontSize=t.fontSize,e.style.fontFamily=t.fontFamily,e.style.fontWeight=t.fontWeight,e.style.fontStyle=t.fontStyle,e.style.letterSpacing=t.letterSpacing,e.style.textTransform=t.textTransform},Tc=typeof window!="undefined"&&window.navigator?/MSIE |Trident\/|Edge\//.test(window.navigator.userAgent):!1,Cc=function(){return Tc?"_"+Math.random().toString(36).substr(2,12):void 0},Ho=function(i){Kw(t,i),bc(t,null,[{key:"getDerivedStateFromProps",value:function(n,r){var o=n.id;return o!==r.prevId?{inputId:o||Cc(),prevId:o}:null}}]);function t(e){Yw(this,t);var n=Zw(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.inputRef=function(r){n.input=r,typeof n.props.inputRef=="function"&&n.props.inputRef(r)},n.placeHolderSizerRef=function(r){n.placeHolderSizer=r},n.sizerRef=function(r){n.sizer=r},n.state={inputWidth:e.minWidth,inputId:e.id||Cc(),prevId:e.id},n}return bc(t,[{key:"componentDidMount",value:function(){this.mounted=!0,this.copyInputStyles(),this.updateInputWidth()}},{key:"componentDidUpdate",value:function(n,r){r.inputWidth!==this.state.inputWidth&&typeof this.props.onAutosize=="function"&&this.props.onAutosize(this.state.inputWidth),this.updateInputWidth()}},{key:"componentWillUnmount",value:function(){this.mounted=!1}},{key:"copyInputStyles",value:function(){if(!(!this.mounted||!window.getComputedStyle)){var n=this.input&&window.getComputedStyle(this.input);!n||(_c(n,this.sizer),this.placeHolderSizer&&_c(n,this.placeHolderSizer))}}},{key:"updateInputWidth",value:function(){if(!(!this.mounted||!this.sizer||typeof this.sizer.scrollWidth=="undefined")){var n=void 0;this.props.placeholder&&(!this.props.value||this.props.value&&this.props.placeholderIsMinWidth)?n=Math.max(this.sizer.scrollWidth,this.placeHolderSizer.scrollWidth)+2:n=this.sizer.scrollWidth+2;var r=this.props.type==="number"&&this.props.extraWidth===void 0?16:parseInt(this.props.extraWidth)||0;n+=r,n<this.props.minWidth&&(n=this.props.minWidth),n!==this.state.inputWidth&&this.setState({inputWidth:n})}}},{key:"getInput",value:function(){return this.input}},{key:"focus",value:function(){this.input.focus()}},{key:"blur",value:function(){this.input.blur()}},{key:"select",value:function(){this.input.select()}},{key:"renderStyles",value:function(){var n=this.props.injectStyles;return Tc&&n?zn.default.createElement("style",{dangerouslySetInnerHTML:{__html:"input#"+this.state.inputId+"::-ms-clear {display: none;}"}}):null}},{key:"render",value:function(){var n=[this.props.defaultValue,this.props.value,""].reduce(function(a,l){return a!=null?a:l}),r=No({},this.props.style);r.display||(r.display="inline-block");var o=No({boxSizing:"content-box",width:this.state.inputWidth+"px"},this.props.inputStyle),s=Xw(this.props,[]);return Qw(s),s.className=this.props.inputClassName,s.id=this.state.inputId,s.style=o,zn.default.createElement("div",{className:this.props.className,style:r},this.renderStyles(),zn.default.createElement("input",No({},s,{ref:this.inputRef})),zn.default.createElement("div",{ref:this.sizerRef,style:xc},n),this.props.placeholder?zn.default.createElement("div",{ref:this.placeHolderSizerRef,style:xc},this.props.placeholder):null)}}]),t}(Sc.Component);Ho.propTypes={className:Ae.default.string,defaultValue:Ae.default.any,extraWidth:Ae.default.oneOfType([Ae.default.number,Ae.default.string]),id:Ae.default.string,injectStyles:Ae.default.bool,inputClassName:Ae.default.string,inputRef:Ae.default.func,inputStyle:Ae.default.object,minWidth:Ae.default.oneOfType([Ae.default.number,Ae.default.string]),onAutosize:Ae.default.func,onChange:Ae.default.func,placeholder:Ae.default.string,placeholderIsMinWidth:Ae.default.bool,style:Ae.default.object,value:Ae.default.any},Ho.defaultProps={minWidth:1,injectStyles:!0};var $w=wc.default=Ho;function zi(i,t){if(!(i instanceof t))throw new TypeError("Cannot call a class as a function")}function eb(i,t){if(cn(i)!=="object"||i===null)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var n=e.call(i,t||"default");if(cn(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(i)}function Pc(i){var t=eb(i,"string");return cn(t)==="symbol"?t:String(t)}function Ac(i,t){for(var e=0;e<t.length;e++){var n=t[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(i,Pc(n.key),n)}}function Vi(i,t,e){return t&&Ac(i.prototype,t),e&&Ac(i,e),Object.defineProperty(i,"prototype",{writable:!1}),i}function Ui(i,t){return Ui=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},Ui(i,t)}function Wi(i,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");i.prototype=Object.create(t&&t.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),Object.defineProperty(i,"prototype",{writable:!1}),t&&Ui(i,t)}function wt(i,t,e){return t=Pc(t),t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}function tb(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}function Oc(i,t){var e=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);t&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),e.push.apply(e,n)}return e}function Ne(i){for(var t=1;t<arguments.length;t++){var e=arguments[t]!=null?arguments[t]:{};t%2?Oc(Object(e),!0).forEach(function(n){tb(i,n,e[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(e)):Oc(Object(e)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(e,n))})}return i}function ji(i){return ji=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},ji(i)}function nb(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}function ib(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function rb(i,t){return t&&(typeof t=="object"||typeof t=="function")?t:ib(i)}function Gi(i){var t=nb();return function(){var n=ji(i),r;if(t){var o=ji(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return rb(this,r)}}var qi=function(){};function ob(i,t){return t?t[0]==="-"?i+t:i+"__"+t:i}function sb(i,t,e){var n=[e];if(t&&i)for(var r in t)t.hasOwnProperty(r)&&t[r]&&n.push("".concat(ob(i,r)));return n.filter(function(o){return o}).map(function(o){return String(o).trim()}).join(" ")}var Dc=function(t){return Array.isArray(t)?t.filter(Boolean):cn(t)==="object"&&t!==null?[t]:[]},Rc=function(t){t.className,t.clearValue,t.cx,t.getStyles,t.getValue,t.hasValue,t.isMulti,t.isRtl,t.options,t.selectOption,t.selectProps,t.setValue,t.theme;var e=un(t,["className","clearValue","cx","getStyles","getValue","hasValue","isMulti","isRtl","options","selectOption","selectProps","setValue","theme"]);return Ne({},e)};function zo(i){return[document.documentElement,document.body,window].indexOf(i)>-1}function Mc(i){return zo(i)?window.pageYOffset:i.scrollTop}function Xi(i,t){if(zo(i)){window.scrollTo(0,t);return}i.scrollTop=t}function ab(i){var t=getComputedStyle(i),e=t.position==="absolute",n=/(auto|scroll)/,r=document.documentElement;if(t.position==="fixed")return r;for(var o=i;o=o.parentElement;)if(t=getComputedStyle(o),!(e&&t.position==="static")&&n.test(t.overflow+t.overflowY+t.overflowX))return o;return r}function lb(i,t,e,n){return e*((i=i/n-1)*i*i+1)+t}function Yi(i,t){var e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:200,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:qi,r=Mc(i),o=t-r,s=10,a=0;function l(){a+=s;var u=lb(a,r,o,e);Xi(i,u),a<e?window.requestAnimationFrame(l):n(i)}l()}function ub(i,t){var e=i.getBoundingClientRect(),n=t.getBoundingClientRect(),r=t.offsetHeight/3;n.bottom+r>e.bottom?Xi(i,Math.min(t.offsetTop+t.clientHeight-i.offsetHeight+r,i.scrollHeight)):n.top-r<e.top&&Xi(i,Math.max(t.offsetTop-r,0))}function cb(i){var t=i.getBoundingClientRect();return{bottom:t.bottom,height:t.height,left:t.left,right:t.right,top:t.top,width:t.width}}function Fc(){try{return document.createEvent("TouchEvent"),!0}catch{return!1}}function hb(){try{return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}catch{return!1}}var kc=!1,db={get passive(){return kc=!0}},Zi=typeof window!="undefined"?window:{};Zi.addEventListener&&Zi.removeEventListener&&(Zi.addEventListener("p",qi,db),Zi.removeEventListener("p",qi,!1));var fb=kc;function pb(i){var t=i.maxHeight,e=i.menuEl,n=i.minHeight,r=i.placement,o=i.shouldScroll,s=i.isFixedPosition,a=i.theme,l=a.spacing,u=ab(e),c={placement:"bottom",maxHeight:t};if(!e||!e.offsetParent)return c;var h=u.getBoundingClientRect(),d=h.height,g=e.getBoundingClientRect(),y=g.bottom,x=g.height,b=g.top,T=e.offsetParent.getBoundingClientRect(),f=T.top,E=window.innerHeight,A=Mc(u),C=parseInt(getComputedStyle(e).marginBottom,10),O=parseInt(getComputedStyle(e).marginTop,10),D=f-O,I=E-b,B=D+A,Z=d-A-b,Y=y-E+A+C,V=A+b-O,K=160;switch(r){case"auto":case"bottom":if(I>=x)return{placement:"bottom",maxHeight:t};if(Z>=x&&!s)return o&&Yi(u,Y,K),{placement:"bottom",maxHeight:t};if(!s&&Z>=n||s&&I>=n){o&&Yi(u,Y,K);var Q=s?I-C:Z-C;return{placement:"bottom",maxHeight:Q}}if(r==="auto"||s){var le=t,re=s?D:B;return re>=n&&(le=Math.min(re-C-l.controlHeight,t)),{placement:"top",maxHeight:le}}if(r==="bottom")return o&&Xi(u,Y),{placement:"bottom",maxHeight:t};break;case"top":if(D>=x)return{placement:"top",maxHeight:t};if(B>=x&&!s)return o&&Yi(u,V,K),{placement:"top",maxHeight:t};if(!s&&B>=n||s&&D>=n){var se=t;return(!s&&B>=n||s&&D>=n)&&(se=s?D-O:B-O),o&&Yi(u,V,K),{placement:"top",maxHeight:se}}return{placement:"bottom",maxHeight:t};default:throw new Error('Invalid placement provided "'.concat(r,'".'))}return c}function mb(i){var t={bottom:"top",top:"bottom"};return i?t[i]:"bottom"}var Vo=function(t){return t==="auto"?"bottom":t},gb=function(t){var e,n=t.placement,r=t.theme,o=r.borderRadius,s=r.spacing,a=r.colors;return e={label:"menu"},wt(e,mb(n),"100%"),wt(e,"backgroundColor",a.neutral0),wt(e,"borderRadius",o),wt(e,"boxShadow","0 0 0 1px hsla(0, 0%, 0%, 0.1), 0 4px 11px hsla(0, 0%, 0%, 0.1)"),wt(e,"marginBottom",s.menuGutter),wt(e,"marginTop",s.menuGutter),wt(e,"position","absolute"),wt(e,"width","100%"),wt(e,"zIndex",1),e},Lc=Sn({getPortalPlacement:null}),Bc=function(i){Wi(e,i);var t=Gi(e);function e(){var n;zi(this,e);for(var r=arguments.length,o=new Array(r),s=0;s<r;s++)o[s]=arguments[s];return n=t.call.apply(t,[this].concat(o)),n.state={maxHeight:n.props.maxMenuHeight,placement:null},n.getPlacement=function(a){var l=n.props,u=l.minMenuHeight,c=l.maxMenuHeight,h=l.menuPlacement,d=l.menuPosition,g=l.menuShouldScrollIntoView,y=l.theme;if(!!a){var x=d==="fixed",b=g&&!x,T=pb({maxHeight:c,menuEl:a,minHeight:u,placement:h,shouldScroll:b,isFixedPosition:x,theme:y}),f=n.context.getPortalPlacement;f&&f(T),n.setState(T)}},n.getUpdatedProps=function(){var a=n.props.menuPlacement,l=n.state.placement||Vo(a);return Ne(Ne({},n.props),{},{placement:l,maxHeight:n.state.maxHeight})},n}return Vi(e,[{key:"render",value:function(){var r=this.props.children;return r({ref:this.getPlacement,placerProps:this.getUpdatedProps()})}}]),e}(Pe);Bc.contextType=Lc;var vb=function(t){var e=t.children,n=t.className,r=t.cx,o=t.getStyles,s=t.innerRef,a=t.innerProps;return ie("div",ne({css:o("menu",t),className:r({menu:!0},n),ref:s},a),e)},yb=function(t){var e=t.maxHeight,n=t.theme.spacing.baseUnit;return{maxHeight:e,overflowY:"auto",paddingBottom:n,paddingTop:n,position:"relative",WebkitOverflowScrolling:"touch"}},wb=function(t){var e=t.children,n=t.className,r=t.cx,o=t.getStyles,s=t.innerProps,a=t.innerRef,l=t.isMulti;return ie("div",ne({css:o("menuList",t),className:r({"menu-list":!0,"menu-list--is-multi":l},n),ref:a},s),e)},Ic=function(t){var e=t.theme,n=e.spacing.baseUnit,r=e.colors;return{color:r.neutral40,padding:"".concat(n*2,"px ").concat(n*3,"px"),textAlign:"center"}},bb=Ic,Sb=Ic,Nc=function(t){var e=t.children,n=t.className,r=t.cx,o=t.getStyles,s=t.innerProps;return ie("div",ne({css:o("noOptionsMessage",t),className:r({"menu-notice":!0,"menu-notice--no-options":!0},n)},s),e)};Nc.defaultProps={children:"No options"};var Hc=function(t){var e=t.children,n=t.className,r=t.cx,o=t.getStyles,s=t.innerProps;return ie("div",ne({css:o("loadingMessage",t),className:r({"menu-notice":!0,"menu-notice--loading":!0},n)},s),e)};Hc.defaultProps={children:"Loading..."};var Eb=function(t){var e=t.rect,n=t.offset,r=t.position;return{left:e.left,position:r,top:n,width:e.width,zIndex:1}},xb=function(i){Wi(e,i);var t=Gi(e);function e(){var n;zi(this,e);for(var r=arguments.length,o=new Array(r),s=0;s<r;s++)o[s]=arguments[s];return n=t.call.apply(t,[this].concat(o)),n.state={placement:null},n.getPortalPlacement=function(a){var l=a.placement,u=Vo(n.props.menuPlacement);l!==u&&n.setState({placement:l})},n}return Vi(e,[{key:"render",value:function(){var r=this.props,o=r.appendTo,s=r.children,a=r.className,l=r.controlElement,u=r.cx,c=r.innerProps,h=r.menuPlacement,d=r.menuPosition,g=r.getStyles,y=d==="fixed";if(!o&&!y||!l)return null;var x=this.state.placement||Vo(h),b=cb(l),T=y?0:window.pageYOffset,f=b[x]+T,E={offset:f,position:d,rect:b},A=ie("div",ne({css:g("menuPortal",E),className:u({"menu-portal":!0},a)},c),s);return ie(Lc.Provider,{value:{getPortalPlacement:this.getPortalPlacement}},o?wr(A,o):A)}}]),e}(Pe),_b=function(t){var e=t.isDisabled,n=t.isRtl;return{label:"container",direction:n?"rtl":null,pointerEvents:e?"none":null,position:"relative"}},Tb=function(t){var e=t.children,n=t.className,r=t.cx,o=t.getStyles,s=t.innerProps,a=t.isDisabled,l=t.isRtl;return ie("div",ne({css:o("container",t),className:r({"--is-disabled":a,"--is-rtl":l},n)},s),e)},Cb=function(t){var e=t.theme.spacing;return{alignItems:"center",display:"flex",flex:1,flexWrap:"wrap",padding:"".concat(e.baseUnit/2,"px ").concat(e.baseUnit*2,"px"),WebkitOverflowScrolling:"touch",position:"relative",overflow:"hidden"}},Pb=function(t){var e=t.children,n=t.className,r=t.cx,o=t.innerProps,s=t.isMulti,a=t.getStyles,l=t.hasValue;return ie("div",ne({css:a("valueContainer",t),className:r({"value-container":!0,"value-container--is-multi":s,"value-container--has-value":l},n)},o),e)},Ab=function(){return{alignItems:"center",alignSelf:"stretch",display:"flex",flexShrink:0}},Ob=function(t){var e=t.children,n=t.className,r=t.cx,o=t.innerProps,s=t.getStyles;return ie("div",ne({css:s("indicatorsContainer",t),className:r({indicators:!0},n)},o),e)},zc,Db={name:"8mmkcg",styles:"display:inline-block;fill:currentColor;line-height:1;stroke:currentColor;stroke-width:0"},Vc=function(t){var e=t.size,n=un(t,["size"]);return ie("svg",ne({height:e,width:e,viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",css:Db},n))},Uo=function(t){return ie(Vc,ne({size:20},t),ie("path",{d:"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"}))},Uc=function(t){return ie(Vc,ne({size:20},t),ie("path",{d:"M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"}))},Wc=function(t){var e=t.isFocused,n=t.theme,r=n.spacing.baseUnit,o=n.colors;return{label:"indicatorContainer",color:e?o.neutral60:o.neutral20,display:"flex",padding:r*2,transition:"color 150ms",":hover":{color:e?o.neutral80:o.neutral40}}},Rb=Wc,Mb=function(t){var e=t.children,n=t.className,r=t.cx,o=t.getStyles,s=t.innerProps;return ie("div",ne({css:o("dropdownIndicator",t),className:r({indicator:!0,"dropdown-indicator":!0},n)},s),e||ie(Uc,null))},Fb=Wc,kb=function(t){var e=t.children,n=t.className,r=t.cx,o=t.getStyles,s=t.innerProps;return ie("div",ne({css:o("clearIndicator",t),className:r({indicator:!0,"clear-indicator":!0},n)},s),e||ie(Uo,null))},Lb=function(t){var e=t.isDisabled,n=t.theme,r=n.spacing.baseUnit,o=n.colors;return{label:"indicatorSeparator",alignSelf:"stretch",backgroundColor:e?o.neutral10:o.neutral20,marginBottom:r*2,marginTop:r*2,width:1}},Bb=function(t){var e=t.className,n=t.cx,r=t.getStyles,o=t.innerProps;return ie("span",ne({},o,{css:r("indicatorSeparator",t),className:n({"indicator-separator":!0},e)}))},Ib=zw(zc||(zc=Gw([`
0%, 80%, 100% { opacity: 0; }
40% { opacity: 1; }
`]))),Nb=function(t){var e=t.isFocused,n=t.size,r=t.theme,o=r.colors,s=r.spacing.baseUnit;return{label:"loadingIndicator",color:e?o.neutral60:o.neutral20,display:"flex",padding:s*2,transition:"color 150ms",alignSelf:"center",fontSize:n,lineHeight:1,marginRight:n,textAlign:"center",verticalAlign:"middle"}},Wo=function(t){var e=t.delay,n=t.offset;return ie("span",{css:Bo({animation:"".concat(Ib," 1s ease-in-out ").concat(e,"ms infinite;"),backgroundColor:"currentColor",borderRadius:"1em",display:"inline-block",marginLeft:n?"1em":null,height:"1em",verticalAlign:"top",width:"1em"},"","")})},jc=function(t){var e=t.className,n=t.cx,r=t.getStyles,o=t.innerProps,s=t.isRtl;return ie("div",ne({css:r("loadingIndicator",t),className:n({indicator:!0,"loading-indicator":!0},e)},o),ie(Wo,{delay:0,offset:s}),ie(Wo,{delay:160,offset:!0}),ie(Wo,{delay:320,offset:!s}))};jc.defaultProps={size:4};var Hb=function(t){var e=t.isDisabled,n=t.isFocused,r=t.theme,o=r.colors,s=r.borderRadius,a=r.spacing;return{label:"control",alignItems:"center",backgroundColor:e?o.neutral5:o.neutral0,borderColor:e?o.neutral10:n?o.primary:o.neutral20,borderRadius:s,borderStyle:"solid",borderWidth:1,boxShadow:n?"0 0 0 1px ".concat(o.primary):null,cursor:"default",display:"flex",flexWrap:"wrap",justifyContent:"space-between",minHeight:a.controlHeight,outline:"0 !important",position:"relative",transition:"all 100ms","&:hover":{borderColor:n?o.primary:o.neutral30}}},zb=function(t){var e=t.children,n=t.cx,r=t.getStyles,o=t.className,s=t.isDisabled,a=t.isFocused,l=t.innerRef,u=t.innerProps,c=t.menuIsOpen;return ie("div",ne({ref:l,css:r("control",t),className:n({control:!0,"control--is-disabled":s,"control--is-focused":a,"control--menu-is-open":c},o)},u),e)},Vb=function(t){var e=t.theme.spacing;return{paddingBottom:e.baseUnit*2,paddingTop:e.baseUnit*2}},Ub=function(t){var e=t.children,n=t.className,r=t.cx,o=t.getStyles,s=t.Heading,a=t.headingProps,l=t.innerProps,u=t.label,c=t.theme,h=t.selectProps;return ie("div",ne({css:o("group",t),className:r({group:!0},n)},l),ie(s,ne({},a,{selectProps:h,theme:c,getStyles:o,cx:r}),u),ie("div",null,e))},Wb=function(t){var e=t.theme.spacing;return{label:"group",color:"#999",cursor:"default",display:"block",fontSize:"75%",fontWeight:"500",marginBottom:"0.25em",paddingLeft:e.baseUnit*3,paddingRight:e.baseUnit*3,textTransform:"uppercase"}},jb=function(t){var e=t.getStyles,n=t.cx,r=t.className,o=Rc(t);o.data;var s=un(o,["data"]);return ie("div",ne({css:e("groupHeading",t),className:n({"group-heading":!0},r)},s))},Gb=function(t){var e=t.isDisabled,n=t.theme,r=n.spacing,o=n.colors;return{margin:r.baseUnit/2,paddingBottom:r.baseUnit/2,paddingTop:r.baseUnit/2,visibility:e?"hidden":"visible",color:o.neutral80}},qb=function(t){return{label:"input",background:0,border:0,fontSize:"inherit",opacity:t?0:1,outline:0,padding:0,color:"inherit"}},Xb=function(t){var e=t.className,n=t.cx,r=t.getStyles,o=Rc(t),s=o.innerRef,a=o.isDisabled,l=o.isHidden,u=un(o,["innerRef","isDisabled","isHidden"]);return ie("div",{css:r("input",t)},ie($w,ne({className:n({input:!0},e),inputRef:s,inputStyle:qb(l),disabled:a},u)))},Yb=function(t){var e=t.theme,n=e.spacing,r=e.borderRadius,o=e.colors;return{label:"multiValue",backgroundColor:o.neutral10,borderRadius:r/2,display:"flex",margin:n.baseUnit/2,minWidth:0}},Zb=function(t){var e=t.theme,n=e.borderRadius,r=e.colors,o=t.cropWithEllipsis;return{borderRadius:n/2,color:r.neutral80,fontSize:"85%",overflow:"hidden",padding:3,paddingLeft:6,textOverflow:o?"ellipsis":null,whiteSpace:"nowrap"}},Kb=function(t){var e=t.theme,n=e.spacing,r=e.borderRadius,o=e.colors,s=t.isFocused;return{alignItems:"center",borderRadius:r/2,backgroundColor:s&&o.dangerLight,display:"flex",paddingLeft:n.baseUnit,paddingRight:n.baseUnit,":hover":{backgroundColor:o.dangerLight,color:o.danger}}},Gc=function(t){var e=t.children,n=t.innerProps;return ie("div",n,e)},Jb=Gc,Qb=Gc;function $b(i){var t=i.children,e=i.innerProps;return ie("div",e,t||ie(Uo,{size:14}))}var qc=function(t){var e=t.children,n=t.className,r=t.components,o=t.cx,s=t.data,a=t.getStyles,l=t.innerProps,u=t.isDisabled,c=t.removeProps,h=t.selectProps,d=r.Container,g=r.Label,y=r.Remove;return ie(jw,null,function(x){var b=x.css,T=x.cx;return ie(d,{data:s,innerProps:Ne({className:T(b(a("multiValue",t)),o({"multi-value":!0,"multi-value--is-disabled":u},n))},l),selectProps:h},ie(g,{data:s,innerProps:{className:T(b(a("multiValueLabel",t)),o({"multi-value__label":!0},n))},selectProps:h},e),ie(y,{data:s,innerProps:Ne({className:T(b(a("multiValueRemove",t)),o({"multi-value__remove":!0},n))},c),selectProps:h}))})};qc.defaultProps={cropWithEllipsis:!0};var eS=function(t){var e=t.isDisabled,n=t.isFocused,r=t.isSelected,o=t.theme,s=o.spacing,a=o.colors;return{label:"option",backgroundColor:r?a.primary:n?a.primary25:"transparent",color:e?a.neutral20:r?a.neutral0:"inherit",cursor:"default",display:"block",fontSize:"inherit",padding:"".concat(s.baseUnit*2,"px ").concat(s.baseUnit*3,"px"),width:"100%",userSelect:"none",WebkitTapHighlightColor:"rgba(0, 0, 0, 0)",":active":{backgroundColor:!e&&(r?a.primary:a.primary50)}}},tS=function(t){var e=t.children,n=t.className,r=t.cx,o=t.getStyles,s=t.isDisabled,a=t.isFocused,l=t.isSelected,u=t.innerRef,c=t.innerProps;return ie("div",ne({css:o("option",t),className:r({option:!0,"option--is-disabled":s,"option--is-focused":a,"option--is-selected":l},n),ref:u},c),e)},nS=function(t){var e=t.theme,n=e.spacing,r=e.colors;return{label:"placeholder",color:r.neutral50,marginLeft:n.baseUnit/2,marginRight:n.baseUnit/2,position:"absolute",top:"50%",transform:"translateY(-50%)"}},iS=function(t){var e=t.children,n=t.className,r=t.cx,o=t.getStyles,s=t.innerProps;return ie("div",ne({css:o("placeholder",t),className:r({placeholder:!0},n)},s),e)},rS=function(t){var e=t.isDisabled,n=t.theme,r=n.spacing,o=n.colors;return{label:"singleValue",color:e?o.neutral40:o.neutral80,marginLeft:r.baseUnit/2,marginRight:r.baseUnit/2,maxWidth:"calc(100% - ".concat(r.baseUnit*2,"px)"),overflow:"hidden",position:"absolute",textOverflow:"ellipsis",whiteSpace:"nowrap",top:"50%",transform:"translateY(-50%)"}},oS=function(t){var e=t.children,n=t.className,r=t.cx,o=t.getStyles,s=t.isDisabled,a=t.innerProps;return ie("div",ne({css:o("singleValue",t),className:r({"single-value":!0,"single-value--is-disabled":s},n)},a),e)},sS={ClearIndicator:kb,Control:zb,DropdownIndicator:Mb,DownChevron:Uc,CrossIcon:Uo,Group:Ub,GroupHeading:jb,IndicatorsContainer:Ob,IndicatorSeparator:Bb,Input:Xb,LoadingIndicator:jc,Menu:vb,MenuList:wb,MenuPortal:xb,LoadingMessage:Hc,NoOptionsMessage:Nc,MultiValue:qc,MultiValueContainer:Jb,MultiValueLabel:Qb,MultiValueRemove:$b,Option:tS,Placeholder:iS,SelectContainer:Tb,SingleValue:oS,ValueContainer:Pb},aS=function(t){return Ne(Ne({},sS),t.components)};function jo(i,t){(t==null||t>i.length)&&(t=i.length);for(var e=0,n=new Array(t);e<t;e++)n[e]=i[e];return n}function lS(i){if(Array.isArray(i))return jo(i)}function uS(i){if(typeof Symbol!="undefined"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function cS(i,t){if(!!i){if(typeof i=="string")return jo(i,t);var e=Object.prototype.toString.call(i).slice(8,-1);if(e==="Object"&&i.constructor&&(e=i.constructor.name),e==="Map"||e==="Set")return Array.from(i);if(e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return jo(i,t)}}function hS(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Xc(i){return lS(i)||uS(i)||cS(i)||hS()}var Yc=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function dS(i,t){return!!(i===t||Yc(i)&&Yc(t))}function fS(i,t){if(i.length!==t.length)return!1;for(var e=0;e<i.length;e++)if(!dS(i[e],t[e]))return!1;return!0}function pS(i,t){t===void 0&&(t=fS);var e,n=[],r,o=!1;function s(){for(var a=[],l=0;l<arguments.length;l++)a[l]=arguments[l];return o&&e===this&&t(a,n)||(r=i.apply(this,a),o=!0,e=this,n=a),r}return s}for(var mS={name:"7pg0cj-a11yText",styles:"label:a11yText;z-index:9999;border:0;clip:rect(1px, 1px, 1px, 1px);height:1px;width:1px;position:absolute;overflow:hidden;padding:0;white-space:nowrap"},gS=function(t){return ie("span",ne({css:mS},t))},vS={guidance:function(t){var e=t.isSearchable,n=t.isMulti,r=t.isDisabled,o=t.tabSelectsValue,s=t.context;switch(s){case"menu":return"Use Up and Down to choose options".concat(r?"":", press Enter to select the currently focused option",", press Escape to exit the menu").concat(o?", press Tab to select the option and exit the menu":"",".");case"input":return"".concat(t["aria-label"]||"Select"," is focused ").concat(e?",type to refine list":"",", press Down to open the menu, ").concat(n?" press left to focus selected values":"");case"value":return"Use left and right to toggle between focused values, press Backspace to remove the currently focused value";default:return""}},onChange:function(t){var e=t.action,n=t.label,r=n===void 0?"":n,o=t.isDisabled;switch(e){case"deselect-option":case"pop-value":case"remove-value":return"option ".concat(r,", deselected.");case"select-option":return o?"option ".concat(r," is disabled. Select another option."):"option ".concat(r,", selected.");default:return""}},onFocus:function(t){var e=t.context,n=t.focused,r=n===void 0?{}:n,o=t.options,s=t.label,a=s===void 0?"":s,l=t.selectValue,u=t.isDisabled,c=t.isSelected,h=function(x,b){return x&&x.length?"".concat(x.indexOf(b)+1," of ").concat(x.length):""};if(e==="value"&&l)return"value ".concat(a," focused, ").concat(h(l,r),".");if(e==="menu"){var d=u?" disabled":"",g="".concat(c?"selected":"focused").concat(d);return"option ".concat(a," ").concat(g,", ").concat(h(o,r),".")}return""},onFilter:function(t){var e=t.inputValue,n=t.resultsMessage;return"".concat(n).concat(e?" for search term "+e:"",".")}},yS=function(t){var e=t.ariaSelection,n=t.focusedOption,r=t.focusedValue,o=t.focusableOptions,s=t.isFocused,a=t.selectValue,l=t.selectProps,u=l.ariaLiveMessages,c=l.getOptionLabel,h=l.inputValue,d=l.isMulti,g=l.isOptionDisabled,y=l.isSearchable,x=l.menuIsOpen,b=l.options,T=l.screenReaderStatus,f=l.tabSelectsValue,E=l["aria-label"],A=l["aria-live"],C=gt(function(){return Ne(Ne({},vS),u||{})},[u]),O=gt(function(){var Y="";if(e&&C.onChange){var V=e.option,K=e.removedValue,Q=e.value,le=function(pe){return Array.isArray(pe)?null:pe},re=K||V||le(Q),se=Ne({isDisabled:re&&g(re),label:re?c(re):""},e);Y=C.onChange(se)}return Y},[e,g,c,C]),D=gt(function(){var Y="",V=n||r,K=!!(n&&a&&a.includes(n));if(V&&C.onFocus){var Q={focused:V,label:c(V),isDisabled:g(V),isSelected:K,options:b,context:V===n?"menu":"value",selectValue:a};Y=C.onFocus(Q)}return Y},[n,r,c,g,C,b,a]),I=gt(function(){var Y="";if(x&&b.length&&C.onFilter){var V=T({count:o.length});Y=C.onFilter({inputValue:h,resultsMessage:V})}return Y},[o,h,x,C,b,T]),B=gt(function(){var Y="";if(C.guidance){var V=r?"value":x?"menu":"input";Y=C.guidance({"aria-label":E,context:V,isDisabled:n&&g(n),isMulti:d,isSearchable:y,tabSelectsValue:f})}return Y},[E,n,r,d,g,y,x,C,f]),Z="".concat(D," ").concat(I," ").concat(B);return ie(gS,{"aria-live":A,"aria-atomic":"false","aria-relevant":"additions text"},s&&ie(k.Fragment,null,ie("span",{id:"aria-selection"},O),ie("span",{id:"aria-context"},Z)))},Go=[{base:"A",letters:"A\u24B6\uFF21\xC0\xC1\xC2\u1EA6\u1EA4\u1EAA\u1EA8\xC3\u0100\u0102\u1EB0\u1EAE\u1EB4\u1EB2\u0226\u01E0\xC4\u01DE\u1EA2\xC5\u01FA\u01CD\u0200\u0202\u1EA0\u1EAC\u1EB6\u1E00\u0104\u023A\u2C6F"},{base:"AA",letters:"\uA732"},{base:"AE",letters:"\xC6\u01FC\u01E2"},{base:"AO",letters:"\uA734"},{base:"AU",letters:"\uA736"},{base:"AV",letters:"\uA738\uA73A"},{base:"AY",letters:"\uA73C"},{base:"B",letters:"B\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0182\u0181"},{base:"C",letters:"C\u24B8\uFF23\u0106\u0108\u010A\u010C\xC7\u1E08\u0187\u023B\uA73E"},{base:"D",letters:"D\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018B\u018A\u0189\uA779"},{base:"DZ",letters:"\u01F1\u01C4"},{base:"Dz",letters:"\u01F2\u01C5"},{base:"E",letters:"E\u24BA\uFF25\xC8\xC9\xCA\u1EC0\u1EBE\u1EC4\u1EC2\u1EBC\u0112\u1E14\u1E16\u0114\u0116\xCB\u1EBA\u011A\u0204\u0206\u1EB8\u1EC6\u0228\u1E1C\u0118\u1E18\u1E1A\u0190\u018E"},{base:"F",letters:"F\u24BB\uFF26\u1E1E\u0191\uA77B"},{base:"G",letters:"G\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E"},{base:"H",letters:"H\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D"},{base:"I",letters:"I\u24BE\uFF29\xCC\xCD\xCE\u0128\u012A\u012C\u0130\xCF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197"},{base:"J",letters:"J\u24BF\uFF2A\u0134\u0248"},{base:"K",letters:"K\u24C0\uFF2B\u1E30\u01E8\u1E32\u0136\u1E34\u0198\u2C69\uA740\uA742\uA744\uA7A2"},{base:"L",letters:"L\u24C1\uFF2C\u013F\u0139\u013D\u1E36\u1E38\u013B\u1E3C\u1E3A\u0141\u023D\u2C62\u2C60\uA748\uA746\uA780"},{base:"LJ",letters:"\u01C7"},{base:"Lj",letters:"\u01C8"},{base:"M",letters:"M\u24C2\uFF2D\u1E3E\u1E40\u1E42\u2C6E\u019C"},{base:"N",letters:"N\u24C3\uFF2E\u01F8\u0143\xD1\u1E44\u0147\u1E46\u0145\u1E4A\u1E48\u0220\u019D\uA790\uA7A4"},{base:"NJ",letters:"\u01CA"},{base:"Nj",letters:"\u01CB"},{base:"O",letters:"O\u24C4\uFF2F\xD2\xD3\xD4\u1ED2\u1ED0\u1ED6\u1ED4\xD5\u1E4C\u022C\u1E4E\u014C\u1E50\u1E52\u014E\u022E\u0230\xD6\u022A\u1ECE\u0150\u01D1\u020C\u020E\u01A0\u1EDC\u1EDA\u1EE0\u1EDE\u1EE2\u1ECC\u1ED8\u01EA\u01EC\xD8\u01FE\u0186\u019F\uA74A\uA74C"},{base:"OI",letters:"\u01A2"},{base:"OO",letters:"\uA74E"},{base:"OU",letters:"\u0222"},{base:"P",letters:"P\u24C5\uFF30\u1E54\u1E56\u01A4\u2C63\uA750\uA752\uA754"},{base:"Q",letters:"Q\u24C6\uFF31\uA756\uA758\u024A"},{base:"R",letters:"R\u24C7\uFF32\u0154\u1E58\u0158\u0210\u0212\u1E5A\u1E5C\u0156\u1E5E\u024C\u2C64\uA75A\uA7A6\uA782"},{base:"S",letters:"S\u24C8\uFF33\u1E9E\u015A\u1E64\u015C\u1E60\u0160\u1E66\u1E62\u1E68\u0218\u015E\u2C7E\uA7A8\uA784"},{base:"T",letters:"T\u24C9\uFF34\u1E6A\u0164\u1E6C\u021A\u0162\u1E70\u1E6E\u0166\u01AC\u01AE\u023E\uA786"},{base:"TZ",letters:"\uA728"},{base:"U",letters:"U\u24CA\uFF35\xD9\xDA\xDB\u0168\u1E78\u016A\u1E7A\u016C\xDC\u01DB\u01D7\u01D5\u01D9\u1EE6\u016E\u0170\u01D3\u0214\u0216\u01AF\u1EEA\u1EE8\u1EEE\u1EEC\u1EF0\u1EE4\u1E72\u0172\u1E76\u1E74\u0244"},{base:"V",letters:"V\u24CB\uFF36\u1E7C\u1E7E\u01B2\uA75E\u0245"},{base:"VY",letters:"\uA760"},{base:"W",letters:"W\u24CC\uFF37\u1E80\u1E82\u0174\u1E86\u1E84\u1E88\u2C72"},{base:"X",letters:"X\u24CD\uFF38\u1E8A\u1E8C"},{base:"Y",letters:"Y\u24CE\uFF39\u1EF2\xDD\u0176\u1EF8\u0232\u1E8E\u0178\u1EF6\u1EF4\u01B3\u024E\u1EFE"},{base:"Z",letters:"Z\u24CF\uFF3A\u0179\u1E90\u017B\u017D\u1E92\u1E94\u01B5\u0224\u2C7F\u2C6B\uA762"},{base:"a",letters:"a\u24D0\uFF41\u1E9A\xE0\xE1\xE2\u1EA7\u1EA5\u1EAB\u1EA9\xE3\u0101\u0103\u1EB1\u1EAF\u1EB5\u1EB3\u0227\u01E1\xE4\u01DF\u1EA3\xE5\u01FB\u01CE\u0201\u0203\u1EA1\u1EAD\u1EB7\u1E01\u0105\u2C65\u0250"},{base:"aa",letters:"\uA733"},{base:"ae",letters:"\xE6\u01FD\u01E3"},{base:"ao",letters:"\uA735"},{base:"au",letters:"\uA737"},{base:"av",letters:"\uA739\uA73B"},{base:"ay",letters:"\uA73D"},{base:"b",letters:"b\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253"},{base:"c",letters:"c\u24D2\uFF43\u0107\u0109\u010B\u010D\xE7\u1E09\u0188\u023C\uA73F\u2184"},{base:"d",letters:"d\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\uA77A"},{base:"dz",letters:"\u01F3\u01C6"},{base:"e",letters:"e\u24D4\uFF45\xE8\xE9\xEA\u1EC1\u1EBF\u1EC5\u1EC3\u1EBD\u0113\u1E15\u1E17\u0115\u0117\xEB\u1EBB\u011B\u0205\u0207\u1EB9\u1EC7\u0229\u1E1D\u0119\u1E19\u1E1B\u0247\u025B\u01DD"},{base:"f",letters:"f\u24D5\uFF46\u1E1F\u0192\uA77C"},{base:"g",letters:"g\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\u1D79\uA77F"},{base:"h",letters:"h\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265"},{base:"hv",letters:"\u0195"},{base:"i",letters:"i\u24D8\uFF49\xEC\xED\xEE\u0129\u012B\u012D\xEF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131"},{base:"j",letters:"j\u24D9\uFF4A\u0135\u01F0\u0249"},{base:"k",letters:"k\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3"},{base:"l",letters:"l\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747"},{base:"lj",letters:"\u01C9"},{base:"m",letters:"m\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F"},{base:"n",letters:"n\u24DD\uFF4E\u01F9\u0144\xF1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5"},{base:"nj",letters:"\u01CC"},{base:"o",letters:"o\u24DE\uFF4F\xF2\xF3\xF4\u1ED3\u1ED1\u1ED7\u1ED5\xF5\u1E4D\u022D\u1E4F\u014D\u1E51\u1E53\u014F\u022F\u0231\xF6\u022B\u1ECF\u0151\u01D2\u020D\u020F\u01A1\u1EDD\u1EDB\u1EE1\u1EDF\u1EE3\u1ECD\u1ED9\u01EB\u01ED\xF8\u01FF\u0254\uA74B\uA74D\u0275"},{base:"oi",letters:"\u01A3"},{base:"ou",letters:"\u0223"},{base:"oo",letters:"\uA74F"},{base:"p",letters:"p\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755"},{base:"q",letters:"q\u24E0\uFF51\u024B\uA757\uA759"},{base:"r",letters:"r\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783"},{base:"s",letters:"s\u24E2\uFF53\xDF\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B"},{base:"t",letters:"t\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787"},{base:"tz",letters:"\uA729"},{base:"u",letters:"u\u24E4\uFF55\xF9\xFA\xFB\u0169\u1E79\u016B\u1E7B\u016D\xFC\u01DC\u01D8\u01D6\u01DA\u1EE7\u016F\u0171\u01D4\u0215\u0217\u01B0\u1EEB\u1EE9\u1EEF\u1EED\u1EF1\u1EE5\u1E73\u0173\u1E77\u1E75\u0289"},{base:"v",letters:"v\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C"},{base:"vy",letters:"\uA761"},{base:"w",letters:"w\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73"},{base:"x",letters:"x\u24E7\uFF58\u1E8B\u1E8D"},{base:"y",letters:"y\u24E8\uFF59\u1EF3\xFD\u0177\u1EF9\u0233\u1E8F\xFF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF"},{base:"z",letters:"z\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763"}],wS=new RegExp("["+Go.map(function(i){return i.letters}).join("")+"]","g"),Zc={},qo=0;qo<Go.length;qo++)for(var Xo=Go[qo],Yo=0;Yo<Xo.letters.length;Yo++)Zc[Xo.letters[Yo]]=Xo.base;var Kc=function(t){return t.replace(wS,function(e){return Zc[e]})},bS=pS(Kc),Jc=function(t){return t.replace(/^\s+|\s+$/g,"")},SS=function(t){return"".concat(t.label," ").concat(t.value)},ES=function(t){return function(e,n){var r=Ne({ignoreCase:!0,ignoreAccents:!0,stringify:SS,trim:!0,matchFrom:"any"},t),o=r.ignoreCase,s=r.ignoreAccents,a=r.stringify,l=r.trim,u=r.matchFrom,c=l?Jc(n):n,h=l?Jc(a(e)):a(e);return o&&(c=c.toLowerCase(),h=h.toLowerCase()),s&&(c=bS(c),h=Kc(h)),u==="start"?h.substr(0,c.length)===c:h.indexOf(c)>-1}};function xS(i){i.in,i.out,i.onExited,i.appear,i.enter,i.exit;var t=i.innerRef;i.emotion;var e=un(i,["in","out","onExited","appear","enter","exit","innerRef","emotion"]);return ie("input",ne({ref:t},e,{css:Bo({label:"dummyInput",background:0,border:0,fontSize:"inherit",outline:0,padding:0,width:1,color:"transparent",left:-100,opacity:0,position:"relative",transform:"scale(0)"},"","")}))}var _S=function(t){t.preventDefault(),t.stopPropagation()};function TS(i){var t=i.isEnabled,e=i.onBottomArrive,n=i.onBottomLeave,r=i.onTopArrive,o=i.onTopLeave,s=ot(!1),a=ot(!1),l=ot(0),u=ot(null),c=st(function(b,T){if(u.current!==null){var f=u.current,E=f.scrollTop,A=f.scrollHeight,C=f.clientHeight,O=u.current,D=T>0,I=A-C-E,B=!1;I>T&&s.current&&(n&&n(b),s.current=!1),D&&a.current&&(o&&o(b),a.current=!1),D&&T>I?(e&&!s.current&&e(b),O.scrollTop=A,B=!0,s.current=!0):!D&&-T>E&&(r&&!a.current&&r(b),O.scrollTop=0,B=!0,a.current=!0),B&&_S(b)}},[]),h=st(function(b){c(b,b.deltaY)},[c]),d=st(function(b){l.current=b.changedTouches[0].clientY},[]),g=st(function(b){var T=l.current-b.changedTouches[0].clientY;c(b,T)},[c]),y=st(function(b){if(!!b){var T=fb?{passive:!1}:!1;typeof b.addEventListener=="function"&&b.addEventListener("wheel",h,T),typeof b.addEventListener=="function"&&b.addEventListener("touchstart",d,T),typeof b.addEventListener=="function"&&b.addEventListener("touchmove",g,T)}},[g,d,h]),x=st(function(b){!b||(typeof b.removeEventListener=="function"&&b.removeEventListener("wheel",h,!1),typeof b.removeEventListener=="function"&&b.removeEventListener("touchstart",d,!1),typeof b.removeEventListener=="function"&&b.removeEventListener("touchmove",g,!1))},[g,d,h]);return kt(function(){if(!!t){var b=u.current;return y(b),function(){x(b)}}},[t,y,x]),function(b){u.current=b}}var Qc=["boxSizing","height","overflow","paddingRight","position"],$c={boxSizing:"border-box",overflow:"hidden",position:"relative",height:"100%"};function eh(i){i.preventDefault()}function th(i){i.stopPropagation()}function nh(){var i=this.scrollTop,t=this.scrollHeight,e=i+this.offsetHeight;i===0?this.scrollTop=1:e===t&&(this.scrollTop=i-1)}function ih(){return"ontouchstart"in window||navigator.maxTouchPoints}var rh=!!(typeof window!="undefined"&&window.document&&window.document.createElement),Vn=0,hn={capture:!1,passive:!1};function CS(i){var t=i.isEnabled,e=i.accountForScrollbars,n=e===void 0?!0:e,r=ot({}),o=ot(null),s=st(function(l){if(!!rh){var u=document.body,c=u&&u.style;if(n&&Qc.forEach(function(y){var x=c&&c[y];r.current[y]=x}),n&&Vn<1){var h=parseInt(r.current.paddingRight,10)||0,d=document.body?document.body.clientWidth:0,g=window.innerWidth-d+h||0;Object.keys($c).forEach(function(y){var x=$c[y];c&&(c[y]=x)}),c&&(c.paddingRight="".concat(g,"px"))}u&&ih()&&(u.addEventListener("touchmove",eh,hn),l&&(l.addEventListener("touchstart",nh,hn),l.addEventListener("touchmove",th,hn))),Vn+=1}},[]),a=st(function(l){if(!!rh){var u=document.body,c=u&&u.style;Vn=Math.max(Vn-1,0),n&&Vn<1&&Qc.forEach(function(h){var d=r.current[h];c&&(c[h]=d)}),u&&ih()&&(u.removeEventListener("touchmove",eh,hn),l&&(l.removeEventListener("touchstart",nh,hn),l.removeEventListener("touchmove",th,hn)))}},[]);return kt(function(){if(!!t){var l=o.current;return s(l),function(){a(l)}}},[t,s,a]),function(l){o.current=l}}var PS=function(){return document.activeElement&&document.activeElement.blur()},AS={name:"1kfdb0e",styles:"position:fixed;left:0;bottom:0;right:0;top:0"};function OS(i){var t=i.children,e=i.lockEnabled,n=i.captureEnabled,r=n===void 0?!0:n,o=i.onBottomArrive,s=i.onBottomLeave,a=i.onTopArrive,l=i.onTopLeave,u=TS({isEnabled:r,onBottomArrive:o,onBottomLeave:s,onTopArrive:a,onTopLeave:l}),c=CS({isEnabled:e}),h=function(g){u(g),c(g)};return ie(k.Fragment,null,e&&ie("div",{onClick:PS,css:AS}),t(h))}var DS=function(t){return t.label},RS=function(t){return t.label},MS=function(t){return t.value},FS=function(t){return!!t.isDisabled},kS={clearIndicator:Fb,container:_b,control:Hb,dropdownIndicator:Rb,group:Vb,groupHeading:Wb,indicatorsContainer:Ab,indicatorSeparator:Lb,input:Gb,loadingIndicator:Nb,loadingMessage:Sb,menu:gb,menuList:yb,menuPortal:Eb,multiValue:Yb,multiValueLabel:Zb,multiValueRemove:Kb,noOptionsMessage:bb,option:eS,placeholder:nS,singleValue:rS,valueContainer:Cb},LS={primary:"#2684FF",primary75:"#4C9AFF",primary50:"#B2D4FF",primary25:"#DEEBFF",danger:"#DE350B",dangerLight:"#FFBDAD",neutral0:"hsl(0, 0%, 100%)",neutral5:"hsl(0, 0%, 95%)",neutral10:"hsl(0, 0%, 90%)",neutral20:"hsl(0, 0%, 80%)",neutral30:"hsl(0, 0%, 70%)",neutral40:"hsl(0, 0%, 60%)",neutral50:"hsl(0, 0%, 50%)",neutral60:"hsl(0, 0%, 40%)",neutral70:"hsl(0, 0%, 30%)",neutral80:"hsl(0, 0%, 20%)",neutral90:"hsl(0, 0%, 10%)"},BS=4,oh=4,IS=38,NS=oh*2,HS={baseUnit:oh,controlHeight:IS,menuGutter:NS},Zo={borderRadius:BS,colors:LS,spacing:HS},zS={"aria-live":"polite",backspaceRemovesValue:!0,blurInputOnSelect:Fc(),captureMenuScroll:!Fc(),closeMenuOnSelect:!0,closeMenuOnScroll:!1,components:{},controlShouldRenderValue:!0,escapeClearsValue:!1,filterOption:ES(),formatGroupLabel:DS,getOptionLabel:RS,getOptionValue:MS,isDisabled:!1,isLoading:!1,isMulti:!1,isRtl:!1,isSearchable:!0,isOptionDisabled:FS,loadingMessage:function(){return"Loading..."},maxMenuHeight:300,minMenuHeight:140,menuIsOpen:!1,menuPlacement:"bottom",menuPosition:"absolute",menuShouldBlockScroll:!1,menuShouldScrollIntoView:!hb(),noOptionsMessage:function(){return"No options"},openMenuOnFocus:!1,openMenuOnClick:!0,options:[],pageSize:5,placeholder:"Select...",screenReaderStatus:function(t){var e=t.count;return"".concat(e," result").concat(e!==1?"s":""," available")},styles:{},tabIndex:"0",tabSelectsValue:!0};function sh(i,t,e,n){var r=hh(i,t,e),o=dh(i,t,e),s=ch(i,t),a=Ki(i,t);return{type:"option",data:t,isDisabled:r,isSelected:o,label:s,value:a,index:n}}function ah(i,t){return i.options.map(function(e,n){if(e.options){var r=e.options.map(function(s,a){return sh(i,s,t,a)}).filter(function(s){return uh(i,s)});return r.length>0?{type:"group",data:e,options:r,index:n}:void 0}var o=sh(i,e,t,n);return uh(i,o)?o:void 0}).filter(function(e){return!!e})}function lh(i){return i.reduce(function(t,e){return e.type==="group"?t.push.apply(t,Xc(e.options.map(function(n){return n.data}))):t.push(e.data),t},[])}function VS(i,t){return lh(ah(i,t))}function uh(i,t){var e=i.inputValue,n=e===void 0?"":e,r=t.data,o=t.isSelected,s=t.label,a=t.value;return(!ph(i)||!o)&&fh(i,{label:s,value:a,data:r},n)}function US(i,t){var e=i.focusedValue,n=i.selectValue,r=n.indexOf(e);if(r>-1){var o=t.indexOf(e);if(o>-1)return e;if(r<t.length)return t[r]}return null}function WS(i,t){var e=i.focusedOption;return e&&t.indexOf(e)>-1?e:t[0]}var ch=function(t,e){return t.getOptionLabel(e)},Ki=function(t,e){return t.getOptionValue(e)};function hh(i,t,e){return typeof i.isOptionDisabled=="function"?i.isOptionDisabled(t,e):!1}function dh(i,t,e){if(e.indexOf(t)>-1)return!0;if(typeof i.isOptionSelected=="function")return i.isOptionSelected(t,e);var n=Ki(i,t);return e.some(function(r){return Ki(i,r)===n})}function fh(i,t,e){return i.filterOption?i.filterOption(t,e):!0}var ph=function(t){var e=t.hideSelectedOptions,n=t.isMulti;return e===void 0?n:e},jS=1,mh=function(i){Wi(e,i);var t=Gi(e);function e(n){var r;return zi(this,e),r=t.call(this,n),r.state={ariaSelection:null,focusedOption:null,focusedValue:null,inputIsHidden:!1,isFocused:!1,selectValue:[],clearFocusValueOnUpdate:!1,inputIsHiddenAfterUpdate:void 0,prevProps:void 0},r.blockOptionHover=!1,r.isComposing=!1,r.commonProps=void 0,r.initialTouchX=0,r.initialTouchY=0,r.instancePrefix="",r.openAfterFocus=!1,r.scrollToFocusedOptionOnUpdate=!1,r.userIsDragging=void 0,r.controlRef=null,r.getControlRef=function(o){r.controlRef=o},r.focusedOptionRef=null,r.getFocusedOptionRef=function(o){r.focusedOptionRef=o},r.menuListRef=null,r.getMenuListRef=function(o){r.menuListRef=o},r.inputRef=null,r.getInputRef=function(o){r.inputRef=o},r.focus=r.focusInput,r.blur=r.blurInput,r.onChange=function(o,s){var a=r.props,l=a.onChange,u=a.name;s.name=u,r.ariaOnChange(o,s),l(o,s)},r.setValue=function(o){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"set-value",a=arguments.length>2?arguments[2]:void 0,l=r.props,u=l.closeMenuOnSelect,c=l.isMulti;r.onInputChange("",{action:"set-value"}),u&&(r.setState({inputIsHiddenAfterUpdate:!c}),r.onMenuClose()),r.setState({clearFocusValueOnUpdate:!0}),r.onChange(o,{action:s,option:a})},r.selectOption=function(o){var s=r.props,a=s.blurInputOnSelect,l=s.isMulti,u=s.name,c=r.state.selectValue,h=l&&r.isOptionSelected(o,c),d=r.isOptionDisabled(o,c);if(h){var g=r.getOptionValue(o);r.setValue(c.filter(function(y){return r.getOptionValue(y)!==g}),"deselect-option",o)}else if(!d)l?r.setValue([].concat(Xc(c),[o]),"select-option",o):r.setValue(o,"select-option");else{r.ariaOnChange(o,{action:"select-option",name:u});return}a&&r.blurInput()},r.removeValue=function(o){var s=r.props.isMulti,a=r.state.selectValue,l=r.getOptionValue(o),u=a.filter(function(h){return r.getOptionValue(h)!==l}),c=s?u:u[0]||null;r.onChange(c,{action:"remove-value",removedValue:o}),r.focusInput()},r.clearValue=function(){var o=r.state.selectValue;r.onChange(r.props.isMulti?[]:null,{action:"clear",removedValues:o})},r.popValue=function(){var o=r.props.isMulti,s=r.state.selectValue,a=s[s.length-1],l=s.slice(0,s.length-1),u=o?l:l[0]||null;r.onChange(u,{action:"pop-value",removedValue:a})},r.getValue=function(){return r.state.selectValue},r.cx=function(){for(var o=arguments.length,s=new Array(o),a=0;a<o;a++)s[a]=arguments[a];return sb.apply(void 0,[r.props.classNamePrefix].concat(s))},r.getOptionLabel=function(o){return ch(r.props,o)},r.getOptionValue=function(o){return Ki(r.props,o)},r.getStyles=function(o,s){var a=kS[o](s);a.boxSizing="border-box";var l=r.props.styles[o];return l?l(a,s):a},r.getElementId=function(o){return"".concat(r.instancePrefix,"-").concat(o)},r.getComponents=function(){return aS(r.props)},r.buildCategorizedOptions=function(){return ah(r.props,r.state.selectValue)},r.getCategorizedOptions=function(){return r.props.menuIsOpen?r.buildCategorizedOptions():[]},r.buildFocusableOptions=function(){return lh(r.buildCategorizedOptions())},r.getFocusableOptions=function(){return r.props.menuIsOpen?r.buildFocusableOptions():[]},r.ariaOnChange=function(o,s){r.setState({ariaSelection:Ne({value:o},s)})},r.onMenuMouseDown=function(o){o.button===0&&(o.stopPropagation(),o.preventDefault(),r.focusInput())},r.onMenuMouseMove=function(o){r.blockOptionHover=!1},r.onControlMouseDown=function(o){var s=r.props.openMenuOnClick;r.state.isFocused?r.props.menuIsOpen?o.target.tagName!=="INPUT"&&o.target.tagName!=="TEXTAREA"&&r.onMenuClose():s&&r.openMenu("first"):(s&&(r.openAfterFocus=!0),r.focusInput()),o.target.tagName!=="INPUT"&&o.target.tagName!=="TEXTAREA"&&o.preventDefault()},r.onDropdownIndicatorMouseDown=function(o){if(!(o&&o.type==="mousedown"&&o.button!==0)&&!r.props.isDisabled){var s=r.props,a=s.isMulti,l=s.menuIsOpen;r.focusInput(),l?(r.setState({inputIsHiddenAfterUpdate:!a}),r.onMenuClose()):r.openMenu("first"),o.preventDefault(),o.stopPropagation()}},r.onClearIndicatorMouseDown=function(o){o&&o.type==="mousedown"&&o.button!==0||(r.clearValue(),o.stopPropagation(),r.openAfterFocus=!1,o.type==="touchend"?r.focusInput():setTimeout(function(){return r.focusInput()}))},r.onScroll=function(o){typeof r.props.closeMenuOnScroll=="boolean"?o.target instanceof HTMLElement&&zo(o.target)&&r.props.onMenuClose():typeof r.props.closeMenuOnScroll=="function"&&r.props.closeMenuOnScroll(o)&&r.props.onMenuClose()},r.onCompositionStart=function(){r.isComposing=!0},r.onCompositionEnd=function(){r.isComposing=!1},r.onTouchStart=function(o){var s=o.touches,a=s&&s.item(0);!a||(r.initialTouchX=a.clientX,r.initialTouchY=a.clientY,r.userIsDragging=!1)},r.onTouchMove=function(o){var s=o.touches,a=s&&s.item(0);if(!!a){var l=Math.abs(a.clientX-r.initialTouchX),u=Math.abs(a.clientY-r.initialTouchY),c=5;r.userIsDragging=l>c||u>c}},r.onTouchEnd=function(o){r.userIsDragging||(r.controlRef&&!r.controlRef.contains(o.target)&&r.menuListRef&&!r.menuListRef.contains(o.target)&&r.blurInput(),r.initialTouchX=0,r.initialTouchY=0)},r.onControlTouchEnd=function(o){r.userIsDragging||r.onControlMouseDown(o)},r.onClearIndicatorTouchEnd=function(o){r.userIsDragging||r.onClearIndicatorMouseDown(o)},r.onDropdownIndicatorTouchEnd=function(o){r.userIsDragging||r.onDropdownIndicatorMouseDown(o)},r.handleInputChange=function(o){var s=o.currentTarget.value;r.setState({inputIsHiddenAfterUpdate:!1}),r.onInputChange(s,{action:"input-change"}),r.props.menuIsOpen||r.onMenuOpen()},r.onInputFocus=function(o){r.props.onFocus&&r.props.onFocus(o),r.setState({inputIsHiddenAfterUpdate:!1,isFocused:!0}),(r.openAfterFocus||r.props.openMenuOnFocus)&&r.openMenu("first"),r.openAfterFocus=!1},r.onInputBlur=function(o){if(r.menuListRef&&r.menuListRef.contains(document.activeElement)){r.inputRef.focus();return}r.props.onBlur&&r.props.onBlur(o),r.onInputChange("",{action:"input-blur"}),r.onMenuClose(),r.setState({focusedValue:null,isFocused:!1})},r.onOptionHover=function(o){r.blockOptionHover||r.state.focusedOption===o||r.setState({focusedOption:o})},r.shouldHideSelectedOptions=function(){return ph(r.props)},r.onKeyDown=function(o){var s=r.props,a=s.isMulti,l=s.backspaceRemovesValue,u=s.escapeClearsValue,c=s.inputValue,h=s.isClearable,d=s.isDisabled,g=s.menuIsOpen,y=s.onKeyDown,x=s.tabSelectsValue,b=s.openMenuOnFocus,T=r.state,f=T.focusedOption,E=T.focusedValue,A=T.selectValue;if(!d&&!(typeof y=="function"&&(y(o),o.defaultPrevented))){switch(r.blockOptionHover=!0,o.key){case"ArrowLeft":if(!a||c)return;r.focusValue("previous");break;case"ArrowRight":if(!a||c)return;r.focusValue("next");break;case"Delete":case"Backspace":if(c)return;if(E)r.removeValue(E);else{if(!l)return;a?r.popValue():h&&r.clearValue()}break;case"Tab":if(r.isComposing||o.shiftKey||!g||!x||!f||b&&r.isOptionSelected(f,A))return;r.selectOption(f);break;case"Enter":if(o.keyCode===229)break;if(g){if(!f||r.isComposing)return;r.selectOption(f);break}return;case"Escape":g?(r.setState({inputIsHiddenAfterUpdate:!1}),r.onInputChange("",{action:"menu-close"}),r.onMenuClose()):h&&u&&r.clearValue();break;case" ":if(c)return;if(!g){r.openMenu("first");break}if(!f)return;r.selectOption(f);break;case"ArrowUp":g?r.focusOption("up"):r.openMenu("last");break;case"ArrowDown":g?r.focusOption("down"):r.openMenu("first");break;case"PageUp":if(!g)return;r.focusOption("pageup");break;case"PageDown":if(!g)return;r.focusOption("pagedown");break;case"Home":if(!g)return;r.focusOption("first");break;case"End":if(!g)return;r.focusOption("last");break;default:return}o.preventDefault()}},r.instancePrefix="react-select-"+(r.props.instanceId||++jS),r.state.selectValue=Dc(n.value),r}return Vi(e,[{key:"componentDidMount",value:function(){this.startListeningComposition(),this.startListeningToTouch(),this.props.closeMenuOnScroll&&document&&document.addEventListener&&document.addEventListener("scroll",this.onScroll,!0),this.props.autoFocus&&this.focusInput()}},{key:"componentDidUpdate",value:function(r){var o=this.props,s=o.isDisabled,a=o.menuIsOpen,l=this.state.isFocused;(l&&!s&&r.isDisabled||l&&a&&!r.menuIsOpen)&&this.focusInput(),l&&s&&!r.isDisabled&&this.setState({isFocused:!1},this.onMenuClose),this.menuListRef&&this.focusedOptionRef&&this.scrollToFocusedOptionOnUpdate&&(ub(this.menuListRef,this.focusedOptionRef),this.scrollToFocusedOptionOnUpdate=!1)}},{key:"componentWillUnmount",value:function(){this.stopListeningComposition(),this.stopListeningToTouch(),document.removeEventListener("scroll",this.onScroll,!0)}},{key:"onMenuOpen",value:function(){this.props.onMenuOpen()}},{key:"onMenuClose",value:function(){this.onInputChange("",{action:"menu-close"}),this.props.onMenuClose()}},{key:"onInputChange",value:function(r,o){this.props.onInputChange(r,o)}},{key:"focusInput",value:function(){!this.inputRef||this.inputRef.focus()}},{key:"blurInput",value:function(){!this.inputRef||this.inputRef.blur()}},{key:"openMenu",value:function(r){var o=this,s=this.state,a=s.selectValue,l=s.isFocused,u=this.buildFocusableOptions(),c=r==="first"?0:u.length-1;if(!this.props.isMulti){var h=u.indexOf(a[0]);h>-1&&(c=h)}this.scrollToFocusedOptionOnUpdate=!(l&&this.menuListRef),this.setState({inputIsHiddenAfterUpdate:!1,focusedValue:null,focusedOption:u[c]},function(){return o.onMenuOpen()})}},{key:"focusValue",value:function(r){var o=this.state,s=o.selectValue,a=o.focusedValue;if(!!this.props.isMulti){this.setState({focusedOption:null});var l=s.indexOf(a);a||(l=-1);var u=s.length-1,c=-1;if(!!s.length){switch(r){case"previous":l===0?c=0:l===-1?c=u:c=l-1;break;case"next":l>-1&&l<u&&(c=l+1);break}this.setState({inputIsHidden:c!==-1,focusedValue:s[c]})}}}},{key:"focusOption",value:function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"first",o=this.props.pageSize,s=this.state.focusedOption,a=this.getFocusableOptions();if(!!a.length){var l=0,u=a.indexOf(s);s||(u=-1),r==="up"?l=u>0?u-1:a.length-1:r==="down"?l=(u+1)%a.length:r==="pageup"?(l=u-o,l<0&&(l=0)):r==="pagedown"?(l=u+o,l>a.length-1&&(l=a.length-1)):r==="last"&&(l=a.length-1),this.scrollToFocusedOptionOnUpdate=!0,this.setState({focusedOption:a[l],focusedValue:null})}}},{key:"getTheme",value:function(){return this.props.theme?typeof this.props.theme=="function"?this.props.theme(Zo):Ne(Ne({},Zo),this.props.theme):Zo}},{key:"getCommonProps",value:function(){var r=this.clearValue,o=this.cx,s=this.getStyles,a=this.getValue,l=this.selectOption,u=this.setValue,c=this.props,h=c.isMulti,d=c.isRtl,g=c.options,y=this.hasValue();return{clearValue:r,cx:o,getStyles:s,getValue:a,hasValue:y,isMulti:h,isRtl:d,options:g,selectOption:l,selectProps:c,setValue:u,theme:this.getTheme()}}},{key:"hasValue",value:function(){var r=this.state.selectValue;return r.length>0}},{key:"hasOptions",value:function(){return!!this.getFocusableOptions().length}},{key:"isClearable",value:function(){var r=this.props,o=r.isClearable,s=r.isMulti;return o===void 0?s:o}},{key:"isOptionDisabled",value:function(r,o){return hh(this.props,r,o)}},{key:"isOptionSelected",value:function(r,o){return dh(this.props,r,o)}},{key:"filterOption",value:function(r,o){return fh(this.props,r,o)}},{key:"formatOptionLabel",value:function(r,o){if(typeof this.props.formatOptionLabel=="function"){var s=this.props.inputValue,a=this.state.selectValue;return this.props.formatOptionLabel(r,{context:o,inputValue:s,selectValue:a})}else return this.getOptionLabel(r)}},{key:"formatGroupLabel",value:function(r){return this.props.formatGroupLabel(r)}},{key:"startListeningComposition",value:function(){document&&document.addEventListener&&(document.addEventListener("compositionstart",this.onCompositionStart,!1),document.addEventListener("compositionend",this.onCompositionEnd,!1))}},{key:"stopListeningComposition",value:function(){document&&document.removeEventListener&&(document.removeEventListener("compositionstart",this.onCompositionStart),document.removeEventListener("compositionend",this.onCompositionEnd))}},{key:"startListeningToTouch",value:function(){document&&document.addEventListener&&(document.addEventListener("touchstart",this.onTouchStart,!1),document.addEventListener("touchmove",this.onTouchMove,!1),document.addEventListener("touchend",this.onTouchEnd,!1))}},{key:"stopListeningToTouch",value:function(){document&&document.removeEventListener&&(document.removeEventListener("touchstart",this.onTouchStart),document.removeEventListener("touchmove",this.onTouchMove),document.removeEventListener("touchend",this.onTouchEnd))}},{key:"renderInput",value:function(){var r=this.props,o=r.isDisabled,s=r.isSearchable,a=r.inputId,l=r.inputValue,u=r.tabIndex,c=r.form,h=this.getComponents(),d=h.Input,g=this.state.inputIsHidden,y=this.commonProps,x=a||this.getElementId("input"),b={"aria-autocomplete":"list","aria-label":this.props["aria-label"],"aria-labelledby":this.props["aria-labelledby"]};return s?k.createElement(d,ne({},y,{autoCapitalize:"none",autoComplete:"off",autoCorrect:"off",id:x,innerRef:this.getInputRef,isDisabled:o,isHidden:g,onBlur:this.onInputBlur,onChange:this.handleInputChange,onFocus:this.onInputFocus,spellCheck:"false",tabIndex:u,form:c,type:"text",value:l},b)):k.createElement(xS,ne({id:x,innerRef:this.getInputRef,onBlur:this.onInputBlur,onChange:qi,onFocus:this.onInputFocus,readOnly:!0,disabled:o,tabIndex:u,form:c,value:""},b))}},{key:"renderPlaceholderOrValue",value:function(){var r=this,o=this.getComponents(),s=o.MultiValue,a=o.MultiValueContainer,l=o.MultiValueLabel,u=o.MultiValueRemove,c=o.SingleValue,h=o.Placeholder,d=this.commonProps,g=this.props,y=g.controlShouldRenderValue,x=g.isDisabled,b=g.isMulti,T=g.inputValue,f=g.placeholder,E=this.state,A=E.selectValue,C=E.focusedValue,O=E.isFocused;if(!this.hasValue()||!y)return T?null:k.createElement(h,ne({},d,{key:"placeholder",isDisabled:x,isFocused:O}),f);if(b){var D=A.map(function(B,Z){var Y=B===C;return k.createElement(s,ne({},d,{components:{Container:a,Label:l,Remove:u},isFocused:Y,isDisabled:x,key:"".concat(r.getOptionValue(B)).concat(Z),index:Z,removeProps:{onClick:function(){return r.removeValue(B)},onTouchEnd:function(){return r.removeValue(B)},onMouseDown:function(K){K.preventDefault(),K.stopPropagation()}},data:B}),r.formatOptionLabel(B,"value"))});return D}if(T)return null;var I=A[0];return k.createElement(c,ne({},d,{data:I,isDisabled:x}),this.formatOptionLabel(I,"value"))}},{key:"renderClearIndicator",value:function(){var r=this.getComponents(),o=r.ClearIndicator,s=this.commonProps,a=this.props,l=a.isDisabled,u=a.isLoading,c=this.state.isFocused;if(!this.isClearable()||!o||l||!this.hasValue()||u)return null;var h={onMouseDown:this.onClearIndicatorMouseDown,onTouchEnd:this.onClearIndicatorTouchEnd,"aria-hidden":"true"};return k.createElement(o,ne({},s,{innerProps:h,isFocused:c}))}},{key:"renderLoadingIndicator",value:function(){var r=this.getComponents(),o=r.LoadingIndicator,s=this.commonProps,a=this.props,l=a.isDisabled,u=a.isLoading,c=this.state.isFocused;if(!o||!u)return null;var h={"aria-hidden":"true"};return k.createElement(o,ne({},s,{innerProps:h,isDisabled:l,isFocused:c}))}},{key:"renderIndicatorSeparator",value:function(){var r=this.getComponents(),o=r.DropdownIndicator,s=r.IndicatorSeparator;if(!o||!s)return null;var a=this.commonProps,l=this.props.isDisabled,u=this.state.isFocused;return k.createElement(s,ne({},a,{isDisabled:l,isFocused:u}))}},{key:"renderDropdownIndicator",value:function(){var r=this.getComponents(),o=r.DropdownIndicator;if(!o)return null;var s=this.commonProps,a=this.props.isDisabled,l=this.state.isFocused,u={onMouseDown:this.onDropdownIndicatorMouseDown,onTouchEnd:this.onDropdownIndicatorTouchEnd,"aria-hidden":"true"};return k.createElement(o,ne({},s,{innerProps:u,isDisabled:a,isFocused:l}))}},{key:"renderMenu",value:function(){var r=this,o=this.getComponents(),s=o.Group,a=o.GroupHeading,l=o.Menu,u=o.MenuList,c=o.MenuPortal,h=o.LoadingMessage,d=o.NoOptionsMessage,g=o.Option,y=this.commonProps,x=this.state.focusedOption,b=this.props,T=b.captureMenuScroll,f=b.inputValue,E=b.isLoading,A=b.loadingMessage,C=b.minMenuHeight,O=b.maxMenuHeight,D=b.menuIsOpen,I=b.menuPlacement,B=b.menuPosition,Z=b.menuPortalTarget,Y=b.menuShouldBlockScroll,V=b.menuShouldScrollIntoView,K=b.noOptionsMessage,Q=b.onMenuScrollToTop,le=b.onMenuScrollToBottom;if(!D)return null;var re=function(H,U){var W=H.type,j=H.data,$=H.isDisabled,ae=H.isSelected,we=H.label,me=H.value,Qe=x===j,$e=$?void 0:function(){return r.onOptionHover(j)},et=$?void 0:function(){return r.selectOption(j)},p="".concat(r.getElementId("option"),"-").concat(U),_={id:p,onClick:et,onMouseMove:$e,onMouseOver:$e,tabIndex:-1};return k.createElement(g,ne({},y,{innerProps:_,data:j,isDisabled:$,isSelected:ae,key:p,label:we,type:W,value:me,isFocused:Qe,innerRef:Qe?r.getFocusedOptionRef:void 0}),r.formatOptionLabel(H.data,"menu"))},se;if(this.hasOptions())se=this.getCategorizedOptions().map(function(F){if(F.type==="group"){var H=F.data,U=F.options,W=F.index,j="".concat(r.getElementId("group"),"-").concat(W),$="".concat(j,"-heading");return k.createElement(s,ne({},y,{key:j,data:H,options:U,Heading:a,headingProps:{id:$,data:F.data},label:r.formatGroupLabel(F.data)}),F.options.map(function(ae){return re(ae,"".concat(W,"-").concat(ae.index))}))}else if(F.type==="option")return re(F,"".concat(F.index))});else if(E){var de=A({inputValue:f});if(de===null)return null;se=k.createElement(h,y,de)}else{var pe=K({inputValue:f});if(pe===null)return null;se=k.createElement(d,y,pe)}var G={minMenuHeight:C,maxMenuHeight:O,menuPlacement:I,menuPosition:B,menuShouldScrollIntoView:V},Me=k.createElement(Bc,ne({},y,G),function(F){var H=F.ref,U=F.placerProps,W=U.placement,j=U.maxHeight;return k.createElement(l,ne({},y,G,{innerRef:H,innerProps:{onMouseDown:r.onMenuMouseDown,onMouseMove:r.onMenuMouseMove},isLoading:E,placement:W}),k.createElement(OS,{captureEnabled:T,onTopArrive:Q,onBottomArrive:le,lockEnabled:Y},function($){return k.createElement(u,ne({},y,{innerRef:function(we){r.getMenuListRef(we),$(we)},isLoading:E,maxHeight:j,focusedOption:x}),se)}))});return Z||B==="fixed"?k.createElement(c,ne({},y,{appendTo:Z,controlElement:this.controlRef,menuPlacement:I,menuPosition:B}),Me):Me}},{key:"renderFormField",value:function(){var r=this,o=this.props,s=o.delimiter,a=o.isDisabled,l=o.isMulti,u=o.name,c=this.state.selectValue;if(!(!u||a))if(l)if(s){var h=c.map(function(y){return r.getOptionValue(y)}).join(s);return k.createElement("input",{name:u,type:"hidden",value:h})}else{var d=c.length>0?c.map(function(y,x){return k.createElement("input",{key:"i-".concat(x),name:u,type:"hidden",value:r.getOptionValue(y)})}):k.createElement("input",{name:u,type:"hidden"});return k.createElement("div",null,d)}else{var g=c[0]?this.getOptionValue(c[0]):"";return k.createElement("input",{name:u,type:"hidden",value:g})}}},{key:"renderLiveRegion",value:function(){var r=this.commonProps,o=this.state,s=o.ariaSelection,a=o.focusedOption,l=o.focusedValue,u=o.isFocused,c=o.selectValue,h=this.getFocusableOptions();return k.createElement(yS,ne({},r,{ariaSelection:s,focusedOption:a,focusedValue:l,isFocused:u,selectValue:c,focusableOptions:h}))}},{key:"render",value:function(){var r=this.getComponents(),o=r.Control,s=r.IndicatorsContainer,a=r.SelectContainer,l=r.ValueContainer,u=this.props,c=u.className,h=u.id,d=u.isDisabled,g=u.menuIsOpen,y=this.state.isFocused,x=this.commonProps=this.getCommonProps();return k.createElement(a,ne({},x,{className:c,innerProps:{id:h,onKeyDown:this.onKeyDown},isDisabled:d,isFocused:y}),this.renderLiveRegion(),k.createElement(o,ne({},x,{innerRef:this.getControlRef,innerProps:{onMouseDown:this.onControlMouseDown,onTouchEnd:this.onControlTouchEnd},isDisabled:d,isFocused:y,menuIsOpen:g}),k.createElement(l,ne({},x,{isDisabled:d}),this.renderPlaceholderOrValue(),this.renderInput()),k.createElement(s,ne({},x,{isDisabled:d}),this.renderClearIndicator(),this.renderLoadingIndicator(),this.renderIndicatorSeparator(),this.renderDropdownIndicator())),this.renderMenu(),this.renderFormField())}}],[{key:"getDerivedStateFromProps",value:function(r,o){var s=o.prevProps,a=o.clearFocusValueOnUpdate,l=o.inputIsHiddenAfterUpdate,u=r.options,c=r.value,h=r.menuIsOpen,d=r.inputValue,g={};if(s&&(c!==s.value||u!==s.options||h!==s.menuIsOpen||d!==s.inputValue)){var y=Dc(c),x=h?VS(r,y):[],b=a?US(o,y):null,T=WS(o,x);g={selectValue:y,focusedOption:T,focusedValue:b,clearFocusValueOnUpdate:!1}}var f=l!=null&&r!==s?{inputIsHidden:l,inputIsHiddenAfterUpdate:void 0}:{};return Ne(Ne(Ne({},g),f),{},{prevProps:r})}}]),e}(Pe);mh.defaultProps=zS;var GS={defaultInputValue:"",defaultMenuIsOpen:!1,defaultValue:null},qS=function(t){var e,n;return n=e=function(r){Wi(s,r);var o=Gi(s);function s(){var a;zi(this,s);for(var l=arguments.length,u=new Array(l),c=0;c<l;c++)u[c]=arguments[c];return a=o.call.apply(o,[this].concat(u)),a.select=void 0,a.state={inputValue:a.props.inputValue!==void 0?a.props.inputValue:a.props.defaultInputValue,menuIsOpen:a.props.menuIsOpen!==void 0?a.props.menuIsOpen:a.props.defaultMenuIsOpen,value:a.props.value!==void 0?a.props.value:a.props.defaultValue},a.onChange=function(h,d){a.callProp("onChange",h,d),a.setState({value:h})},a.onInputChange=function(h,d){var g=a.callProp("onInputChange",h,d);a.setState({inputValue:g!==void 0?g:h})},a.onMenuOpen=function(){a.callProp("onMenuOpen"),a.setState({menuIsOpen:!0})},a.onMenuClose=function(){a.callProp("onMenuClose"),a.setState({menuIsOpen:!1})},a}return Vi(s,[{key:"focus",value:function(){this.select.focus()}},{key:"blur",value:function(){this.select.blur()}},{key:"getProp",value:function(l){return this.props[l]!==void 0?this.props[l]:this.state[l]}},{key:"callProp",value:function(l){if(typeof this.props[l]=="function"){for(var u,c=arguments.length,h=new Array(c>1?c-1:0),d=1;d<c;d++)h[d-1]=arguments[d];return(u=this.props)[l].apply(u,h)}}},{key:"render",value:function(){var l=this,u=this.props;u.defaultInputValue,u.defaultMenuIsOpen,u.defaultValue;var c=un(u,["defaultInputValue","defaultMenuIsOpen","defaultValue"]);return k.createElement(t,ne({},c,{ref:function(d){l.select=d},inputValue:this.getProp("inputValue"),menuIsOpen:this.getProp("menuIsOpen"),onChange:this.onChange,onInputChange:this.onInputChange,onMenuClose:this.onMenuClose,onMenuOpen:this.onMenuOpen,value:this.getProp("value")}))}}]),s}(Pe),e.defaultProps=GS,n},XS=qS(mh),YS=XS;const Ko=[{value:"assessing",label:"Assessing"},{value:"bookmarking",label:"Bookmarking"},{value:"classifying",label:"Classifying"},{value:"commenting",label:"Commenting"},{value:"describing",label:"Describing"},{value:"editing",label:"Editing"},{value:"highlighting",label:"Highlighting"},{value:"identifying",label:"Identifying"},{value:"linking",label:"Linking"},{value:"moderating",label:"Moderating"},{value:"questioning",label:"Questioning"},{value:"replying",label:"Replying"},{value:"supplementing",label:"Transcription"}];var gh=i=>{const t=i.content?Ko.find(e=>e.value===i.content):null;return k.createElement("div",{className:"r6o-purposedropdown"},k.createElement(YS,{value:t,onChange:i.onChange,options:Ko,isDisabled:!i.editable}))};const ZS=i=>k.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1000 940",width:i.width},k.createElement("metadata",null,"IcoFont Icons"),k.createElement("title",null,"simple-down"),k.createElement("glyph",{glyphName:"simple-down",unicode:"\uEAB2",horizAdvX:"1000"}),k.createElement("path",{fill:"currentColor",d:"M200 392.6l300 300 300-300-85.10000000000002-85.10000000000002-214.89999999999998 214.79999999999995-214.89999999999998-214.89999999999998-85.10000000000002 85.20000000000005z"})),KS=i=>k.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"180 150 700 800",width:i.width},k.createElement("metadata",null,"IcoFont Icons"),k.createElement("title",null,"close"),k.createElement("glyph",{glyphName:"close",unicode:"\uEEE4",horizAdvX:"1000"}),k.createElement("path",{fill:"currentColor",d:"M709.8 206.6c-64.39999999999998 65.50000000000003-128.89999999999998 131.20000000000002-194.19999999999993 197.6-8.600000000000023 8.699999999999989-22.400000000000034 8.800000000000011-31 0-65-66-129.70000000000005-131.8-194.5-197.6-8.600000000000023-8.699999999999989-22.400000000000034-8.599999999999994-30.900000000000034 0.09999999999999432-15.699999999999989 16.200000000000017-31.099999999999994 32.30000000000001-47.099999999999994 48.80000000000001-8.5 8.800000000000011-8.299999999999983 23 0.20000000000001705 31.69999999999999 63.099999999999966 64.19999999999999 127.89999999999998 130.10000000000002 193.59999999999997 197 8.600000000000023 8.699999999999989 8.5 22.80000000000001 0 31.599999999999966-65.19999999999999 66.40000000000009-130.2 132.5-194.7 198.10000000000002-8.5 8.700000000000045-8.5 22.800000000000068 0.20000000000001705 31.399999999999977l47.79999999999998 47.90000000000009c8.600000000000023 8.599999999999909 22.600000000000023 8.599999999999909 31.100000000000023-0.10000000000002274l194.2-197.30000000000007c8.600000000000023-8.699999999999932 22.399999999999977-8.699999999999932 31 0 64.70000000000005 65.80000000000007 129.20000000000005 131.4000000000001 194.20000000000005 197.5 8.599999999999909 8.700000000000045 22.5 8.800000000000068 31 0.10000000000002274 16-16.199999999999932 31.699999999999932-32.19999999999993 47.59999999999991-48.299999999999955 8.600000000000023-8.700000000000045 8.600000000000023-22.899999999999977 0.10000000000002274-31.600000000000023-63.799999999999955-65-128.5-130.89999999999998-194.19999999999993-197.79999999999995-8.600000000000023-8.700000000000045-8.600000000000023-22.900000000000034 0-31.600000000000023 65.19999999999993-66.40000000000003 130.0999999999999-132.5 194.5-198.20000000000005 8.599999999999909-8.699999999999989 8.5-22.799999999999955-0.10000000000002274-31.49999999999997l-47.80000000000007-48.099999999999994c-8.5-8.5-22.399999999999977-8.400000000000006-31 0.29999999999998295z"})),JS=i=>k.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 448 512",width:i.width},k.createElement("path",{fill:"currentColor",d:"M268 416h24a12 12 0 0 0 12-12V188a12 12 0 0 0-12-12h-24a12 12 0 0 0-12 12v216a12 12 0 0 0 12 12zM432 80h-82.41l-34-56.7A48 48 0 0 0 274.41 0H173.59a48 48 0 0 0-41.16 23.3L98.41 80H16A16 16 0 0 0 0 96v16a16 16 0 0 0 16 16h16v336a48 48 0 0 0 48 48h288a48 48 0 0 0 48-48V128h16a16 16 0 0 0 16-16V96a16 16 0 0 0-16-16zM171.84 50.91A6 6 0 0 1 177 48h94a6 6 0 0 1 5.15 2.91L293.61 80H154.39zM368 464H80V128h288zm-212-48h24a12 12 0 0 0 12-12V188a12 12 0 0 0-12-12h-24a12 12 0 0 0-12 12v216a12 12 0 0 0 12 12z"}));var QS=i=>{const[t,e]=mt(!1),[n,r]=mt(!1),o=h=>{e(!0),r(!1)},s=h=>{i.onDelete(i.body),r(!1)},a=h=>i.onUpdate(i.body,{...i.body,value:h.target.value}),l=h=>i.onUpdate(i.body,{...i.body,purpose:h.value}),u=i.body.modified||i.body.created,c=i.body.creator&&k.createElement("div",{className:"r6o-lastmodified"},k.createElement("span",{className:"r6o-lastmodified-by"},i.body.creator.name||i.body.creator.id),i.body.created&&k.createElement("span",{className:"r6o-lastmodified-at"},k.createElement(Bf,{datetime:i.env.toClientTime(u),locale:Ze.locale()})));return i.readOnly?k.createElement("div",{className:"r6o-widget comment"},k.createElement("div",{className:"r6o-readonly-comment"},i.body.value),c):k.createElement("div",{className:t?"r6o-widget comment editable":"r6o-widget comment"},k.createElement(Yu,{editable:t,content:i.body.value,onChange:a,onSaveAndClose:i.onSaveAndClose}),!t&&c,i.purposeSelector&&k.createElement(gh,{editable:t,content:i.body.purpose,onChange:l,onSaveAndClose:i.onSaveAndClose}),k.createElement("div",{className:n?"r6o-icon r6o-arrow-down r6o-menu-open":"r6o-icon r6o-arrow-down",onClick:()=>r(!n)},k.createElement(ZS,{width:12})),n&&k.createElement(k0,{onEdit:o,onDelete:s,onClickOutside:()=>r(!1)}))};const $S=Ko.map(i=>i.value),vh=(i,t)=>{const e=t?$S.indexOf(i.purpose)>-1:i.purpose=="commenting"||i.purpose=="replying";return i.type==="TextualBody"&&(!Object.prototype.hasOwnProperty.call(i,"purpose")||e)},yh=(i,t)=>{var e,n;if(t.editable===!0)return!1;if(t.editable===!1)return!0;if(t.editable==="MINE_ONLY"){const r=(e=i.creator)==null?void 0:e.id;return((n=t.env.user)==null?void 0:n.id)!==r}return t.readOnly},eE=(i,t)=>i||{type:"TextualBody",value:"",purpose:t?"replying":"commenting",draft:!0},wh=i=>{const t=i.annotation?i.annotation.bodies.filter(l=>vh(l,i.purposeSelector)):[],e=eE(t.find(l=>l.draft==!0),t.length>1),n=t.filter(l=>l!=e),r=l=>{const u=e.value,c=l.target.value;u.length===0&&c.length>0?i.onAppendBody({...e,value:c}):u.length>0&&c.length===0?i.onRemoveBody(e):i.onUpdateBody(e,{...e,value:c})},o=l=>i.onUpdateBody(e,{...e,purpose:l.value}),s=!i.readOnly&&i.annotation,a=n.length===0||!i.disableReply;return k.createElement(k.Fragment,null,n.map((l,u)=>k.createElement(QS,{key:u,env:i.env,purposeSelector:i.purposeSelector,readOnly:yh(l,i),body:l,onUpdate:i.onUpdateBody,onDelete:i.onRemoveBody,onSaveAndClose:i.onSaveAndClose})),s&&a&&k.createElement("div",{className:"r6o-widget comment editable"},k.createElement(Yu,{focus:i.focus,content:e.value,editable:!0,placeholder:n.length>0?Ze.t("Add a reply..."):i.textPlaceHolder||Ze.t("Add a comment..."),onChange:r,onSaveAndClose:()=>i.onSaveAndClose()}),i.purposeSelector&&e.value.length>0&&k.createElement(gh,{editable:!0,content:e.purpose,onChange:o,onSaveAndClose:()=>i.onSaveAndClose()})))};wh.disableDelete=(i,t)=>i.bodies.filter(n=>vh(n,t.purposeSelector)).some(n=>yh(n,t));var bh=wh;function Sh(i,t){i.prototype=Object.create(t.prototype),i.prototype.constructor=i,Ui(i,t)}function tE(i,t){return i.classList?!!t&&i.classList.contains(t):(" "+(i.className.baseVal||i.className)+" ").indexOf(" "+t+" ")!==-1}function nE(i,t){i.classList?i.classList.add(t):tE(i,t)||(typeof i.className=="string"?i.className=i.className+" "+t:i.setAttribute("class",(i.className&&i.className.baseVal||"")+" "+t))}function Eh(i,t){return i.replace(new RegExp("(^|\\s)"+t+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")}function iE(i,t){i.classList?i.classList.remove(t):typeof i.className=="string"?i.className=Eh(i.className,t):i.setAttribute("class",Eh(i.className&&i.className.baseVal||"",t))}var xh={disabled:!1},_h=k.createContext(null),Th=function(t){return t.scrollTop},Un="unmounted",Vt="exited",Ut="entering",dn="entered",Jo="exiting",bt=function(i){Sh(t,i);function t(n,r){var o;o=i.call(this,n,r)||this;var s=r,a=s&&!s.isMounting?n.enter:n.appear,l;return o.appearStatus=null,n.in?a?(l=Vt,o.appearStatus=Ut):l=dn:n.unmountOnExit||n.mountOnEnter?l=Un:l=Vt,o.state={status:l},o.nextCallback=null,o}t.getDerivedStateFromProps=function(r,o){var s=r.in;return s&&o.status===Un?{status:Vt}:null};var e=t.prototype;return e.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},e.componentDidUpdate=function(r){var o=null;if(r!==this.props){var s=this.state.status;this.props.in?s!==Ut&&s!==dn&&(o=Ut):(s===Ut||s===dn)&&(o=Jo)}this.updateStatus(!1,o)},e.componentWillUnmount=function(){this.cancelNextCallback()},e.getTimeouts=function(){var r=this.props.timeout,o,s,a;return o=s=a=r,r!=null&&typeof r!="number"&&(o=r.exit,s=r.enter,a=r.appear!==void 0?r.appear:s),{exit:o,enter:s,appear:a}},e.updateStatus=function(r,o){if(r===void 0&&(r=!1),o!==null)if(this.cancelNextCallback(),o===Ut){if(this.props.unmountOnExit||this.props.mountOnEnter){var s=this.props.nodeRef?this.props.nodeRef.current:k.findDOMNode(this);s&&Th(s)}this.performEnter(r)}else this.performExit();else this.props.unmountOnExit&&this.state.status===Vt&&this.setState({status:Un})},e.performEnter=function(r){var o=this,s=this.props.enter,a=this.context?this.context.isMounting:r,l=this.props.nodeRef?[a]:[k.findDOMNode(this),a],u=l[0],c=l[1],h=this.getTimeouts(),d=a?h.appear:h.enter;if(!r&&!s||xh.disabled){this.safeSetState({status:dn},function(){o.props.onEntered(u)});return}this.props.onEnter(u,c),this.safeSetState({status:Ut},function(){o.props.onEntering(u,c),o.onTransitionEnd(d,function(){o.safeSetState({status:dn},function(){o.props.onEntered(u,c)})})})},e.performExit=function(){var r=this,o=this.props.exit,s=this.getTimeouts(),a=this.props.nodeRef?void 0:k.findDOMNode(this);if(!o||xh.disabled){this.safeSetState({status:Vt},function(){r.props.onExited(a)});return}this.props.onExit(a),this.safeSetState({status:Jo},function(){r.props.onExiting(a),r.onTransitionEnd(s.exit,function(){r.safeSetState({status:Vt},function(){r.props.onExited(a)})})})},e.cancelNextCallback=function(){this.nextCallback!==null&&(this.nextCallback.cancel(),this.nextCallback=null)},e.safeSetState=function(r,o){o=this.setNextCallback(o),this.setState(r,o)},e.setNextCallback=function(r){var o=this,s=!0;return this.nextCallback=function(a){s&&(s=!1,o.nextCallback=null,r(a))},this.nextCallback.cancel=function(){s=!1},this.nextCallback},e.onTransitionEnd=function(r,o){this.setNextCallback(o);var s=this.props.nodeRef?this.props.nodeRef.current:k.findDOMNode(this),a=r==null&&!this.props.addEndListener;if(!s||a){setTimeout(this.nextCallback,0);return}if(this.props.addEndListener){var l=this.props.nodeRef?[this.nextCallback]:[s,this.nextCallback],u=l[0],c=l[1];this.props.addEndListener(u,c)}r!=null&&setTimeout(this.nextCallback,r)},e.render=function(){var r=this.state.status;if(r===Un)return null;var o=this.props,s=o.children;o.in,o.mountOnEnter,o.unmountOnExit,o.appear,o.enter,o.exit,o.timeout,o.addEndListener,o.onEnter,o.onEntering,o.onEntered,o.onExit,o.onExiting,o.onExited,o.nodeRef;var a=Io(o,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]);return k.createElement(_h.Provider,{value:null},typeof s=="function"?s(r,a):k.cloneElement(k.Children.only(s),a))},t}(k.Component);bt.contextType=_h,bt.propTypes={};function fn(){}bt.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:fn,onEntering:fn,onEntered:fn,onExit:fn,onExiting:fn,onExited:fn},bt.UNMOUNTED=Un,bt.EXITED=Vt,bt.ENTERING=Ut,bt.ENTERED=dn,bt.EXITING=Jo;var rE=bt,oE=function(t,e){return t&&e&&e.split(" ").forEach(function(n){return nE(t,n)})},Qo=function(t,e){return t&&e&&e.split(" ").forEach(function(n){return iE(t,n)})},$o=function(i){Sh(t,i);function t(){for(var n,r=arguments.length,o=new Array(r),s=0;s<r;s++)o[s]=arguments[s];return n=i.call.apply(i,[this].concat(o))||this,n.appliedClasses={appear:{},enter:{},exit:{}},n.onEnter=function(a,l){var u=n.resolveArguments(a,l),c=u[0],h=u[1];n.removeClasses(c,"exit"),n.addClass(c,h?"appear":"enter","base"),n.props.onEnter&&n.props.onEnter(a,l)},n.onEntering=function(a,l){var u=n.resolveArguments(a,l),c=u[0],h=u[1],d=h?"appear":"enter";n.addClass(c,d,"active"),n.props.onEntering&&n.props.onEntering(a,l)},n.onEntered=function(a,l){var u=n.resolveArguments(a,l),c=u[0],h=u[1],d=h?"appear":"enter";n.removeClasses(c,d),n.addClass(c,d,"done"),n.props.onEntered&&n.props.onEntered(a,l)},n.onExit=function(a){var l=n.resolveArguments(a),u=l[0];n.removeClasses(u,"appear"),n.removeClasses(u,"enter"),n.addClass(u,"exit","base"),n.props.onExit&&n.props.onExit(a)},n.onExiting=function(a){var l=n.resolveArguments(a),u=l[0];n.addClass(u,"exit","active"),n.props.onExiting&&n.props.onExiting(a)},n.onExited=function(a){var l=n.resolveArguments(a),u=l[0];n.removeClasses(u,"exit"),n.addClass(u,"exit","done"),n.props.onExited&&n.props.onExited(a)},n.resolveArguments=function(a,l){return n.props.nodeRef?[n.props.nodeRef.current,a]:[a,l]},n.getClassNames=function(a){var l=n.props.classNames,u=typeof l=="string",c=u&&l?l+"-":"",h=u?""+c+a:l[a],d=u?h+"-active":l[a+"Active"],g=u?h+"-done":l[a+"Done"];return{baseClassName:h,activeClassName:d,doneClassName:g}},n}var e=t.prototype;return e.addClass=function(r,o,s){var a=this.getClassNames(o)[s+"ClassName"],l=this.getClassNames("enter"),u=l.doneClassName;o==="appear"&&s==="done"&&u&&(a+=" "+u),s==="active"&&r&&Th(r),a&&(this.appliedClasses[o][s]=a,oE(r,a))},e.removeClasses=function(r,o){var s=this.appliedClasses[o],a=s.base,l=s.active,u=s.done;this.appliedClasses[o]={},a&&Qo(r,a),l&&Qo(r,l),u&&Qo(r,u)},e.render=function(){var r=this.props;r.classNames;var o=Io(r,["classNames"]);return k.createElement(rE,ne({},o,{onEnter:this.onEnter,onEntered:this.onEntered,onEntering:this.onEntering,onExit:this.onExit,onExiting:this.onExiting,onExited:this.onExited}))},t}(k.Component);$o.defaultProps={classNames:""},$o.propTypes={};var sE=$o;const aE=(i,t)=>t.filter(e=>(e.label?e.label:e).toLowerCase().startsWith(i.toLowerCase())),lE=(i,t)=>t(i);var uE=i=>{const t=ot(),[e,n]=mt(i.initialValue||""),[r,o]=mt([]),[s,a]=mt(null);kt(()=>{i.focus&&t.current.querySelector("input").focus({preventScroll:!0})},[]),kt(()=>{i.onChange&&i.onChange(e)},[e]);const l=d=>{if(typeof i.vocabulary=="function"){const g=lE(d,i.vocabulary);g.then?g.then(o):o(g)}else{const g=aE(d,i.vocabulary);o(g)}},u=()=>{if(s!==null)i.onSubmit(r[s]);else{const d=e.trim();if(d){const g=Array.isArray(i.vocabulary)?i.vocabulary.find(y=>(y.label||y).toLowerCase()===d.toLowerCase()):null;g?i.onSubmit(g):i.onSubmit(d)}}n(""),o([]),a(null)},c=d=>{if(d.which===13)u();else if(d.which===27)i.onCancel&&i.onCancel();else if(r.length>0){if(d.which===38)if(s===null)a(0);else{const g=Math.max(0,s-1);a(g)}else if(d.which===40)if(s===null)a(0);else{const g=Math.min(r.length-1,s+1);a(g)}}else d.which===40&&Array.isArray(i.vocabulary)&&o(i.vocabulary)},h=d=>{const{value:g}=d.target;n(g),a(null),g?l(g):o([])};return k.createElement("div",{ref:t,className:"r6o-autocomplete"},k.createElement("div",null,k.createElement("input",{onKeyDown:c,onChange:h,value:e,placeholder:i.placeholder})),k.createElement("ul",null,r.length>0&&r.map((d,g)=>k.createElement("li",{key:`${d.label?d.label:d}${g}`,onClick:u,onMouseEnter:()=>a(g),style:s===g?{backgroundColor:"#bde4ff"}:{}},d.label?d.label:d))))};const cE=i=>i||{type:"TextualBody",value:"",purpose:"tagging",draft:!0};var Ch=i=>{const t=i.annotation?i.annotation.bodies.filter(h=>h.purpose==="tagging"):[],e=cE(t.slice().reverse().find(h=>h.draft)),n=t.filter(h=>h!=e),[r,o]=mt(!1),s=h=>d=>{o(r===h?!1:h)},a=h=>{const d=e.value.trim(),g=h.trim();d.length===0&&g.length>0?i.onAppendBody({...e,value:g}):d.length>0&&g.length===0?i.onRemoveBody(e):d!==g&&i.onUpdateBody(e,{...e,value:g})},l=h=>d=>{d.stopPropagation(),i.onRemoveBody(h)},u=h=>{const d=h.uri?{type:"SpecificResource",purpose:"tagging",source:{id:h.uri,label:h.label}}:{type:"TextualBody",purpose:"tagging",value:h.label||h};e.value.trim().length===0?i.onAppendBody(d):i.onUpdateBody(e,d)},c=h=>h.value||h.source.label;return k.createElement("div",{className:"r6o-widget r6o-tag"},n.length>0&&k.createElement("ul",{className:"r6o-taglist"},n.map(h=>k.createElement("li",{key:c(h),onClick:s(h)},k.createElement("span",{className:"r6o-label"},c(h)),!i.readOnly&&k.createElement(sE,{in:r===h,timeout:200,classNames:"r6o-delete"},k.createElement("span",{className:"r6o-delete-wrapper",onClick:l(h)},k.createElement("span",{className:"r6o-delete"},k.createElement(KS,{width:12}))))))),!i.readOnly&&k.createElement(uE,{focus:i.focus,placeholder:i.textPlaceHolder||Ze.t("Add tag..."),vocabulary:i.vocabulary||[],onChange:a,onSubmit:u}))};class Ph extends Pe{constructor(t){super(t),this.element=k.createRef()}renderWidget(t){const e=this.props.widget({annotation:t.annotation,readOnly:t.readOnly,...t.config,onAppendBody:(n,r)=>t.onAppendBody(n,r),onUpdateBody:(n,r,o)=>t.onUpdateBody(n,r,o),onUpsertBody:(n,r,o)=>t.onUpsertBody(n,r,o),onRemoveBody:(n,r)=>t.onRemoveBody(n,r),onBatchModify:(n,r)=>t.onBatchModify(n,r),onSetProperty:(n,r)=>t.onSetProperty(n,r),onAddContext:n=>t.onAddContext(n),onSaveAndClose:()=>t.onSaveAndClose()});for(;this.element.current.firstChild;)this.element.current.removeChild(this.element.current.lastChild);this.element.current.appendChild(e)}componentDidMount(){this.renderWidget(this.props)}componentWillReceiveProps(t){this.element.current&&this.props.annotation!==t.annotation&&this.renderWidget(t)}render(){return k.createElement("div",{ref:this.element,className:"widget"})}}window.React=k,window.ReactDOM=k;const hE={COMMENT:bh,TAG:Ch},dE=[k.createElement(bh,null),k.createElement(Ch,null)],fE=i=>{const t=n=>{var r;return typeof n=="function"&&!!((r=n.prototype)!=null&&r.isReactComponent)},e=n=>typeof n=="function"&&(String(n).match(/return .+\(['|"].+['|"],\s*\{/g)||String(n).match(/return .+preact_compat/)||String(n).match(/return .+\.createElement/g));return t(i)||e(i)},pE=i=>{const t=(e,n,r)=>{if(typeof e=="string"||e instanceof String)return k.createElement(hE[e],n);if((r==null?void 0:r.toLowerCase())==="react")return k.createElement(e,n);if((r==null?void 0:r.toLowerCase())==="plainjs")return k.createElement(Ph,{widget:e,config:n});if(fE(e))return k.createElement(e,n);if(typeof e=="function"||e instanceof Function)return k.createElement(Ph,{widget:e,config:n});throw`${e} is not a valid plugin`};if(i.widget){const{widget:e,force:n,...r}=i;return t(e,r,n)}else return t(i)},Ah=14;var Oh=(i,t,e,n)=>{const r=i.getBoundingClientRect();t.className="r6o-editor r6o-arrow-top r6o-arrow-left";const{left:o,top:s,right:a,bottom:l}=e.getBoundingClientRect();if(t.style.top=`${l-r.top+Ah}px`,t.style.left=`${o-r.left}px`,n){const u=t.children[1].getBoundingClientRect(),{innerWidth:c,innerHeight:h}=i.ownerDocument.defaultView;if(u.right>c&&(t.classList.remove("r6o-arrow-left"),t.classList.add("r6o-arrow-right"),t.style.left=`${a-u.width-r.left}px`),u.bottom>h){t.classList.remove("r6o-arrow-top"),t.classList.add("r6o-arrow-bottom");const g=t.children[1].getBoundingClientRect().height;t.style.top=`${s-r.top-g-Ah}px`}const d=t.children[1].getBoundingClientRect();if(d.top<0){t.classList.add("pushed","down"),t.style.top=`${-r.top}px`;const g=l-r.top;d.height-r.top>g&&t.classList.remove("r6o-arrow-bottom")}d.left<0&&(t.classList.add("pushed","right"),t.style.left=`${-r.left}px`),requestAnimationFrame(()=>t.style.opacity=1)}};const Dh=i=>{const{top:t,left:e,width:n,height:r}=i.getBoundingClientRect();return`${t}, ${e}, ${n}, ${r}`};class mE extends Pe{constructor(e){super(e);P(this,"initResizeObserver",()=>{const e=this.props.autoPosition===void 0?!0:this.props.autoPosition;if(window!=null&&window.ResizeObserver){const n=new ResizeObserver(()=>{this.state.dragged||Oh(this.props.wrapperEl,this.element.current,this.props.selectedElement,e)});return n.observe(this.props.wrapperEl),()=>n.disconnect()}else this.state.dragged||Oh(this.props.wrapperEl,this.element.current,this.props.selectedElement,e)});P(this,"creationMeta",e=>{const n={},{user:r}=this.props.env;return r&&(n.creator={},r.id&&(n.creator.id=r.id),r.displayName&&(n.creator.name=r.displayName),n[e.created?"modified":"created"]=this.props.env.getCurrentTimeAdjusted()),n});P(this,"getCurrentAnnotation",()=>this.state.currentAnnotation.clone());P(this,"hasChanges",()=>{var e;return!((e=this.props.annotation)!=null&&e.isEqual(this.state.currentAnnotation))});P(this,"updateCurrentAnnotation",(e,n)=>{this.setState({currentAnnotation:this.state.currentAnnotation.clone(e)},()=>{n?this.onOk():this.props.onChanged&&this.props.onChanged()})});P(this,"onAppendBody",(e,n)=>this.updateCurrentAnnotation({body:[...this.state.currentAnnotation.bodies,{...e,...this.creationMeta(e)}]},n));P(this,"onUpdateBody",(e,n,r)=>this.updateCurrentAnnotation({body:this.state.currentAnnotation.bodies.map(o=>o===e?{...n,...this.creationMeta(n)}:o)},r));P(this,"onRemoveBody",(e,n)=>this.updateCurrentAnnotation({body:this.state.currentAnnotation.bodies.filter(r=>r!==e)},n));P(this,"onUpsertBody",(e,n,r)=>{if(e==null&&n!=null)this.onAppendBody(n,r);else if(e!=null&&n!=null)this.onUpdateBody(e,n,r);else if(e!=null&&n==null){const o=this.state.currentAnnotation.bodies.find(s=>s.purpose===e.purpose);o?this.onUpdateBody(o,e,r):this.onAppendBody(e,r)}});P(this,"onBatchModify",(e,n)=>{const r=e.filter(u=>u.action==="upsert"&&u.body).map(u=>({previous:this.state.currentAnnotation.bodies.find(c=>c.purpose===u.body.purpose),updated:{...u.body,...this.creationMeta(u.body)}})),o=e.filter(u=>u.action==="remove").map(u=>u.body),s=[...e.filter(u=>u.action==="append"||u.action==="upsert"&&u.updated&&!u.previous).map(u=>({...u.body,...this.creationMeta(u.body)})),...r.filter(u=>!u.previous).map(u=>u.updated)],a=[...e.filter(u=>u.action==="update"||u.action==="upsert"&&u.updated&&u.previous).map(u=>({previous:u.previous,updated:{...u.updated,...this.creationMeta(u.updated)}})),...r.filter(u=>u.previous)],l=[...this.state.currentAnnotation.bodies.filter(u=>!o.includes(u)).map(u=>{const c=a.find(h=>h.previous===u);return c?c.updated:u}),...s];this.updateCurrentAnnotation({body:l},n)});P(this,"onSetProperty",(e,n)=>{if(["@context","id","type","body","target"].includes(e))throw new Exception(`Cannot set ${e} - not allowed`);if(n)this.updateCurrentAnnotation({[e]:n});else{const o=this.currentAnnotation.clone();delete o[e],this.setState({currentAnnotation:o})}});P(this,"onAddContext",e=>{const{currentAnnotation:n}=this.state,r=Array.isArray(n.context)?n.context:[n.context];r.indexOf(e)<0&&(r.push(e),this.updateCurrentAnnotation({"@context":r}))});P(this,"onCancel",()=>this.props.onCancel(this.props.annotation));P(this,"onOk",()=>{const e=r=>r.clone({body:r.bodies.map(({draft:o,...s})=>s)}),{currentAnnotation:n}=this.state;n.bodies.length===0&&!this.props.allowEmpty?n.isSelection?this.onCancel():this.props.onAnnotationDeleted(this.props.annotation):n.isSelection?this.props.onAnnotationCreated(e(n).toAnnotation()):this.props.onAnnotationUpdated(e(n),this.props.annotation)});P(this,"onDelete",()=>this.props.onAnnotationDeleted(this.props.annotation));this.element=k.createRef(),this.state={currentAnnotation:e.annotation,dragged:!1,selectionBounds:Dh(e.selectedElement)}}componentWillReceiveProps(e){var o;const{selectionBounds:n}=this.state,r=Dh(e.selectedElement);(o=this.props.annotation)!=null&&o.isEqual(e.annotation)?this.setState({selectionBounds:r}):this.setState({currentAnnotation:e.annotation,selectionBounds:r}),this.props.modifiedTarget!=e.modifiedTarget&&this.state.currentAnnotation&&this.updateCurrentAnnotation({target:this.props.modifiedTarget}),n!=r&&this.element.current&&(this.removeObserver&&this.removeObserver(),this.removeObserver=this.initResizeObserver())}componentDidMount(){this.removeObserver=this.initResizeObserver(),new MutationObserver(()=>{this.element.current&&(this.removeObserver&&this.removeObserver(),this.removeObserver=this.initResizeObserver())}).observe(this.element.current,{childList:!0,subtree:!0})}componentWillUnmount(){this.removeObserver&&this.removeObserver()}render(){const{currentAnnotation:e}=this.state,n=this.props.widgets?this.props.widgets.map(pE):dE,r=s=>s.type.disableDelete?s.type.disableDelete(e,{...s.props,readOnly:this.props.readOnly,env:this.props.env}):!1,o=e&&(e.bodies.length>0||this.props.allowEmpty)&&!this.props.readOnly&&!e.isSelection&&!n.some(r);return k.createElement(xf,{disabled:!this.props.detachable,handle:".r6o-draggable",cancel:".r6o-btn, .r6o-btn *",onDrag:()=>this.setState({dragged:!0})},k.createElement("div",{ref:this.element,className:this.state.dragged?"r6o-editor dragged":"r6o-editor"},k.createElement("div",{className:"r6o-arrow"}),k.createElement("div",{className:"r6o-editor-inner"},n.map((s,a)=>k.cloneElement(s,{key:`${a}`,focus:a===0,annotation:e,readOnly:this.props.readOnly,env:this.props.env,onAppendBody:this.onAppendBody,onUpdateBody:this.onUpdateBody,onRemoveBody:this.onRemoveBody,onUpsertBody:this.onUpsertBody,onBatchModify:this.onBatchModify,onSetProperty:this.onSetProperty,onAddContext:this.onAddContext,onSaveAndClose:this.onOk})),this.props.readOnly?k.createElement("div",{className:"r6o-footer"},k.createElement("button",{className:"r6o-btn",onClick:this.onCancel},Ze.t("Close"))):k.createElement("div",{className:this.props.detachable?"r6o-footer r6o-draggable":"r6o-footer"},o&&k.createElement("button",{className:"r6o-btn left delete-annotation",title:Ze.t("Delete"),onClick:this.onDelete},k.createElement(JS,{width:12})),k.createElement("button",{className:"r6o-btn outline",onClick:this.onCancel},Ze.t("Cancel")),k.createElement("button",{className:"r6o-btn ",onClick:this.onOk},Ze.t("Ok"))))))}}var Ji,gE=new Uint8Array(16);function vE(){if(!Ji&&(Ji=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!Ji))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Ji(gE)}var yE=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function wE(i){return typeof i=="string"&&yE.test(i)}for(var He=[],es=0;es<256;++es)He.push((es+256).toString(16).substr(1));function bE(i){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,e=(He[i[t+0]]+He[i[t+1]]+He[i[t+2]]+He[i[t+3]]+"-"+He[i[t+4]]+He[i[t+5]]+"-"+He[i[t+6]]+He[i[t+7]]+"-"+He[i[t+8]]+He[i[t+9]]+"-"+He[i[t+10]]+He[i[t+11]]+He[i[t+12]]+He[i[t+13]]+He[i[t+14]]+He[i[t+15]]).toLowerCase();if(!wE(e))throw TypeError("Stringified UUID is invalid");return e}function Rh(i,t,e){i=i||{};var n=i.random||(i.rng||vE)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){e=e||0;for(var r=0;r<16;++r)t[e+r]=n[r];return t}return bE(n)}var SE=function i(t,e){if(t===e)return!0;if(t&&e&&typeof t=="object"&&typeof e=="object"){if(t.constructor!==e.constructor)return!1;var n,r,o;if(Array.isArray(t)){if(n=t.length,n!=e.length)return!1;for(r=n;r--!==0;)if(!i(t[r],e[r]))return!1;return!0}if(t.constructor===RegExp)return t.source===e.source&&t.flags===e.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===e.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===e.toString();if(o=Object.keys(t),n=o.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!Object.prototype.hasOwnProperty.call(e,o[r]))return!1;for(r=n;r--!==0;){var s=o[r];if(!i(t[s],e[s]))return!1}return!0}return t!==t&&e!==e},Mh=SE;const lr=class{constructor(t,e){P(this,"clone",(t,e)=>new lr({...this.underlying,...t},{...this.opts,...e}));P(this,"selector",t=>{const{target:e}=this.underlying;if(e.selector)return(Array.isArray(e.selector)?e.selector:[e.selector]).find(r=>r.type===t)});this.underlying=t,this.opts=e}isEqual(t){return(t==null?void 0:t.type)!=="Annotation"?!1:this.underlying===t.underlying?!0:!this.underlying.id||!t.underlying.id?!1:Mh(this.underlying,t.underlying)}get readOnly(){var t;return(t=this.opts)==null?void 0:t.readOnly}get id(){return this.underlying.id}get context(){return this.underlying["@context"]}get type(){return this.underlying.type}get motivation(){return this.underlying.motivation}get body(){return this.underlying.body}get target(){return this.underlying.target}get bodies(){return Array.isArray(this.underlying.body)?this.underlying.body:[this.underlying.body]}set bodies(t){this.underlying.body=t}get targets(){return Array.isArray(this.underlying.target)?this.underlying.target:[this.underlying.target]}get quote(){var t;return(t=this.selector("TextQuoteSelector"))==null?void 0:t.exact}get start(){var t;return(t=this.selector("TextPositionSelector"))==null?void 0:t.start}get end(){var t;return(t=this.selector("TextPositionSelector"))==null?void 0:t.end}};let St=lr;P(St,"create",t=>{const e={"@context":"http://www.w3.org/ns/anno.jsonld",type:"Annotation",id:`#${Rh()}`,body:[]};return new lr({...e,...t})});class Wn{constructor(t,e){P(this,"clone",t=>{const e=new Wn;return e.underlying=JSON.parse(JSON.stringify(this.underlying)),t&&(e.underlying={...e.underlying,...t}),e});P(this,"selector",t=>{const{target:e}=this.underlying;if(e.selector)return(Array.isArray(e.selector)?e.selector:[e.selector]).find(r=>r.type===t)});P(this,"toAnnotation",()=>{const t=Object.assign({},this.underlying,{type:"Annotation",id:`#${Rh()}`});return new St(t)});this.underlying={"@context":"http://www.w3.org/ns/anno.jsonld",type:"Selection",body:e||[],target:t}}get context(){return this.underlying["@context"]}get type(){return this.underlying.type}get body(){return this.underlying.body}get target(){return this.underlying.target}get targets(){return Array.isArray(this.underlying.target)?this.underlying.target:[this.underlying.target]}isEqual(t){return t?Mh(this.underlying,t.underlying):!1}get bodies(){return Array.isArray(this.underlying.body)?this.underlying.body:[this.underlying.body]}get quote(){var t;return(t=this.selector("TextQuoteSelector"))==null?void 0:t.exact}get isSelection(){return!0}}let ts=0;var EE=()=>({setServerTime:i=>{const t=Date.now();ts=i-t},getCurrentTimeAdjusted:()=>new Date(Date.now()+ts).toISOString(),toClientTime:i=>Date.parse(i)-ts});const xE=(i,t)=>{if(i){const e=i==="auto"?window.navigator.userLanguage||window.navigator.language:i,n=e.split("-")[0].toLowerCase(),r=[e,n].find(o=>F0.includes(o));r||console.warn(`Unsupported locale '${e}'. Falling back to default en.`),Ze.init(r,t)}else Ze.init(null,t)};var Fh={exports:{}};(function(i){//! openseadragon 3.0.0
//! Built on 2021-12-15
//! Git commit: v3.0.0-0-3eded36
//! http://openseadragon.github.io
//! License: http://openseadragon.github.io/license/
function t(e){return new t.Viewer(e)}(function(e){e.version={versionStr:"3.0.0",major:parseInt("3",10),minor:parseInt("0",10),revision:parseInt("0",10)};var n={"[object Boolean]":"boolean","[object Number]":"number","[object String]":"string","[object Function]":"function","[object Array]":"array","[object Date]":"date","[object RegExp]":"regexp","[object Object]":"object"},r=Object.prototype.toString,o=Object.prototype.hasOwnProperty;e.isFunction=function(s){return e.type(s)==="function"},e.isArray=Array.isArray||function(s){return e.type(s)==="array"},e.isWindow=function(s){return s&&typeof s=="object"&&"setInterval"in s},e.type=function(s){return s==null?String(s):n[r.call(s)]||"object"},e.isPlainObject=function(s){if(!s||t.type(s)!=="object"||s.nodeType||e.isWindow(s)||s.constructor&&!o.call(s,"constructor")&&!o.call(s.constructor.prototype,"isPrototypeOf"))return!1;var a;for(var l in s)a=l;return a===void 0||o.call(s,a)},e.isEmptyObject=function(s){for(var a in s)return!1;return!0},e.freezeObject=function(s){return Object.freeze?e.freezeObject=Object.freeze:e.freezeObject=function(a){return a},e.freezeObject(s)},e.supportsCanvas=function(){var s=document.createElement("canvas");return!!(e.isFunction(s.getContext)&&s.getContext("2d"))}(),e.isCanvasTainted=function(s){var a=!1;try{s.getContext("2d").getImageData(0,0,1,1)}catch{a=!0}return a},e.supportsAddEventListener=function(){return!!(document.documentElement.addEventListener&&document.addEventListener)}(),e.supportsRemoveEventListener=function(){return!!(document.documentElement.removeEventListener&&document.removeEventListener)}(),e.supportsEventListenerOptions=function(){var s=0;if(e.supportsAddEventListener)try{var a={get capture(){return s++,!1},get once(){return s++,!1},get passive(){return s++,!1}};window.addEventListener("test",null,a),window.removeEventListener("test",null,a)}catch{s=0}return s>=3}(),e.getCurrentPixelDensityRatio=function(){if(e.supportsCanvas){var s=document.createElement("canvas").getContext("2d"),a=window.devicePixelRatio||1,l=s.webkitBackingStorePixelRatio||s.mozBackingStorePixelRatio||s.msBackingStorePixelRatio||s.oBackingStorePixelRatio||s.backingStorePixelRatio||1;return Math.max(a,1)/l}else return 1},e.pixelDensityRatio=e.getCurrentPixelDensityRatio()})(t),function(e){e.extend=function(){var l,u,c,h,d,g,y=arguments[0]||{},x=arguments.length,b=!1,T=1;for(typeof y=="boolean"&&(b=y,y=arguments[1]||{},T=2),typeof y!="object"&&!t.isFunction(y)&&(y={}),x===T&&(y=this,--T);T<x;T++)if(l=arguments[T],l!==null||l!==void 0)for(u in l)c=y[u],h=l[u],y!==h&&(b&&h&&(t.isPlainObject(h)||(d=t.isArray(h)))?(d?(d=!1,g=c&&t.isArray(c)?c:[]):g=c&&t.isPlainObject(c)?c:{},y[u]=t.extend(b,g,h)):h!==void 0&&(y[u]=h));return y};var n=function(){if(typeof navigator!="object")return!1;var l=navigator.userAgent;return typeof l!="string"?!1:l.indexOf("iPhone")!==-1||l.indexOf("iPad")!==-1||l.indexOf("iPod")!==-1};e.extend(e,{DEFAULT_SETTINGS:{xmlPath:null,tileSources:null,tileHost:null,initialPage:0,crossOriginPolicy:!1,ajaxWithCredentials:!1,loadTilesWithAjax:!1,ajaxHeaders:{},panHorizontal:!0,panVertical:!0,constrainDuringPan:!1,wrapHorizontal:!1,wrapVertical:!1,visibilityRatio:.5,minPixelRatio:.5,defaultZoomLevel:0,minZoomLevel:null,maxZoomLevel:null,homeFillsViewer:!1,clickTimeThreshold:300,clickDistThreshold:5,dblClickTimeThreshold:300,dblClickDistThreshold:20,springStiffness:6.5,animationTime:1.2,gestureSettingsMouse:{dragToPan:!0,scrollToZoom:!0,clickToZoom:!0,dblClickToZoom:!1,pinchToZoom:!1,zoomToRefPoint:!0,flickEnabled:!1,flickMinSpeed:120,flickMomentum:.25,pinchRotate:!1},gestureSettingsTouch:{dragToPan:!0,scrollToZoom:!1,clickToZoom:!1,dblClickToZoom:!0,pinchToZoom:!0,zoomToRefPoint:!0,flickEnabled:!0,flickMinSpeed:120,flickMomentum:.25,pinchRotate:!1},gestureSettingsPen:{dragToPan:!0,scrollToZoom:!1,clickToZoom:!0,dblClickToZoom:!1,pinchToZoom:!1,zoomToRefPoint:!0,flickEnabled:!1,flickMinSpeed:120,flickMomentum:.25,pinchRotate:!1},gestureSettingsUnknown:{dragToPan:!0,scrollToZoom:!1,clickToZoom:!1,dblClickToZoom:!0,pinchToZoom:!0,zoomToRefPoint:!0,flickEnabled:!0,flickMinSpeed:120,flickMomentum:.25,pinchRotate:!1},zoomPerClick:2,zoomPerScroll:1.2,zoomPerSecond:1,blendTime:0,alwaysBlend:!1,autoHideControls:!0,immediateRender:!1,minZoomImageRatio:.9,maxZoomPixelRatio:1.1,smoothTileEdgesMinZoom:1.1,iOSDevice:n(),pixelsPerWheelLine:40,pixelsPerArrowPress:40,autoResize:!0,preserveImageSizeOnResize:!1,minScrollDeltaTime:50,rotationIncrement:90,showSequenceControl:!0,sequenceControlAnchor:null,preserveViewport:!1,preserveOverlays:!1,navPrevNextWrap:!1,showNavigationControl:!0,navigationControlAnchor:null,showZoomControl:!0,showHomeControl:!0,showFullPageControl:!0,showRotationControl:!1,showFlipControl:!1,controlsFadeDelay:2e3,controlsFadeLength:1500,mouseNavEnabled:!0,showNavigator:!1,navigatorId:null,navigatorPosition:null,navigatorSizeRatio:.2,navigatorMaintainSizeRatio:!1,navigatorTop:null,navigatorLeft:null,navigatorHeight:null,navigatorWidth:null,navigatorAutoResize:!0,navigatorAutoFade:!0,navigatorRotate:!0,navigatorBackground:"#000",navigatorOpacity:.8,navigatorBorderColor:"#555",navigatorDisplayRegionColor:"#900",degrees:0,flipped:!1,opacity:1,preload:!1,compositeOperation:null,imageSmoothingEnabled:!0,placeholderFillStyle:null,showReferenceStrip:!1,referenceStripScroll:"horizontal",referenceStripElement:null,referenceStripHeight:null,referenceStripWidth:null,referenceStripPosition:"BOTTOM_LEFT",referenceStripSizeRatio:.2,collectionRows:3,collectionColumns:0,collectionLayout:"horizontal",collectionMode:!1,collectionTileSize:800,collectionTileMargin:80,imageLoaderLimit:0,maxImageCacheCount:200,timeout:3e4,useCanvas:!0,prefixUrl:"/images/",navImages:{zoomIn:{REST:"zoomin_rest.png",GROUP:"zoomin_grouphover.png",HOVER:"zoomin_hover.png",DOWN:"zoomin_pressed.png"},zoomOut:{REST:"zoomout_rest.png",GROUP:"zoomout_grouphover.png",HOVER:"zoomout_hover.png",DOWN:"zoomout_pressed.png"},home:{REST:"home_rest.png",GROUP:"home_grouphover.png",HOVER:"home_hover.png",DOWN:"home_pressed.png"},fullpage:{REST:"fullpage_rest.png",GROUP:"fullpage_grouphover.png",HOVER:"fullpage_hover.png",DOWN:"fullpage_pressed.png"},rotateleft:{REST:"rotateleft_rest.png",GROUP:"rotateleft_grouphover.png",HOVER:"rotateleft_hover.png",DOWN:"rotateleft_pressed.png"},rotateright:{REST:"rotateright_rest.png",GROUP:"rotateright_grouphover.png",HOVER:"rotateright_hover.png",DOWN:"rotateright_pressed.png"},flip:{REST:"flip_rest.png",GROUP:"flip_grouphover.png",HOVER:"flip_hover.png",DOWN:"flip_pressed.png"},previous:{REST:"previous_rest.png",GROUP:"previous_grouphover.png",HOVER:"previous_hover.png",DOWN:"previous_pressed.png"},next:{REST:"next_rest.png",GROUP:"next_grouphover.png",HOVER:"next_hover.png",DOWN:"next_pressed.png"}},debugMode:!1,debugGridColor:["#437AB2","#1B9E77","#D95F02","#7570B3","#E7298A","#66A61E","#E6AB02","#A6761D","#666666"]},SIGNAL:"----seadragon----",delegate:function(l,u){return function(){var c=arguments;return c===void 0&&(c=[]),u.apply(l,c)}},BROWSERS:{UNKNOWN:0,IE:1,FIREFOX:2,SAFARI:3,CHROME:4,OPERA:5,EDGE:6,CHROMEEDGE:7},_viewers:new Map,getViewer:function(l){return e._viewers.get(this.getElement(l))},getElement:function(l){return typeof l=="string"&&(l=document.getElementById(l)),l},getElementPosition:function(l){var u=new e.Point,c,h;for(l=e.getElement(l),c=e.getElementStyle(l).position==="fixed",h=a(l,c);h;)u.x+=l.offsetLeft,u.y+=l.offsetTop,c&&(u=u.plus(e.getPageScroll())),l=h,c=e.getElementStyle(l).position==="fixed",h=a(l,c);return u},getElementOffset:function(l){l=e.getElement(l);var u=l&&l.ownerDocument,c,h,d={top:0,left:0};return u?(c=u.documentElement,typeof l.getBoundingClientRect!="undefined"&&(d=l.getBoundingClientRect()),h=u===u.window?u:u.nodeType===9?u.defaultView||u.parentWindow:!1,new e.Point(d.left+(h.pageXOffset||c.scrollLeft)-(c.clientLeft||0),d.top+(h.pageYOffset||c.scrollTop)-(c.clientTop||0))):new e.Point},getElementSize:function(l){return l=e.getElement(l),new e.Point(l.clientWidth,l.clientHeight)},getElementStyle:document.documentElement.currentStyle?function(l){return l=e.getElement(l),l.currentStyle}:function(l){return l=e.getElement(l),window.getComputedStyle(l,"")},getCssPropertyWithVendorPrefix:function(l){var u={};return e.getCssPropertyWithVendorPrefix=function(c){if(u[c]!==void 0)return u[c];var h=document.createElement("div").style,d=null;if(h[c]!==void 0)d=c;else for(var g=["Webkit","Moz","MS","O","webkit","moz","ms","o"],y=e.capitalizeFirstLetter(c),x=0;x<g.length;x++){var b=g[x]+y;if(h[b]!==void 0){d=b;break}}return u[c]=d,d},e.getCssPropertyWithVendorPrefix(l)},capitalizeFirstLetter:function(l){return l.charAt(0).toUpperCase()+l.slice(1)},positiveModulo:function(l,u){var c=l%u;return c<0&&(c+=u),c},pointInElement:function(l,u){l=e.getElement(l);var c=e.getElementOffset(l),h=e.getElementSize(l);return u.x>=c.x&&u.x<c.x+h.x&&u.y<c.y+h.y&&u.y>=c.y},getMousePosition:function(l){if(typeof l.pageX=="number")e.getMousePosition=function(u){var c=new e.Point;return c.x=u.pageX,c.y=u.pageY,c};else if(typeof l.clientX=="number")e.getMousePosition=function(u){var c=new e.Point;return c.x=u.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,c.y=u.clientY+document.body.scrollTop+document.documentElement.scrollTop,c};else throw new Error("Unknown event mouse position, no known technique.");return e.getMousePosition(l)},getPageScroll:function(){var l=document.documentElement||{},u=document.body||{};if(typeof window.pageXOffset=="number")e.getPageScroll=function(){return new e.Point(window.pageXOffset,window.pageYOffset)};else if(u.scrollLeft||u.scrollTop)e.getPageScroll=function(){return new e.Point(document.body.scrollLeft,document.body.scrollTop)};else if(l.scrollLeft||l.scrollTop)e.getPageScroll=function(){return new e.Point(document.documentElement.scrollLeft,document.documentElement.scrollTop)};else return new e.Point(0,0);return e.getPageScroll()},setPageScroll:function(l){if(typeof window.scrollTo!="undefined")e.setPageScroll=function(h){window.scrollTo(h.x,h.y)};else{var u=e.getPageScroll();if(u.x===l.x&&u.y===l.y)return;document.body.scrollLeft=l.x,document.body.scrollTop=l.y;var c=e.getPageScroll();if(c.x!==u.x&&c.y!==u.y){e.setPageScroll=function(h){document.body.scrollLeft=h.x,document.body.scrollTop=h.y};return}if(document.documentElement.scrollLeft=l.x,document.documentElement.scrollTop=l.y,c=e.getPageScroll(),c.x!==u.x&&c.y!==u.y){e.setPageScroll=function(h){document.documentElement.scrollLeft=h.x,document.documentElement.scrollTop=h.y};return}e.setPageScroll=function(h){}}e.setPageScroll(l)},getWindowSize:function(){var l=document.documentElement||{},u=document.body||{};if(typeof window.innerWidth=="number")e.getWindowSize=function(){return new e.Point(window.innerWidth,window.innerHeight)};else if(l.clientWidth||l.clientHeight)e.getWindowSize=function(){return new e.Point(document.documentElement.clientWidth,document.documentElement.clientHeight)};else if(u.clientWidth||u.clientHeight)e.getWindowSize=function(){return new e.Point(document.body.clientWidth,document.body.clientHeight)};else throw new Error("Unknown window size, no known technique.");return e.getWindowSize()},makeCenteredNode:function(l){l=e.getElement(l);var u=[e.makeNeutralElement("div"),e.makeNeutralElement("div"),e.makeNeutralElement("div")];return e.extend(u[0].style,{display:"table",height:"100%",width:"100%"}),e.extend(u[1].style,{display:"table-row"}),e.extend(u[2].style,{display:"table-cell",verticalAlign:"middle",textAlign:"center"}),u[0].appendChild(u[1]),u[1].appendChild(u[2]),u[2].appendChild(l),u[0]},makeNeutralElement:function(l){var u=document.createElement(l),c=u.style;return c.background="transparent none",c.border="none",c.margin="0px",c.padding="0px",c.position="static",u},now:function(){return Date.now?e.now=Date.now:e.now=function(){return new Date().getTime()},e.now()},makeTransparentImage:function(l){var u=e.makeNeutralElement("img");return u.src=l,u},setElementOpacity:function(l,u,c){var h,d;l=e.getElement(l),c&&!e.Browser.alpha&&(u=Math.round(u)),e.Browser.opacity?l.style.opacity=u<1?u:"":u<1?(h=Math.round(100*u),d="alpha(opacity="+h+")",l.style.filter=d):l.style.filter=""},setElementTouchActionNone:function(l){l=e.getElement(l),typeof l.style.touchAction!="undefined"?l.style.touchAction="none":typeof l.style.msTouchAction!="undefined"&&(l.style.msTouchAction="none")},setElementPointerEvents:function(l,u){l=e.getElement(l),typeof l.style.pointerEvents!="undefined"&&(l.style.pointerEvents=u)},setElementPointerEventsNone:function(l){e.setElementPointerEvents(l,"none")},addClass:function(l,u){l=e.getElement(l),l.className?(" "+l.className+" ").indexOf(" "+u+" ")===-1&&(l.className+=" "+u):l.className=u},indexOf:function(l,u,c){return Array.prototype.indexOf?this.indexOf=function(h,d,g){return h.indexOf(d,g)}:this.indexOf=function(h,d,g){var y,x=g||0,b;if(!h)throw new TypeError;if(b=h.length,b===0||x>=b)return-1;for(x<0&&(x=b-Math.abs(x)),y=x;y<b;y++)if(h[y]===d)return y;return-1},this.indexOf(l,u,c)},removeClass:function(l,u){var c,h=[],d;for(l=e.getElement(l),c=l.className.split(/\s+/),d=0;d<c.length;d++)c[d]&&c[d]!==u&&h.push(c[d]);l.className=h.join(" ")},normalizeEventListenerOptions:function(l){var u;return typeof l!="undefined"?typeof l=="boolean"?u=e.supportsEventListenerOptions?{capture:l}:l:u=e.supportsEventListenerOptions?l:typeof l.capture!="undefined"?l.capture:!1:u=e.supportsEventListenerOptions?{capture:!1}:!1,u},addEvent:function(){if(e.supportsAddEventListener)return function(l,u,c,h){h=e.normalizeEventListenerOptions(h),l=e.getElement(l),l.addEventListener(u,c,h)};if(document.documentElement.attachEvent&&document.attachEvent)return function(l,u,c){l=e.getElement(l),l.attachEvent("on"+u,c)};throw new Error("No known event model.")}(),removeEvent:function(){if(e.supportsRemoveEventListener)return function(l,u,c,h){h=e.normalizeEventListenerOptions(h),l=e.getElement(l),l.removeEventListener(u,c,h)};if(document.documentElement.detachEvent&&document.detachEvent)return function(l,u,c){l=e.getElement(l),l.detachEvent("on"+u,c)};throw new Error("No known event model.")}(),cancelEvent:function(l){l.preventDefault()},eventIsCanceled:function(l){return l.defaultPrevented},stopEvent:function(l){l.stopPropagation()},createCallback:function(l,u){var c=[],h;for(h=2;h<arguments.length;h++)c.push(arguments[h]);return function(){var d=c.concat([]),g;for(g=0;g<arguments.length;g++)d.push(arguments[g]);return u.apply(l,d)}},getUrlParameter:function(l){var u=s[l];return u||null},getUrlProtocol:function(l){var u=l.match(/^([a-z]+:)\/\//i);return u===null?window.location.protocol:u[1].toLowerCase()},createAjaxRequest:function(l){var u;try{u=!!new ActiveXObject("Microsoft.XMLHTTP")}catch{u=!1}if(u)window.XMLHttpRequest?e.createAjaxRequest=function(c){return c?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest}:e.createAjaxRequest=function(){return new ActiveXObject("Microsoft.XMLHTTP")};else if(window.XMLHttpRequest)e.createAjaxRequest=function(){return new XMLHttpRequest};else throw new Error("Browser doesn't support XMLHttpRequest.");return e.createAjaxRequest(l)},makeAjaxRequest:function(l,u,c){var h,d,g;e.isPlainObject(l)&&(u=l.success,c=l.error,h=l.withCredentials,d=l.headers,g=l.responseType||null,l=l.url);var y=e.getUrlProtocol(l),x=e.createAjaxRequest(y==="file:");if(!e.isFunction(u))throw new Error("makeAjaxRequest requires a success callback");x.onreadystatechange=function(){x.readyState===4&&(x.onreadystatechange=function(){},x.status>=200&&x.status<300||x.status===0&&y!=="http:"&&y!=="https:"?u(x):(e.console.log("AJAX request returned %d: %s",x.status,l),e.isFunction(c)&&c(x)))};try{if(x.open("GET",l,!0),g&&(x.responseType=g),d)for(var b in d)Object.prototype.hasOwnProperty.call(d,b)&&d[b]&&x.setRequestHeader(b,d[b]);h&&(x.withCredentials=!0),x.send(null)}catch(T){e.console.log("%s while making AJAX request: %s",T.name,T.message),x.onreadystatechange=function(){},e.isFunction(c)&&c(x,T)}return x},jsonp:function(l){var u,c=l.url,h=document.head||document.getElementsByTagName("head")[0]||document.documentElement,d=l.callbackName||"openseadragon"+e.now(),g=window[d],y="$1"+d+"$2",x=l.param||"callback",b=l.callback;c=c.replace(/(=)\?(&|$)|\?\?/i,y),c+=(/\?/.test(c)?"&":"?")+x+"="+d,window[d]=function(T){if(g)window[d]=g;else try{delete window[d]}catch{}b&&e.isFunction(b)&&b(T)},u=document.createElement("script"),(l.async!==void 0||l.async!==!1)&&(u.async="async"),l.scriptCharset&&(u.charset=l.scriptCharset),u.src=c,u.onload=u.onreadystatechange=function(T,f){(f||!u.readyState||/loaded|complete/.test(u.readyState))&&(u.onload=u.onreadystatechange=null,h&&u.parentNode&&h.removeChild(u),u=void 0)},h.insertBefore(u,h.firstChild)},createFromDZI:function(){throw"OpenSeadragon.createFromDZI is deprecated, use Viewer.open."},parseXml:function(l){if(window.DOMParser)e.parseXml=function(u){var c=null,h;return h=new DOMParser,c=h.parseFromString(u,"text/xml"),c};else if(window.ActiveXObject)e.parseXml=function(u){var c=null;return c=new ActiveXObject("Microsoft.XMLDOM"),c.async=!1,c.loadXML(u),c};else throw new Error("Browser doesn't support XML DOM.");return e.parseXml(l)},parseJSON:function(l){return e.parseJSON=window.JSON.parse,e.parseJSON(l)},imageFormatSupported:function(l){return l=l||"",!!o[l.toLowerCase()]},setImageFormatsSupported:function(l){e.extend(o,l)}});var r=function(l){};e.console=window.console||{log:r,debug:r,info:r,warn:r,error:r,assert:r},e.Browser={vendor:e.BROWSERS.UNKNOWN,version:0,alpha:!0};var o={bmp:!1,jpeg:!0,jpg:!0,png:!0,tif:!1,wdp:!1},s={};(function(){var l=navigator.appVersion,u=navigator.userAgent,c;switch(navigator.appName){case"Microsoft Internet Explorer":!!window.attachEvent&&!!window.ActiveXObject&&(e.Browser.vendor=e.BROWSERS.IE,e.Browser.version=parseFloat(u.substring(u.indexOf("MSIE")+5,u.indexOf(";",u.indexOf("MSIE")))));break;case"Netscape":window.addEventListener&&(u.indexOf("Edge")>=0?(e.Browser.vendor=e.BROWSERS.EDGE,e.Browser.version=parseFloat(u.substring(u.indexOf("Edge")+5))):u.indexOf("Edg")>=0?(e.Browser.vendor=e.BROWSERS.CHROMEEDGE,e.Browser.version=parseFloat(u.substring(u.indexOf("Edg")+4))):u.indexOf("Firefox")>=0?(e.Browser.vendor=e.BROWSERS.FIREFOX,e.Browser.version=parseFloat(u.substring(u.indexOf("Firefox")+8))):u.indexOf("Safari")>=0?(e.Browser.vendor=u.indexOf("Chrome")>=0?e.BROWSERS.CHROME:e.BROWSERS.SAFARI,e.Browser.version=parseFloat(u.substring(u.substring(0,u.indexOf("Safari")).lastIndexOf("/")+1,u.indexOf("Safari")))):(c=new RegExp("Trident/.*rv:([0-9]{1,}[.0-9]{0,})"),c.exec(u)!==null&&(e.Browser.vendor=e.BROWSERS.IE,e.Browser.version=parseFloat(RegExp.$1))));break;case"Opera":e.Browser.vendor=e.BROWSERS.OPERA,e.Browser.version=parseFloat(l);break}var h=window.location.search.substring(1),d=h.split("&"),g,y,x;for(x=0;x<d.length;x++)if(g=d[x],y=g.indexOf("="),y>0){var b=g.substring(0,y),T=g.substring(y+1);try{s[b]=decodeURIComponent(T)}catch{e.console.error("Ignoring malformed URL parameter: %s=%s",b,T)}}e.Browser.alpha=!(e.Browser.vendor===e.BROWSERS.CHROME&&e.Browser.version<2),e.Browser.opacity=!0,e.Browser.vendor===e.BROWSERS.IE&&e.Browser.version<11&&e.console.error("Internet Explorer versions < 11 are not supported by OpenSeadragon")})(),function(l){var u=l.requestAnimationFrame||l.mozRequestAnimationFrame||l.webkitRequestAnimationFrame||l.msRequestAnimationFrame,c=l.cancelAnimationFrame||l.mozCancelAnimationFrame||l.webkitCancelAnimationFrame||l.msCancelAnimationFrame;if(u&&c)e.requestAnimationFrame=function(){return u.apply(l,arguments)},e.cancelAnimationFrame=function(){return c.apply(l,arguments)};else{var h=[],d=[],g=0,y;e.requestAnimationFrame=function(x){return h.push([++g,x]),y||(y=setInterval(function(){if(h.length){var b=e.now(),T=d;for(d=h,h=T;d.length;)d.shift()[1](b)}else clearInterval(y),y=void 0},1e3/50)),g},e.cancelAnimationFrame=function(x){var b,T;for(b=0,T=h.length;b<T;b+=1)if(h[b][0]===x){h.splice(b,1);return}for(b=0,T=d.length;b<T;b+=1)if(d[b][0]===x){d.splice(b,1);return}}}}(window);function a(l,u){return u&&l!==document.body?document.body:l.offsetParent}}(t),function(e,n){i.exports?i.exports=n():e.OpenSeadragon=n()}(_t,function(){return t}),function(e){var n={supportsFullScreen:!1,isFullScreen:function(){return!1},getFullScreenElement:function(){return null},requestFullScreen:function(){},exitFullScreen:function(){},cancelFullScreen:function(){},fullScreenEventName:"",fullScreenErrorEventName:""};document.exitFullscreen?(n.supportsFullScreen=!0,n.getFullScreenElement=function(){return document.fullscreenElement},n.requestFullScreen=function(r){return r.requestFullscreen()},n.exitFullScreen=function(){document.exitFullscreen()},n.fullScreenEventName="fullscreenchange",n.fullScreenErrorEventName="fullscreenerror"):document.msExitFullscreen?(n.supportsFullScreen=!0,n.getFullScreenElement=function(){return document.msFullscreenElement},n.requestFullScreen=function(r){return r.msRequestFullscreen()},n.exitFullScreen=function(){document.msExitFullscreen()},n.fullScreenEventName="MSFullscreenChange",n.fullScreenErrorEventName="MSFullscreenError"):document.webkitExitFullscreen?(n.supportsFullScreen=!0,n.getFullScreenElement=function(){return document.webkitFullscreenElement},n.requestFullScreen=function(r){return r.webkitRequestFullscreen()},n.exitFullScreen=function(){document.webkitExitFullscreen()},n.fullScreenEventName="webkitfullscreenchange",n.fullScreenErrorEventName="webkitfullscreenerror"):document.webkitCancelFullScreen?(n.supportsFullScreen=!0,n.getFullScreenElement=function(){return document.webkitCurrentFullScreenElement},n.requestFullScreen=function(r){return r.webkitRequestFullScreen()},n.exitFullScreen=function(){document.webkitCancelFullScreen()},n.fullScreenEventName="webkitfullscreenchange",n.fullScreenErrorEventName="webkitfullscreenerror"):document.mozCancelFullScreen&&(n.supportsFullScreen=!0,n.getFullScreenElement=function(){return document.mozFullScreenElement},n.requestFullScreen=function(r){return r.mozRequestFullScreen()},n.exitFullScreen=function(){document.mozCancelFullScreen()},n.fullScreenEventName="mozfullscreenchange",n.fullScreenErrorEventName="mozfullscreenerror"),n.isFullScreen=function(){return n.getFullScreenElement()!==null},n.cancelFullScreen=function(){e.console.error("cancelFullScreen is deprecated. Use exitFullScreen instead."),n.exitFullScreen()},e.extend(e,n)}(t),function(e){e.EventSource=function(){this.events={}},e.EventSource.prototype={addOnceHandler:function(n,r,o,s){var a=this;s=s||1;var l=0,u=function(c){l++,l===s&&a.removeHandler(n,u),r(c)};this.addHandler(n,u,o)},addHandler:function(n,r,o){var s=this.events[n];s||(this.events[n]=s=[]),r&&e.isFunction(r)&&(s[s.length]={handler:r,userData:o||null})},removeHandler:function(n,r){var o=this.events[n],s=[],a;if(!!o&&e.isArray(o)){for(a=0;a<o.length;a++)o[a].handler!==r&&s.push(o[a]);this.events[n]=s}},removeAllHandlers:function(n){if(n)this.events[n]=[];else for(var r in this.events)this.events[r]=[]},getHandler:function(n){var r=this.events[n];return!r||!r.length?null:(r=r.length===1?[r[0]]:Array.apply(null,r),function(o,s){var a,l=r.length;for(a=0;a<l;a++)r[a]&&(s.eventSource=o,s.userData=r[a].userData,r[a].handler(s))})},raiseEvent:function(n,r){var o=this.getHandler(n);o&&(r||(r={}),o(this,r))}}}(t),function(e){var n={};e.MouseTracker=function(v){var m=arguments;e.isPlainObject(v)||(v={element:m[0],clickTimeThreshold:m[1],clickDistThreshold:m[2]}),this.hash=Math.random(),this.element=e.getElement(v.element),this.clickTimeThreshold=v.clickTimeThreshold||e.DEFAULT_SETTINGS.clickTimeThreshold,this.clickDistThreshold=v.clickDistThreshold||e.DEFAULT_SETTINGS.clickDistThreshold,this.dblClickTimeThreshold=v.dblClickTimeThreshold||e.DEFAULT_SETTINGS.dblClickTimeThreshold,this.dblClickDistThreshold=v.dblClickDistThreshold||e.DEFAULT_SETTINGS.dblClickDistThreshold,this.userData=v.userData||null,this.stopDelay=v.stopDelay||50,this.preProcessEventHandler=v.preProcessEventHandler||null,this.contextMenuHandler=v.contextMenuHandler||null,this.enterHandler=v.enterHandler||null,this.leaveHandler=v.leaveHandler||null,this.exitHandler=v.exitHandler||null,this.overHandler=v.overHandler||null,this.outHandler=v.outHandler||null,this.pressHandler=v.pressHandler||null,this.nonPrimaryPressHandler=v.nonPrimaryPressHandler||null,this.releaseHandler=v.releaseHandler||null,this.nonPrimaryReleaseHandler=v.nonPrimaryReleaseHandler||null,this.moveHandler=v.moveHandler||null,this.scrollHandler=v.scrollHandler||null,this.clickHandler=v.clickHandler||null,this.dblClickHandler=v.dblClickHandler||null,this.dragHandler=v.dragHandler||null,this.dragEndHandler=v.dragEndHandler||null,this.pinchHandler=v.pinchHandler||null,this.stopHandler=v.stopHandler||null,this.keyDownHandler=v.keyDownHandler||null,this.keyUpHandler=v.keyUpHandler||null,this.keyHandler=v.keyHandler||null,this.focusHandler=v.focusHandler||null,this.blurHandler=v.blurHandler||null;var w=this;n[this.hash]={click:function(S){E(w,S)},dblclick:function(S){A(w,S)},keydown:function(S){C(w,S)},keyup:function(S){O(w,S)},keypress:function(S){D(w,S)},focus:function(S){I(w,S)},blur:function(S){B(w,S)},contextmenu:function(S){Z(w,S)},wheel:function(S){Y(w,S)},mousewheel:function(S){V(w,S)},DOMMouseScroll:function(S){V(w,S)},MozMousePixelScroll:function(S){V(w,S)},losecapture:function(S){Q(w,S)},mouseenter:function(S){H(w,S)},mouseleave:function(S){U(w,S)},mouseover:function(S){W(w,S)},mouseout:function(S){j(w,S)},mousedown:function(S){$(w,S)},mouseup:function(S){ae(w,S)},mousemove:function(S){Qe(w,S)},touchstart:function(S){le(w,S)},touchend:function(S){re(w,S)},touchmove:function(S){se(w,S)},touchcancel:function(S){de(w,S)},gesturestart:function(S){pe(w,S)},gesturechange:function(S){G(w,S)},gotpointercapture:function(S){Me(w,S)},lostpointercapture:function(S){F(w,S)},pointerenter:function(S){H(w,S)},pointerleave:function(S){U(w,S)},pointerover:function(S){W(w,S)},pointerout:function(S){j(w,S)},pointerdown:function(S){$(w,S)},pointerup:function(S){ae(w,S)},pointermove:function(S){Qe(w,S)},pointercancel:function(S){p(w,S)},pointerupcaptured:function(S){we(w,S)},pointermovecaptured:function(S){$e(w,S)},tracking:!1,activePointersLists:[],lastClickPos:null,dblClickTimeOut:null,pinchGPoints:[],lastPinchDist:0,currentPinchDist:0,lastPinchCenter:null,currentPinchCenter:null,sentDragEvent:!1},this.hasGestureHandlers=!!(this.pressHandler||this.nonPrimaryPressHandler||this.releaseHandler||this.nonPrimaryReleaseHandler||this.clickHandler||this.dblClickHandler||this.dragHandler||this.dragEndHandler||this.pinchHandler),this.hasScrollHandler=!!this.scrollHandler,e.MouseTracker.havePointerEvents&&e.setElementPointerEvents(this.element,"auto"),this.exitHandler&&e.console.error("MouseTracker.exitHandler is deprecated. Use MouseTracker.leaveHandler instead."),v.startDisabled||this.setTracking(!0)},e.MouseTracker.prototype={destroy:function(){l(this),this.element=null,n[this.hash]=null,delete n[this.hash]},isTracking:function(){return n[this.hash].tracking},setTracking:function(v){return v?a(this):l(this),this},getActivePointersListByType:function(v){var m=n[this.hash],w,S=m.activePointersLists.length,M;for(w=0;w<S;w++)if(m.activePointersLists[w].type===v)return m.activePointersLists[w];return M=new e.MouseTracker.GesturePointList(v),m.activePointersLists.push(M),M},getActivePointerCount:function(){var v=n[this.hash],m,w=v.activePointersLists.length,S=0;for(m=0;m<w;m++)S+=v.activePointersLists[m].getLength();return S},preProcessEventHandler:function(){},contextMenuHandler:function(){},enterHandler:function(){},leaveHandler:function(){},exitHandler:function(){},overHandler:function(){},outHandler:function(){},pressHandler:function(){},nonPrimaryPressHandler:function(){},releaseHandler:function(){},nonPrimaryReleaseHandler:function(){},moveHandler:function(){},scrollHandler:function(){},clickHandler:function(){},dblClickHandler:function(){},dragHandler:function(){},dragEndHandler:function(){},pinchHandler:function(){},stopHandler:function(){},keyDownHandler:function(){},keyUpHandler:function(){},keyHandler:function(){},focusHandler:function(){},blurHandler:function(){}};var r=function(){try{return window.self!==window.top}catch{return!0}}();function o(v){try{return v.addEventListener&&v.removeEventListener}catch{return!1}}e.MouseTracker.gesturePointVelocityTracker=function(){var v=[],m=0,w=0,S=function(Ee,te){return Ee.hash.toString()+te.type+te.id.toString()},M=function(){var Ee,te=v.length,tt,Fe,vn=e.now(),nd,id,rd;for(nd=vn-w,w=vn,Ee=0;Ee<te;Ee++)tt=v[Ee],Fe=tt.gPoint,Fe.direction=Math.atan2(Fe.currentPos.y-tt.lastPos.y,Fe.currentPos.x-tt.lastPos.x),id=tt.lastPos.distanceTo(Fe.currentPos),tt.lastPos=Fe.currentPos,rd=1e3*id/(nd+1),Fe.speed=.75*rd+.25*Fe.speed},z=function(Ee,te){var tt=S(Ee,te);v.push({guid:tt,gPoint:te,lastPos:te.currentPos}),v.length===1&&(w=e.now(),m=window.setInterval(M,50))},ee=function(Ee,te){var tt=S(Ee,te),Fe,vn=v.length;for(Fe=0;Fe<vn;Fe++)if(v[Fe].guid===tt){v.splice(Fe,1),vn--,vn===0&&window.clearInterval(m);break}};return{addPoint:z,removePoint:ee}}(),e.MouseTracker.captureElement=document,e.MouseTracker.wheelEventName=e.Browser.vendor===e.BROWSERS.IE&&e.Browser.version>8||"onwheel"in document.createElement("div")?"wheel":document.onmousewheel!==void 0?"mousewheel":"DOMMouseScroll",e.MouseTracker.subscribeEvents=["click","dblclick","keydown","keyup","keypress","focus","blur","contextmenu",e.MouseTracker.wheelEventName],e.MouseTracker.wheelEventName==="DOMMouseScroll"&&e.MouseTracker.subscribeEvents.push("MozMousePixelScroll"),window.PointerEvent?(e.MouseTracker.havePointerEvents=!0,e.MouseTracker.subscribeEvents.push("pointerenter","pointerleave","pointerover","pointerout","pointerdown","pointerup","pointermove","pointercancel"),e.MouseTracker.havePointerCapture=function(){var v=document.createElement("div");return e.isFunction(v.setPointerCapture)&&e.isFunction(v.releasePointerCapture)}(),e.MouseTracker.havePointerCapture&&e.MouseTracker.subscribeEvents.push("gotpointercapture","lostpointercapture")):(e.MouseTracker.havePointerEvents=!1,e.MouseTracker.subscribeEvents.push("mouseenter","mouseleave","mouseover","mouseout","mousedown","mouseup","mousemove"),e.MouseTracker.mousePointerId="legacy-mouse",e.MouseTracker.havePointerCapture=function(){var v=document.createElement("div");return e.isFunction(v.setCapture)&&e.isFunction(v.releaseCapture)}(),e.MouseTracker.havePointerCapture&&e.MouseTracker.subscribeEvents.push("losecapture"),"ontouchstart"in window&&e.MouseTracker.subscribeEvents.push("touchstart","touchend","touchmove","touchcancel"),"ongesturestart"in window&&e.MouseTracker.subscribeEvents.push("gesturestart","gesturechange")),e.MouseTracker.GesturePointList=function(v){this._gPoints=[],this.type=v,this.buttons=0,this.contacts=0,this.clicks=0,this.captureCount=0},e.MouseTracker.GesturePointList.prototype={getLength:function(){return this._gPoints.length},asArray:function(){return this._gPoints},add:function(v){return this._gPoints.push(v)},removeById:function(v){var m,w=this._gPoints.length;for(m=0;m<w;m++)if(this._gPoints[m].id===v){this._gPoints.splice(m,1);break}return this._gPoints.length},getByIndex:function(v){return v<this._gPoints.length?this._gPoints[v]:null},getById:function(v){var m,w=this._gPoints.length;for(m=0;m<w;m++)if(this._gPoints[m].id===v)return this._gPoints[m];return null},getPrimary:function(v){var m,w=this._gPoints.length;for(m=0;m<w;m++)if(this._gPoints[m].isPrimary)return this._gPoints[m];return null},addContact:function(){++this.contacts,this.contacts>1&&(this.type==="mouse"||this.type==="pen")&&(e.console.warn("GesturePointList.addContact() Implausible contacts value"),this.contacts=1)},removeContact:function(){--this.contacts,this.contacts<0&&(e.console.warn("GesturePointList.removeContact() Implausible contacts value"),this.contacts=0)}};function s(v){var m=n[v.hash],w,S,M,z,ee,Ee=m.activePointersLists.length;for(w=0;w<Ee;w++)if(M=m.activePointersLists[w],M.getLength()>0){for(ee=[],z=M.asArray(),S=0;S<z.length;S++)ee.push(z[S]);for(S=0;S<ee.length;S++)R(v,M,ee[S])}for(w=0;w<Ee;w++)m.activePointersLists.pop();m.sentDragEvent=!1}function a(v){var m=n[v.hash],w,S;if(!m.tracking){for(S=0;S<e.MouseTracker.subscribeEvents.length;S++)w=e.MouseTracker.subscribeEvents[S],e.addEvent(v.element,w,m[w],w===e.MouseTracker.wheelEventName?{passive:!1,capture:!1}:!1);s(v),m.tracking=!0}}function l(v){var m=n[v.hash],w,S;if(m.tracking){for(S=0;S<e.MouseTracker.subscribeEvents.length;S++)w=e.MouseTracker.subscribeEvents[S],e.removeEvent(v.element,w,m[w],!1);s(v),m.tracking=!1}}function u(v,m){var w=n[v.hash];if(m==="pointerevent")return{upName:"pointerup",upHandler:w.pointerupcaptured,moveName:"pointermove",moveHandler:w.pointermovecaptured};if(m==="mouse")return{upName:"pointerup",upHandler:w.pointerupcaptured,moveName:"pointermove",moveHandler:w.pointermovecaptured};if(m==="touch")return{upName:"touchend",upHandler:w.touchendcaptured,moveName:"touchmove",moveHandler:w.touchmovecaptured};throw new Error("MouseTracker.getCaptureEventParams: Unknown pointer type.")}function c(v,m){var w;if(e.MouseTracker.havePointerCapture)if(e.MouseTracker.havePointerEvents)try{v.element.setPointerCapture(m.id)}catch{e.console.warn("setPointerCapture() called on invalid pointer ID");return}else v.element.setCapture(!0);else w=u(v,e.MouseTracker.havePointerEvents?"pointerevent":m.type),r&&o(window.top)&&e.addEvent(window.top,w.upName,w.upHandler,!0),e.addEvent(e.MouseTracker.captureElement,w.upName,w.upHandler,!0),e.addEvent(e.MouseTracker.captureElement,w.moveName,w.moveHandler,!0);J(v,m,!0)}function h(v,m){var w,S,M;if(e.MouseTracker.havePointerCapture)if(e.MouseTracker.havePointerEvents){if(S=v.getActivePointersListByType(m.type),M=S.getById(m.id),!M||!M.captured)return;try{v.element.releasePointerCapture(m.id)}catch{}}else v.element.releaseCapture();else w=u(v,e.MouseTracker.havePointerEvents?"pointerevent":m.type),r&&o(window.top)&&e.removeEvent(window.top,w.upName,w.upHandler,!0),e.removeEvent(e.MouseTracker.captureElement,w.moveName,w.moveHandler,!0),e.removeEvent(e.MouseTracker.captureElement,w.upName,w.upHandler,!0);J(v,m,!1)}function d(v){return e.MouseTracker.havePointerEvents?v.pointerId:e.MouseTracker.mousePointerId}function g(v){return e.MouseTracker.havePointerEvents?v.pointerType||(e.Browser.vendor===e.BROWSERS.IE?"mouse":""):"mouse"}function y(v){return e.MouseTracker.havePointerEvents?v.isPrimary:!0}function x(v){return e.getMousePosition(v)}function b(v,m){return T(x(v),m)}function T(v,m){var w=e.getElementOffset(m);return v.minus(w)}function f(v,m){return new e.Point((v.x+m.x)/2,(v.y+m.y)/2)}function E(v,m){var w={originalEvent:m,eventType:"click",pointerType:"mouse",isEmulated:!1};L(v,w),w.preventDefault&&!w.defaultPrevented&&e.cancelEvent(m),w.stopPropagation&&e.stopEvent(m)}function A(v,m){var w={originalEvent:m,eventType:"dblclick",pointerType:"mouse",isEmulated:!1};L(v,w),w.preventDefault&&!w.defaultPrevented&&e.cancelEvent(m),w.stopPropagation&&e.stopEvent(m)}function C(v,m){var w=null,S={originalEvent:m,eventType:"keydown",pointerType:"",isEmulated:!1};L(v,S),v.keyDownHandler&&!S.preventGesture&&!S.defaultPrevented&&(w={eventSource:v,keyCode:m.keyCode?m.keyCode:m.charCode,ctrl:m.ctrlKey,shift:m.shiftKey,alt:m.altKey,meta:m.metaKey,originalEvent:m,preventDefault:S.preventDefault||S.defaultPrevented,userData:v.userData},v.keyDownHandler(w)),(w&&w.preventDefault||S.preventDefault&&!S.defaultPrevented)&&e.cancelEvent(m),S.stopPropagation&&e.stopEvent(m)}function O(v,m){var w=null,S={originalEvent:m,eventType:"keyup",pointerType:"",isEmulated:!1};L(v,S),v.keyUpHandler&&!S.preventGesture&&!S.defaultPrevented&&(w={eventSource:v,keyCode:m.keyCode?m.keyCode:m.charCode,ctrl:m.ctrlKey,shift:m.shiftKey,alt:m.altKey,meta:m.metaKey,originalEvent:m,preventDefault:S.preventDefault||S.defaultPrevented,userData:v.userData},v.keyUpHandler(w)),(w&&w.preventDefault||S.preventDefault&&!S.defaultPrevented)&&e.cancelEvent(m),S.stopPropagation&&e.stopEvent(m)}function D(v,m){var w=null,S={originalEvent:m,eventType:"keypress",pointerType:"",isEmulated:!1};L(v,S),v.keyHandler&&!S.preventGesture&&!S.defaultPrevented&&(w={eventSource:v,keyCode:m.keyCode?m.keyCode:m.charCode,ctrl:m.ctrlKey,shift:m.shiftKey,alt:m.altKey,meta:m.metaKey,originalEvent:m,preventDefault:S.preventDefault||S.defaultPrevented,userData:v.userData},v.keyHandler(w)),(w&&w.preventDefault||S.preventDefault&&!S.defaultPrevented)&&e.cancelEvent(m),S.stopPropagation&&e.stopEvent(m)}function I(v,m){var w={originalEvent:m,eventType:"focus",pointerType:"",isEmulated:!1};L(v,w),v.focusHandler&&!w.preventGesture&&v.focusHandler({eventSource:v,originalEvent:m,userData:v.userData})}function B(v,m){var w={originalEvent:m,eventType:"blur",pointerType:"",isEmulated:!1};L(v,w),v.blurHandler&&!w.preventGesture&&v.blurHandler({eventSource:v,originalEvent:m,userData:v.userData})}function Z(v,m){var w=null,S={originalEvent:m,eventType:"contextmenu",pointerType:"mouse",isEmulated:!1};L(v,S),v.contextMenuHandler&&!S.preventGesture&&!S.defaultPrevented&&(w={eventSource:v,position:T(x(m),v.element),originalEvent:S.originalEvent,preventDefault:S.preventDefault||S.defaultPrevented,userData:v.userData},v.contextMenuHandler(w)),(w&&w.preventDefault||S.preventDefault&&!S.defaultPrevented)&&e.cancelEvent(m),S.stopPropagation&&e.stopEvent(m)}function Y(v,m){K(v,m,m)}function V(v,m){var w={target:m.target||m.srcElement,type:"wheel",shiftKey:m.shiftKey||!1,clientX:m.clientX,clientY:m.clientY,pageX:m.pageX?m.pageX:m.clientX,pageY:m.pageY?m.pageY:m.clientY,deltaMode:m.type==="MozMousePixelScroll"?0:1,deltaX:0,deltaZ:0};e.MouseTracker.wheelEventName==="mousewheel"?w.deltaY=-m.wheelDelta/e.DEFAULT_SETTINGS.pixelsPerWheelLine:w.deltaY=m.detail,K(v,w,m)}function K(v,m,w){var S=0,M,z=null;S=m.deltaY<0?1:-1,M={originalEvent:m,eventType:"wheel",pointerType:"mouse",isEmulated:m!==w},L(v,M),v.scrollHandler&&!M.preventGesture&&!M.defaultPrevented&&(z={eventSource:v,pointerType:"mouse",position:b(m,v.element),scroll:S,shift:m.shiftKey,isTouchEvent:!1,originalEvent:w,preventDefault:M.preventDefault||M.defaultPrevented,userData:v.userData},v.scrollHandler(z)),M.stopPropagation&&e.stopEvent(w),(z&&z.preventDefault||M.preventDefault&&!M.defaultPrevented)&&e.cancelEvent(w)}function Q(v,m){var w={id:e.MouseTracker.mousePointerId,type:"mouse"},S={originalEvent:m,eventType:"lostpointercapture",pointerType:"mouse",isEmulated:!1};L(v,S),m.target===v.element&&J(v,w,!1),S.stopPropagation&&e.stopEvent(m)}function le(v,m){var w,S,M=m.changedTouches.length,z,ee=v.getActivePointersListByType("touch");w=e.now(),ee.getLength()>m.touches.length-M&&e.console.warn("Tracked touch contact count doesn't match event.touches.length");var Ee={originalEvent:m,eventType:"pointerdown",pointerType:"touch",isEmulated:!1};for(L(v,Ee),S=0;S<M;S++)z={id:m.changedTouches[S].identifier,type:"touch",isPrimary:ee.getLength()===0,currentPos:x(m.changedTouches[S]),currentTime:w},q(v,Ee,z),oe(v,Ee,z,0),J(v,z,!0);Ee.preventDefault&&!Ee.defaultPrevented&&e.cancelEvent(m),Ee.stopPropagation&&e.stopEvent(m)}function re(v,m){var w,S,M=m.changedTouches.length,z;w=e.now();var ee={originalEvent:m,eventType:"pointerup",pointerType:"touch",isEmulated:!1};for(L(v,ee),S=0;S<M;S++)z={id:m.changedTouches[S].identifier,type:"touch",currentPos:x(m.changedTouches[S]),currentTime:w},Te(v,ee,z,0),J(v,z,!1),fe(v,ee,z);ee.preventDefault&&!ee.defaultPrevented&&e.cancelEvent(m),ee.stopPropagation&&e.stopEvent(m)}function se(v,m){var w,S,M=m.changedTouches.length,z;w=e.now();var ee={originalEvent:m,eventType:"pointermove",pointerType:"touch",isEmulated:!1};for(L(v,ee),S=0;S<M;S++)z={id:m.changedTouches[S].identifier,type:"touch",currentPos:x(m.changedTouches[S]),currentTime:w},he(v,ee,z);ee.preventDefault&&!ee.defaultPrevented&&e.cancelEvent(m),ee.stopPropagation&&e.stopEvent(m)}function de(v,m){var w=m.changedTouches.length,S,M,z={originalEvent:m,eventType:"pointercancel",pointerType:"touch",isEmulated:!1};for(L(v,z),S=0;S<w;S++)M={id:m.changedTouches[S].identifier,type:"touch"},ze(v,z,M);z.stopPropagation&&e.stopEvent(m)}function pe(v,m){return e.eventIsCanceled(m)||m.preventDefault(),!1}function G(v,m){return e.eventIsCanceled(m)||m.preventDefault(),!1}function Me(v,m){var w={originalEvent:m,eventType:"gotpointercapture",pointerType:g(m),isEmulated:!1};L(v,w),m.target===v.element&&J(v,{id:m.pointerId,type:g(m)},!0),w.stopPropagation&&e.stopEvent(m)}function F(v,m){var w={originalEvent:m,eventType:"lostpointercapture",pointerType:g(m),isEmulated:!1};L(v,w),m.target===v.element&&J(v,{id:m.pointerId,type:g(m)},!1),w.stopPropagation&&e.stopEvent(m)}function H(v,m){var w={id:d(m),type:g(m),isPrimary:y(m),currentPos:x(m),currentTime:e.now()},S={originalEvent:m,eventType:"pointerenter",pointerType:w.type,isEmulated:!1};L(v,S),q(v,S,w)}function U(v,m){var w={id:d(m),type:g(m),isPrimary:y(m),currentPos:x(m),currentTime:e.now()},S={originalEvent:m,eventType:"pointerleave",pointerType:w.type,isEmulated:!1};L(v,S),fe(v,S,w)}function W(v,m){var w={id:d(m),type:g(m),isPrimary:y(m),currentPos:x(m),currentTime:e.now()},S={originalEvent:m,eventType:"pointerover",pointerType:w.type,isEmulated:!1};L(v,S),Se(v,S,w),S.preventDefault&&!S.defaultPrevented&&e.cancelEvent(m),S.stopPropagation&&e.stopEvent(m)}function j(v,m){var w={id:d(m),type:g(m),isPrimary:y(m),currentPos:x(m),currentTime:e.now()},S={originalEvent:m,eventType:"pointerout",pointerType:w.type,isEmulated:!1};L(v,S),ge(v,S,w),S.preventDefault&&!S.defaultPrevented&&e.cancelEvent(m),S.stopPropagation&&e.stopEvent(m)}function $(v,m){var w={id:d(m),type:g(m),isPrimary:y(m),currentPos:x(m),currentTime:e.now()},S=e.MouseTracker.havePointerEvents&&w.type==="touch"&&e.Browser.vendor!==e.BROWSERS.IE,M={originalEvent:m,eventType:"pointerdown",pointerType:w.type,isEmulated:!1};L(v,M),oe(v,M,w,m.button),M.preventDefault&&!M.defaultPrevented&&e.cancelEvent(m),M.stopPropagation&&e.stopEvent(m),M.shouldCapture&&(S?J(v,w,!0):c(v,w))}function ae(v,m){me(v,m)}function we(v,m){var w=v.getActivePointersListByType(g(m));w.getById(m.pointerId)&&me(v,m),e.stopEvent(m)}function me(v,m){var w;w={id:d(m),type:g(m),isPrimary:y(m),currentPos:x(m),currentTime:e.now()};var S={originalEvent:m,eventType:"pointerup",pointerType:w.type,isEmulated:!1};L(v,S),Te(v,S,w,m.button),S.preventDefault&&!S.defaultPrevented&&e.cancelEvent(m),S.stopPropagation&&e.stopEvent(m),S.shouldReleaseCapture&&(m.target===v.element?h(v,w):J(v,w,!1))}function Qe(v,m){et(v,m)}function $e(v,m){var w=v.getActivePointersListByType(g(m));w.getById(m.pointerId)&&et(v,m),e.stopEvent(m)}function et(v,m){var w={id:d(m),type:g(m),isPrimary:y(m),currentPos:x(m),currentTime:e.now()},S={originalEvent:m,eventType:"pointermove",pointerType:w.type,isEmulated:!1};L(v,S),he(v,S,w),S.preventDefault&&!S.defaultPrevented&&e.cancelEvent(m),S.stopPropagation&&e.stopEvent(m)}function p(v,m){var w={id:m.pointerId,type:g(m)},S={originalEvent:m,eventType:"pointercancel",pointerType:w.type,isEmulated:!1};L(v,S),ze(v,S,w),S.stopPropagation&&e.stopEvent(m)}function _(v,m){return m.speed=0,m.direction=0,m.contactPos=m.currentPos,m.contactTime=m.currentTime,m.lastPos=m.currentPos,m.lastTime=m.currentTime,v.add(m)}function R(v,m,w){var S,M=m.getById(w.id);return M?(M.captured&&(e.console.warn("stopTrackingPointer() called on captured pointer"),h(v,M)),(m.type==="mouse"||m.type==="pen")&&m.contacts>0&&m.removeContact(),S=m.removeById(w.id)):S=m.getLength(),S}function N(v,m){switch(m.eventType){case"pointermove":m.isStoppable=!0,m.isCancelable=!0,m.preventDefault=!1,m.preventGesture=!v.hasGestureHandlers,m.stopPropagation=!1;break;case"pointerover":case"pointerout":case"contextmenu":case"keydown":case"keyup":case"keypress":m.isStoppable=!0,m.isCancelable=!0,m.preventDefault=!1,m.preventGesture=!1,m.stopPropagation=!1;break;case"pointerdown":m.isStoppable=!0,m.isCancelable=!0,m.preventDefault=!1,m.preventGesture=!v.hasGestureHandlers,m.stopPropagation=!1;break;case"pointerup":m.isStoppable=!0,m.isCancelable=!0,m.preventDefault=!1,m.preventGesture=!v.hasGestureHandlers,m.stopPropagation=!1;break;case"wheel":m.isStoppable=!0,m.isCancelable=!0,m.preventDefault=!1,m.preventGesture=!v.hasScrollHandler,m.stopPropagation=!1;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":m.isStoppable=!0,m.isCancelable=!1,m.preventDefault=!1,m.preventGesture=!1,m.stopPropagation=!1;break;case"click":m.isStoppable=!0,m.isCancelable=!0,m.preventDefault=!!v.clickHandler,m.preventGesture=!1,m.stopPropagation=!1;break;case"dblclick":m.isStoppable=!0,m.isCancelable=!0,m.preventDefault=!!v.dblClickHandler,m.preventGesture=!1,m.stopPropagation=!1;break;case"focus":case"blur":case"pointerenter":case"pointerleave":default:m.isStoppable=!1,m.isCancelable=!1,m.preventDefault=!1,m.preventGesture=!1,m.stopPropagation=!1;break}}function L(v,m){m.eventSource=v,m.eventPhase=m.originalEvent&&typeof m.originalEvent.eventPhase!="undefined"?m.originalEvent.eventPhase:0,m.defaultPrevented=e.eventIsCanceled(m.originalEvent),m.shouldCapture=!1,m.shouldReleaseCapture=!1,m.userData=v.userData,N(v,m),v.preProcessEventHandler&&v.preProcessEventHandler(m)}function J(v,m,w){var S=v.getActivePointersListByType(m.type),M=S.getById(m.id);M?w&&!M.captured?(M.captured=!0,S.captureCount++):!w&&M.captured&&(M.captured=!1,S.captureCount--,S.captureCount<0&&(S.captureCount=0,e.console.warn("updatePointerCaptured() - pointsList.captureCount went negative"))):e.console.warn("updatePointerCaptured() called on untracked pointer")}function q(v,m,w){var S=v.getActivePointersListByType(w.type),M;M=S.getById(w.id),M?(M.insideElement=!0,M.lastPos=M.currentPos,M.lastTime=M.currentTime,M.currentPos=w.currentPos,M.currentTime=w.currentTime,w=M):(w.captured=!1,w.insideElementPressed=!1,w.insideElement=!0,_(S,w)),v.enterHandler&&v.enterHandler({eventSource:v,pointerType:w.type,position:T(w.currentPos,v.element),buttons:S.buttons,pointers:v.getActivePointerCount(),insideElementPressed:w.insideElementPressed,buttonDownAny:S.buttons!==0,isTouchEvent:w.type==="touch",originalEvent:m.originalEvent,userData:v.userData})}function fe(v,m,w){var S=v.getActivePointersListByType(w.type),M,z;M=S.getById(w.id),M?(M.captured?(M.insideElement=!1,M.lastPos=M.currentPos,M.lastTime=M.currentTime,M.currentPos=w.currentPos,M.currentTime=w.currentTime):R(v,S,M),w=M):(w.captured=!1,w.insideElementPressed=!1),(v.leaveHandler||v.exitHandler)&&(z={eventSource:v,pointerType:w.type,position:w.currentPos&&T(w.currentPos,v.element),buttons:S.buttons,pointers:v.getActivePointerCount(),insideElementPressed:w.insideElementPressed,buttonDownAny:S.buttons!==0,isTouchEvent:w.type==="touch",originalEvent:m.originalEvent,userData:v.userData},v.leaveHandler&&v.leaveHandler(z),v.exitHandler&&v.exitHandler(z))}function Se(v,m,w){var S,M;S=v.getActivePointersListByType(w.type),M=S.getById(w.id),M?w=M:(w.captured=!1,w.insideElementPressed=!1),v.overHandler&&v.overHandler({eventSource:v,pointerType:w.type,position:T(w.currentPos,v.element),buttons:S.buttons,pointers:v.getActivePointerCount(),insideElementPressed:w.insideElementPressed,buttonDownAny:S.buttons!==0,isTouchEvent:w.type==="touch",originalEvent:m.originalEvent,userData:v.userData})}function ge(v,m,w){var S,M;S=v.getActivePointersListByType(w.type),M=S.getById(w.id),M?w=M:(w.captured=!1,w.insideElementPressed=!1),v.outHandler&&v.outHandler({eventSource:v,pointerType:w.type,position:w.currentPos&&T(w.currentPos,v.element),buttons:S.buttons,pointers:v.getActivePointerCount(),insideElementPressed:w.insideElementPressed,buttonDownAny:S.buttons!==0,isTouchEvent:w.type==="touch",originalEvent:m.originalEvent,userData:v.userData})}function oe(v,m,w,S){var M=n[v.hash],z=v.getActivePointersListByType(w.type),ee;if(typeof m.originalEvent.buttons!="undefined"?z.buttons=m.originalEvent.buttons:S===0?z.buttons|=1:S===1?z.buttons|=4:S===2?z.buttons|=2:S===3?z.buttons|=8:S===4?z.buttons|=16:S===5&&(z.buttons|=32),S!==0){m.shouldCapture=!1,m.shouldReleaseCapture=!1,v.nonPrimaryPressHandler&&!m.preventGesture&&!m.defaultPrevented&&(m.preventDefault=!0,v.nonPrimaryPressHandler({eventSource:v,pointerType:w.type,position:T(w.currentPos,v.element),button:S,buttons:z.buttons,isTouchEvent:w.type==="touch",originalEvent:m.originalEvent,userData:v.userData}));return}if(ee=z.getById(w.id),ee)ee.insideElementPressed=!0,ee.insideElement=!0,ee.originalTarget=m.originalEvent.target,ee.contactPos=w.currentPos,ee.contactTime=w.currentTime,ee.lastPos=ee.currentPos,ee.lastTime=ee.currentTime,ee.currentPos=w.currentPos,ee.currentTime=w.currentTime,w=ee;else{e.console.warn("pointerdown event on untracked pointer"),w.captured=!1,w.insideElementPressed=!0,w.insideElement=!0,w.originalTarget=m.originalEvent.target,_(z,w);return}z.addContact(),!m.preventGesture&&!m.defaultPrevented?(m.shouldCapture=!0,m.shouldReleaseCapture=!1,m.preventDefault=!0,(v.dragHandler||v.dragEndHandler||v.pinchHandler)&&e.MouseTracker.gesturePointVelocityTracker.addPoint(v,w),z.contacts===1?v.pressHandler&&!m.preventGesture&&v.pressHandler({eventSource:v,pointerType:w.type,position:T(w.contactPos,v.element),buttons:z.buttons,isTouchEvent:w.type==="touch",originalEvent:m.originalEvent,userData:v.userData}):z.contacts===2&&v.pinchHandler&&w.type==="touch"&&(M.pinchGPoints=z.asArray(),M.lastPinchDist=M.currentPinchDist=M.pinchGPoints[0].currentPos.distanceTo(M.pinchGPoints[1].currentPos),M.lastPinchCenter=M.currentPinchCenter=f(M.pinchGPoints[0].currentPos,M.pinchGPoints[1].currentPos))):(m.shouldCapture=!1,m.shouldReleaseCapture=!1)}function Te(v,m,w,S){var M=n[v.hash],z=v.getActivePointersListByType(w.type),ee,Ee,te,tt=!1,Fe;if(typeof m.originalEvent.buttons!="undefined"?z.buttons=m.originalEvent.buttons:S===0?z.buttons^=-2:S===1?z.buttons^=-5:S===2?z.buttons^=-3:S===3?z.buttons^=-9:S===4?z.buttons^=-17:S===5&&(z.buttons^=-33),m.shouldCapture=!1,S!==0){m.shouldReleaseCapture=!1,v.nonPrimaryReleaseHandler&&!m.preventGesture&&!m.defaultPrevented&&(m.preventDefault=!0,v.nonPrimaryReleaseHandler({eventSource:v,pointerType:w.type,position:T(w.currentPos,v.element),button:S,buttons:z.buttons,isTouchEvent:w.type==="touch",originalEvent:m.originalEvent,userData:v.userData}));return}te=z.getById(w.id),te?(z.removeContact(),te.captured&&(tt=!0),te.lastPos=te.currentPos,te.lastTime=te.currentTime,te.currentPos=w.currentPos,te.currentTime=w.currentTime,te.insideElement||R(v,z,te),ee=te.currentPos,Ee=te.currentTime):(e.console.warn("updatePointerUp(): pointerup on untracked gPoint"),w.captured=!1,w.insideElementPressed=!1,w.insideElement=!0,_(z,w),te=w),!m.preventGesture&&!m.defaultPrevented&&(tt?(m.shouldReleaseCapture=!0,m.preventDefault=!0,(v.dragHandler||v.dragEndHandler||v.pinchHandler)&&e.MouseTracker.gesturePointVelocityTracker.removePoint(v,te),z.contacts===0?(v.releaseHandler&&v.releaseHandler({eventSource:v,pointerType:te.type,position:T(ee,v.element),buttons:z.buttons,insideElementPressed:te.insideElementPressed,insideElementReleased:te.insideElement,isTouchEvent:te.type==="touch",originalEvent:m.originalEvent,userData:v.userData}),v.dragEndHandler&&M.sentDragEvent&&v.dragEndHandler({eventSource:v,pointerType:te.type,position:T(te.currentPos,v.element),speed:te.speed,direction:te.direction,shift:m.originalEvent.shiftKey,isTouchEvent:te.type==="touch",originalEvent:m.originalEvent,userData:v.userData}),M.sentDragEvent=!1,(v.clickHandler||v.dblClickHandler)&&te.insideElement&&(Fe=Ee-te.contactTime<=v.clickTimeThreshold&&te.contactPos.distanceTo(ee)<=v.clickDistThreshold,v.clickHandler&&v.clickHandler({eventSource:v,pointerType:te.type,position:T(te.currentPos,v.element),quick:Fe,shift:m.originalEvent.shiftKey,isTouchEvent:te.type==="touch",originalEvent:m.originalEvent,originalTarget:te.originalTarget,userData:v.userData}),v.dblClickHandler&&Fe&&(z.clicks++,z.clicks===1?(M.lastClickPos=ee,M.dblClickTimeOut=setTimeout(function(){z.clicks=0},v.dblClickTimeThreshold)):z.clicks===2&&(clearTimeout(M.dblClickTimeOut),z.clicks=0,M.lastClickPos.distanceTo(ee)<=v.dblClickDistThreshold&&v.dblClickHandler({eventSource:v,pointerType:te.type,position:T(te.currentPos,v.element),shift:m.originalEvent.shiftKey,isTouchEvent:te.type==="touch",originalEvent:m.originalEvent,userData:v.userData}),M.lastClickPos=null)))):z.contacts===2&&v.pinchHandler&&te.type==="touch"&&(M.pinchGPoints=z.asArray(),M.lastPinchDist=M.currentPinchDist=M.pinchGPoints[0].currentPos.distanceTo(M.pinchGPoints[1].currentPos),M.lastPinchCenter=M.currentPinchCenter=f(M.pinchGPoints[0].currentPos,M.pinchGPoints[1].currentPos))):(m.shouldReleaseCapture=!1,v.releaseHandler&&(v.releaseHandler({eventSource:v,pointerType:te.type,position:T(ee,v.element),buttons:z.buttons,insideElementPressed:te.insideElementPressed,insideElementReleased:te.insideElement,isTouchEvent:te.type==="touch",originalEvent:m.originalEvent,userData:v.userData}),m.preventDefault=!0)))}function he(v,m,w){var S=n[v.hash],M=v.getActivePointersListByType(w.type),z,ee,Ee;if(typeof m.originalEvent.buttons!="undefined"&&(M.buttons=m.originalEvent.buttons),z=M.getById(w.id),z)z.lastPos=z.currentPos,z.lastTime=z.currentTime,z.currentPos=w.currentPos,z.currentTime=w.currentTime;else return;m.shouldCapture=!1,m.shouldReleaseCapture=!1,v.stopHandler&&w.type==="mouse"&&(clearTimeout(v.stopTimeOut),v.stopTimeOut=setTimeout(function(){Mt(v,m.originalEvent,w.type)},v.stopDelay)),M.contacts===0?v.moveHandler&&v.moveHandler({eventSource:v,pointerType:w.type,position:T(w.currentPos,v.element),buttons:M.buttons,isTouchEvent:w.type==="touch",originalEvent:m.originalEvent,userData:v.userData}):M.contacts===1?(v.moveHandler&&(z=M.asArray()[0],v.moveHandler({eventSource:v,pointerType:z.type,position:T(z.currentPos,v.element),buttons:M.buttons,isTouchEvent:z.type==="touch",originalEvent:m.originalEvent,userData:v.userData})),v.dragHandler&&!m.preventGesture&&!m.defaultPrevented&&(z=M.asArray()[0],Ee=z.currentPos.minus(z.lastPos),v.dragHandler({eventSource:v,pointerType:z.type,position:T(z.currentPos,v.element),buttons:M.buttons,delta:Ee,speed:z.speed,direction:z.direction,shift:m.originalEvent.shiftKey,isTouchEvent:z.type==="touch",originalEvent:m.originalEvent,userData:v.userData}),m.preventDefault=!0,S.sentDragEvent=!0)):M.contacts===2&&(v.moveHandler&&(ee=M.asArray(),v.moveHandler({eventSource:v,pointerType:ee[0].type,position:T(f(ee[0].currentPos,ee[1].currentPos),v.element),buttons:M.buttons,isTouchEvent:ee[0].type==="touch",originalEvent:m.originalEvent,userData:v.userData})),v.pinchHandler&&w.type==="touch"&&!m.preventGesture&&!m.defaultPrevented&&(Ee=S.pinchGPoints[0].currentPos.distanceTo(S.pinchGPoints[1].currentPos),Ee!==S.currentPinchDist&&(S.lastPinchDist=S.currentPinchDist,S.currentPinchDist=Ee,S.lastPinchCenter=S.currentPinchCenter,S.currentPinchCenter=f(S.pinchGPoints[0].currentPos,S.pinchGPoints[1].currentPos),v.pinchHandler({eventSource:v,pointerType:"touch",gesturePoints:S.pinchGPoints,lastCenter:T(S.lastPinchCenter,v.element),center:T(S.currentPinchCenter,v.element),lastDistance:S.lastPinchDist,distance:S.currentPinchDist,shift:m.originalEvent.shiftKey,originalEvent:m.originalEvent,userData:v.userData}),m.preventDefault=!0)))}function ze(v,m,w){var S=v.getActivePointersListByType(w.type),M;M=S.getById(w.id),M&&R(v,S,M)}function Mt(v,m,w){v.stopHandler&&v.stopHandler({eventSource:v,pointerType:w,position:b(m,v.element),buttons:v.getActivePointersListByType(w).buttons,isTouchEvent:w==="touch",originalEvent:m,userData:v.userData})}}(t),function(e){e.ControlAnchor={NONE:0,TOP_LEFT:1,TOP_RIGHT:2,BOTTOM_RIGHT:3,BOTTOM_LEFT:4,ABSOLUTE:5},e.Control=function(n,r,o){var s=n.parentNode;typeof r=="number"&&(e.console.error("Passing an anchor directly into the OpenSeadragon.Control constructor is deprecated; please use an options object instead. Support for this deprecated variant is scheduled for removal in December 2013"),r={anchor:r}),r.attachToViewer=typeof r.attachToViewer=="undefined"?!0:r.attachToViewer,this.autoFade=typeof r.autoFade=="undefined"?!0:r.autoFade,this.element=n,this.anchor=r.anchor,this.container=o,this.anchor===e.ControlAnchor.ABSOLUTE?(this.wrapper=e.makeNeutralElement("div"),this.wrapper.style.position="absolute",this.wrapper.style.top=typeof r.top=="number"?r.top+"px":r.top,this.wrapper.style.left=typeof r.left=="number"?r.left+"px":r.left,this.wrapper.style.height=typeof r.height=="number"?r.height+"px":r.height,this.wrapper.style.width=typeof r.width=="number"?r.width+"px":r.width,this.wrapper.style.margin="0px",this.wrapper.style.padding="0px",this.element.style.position="relative",this.element.style.top="0px",this.element.style.left="0px",this.element.style.height="100%",this.element.style.width="100%"):(this.wrapper=e.makeNeutralElement("div"),this.wrapper.style.display="inline-block",this.anchor===e.ControlAnchor.NONE&&(this.wrapper.style.width=this.wrapper.style.height="100%")),this.wrapper.appendChild(this.element),r.attachToViewer?this.anchor===e.ControlAnchor.TOP_RIGHT||this.anchor===e.ControlAnchor.BOTTOM_RIGHT?this.container.insertBefore(this.wrapper,this.container.firstChild):this.container.appendChild(this.wrapper):s.appendChild(this.wrapper)},e.Control.prototype={destroy:function(){this.wrapper.removeChild(this.element),this.anchor!==e.ControlAnchor.NONE&&this.container.removeChild(this.wrapper)},isVisible:function(){return this.wrapper.style.display!=="none"},setVisible:function(n){this.wrapper.style.display=n?this.anchor===e.ControlAnchor.ABSOLUTE?"block":"inline-block":"none"},setOpacity:function(n){this.element[e.SIGNAL]&&e.Browser.vendor===e.BROWSERS.IE?e.setElementOpacity(this.element,n,!0):e.setElementOpacity(this.wrapper,n,!0)}}}(t),function(e){e.ControlDock=function(r){var o=["topleft","topright","bottomright","bottomleft"],s,a;for(e.extend(!0,this,{id:"controldock-"+e.now()+"-"+Math.floor(Math.random()*1e6),container:e.makeNeutralElement("div"),controls:[]},r),this.container.onsubmit=function(){return!1},this.element&&(this.element=e.getElement(this.element),this.element.appendChild(this.container),this.element.style.position="relative",this.container.style.width="100%",this.container.style.height="100%"),a=0;a<o.length;a++)s=o[a],this.controls[s]=e.makeNeutralElement("div"),this.controls[s].style.position="absolute",s.match("left")&&(this.controls[s].style.left="0px"),s.match("right")&&(this.controls[s].style.right="0px"),s.match("top")&&(this.controls[s].style.top="0px"),s.match("bottom")&&(this.controls[s].style.bottom="0px");this.container.appendChild(this.controls.topleft),this.container.appendChild(this.controls.topright),this.container.appendChild(this.controls.bottomright),this.container.appendChild(this.controls.bottomleft)},e.ControlDock.prototype={addControl:function(r,o){r=e.getElement(r);var s=null;if(!(n(this,r)>=0)){switch(o.anchor){case e.ControlAnchor.TOP_RIGHT:s=this.controls.topright,r.style.position="relative",r.style.paddingRight="0px",r.style.paddingTop="0px";break;case e.ControlAnchor.BOTTOM_RIGHT:s=this.controls.bottomright,r.style.position="relative",r.style.paddingRight="0px",r.style.paddingBottom="0px";break;case e.ControlAnchor.BOTTOM_LEFT:s=this.controls.bottomleft,r.style.position="relative",r.style.paddingLeft="0px",r.style.paddingBottom="0px";break;case e.ControlAnchor.TOP_LEFT:s=this.controls.topleft,r.style.position="relative",r.style.paddingLeft="0px",r.style.paddingTop="0px";break;case e.ControlAnchor.ABSOLUTE:s=this.container,r.style.margin="0px",r.style.padding="0px";break;default:case e.ControlAnchor.NONE:s=this.container,r.style.margin="0px",r.style.padding="0px";break}this.controls.push(new e.Control(r,o,s)),r.style.display="inline-block"}},removeControl:function(r){r=e.getElement(r);var o=n(this,r);return o>=0&&(this.controls[o].destroy(),this.controls.splice(o,1)),this},clearControls:function(){for(;this.controls.length>0;)this.controls.pop().destroy();return this},areControlsEnabled:function(){var r;for(r=this.controls.length-1;r>=0;r--)if(this.controls[r].isVisible())return!0;return!1},setControlsEnabled:function(r){var o;for(o=this.controls.length-1;o>=0;o--)this.controls[o].setVisible(r);return this}};function n(r,o){var s=r.controls,a;for(a=s.length-1;a>=0;a--)if(s[a].element===o)return a;return-1}}(t),function(e){e.Placement=e.freezeObject({CENTER:0,TOP_LEFT:1,TOP:2,TOP_RIGHT:3,RIGHT:4,BOTTOM_RIGHT:5,BOTTOM:6,BOTTOM_LEFT:7,LEFT:8,properties:{0:{isLeft:!1,isHorizontallyCentered:!0,isRight:!1,isTop:!1,isVerticallyCentered:!0,isBottom:!1},1:{isLeft:!0,isHorizontallyCentered:!1,isRight:!1,isTop:!0,isVerticallyCentered:!1,isBottom:!1},2:{isLeft:!1,isHorizontallyCentered:!0,isRight:!1,isTop:!0,isVerticallyCentered:!1,isBottom:!1},3:{isLeft:!1,isHorizontallyCentered:!1,isRight:!0,isTop:!0,isVerticallyCentered:!1,isBottom:!1},4:{isLeft:!1,isHorizontallyCentered:!1,isRight:!0,isTop:!1,isVerticallyCentered:!0,isBottom:!1},5:{isLeft:!1,isHorizontallyCentered:!1,isRight:!0,isTop:!1,isVerticallyCentered:!1,isBottom:!0},6:{isLeft:!1,isHorizontallyCentered:!0,isRight:!1,isTop:!1,isVerticallyCentered:!1,isBottom:!0},7:{isLeft:!0,isHorizontallyCentered:!1,isRight:!1,isTop:!1,isVerticallyCentered:!1,isBottom:!0},8:{isLeft:!0,isHorizontallyCentered:!1,isRight:!1,isTop:!1,isVerticallyCentered:!0,isBottom:!1}}})}(t),function(e){var n={},r=1;e.Viewer=function(p){var _=arguments,R=this,N;if(e.isPlainObject(p)||(p={id:_[0],xmlPath:_.length>1?_[1]:void 0,prefixUrl:_.length>2?_[2]:void 0,controls:_.length>3?_[3]:void 0,overlays:_.length>4?_[4]:void 0}),p.config&&(e.extend(!0,p,p.config),delete p.config),e.extend(!0,this,{id:p.id,hash:p.hash||r++,initialPage:0,element:null,container:null,canvas:null,overlays:[],overlaysContainer:null,previousBody:[],customControls:[],source:null,drawer:null,world:null,viewport:null,navigator:null,collectionViewport:null,collectionDrawer:null,navImages:null,buttons:null,profiler:null},e.DEFAULT_SETTINGS,p),typeof this.hash=="undefined")throw new Error("A hash must be defined, either by specifying options.id or options.hash.");for(typeof n[this.hash]!="undefined"&&e.console.warn("Hash "+this.hash+" has already been used."),n[this.hash]={fsBoundsDelta:new e.Point(1,1),prevContainerSize:null,animating:!1,forceRedraw:!1,mouseInside:!1,group:null,zooming:!1,zoomFactor:null,lastZoomTime:null,fullPage:!1,onfullscreenchange:null},this._sequenceIndex=0,this._firstOpen=!0,this._updateRequestId=null,this._loadQueue=[],this.currentOverlays=[],this._updatePixelDensityRatioBind=null,this._lastScrollTime=e.now(),e.EventSource.call(this),this.addHandler("open-failed",function(L){var J=e.getString("Errors.OpenFailed",L.eventSource,L.message);R._showMessage(J)}),e.ControlDock.call(this,p),this.xmlPath&&(this.tileSources=[this.xmlPath]),this.element=this.element||document.getElementById(this.id),this.canvas=e.makeNeutralElement("div"),this.canvas.className="openseadragon-canvas",function(L){L.width="100%",L.height="100%",L.overflow="hidden",L.position="absolute",L.top="0px",L.left="0px"}(this.canvas.style),e.setElementTouchActionNone(this.canvas),p.tabIndex!==""&&(this.canvas.tabIndex=p.tabIndex===void 0?0:p.tabIndex),this.container.className="openseadragon-container",function(L){L.width="100%",L.height="100%",L.position="relative",L.overflow="hidden",L.left="0px",L.top="0px",L.textAlign="left"}(this.container.style),e.setElementTouchActionNone(this.container),this.container.insertBefore(this.canvas,this.container.firstChild),this.element.appendChild(this.container),this.bodyWidth=document.body.style.width,this.bodyHeight=document.body.style.height,this.bodyOverflow=document.body.style.overflow,this.docOverflow=document.documentElement.style.overflow,this.innerTracker=new e.MouseTracker({userData:"Viewer.innerTracker",element:this.canvas,startDisabled:!this.mouseNavEnabled,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,dblClickTimeThreshold:this.dblClickTimeThreshold,dblClickDistThreshold:this.dblClickDistThreshold,contextMenuHandler:e.delegate(this,b),keyDownHandler:e.delegate(this,T),keyHandler:e.delegate(this,f),clickHandler:e.delegate(this,E),dblClickHandler:e.delegate(this,A),dragHandler:e.delegate(this,C),dragEndHandler:e.delegate(this,O),enterHandler:e.delegate(this,D),leaveHandler:e.delegate(this,I),pressHandler:e.delegate(this,B),releaseHandler:e.delegate(this,Z),nonPrimaryPressHandler:e.delegate(this,Y),nonPrimaryReleaseHandler:e.delegate(this,V),scrollHandler:e.delegate(this,Q),pinchHandler:e.delegate(this,K)}),this.outerTracker=new e.MouseTracker({userData:"Viewer.outerTracker",element:this.container,startDisabled:!this.mouseNavEnabled,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,dblClickTimeThreshold:this.dblClickTimeThreshold,dblClickDistThreshold:this.dblClickDistThreshold,enterHandler:e.delegate(this,le),leaveHandler:e.delegate(this,re)}),this.toolbar&&(this.toolbar=new e.ControlDock({element:this.toolbar})),this.bindStandardControls(),n[this.hash].prevContainerSize=o(this.container),this.world=new e.World({viewer:this}),this.world.addHandler("add-item",function(L){R.source=R.world.getItemAt(0).source,n[R.hash].forceRedraw=!0,R._updateRequestId||(R._updateRequestId=u(R,se))}),this.world.addHandler("remove-item",function(L){R.world.getItemCount()?R.source=R.world.getItemAt(0).source:R.source=null,n[R.hash].forceRedraw=!0}),this.world.addHandler("metrics-change",function(L){R.viewport&&R.viewport._setContentBounds(R.world.getHomeBounds(),R.world.getContentFactor())}),this.world.addHandler("item-index-change",function(L){R.source=R.world.getItemAt(0).source}),this.viewport=new e.Viewport({containerSize:n[this.hash].prevContainerSize,springStiffness:this.springStiffness,animationTime:this.animationTime,minZoomImageRatio:this.minZoomImageRatio,maxZoomPixelRatio:this.maxZoomPixelRatio,visibilityRatio:this.visibilityRatio,wrapHorizontal:this.wrapHorizontal,wrapVertical:this.wrapVertical,defaultZoomLevel:this.defaultZoomLevel,minZoomLevel:this.minZoomLevel,maxZoomLevel:this.maxZoomLevel,viewer:this,degrees:this.degrees,flipped:this.flipped,navigatorRotate:this.navigatorRotate,homeFillsViewer:this.homeFillsViewer,margins:this.viewportMargins}),this.viewport._setContentBounds(this.world.getHomeBounds(),this.world.getContentFactor()),this.imageLoader=new e.ImageLoader({jobLimit:this.imageLoaderLimit,timeout:p.timeout}),this.tileCache=new e.TileCache({maxImageCacheCount:this.maxImageCacheCount}),this.drawer=new e.Drawer({viewer:this,viewport:this.viewport,element:this.canvas,debugGridColor:this.debugGridColor}),this.overlaysContainer=e.makeNeutralElement("div"),this.canvas.appendChild(this.overlaysContainer),this.drawer.canRotate()||(this.rotateLeft&&(N=this.buttonGroup.buttons.indexOf(this.rotateLeft),this.buttonGroup.buttons.splice(N,1),this.buttonGroup.element.removeChild(this.rotateLeft.element)),this.rotateRight&&(N=this.buttonGroup.buttons.indexOf(this.rotateRight),this.buttonGroup.buttons.splice(N,1),this.buttonGroup.element.removeChild(this.rotateRight.element))),this._addUpdatePixelDensityRatioEvent(),this.showNavigator&&(this.navigator=new e.Navigator({id:this.navigatorId,position:this.navigatorPosition,sizeRatio:this.navigatorSizeRatio,maintainSizeRatio:this.navigatorMaintainSizeRatio,top:this.navigatorTop,left:this.navigatorLeft,width:this.navigatorWidth,height:this.navigatorHeight,autoResize:this.navigatorAutoResize,autoFade:this.navigatorAutoFade,prefixUrl:this.prefixUrl,viewer:this,navigatorRotate:this.navigatorRotate,background:this.navigatorBackground,opacity:this.navigatorOpacity,borderColor:this.navigatorBorderColor,displayRegionColor:this.navigatorDisplayRegionColor,crossOriginPolicy:this.crossOriginPolicy})),this.sequenceMode&&this.bindSequenceControls(),this.tileSources&&this.open(this.tileSources),N=0;N<this.customControls.length;N++)this.addControl(this.customControls[N].id,{anchor:this.customControls[N].anchor});e.requestAnimationFrame(function(){h(R)}),this.imageSmoothingEnabled!==void 0&&!this.imageSmoothingEnabled&&this.drawer.setImageSmoothingEnabled(this.imageSmoothingEnabled),e._viewers.set(this.element,this)},e.extend(e.Viewer.prototype,e.EventSource.prototype,e.ControlDock.prototype,{isOpen:function(){return!!this.world.getItemCount()},openDzi:function(p){return e.console.error("[Viewer.openDzi] this function is deprecated; use Viewer.open() instead."),this.open(p)},openTileSource:function(p){return e.console.error("[Viewer.openTileSource] this function is deprecated; use Viewer.open() instead."),this.open(p)},open:function(p,_){var R=this;if(this.close(),!p)return this;if(this.sequenceMode&&e.isArray(p))return this.referenceStrip&&(this.referenceStrip.destroy(),this.referenceStrip=null),typeof _!="undefined"&&!isNaN(_)&&(this.initialPage=_),this.tileSources=p,this._sequenceIndex=Math.max(0,Math.min(this.tileSources.length-1,this.initialPage)),this.tileSources.length&&(this.open(this.tileSources[this._sequenceIndex]),this.showReferenceStrip&&this.addReferenceStrip()),this._updateSequenceButtons(this._sequenceIndex),this;if(e.isArray(p)||(p=[p]),!p.length)return this;this._opening=!0;for(var N=p.length,L=0,J=0,q,fe=function(){if(L+J===N)if(L){(R._firstOpen||!R.preserveViewport)&&(R.viewport.goHome(!0),R.viewport.update()),R._firstOpen=!1;var oe=p[0];if(oe.tileSource&&(oe=oe.tileSource),R.overlays&&!R.preserveOverlays)for(var Te=0;Te<R.overlays.length;Te++)R.currentOverlays[Te]=a(R,R.overlays[Te]);R._drawOverlays(),R._opening=!1,R.raiseEvent("open",{source:oe})}else R._opening=!1,R.raiseEvent("open-failed",q)},Se=function(oe){(!e.isPlainObject(oe)||!oe.tileSource)&&(oe={tileSource:oe}),oe.index!==void 0&&(e.console.error("[Viewer.open] setting indexes here is not supported; use addTiledImage instead"),delete oe.index),oe.collectionImmediately===void 0&&(oe.collectionImmediately=!0);var Te=oe.success;oe.success=function(ze){if(L++,oe.tileSource.overlays)for(var Mt=0;Mt<oe.tileSource.overlays.length;Mt++)R.addOverlay(oe.tileSource.overlays[Mt]);Te&&Te(ze),fe()};var he=oe.error;oe.error=function(ze){J++,q||(q=ze),he&&he(ze),fe()},R.addTiledImage(oe)},ge=0;ge<p.length;ge++)Se(p[ge]);return this},close:function(){return n[this.hash]?(this._opening=!1,this.navigator&&this.navigator.close(),this.preserveOverlays||(this.clearOverlays(),this.overlaysContainer.innerHTML=""),n[this.hash].animating=!1,this.world.removeAll(),this.imageLoader.clear(),this.raiseEvent("close"),this):this},destroy:function(){if(!!n[this.hash]){if(this._removeUpdatePixelDensityRatioEvent(),this.close(),this.clearOverlays(),this.overlaysContainer.innerHTML="",this.referenceStrip&&(this.referenceStrip.destroy(),this.referenceStrip=null),this._updateRequestId!==null&&(e.cancelAnimationFrame(this._updateRequestId),this._updateRequestId=null),this.drawer&&this.drawer.destroy(),this.navigator&&(this.navigator.destroy(),n[this.navigator.hash]=null,delete n[this.navigator.hash],this.navigator=null),this.removeAllHandlers(),this.buttonGroup)this.buttonGroup.destroy();else if(this.customButtons)for(;this.customButtons.length;)this.customButtons.pop().destroy();if(this.paging&&this.paging.destroy(),this.element)for(;this.element.firstChild;)this.element.removeChild(this.element.firstChild);this.container.onsubmit=null,this.clearControls(),this.innerTracker&&this.innerTracker.destroy(),this.outerTracker&&this.outerTracker.destroy(),n[this.hash]=null,delete n[this.hash],this.canvas=null,this.container=null,e._viewers.delete(this.element),this.element=null}},isMouseNavEnabled:function(){return this.innerTracker.isTracking()},setMouseNavEnabled:function(p){return this.innerTracker.setTracking(p),this.outerTracker.setTracking(p),this.raiseEvent("mouse-enabled",{enabled:p}),this},areControlsEnabled:function(){var p=this.controls.length,_;for(_=0;_<this.controls.length;_++)p=p&&this.controls[_].isVisible();return p},setControlsEnabled:function(p){return p?g(this):h(this),this.raiseEvent("controls-enabled",{enabled:p}),this},setDebugMode:function(p){for(var _=0;_<this.world.getItemCount();_++)this.world.getItemAt(_).debugMode=p;this.debugMode=p,this.forceRedraw()},isFullPage:function(){return n[this.hash].fullPage},setFullPage:function(p){var _=document.body,R=_.style,N=document.documentElement.style,L=this,J,q;if(p===this.isFullPage())return this;var fe={fullPage:p,preventDefaultAction:!1};if(this.raiseEvent("pre-full-page",fe),fe.preventDefaultAction)return this;if(p){for(this.elementSize=e.getElementSize(this.element),this.pageScroll=e.getPageScroll(),this.elementMargin=this.element.style.margin,this.element.style.margin="0",this.elementPadding=this.element.style.padding,this.element.style.padding="0",this.bodyMargin=R.margin,this.docMargin=N.margin,R.margin="0",N.margin="0",this.bodyPadding=R.padding,this.docPadding=N.padding,R.padding="0",N.padding="0",this.bodyWidth=R.width,this.docWidth=N.width,R.width="100%",N.width="100%",this.bodyHeight=R.height,this.docHeight=N.height,R.height="100%",N.height="100%",this.bodyDisplay=R.display,R.display="block",this.previousBody=[],n[this.hash].prevElementParent=this.element.parentNode,n[this.hash].prevNextSibling=this.element.nextSibling,n[this.hash].prevElementWidth=this.element.style.width,n[this.hash].prevElementHeight=this.element.style.height,J=_.childNodes.length,q=0;q<J;q++)this.previousBody.push(_.childNodes[0]),_.removeChild(_.childNodes[0]);this.toolbar&&this.toolbar.element&&(this.toolbar.parentNode=this.toolbar.element.parentNode,this.toolbar.nextSibling=this.toolbar.element.nextSibling,_.appendChild(this.toolbar.element),e.addClass(this.toolbar.element,"fullpage")),e.addClass(this.element,"fullpage"),_.appendChild(this.element),this.element.style.height=e.getWindowSize().y+"px",this.element.style.width=e.getWindowSize().x+"px",this.toolbar&&this.toolbar.element&&(this.element.style.height=e.getElementSize(this.element).y-e.getElementSize(this.toolbar.element).y+"px"),n[this.hash].fullPage=!0,e.delegate(this,le)({})}else{for(this.element.style.margin=this.elementMargin,this.element.style.padding=this.elementPadding,R.margin=this.bodyMargin,N.margin=this.docMargin,R.padding=this.bodyPadding,N.padding=this.docPadding,R.width=this.bodyWidth,N.width=this.docWidth,R.height=this.bodyHeight,N.height=this.docHeight,R.display=this.bodyDisplay,_.removeChild(this.element),J=this.previousBody.length,q=0;q<J;q++)_.appendChild(this.previousBody.shift());e.removeClass(this.element,"fullpage"),n[this.hash].prevElementParent.insertBefore(this.element,n[this.hash].prevNextSibling),this.toolbar&&this.toolbar.element&&(_.removeChild(this.toolbar.element),e.removeClass(this.toolbar.element,"fullpage"),this.toolbar.parentNode.insertBefore(this.toolbar.element,this.toolbar.nextSibling),delete this.toolbar.parentNode,delete this.toolbar.nextSibling),this.element.style.width=n[this.hash].prevElementWidth,this.element.style.height=n[this.hash].prevElementHeight;var Se=0,ge=function(){e.setPageScroll(L.pageScroll);var oe=e.getPageScroll();Se++,Se<10&&(oe.x!==L.pageScroll.x||oe.y!==L.pageScroll.y)&&e.requestAnimationFrame(ge)};e.requestAnimationFrame(ge),n[this.hash].fullPage=!1,e.delegate(this,re)({})}return this.navigator&&this.viewport&&this.navigator.update(this.viewport),this.raiseEvent("full-page",{fullPage:p}),this},setFullScreen:function(p){var _=this;if(!e.supportsFullScreen)return this.setFullPage(p);if(e.isFullScreen()===p)return this;var R={fullScreen:p,preventDefaultAction:!1};if(this.raiseEvent("pre-full-screen",R),R.preventDefaultAction)return this;if(p){if(this.setFullPage(!0),!this.isFullPage())return this;this.fullPageStyleWidth=this.element.style.width,this.fullPageStyleHeight=this.element.style.height,this.element.style.width="100%",this.element.style.height="100%";var N=function(){var L=e.isFullScreen();L||(e.removeEvent(document,e.fullScreenEventName,N),e.removeEvent(document,e.fullScreenErrorEventName,N),_.setFullPage(!1),_.isFullPage()&&(_.element.style.width=_.fullPageStyleWidth,_.element.style.height=_.fullPageStyleHeight)),_.navigator&&_.viewport&&setTimeout(function(){_.navigator.update(_.viewport)}),_.raiseEvent("full-screen",{fullScreen:L})};e.addEvent(document,e.fullScreenEventName,N),e.addEvent(document,e.fullScreenErrorEventName,N),e.requestFullScreen(document.body)}else e.exitFullScreen();return this},isVisible:function(){return this.container.style.visibility!=="hidden"},setVisible:function(p){return this.container.style.visibility=p?"":"hidden",this.raiseEvent("visible",{visible:p}),this},addTiledImage:function(p){e.console.assert(p,"[Viewer.addTiledImage] options is required"),e.console.assert(p.tileSource,"[Viewer.addTiledImage] options.tileSource is required"),e.console.assert(!p.replace||p.index>-1&&p.index<this.world.getItemCount(),"[Viewer.addTiledImage] if options.replace is used, options.index must be a valid index in Viewer.world");var _=this;p.replace&&(p.replaceItem=_.world.getItemAt(p.index)),this._hideMessage(),p.placeholderFillStyle===void 0&&(p.placeholderFillStyle=this.placeholderFillStyle),p.opacity===void 0&&(p.opacity=this.opacity),p.preload===void 0&&(p.preload=this.preload),p.compositeOperation===void 0&&(p.compositeOperation=this.compositeOperation),p.crossOriginPolicy===void 0&&(p.crossOriginPolicy=p.tileSource.crossOriginPolicy!==void 0?p.tileSource.crossOriginPolicy:this.crossOriginPolicy),p.ajaxWithCredentials===void 0&&(p.ajaxWithCredentials=this.ajaxWithCredentials),p.loadTilesWithAjax===void 0&&(p.loadTilesWithAjax=this.loadTilesWithAjax),p.ajaxHeaders===void 0||p.ajaxHeaders===null?p.ajaxHeaders=this.ajaxHeaders:e.isPlainObject(p.ajaxHeaders)&&e.isPlainObject(this.ajaxHeaders)&&(p.ajaxHeaders=e.extend({},this.ajaxHeaders,p.ajaxHeaders));var R={options:p};function N(q){for(var fe=0;fe<_._loadQueue.length;fe++)if(_._loadQueue[fe]===R){_._loadQueue.splice(fe,1);break}_._loadQueue.length===0&&L(R),_.raiseEvent("add-item-failed",q),p.error&&p.error(q)}function L(q){_.collectionMode&&(_.world.arrange({immediately:q.options.collectionImmediately,rows:_.collectionRows,columns:_.collectionColumns,layout:_.collectionLayout,tileSize:_.collectionTileSize,tileMargin:_.collectionTileMargin}),_.world.setAutoRefigureSizes(!0))}if(e.isArray(p.tileSource)){setTimeout(function(){N({message:"[Viewer.addTiledImage] Sequences can not be added; add them one at a time instead.",source:p.tileSource,options:p})});return}this._loadQueue.push(R);function J(){for(var q,fe,Se;_._loadQueue.length&&(q=_._loadQueue[0],!!q.tileSource);){if(_._loadQueue.splice(0,1),q.options.replace){var ge=_.world.getIndexOfItem(q.options.replaceItem);ge!==-1&&(q.options.index=ge),_.world.removeItem(q.options.replaceItem)}fe=new e.TiledImage({viewer:_,source:q.tileSource,viewport:_.viewport,drawer:_.drawer,tileCache:_.tileCache,imageLoader:_.imageLoader,x:q.options.x,y:q.options.y,width:q.options.width,height:q.options.height,fitBounds:q.options.fitBounds,fitBoundsPlacement:q.options.fitBoundsPlacement,clip:q.options.clip,placeholderFillStyle:q.options.placeholderFillStyle,opacity:q.options.opacity,preload:q.options.preload,degrees:q.options.degrees,flipped:q.options.flipped,compositeOperation:q.options.compositeOperation,springStiffness:_.springStiffness,animationTime:_.animationTime,minZoomImageRatio:_.minZoomImageRatio,wrapHorizontal:_.wrapHorizontal,wrapVertical:_.wrapVertical,immediateRender:_.immediateRender,blendTime:_.blendTime,alwaysBlend:_.alwaysBlend,minPixelRatio:_.minPixelRatio,smoothTileEdgesMinZoom:_.smoothTileEdgesMinZoom,iOSDevice:_.iOSDevice,crossOriginPolicy:q.options.crossOriginPolicy,ajaxWithCredentials:q.options.ajaxWithCredentials,loadTilesWithAjax:q.options.loadTilesWithAjax,ajaxHeaders:q.options.ajaxHeaders,debugMode:_.debugMode}),_.collectionMode&&_.world.setAutoRefigureSizes(!1),_.navigator&&(Se=e.extend({},q.options,{replace:!1,originalTiledImage:fe,tileSource:q.tileSource}),_.navigator.addTiledImage(Se)),_.world.addItem(fe,{index:q.options.index}),_._loadQueue.length===0&&L(q),_.world.getItemCount()===1&&!_.preserveViewport&&_.viewport.goHome(!0),q.options.success&&q.options.success({item:fe})}}s(this,p.tileSource,p,function(q){R.tileSource=q,J()},function(q){q.options=p,N(q),J()})},addSimpleImage:function(p){e.console.assert(p,"[Viewer.addSimpleImage] options is required"),e.console.assert(p.url,"[Viewer.addSimpleImage] options.url is required");var _=e.extend({},p,{tileSource:{type:"image",url:p.url}});delete _.url,this.addTiledImage(_)},addLayer:function(p){var _=this;e.console.error("[Viewer.addLayer] this function is deprecated; use Viewer.addTiledImage() instead.");var R=e.extend({},p,{success:function(N){_.raiseEvent("add-layer",{options:p,drawer:N.item})},error:function(N){_.raiseEvent("add-layer-failed",N)}});return this.addTiledImage(R),this},getLayerAtLevel:function(p){return e.console.error("[Viewer.getLayerAtLevel] this function is deprecated; use World.getItemAt() instead."),this.world.getItemAt(p)},getLevelOfLayer:function(p){return e.console.error("[Viewer.getLevelOfLayer] this function is deprecated; use World.getIndexOfItem() instead."),this.world.getIndexOfItem(p)},getLayersCount:function(){return e.console.error("[Viewer.getLayersCount] this function is deprecated; use World.getItemCount() instead."),this.world.getItemCount()},setLayerLevel:function(p,_){return e.console.error("[Viewer.setLayerLevel] this function is deprecated; use World.setItemIndex() instead."),this.world.setItemIndex(p,_)},removeLayer:function(p){return e.console.error("[Viewer.removeLayer] this function is deprecated; use World.removeItem() instead."),this.world.removeItem(p)},forceRedraw:function(){return n[this.hash].forceRedraw=!0,this},bindSequenceControls:function(){var p=e.delegate(this,y),_=e.delegate(this,x),R=e.delegate(this,this.goToNextPage),N=e.delegate(this,this.goToPreviousPage),L=this.navImages,J=!0;return this.showSequenceControl&&((this.previousButton||this.nextButton)&&(J=!1),this.previousButton=new e.Button({element:this.previousButton?e.getElement(this.previousButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:e.getString("Tooltips.PreviousPage"),srcRest:G(this.prefixUrl,L.previous.REST),srcGroup:G(this.prefixUrl,L.previous.GROUP),srcHover:G(this.prefixUrl,L.previous.HOVER),srcDown:G(this.prefixUrl,L.previous.DOWN),onRelease:N,onFocus:p,onBlur:_}),this.nextButton=new e.Button({element:this.nextButton?e.getElement(this.nextButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:e.getString("Tooltips.NextPage"),srcRest:G(this.prefixUrl,L.next.REST),srcGroup:G(this.prefixUrl,L.next.GROUP),srcHover:G(this.prefixUrl,L.next.HOVER),srcDown:G(this.prefixUrl,L.next.DOWN),onRelease:R,onFocus:p,onBlur:_}),this.navPrevNextWrap||this.previousButton.disable(),(!this.tileSources||!this.tileSources.length)&&this.nextButton.disable(),J&&(this.paging=new e.ButtonGroup({buttons:[this.previousButton,this.nextButton],clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold}),this.pagingControl=this.paging.element,this.toolbar?this.toolbar.addControl(this.pagingControl,{anchor:e.ControlAnchor.BOTTOM_RIGHT}):this.addControl(this.pagingControl,{anchor:this.sequenceControlAnchor||e.ControlAnchor.TOP_LEFT}))),this},bindStandardControls:function(){var p=e.delegate(this,Me),_=e.delegate(this,H),R=e.delegate(this,j),N=e.delegate(this,F),L=e.delegate(this,$),J=e.delegate(this,we),q=e.delegate(this,me),fe=e.delegate(this,Qe),Se=e.delegate(this,$e),ge=e.delegate(this,et),oe=e.delegate(this,y),Te=e.delegate(this,x),he=this.navImages,ze=[],Mt=!0;return this.showNavigationControl&&((this.zoomInButton||this.zoomOutButton||this.homeButton||this.fullPageButton||this.rotateLeftButton||this.rotateRightButton||this.flipButton)&&(Mt=!1),this.showZoomControl&&(ze.push(this.zoomInButton=new e.Button({element:this.zoomInButton?e.getElement(this.zoomInButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:e.getString("Tooltips.ZoomIn"),srcRest:G(this.prefixUrl,he.zoomIn.REST),srcGroup:G(this.prefixUrl,he.zoomIn.GROUP),srcHover:G(this.prefixUrl,he.zoomIn.HOVER),srcDown:G(this.prefixUrl,he.zoomIn.DOWN),onPress:p,onRelease:_,onClick:R,onEnter:p,onExit:_,onFocus:oe,onBlur:Te})),ze.push(this.zoomOutButton=new e.Button({element:this.zoomOutButton?e.getElement(this.zoomOutButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:e.getString("Tooltips.ZoomOut"),srcRest:G(this.prefixUrl,he.zoomOut.REST),srcGroup:G(this.prefixUrl,he.zoomOut.GROUP),srcHover:G(this.prefixUrl,he.zoomOut.HOVER),srcDown:G(this.prefixUrl,he.zoomOut.DOWN),onPress:N,onRelease:_,onClick:L,onEnter:N,onExit:_,onFocus:oe,onBlur:Te}))),this.showHomeControl&&ze.push(this.homeButton=new e.Button({element:this.homeButton?e.getElement(this.homeButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:e.getString("Tooltips.Home"),srcRest:G(this.prefixUrl,he.home.REST),srcGroup:G(this.prefixUrl,he.home.GROUP),srcHover:G(this.prefixUrl,he.home.HOVER),srcDown:G(this.prefixUrl,he.home.DOWN),onRelease:J,onFocus:oe,onBlur:Te})),this.showFullPageControl&&ze.push(this.fullPageButton=new e.Button({element:this.fullPageButton?e.getElement(this.fullPageButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:e.getString("Tooltips.FullPage"),srcRest:G(this.prefixUrl,he.fullpage.REST),srcGroup:G(this.prefixUrl,he.fullpage.GROUP),srcHover:G(this.prefixUrl,he.fullpage.HOVER),srcDown:G(this.prefixUrl,he.fullpage.DOWN),onRelease:q,onFocus:oe,onBlur:Te})),this.showRotationControl&&(ze.push(this.rotateLeftButton=new e.Button({element:this.rotateLeftButton?e.getElement(this.rotateLeftButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:e.getString("Tooltips.RotateLeft"),srcRest:G(this.prefixUrl,he.rotateleft.REST),srcGroup:G(this.prefixUrl,he.rotateleft.GROUP),srcHover:G(this.prefixUrl,he.rotateleft.HOVER),srcDown:G(this.prefixUrl,he.rotateleft.DOWN),onRelease:fe,onFocus:oe,onBlur:Te})),ze.push(this.rotateRightButton=new e.Button({element:this.rotateRightButton?e.getElement(this.rotateRightButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:e.getString("Tooltips.RotateRight"),srcRest:G(this.prefixUrl,he.rotateright.REST),srcGroup:G(this.prefixUrl,he.rotateright.GROUP),srcHover:G(this.prefixUrl,he.rotateright.HOVER),srcDown:G(this.prefixUrl,he.rotateright.DOWN),onRelease:Se,onFocus:oe,onBlur:Te}))),this.showFlipControl&&ze.push(this.flipButton=new e.Button({element:this.flipButton?e.getElement(this.flipButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:e.getString("Tooltips.Flip"),srcRest:G(this.prefixUrl,he.flip.REST),srcGroup:G(this.prefixUrl,he.flip.GROUP),srcHover:G(this.prefixUrl,he.flip.HOVER),srcDown:G(this.prefixUrl,he.flip.DOWN),onRelease:ge,onFocus:oe,onBlur:Te})),Mt?(this.buttonGroup=new e.ButtonGroup({buttons:ze,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold}),this.navControl=this.buttonGroup.element,this.addHandler("open",e.delegate(this,ae)),this.toolbar?this.toolbar.addControl(this.navControl,{anchor:this.navigationControlAnchor||e.ControlAnchor.TOP_LEFT}):this.addControl(this.navControl,{anchor:this.navigationControlAnchor||e.ControlAnchor.TOP_LEFT})):this.customButtons=ze),this},currentPage:function(){return this._sequenceIndex},goToPage:function(p){return this.tileSources&&p>=0&&p<this.tileSources.length&&(this._sequenceIndex=p,this._updateSequenceButtons(p),this.open(this.tileSources[p]),this.referenceStrip&&this.referenceStrip.setFocus(p),this.raiseEvent("page",{page:p})),this},addOverlay:function(p,_,R,N){var L;if(e.isPlainObject(p)?L=p:L={element:p,location:_,placement:R,onDraw:N},p=e.getElement(L.element),l(this.currentOverlays,p)>=0)return this;var J=a(this,L);return this.currentOverlays.push(J),J.drawHTML(this.overlaysContainer,this.viewport),this.raiseEvent("add-overlay",{element:p,location:L.location,placement:L.placement}),this},updateOverlay:function(p,_,R){var N;return p=e.getElement(p),N=l(this.currentOverlays,p),N>=0&&(this.currentOverlays[N].update(_,R),n[this.hash].forceRedraw=!0,this.raiseEvent("update-overlay",{element:p,location:_,placement:R})),this},removeOverlay:function(p){var _;return p=e.getElement(p),_=l(this.currentOverlays,p),_>=0&&(this.currentOverlays[_].destroy(),this.currentOverlays.splice(_,1),n[this.hash].forceRedraw=!0,this.raiseEvent("remove-overlay",{element:p})),this},clearOverlays:function(){for(;this.currentOverlays.length>0;)this.currentOverlays.pop().destroy();return n[this.hash].forceRedraw=!0,this.raiseEvent("clear-overlay",{}),this},getOverlayById:function(p){var _;return p=e.getElement(p),_=l(this.currentOverlays,p),_>=0?this.currentOverlays[_]:null},_updateSequenceButtons:function(p){this.nextButton&&(!this.tileSources||this.tileSources.length-1===p?this.navPrevNextWrap||this.nextButton.disable():this.nextButton.enable()),this.previousButton&&(p>0?this.previousButton.enable():this.navPrevNextWrap||this.previousButton.disable())},_showMessage:function(p){this._hideMessage();var _=e.makeNeutralElement("div");_.appendChild(document.createTextNode(p)),this.messageDiv=e.makeCenteredNode(_),e.addClass(this.messageDiv,"openseadragon-message"),this.container.appendChild(this.messageDiv)},_hideMessage:function(){var p=this.messageDiv;p&&(p.parentNode.removeChild(p),delete this.messageDiv)},gestureSettingsByDeviceType:function(p){switch(p){case"mouse":return this.gestureSettingsMouse;case"touch":return this.gestureSettingsTouch;case"pen":return this.gestureSettingsPen;default:return this.gestureSettingsUnknown}},_drawOverlays:function(){var p,_=this.currentOverlays.length;for(p=0;p<_;p++)this.currentOverlays[p].drawHTML(this.overlaysContainer,this.viewport)},_cancelPendingImages:function(){this._loadQueue=[]},removeReferenceStrip:function(){this.showReferenceStrip=!1,this.referenceStrip&&(this.referenceStrip.destroy(),this.referenceStrip=null)},addReferenceStrip:function(){if(this.showReferenceStrip=!0,this.sequenceMode){if(this.referenceStrip)return;this.tileSources.length&&this.tileSources.length>1&&(this.referenceStrip=new e.ReferenceStrip({id:this.referenceStripElement,position:this.referenceStripPosition,sizeRatio:this.referenceStripSizeRatio,scroll:this.referenceStripScroll,height:this.referenceStripHeight,width:this.referenceStripWidth,tileSources:this.tileSources,prefixUrl:this.prefixUrl,useCanvas:this.useCanvas,viewer:this}),this.referenceStrip.setFocus(this._sequenceIndex))}else e.console.warn('Attempting to display a reference strip while "sequenceMode" is off.')},_addUpdatePixelDensityRatioEvent:function(){this._updatePixelDensityRatioBind=this._updatePixelDensityRatio.bind(this),e.addEvent(window,"resize",this._updatePixelDensityRatioBind)},_removeUpdatePixelDensityRatioEvent:function(){e.removeEvent(window,"resize",this._updatePixelDensityRatioBind)},_updatePixelDensityRatio:function(){var p=e.pixelDensityRatio,_=e.getCurrentPixelDensityRatio();p!==_&&(e.pixelDensityRatio=_,this.world.resetItems(),this.forceRedraw())},goToPreviousPage:function(){var p=this._sequenceIndex-1;this.navPrevNextWrap&&p<0&&(p+=this.tileSources.length),this.goToPage(p)},goToNextPage:function(){var p=this._sequenceIndex+1;this.navPrevNextWrap&&p>=this.tileSources.length&&(p=0),this.goToPage(p)}});function o(p){return p=e.getElement(p),new e.Point(p.clientWidth===0?1:p.clientWidth,p.clientHeight===0?1:p.clientHeight)}function s(p,_,R,N,L){var J=p;if(e.type(_)==="string"){if(_.match(/^\s*<.*>\s*$/))_=e.parseXml(_);else if(_.match(/^\s*[{[].*[}\]]\s*$/))try{var q=e.parseJSON(_);_=q}catch{}}function fe(Se,ge){Se.ready?N(Se):(Se.addHandler("ready",function(){N(Se)}),Se.addHandler("open-failed",function(oe){L({message:oe.message,source:ge})}))}setTimeout(function(){if(e.type(_)==="string")_=new e.TileSource({url:_,crossOriginPolicy:R.crossOriginPolicy!==void 0?R.crossOriginPolicy:p.crossOriginPolicy,ajaxWithCredentials:p.ajaxWithCredentials,ajaxHeaders:R.ajaxHeaders?R.ajaxHeaders:p.ajaxHeaders,useCanvas:p.useCanvas,success:function(Te){N(Te.tileSource)}}),_.addHandler("open-failed",function(Te){L(Te)});else if(e.isPlainObject(_)||_.nodeType)if(_.crossOriginPolicy===void 0&&(R.crossOriginPolicy!==void 0||p.crossOriginPolicy!==void 0)&&(_.crossOriginPolicy=R.crossOriginPolicy!==void 0?R.crossOriginPolicy:p.crossOriginPolicy),_.ajaxWithCredentials===void 0&&(_.ajaxWithCredentials=p.ajaxWithCredentials),_.useCanvas===void 0&&(_.useCanvas=p.useCanvas),e.isFunction(_.getTileUrl)){var Se=new e.TileSource(_);Se.getTileUrl=_.getTileUrl,N(Se)}else{var ge=e.TileSource.determineType(J,_);if(!ge){L({message:"Unable to load TileSource",source:_});return}var oe=ge.prototype.configure.apply(J,[_]);fe(new ge(oe),_)}else fe(_,_)})}function a(p,_){if(_ instanceof e.Overlay)return _;var R=null;if(_.element)R=e.getElement(_.element);else{var N=_.id?_.id:"openseadragon-overlay-"+Math.floor(Math.random()*1e7);R=e.getElement(_.id),R||(R=document.createElement("a"),R.href="#/overlay/"+N),R.id=N,e.addClass(R,_.className?_.className:"openseadragon-overlay")}var L=_.location,J=_.width,q=_.height;if(!L){var fe=_.x,Se=_.y;if(_.px!==void 0){var ge=p.viewport.imageToViewportRectangle(new e.Rect(_.px,_.py,J||0,q||0));fe=ge.x,Se=ge.y,J=J!==void 0?ge.width:void 0,q=q!==void 0?ge.height:void 0}L=new e.Point(fe,Se)}var oe=_.placement;return oe&&e.type(oe)==="string"&&(oe=e.Placement[_.placement.toUpperCase()]),new e.Overlay({element:R,location:L,placement:oe,onDraw:_.onDraw,checkResize:_.checkResize,width:J,height:q,rotationMode:_.rotationMode})}function l(p,_){var R;for(R=p.length-1;R>=0;R--)if(p[R].element===_)return R;return-1}function u(p,_){return e.requestAnimationFrame(function(){_(p)})}function c(p){e.requestAnimationFrame(function(){d(p)})}function h(p){!p.autoHideControls||(p.controlsShouldFade=!0,p.controlsFadeBeginTime=e.now()+p.controlsFadeDelay,window.setTimeout(function(){c(p)},p.controlsFadeDelay))}function d(p){var _,R,N,L;if(p.controlsShouldFade){for(_=e.now(),R=_-p.controlsFadeBeginTime,N=1-R/p.controlsFadeLength,N=Math.min(1,N),N=Math.max(0,N),L=p.controls.length-1;L>=0;L--)p.controls[L].autoFade&&p.controls[L].setOpacity(N);N>0&&c(p)}}function g(p){var _;for(p.controlsShouldFade=!1,_=p.controls.length-1;_>=0;_--)p.controls[_].setOpacity(1)}function y(){g(this)}function x(){h(this)}function b(p){var _={tracker:p.eventSource,position:p.position,originalEvent:p.originalEvent,preventDefault:p.preventDefault};this.raiseEvent("canvas-contextmenu",_),p.preventDefault=_.preventDefault}function T(p){var _={originalEvent:p.originalEvent,preventDefaultAction:!1,preventVerticalPan:p.preventVerticalPan,preventHorizontalPan:p.preventHorizontalPan};if(this.raiseEvent("canvas-key",_),!_.preventDefaultAction&&!p.ctrl&&!p.alt&&!p.meta)switch(p.keyCode){case 38:_.preventVerticalPan||(p.shift?this.viewport.zoomBy(1.1):this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(0,-this.pixelsPerArrowPress))),this.viewport.applyConstraints()),p.preventDefault=!0;break;case 40:_.preventVerticalPan||(p.shift?this.viewport.zoomBy(.9):this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(0,this.pixelsPerArrowPress))),this.viewport.applyConstraints()),p.preventDefault=!0;break;case 37:_.preventHorizontalPan||(this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(-this.pixelsPerArrowPress,0))),this.viewport.applyConstraints()),p.preventDefault=!0;break;case 39:_.preventHorizontalPan||(this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(this.pixelsPerArrowPress,0))),this.viewport.applyConstraints()),p.preventDefault=!0;break;default:p.preventDefault=!1;break}else p.preventDefault=!1}function f(p){var _={originalEvent:p.originalEvent,preventDefaultAction:!1,preventVerticalPan:p.preventVerticalPan,preventHorizontalPan:p.preventHorizontalPan};if(this.raiseEvent("canvas-key",_),!_.preventDefaultAction&&!p.ctrl&&!p.alt&&!p.meta)switch(p.keyCode){case 43:case 61:this.viewport.zoomBy(1.1),this.viewport.applyConstraints(),p.preventDefault=!0;break;case 45:this.viewport.zoomBy(.9),this.viewport.applyConstraints(),p.preventDefault=!0;break;case 48:this.viewport.goHome(),this.viewport.applyConstraints(),p.preventDefault=!0;break;case 119:case 87:_.preventVerticalPan||(p.shift?this.viewport.zoomBy(1.1):this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(0,-40))),this.viewport.applyConstraints()),p.preventDefault=!0;break;case 115:case 83:_.preventVerticalPan||(p.shift?this.viewport.zoomBy(.9):this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(0,40))),this.viewport.applyConstraints()),p.preventDefault=!0;break;case 97:_.preventHorizontalPan||(this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(-40,0))),this.viewport.applyConstraints()),p.preventDefault=!0;break;case 100:_.preventHorizontalPan||(this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(40,0))),this.viewport.applyConstraints()),p.preventDefault=!0;break;case 114:this.viewport.flipped?this.viewport.setRotation(e.positiveModulo(this.viewport.degrees-this.rotationIncrement,360)):this.viewport.setRotation(e.positiveModulo(this.viewport.degrees+this.rotationIncrement,360)),this.viewport.applyConstraints(),p.preventDefault=!0;break;case 82:this.viewport.flipped?this.viewport.setRotation(e.positiveModulo(this.viewport.degrees+this.rotationIncrement,360)):this.viewport.setRotation(e.positiveModulo(this.viewport.degrees-this.rotationIncrement,360)),this.viewport.applyConstraints(),p.preventDefault=!0;break;case 102:this.viewport.toggleFlip(),p.preventDefault=!0;break;case 106:this.goToPreviousPage();break;case 107:this.goToNextPage();break;default:p.preventDefault=!1;break}else p.preventDefault=!1}function E(p){var _,R=document.activeElement===this.canvas;R||this.canvas.focus(),this.viewport.flipped&&(p.position.x=this.viewport.getContainerSize().x-p.position.x);var N={tracker:p.eventSource,position:p.position,quick:p.quick,shift:p.shift,originalEvent:p.originalEvent,originalTarget:p.originalTarget,preventDefaultAction:!1};this.raiseEvent("canvas-click",N),!N.preventDefaultAction&&this.viewport&&p.quick&&(_=this.gestureSettingsByDeviceType(p.pointerType),_.clickToZoom&&(this.viewport.zoomBy(p.shift?1/this.zoomPerClick:this.zoomPerClick,_.zoomToRefPoint?this.viewport.pointFromPixel(p.position,!0):null),this.viewport.applyConstraints()))}function A(p){var _,R={tracker:p.eventSource,position:p.position,shift:p.shift,originalEvent:p.originalEvent,preventDefaultAction:!1};this.raiseEvent("canvas-double-click",R),!R.preventDefaultAction&&this.viewport&&(_=this.gestureSettingsByDeviceType(p.pointerType),_.dblClickToZoom&&(this.viewport.zoomBy(p.shift?1/this.zoomPerClick:this.zoomPerClick,_.zoomToRefPoint?this.viewport.pointFromPixel(p.position,!0):null),this.viewport.applyConstraints()))}function C(p){var _,R={tracker:p.eventSource,pointerType:p.pointerType,position:p.position,delta:p.delta,speed:p.speed,direction:p.direction,shift:p.shift,originalEvent:p.originalEvent,preventDefaultAction:!1};if(this.raiseEvent("canvas-drag",R),_=this.gestureSettingsByDeviceType(p.pointerType),_.dragToPan&&!R.preventDefaultAction&&this.viewport){if(this.panHorizontal||(p.delta.x=0),this.panVertical||(p.delta.y=0),this.viewport.flipped&&(p.delta.x=-p.delta.x),this.constrainDuringPan){var N=this.viewport.deltaPointsFromPixels(p.delta.negate());this.viewport.centerSpringX.target.value+=N.x,this.viewport.centerSpringY.target.value+=N.y;var L=this.viewport.getBounds(),J=this.viewport.getConstrainedBounds();this.viewport.centerSpringX.target.value-=N.x,this.viewport.centerSpringY.target.value-=N.y,L.x!==J.x&&(p.delta.x=0),L.y!==J.y&&(p.delta.y=0)}this.viewport.panBy(this.viewport.deltaPointsFromPixels(p.delta.negate()),_.flickEnabled&&!this.constrainDuringPan)}}function O(p){var _={tracker:p.eventSource,pointerType:p.pointerType,position:p.position,speed:p.speed,direction:p.direction,shift:p.shift,originalEvent:p.originalEvent,preventDefaultAction:!1};if(this.raiseEvent("canvas-drag-end",_),!_.preventDefaultAction&&this.viewport){var R=this.gestureSettingsByDeviceType(p.pointerType);if(R.flickEnabled&&p.speed>=R.flickMinSpeed){var N=0;this.panHorizontal&&(N=R.flickMomentum*p.speed*Math.cos(p.direction));var L=0;this.panVertical&&(L=R.flickMomentum*p.speed*Math.sin(p.direction));var J=this.viewport.pixelFromPoint(this.viewport.getCenter(!0)),q=this.viewport.pointFromPixel(new e.Point(J.x-N,J.y-L));this.viewport.panTo(q,!1)}this.viewport.applyConstraints()}}function D(p){this.raiseEvent("canvas-enter",{tracker:p.eventSource,pointerType:p.pointerType,position:p.position,buttons:p.buttons,pointers:p.pointers,insideElementPressed:p.insideElementPressed,buttonDownAny:p.buttonDownAny,originalEvent:p.originalEvent})}function I(p){this.raiseEvent("canvas-exit",{tracker:p.eventSource,pointerType:p.pointerType,position:p.position,buttons:p.buttons,pointers:p.pointers,insideElementPressed:p.insideElementPressed,buttonDownAny:p.buttonDownAny,originalEvent:p.originalEvent})}function B(p){this.raiseEvent("canvas-press",{tracker:p.eventSource,pointerType:p.pointerType,position:p.position,insideElementPressed:p.insideElementPressed,insideElementReleased:p.insideElementReleased,originalEvent:p.originalEvent})}function Z(p){this.raiseEvent("canvas-release",{tracker:p.eventSource,pointerType:p.pointerType,position:p.position,insideElementPressed:p.insideElementPressed,insideElementReleased:p.insideElementReleased,originalEvent:p.originalEvent})}function Y(p){this.raiseEvent("canvas-nonprimary-press",{tracker:p.eventSource,position:p.position,pointerType:p.pointerType,button:p.button,buttons:p.buttons,originalEvent:p.originalEvent})}function V(p){this.raiseEvent("canvas-nonprimary-release",{tracker:p.eventSource,position:p.position,pointerType:p.pointerType,button:p.button,buttons:p.buttons,originalEvent:p.originalEvent})}function K(p){var _,R,N,L,J={tracker:p.eventSource,pointerType:p.pointerType,gesturePoints:p.gesturePoints,lastCenter:p.lastCenter,center:p.center,lastDistance:p.lastDistance,distance:p.distance,shift:p.shift,originalEvent:p.originalEvent,preventDefaultPanAction:!1,preventDefaultZoomAction:!1,preventDefaultRotateAction:!1};if(this.raiseEvent("canvas-pinch",J),this.viewport&&(_=this.gestureSettingsByDeviceType(p.pointerType),_.pinchToZoom&&(!J.preventDefaultPanAction||!J.preventDefaultZoomAction)&&(R=this.viewport.pointFromPixel(p.center,!0),J.preventDefaultZoomAction||this.viewport.zoomBy(p.distance/p.lastDistance,R,!0),_.zoomToRefPoint&&!J.preventDefaultPanAction&&(N=this.viewport.pointFromPixel(p.lastCenter,!0),L=N.minus(R),this.panHorizontal||(L.x=0),this.panVertical||(L.y=0),this.viewport.panBy(L,!0)),this.viewport.applyConstraints()),_.pinchRotate&&!J.preventDefaultRotateAction)){var q=Math.atan2(p.gesturePoints[0].currentPos.y-p.gesturePoints[1].currentPos.y,p.gesturePoints[0].currentPos.x-p.gesturePoints[1].currentPos.x),fe=Math.atan2(p.gesturePoints[0].lastPos.y-p.gesturePoints[1].lastPos.y,p.gesturePoints[0].lastPos.x-p.gesturePoints[1].lastPos.x);this.viewport.setRotation(this.viewport.getRotation()+(q-fe)*(180/Math.PI))}}function Q(p){var _,R,N,L,J;L=e.now(),J=L-this._lastScrollTime,J>this.minScrollDeltaTime?(this._lastScrollTime=L,_={tracker:p.eventSource,position:p.position,scroll:p.scroll,shift:p.shift,originalEvent:p.originalEvent,preventDefaultAction:!1,preventDefault:!0},this.raiseEvent("canvas-scroll",_),!_.preventDefaultAction&&this.viewport&&(this.viewport.flipped&&(p.position.x=this.viewport.getContainerSize().x-p.position.x),R=this.gestureSettingsByDeviceType(p.pointerType),R.scrollToZoom&&(N=Math.pow(this.zoomPerScroll,p.scroll),this.viewport.zoomBy(N,R.zoomToRefPoint?this.viewport.pointFromPixel(p.position,!0):null),this.viewport.applyConstraints())),p.preventDefault=_.preventDefault):p.preventDefault=!0}function le(p){n[this.hash].mouseInside=!0,g(this),this.raiseEvent("container-enter",{tracker:p.eventSource,pointerType:p.pointerType,position:p.position,buttons:p.buttons,pointers:p.pointers,insideElementPressed:p.insideElementPressed,buttonDownAny:p.buttonDownAny,originalEvent:p.originalEvent})}function re(p){p.pointers<1&&(n[this.hash].mouseInside=!1,n[this.hash].animating||h(this)),this.raiseEvent("container-exit",{tracker:p.eventSource,pointerType:p.pointerType,position:p.position,buttons:p.buttons,pointers:p.pointers,insideElementPressed:p.insideElementPressed,buttonDownAny:p.buttonDownAny,originalEvent:p.originalEvent})}function se(p){de(p),p.isOpen()?p._updateRequestId=u(p,se):p._updateRequestId=!1}function de(p){if(!(p._opening||!n[p.hash])){if(p.autoResize){var _=o(p.container),R=n[p.hash].prevContainerSize;if(!_.equals(R)){var N=p.viewport;if(p.preserveImageSizeOnResize){var L=R.x/_.x,J=N.getZoom()*L,q=N.getCenter();N.resize(_,!1),N.zoomTo(J,null,!0),N.panTo(q,!0)}else{var fe=N.getBounds();N.resize(_,!0),N.fitBoundsWithConstraints(fe,!0)}n[p.hash].prevContainerSize=_,n[p.hash].forceRedraw=!0}}var Se=p.viewport.update(),ge=p.world.update()||Se;Se&&p.raiseEvent("viewport-change"),p.referenceStrip&&(ge=p.referenceStrip.update(p.viewport)||ge),!n[p.hash].animating&&ge&&(p.raiseEvent("animation-start"),g(p)),(ge||n[p.hash].forceRedraw||p.world.needsDraw())&&(pe(p),p._drawOverlays(),p.navigator&&p.navigator.update(p.viewport),n[p.hash].forceRedraw=!1,ge&&p.raiseEvent("animation")),n[p.hash].animating&&!ge&&(p.raiseEvent("animation-finish"),n[p.hash].mouseInside||h(p)),n[p.hash].animating=ge}}function pe(p){p.imageLoader.clear(),p.drawer.clear(),p.world.draw(),p.raiseEvent("update-viewport",{})}function G(p,_){return p?p+_:_}function Me(){n[this.hash].lastZoomTime=e.now(),n[this.hash].zoomFactor=this.zoomPerSecond,n[this.hash].zooming=!0,U(this)}function F(){n[this.hash].lastZoomTime=e.now(),n[this.hash].zoomFactor=1/this.zoomPerSecond,n[this.hash].zooming=!0,U(this)}function H(){n[this.hash].zooming=!1}function U(p){e.requestAnimationFrame(e.delegate(p,W))}function W(){var p,_,R;n[this.hash].zooming&&this.viewport&&(p=e.now(),_=p-n[this.hash].lastZoomTime,R=Math.pow(n[this.hash].zoomFactor,_/1e3),this.viewport.zoomBy(R),this.viewport.applyConstraints(),n[this.hash].lastZoomTime=p,U(this))}function j(){this.viewport&&(n[this.hash].zooming=!1,this.viewport.zoomBy(this.zoomPerClick/1),this.viewport.applyConstraints())}function $(){this.viewport&&(n[this.hash].zooming=!1,this.viewport.zoomBy(1/this.zoomPerClick),this.viewport.applyConstraints())}function ae(){this.buttonGroup&&(this.buttonGroup.emulateEnter(),this.buttonGroup.emulateLeave())}function we(){this.viewport&&this.viewport.goHome()}function me(){this.isFullPage()&&!e.isFullScreen()?this.setFullPage(!1):this.setFullScreen(!this.isFullPage()),this.buttonGroup&&this.buttonGroup.emulateLeave(),this.fullPageButton.element.focus(),this.viewport&&this.viewport.applyConstraints()}function Qe(){if(this.viewport){var p=this.viewport.getRotation();this.viewport.flipped?p=e.positiveModulo(p+this.rotationIncrement,360):p=e.positiveModulo(p-this.rotationIncrement,360),this.viewport.setRotation(p)}}function $e(){if(this.viewport){var p=this.viewport.getRotation();this.viewport.flipped?p=e.positiveModulo(p-this.rotationIncrement,360):p=e.positiveModulo(p+this.rotationIncrement,360),this.viewport.setRotation(p)}}function et(){this.viewport.toggleFlip()}}(t),function(e){e.Navigator=function(u){var c=u.viewer,h=this,d,g;u.id?(this.element=document.getElementById(u.id),u.controlOptions={anchor:e.ControlAnchor.NONE,attachToViewer:!1,autoFade:!1}):(u.id="navigator-"+e.now(),this.element=e.makeNeutralElement("div"),u.controlOptions={anchor:e.ControlAnchor.TOP_RIGHT,attachToViewer:!0,autoFade:u.autoFade},u.position&&(u.position==="BOTTOM_RIGHT"?u.controlOptions.anchor=e.ControlAnchor.BOTTOM_RIGHT:u.position==="BOTTOM_LEFT"?u.controlOptions.anchor=e.ControlAnchor.BOTTOM_LEFT:u.position==="TOP_RIGHT"?u.controlOptions.anchor=e.ControlAnchor.TOP_RIGHT:u.position==="TOP_LEFT"?u.controlOptions.anchor=e.ControlAnchor.TOP_LEFT:u.position==="ABSOLUTE"&&(u.controlOptions.anchor=e.ControlAnchor.ABSOLUTE,u.controlOptions.top=u.top,u.controlOptions.left=u.left,u.controlOptions.height=u.height,u.controlOptions.width=u.width))),this.element.id=u.id,this.element.className+=" navigator",u=e.extend(!0,{sizeRatio:e.DEFAULT_SETTINGS.navigatorSizeRatio},u,{element:this.element,tabIndex:-1,showNavigator:!1,mouseNavEnabled:!1,showNavigationControl:!1,showSequenceControl:!1,immediateRender:!0,blendTime:0,animationTime:0,autoResize:u.autoResize,minZoomImageRatio:1,background:u.background,opacity:u.opacity,borderColor:u.borderColor,displayRegionColor:u.displayRegionColor}),u.minPixelRatio=this.minPixelRatio=c.minPixelRatio,e.setElementTouchActionNone(this.element),this.borderWidth=2,this.fudge=new e.Point(1,1),this.totalBorderWidths=new e.Point(this.borderWidth*2,this.borderWidth*2).minus(this.fudge),u.controlOptions.anchor!==e.ControlAnchor.NONE&&function(b,T){b.margin="0px",b.border=T+"px solid "+u.borderColor,b.padding="0px",b.background=u.background,b.opacity=u.opacity,b.overflow="hidden"}(this.element.style,this.borderWidth),this.displayRegion=e.makeNeutralElement("div"),this.displayRegion.id=this.element.id+"-displayregion",this.displayRegion.className="displayregion",function(b,T){b.position="relative",b.top="0px",b.left="0px",b.fontSize="0px",b.overflow="hidden",b.border=T+"px solid "+u.displayRegionColor,b.margin="0px",b.padding="0px",b.background="transparent",b.float="left",b.cssFloat="left",b.styleFloat="left",b.zIndex=999999999,b.cursor="default"}(this.displayRegion.style,this.borderWidth),e.setElementPointerEventsNone(this.displayRegion),e.setElementTouchActionNone(this.displayRegion),this.displayRegionContainer=e.makeNeutralElement("div"),this.displayRegionContainer.id=this.element.id+"-displayregioncontainer",this.displayRegionContainer.className="displayregioncontainer",this.displayRegionContainer.style.width="100%",this.displayRegionContainer.style.height="100%",e.setElementPointerEventsNone(this.displayRegionContainer),e.setElementTouchActionNone(this.displayRegionContainer),c.addControl(this.element,u.controlOptions),this._resizeWithViewer=u.controlOptions.anchor!==e.ControlAnchor.ABSOLUTE&&u.controlOptions.anchor!==e.ControlAnchor.NONE,u.width&&u.height?(this.setWidth(u.width),this.setHeight(u.height)):this._resizeWithViewer&&(d=e.getElementSize(c.element),this.element.style.height=Math.round(d.y*u.sizeRatio)+"px",this.element.style.width=Math.round(d.x*u.sizeRatio)+"px",this.oldViewerSize=d,g=e.getElementSize(this.element),this.elementArea=g.x*g.y),this.oldContainerSize=new e.Point(0,0),e.Viewer.apply(this,[u]),this.displayRegionContainer.appendChild(this.displayRegion),this.element.getElementsByTagName("div")[0].appendChild(this.displayRegionContainer);function y(b){a(h.displayRegionContainer,b),a(h.displayRegion,-b),h.viewport.setRotation(b)}if(u.navigatorRotate){var x=u.viewer.viewport?u.viewer.viewport.getRotation():u.viewer.degrees||0;y(x),u.viewer.addHandler("rotate",function(b){y(b.degrees)})}this.innerTracker.destroy(),this.innerTracker=new e.MouseTracker({userData:"Navigator.innerTracker",element:this.element,dragHandler:e.delegate(this,r),clickHandler:e.delegate(this,n),releaseHandler:e.delegate(this,o),scrollHandler:e.delegate(this,s),preProcessEventHandler:function(b){b.eventType==="wheel"&&(b.preventDefault=!0)}}),this.outerTracker.userData="Navigator.outerTracker",e.setElementPointerEventsNone(this.canvas),e.setElementPointerEventsNone(this.container),this.addHandler("reset-size",function(){h.viewport&&h.viewport.goHome(!0)}),c.world.addHandler("item-index-change",function(b){window.setTimeout(function(){var T=h.world.getItemAt(b.previousIndex);h.world.setItemIndex(T,b.newIndex)},1)}),c.world.addHandler("remove-item",function(b){var T=b.item,f=h._getMatchingItem(T);f&&h.world.removeItem(f)}),this.update(c.viewport)},e.extend(e.Navigator.prototype,e.EventSource.prototype,e.Viewer.prototype,{updateSize:function(){if(this.viewport){var u=new e.Point(this.container.clientWidth===0?1:this.container.clientWidth,this.container.clientHeight===0?1:this.container.clientHeight);u.equals(this.oldContainerSize)||(this.viewport.resize(u,!0),this.viewport.goHome(!0),this.oldContainerSize=u,this.drawer.clear(),this.world.draw())}},setWidth:function(u){this.width=u,this.element.style.width=typeof u=="number"?u+"px":u,this._resizeWithViewer=!1},setHeight:function(u){this.height=u,this.element.style.height=typeof u=="number"?u+"px":u,this._resizeWithViewer=!1},setFlip:function(u){return this.viewport.setFlip(u),this.setDisplayTransform(this.viewer.viewport.getFlip()?"scale(-1,1)":"scale(1,1)"),this},setDisplayTransform:function(u){l(this.displayRegion,u),l(this.canvas,u),l(this.element,u)},update:function(u){var c,h,d,g,y,x;if(c=e.getElementSize(this.viewer.element),this._resizeWithViewer&&c.x&&c.y&&!c.equals(this.oldViewerSize)&&(this.oldViewerSize=c,this.maintainSizeRatio||!this.elementArea?(h=c.x*this.sizeRatio,d=c.y*this.sizeRatio):(h=Math.sqrt(this.elementArea*(c.x/c.y)),d=this.elementArea/h),this.element.style.width=Math.round(h)+"px",this.element.style.height=Math.round(d)+"px",this.elementArea||(this.elementArea=h*d),this.updateSize()),u&&this.viewport){g=u.getBoundsNoRotate(!0),y=this.viewport.pixelFromPointNoRotate(g.getTopLeft(),!1),x=this.viewport.pixelFromPointNoRotate(g.getBottomRight(),!1).minus(this.totalBorderWidths);var b=this.displayRegion.style;b.display=this.world.getItemCount()?"block":"none",b.top=Math.round(y.y)+"px",b.left=Math.round(y.x)+"px";var T=Math.abs(y.x-x.x),f=Math.abs(y.y-x.y);b.width=Math.round(Math.max(T,0))+"px",b.height=Math.round(Math.max(f,0))+"px"}},addTiledImage:function(u){var c=this,h=u.originalTiledImage;delete u.original;var d=e.extend({},u,{success:function(g){var y=g.item;y._originalForNavigator=h,c._matchBounds(y,h,!0),c._matchOpacity(y,h),c._matchCompositeOperation(y,h);function x(){c._matchBounds(y,h)}function b(){c._matchOpacity(y,h)}function T(){c._matchCompositeOperation(y,h)}h.addHandler("bounds-change",x),h.addHandler("clip-change",x),h.addHandler("opacity-change",b),h.addHandler("composite-operation-change",T)}});return e.Viewer.prototype.addTiledImage.apply(this,[d])},destroy:function(){return e.Viewer.prototype.destroy.apply(this)},_getMatchingItem:function(u){for(var c=this.world.getItemCount(),h,d=0;d<c;d++)if(h=this.world.getItemAt(d),h._originalForNavigator===u)return h;return null},_matchBounds:function(u,c,h){var d=c.getBoundsNoRotate();u.setPosition(d.getTopLeft(),h),u.setWidth(d.width,h),u.setRotation(c.getRotation(),h),u.setClip(c.getClip()),u.setFlip(c.getFlip())},_matchOpacity:function(u,c){u.setOpacity(c.opacity)},_matchCompositeOperation:function(u,c){u.setCompositeOperation(c.compositeOperation)}});function n(u){var c={tracker:u.eventSource,position:u.position,quick:u.quick,shift:u.shift,originalEvent:u.originalEvent,preventDefaultAction:!1};if(this.viewer.raiseEvent("navigator-click",c),!c.preventDefaultAction&&u.quick&&this.viewer.viewport&&(this.panVertical||this.panHorizontal)){this.viewer.viewport.flipped&&(u.position.x=this.viewport.getContainerSize().x-u.position.x);var h=this.viewport.pointFromPixel(u.position);this.panVertical?this.panHorizontal||(h.x=this.viewer.viewport.getCenter(!0).x):h.y=this.viewer.viewport.getCenter(!0).y,this.viewer.viewport.panTo(h),this.viewer.viewport.applyConstraints()}}function r(u){var c={tracker:u.eventSource,position:u.position,delta:u.delta,speed:u.speed,direction:u.direction,shift:u.shift,originalEvent:u.originalEvent,preventDefaultAction:!1};this.viewer.raiseEvent("navigator-drag",c),!c.preventDefaultAction&&this.viewer.viewport&&(this.panHorizontal||(u.delta.x=0),this.panVertical||(u.delta.y=0),this.viewer.viewport.flipped&&(u.delta.x=-u.delta.x),this.viewer.viewport.panBy(this.viewport.deltaPointsFromPixels(u.delta)),this.viewer.constrainDuringPan&&this.viewer.viewport.applyConstraints())}function o(u){u.insideElementPressed&&this.viewer.viewport&&this.viewer.viewport.applyConstraints()}function s(u){var c={tracker:u.eventSource,position:u.position,scroll:u.scroll,shift:u.shift,originalEvent:u.originalEvent,preventDefault:u.preventDefault};this.viewer.raiseEvent("navigator-scroll",c),u.preventDefault=c.preventDefault}function a(u,c){l(u,"rotate("+c+"deg)")}function l(u,c){u.style.webkitTransform=c,u.style.mozTransform=c,u.style.msTransform=c,u.style.oTransform=c,u.style.transform=c}}(t),function(e){var n={Errors:{Dzc:"Sorry, we don't support Deep Zoom Collections!",Dzi:"Hmm, this doesn't appear to be a valid Deep Zoom Image.",Xml:"Hmm, this doesn't appear to be a valid Deep Zoom Image.",ImageFormat:"Sorry, we don't support {0}-based Deep Zoom Images.",Security:"It looks like a security restriction stopped us from loading this Deep Zoom Image.",Status:"This space unintentionally left blank ({0} {1}).",OpenFailed:"Unable to open {0}: {1}"},Tooltips:{FullPage:"Toggle full page",Home:"Go home",ZoomIn:"Zoom in",ZoomOut:"Zoom out",NextPage:"Next page",PreviousPage:"Previous page",RotateLeft:"Rotate left",RotateRight:"Rotate right",Flip:"Flip Horizontally"}};e.extend(e,{getString:function(r){var o=r.split("."),s=null,a=arguments,l=n,u;for(u=0;u<o.length-1;u++)l=l[o[u]]||{};return s=l[o[u]],typeof s!="string"&&(e.console.log("Untranslated source string:",r),s=""),s.replace(/\{\d+\}/g,function(c){var h=parseInt(c.match(/\d+/),10)+1;return h<a.length?a[h]:""})},setString:function(r,o){var s=r.split("."),a=n,l;for(l=0;l<s.length-1;l++)a[s[l]]||(a[s[l]]={}),a=a[s[l]];a[s[l]]=o}})}(t),function(e){e.Point=function(n,r){this.x=typeof n=="number"?n:0,this.y=typeof r=="number"?r:0},e.Point.prototype={clone:function(){return new e.Point(this.x,this.y)},plus:function(n){return new e.Point(this.x+n.x,this.y+n.y)},minus:function(n){return new e.Point(this.x-n.x,this.y-n.y)},times:function(n){return new e.Point(this.x*n,this.y*n)},divide:function(n){return new e.Point(this.x/n,this.y/n)},negate:function(){return new e.Point(-this.x,-this.y)},distanceTo:function(n){return Math.sqrt(Math.pow(this.x-n.x,2)+Math.pow(this.y-n.y,2))},squaredDistanceTo:function(n){return Math.pow(this.x-n.x,2)+Math.pow(this.y-n.y,2)},apply:function(n){return new e.Point(n(this.x),n(this.y))},equals:function(n){return n instanceof e.Point&&this.x===n.x&&this.y===n.y},rotate:function(n,r){r=r||new e.Point(0,0);var o,s;if(n%90===0){var a=e.positiveModulo(n,360);switch(a){case 0:o=1,s=0;break;case 90:o=0,s=1;break;case 180:o=-1,s=0;break;case 270:o=0,s=-1;break}}else{var l=n*Math.PI/180;o=Math.cos(l),s=Math.sin(l)}var u=o*(this.x-r.x)-s*(this.y-r.y)+r.x,c=s*(this.x-r.x)+o*(this.y-r.y)+r.y;return new e.Point(u,c)},toString:function(){return"("+Math.round(this.x*100)/100+","+Math.round(this.y*100)/100+")"}}}(t),function(e){e.TileSource=function(r,o,s,a,l,u){var c=this,h=arguments,d,g;if(e.isPlainObject(r)?d=r:d={width:h[0],height:h[1],tileSize:h[2],tileOverlap:h[3],minLevel:h[4],maxLevel:h[5]},e.EventSource.call(this),e.extend(!0,this,d),!this.success){for(g=0;g<arguments.length;g++)if(e.isFunction(arguments[g])){this.success=arguments[g];break}}this.success&&this.addHandler("ready",function(y){c.success(y)}),e.type(arguments[0])==="string"&&(this.url=arguments[0]),this.url?(this.aspectRatio=1,this.dimensions=new e.Point(10,10),this._tileWidth=0,this._tileHeight=0,this.tileOverlap=0,this.minLevel=0,this.maxLevel=0,this.ready=!1,this.getImageInfo(this.url)):(this.ready=!0,this.aspectRatio=d.width&&d.height?d.width/d.height:1,this.dimensions=new e.Point(d.width,d.height),this.tileSize?(this._tileWidth=this._tileHeight=this.tileSize,delete this.tileSize):(this.tileWidth?(this._tileWidth=this.tileWidth,delete this.tileWidth):this._tileWidth=0,this.tileHeight?(this._tileHeight=this.tileHeight,delete this.tileHeight):this._tileHeight=0),this.tileOverlap=d.tileOverlap?d.tileOverlap:0,this.minLevel=d.minLevel?d.minLevel:0,this.maxLevel=d.maxLevel!==void 0&&d.maxLevel!==null?d.maxLevel:d.width&&d.height?Math.ceil(Math.log(Math.max(d.width,d.height))/Math.log(2)):0,this.success&&e.isFunction(this.success)&&this.success(this))},e.TileSource.prototype={getTileSize:function(r){return e.console.error("[TileSource.getTileSize] is deprecated. Use TileSource.getTileWidth() and TileSource.getTileHeight() instead"),this._tileWidth},getTileWidth:function(r){return this._tileWidth?this._tileWidth:this.getTileSize(r)},getTileHeight:function(r){return this._tileHeight?this._tileHeight:this.getTileSize(r)},setMaxLevel:function(r){this.maxLevel=r,this._memoizeLevelScale()},getLevelScale:function(r){return this._memoizeLevelScale(),this.getLevelScale(r)},_memoizeLevelScale:function(){var r={},o;for(o=0;o<=this.maxLevel;o++)r[o]=1/Math.pow(2,this.maxLevel-o);this.getLevelScale=function(s){return r[s]}},getNumTiles:function(r){var o=this.getLevelScale(r),s=Math.ceil(o*this.dimensions.x/this.getTileWidth(r)),a=Math.ceil(o*this.dimensions.y/this.getTileHeight(r));return new e.Point(s,a)},getPixelRatio:function(r){var o=this.dimensions.times(this.getLevelScale(r)),s=1/o.x*e.pixelDensityRatio,a=1/o.y*e.pixelDensityRatio;return new e.Point(s,a)},getClosestLevel:function(){var r,o;for(r=this.minLevel+1;r<=this.maxLevel&&(o=this.getNumTiles(r),!(o.x>1||o.y>1));r++);return r-1},getTileAtPoint:function(r,o){var s=o.x>=0&&o.x<=1&&o.y>=0&&o.y<=1/this.aspectRatio;e.console.assert(s,"[TileSource.getTileAtPoint] must be called with a valid point.");var a=this.dimensions.x*this.getLevelScale(r),l=o.x*a,u=o.y*a,c=Math.floor(l/this.getTileWidth(r)),h=Math.floor(u/this.getTileHeight(r));o.x>=1&&(c=this.getNumTiles(r).x-1);var d=1e-15;return o.y>=1/this.aspectRatio-d&&(h=this.getNumTiles(r).y-1),new e.Point(c,h)},getTileBounds:function(r,o,s,a){var l=this.dimensions.times(this.getLevelScale(r)),u=this.getTileWidth(r),c=this.getTileHeight(r),h=o===0?0:u*o-this.tileOverlap,d=s===0?0:c*s-this.tileOverlap,g=u+(o===0?1:2)*this.tileOverlap,y=c+(s===0?1:2)*this.tileOverlap,x=1/l.x;return g=Math.min(g,l.x-h),y=Math.min(y,l.y-d),a?new e.Rect(0,0,g,y):new e.Rect(h*x,d*x,g*x,y*x)},getImageInfo:function(r){var o=this,s,a,l,u,c,h,d;r&&(c=r.split("/"),h=c[c.length-1],d=h.lastIndexOf("."),d>-1&&(c[c.length-1]=h.slice(0,d))),a=function(g){typeof g=="string"&&(g=e.parseXml(g));var y=e.TileSource.determineType(o,g,r);if(!y){o.raiseEvent("open-failed",{message:"Unable to load TileSource",source:r});return}u=y.prototype.configure.apply(o,[g,r]),u.ajaxWithCredentials===void 0&&(u.ajaxWithCredentials=o.ajaxWithCredentials),l=new y(u),o.ready=!0,o.raiseEvent("ready",{tileSource:l})},r.match(/\.js$/)?(s=r.split("/").pop().replace(".js",""),e.jsonp({url:r,async:!1,callbackName:s,callback:a})):e.makeAjaxRequest({url:r,withCredentials:this.ajaxWithCredentials,headers:this.ajaxHeaders,success:function(g){var y=n(g);a(y)},error:function(g,y){var x;try{x="HTTP "+g.status+" attempting to load TileSource"}catch{var b;typeof y=="undefined"||!y.toString?b="Unknown error":b=y.toString(),x=b+" attempting to load TileSource"}o.raiseEvent("open-failed",{message:x,source:r})}})},supports:function(r,o){return!1},configure:function(r,o){throw new Error("Method not implemented.")},getTileUrl:function(r,o,s){throw new Error("Method not implemented.")},getTileAjaxHeaders:function(r,o,s){return{}},tileExists:function(r,o,s){var a=this.getNumTiles(r);return r>=this.minLevel&&r<=this.maxLevel&&o>=0&&s>=0&&o<a.x&&s<a.y}},e.extend(!0,e.TileSource.prototype,e.EventSource.prototype);function n(r){var o=r.responseText,s=r.status,a,l;if(r){if(r.status!==200&&r.status!==0)throw s=r.status,a=s===404?"Not Found":r.statusText,new Error(e.getString("Errors.Status",s,a))}else throw new Error(e.getString("Errors.Security"));if(o.match(/\s*<.*/))try{l=r.responseXML&&r.responseXML.documentElement?r.responseXML:e.parseXml(o)}catch{l=r.responseText}else if(o.match(/\s*[{[].*/))try{l=e.parseJSON(o)}catch{l=o}else l=o;return l}e.TileSource.determineType=function(r,o,s){var a;for(a in t)if(a.match(/.+TileSource$/)&&e.isFunction(t[a])&&e.isFunction(t[a].prototype.supports)&&t[a].prototype.supports.call(r,o,s))return t[a];return e.console.error("No TileSource was able to open %s %s",s,o),null}}(t),function(e){e.DziTileSource=function(o,s,a,l,u,c,h,d,g){var y,x,b,T;if(e.isPlainObject(o)?T=o:T={width:arguments[0],height:arguments[1],tileSize:arguments[2],tileOverlap:arguments[3],tilesUrl:arguments[4],fileFormat:arguments[5],displayRects:arguments[6],minLevel:arguments[7],maxLevel:arguments[8]},this._levelRects={},this.tilesUrl=T.tilesUrl,this.fileFormat=T.fileFormat,this.displayRects=T.displayRects,this.displayRects)for(y=this.displayRects.length-1;y>=0;y--)for(x=this.displayRects[y],b=x.minLevel;b<=x.maxLevel;b++)this._levelRects[b]||(this._levelRects[b]=[]),this._levelRects[b].push(x);e.TileSource.apply(this,[T])},e.extend(e.DziTileSource.prototype,e.TileSource.prototype,{supports:function(o,s){var a;return o.Image?a=o.Image.xmlns:o.documentElement&&(o.documentElement.localName==="Image"||o.documentElement.tagName==="Image")&&(a=o.documentElement.namespaceURI),a=(a||"").toLowerCase(),a.indexOf("schemas.microsoft.com/deepzoom/2008")!==-1||a.indexOf("schemas.microsoft.com/deepzoom/2009")!==-1},configure:function(o,s){var a;return e.isPlainObject(o)?a=r(this,o):a=n(this,o),s&&!a.tilesUrl&&(a.tilesUrl=s.replace(/([^/]+?)(\.(dzi|xml|js)?(\?[^/]*)?)?\/?$/,"$1_files/"),s.search(/\.(dzi|xml|js)\?/)!==-1?a.queryParams=s.match(/\?.*/):a.queryParams=""),a},getTileUrl:function(o,s,a){return[this.tilesUrl,o,"/",s,"_",a,".",this.fileFormat,this.queryParams].join("")},tileExists:function(o,s,a){var l=this._levelRects[o],u,c,h,d,g,y,x;if(this.minLevel&&o<this.minLevel||this.maxLevel&&o>this.maxLevel)return!1;if(!l||!l.length)return!0;for(x=l.length-1;x>=0;x--)if(u=l[x],!(o<u.minLevel||o>u.maxLevel)&&(c=this.getLevelScale(o),h=u.x*c,d=u.y*c,g=h+u.width*c,y=d+u.height*c,h=Math.floor(h/this._tileWidth),d=Math.floor(d/this._tileWidth),g=Math.ceil(g/this._tileWidth),y=Math.ceil(y/this._tileWidth),h<=s&&s<g&&d<=a&&a<y))return!0;return!1}});function n(o,s){if(!s||!s.documentElement)throw new Error(e.getString("Errors.Xml"));var a=s.documentElement,l=a.localName||a.tagName,u=s.documentElement.namespaceURI,c=null,h=[],d,g,y,x,b;if(l==="Image")try{if(x=a.getElementsByTagName("Size")[0],x===void 0&&(x=a.getElementsByTagNameNS(u,"Size")[0]),c={Image:{xmlns:"http://schemas.microsoft.com/deepzoom/2008",Url:a.getAttribute("Url"),Format:a.getAttribute("Format"),DisplayRect:null,Overlap:parseInt(a.getAttribute("Overlap"),10),TileSize:parseInt(a.getAttribute("TileSize"),10),Size:{Height:parseInt(x.getAttribute("Height"),10),Width:parseInt(x.getAttribute("Width"),10)}}},!e.imageFormatSupported(c.Image.Format))throw new Error(e.getString("Errors.ImageFormat",c.Image.Format.toUpperCase()));for(d=a.getElementsByTagName("DisplayRect"),d===void 0&&(d=a.getElementsByTagNameNS(u,"DisplayRect")[0]),b=0;b<d.length;b++)g=d[b],y=g.getElementsByTagName("Rect")[0],y===void 0&&(y=g.getElementsByTagNameNS(u,"Rect")[0]),h.push({Rect:{X:parseInt(y.getAttribute("X"),10),Y:parseInt(y.getAttribute("Y"),10),Width:parseInt(y.getAttribute("Width"),10),Height:parseInt(y.getAttribute("Height"),10),MinLevel:parseInt(g.getAttribute("MinLevel"),10),MaxLevel:parseInt(g.getAttribute("MaxLevel"),10)}});return h.length&&(c.Image.DisplayRect=h),r(o,c)}catch(E){throw E instanceof Error?E:new Error(e.getString("Errors.Dzi"))}else{if(l==="Collection")throw new Error(e.getString("Errors.Dzc"));if(l==="Error"){var T=a.getElementsByTagName("Message")[0],f=T.firstChild.nodeValue;throw new Error(f)}}throw new Error(e.getString("Errors.Dzi"))}function r(o,s){var a=s.Image,l=a.Url,u=a.Format,c=a.Size,h=a.DisplayRect||[],d=parseInt(c.Width,10),g=parseInt(c.Height,10),y=parseInt(a.TileSize,10),x=parseInt(a.Overlap,10),b=[],T,f;for(f=0;f<h.length;f++)T=h[f].Rect,b.push(new e.DisplayRect(parseInt(T.X,10),parseInt(T.Y,10),parseInt(T.Width,10),parseInt(T.Height,10),parseInt(T.MinLevel,10),parseInt(T.MaxLevel,10)));return e.extend(!0,{width:d,height:g,tileSize:y,tileOverlap:x,minLevel:null,maxLevel:null,tilesUrl:l,fileFormat:u,displayRects:b},s)}}(t),function(e){e.IIIFTileSource=function(a){if(e.extend(!0,this,a),!(this.height&&this.width&&this["@id"]))throw new Error("IIIF required parameters not provided.");if(a.tileSizePerScaleFactor={},this.tileFormat=this.tileFormat||"jpg",this.version=a.version,this.tile_width&&this.tile_height)a.tileWidth=this.tile_width,a.tileHeight=this.tile_height;else if(this.tile_width)a.tileSize=this.tile_width;else if(this.tile_height)a.tileSize=this.tile_height;else if(this.tiles)if(this.tiles.length===1)a.tileWidth=this.tiles[0].width,a.tileHeight=this.tiles[0].height||this.tiles[0].width,this.scale_factors=this.tiles[0].scaleFactors;else{this.scale_factors=[];for(var l=0;l<this.tiles.length;l++)for(var u=0;u<this.tiles[l].scaleFactors.length;u++){var c=this.tiles[l].scaleFactors[u];this.scale_factors.push(c),a.tileSizePerScaleFactor[c]={width:this.tiles[l].width,height:this.tiles[l].height||this.tiles[l].width}}}else if(n(a)){for(var h=Math.min(this.height,this.width),d=[256,512,1024],g=[],y=0;y<d.length;y++)d[y]<=h&&g.push(d[y]);g.length>0?a.tileSize=Math.max.apply(null,g):a.tileSize=h}else this.sizes&&this.sizes.length>0?(this.emulateLegacyImagePyramid=!0,a.levels=r(this),e.extend(!0,a,{width:a.levels[a.levels.length-1].width,height:a.levels[a.levels.length-1].height,tileSize:Math.max(a.height,a.width),tileOverlap:0,minLevel:0,maxLevel:a.levels.length-1}),this.levels=a.levels):e.console.error("Nothing in the info.json to construct image pyramids from");if(!a.maxLevel&&!this.emulateLegacyImagePyramid)if(!this.scale_factors)a.maxLevel=Number(Math.ceil(Math.log(Math.max(this.width,this.height),2)));else{var x=Math.max.apply(null,this.scale_factors);a.maxLevel=Math.round(Math.log(x)*Math.LOG2E)}e.TileSource.apply(this,[a])},e.extend(e.IIIFTileSource.prototype,e.TileSource.prototype,{supports:function(a,l){return a.protocol&&a.protocol==="http://iiif.io/api/image"||a["@context"]&&(a["@context"]==="http://library.stanford.edu/iiif/image-api/1.1/context.json"||a["@context"]==="http://iiif.io/api/image/1/context.json")||a.profile&&a.profile.indexOf("http://library.stanford.edu/iiif/image-api/compliance.html")===0||a.identifier&&a.width&&a.height?!0:!!(a.documentElement&&a.documentElement.tagName==="info"&&a.documentElement.namespaceURI==="http://library.stanford.edu/iiif/image-api/ns/")},configure:function(a,l){if(e.isPlainObject(a)){if(!a["@context"])a["@context"]="http://iiif.io/api/image/1.0/context.json",a["@id"]=l.replace("/info.json",""),a.version=1;else{var c=a["@context"];if(Array.isArray(c)){for(var h=0;h<c.length;h++)if(typeof c[h]=="string"&&(/^http:\/\/iiif\.io\/api\/image\/[1-3]\/context\.json$/.test(c[h])||c[h]==="http://library.stanford.edu/iiif/image-api/1.1/context.json")){c=c[h];break}}switch(c){case"http://iiif.io/api/image/1/context.json":case"http://library.stanford.edu/iiif/image-api/1.1/context.json":a.version=1;break;case"http://iiif.io/api/image/2/context.json":a.version=2;break;case"http://iiif.io/api/image/3/context.json":a.version=3;break;default:e.console.error("Data has a @context property which contains no known IIIF context URI.")}}if(!a["@id"]&&a.id&&(a["@id"]=a.id),a.preferredFormats){for(var d=0;d<a.preferredFormats.length;d++)if(t.imageFormatSupported(a.preferredFormats[d])){a.tileFormat=a.preferredFormats[d];break}}return a}else{var u=o(a);return u["@context"]="http://iiif.io/api/image/1.0/context.json",u["@id"]=l.replace("/info.xml",""),u.version=1,u}},getTileWidth:function(a){if(this.emulateLegacyImagePyramid)return e.TileSource.prototype.getTileWidth.call(this,a);var l=Math.pow(2,this.maxLevel-a);return this.tileSizePerScaleFactor&&this.tileSizePerScaleFactor[l]?this.tileSizePerScaleFactor[l].width:this._tileWidth},getTileHeight:function(a){if(this.emulateLegacyImagePyramid)return e.TileSource.prototype.getTileHeight.call(this,a);var l=Math.pow(2,this.maxLevel-a);return this.tileSizePerScaleFactor&&this.tileSizePerScaleFactor[l]?this.tileSizePerScaleFactor[l].height:this._tileHeight},getLevelScale:function(a){if(this.emulateLegacyImagePyramid){var l=NaN;return this.levels.length>0&&a>=this.minLevel&&a<=this.maxLevel&&(l=this.levels[a].width/this.levels[this.maxLevel].width),l}return e.TileSource.prototype.getLevelScale.call(this,a)},getNumTiles:function(a){if(this.emulateLegacyImagePyramid){var l=this.getLevelScale(a);return l?new e.Point(1,1):new e.Point(0,0)}return e.TileSource.prototype.getNumTiles.call(this,a)},getTileAtPoint:function(a,l){return this.emulateLegacyImagePyramid?new e.Point(0,0):e.TileSource.prototype.getTileAtPoint.call(this,a,l)},getTileUrl:function(a,l,u){if(this.emulateLegacyImagePyramid){var c=null;return this.levels.length>0&&a>=this.minLevel&&a<=this.maxLevel&&(c=this.levels[a].url),c}var h="0",d=Math.pow(.5,this.maxLevel-a),g=Math.ceil(this.width*d),y=Math.ceil(this.height*d),x,b,T,f,E,A,C,O,D,I,B,Z,Y,V;return x=this.getTileWidth(a),b=this.getTileHeight(a),T=Math.ceil(x/d),f=Math.ceil(b/d),this.version===1?Y="native."+this.tileFormat:Y="default."+this.tileFormat,g<x&&y<b?(this.version===2&&g===this.width?I="full":this.version===3&&g===this.width&&y===this.height?I="max":this.version===3?I=g+","+y:I=g+",",E="full"):(A=l*T,C=u*f,O=Math.min(T,this.width-A),D=Math.min(f,this.height-C),l===0&&u===0&&O===this.width&&D===this.height?E="full":E=[A,C,O,D].join(","),B=Math.ceil(O*d),Z=Math.ceil(D*d),this.version===2&&B===this.width?I="full":this.version===3&&B===this.width&&Z===this.height?I="max":this.version===3?I=B+","+Z:I=B+","),V=[this["@id"],E,I,h,Y].join("/"),V},__testonly__:{canBeTiled:n,constructLevels:r}});function n(a){var l=["http://library.stanford.edu/iiif/image-api/compliance.html#level0","http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level0","http://iiif.io/api/image/2/level0.json","level0","https://iiif.io/api/image/3/level0.json"],u=Array.isArray(a.profile)?a.profile[0]:a.profile,c=l.indexOf(u)!==-1,h=!1;return a.version===2&&a.profile.length>1&&a.profile[1].supports&&(h=a.profile[1].supports.indexOf("sizeByW")!==-1),a.version===3&&a.extraFeatures&&(h=a.extraFeatures.indexOf("sizeByWh")!==-1),!c||h}function r(a){for(var l=[],u=0;u<a.sizes.length;u++)l.push({url:a["@id"]+"/full/"+a.sizes[u].width+","+(a.version===3?a.sizes[u].height:"")+"/0/default."+a.tileFormat,width:a.sizes[u].width,height:a.sizes[u].height});return l.sort(function(c,h){return c.width-h.width})}function o(a){if(!a||!a.documentElement)throw new Error(e.getString("Errors.Xml"));var l=a.documentElement,u=l.tagName,c=null;if(u==="info")try{return c={},s(l,c),c}catch(h){throw h instanceof Error?h:new Error(e.getString("Errors.IIIF"))}throw new Error(e.getString("Errors.IIIF"))}function s(a,l,u){var c,h;if(a.nodeType===3&&u)h=a.nodeValue.trim(),h.match(/^\d*$/)&&(h=Number(h)),l[u]?(e.isArray(l[u])||(l[u]=[l[u]]),l[u].push(h)):l[u]=h;else if(a.nodeType===1)for(c=0;c<a.childNodes.length;c++)s(a.childNodes[c],l,a.nodeName)}}(t),function(e){e.OsmTileSource=function(n,r,o,s,a){var l;e.isPlainObject(n)?l=n:l={width:arguments[0],height:arguments[1],tileSize:arguments[2],tileOverlap:arguments[3],tilesUrl:arguments[4]},(!l.width||!l.height)&&(l.width=65572864,l.height=65572864),l.tileSize||(l.tileSize=256,l.tileOverlap=0),l.tilesUrl||(l.tilesUrl="http://tile.openstreetmap.org/"),l.minLevel=8,e.TileSource.apply(this,[l])},e.extend(e.OsmTileSource.prototype,e.TileSource.prototype,{supports:function(n,r){return n.type&&n.type==="openstreetmaps"},configure:function(n,r){return n},getTileUrl:function(n,r,o){return this.tilesUrl+(n-8)+"/"+r+"/"+o+".png"}})}(t),function(e){e.TmsTileSource=function(n,r,o,s,a){var l;e.isPlainObject(n)?l=n:l={width:arguments[0],height:arguments[1],tileSize:arguments[2],tileOverlap:arguments[3],tilesUrl:arguments[4]};var u=Math.ceil(l.width/256)*256,c=Math.ceil(l.height/256)*256,h;u>c?h=u/256:h=c/256,l.maxLevel=Math.ceil(Math.log(h)/Math.log(2))-1,l.tileSize=256,l.width=u,l.height=c,e.TileSource.apply(this,[l])},e.extend(e.TmsTileSource.prototype,e.TileSource.prototype,{supports:function(n,r){return n.type&&n.type==="tiledmapservice"},configure:function(n,r){return n},getTileUrl:function(n,r,o){var s=this.getNumTiles(n).y-1;return this.tilesUrl+n+"/"+r+"/"+(s-o)+".png"}})}(t),function(e){e.ZoomifyTileSource=function(n){typeof n.tileSize=="undefined"&&(n.tileSize=256),typeof n.fileFormat=="undefined"&&(n.fileFormat="jpg",this.fileFormat=n.fileFormat);var r={x:n.width,y:n.height};for(n.imageSizes=[{x:n.width,y:n.height}],n.gridSize=[this._getGridSize(n.width,n.height,n.tileSize)];parseInt(r.x,10)>n.tileSize||parseInt(r.y,10)>n.tileSize;)r.x=Math.floor(r.x/2),r.y=Math.floor(r.y/2),n.imageSizes.push({x:r.x,y:r.y}),n.gridSize.push(this._getGridSize(r.x,r.y,n.tileSize));n.imageSizes.reverse(),n.gridSize.reverse(),n.minLevel=0,n.maxLevel=n.gridSize.length-1,t.TileSource.apply(this,[n])},e.extend(e.ZoomifyTileSource.prototype,e.TileSource.prototype,{_getGridSize:function(n,r,o){return{x:Math.ceil(n/o),y:Math.ceil(r/o)}},_calculateAbsoluteTileNumber:function(n,r,o){for(var s=0,a={},l=0;l<n;l++)a=this.gridSize[l],s+=a.x*a.y;return a=this.gridSize[n],s+=a.x*o+r,s},supports:function(n,r){return n.type&&n.type==="zoomifytileservice"},configure:function(n,r){return n},getTileUrl:function(n,r,o){var s=0,a=this._calculateAbsoluteTileNumber(n,r,o);return s=Math.floor(a/256),this.tilesUrl+"TileGroup"+s+"/"+n+"-"+r+"-"+o+"."+this.fileFormat}})}(t),function(e){e.LegacyTileSource=function(s){var a,l,u;e.isArray(s)&&(a={type:"legacy-image-pyramid",levels:s}),a.levels=n(a.levels),a.levels.length>0?(l=a.levels[a.levels.length-1].width,u=a.levels[a.levels.length-1].height):(l=0,u=0,e.console.error("No supported image formats found")),e.extend(!0,a,{width:l,height:u,tileSize:Math.max(u,l),tileOverlap:0,minLevel:0,maxLevel:a.levels.length>0?a.levels.length-1:0}),e.TileSource.apply(this,[a]),this.levels=a.levels},e.extend(e.LegacyTileSource.prototype,e.TileSource.prototype,{supports:function(s,a){return s.type&&s.type==="legacy-image-pyramid"||s.documentElement&&s.documentElement.getAttribute("type")==="legacy-image-pyramid"},configure:function(s,a){var l;return e.isPlainObject(s)?l=o(this,s):l=r(this,s),l},getLevelScale:function(s){var a=NaN;return this.levels.length>0&&s>=this.minLevel&&s<=this.maxLevel&&(a=this.levels[s].width/this.levels[this.maxLevel].width),a},getNumTiles:function(s){var a=this.getLevelScale(s);return a?new e.Point(1,1):new e.Point(0,0)},getTileUrl:function(s,a,l){var u=null;return this.levels.length>0&&s>=this.minLevel&&s<=this.maxLevel&&(u=this.levels[s].url),u}});function n(s){var a=[],l,u;for(u=0;u<s.length;u++)l=s[u],l.height&&l.width&&l.url?a.push({url:l.url,width:Number(l.width),height:Number(l.height)}):e.console.error("Unsupported image format: %s",l.url?l.url:"<no URL>");return a.sort(function(c,h){return c.height-h.height})}function r(s,a){if(!a||!a.documentElement)throw new Error(e.getString("Errors.Xml"));var l=a.documentElement,u=l.tagName,c=null,h=[],d,g;if(u==="image")try{for(c={type:l.getAttribute("type"),levels:[]},h=l.getElementsByTagName("level"),g=0;g<h.length;g++)d=h[g],c.levels.push({url:d.getAttribute("url"),width:parseInt(d.getAttribute("width"),10),height:parseInt(d.getAttribute("height"),10)});return o(s,c)}catch(y){throw y instanceof Error?y:new Error("Unknown error parsing Legacy Image Pyramid XML.")}else{if(u==="collection")throw new Error("Legacy Image Pyramid Collections not yet supported.");if(u==="error")throw new Error("Error: "+a)}throw new Error("Unknown element "+u)}function o(s,a){return a.levels}}(t),function(e){e.ImageTileSource=function(n){n=e.extend({buildPyramid:!0,crossOriginPolicy:!1,ajaxWithCredentials:!1,useCanvas:!0},n),e.TileSource.apply(this,[n])},e.extend(e.ImageTileSource.prototype,e.TileSource.prototype,{supports:function(n,r){return n.type&&n.type==="image"},configure:function(n,r){return n},getImageInfo:function(n){var r=this._image=new Image,o=this;this.crossOriginPolicy&&(r.crossOrigin=this.crossOriginPolicy),this.ajaxWithCredentials&&(r.useCredentials=this.ajaxWithCredentials),e.addEvent(r,"load",function(){o.width=r.naturalWidth,o.height=r.naturalHeight,o.aspectRatio=o.width/o.height,o.dimensions=new e.Point(o.width,o.height),o._tileWidth=o.width,o._tileHeight=o.height,o.tileOverlap=0,o.minLevel=0,o.levels=o._buildLevels(),o.maxLevel=o.levels.length-1,o.ready=!0,o.raiseEvent("ready",{tileSource:o})}),e.addEvent(r,"error",function(){o.raiseEvent("open-failed",{message:"Error loading image at "+n,source:n})}),r.src=n},getLevelScale:function(n){var r=NaN;return n>=this.minLevel&&n<=this.maxLevel&&(r=this.levels[n].width/this.levels[this.maxLevel].width),r},getNumTiles:function(n){var r=this.getLevelScale(n);return r?new e.Point(1,1):new e.Point(0,0)},getTileUrl:function(n,r,o){var s=null;return n>=this.minLevel&&n<=this.maxLevel&&(s=this.levels[n].url),s},getContext2D:function(n,r,o){var s=null;return n>=this.minLevel&&n<=this.maxLevel&&(s=this.levels[n].context2D),s},destroy:function(){this._freeupCanvasMemory()},_buildLevels:function(){var n=[{url:this._image.src,width:this._image.naturalWidth,height:this._image.naturalHeight}];if(!this.buildPyramid||!e.supportsCanvas||!this.useCanvas)return delete this._image,n;var r=this._image.naturalWidth,o=this._image.naturalHeight,s=document.createElement("canvas"),a=s.getContext("2d");if(s.width=r,s.height=o,a.drawImage(this._image,0,0,r,o),n[0].context2D=a,delete this._image,e.isCanvasTainted(s))return n;for(;r>=2&&o>=2;){r=Math.floor(r/2),o=Math.floor(o/2);var l=document.createElement("canvas"),u=l.getContext("2d");l.width=r,l.height=o,u.drawImage(s,0,0,r,o),n.splice(0,0,{context2D:u,width:r,height:o}),s=l,a=u}return n},_freeupCanvasMemory:function(){for(var n=0;n<this.levels.length;n++)this.levels[n].context2D.canvas.height=0,this.levels[n].context2D.canvas.width=0}})}(t),function(e){e.TileSourceCollection=function(n,r,o,s){e.console.error("TileSourceCollection is deprecated; use World instead")}}(t),function(e){e.ButtonState={REST:0,GROUP:1,HOVER:2,DOWN:3},e.Button=function(u){var c=this;e.EventSource.call(this),e.extend(!0,this,{tooltip:null,srcRest:null,srcGroup:null,srcHover:null,srcDown:null,clickTimeThreshold:e.DEFAULT_SETTINGS.clickTimeThreshold,clickDistThreshold:e.DEFAULT_SETTINGS.clickDistThreshold,fadeDelay:0,fadeLength:2e3,onPress:null,onRelease:null,onClick:null,onEnter:null,onExit:null,onFocus:null,onBlur:null,userData:null},u),this.element=u.element||e.makeNeutralElement("div"),u.element||(this.imgRest=e.makeTransparentImage(this.srcRest),this.imgGroup=e.makeTransparentImage(this.srcGroup),this.imgHover=e.makeTransparentImage(this.srcHover),this.imgDown=e.makeTransparentImage(this.srcDown),this.imgRest.alt=this.imgGroup.alt=this.imgHover.alt=this.imgDown.alt=this.tooltip,e.setElementPointerEventsNone(this.imgRest),e.setElementPointerEventsNone(this.imgGroup),e.setElementPointerEventsNone(this.imgHover),e.setElementPointerEventsNone(this.imgDown),this.element.style.position="relative",e.setElementTouchActionNone(this.element),this.imgGroup.style.position=this.imgHover.style.position=this.imgDown.style.position="absolute",this.imgGroup.style.top=this.imgHover.style.top=this.imgDown.style.top="0px",this.imgGroup.style.left=this.imgHover.style.left=this.imgDown.style.left="0px",this.imgHover.style.visibility=this.imgDown.style.visibility="hidden",e.Browser.vendor===e.BROWSERS.FIREFOX&&e.Browser.version<3&&(this.imgGroup.style.top=this.imgHover.style.top=this.imgDown.style.top=""),this.element.appendChild(this.imgRest),this.element.appendChild(this.imgGroup),this.element.appendChild(this.imgHover),this.element.appendChild(this.imgDown)),this.addHandler("press",this.onPress),this.addHandler("release",this.onRelease),this.addHandler("click",this.onClick),this.addHandler("enter",this.onEnter),this.addHandler("exit",this.onExit),this.addHandler("focus",this.onFocus),this.addHandler("blur",this.onBlur),this.currentState=e.ButtonState.GROUP,this.fadeBeginTime=null,this.shouldFade=!1,this.element.style.display="inline-block",this.element.style.position="relative",this.element.title=this.tooltip,this.tracker=new e.MouseTracker({userData:"Button.tracker",element:this.element,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,enterHandler:function(h){h.insideElementPressed?(a(c,e.ButtonState.DOWN),c.raiseEvent("enter",{originalEvent:h.originalEvent})):h.buttonDownAny||a(c,e.ButtonState.HOVER)},focusHandler:function(h){c.tracker.enterHandler(h),c.raiseEvent("focus",{originalEvent:h.originalEvent})},leaveHandler:function(h){l(c,e.ButtonState.GROUP),h.insideElementPressed&&c.raiseEvent("exit",{originalEvent:h.originalEvent})},blurHandler:function(h){c.tracker.leaveHandler(h),c.raiseEvent("blur",{originalEvent:h.originalEvent})},pressHandler:function(h){a(c,e.ButtonState.DOWN),c.raiseEvent("press",{originalEvent:h.originalEvent})},releaseHandler:function(h){h.insideElementPressed&&h.insideElementReleased?(l(c,e.ButtonState.HOVER),c.raiseEvent("release",{originalEvent:h.originalEvent})):h.insideElementPressed?l(c,e.ButtonState.GROUP):a(c,e.ButtonState.HOVER)},clickHandler:function(h){h.quick&&c.raiseEvent("click",{originalEvent:h.originalEvent})},keyHandler:function(h){h.keyCode===13?(c.raiseEvent("click",{originalEvent:h.originalEvent}),c.raiseEvent("release",{originalEvent:h.originalEvent}),h.preventDefault=!0):h.preventDefault=!1}}),l(this,e.ButtonState.REST)},e.extend(e.Button.prototype,e.EventSource.prototype,{notifyGroupEnter:function(){a(this,e.ButtonState.GROUP)},notifyGroupExit:function(){l(this,e.ButtonState.REST)},disable:function(){this.notifyGroupExit(),this.element.disabled=!0,e.setElementOpacity(this.element,.2,!0)},enable:function(){this.element.disabled=!1,e.setElementOpacity(this.element,1,!0),this.notifyGroupEnter()},destroy:function(){this.imgRest&&(this.element.removeChild(this.imgRest),this.imgRest=null),this.imgGroup&&(this.element.removeChild(this.imgGroup),this.imgGroup=null),this.imgHover&&(this.element.removeChild(this.imgHover),this.imgHover=null),this.imgDown&&(this.element.removeChild(this.imgDown),this.imgDown=null),this.removeAllHandlers(),this.tracker.destroy(),this.element=null}});function n(u){e.requestAnimationFrame(function(){r(u)})}function r(u){var c,h,d;u.shouldFade&&(c=e.now(),h=c-u.fadeBeginTime,d=1-h/u.fadeLength,d=Math.min(1,d),d=Math.max(0,d),u.imgGroup&&e.setElementOpacity(u.imgGroup,d,!0),d>0&&n(u))}function o(u){u.shouldFade=!0,u.fadeBeginTime=e.now()+u.fadeDelay,window.setTimeout(function(){n(u)},u.fadeDelay)}function s(u){u.shouldFade=!1,u.imgGroup&&e.setElementOpacity(u.imgGroup,1,!0)}function a(u,c){u.element.disabled||(c>=e.ButtonState.GROUP&&u.currentState===e.ButtonState.REST&&(s(u),u.currentState=e.ButtonState.GROUP),c>=e.ButtonState.HOVER&&u.currentState===e.ButtonState.GROUP&&(u.imgHover&&(u.imgHover.style.visibility=""),u.currentState=e.ButtonState.HOVER),c>=e.ButtonState.DOWN&&u.currentState===e.ButtonState.HOVER&&(u.imgDown&&(u.imgDown.style.visibility=""),u.currentState=e.ButtonState.DOWN))}function l(u,c){u.element.disabled||(c<=e.ButtonState.HOVER&&u.currentState===e.ButtonState.DOWN&&(u.imgDown&&(u.imgDown.style.visibility="hidden"),u.currentState=e.ButtonState.HOVER),c<=e.ButtonState.GROUP&&u.currentState===e.ButtonState.HOVER&&(u.imgHover&&(u.imgHover.style.visibility="hidden"),u.currentState=e.ButtonState.GROUP),c<=e.ButtonState.REST&&u.currentState===e.ButtonState.GROUP&&(o(u),u.currentState=e.ButtonState.REST))}}(t),function(e){e.ButtonGroup=function(n){e.extend(!0,this,{buttons:[],clickTimeThreshold:e.DEFAULT_SETTINGS.clickTimeThreshold,clickDistThreshold:e.DEFAULT_SETTINGS.clickDistThreshold,labelText:""},n);var r=this.buttons.concat([]),o=this,s;if(this.element=n.element||e.makeNeutralElement("div"),!n.group)for(this.element.style.display="inline-block",s=0;s<r.length;s++)this.element.appendChild(r[s].element);e.setElementTouchActionNone(this.element),this.tracker=new e.MouseTracker({userData:"ButtonGroup.tracker",element:this.element,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,enterHandler:function(a){var l;for(l=0;l<o.buttons.length;l++)o.buttons[l].notifyGroupEnter()},leaveHandler:function(a){var l;if(!a.insideElementPressed)for(l=0;l<o.buttons.length;l++)o.buttons[l].notifyGroupExit()}})},e.ButtonGroup.prototype={emulateEnter:function(){this.tracker.enterHandler({eventSource:this.tracker})},emulateLeave:function(){this.tracker.leaveHandler({eventSource:this.tracker})},destroy:function(){for(;this.buttons.length;){var n=this.buttons.pop();this.element.removeChild(n.element),n.destroy()}this.tracker.destroy(),this.element=null}}}(t),function(e){e.Rect=function(n,r,o,s,a){this.x=typeof n=="number"?n:0,this.y=typeof r=="number"?r:0,this.width=typeof o=="number"?o:0,this.height=typeof s=="number"?s:0,this.degrees=typeof a=="number"?a:0,this.degrees=e.positiveModulo(this.degrees,360);var l,u;this.degrees>=270?(l=this.getTopRight(),this.x=l.x,this.y=l.y,u=this.height,this.height=this.width,this.width=u,this.degrees-=270):this.degrees>=180?(l=this.getBottomRight(),this.x=l.x,this.y=l.y,this.degrees-=180):this.degrees>=90&&(l=this.getBottomLeft(),this.x=l.x,this.y=l.y,u=this.height,this.height=this.width,this.width=u,this.degrees-=90)},e.Rect.fromSummits=function(n,r,o){var s=n.distanceTo(r),a=n.distanceTo(o),l=r.minus(n),u=Math.atan(l.y/l.x);return l.x<0?u+=Math.PI:l.y<0&&(u+=2*Math.PI),new e.Rect(n.x,n.y,s,a,u/Math.PI*180)},e.Rect.prototype={clone:function(){return new e.Rect(this.x,this.y,this.width,this.height,this.degrees)},getAspectRatio:function(){return this.width/this.height},getTopLeft:function(){return new e.Point(this.x,this.y)},getBottomRight:function(){return new e.Point(this.x+this.width,this.y+this.height).rotate(this.degrees,this.getTopLeft())},getTopRight:function(){return new e.Point(this.x+this.width,this.y).rotate(this.degrees,this.getTopLeft())},getBottomLeft:function(){return new e.Point(this.x,this.y+this.height).rotate(this.degrees,this.getTopLeft())},getCenter:function(){return new e.Point(this.x+this.width/2,this.y+this.height/2).rotate(this.degrees,this.getTopLeft())},getSize:function(){return new e.Point(this.width,this.height)},equals:function(n){return n instanceof e.Rect&&this.x===n.x&&this.y===n.y&&this.width===n.width&&this.height===n.height&&this.degrees===n.degrees},times:function(n){return new e.Rect(this.x*n,this.y*n,this.width*n,this.height*n,this.degrees)},translate:function(n){return new e.Rect(this.x+n.x,this.y+n.y,this.width,this.height,this.degrees)},union:function(n){var r=this.getBoundingBox(),o=n.getBoundingBox(),s=Math.min(r.x,o.x),a=Math.min(r.y,o.y),l=Math.max(r.x+r.width,o.x+o.width),u=Math.max(r.y+r.height,o.y+o.height);return new e.Rect(s,a,l-s,u-a)},intersection:function(n){var r=1e-10,o=[],s=this.getTopLeft();n.containsPoint(s,r)&&o.push(s);var a=this.getTopRight();n.containsPoint(a,r)&&o.push(a);var l=this.getBottomLeft();n.containsPoint(l,r)&&o.push(l);var u=this.getBottomRight();n.containsPoint(u,r)&&o.push(u);var c=n.getTopLeft();this.containsPoint(c,r)&&o.push(c);var h=n.getTopRight();this.containsPoint(h,r)&&o.push(h);var d=n.getBottomLeft();this.containsPoint(d,r)&&o.push(d);var g=n.getBottomRight();this.containsPoint(g,r)&&o.push(g);for(var y=this._getSegments(),x=n._getSegments(),b=0;b<y.length;b++)for(var T=y[b],f=0;f<x.length;f++){var E=x[f],A=C(T[0],T[1],E[0],E[1]);A&&o.push(A)}function C(V,K,Q,le){var re=K.minus(V),se=le.minus(Q),de=-se.x*re.y+re.x*se.y;if(de===0)return null;var pe=(re.x*(V.y-Q.y)-re.y*(V.x-Q.x))/de,G=(se.x*(V.y-Q.y)-se.y*(V.x-Q.x))/de;return-r<=pe&&pe<=1-r&&-r<=G&&G<=1-r?new e.Point(V.x+G*re.x,V.y+G*re.y):null}if(o.length===0)return null;for(var O=o[0].x,D=o[0].x,I=o[0].y,B=o[0].y,Z=1;Z<o.length;Z++){var Y=o[Z];Y.x<O&&(O=Y.x),Y.x>D&&(D=Y.x),Y.y<I&&(I=Y.y),Y.y>B&&(B=Y.y)}return new e.Rect(O,I,D-O,B-I)},_getSegments:function(){var n=this.getTopLeft(),r=this.getTopRight(),o=this.getBottomLeft(),s=this.getBottomRight();return[[n,r],[r,s],[s,o],[o,n]]},rotate:function(n,r){if(n=e.positiveModulo(n,360),n===0)return this.clone();r=r||this.getCenter();var o=this.getTopLeft().rotate(n,r),s=this.getTopRight().rotate(n,r),a=s.minus(o);a=a.apply(function(u){var c=1e-15;return Math.abs(u)<c?0:u});var l=Math.atan(a.y/a.x);return a.x<0?l+=Math.PI:a.y<0&&(l+=2*Math.PI),new e.Rect(o.x,o.y,this.width,this.height,l/Math.PI*180)},getBoundingBox:function(){if(this.degrees===0)return this.clone();var n=this.getTopLeft(),r=this.getTopRight(),o=this.getBottomLeft(),s=this.getBottomRight(),a=Math.min(n.x,r.x,o.x,s.x),l=Math.max(n.x,r.x,o.x,s.x),u=Math.min(n.y,r.y,o.y,s.y),c=Math.max(n.y,r.y,o.y,s.y);return new e.Rect(a,u,l-a,c-u)},getIntegerBoundingBox:function(){var n=this.getBoundingBox(),r=Math.floor(n.x),o=Math.floor(n.y),s=Math.ceil(n.width+n.x-r),a=Math.ceil(n.height+n.y-o);return new e.Rect(r,o,s,a)},containsPoint:function(n,r){r=r||0;var o=this.getTopLeft(),s=this.getTopRight(),a=this.getBottomLeft(),l=s.minus(o),u=a.minus(o);return(n.x-o.x)*l.x+(n.y-o.y)*l.y>=-r&&(n.x-s.x)*l.x+(n.y-s.y)*l.y<=r&&(n.x-o.x)*u.x+(n.y-o.y)*u.y>=-r&&(n.x-a.x)*u.x+(n.y-a.y)*u.y<=r},toString:function(){return"["+Math.round(this.x*100)/100+", "+Math.round(this.y*100)/100+", "+Math.round(this.width*100)/100+"x"+Math.round(this.height*100)/100+", "+Math.round(this.degrees*100)/100+"deg]"}}}(t),function(e){var n={};e.ReferenceStrip=function(d){var g=this,y=d.viewer,x=e.getElementSize(y.element),b,T,f;for(d.id||(d.id="referencestrip-"+e.now(),this.element=e.makeNeutralElement("div"),this.element.id=d.id,this.element.className="referencestrip"),d=e.extend(!0,{sizeRatio:e.DEFAULT_SETTINGS.referenceStripSizeRatio,position:e.DEFAULT_SETTINGS.referenceStripPosition,scroll:e.DEFAULT_SETTINGS.referenceStripScroll,clickTimeThreshold:e.DEFAULT_SETTINGS.clickTimeThreshold},d,{element:this.element}),e.extend(this,d),n[this.id]={animating:!1},this.minPixelRatio=this.viewer.minPixelRatio,this.element.tabIndex=0,T=this.element.style,T.marginTop="0px",T.marginRight="0px",T.marginBottom="0px",T.marginLeft="0px",T.left="0px",T.bottom="0px",T.border="0px",T.background="#000",T.position="relative",e.setElementTouchActionNone(this.element),e.setElementOpacity(this.element,.8),this.viewer=y,this.tracker=new e.MouseTracker({userData:"ReferenceStrip.tracker",element:this.element,clickHandler:e.delegate(this,r),dragHandler:e.delegate(this,o),scrollHandler:e.delegate(this,s),enterHandler:e.delegate(this,l),leaveHandler:e.delegate(this,u),keyDownHandler:e.delegate(this,c),keyHandler:e.delegate(this,h),preProcessEventHandler:function(E){E.eventType==="wheel"&&(E.preventDefault=!0)}}),d.width&&d.height?(this.element.style.width=d.width+"px",this.element.style.height=d.height+"px",y.addControl(this.element,{anchor:e.ControlAnchor.BOTTOM_LEFT})):d.scroll==="horizontal"?(this.element.style.width=x.x*d.sizeRatio*y.tileSources.length+12*y.tileSources.length+"px",this.element.style.height=x.y*d.sizeRatio+"px",y.addControl(this.element,{anchor:e.ControlAnchor.BOTTOM_LEFT})):(this.element.style.height=x.y*d.sizeRatio*y.tileSources.length+12*y.tileSources.length+"px",this.element.style.width=x.x*d.sizeRatio+"px",y.addControl(this.element,{anchor:e.ControlAnchor.TOP_LEFT})),this.panelWidth=x.x*this.sizeRatio+8,this.panelHeight=x.y*this.sizeRatio+8,this.panels=[],this.miniViewers={},f=0;f<y.tileSources.length;f++)b=e.makeNeutralElement("div"),b.id=this.element.id+"-"+f,b.style.width=g.panelWidth+"px",b.style.height=g.panelHeight+"px",b.style.display="inline",b.style.float="left",b.style.cssFloat="left",b.style.styleFloat="left",b.style.padding="2px",e.setElementTouchActionNone(b),e.setElementPointerEventsNone(b),this.element.appendChild(b),b.activePanel=!1,this.panels.push(b);a(this,this.scroll==="vertical"?x.y:x.x,0),this.setFocus(0)},e.ReferenceStrip.prototype={setFocus:function(d){var g=this.element.querySelector("#"+this.element.id+"-"+d),y=e.getElementSize(this.viewer.canvas),x=Number(this.element.style.width.replace("px","")),b=Number(this.element.style.height.replace("px","")),T=-Number(this.element.style.marginLeft.replace("px","")),f=-Number(this.element.style.marginTop.replace("px","")),E;this.currentSelected!==g&&(this.currentSelected&&(this.currentSelected.style.background="#000"),this.currentSelected=g,this.currentSelected.style.background="#999",this.scroll==="horizontal"?(E=Number(d)*(this.panelWidth+3),E>T+y.x-this.panelWidth?(E=Math.min(E,x-y.x),this.element.style.marginLeft=-E+"px",a(this,y.x,-E)):E<T&&(E=Math.max(0,E-y.x/2),this.element.style.marginLeft=-E+"px",a(this,y.x,-E))):(E=Number(d)*(this.panelHeight+3),E>f+y.y-this.panelHeight?(E=Math.min(E,b-y.y),this.element.style.marginTop=-E+"px",a(this,y.y,-E)):E<f&&(E=Math.max(0,E-y.y/2),this.element.style.marginTop=-E+"px",a(this,y.y,-E))),this.currentPage=d,l.call(this,{eventSource:this.tracker}))},update:function(){return n[this.id].animating?(e.console.log("image reference strip update"),!0):!1},destroy:function(){if(this.miniViewers)for(var d in this.miniViewers)this.miniViewers[d].destroy();this.tracker.destroy(),this.element&&this.viewer.removeControl(this.element)}};function r(d){if(d.quick){var g;this.scroll==="horizontal"?g=Math.floor(d.position.x/this.panelWidth):g=Math.floor(d.position.y/this.panelHeight),this.viewer.goToPage(g)}this.element.focus()}function o(d){if(this.dragging=!0,this.element){var g=Number(this.element.style.marginLeft.replace("px","")),y=Number(this.element.style.marginTop.replace("px","")),x=Number(this.element.style.width.replace("px","")),b=Number(this.element.style.height.replace("px","")),T=e.getElementSize(this.viewer.canvas);this.scroll==="horizontal"?-d.delta.x>0?g>-(x-T.x)&&(this.element.style.marginLeft=g+d.delta.x*2+"px",a(this,T.x,g+d.delta.x*2)):-d.delta.x<0&&g<0&&(this.element.style.marginLeft=g+d.delta.x*2+"px",a(this,T.x,g+d.delta.x*2)):-d.delta.y>0?y>-(b-T.y)&&(this.element.style.marginTop=y+d.delta.y*2+"px",a(this,T.y,y+d.delta.y*2)):-d.delta.y<0&&y<0&&(this.element.style.marginTop=y+d.delta.y*2+"px",a(this,T.y,y+d.delta.y*2))}}function s(d){if(this.element){var g=Number(this.element.style.marginLeft.replace("px","")),y=Number(this.element.style.marginTop.replace("px","")),x=Number(this.element.style.width.replace("px","")),b=Number(this.element.style.height.replace("px","")),T=e.getElementSize(this.viewer.canvas);this.scroll==="horizontal"?d.scroll>0?g>-(x-T.x)&&(this.element.style.marginLeft=g-d.scroll*60+"px",a(this,T.x,g-d.scroll*60)):d.scroll<0&&g<0&&(this.element.style.marginLeft=g-d.scroll*60+"px",a(this,T.x,g-d.scroll*60)):d.scroll<0?y>T.y-b&&(this.element.style.marginTop=y+d.scroll*60+"px",a(this,T.y,y+d.scroll*60)):d.scroll>0&&y<0&&(this.element.style.marginTop=y+d.scroll*60+"px",a(this,T.y,y+d.scroll*60)),d.preventDefault=!0}}function a(d,g,y){var x,b,T,f,E,A;for(d.scroll==="horizontal"?x=d.panelWidth:x=d.panelHeight,b=Math.ceil(g/x)+5,T=Math.ceil((Math.abs(y)+g)/x)+1,b=T-b,b=b<0?0:b,E=b;E<T&&E<d.panels.length;E++)if(A=d.panels[E],!A.activePanel){var C,O=d.viewer.tileSources[E];O.referenceStripThumbnailUrl?C={type:"image",url:O.referenceStripThumbnailUrl}:C=O,f=new e.Viewer({id:A.id,tileSources:[C],element:A,navigatorSizeRatio:d.sizeRatio,showNavigator:!1,mouseNavEnabled:!1,showNavigationControl:!1,showSequenceControl:!1,immediateRender:!0,blendTime:0,animationTime:0,loadTilesWithAjax:d.viewer.loadTilesWithAjax,ajaxHeaders:d.viewer.ajaxHeaders,useCanvas:d.useCanvas}),e.setElementPointerEventsNone(f.canvas),e.setElementPointerEventsNone(f.container),f.innerTracker.setTracking(!1),f.outerTracker.setTracking(!1),d.miniViewers[A.id]=f,A.activePanel=!0}}function l(d){var g=d.eventSource.element;this.scroll==="horizontal"?g.style.marginBottom="0px":g.style.marginLeft="0px"}function u(d){var g=d.eventSource.element;this.scroll==="horizontal"?g.style.marginBottom="-"+e.getElementSize(g).y/2+"px":g.style.marginLeft="-"+e.getElementSize(g).x/2+"px"}function c(d){if(!d.ctrl&&!d.alt&&!d.meta)switch(d.keyCode){case 38:s.call(this,{eventSource:this.tracker,position:null,scroll:1,shift:null}),d.preventDefault=!0;break;case 40:s.call(this,{eventSource:this.tracker,position:null,scroll:-1,shift:null}),d.preventDefault=!0;break;case 37:s.call(this,{eventSource:this.tracker,position:null,scroll:-1,shift:null}),d.preventDefault=!0;break;case 39:s.call(this,{eventSource:this.tracker,position:null,scroll:1,shift:null}),d.preventDefault=!0;break;default:d.preventDefault=!1;break}else d.preventDefault=!1}function h(d){if(!d.ctrl&&!d.alt&&!d.meta)switch(d.keyCode){case 61:s.call(this,{eventSource:this.tracker,position:null,scroll:1,shift:null}),d.preventDefault=!0;break;case 45:s.call(this,{eventSource:this.tracker,position:null,scroll:-1,shift:null}),d.preventDefault=!0;break;case 48:case 119:case 87:s.call(this,{eventSource:this.tracker,position:null,scroll:1,shift:null}),d.preventDefault=!0;break;case 115:case 83:s.call(this,{eventSource:this.tracker,position:null,scroll:-1,shift:null}),d.preventDefault=!0;break;case 97:s.call(this,{eventSource:this.tracker,position:null,scroll:-1,shift:null}),d.preventDefault=!0;break;case 100:s.call(this,{eventSource:this.tracker,position:null,scroll:1,shift:null}),d.preventDefault=!0;break;default:d.preventDefault=!1;break}else d.preventDefault=!1}}(t),function(e){e.DisplayRect=function(n,r,o,s,a,l){e.Rect.apply(this,[n,r,o,s]),this.minLevel=a,this.maxLevel=l},e.extend(e.DisplayRect.prototype,e.Rect.prototype)}(t),function(e){e.Spring=function(r){var o=arguments;typeof r!="object"&&(r={initial:o.length&&typeof o[0]=="number"?o[0]:void 0,springStiffness:o.length>1?o[1].springStiffness:5,animationTime:o.length>1?o[1].animationTime:1.5}),e.console.assert(typeof r.springStiffness=="number"&&r.springStiffness!==0,"[OpenSeadragon.Spring] options.springStiffness must be a non-zero number"),e.console.assert(typeof r.animationTime=="number"&&r.animationTime>=0,"[OpenSeadragon.Spring] options.animationTime must be a number greater than or equal to 0"),r.exponential&&(this._exponential=!0,delete r.exponential),e.extend(!0,this,r),this.current={value:typeof this.initial=="number"?this.initial:this._exponential?0:1,time:e.now()},e.console.assert(!this._exponential||this.current.value!==0,"[OpenSeadragon.Spring] value must be non-zero for exponential springs"),this.start={value:this.current.value,time:this.current.time},this.target={value:this.current.value,time:this.current.time},this._exponential&&(this.start._logValue=Math.log(this.start.value),this.target._logValue=Math.log(this.target.value),this.current._logValue=Math.log(this.current.value))},e.Spring.prototype={resetTo:function(r){e.console.assert(!this._exponential||r!==0,"[OpenSeadragon.Spring.resetTo] target must be non-zero for exponential springs"),this.start.value=this.target.value=this.current.value=r,this.start.time=this.target.time=this.current.time=e.now(),this._exponential&&(this.start._logValue=Math.log(this.start.value),this.target._logValue=Math.log(this.target.value),this.current._logValue=Math.log(this.current.value))},springTo:function(r){e.console.assert(!this._exponential||r!==0,"[OpenSeadragon.Spring.springTo] target must be non-zero for exponential springs"),this.start.value=this.current.value,this.start.time=this.current.time,this.target.value=r,this.target.time=this.start.time+1e3*this.animationTime,this._exponential&&(this.start._logValue=Math.log(this.start.value),this.target._logValue=Math.log(this.target.value))},shiftBy:function(r){this.start.value+=r,this.target.value+=r,this._exponential&&(e.console.assert(this.target.value!==0&&this.start.value!==0,"[OpenSeadragon.Spring.shiftBy] spring value must be non-zero for exponential springs"),this.start._logValue=Math.log(this.start.value),this.target._logValue=Math.log(this.target.value))},setExponential:function(r){this._exponential=r,this._exponential&&(e.console.assert(this.current.value!==0&&this.target.value!==0&&this.start.value!==0,"[OpenSeadragon.Spring.setExponential] spring value must be non-zero for exponential springs"),this.start._logValue=Math.log(this.start.value),this.target._logValue=Math.log(this.target.value),this.current._logValue=Math.log(this.current.value))},update:function(){this.current.time=e.now();var r,o;this._exponential?(r=this.start._logValue,o=this.target._logValue):(r=this.start.value,o=this.target.value);var s=this.current.time>=this.target.time?o:r+(o-r)*n(this.springStiffness,(this.current.time-this.start.time)/(this.target.time-this.start.time)),a=this.current.value;return this._exponential?this.current.value=Math.exp(s):this.current.value=s,a!==this.current.value},isAtTargetValue:function(){return this.current.value===this.target.value}};function n(r,o){return(1-Math.exp(r*-o))/(1-Math.exp(-r))}}(t),function(e){function n(o){e.extend(!0,this,{timeout:e.DEFAULT_SETTINGS.timeout,jobId:null},o),this.image=null}n.prototype={errorMsg:null,start:function(){var o=this,s=this.abort;this.image=new Image,this.image.onload=function(){o.finish(!0)},this.image.onabort=this.image.onerror=function(){o.errorMsg="Image load aborted",o.finish(!1)},this.jobId=window.setTimeout(function(){o.errorMsg="Image load exceeded timeout ("+o.timeout+" ms)",o.finish(!1)},this.timeout),this.loadWithAjax?(this.request=e.makeAjaxRequest({url:this.src,withCredentials:this.ajaxWithCredentials,headers:this.ajaxHeaders,responseType:"arraybuffer",success:function(a){var l;try{l=new window.Blob([a.response])}catch(d){var u=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder;if(d.name==="TypeError"&&u){var c=new u;c.append(a.response),l=c.getBlob()}}l.size===0&&(o.errorMsg="Empty image response.",o.finish(!1));var h=(window.URL||window.webkitURL).createObjectURL(l);o.image.src=h},error:function(a){o.errorMsg="Image load aborted - XHR error",o.finish(!1)}}),this.abort=function(){o.request.abort(),typeof s=="function"&&s()}):(this.crossOriginPolicy!==!1&&(this.image.crossOrigin=this.crossOriginPolicy),this.image.src=this.src)},finish:function(o){this.image.onload=this.image.onerror=this.image.onabort=null,o||(this.image=null),this.jobId&&window.clearTimeout(this.jobId),this.callback(this)}},e.ImageLoader=function(o){e.extend(!0,this,{jobLimit:e.DEFAULT_SETTINGS.imageLoaderLimit,timeout:e.DEFAULT_SETTINGS.timeout,jobQueue:[],jobsInProgress:0},o)},e.ImageLoader.prototype={addJob:function(o){var s=this,a=function(c){r(s,c,o.callback)},l={src:o.src,loadWithAjax:o.loadWithAjax,ajaxHeaders:o.loadWithAjax?o.ajaxHeaders:null,crossOriginPolicy:o.crossOriginPolicy,ajaxWithCredentials:o.ajaxWithCredentials,callback:a,abort:o.abort,timeout:this.timeout},u=new n(l);!this.jobLimit||this.jobsInProgress<this.jobLimit?(u.start(),this.jobsInProgress++):this.jobQueue.push(u)},clear:function(){for(var o=0;o<this.jobQueue.length;o++){var s=this.jobQueue[o];typeof s.abort=="function"&&s.abort()}this.jobQueue=[]}};function r(o,s,a){var l;o.jobsInProgress--,(!o.jobLimit||o.jobsInProgress<o.jobLimit)&&o.jobQueue.length>0&&(l=o.jobQueue.shift(),l.start(),o.jobsInProgress++),a(s.image,s.errorMsg,s.request)}}(t),function(e){e.Tile=function(n,r,o,s,a,l,u,c,h,d){this.level=n,this.x=r,this.y=o,this.bounds=s,this.sourceBounds=d,this.exists=a,this.url=l,this.context2D=u,this.loadWithAjax=c,this.ajaxHeaders=h,this.ajaxHeaders?this.cacheKey=this.url+"+"+JSON.stringify(this.ajaxHeaders):this.cacheKey=this.url,this.loaded=!1,this.loading=!1,this.element=null,this.imgElement=null,this.image=null,this.style=null,this.position=null,this.size=null,this.flipped=!1,this.blendStart=null,this.opacity=null,this.squaredDistance=null,this.visibility=null,this.beingDrawn=!1,this.lastTouchTime=0,this.isRightMost=!1,this.isBottomMost=!1},e.Tile.prototype={toString:function(){return this.level+"/"+this.x+"_"+this.y},_hasTransparencyChannel:function(){return!!this.context2D||this.url.match(".png")},drawHTML:function(n){if(!this.cacheImageRecord){e.console.warn("[Tile.drawHTML] attempting to draw tile %s when it's not cached",this.toString());return}if(!this.loaded){e.console.warn("Attempting to draw tile %s when it's not yet loaded.",this.toString());return}this.element||(this.element=e.makeNeutralElement("div"),this.imgElement=this.cacheImageRecord.getImage().cloneNode(),this.imgElement.style.msInterpolationMode="nearest-neighbor",this.imgElement.style.width="100%",this.imgElement.style.height="100%",this.style=this.element.style,this.style.position="absolute"),this.element.parentNode!==n&&n.appendChild(this.element),this.imgElement.parentNode!==this.element&&this.element.appendChild(this.imgElement),this.style.top=this.position.y+"px",this.style.left=this.position.x+"px",this.style.height=this.size.y+"px",this.style.width=this.size.x+"px",this.flipped&&(this.style.transform="scaleX(-1)"),e.setElementOpacity(this.element,this.opacity)},drawCanvas:function(n,r,o,s){var a=this.position.times(e.pixelDensityRatio),l=this.size.times(e.pixelDensityRatio),u;if(!this.context2D&&!this.cacheImageRecord){e.console.warn("[Tile.drawCanvas] attempting to draw tile %s when it's not cached",this.toString());return}if(u=this.context2D||this.cacheImageRecord.getRenderedContext(),!this.loaded||!u){e.console.warn("Attempting to draw tile %s when it's not yet loaded.",this.toString());return}n.save(),n.globalAlpha=this.opacity,typeof o=="number"&&o!==1&&(a=a.times(o),l=l.times(o)),s instanceof e.Point&&(a=a.plus(s)),n.globalAlpha===1&&this._hasTransparencyChannel()&&n.clearRect(a.x,a.y,l.x,l.y),r({context:n,tile:this,rendered:u});var c,h;this.sourceBounds?(c=Math.min(this.sourceBounds.width,u.canvas.width),h=Math.min(this.sourceBounds.height,u.canvas.height)):(c=u.canvas.width,h=u.canvas.height),n.translate(a.x+l.x/2,0),this.flipped&&n.scale(-1,1),n.drawImage(u.canvas,0,0,c,h,-l.x/2,a.y,l.x,l.y),n.restore()},getScaleForEdgeSmoothing:function(){var n;if(this.cacheImageRecord)n=this.cacheImageRecord.getRenderedContext();else if(this.context2D)n=this.context2D;else return e.console.warn("[Tile.drawCanvas] attempting to get tile scale %s when tile's not cached",this.toString()),1;return n.canvas.width/(this.size.x*e.pixelDensityRatio)},getTranslationForEdgeSmoothing:function(n,r,o){var s=Math.max(1,Math.ceil((o.x-r.x)/2)),a=Math.max(1,Math.ceil((o.y-r.y)/2));return new e.Point(s,a).minus(this.position.times(e.pixelDensityRatio).times(n||1).apply(function(l){return l%1}))},unload:function(){this.imgElement&&this.imgElement.parentNode&&this.imgElement.parentNode.removeChild(this.imgElement),this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element),this.element=null,this.imgElement=null,this.loaded=!1,this.loading=!1}}}(t),function(e){e.OverlayPlacement=e.Placement,e.OverlayRotationMode=e.freezeObject({NO_ROTATION:1,EXACT:2,BOUNDING_BOX:3}),e.Overlay=function(n,r,o){var s;e.isPlainObject(n)?s=n:s={element:n,location:r,placement:o},this.element=s.element,this.style=s.element.style,this._init(s)},e.Overlay.prototype={_init:function(n){this.location=n.location,this.placement=n.placement===void 0?e.Placement.TOP_LEFT:n.placement,this.onDraw=n.onDraw,this.checkResize=n.checkResize===void 0?!0:n.checkResize,this.width=n.width===void 0?null:n.width,this.height=n.height===void 0?null:n.height,this.rotationMode=n.rotationMode||e.OverlayRotationMode.EXACT,this.location instanceof e.Rect&&(this.width=this.location.width,this.height=this.location.height,this.location=this.location.getTopLeft(),this.placement=e.Placement.TOP_LEFT),this.scales=this.width!==null&&this.height!==null,this.bounds=new e.Rect(this.location.x,this.location.y,this.width,this.height),this.position=this.location},adjust:function(n,r){var o=e.Placement.properties[this.placement];!o||(o.isHorizontallyCentered?n.x-=r.x/2:o.isRight&&(n.x-=r.x),o.isVerticallyCentered?n.y-=r.y/2:o.isBottom&&(n.y-=r.y))},destroy:function(){var n=this.element,r=this.style;n.parentNode&&(n.parentNode.removeChild(n),n.prevElementParent&&(r.display="none",document.body.appendChild(n))),this.onDraw=null,r.top="",r.left="",r.position="",this.width!==null&&(r.width=""),this.height!==null&&(r.height="");var o=e.getCssPropertyWithVendorPrefix("transformOrigin"),s=e.getCssPropertyWithVendorPrefix("transform");o&&s&&(r[o]="",r[s]="")},drawHTML:function(n,r){var o=this.element;o.parentNode!==n&&(o.prevElementParent=o.parentNode,o.prevNextSibling=o.nextSibling,n.appendChild(o),this.style.position="absolute",this.size=e.getElementSize(o));var s=this._getOverlayPositionAndSize(r),a=s.position,l=this.size=s.size,u=s.rotate;if(this.onDraw)this.onDraw(a,l,this.element);else{var c=this.style;c.left=a.x+"px",c.top=a.y+"px",this.width!==null&&(c.width=l.x+"px"),this.height!==null&&(c.height=l.y+"px");var h=e.getCssPropertyWithVendorPrefix("transformOrigin"),d=e.getCssPropertyWithVendorPrefix("transform");h&&d&&(u?(c[h]=this._getTransformOrigin(),c[d]="rotate("+u+"deg)"):(c[h]="",c[d]="")),c.display="block"}},_getOverlayPositionAndSize:function(n){var r=n.pixelFromPoint(this.location,!0),o=this._getSizeInPixels(n);this.adjust(r,o);var s=0;if(n.degrees&&this.rotationMode!==e.OverlayRotationMode.NO_ROTATION)if(this.rotationMode===e.OverlayRotationMode.BOUNDING_BOX&&this.width!==null&&this.height!==null){var a=new e.Rect(r.x,r.y,o.x,o.y),l=this._getBoundingBox(a,n.degrees);r=l.getTopLeft(),o=l.getSize()}else s=n.degrees;return{position:r,size:o,rotate:s}},_getSizeInPixels:function(n){var r=this.size.x,o=this.size.y;if(this.width!==null||this.height!==null){var s=n.deltaPixelsFromPointsNoRotate(new e.Point(this.width||0,this.height||0),!0);this.width!==null&&(r=s.x),this.height!==null&&(o=s.y)}if(this.checkResize&&(this.width===null||this.height===null)){var a=this.size=e.getElementSize(this.element);this.width===null&&(r=a.x),this.height===null&&(o=a.y)}return new e.Point(r,o)},_getBoundingBox:function(n,r){var o=this._getPlacementPoint(n);return n.rotate(r,o).getBoundingBox()},_getPlacementPoint:function(n){var r=new e.Point(n.x,n.y),o=e.Placement.properties[this.placement];return o&&(o.isHorizontallyCentered?r.x+=n.width/2:o.isRight&&(r.x+=n.width),o.isVerticallyCentered?r.y+=n.height/2:o.isBottom&&(r.y+=n.height)),r},_getTransformOrigin:function(){var n="",r=e.Placement.properties[this.placement];return r&&(r.isLeft?n="left":r.isRight&&(n="right"),r.isTop?n+=" top":r.isBottom&&(n+=" bottom")),n},update:function(n,r){var o=e.isPlainObject(n)?n:{location:n,placement:r};this._init({location:o.location||this.location,placement:o.placement!==void 0?o.placement:this.placement,onDraw:o.onDraw||this.onDraw,checkResize:o.checkResize||this.checkResize,width:o.width!==void 0?o.width:this.width,height:o.height!==void 0?o.height:this.height,rotationMode:o.rotationMode||this.rotationMode})},getBounds:function(n){e.console.assert(n,"A viewport must now be passed to Overlay.getBounds.");var r=this.width,o=this.height;if(r===null||o===null){var s=n.deltaPointsFromPixelsNoRotate(this.size,!0);r===null&&(r=s.x),o===null&&(o=s.y)}var a=this.location.clone();return this.adjust(a,new e.Point(r,o)),this._adjustBoundsForRotation(n,new e.Rect(a.x,a.y,r,o))},_adjustBoundsForRotation:function(n,r){if(!n||n.degrees===0||this.rotationMode===e.OverlayRotationMode.EXACT)return r;if(this.rotationMode===e.OverlayRotationMode.BOUNDING_BOX){if(this.width===null||this.height===null)return r;var o=this._getOverlayPositionAndSize(n);return n.viewerElementToViewportRectangle(new e.Rect(o.position.x,o.position.y,o.size.x,o.size.y))}return r.rotate(-n.degrees,this._getPlacementPoint(r))}}}(t),function(e){e.Drawer=function(n){e.console.assert(n.viewer,"[Drawer] options.viewer is required");var r=arguments;if(e.isPlainObject(n)||(n={source:r[0],viewport:r[1],element:r[2]}),e.console.assert(n.viewport,"[Drawer] options.viewport is required"),e.console.assert(n.element,"[Drawer] options.element is required"),n.source&&e.console.error("[Drawer] options.source is no longer accepted; use TiledImage instead"),this.viewer=n.viewer,this.viewport=n.viewport,this.debugGridColor=typeof n.debugGridColor=="string"?[n.debugGridColor]:n.debugGridColor||e.DEFAULT_SETTINGS.debugGridColor,n.opacity&&e.console.error("[Drawer] options.opacity is no longer accepted; set the opacity on the TiledImage instead"),this.useCanvas=e.supportsCanvas&&(this.viewer?this.viewer.useCanvas:!0),this.container=e.getElement(n.element),this.canvas=e.makeNeutralElement(this.useCanvas?"canvas":"div"),this.context=this.useCanvas?this.canvas.getContext("2d"):null,this.sketchCanvas=null,this.sketchContext=null,this.element=this.container,this.container.dir="ltr",this.useCanvas){var o=this._calculateCanvasSize();this.canvas.width=o.x,this.canvas.height=o.y}this.canvas.style.width="100%",this.canvas.style.height="100%",this.canvas.style.position="absolute",e.setElementOpacity(this.canvas,this.opacity,!0),e.setElementPointerEventsNone(this.canvas),e.setElementTouchActionNone(this.canvas),this.container.style.textAlign="left",this.container.appendChild(this.canvas),this._imageSmoothingEnabled=!0},e.Drawer.prototype={addOverlay:function(n,r,o,s){return e.console.error("drawer.addOverlay is deprecated. Use viewer.addOverlay instead."),this.viewer.addOverlay(n,r,o,s),this},updateOverlay:function(n,r,o){return e.console.error("drawer.updateOverlay is deprecated. Use viewer.updateOverlay instead."),this.viewer.updateOverlay(n,r,o),this},removeOverlay:function(n){return e.console.error("drawer.removeOverlay is deprecated. Use viewer.removeOverlay instead."),this.viewer.removeOverlay(n),this},clearOverlays:function(){return e.console.error("drawer.clearOverlays is deprecated. Use viewer.clearOverlays instead."),this.viewer.clearOverlays(),this},viewportCoordToDrawerCoord:function(n){var r=this.viewport.pixelFromPointNoRotate(n,!0);return new e.Point(r.x*e.pixelDensityRatio,r.y*e.pixelDensityRatio)},clipWithPolygons:function(n,r){if(!!this.useCanvas){var o=this._getContext(r);o.beginPath(),n.forEach(function(s){s.forEach(function(a,l){o[l===0?"moveTo":"lineTo"](a.x,a.y)})}),o.clip()}},setOpacity:function(n){e.console.error("drawer.setOpacity is deprecated. Use tiledImage.setOpacity instead.");for(var r=this.viewer.world,o=0;o<r.getItemCount();o++)r.getItemAt(o).setOpacity(n);return this},getOpacity:function(){e.console.error("drawer.getOpacity is deprecated. Use tiledImage.getOpacity instead.");for(var n=this.viewer.world,r=0,o=0;o<n.getItemCount();o++){var s=n.getItemAt(o).getOpacity();s>r&&(r=s)}return r},needsUpdate:function(){return e.console.error("[Drawer.needsUpdate] this function is deprecated. Use World.needsDraw instead."),this.viewer.world.needsDraw()},numTilesLoaded:function(){return e.console.error("[Drawer.numTilesLoaded] this function is deprecated. Use TileCache.numTilesLoaded instead."),this.viewer.tileCache.numTilesLoaded()},reset:function(){return e.console.error("[Drawer.reset] this function is deprecated. Use World.resetItems instead."),this.viewer.world.resetItems(),this},update:function(){return e.console.error("[Drawer.update] this function is deprecated. Use Drawer.clear and World.draw instead."),this.clear(),this.viewer.world.draw(),this},canRotate:function(){return this.useCanvas},destroy:function(){this.canvas.width=1,this.canvas.height=1,this.sketchCanvas=null,this.sketchContext=null},clear:function(){if(this.canvas.innerHTML="",this.useCanvas){var n=this._calculateCanvasSize();if((this.canvas.width!==n.x||this.canvas.height!==n.y)&&(this.canvas.width=n.x,this.canvas.height=n.y,this._updateImageSmoothingEnabled(this.context),this.sketchCanvas!==null)){var r=this._calculateSketchCanvasSize();this.sketchCanvas.width=r.x,this.sketchCanvas.height=r.y,this._updateImageSmoothingEnabled(this.sketchContext)}this._clear()}},_clear:function(n,r){if(!!this.useCanvas){var o=this._getContext(n);if(r)o.clearRect(r.x,r.y,r.width,r.height);else{var s=o.canvas;o.clearRect(0,0,s.width,s.height)}}},viewportToDrawerRectangle:function(n){var r=this.viewport.pixelFromPointNoRotate(n.getTopLeft(),!0),o=this.viewport.deltaPixelsFromPointsNoRotate(n.getSize(),!0);return new e.Rect(r.x*e.pixelDensityRatio,r.y*e.pixelDensityRatio,o.x*e.pixelDensityRatio,o.y*e.pixelDensityRatio)},drawTile:function(n,r,o,s,a){if(e.console.assert(n,"[Drawer.drawTile] tile is required"),e.console.assert(r,"[Drawer.drawTile] drawingHandler is required"),this.useCanvas){var l=this._getContext(o);s=s||1,n.drawCanvas(l,r,s,a)}else n.drawHTML(this.canvas)},_getContext:function(n){var r=this.context;if(n){if(this.sketchCanvas===null){this.sketchCanvas=document.createElement("canvas");var o=this._calculateSketchCanvasSize();if(this.sketchCanvas.width=o.x,this.sketchCanvas.height=o.y,this.sketchContext=this.sketchCanvas.getContext("2d"),this.viewport.getRotation()===0){var s=this;this.viewer.addHandler("rotate",function a(){if(s.viewport.getRotation()!==0){s.viewer.removeHandler("rotate",a);var l=s._calculateSketchCanvasSize();s.sketchCanvas.width=l.x,s.sketchCanvas.height=l.y}})}this._updateImageSmoothingEnabled(this.sketchContext)}r=this.sketchContext}return r},saveContext:function(n){!this.useCanvas||this._getContext(n).save()},restoreContext:function(n){!this.useCanvas||this._getContext(n).restore()},setClip:function(n,r){if(!!this.useCanvas){var o=this._getContext(r);o.beginPath(),o.rect(n.x,n.y,n.width,n.height),o.clip()}},drawRectangle:function(n,r,o){if(!!this.useCanvas){var s=this._getContext(o);s.save(),s.fillStyle=r,s.fillRect(n.x,n.y,n.width,n.height),s.restore()}},blendSketch:function(n,r,o,s){var a=n;if(e.isPlainObject(a)||(a={opacity:n,scale:r,translate:o,compositeOperation:s}),!(!this.useCanvas||!this.sketchCanvas)){n=a.opacity,s=a.compositeOperation;var l=a.bounds;if(this.context.save(),this.context.globalAlpha=n,s&&(this.context.globalCompositeOperation=s),l)l.x<0&&(l.width+=l.x,l.x=0),l.x+l.width>this.canvas.width&&(l.width=this.canvas.width-l.x),l.y<0&&(l.height+=l.y,l.y=0),l.y+l.height>this.canvas.height&&(l.height=this.canvas.height-l.y),this.context.drawImage(this.sketchCanvas,l.x,l.y,l.width,l.height,l.x,l.y,l.width,l.height);else{r=a.scale||1,o=a.translate;var u=o instanceof e.Point?o:new e.Point(0,0),c=0,h=0;if(o){var d=this.sketchCanvas.width-this.canvas.width,g=this.sketchCanvas.height-this.canvas.height;c=Math.round(d/2),h=Math.round(g/2)}this.context.drawImage(this.sketchCanvas,u.x-c*r,u.y-h*r,(this.canvas.width+2*c)*r,(this.canvas.height+2*h)*r,-c,-h,this.canvas.width+2*c,this.canvas.height+2*h)}this.context.restore()}},drawDebugInfo:function(n,r,o,s){if(!!this.useCanvas){var a=this.viewer.world.getIndexOfItem(s)%this.debugGridColor.length,l=this.context;l.save(),l.lineWidth=2*e.pixelDensityRatio,l.font="small-caps bold "+13*e.pixelDensityRatio+"px arial",l.strokeStyle=this.debugGridColor[a],l.fillStyle=this.debugGridColor[a],this.viewport.degrees!==0&&this._offsetForRotation({degrees:this.viewport.degrees}),s.getRotation(!0)%360!==0&&this._offsetForRotation({degrees:s.getRotation(!0),point:s.viewport.pixelFromPointNoRotate(s._getRotationPoint(!0),!0)}),s.viewport.degrees===0&&s.getRotation(!0)%360===0&&s._drawer.viewer.viewport.getFlip()&&s._drawer._flip(),l.strokeRect(n.position.x*e.pixelDensityRatio,n.position.y*e.pixelDensityRatio,n.size.x*e.pixelDensityRatio,n.size.y*e.pixelDensityRatio);var u=(n.position.x+n.size.x/2)*e.pixelDensityRatio,c=(n.position.y+n.size.y/2)*e.pixelDensityRatio;l.translate(u,c),l.rotate(Math.PI/180*-this.viewport.degrees),l.translate(-u,-c),n.x===0&&n.y===0&&(l.fillText("Zoom: "+this.viewport.getZoom(),n.position.x*e.pixelDensityRatio,(n.position.y-30)*e.pixelDensityRatio),l.fillText("Pan: "+this.viewport.getBounds().toString(),n.position.x*e.pixelDensityRatio,(n.position.y-20)*e.pixelDensityRatio)),l.fillText("Level: "+n.level,(n.position.x+10)*e.pixelDensityRatio,(n.position.y+20)*e.pixelDensityRatio),l.fillText("Column: "+n.x,(n.position.x+10)*e.pixelDensityRatio,(n.position.y+30)*e.pixelDensityRatio),l.fillText("Row: "+n.y,(n.position.x+10)*e.pixelDensityRatio,(n.position.y+40)*e.pixelDensityRatio),l.fillText("Order: "+o+" of "+r,(n.position.x+10)*e.pixelDensityRatio,(n.position.y+50)*e.pixelDensityRatio),l.fillText("Size: "+n.size.toString(),(n.position.x+10)*e.pixelDensityRatio,(n.position.y+60)*e.pixelDensityRatio),l.fillText("Position: "+n.position.toString(),(n.position.x+10)*e.pixelDensityRatio,(n.position.y+70)*e.pixelDensityRatio),this.viewport.degrees!==0&&this._restoreRotationChanges(),s.getRotation(!0)%360!==0&&this._restoreRotationChanges(),s.viewport.degrees===0&&s.getRotation(!0)%360===0&&s._drawer.viewer.viewport.getFlip()&&s._drawer._flip(),l.restore()}},debugRect:function(n){if(this.useCanvas){var r=this.context;r.save(),r.lineWidth=2*e.pixelDensityRatio,r.strokeStyle=this.debugGridColor[0],r.fillStyle=this.debugGridColor[0],r.strokeRect(n.x*e.pixelDensityRatio,n.y*e.pixelDensityRatio,n.width*e.pixelDensityRatio,n.height*e.pixelDensityRatio),r.restore()}},setImageSmoothingEnabled:function(n){this.useCanvas&&(this._imageSmoothingEnabled=n,this._updateImageSmoothingEnabled(this.context),this.viewer.forceRedraw())},_updateImageSmoothingEnabled:function(n){n.msImageSmoothingEnabled=this._imageSmoothingEnabled,n.imageSmoothingEnabled=this._imageSmoothingEnabled},getCanvasSize:function(n){var r=this._getContext(n).canvas;return new e.Point(r.width,r.height)},getCanvasCenter:function(){return new e.Point(this.canvas.width/2,this.canvas.height/2)},_offsetForRotation:function(n){var r=n.point?n.point.times(e.pixelDensityRatio):this.getCanvasCenter(),o=this._getContext(n.useSketch);o.save(),o.translate(r.x,r.y),this.viewer.viewport.flipped?(o.rotate(Math.PI/180*-n.degrees),o.scale(-1,1)):o.rotate(Math.PI/180*n.degrees),o.translate(-r.x,-r.y)},_flip:function(n){n=n||{};var r=n.point?n.point.times(e.pixelDensityRatio):this.getCanvasCenter(),o=this._getContext(n.useSketch);o.translate(r.x,0),o.scale(-1,1),o.translate(-r.x,0)},_restoreRotationChanges:function(n){var r=this._getContext(n);r.restore()},_calculateCanvasSize:function(){var n=e.pixelDensityRatio,r=this.viewport.getContainerSize();return{x:Math.round(r.x*n),y:Math.round(r.y*n)}},_calculateSketchCanvasSize:function(){var n=this._calculateCanvasSize();if(this.viewport.getRotation()===0)return n;var r=Math.ceil(Math.sqrt(n.x*n.x+n.y*n.y));return{x:r,y:r}}}}(t),function(e){e.Viewport=function(n){var r=arguments;r.length&&r[0]instanceof e.Point&&(n={containerSize:r[0],contentSize:r[1],config:r[2]}),n.config&&(e.extend(!0,n,n.config),delete n.config),this._margins=e.extend({left:0,top:0,right:0,bottom:0},n.margins||{}),delete n.margins,e.extend(!0,this,{containerSize:null,contentSize:null,zoomPoint:null,viewer:null,springStiffness:e.DEFAULT_SETTINGS.springStiffness,animationTime:e.DEFAULT_SETTINGS.animationTime,minZoomImageRatio:e.DEFAULT_SETTINGS.minZoomImageRatio,maxZoomPixelRatio:e.DEFAULT_SETTINGS.maxZoomPixelRatio,visibilityRatio:e.DEFAULT_SETTINGS.visibilityRatio,wrapHorizontal:e.DEFAULT_SETTINGS.wrapHorizontal,wrapVertical:e.DEFAULT_SETTINGS.wrapVertical,defaultZoomLevel:e.DEFAULT_SETTINGS.defaultZoomLevel,minZoomLevel:e.DEFAULT_SETTINGS.minZoomLevel,maxZoomLevel:e.DEFAULT_SETTINGS.maxZoomLevel,degrees:e.DEFAULT_SETTINGS.degrees,flipped:e.DEFAULT_SETTINGS.flipped,homeFillsViewer:e.DEFAULT_SETTINGS.homeFillsViewer},n),this._updateContainerInnerSize(),this.centerSpringX=new e.Spring({initial:0,springStiffness:this.springStiffness,animationTime:this.animationTime}),this.centerSpringY=new e.Spring({initial:0,springStiffness:this.springStiffness,animationTime:this.animationTime}),this.zoomSpring=new e.Spring({exponential:!0,initial:1,springStiffness:this.springStiffness,animationTime:this.animationTime}),this._oldCenterX=this.centerSpringX.current.value,this._oldCenterY=this.centerSpringY.current.value,this._oldZoom=this.zoomSpring.current.value,this._setContentBounds(new e.Rect(0,0,1,1),1),this.goHome(!0),this.update()},e.Viewport.prototype={resetContentSize:function(n){return e.console.assert(n,"[Viewport.resetContentSize] contentSize is required"),e.console.assert(n instanceof e.Point,"[Viewport.resetContentSize] contentSize must be an OpenSeadragon.Point"),e.console.assert(n.x>0,"[Viewport.resetContentSize] contentSize.x must be greater than 0"),e.console.assert(n.y>0,"[Viewport.resetContentSize] contentSize.y must be greater than 0"),this._setContentBounds(new e.Rect(0,0,1,n.y/n.x),n.x),this},setHomeBounds:function(n,r){e.console.error("[Viewport.setHomeBounds] this function is deprecated; The content bounds should not be set manually."),this._setContentBounds(n,r)},_setContentBounds:function(n,r){e.console.assert(n,"[Viewport._setContentBounds] bounds is required"),e.console.assert(n instanceof e.Rect,"[Viewport._setContentBounds] bounds must be an OpenSeadragon.Rect"),e.console.assert(n.width>0,"[Viewport._setContentBounds] bounds.width must be greater than 0"),e.console.assert(n.height>0,"[Viewport._setContentBounds] bounds.height must be greater than 0"),this._contentBoundsNoRotate=n.clone(),this._contentSizeNoRotate=this._contentBoundsNoRotate.getSize().times(r),this._contentBounds=n.rotate(this.degrees).getBoundingBox(),this._contentSize=this._contentBounds.getSize().times(r),this._contentAspectRatio=this._contentSize.x/this._contentSize.y,this.viewer&&this.viewer.raiseEvent("reset-size",{contentSize:this._contentSizeNoRotate.clone(),contentFactor:r,homeBounds:this._contentBoundsNoRotate.clone(),contentBounds:this._contentBounds.clone()})},getHomeZoom:function(){if(this.defaultZoomLevel)return this.defaultZoomLevel;var n=this._contentAspectRatio/this.getAspectRatio(),r;return this.homeFillsViewer?r=n>=1?n:1:r=n>=1?1:n,r/this._contentBounds.width},getHomeBounds:function(){return this.getHomeBoundsNoRotate().rotate(-this.getRotation())},getHomeBoundsNoRotate:function(){var n=this._contentBounds.getCenter(),r=1/this.getHomeZoom(),o=r/this.getAspectRatio();return new e.Rect(n.x-r/2,n.y-o/2,r,o)},goHome:function(n){return this.viewer&&this.viewer.raiseEvent("home",{immediately:n}),this.fitBounds(this.getHomeBounds(),n)},getMinZoom:function(){var n=this.getHomeZoom(),r=this.minZoomLevel?this.minZoomLevel:this.minZoomImageRatio*n;return r},getMaxZoom:function(){var n=this.maxZoomLevel;return n||(n=this._contentSize.x*this.maxZoomPixelRatio/this._containerInnerSize.x,n/=this._contentBounds.width),Math.max(n,this.getHomeZoom())},getAspectRatio:function(){return this._containerInnerSize.x/this._containerInnerSize.y},getContainerSize:function(){return new e.Point(this.containerSize.x,this.containerSize.y)},getMargins:function(){return e.extend({},this._margins)},setMargins:function(n){e.console.assert(e.type(n)==="object","[Viewport.setMargins] margins must be an object"),this._margins=e.extend({left:0,top:0,right:0,bottom:0},n),this._updateContainerInnerSize(),this.viewer&&this.viewer.forceRedraw()},getBounds:function(n){return this.getBoundsNoRotate(n).rotate(-this.getRotation())},getBoundsNoRotate:function(n){var r=this.getCenter(n),o=1/this.getZoom(n),s=o/this.getAspectRatio();return new e.Rect(r.x-o/2,r.y-s/2,o,s)},getBoundsWithMargins:function(n){return this.getBoundsNoRotateWithMargins(n).rotate(-this.getRotation(),this.getCenter(n))},getBoundsNoRotateWithMargins:function(n){var r=this.getBoundsNoRotate(n),o=this._containerInnerSize.x*this.getZoom(n);return r.x-=this._margins.left/o,r.y-=this._margins.top/o,r.width+=(this._margins.left+this._margins.right)/o,r.height+=(this._margins.top+this._margins.bottom)/o,r},getCenter:function(n){var r=new e.Point(this.centerSpringX.current.value,this.centerSpringY.current.value),o=new e.Point(this.centerSpringX.target.value,this.centerSpringY.target.value),s,a,l,u,c,h,d,g;return n?r:this.zoomPoint?(s=this.pixelFromPoint(this.zoomPoint,!0),a=this.getZoom(),l=1/a,u=l/this.getAspectRatio(),c=new e.Rect(r.x-l/2,r.y-u/2,l,u),h=this._pixelFromPoint(this.zoomPoint,c),d=h.minus(s),g=d.divide(this._containerInnerSize.x*a),o.plus(g)):o},getZoom:function(n){return n?this.zoomSpring.current.value:this.zoomSpring.target.value},_applyZoomConstraints:function(n){return Math.max(Math.min(n,this.getMaxZoom()),this.getMinZoom())},_applyBoundaryConstraints:function(n){var r=new e.Rect(n.x,n.y,n.width,n.height);if(!this.wrapHorizontal){var o=this.visibilityRatio*r.width,s=r.x+r.width,a=this._contentBoundsNoRotate.x+this._contentBoundsNoRotate.width,l=this._contentBoundsNoRotate.x-s+o,u=a-r.x-o;o>this._contentBoundsNoRotate.width?r.x+=(l+u)/2:u<0?r.x+=u:l>0&&(r.x+=l)}if(!this.wrapVertical){var c=this.visibilityRatio*r.height,h=r.y+r.height,d=this._contentBoundsNoRotate.y+this._contentBoundsNoRotate.height,g=this._contentBoundsNoRotate.y-h+c,y=d-r.y-c;c>this._contentBoundsNoRotate.height?r.y+=(g+y)/2:y<0?r.y+=y:g>0&&(r.y+=g)}return r},_raiseConstraintsEvent:function(n){this.viewer&&this.viewer.raiseEvent("constrain",{immediately:n})},applyConstraints:function(n){var r=this.getZoom(),o=this._applyZoomConstraints(r);r!==o&&this.zoomTo(o,this.zoomPoint,n);var s=this.getBoundsNoRotate(),a=this._applyBoundaryConstraints(s);return this._raiseConstraintsEvent(n),(s.x!==a.x||s.y!==a.y||n)&&this.fitBounds(a.rotate(-this.getRotation()),n),this},ensureVisible:function(n){return this.applyConstraints(n)},_fitBounds:function(n,r){r=r||{};var o=r.immediately||!1,s=r.constraints||!1,a=this.getAspectRatio(),l=n.getCenter(),u=new e.Rect(n.x,n.y,n.width,n.height,n.degrees+this.getRotation()).getBoundingBox();u.getAspectRatio()>=a?u.height=u.width/a:u.width=u.height*a,u.x=l.x-u.width/2,u.y=l.y-u.height/2;var c=1/u.width;if(s){var h=u.getAspectRatio(),d=this._applyZoomConstraints(c);c!==d&&(c=d,u.width=1/c,u.x=l.x-u.width/2,u.height=u.width/h,u.y=l.y-u.height/2),u=this._applyBoundaryConstraints(u),l=u.getCenter(),this._raiseConstraintsEvent(o)}if(o)return this.panTo(l,!0),this.zoomTo(c,null,!0);this.panTo(this.getCenter(!0),!0),this.zoomTo(this.getZoom(!0),null,!0);var g=this.getBounds(),y=this.getZoom();if(y===0||Math.abs(c/y-1)<1e-8)return this.zoomTo(c,!0),this.panTo(l,o);u=u.rotate(-this.getRotation());var x=u.getTopLeft().times(c).minus(g.getTopLeft().times(y)).divide(c-y);return this.zoomTo(c,x,o)},fitBounds:function(n,r){return this._fitBounds(n,{immediately:r,constraints:!1})},fitBoundsWithConstraints:function(n,r){return this._fitBounds(n,{immediately:r,constraints:!0})},fitVertically:function(n){var r=new e.Rect(this._contentBounds.x+this._contentBounds.width/2,this._contentBounds.y,0,this._contentBounds.height);return this.fitBounds(r,n)},fitHorizontally:function(n){var r=new e.Rect(this._contentBounds.x,this._contentBounds.y+this._contentBounds.height/2,this._contentBounds.width,0);return this.fitBounds(r,n)},getConstrainedBounds:function(n){var r,o;return r=this.getBounds(n),o=this._applyBoundaryConstraints(r),o},panBy:function(n,r){var o=new e.Point(this.centerSpringX.target.value,this.centerSpringY.target.value);return this.panTo(o.plus(n),r)},panTo:function(n,r){return r?(this.centerSpringX.resetTo(n.x),this.centerSpringY.resetTo(n.y)):(this.centerSpringX.springTo(n.x),this.centerSpringY.springTo(n.y)),this.viewer&&this.viewer.raiseEvent("pan",{center:n,immediately:r}),this},zoomBy:function(n,r,o){return this.zoomTo(this.zoomSpring.target.value*n,r,o)},zoomTo:function(n,r,o){var s=this;return this.zoomPoint=r instanceof e.Point&&!isNaN(r.x)&&!isNaN(r.y)?r:null,o?this._adjustCenterSpringsForZoomPoint(function(){s.zoomSpring.resetTo(n)}):this.zoomSpring.springTo(n),this.viewer&&this.viewer.raiseEvent("zoom",{zoom:n,refPoint:r,immediately:o}),this},setRotation:function(n){return!this.viewer||!this.viewer.drawer.canRotate()?this:(this.degrees=e.positiveModulo(n,360),this._setContentBounds(this.viewer.world.getHomeBounds(),this.viewer.world.getContentFactor()),this.viewer.forceRedraw(),this.viewer.raiseEvent("rotate",{degrees:n}),this)},getRotation:function(){return this.degrees},resize:function(n,r){var o=this.getBoundsNoRotate(),s=o,a;return this.containerSize.x=n.x,this.containerSize.y=n.y,this._updateContainerInnerSize(),r&&(a=n.x/this.containerSize.x,s.width=o.width*a,s.height=s.width/this.getAspectRatio()),this.viewer&&this.viewer.raiseEvent("resize",{newContainerSize:n,maintain:r}),this.fitBounds(s,!0)},_updateContainerInnerSize:function(){this._containerInnerSize=new e.Point(Math.max(1,this.containerSize.x-(this._margins.left+this._margins.right)),Math.max(1,this.containerSize.y-(this._margins.top+this._margins.bottom)))},update:function(){var n=this;this._adjustCenterSpringsForZoomPoint(function(){n.zoomSpring.update()}),this.centerSpringX.update(),this.centerSpringY.update();var r=this.centerSpringX.current.value!==this._oldCenterX||this.centerSpringY.current.value!==this._oldCenterY||this.zoomSpring.current.value!==this._oldZoom;return this._oldCenterX=this.centerSpringX.current.value,this._oldCenterY=this.centerSpringY.current.value,this._oldZoom=this.zoomSpring.current.value,r},_adjustCenterSpringsForZoomPoint:function(n){if(this.zoomPoint){var r=this.pixelFromPoint(this.zoomPoint,!0);n();var o=this.pixelFromPoint(this.zoomPoint,!0),s=o.minus(r),a=this.deltaPointsFromPixels(s,!0);this.centerSpringX.shiftBy(a.x),this.centerSpringY.shiftBy(a.y),this.zoomSpring.isAtTargetValue()&&(this.zoomPoint=null)}else n()},deltaPixelsFromPointsNoRotate:function(n,r){return n.times(this._containerInnerSize.x*this.getZoom(r))},deltaPixelsFromPoints:function(n,r){return this.deltaPixelsFromPointsNoRotate(n.rotate(this.getRotation()),r)},deltaPointsFromPixelsNoRotate:function(n,r){return n.divide(this._containerInnerSize.x*this.getZoom(r))},deltaPointsFromPixels:function(n,r){return this.deltaPointsFromPixelsNoRotate(n,r).rotate(-this.getRotation())},pixelFromPointNoRotate:function(n,r){return this._pixelFromPointNoRotate(n,this.getBoundsNoRotate(r))},pixelFromPoint:function(n,r){return this._pixelFromPoint(n,this.getBoundsNoRotate(r))},_pixelFromPointNoRotate:function(n,r){return n.minus(r.getTopLeft()).times(this._containerInnerSize.x/r.width).plus(new e.Point(this._margins.left,this._margins.top))},_pixelFromPoint:function(n,r){return this._pixelFromPointNoRotate(n.rotate(this.getRotation(),this.getCenter(!0)),r)},pointFromPixelNoRotate:function(n,r){var o=this.getBoundsNoRotate(r);return n.minus(new e.Point(this._margins.left,this._margins.top)).divide(this._containerInnerSize.x/o.width).plus(o.getTopLeft())},pointFromPixel:function(n,r){return this.pointFromPixelNoRotate(n,r).rotate(-this.getRotation(),this.getCenter(!0))},_viewportToImageDelta:function(n,r){var o=this._contentBoundsNoRotate.width;return new e.Point(n*this._contentSizeNoRotate.x/o,r*this._contentSizeNoRotate.x/o)},viewportToImageCoordinates:function(n,r){if(n instanceof e.Point)return this.viewportToImageCoordinates(n.x,n.y);if(this.viewer){var o=this.viewer.world.getItemCount();if(o>1)e.console.error("[Viewport.viewportToImageCoordinates] is not accurate with multi-image; use TiledImage.viewportToImageCoordinates instead.");else if(o===1){var s=this.viewer.world.getItemAt(0);return s.viewportToImageCoordinates(n,r,!0)}}return this._viewportToImageDelta(n-this._contentBoundsNoRotate.x,r-this._contentBoundsNoRotate.y)},_imageToViewportDelta:function(n,r){var o=this._contentBoundsNoRotate.width;return new e.Point(n/this._contentSizeNoRotate.x*o,r/this._contentSizeNoRotate.x*o)},imageToViewportCoordinates:function(n,r){if(n instanceof e.Point)return this.imageToViewportCoordinates(n.x,n.y);if(this.viewer){var o=this.viewer.world.getItemCount();if(o>1)e.console.error("[Viewport.imageToViewportCoordinates] is not accurate with multi-image; use TiledImage.imageToViewportCoordinates instead.");else if(o===1){var s=this.viewer.world.getItemAt(0);return s.imageToViewportCoordinates(n,r,!0)}}var a=this._imageToViewportDelta(n,r);return a.x+=this._contentBoundsNoRotate.x,a.y+=this._contentBoundsNoRotate.y,a},imageToViewportRectangle:function(n,r,o,s){var a=n;if(a instanceof e.Rect||(a=new e.Rect(n,r,o,s)),this.viewer){var l=this.viewer.world.getItemCount();if(l>1)e.console.error("[Viewport.imageToViewportRectangle] is not accurate with multi-image; use TiledImage.imageToViewportRectangle instead.");else if(l===1){var u=this.viewer.world.getItemAt(0);return u.imageToViewportRectangle(n,r,o,s,!0)}}var c=this.imageToViewportCoordinates(a.x,a.y),h=this._imageToViewportDelta(a.width,a.height);return new e.Rect(c.x,c.y,h.x,h.y,a.degrees)},viewportToImageRectangle:function(n,r,o,s){var a=n;if(a instanceof e.Rect||(a=new e.Rect(n,r,o,s)),this.viewer){var l=this.viewer.world.getItemCount();if(l>1)e.console.error("[Viewport.viewportToImageRectangle] is not accurate with multi-image; use TiledImage.viewportToImageRectangle instead.");else if(l===1){var u=this.viewer.world.getItemAt(0);return u.viewportToImageRectangle(n,r,o,s,!0)}}var c=this.viewportToImageCoordinates(a.x,a.y),h=this._viewportToImageDelta(a.width,a.height);return new e.Rect(c.x,c.y,h.x,h.y,a.degrees)},viewerElementToImageCoordinates:function(n){var r=this.pointFromPixel(n,!0);return this.viewportToImageCoordinates(r)},imageToViewerElementCoordinates:function(n){var r=this.imageToViewportCoordinates(n);return this.pixelFromPoint(r,!0)},windowToImageCoordinates:function(n){e.console.assert(this.viewer,"[Viewport.windowToImageCoordinates] the viewport must have a viewer.");var r=n.minus(e.getElementPosition(this.viewer.element));return this.viewerElementToImageCoordinates(r)},imageToWindowCoordinates:function(n){e.console.assert(this.viewer,"[Viewport.imageToWindowCoordinates] the viewport must have a viewer.");var r=this.imageToViewerElementCoordinates(n);return r.plus(e.getElementPosition(this.viewer.element))},viewerElementToViewportCoordinates:function(n){return this.pointFromPixel(n,!0)},viewportToViewerElementCoordinates:function(n){return this.pixelFromPoint(n,!0)},viewerElementToViewportRectangle:function(n){return e.Rect.fromSummits(this.pointFromPixel(n.getTopLeft(),!0),this.pointFromPixel(n.getTopRight(),!0),this.pointFromPixel(n.getBottomLeft(),!0))},viewportToViewerElementRectangle:function(n){return e.Rect.fromSummits(this.pixelFromPoint(n.getTopLeft(),!0),this.pixelFromPoint(n.getTopRight(),!0),this.pixelFromPoint(n.getBottomLeft(),!0))},windowToViewportCoordinates:function(n){e.console.assert(this.viewer,"[Viewport.windowToViewportCoordinates] the viewport must have a viewer.");var r=n.minus(e.getElementPosition(this.viewer.element));return this.viewerElementToViewportCoordinates(r)},viewportToWindowCoordinates:function(n){e.console.assert(this.viewer,"[Viewport.viewportToWindowCoordinates] the viewport must have a viewer.");var r=this.viewportToViewerElementCoordinates(n);return r.plus(e.getElementPosition(this.viewer.element))},viewportToImageZoom:function(n){if(this.viewer){var r=this.viewer.world.getItemCount();if(r>1)e.console.error("[Viewport.viewportToImageZoom] is not accurate with multi-image.");else if(r===1){var o=this.viewer.world.getItemAt(0);return o.viewportToImageZoom(n)}}var s=this._contentSizeNoRotate.x,a=this._containerInnerSize.x,l=this._contentBoundsNoRotate.width,u=a/s*l;return n*u},imageToViewportZoom:function(n){if(this.viewer){var r=this.viewer.world.getItemCount();if(r>1)e.console.error("[Viewport.imageToViewportZoom] is not accurate with multi-image.");else if(r===1){var o=this.viewer.world.getItemAt(0);return o.imageToViewportZoom(n)}}var s=this._contentSizeNoRotate.x,a=this._containerInnerSize.x,l=this._contentBoundsNoRotate.width,u=s/a/l;return n*u},toggleFlip:function(){return this.setFlip(!this.getFlip()),this},getFlip:function(){return this.flipped},setFlip:function(n){return this.flipped===n?this:(this.flipped=n,this.viewer.navigator&&this.viewer.navigator.setFlip(this.getFlip()),this.viewer.forceRedraw(),this.viewer.raiseEvent("flip",{flipped:n}),this)}}}(t),function(e){e.TiledImage=function(f){var E=this;e.console.assert(f.tileCache,"[TiledImage] options.tileCache is required"),e.console.assert(f.drawer,"[TiledImage] options.drawer is required"),e.console.assert(f.viewer,"[TiledImage] options.viewer is required"),e.console.assert(f.imageLoader,"[TiledImage] options.imageLoader is required"),e.console.assert(f.source,"[TiledImage] options.source is required"),e.console.assert(!f.clip||f.clip instanceof e.Rect,"[TiledImage] options.clip must be an OpenSeadragon.Rect if present"),e.EventSource.call(this),this._tileCache=f.tileCache,delete f.tileCache,this._drawer=f.drawer,delete f.drawer,this._imageLoader=f.imageLoader,delete f.imageLoader,f.clip instanceof e.Rect&&(this._clip=f.clip.clone()),delete f.clip;var A=f.x||0;delete f.x;var C=f.y||0;delete f.y,this.normHeight=f.source.dimensions.y/f.source.dimensions.x,this.contentAspectX=f.source.dimensions.x/f.source.dimensions.y;var O=1;f.width?(O=f.width,delete f.width,f.height&&(e.console.error("specifying both width and height to a tiledImage is not supported"),delete f.height)):f.height&&(O=f.height/this.normHeight,delete f.height);var D=f.fitBounds;delete f.fitBounds;var I=f.fitBoundsPlacement||t.Placement.CENTER;delete f.fitBoundsPlacement;var B=f.degrees||0;delete f.degrees,e.extend(!0,this,{viewer:null,tilesMatrix:{},coverage:{},loadingCoverage:{},lastDrawn:[],lastResetTime:0,_midDraw:!1,_needsDraw:!0,_hasOpaqueTile:!1,_tilesLoading:0,springStiffness:e.DEFAULT_SETTINGS.springStiffness,animationTime:e.DEFAULT_SETTINGS.animationTime,minZoomImageRatio:e.DEFAULT_SETTINGS.minZoomImageRatio,wrapHorizontal:e.DEFAULT_SETTINGS.wrapHorizontal,wrapVertical:e.DEFAULT_SETTINGS.wrapVertical,immediateRender:e.DEFAULT_SETTINGS.immediateRender,blendTime:e.DEFAULT_SETTINGS.blendTime,alwaysBlend:e.DEFAULT_SETTINGS.alwaysBlend,minPixelRatio:e.DEFAULT_SETTINGS.minPixelRatio,smoothTileEdgesMinZoom:e.DEFAULT_SETTINGS.smoothTileEdgesMinZoom,iOSDevice:e.DEFAULT_SETTINGS.iOSDevice,debugMode:e.DEFAULT_SETTINGS.debugMode,crossOriginPolicy:e.DEFAULT_SETTINGS.crossOriginPolicy,ajaxWithCredentials:e.DEFAULT_SETTINGS.ajaxWithCredentials,placeholderFillStyle:e.DEFAULT_SETTINGS.placeholderFillStyle,opacity:e.DEFAULT_SETTINGS.opacity,preload:e.DEFAULT_SETTINGS.preload,compositeOperation:e.DEFAULT_SETTINGS.compositeOperation},f),this._preload=this.preload,delete this.preload,this._fullyLoaded=!1,this._xSpring=new e.Spring({initial:A,springStiffness:this.springStiffness,animationTime:this.animationTime}),this._ySpring=new e.Spring({initial:C,springStiffness:this.springStiffness,animationTime:this.animationTime}),this._scaleSpring=new e.Spring({initial:O,springStiffness:this.springStiffness,animationTime:this.animationTime}),this._degreesSpring=new e.Spring({initial:B,springStiffness:this.springStiffness,animationTime:this.animationTime}),this._updateForScale(),D&&this.fitBounds(D,I,!0),this._drawingHandler=function(Z){E.viewer.raiseEvent("tile-drawing",e.extend({tiledImage:E},Z))}},e.extend(e.TiledImage.prototype,e.EventSource.prototype,{needsDraw:function(){return this._needsDraw},getFullyLoaded:function(){return this._fullyLoaded},_setFullyLoaded:function(f){f!==this._fullyLoaded&&(this._fullyLoaded=f,this.raiseEvent("fully-loaded-change",{fullyLoaded:this._fullyLoaded}))},reset:function(){this._tileCache.clearTilesFor(this),this.lastResetTime=e.now(),this._needsDraw=!0},update:function(){var f=this._xSpring.update(),E=this._ySpring.update(),A=this._scaleSpring.update(),C=this._degreesSpring.update();return f||E||A||C?(this._updateForScale(),this._needsDraw=!0,!0):!1},draw:function(){this.opacity!==0||this._preload?(this._midDraw=!0,this._updateViewport(),this._midDraw=!1):this._needsDraw=!1},destroy:function(){this.reset(),this.source.destroy&&this.source.destroy()},getBounds:function(f){return this.getBoundsNoRotate(f).rotate(this.getRotation(f),this._getRotationPoint(f))},getBoundsNoRotate:function(f){return f?new e.Rect(this._xSpring.current.value,this._ySpring.current.value,this._worldWidthCurrent,this._worldHeightCurrent):new e.Rect(this._xSpring.target.value,this._ySpring.target.value,this._worldWidthTarget,this._worldHeightTarget)},getWorldBounds:function(){return e.console.error("[TiledImage.getWorldBounds] is deprecated; use TiledImage.getBounds instead"),this.getBounds()},getClippedBounds:function(f){var E=this.getBoundsNoRotate(f);if(this._clip){var A=f?this._worldWidthCurrent:this._worldWidthTarget,C=A/this.source.dimensions.x,O=this._clip.times(C);E=new e.Rect(E.x+O.x,E.y+O.y,O.width,O.height)}return E.rotate(this.getRotation(f),this._getRotationPoint(f))},getTileBounds:function(f,E,A){var C=this.source.getNumTiles(f),O=(C.x+E%C.x)%C.x,D=(C.y+A%C.y)%C.y,I=this.source.getTileBounds(f,O,D);return this.getFlip()&&(I.x=1-I.x-I.width),I.x+=(E-O)/C.x,I.y+=this._worldHeightCurrent/this._worldWidthCurrent*((A-D)/C.y),I},getContentSize:function(){return new e.Point(this.source.dimensions.x,this.source.dimensions.y)},getSizeInWindowCoordinates:function(){var f=this.imageToWindowCoordinates(new e.Point(0,0)),E=this.imageToWindowCoordinates(this.getContentSize());return new e.Point(E.x-f.x,E.y-f.y)},_viewportToImageDelta:function(f,E,A){var C=A?this._scaleSpring.current.value:this._scaleSpring.target.value;return new e.Point(f*(this.source.dimensions.x/C),E*(this.source.dimensions.y*this.contentAspectX/C))},viewportToImageCoordinates:function(f,E,A){var C;return f instanceof e.Point?(A=E,C=f):C=new e.Point(f,E),C=C.rotate(-this.getRotation(A),this._getRotationPoint(A)),A?this._viewportToImageDelta(C.x-this._xSpring.current.value,C.y-this._ySpring.current.value):this._viewportToImageDelta(C.x-this._xSpring.target.value,C.y-this._ySpring.target.value)},_imageToViewportDelta:function(f,E,A){var C=A?this._scaleSpring.current.value:this._scaleSpring.target.value;return new e.Point(f/this.source.dimensions.x*C,E/this.source.dimensions.y/this.contentAspectX*C)},imageToViewportCoordinates:function(f,E,A){f instanceof e.Point&&(A=E,E=f.y,f=f.x);var C=this._imageToViewportDelta(f,E);return A?(C.x+=this._xSpring.current.value,C.y+=this._ySpring.current.value):(C.x+=this._xSpring.target.value,C.y+=this._ySpring.target.value),C.rotate(this.getRotation(A),this._getRotationPoint(A))},imageToViewportRectangle:function(f,E,A,C,O){var D=f;D instanceof e.Rect?O=E:D=new e.Rect(f,E,A,C);var I=this.imageToViewportCoordinates(D.getTopLeft(),O),B=this._imageToViewportDelta(D.width,D.height,O);return new e.Rect(I.x,I.y,B.x,B.y,D.degrees+this.getRotation(O))},viewportToImageRectangle:function(f,E,A,C,O){var D=f;f instanceof e.Rect?O=E:D=new e.Rect(f,E,A,C);var I=this.viewportToImageCoordinates(D.getTopLeft(),O),B=this._viewportToImageDelta(D.width,D.height,O);return new e.Rect(I.x,I.y,B.x,B.y,D.degrees-this.getRotation(O))},viewerElementToImageCoordinates:function(f){var E=this.viewport.pointFromPixel(f,!0);return this.viewportToImageCoordinates(E)},imageToViewerElementCoordinates:function(f){var E=this.imageToViewportCoordinates(f);return this.viewport.pixelFromPoint(E,!0)},windowToImageCoordinates:function(f){var E=f.minus(t.getElementPosition(this.viewer.element));return this.viewerElementToImageCoordinates(E)},imageToWindowCoordinates:function(f){var E=this.imageToViewerElementCoordinates(f);return E.plus(t.getElementPosition(this.viewer.element))},_viewportToTiledImageRectangle:function(f){var E=this._scaleSpring.current.value;return f=f.rotate(-this.getRotation(!0),this._getRotationPoint(!0)),new e.Rect((f.x-this._xSpring.current.value)/E,(f.y-this._ySpring.current.value)/E,f.width/E,f.height/E,f.degrees)},viewportToImageZoom:function(f){var E=this._scaleSpring.current.value*this.viewport._containerInnerSize.x/this.source.dimensions.x;return E*f},imageToViewportZoom:function(f){var E=this._scaleSpring.current.value*this.viewport._containerInnerSize.x/this.source.dimensions.x;return f/E},setPosition:function(f,E){var A=this._xSpring.target.value===f.x&&this._ySpring.target.value===f.y;if(E){if(A&&this._xSpring.current.value===f.x&&this._ySpring.current.value===f.y)return;this._xSpring.resetTo(f.x),this._ySpring.resetTo(f.y),this._needsDraw=!0}else{if(A)return;this._xSpring.springTo(f.x),this._ySpring.springTo(f.y),this._needsDraw=!0}A||this._raiseBoundsChange()},setWidth:function(f,E){this._setScale(f,E)},setHeight:function(f,E){this._setScale(f/this.normHeight,E)},setCroppingPolygons:function(f){var E=function(C){return C instanceof e.Point||typeof C.x=="number"&&typeof C.y=="number"},A=function(C){return C.map(function(O){try{if(E(O))return{x:O.x,y:O.y};throw new Error}catch{throw new Error("A Provided cropping polygon point is not supported")}})};try{if(!e.isArray(f))throw new Error("Provided cropping polygon is not an array");this._croppingPolygons=f.map(function(C){return A(C)})}catch(C){e.console.error("[TiledImage.setCroppingPolygons] Cropping polygon format not supported"),e.console.error(C),this._croppingPolygons=null}},resetCroppingPolygons:function(){this._croppingPolygons=null},fitBounds:function(f,E,A){E=E||e.Placement.CENTER;var C=e.Placement.properties[E],O=this.contentAspectX,D=0,I=0,B=1,Z=1;if(this._clip&&(O=this._clip.getAspectRatio(),B=this._clip.width/this.source.dimensions.x,Z=this._clip.height/this.source.dimensions.y,f.getAspectRatio()>O?(D=this._clip.x/this._clip.height*f.height,I=this._clip.y/this._clip.height*f.height):(D=this._clip.x/this._clip.width*f.width,I=this._clip.y/this._clip.width*f.width)),f.getAspectRatio()>O){var Y=f.height/Z,V=0;C.isHorizontallyCentered?V=(f.width-f.height*O)/2:C.isRight&&(V=f.width-f.height*O),this.setPosition(new e.Point(f.x-D+V,f.y-I),A),this.setHeight(Y,A)}else{var K=f.width/B,Q=0;C.isVerticallyCentered?Q=(f.height-f.width/O)/2:C.isBottom&&(Q=f.height-f.width/O),this.setPosition(new e.Point(f.x-D,f.y-I+Q),A),this.setWidth(K,A)}},getClip:function(){return this._clip?this._clip.clone():null},setClip:function(f){e.console.assert(!f||f instanceof e.Rect,"[TiledImage.setClip] newClip must be an OpenSeadragon.Rect or null"),f instanceof e.Rect?this._clip=f.clone():this._clip=null,this._needsDraw=!0,this.raiseEvent("clip-change")},getFlip:function(){return!!this.flipped},setFlip:function(f){this.flipped=!!f,this._needsDraw=!0,this._raiseBoundsChange()},getOpacity:function(){return this.opacity},setOpacity:function(f){f!==this.opacity&&(this.opacity=f,this._needsDraw=!0,this.raiseEvent("opacity-change",{opacity:this.opacity}))},getPreload:function(){return this._preload},setPreload:function(f){this._preload=!!f,this._needsDraw=!0},getRotation:function(f){return f?this._degreesSpring.current.value:this._degreesSpring.target.value},setRotation:function(f,E){this._degreesSpring.target.value===f&&this._degreesSpring.isAtTargetValue()||(E?this._degreesSpring.resetTo(f):this._degreesSpring.springTo(f),this._needsDraw=!0,this._raiseBoundsChange())},_getRotationPoint:function(f){return this.getBoundsNoRotate(f).getCenter()},getCompositeOperation:function(){return this.compositeOperation},setCompositeOperation:function(f){f!==this.compositeOperation&&(this.compositeOperation=f,this._needsDraw=!0,this.raiseEvent("composite-operation-change",{compositeOperation:this.compositeOperation}))},_setScale:function(f,E){var A=this._scaleSpring.target.value===f;if(E){if(A&&this._scaleSpring.current.value===f)return;this._scaleSpring.resetTo(f),this._updateForScale(),this._needsDraw=!0}else{if(A)return;this._scaleSpring.springTo(f),this._updateForScale(),this._needsDraw=!0}A||this._raiseBoundsChange()},_updateForScale:function(){this._worldWidthTarget=this._scaleSpring.target.value,this._worldHeightTarget=this.normHeight*this._scaleSpring.target.value,this._worldWidthCurrent=this._scaleSpring.current.value,this._worldHeightCurrent=this.normHeight*this._scaleSpring.current.value},_raiseBoundsChange:function(){this.raiseEvent("bounds-change")},_isBottomItem:function(){return this.viewer.world.getItemAt(0)===this},_getLevelsInterval:function(){var f=Math.max(this.source.minLevel,Math.floor(Math.log(this.minZoomImageRatio)/Math.log(2))),E=this.viewport.deltaPixelsFromPointsNoRotate(this.source.getPixelRatio(0),!0).x*this._scaleSpring.current.value,A=Math.min(Math.abs(this.source.maxLevel),Math.abs(Math.floor(Math.log(E/this.minPixelRatio)/Math.log(2))));return A=Math.max(A,this.source.minLevel||0),f=Math.min(f,A),{lowestLevel:f,highestLevel:A}},_updateViewport:function(){for(this._needsDraw=!1,this._tilesLoading=0,this.loadingCoverage={};this.lastDrawn.length>0;){var f=this.lastDrawn.pop();f.beingDrawn=!1}var E=this.viewport,A=this._viewportToTiledImageRectangle(E.getBoundsWithMargins(!0));if(!this.wrapHorizontal&&!this.wrapVertical){var C=this._viewportToTiledImageRectangle(this.getClippedBounds(!0));if(A=A.intersection(C),A===null)return}for(var O=this._getLevelsInterval(),D=O.lowestLevel,I=O.highestLevel,B=null,Z=!1,Y=e.now(),V=I;V>=D;V--){var K=!1,Q=E.deltaPixelsFromPointsNoRotate(this.source.getPixelRatio(V),!0).x*this._scaleSpring.current.value;if(V===D||!Z&&Q>=this.minPixelRatio)K=!0,Z=!0;else if(!Z)continue;var le=E.deltaPixelsFromPointsNoRotate(this.source.getPixelRatio(V),!1).x*this._scaleSpring.current.value,re=E.deltaPixelsFromPointsNoRotate(this.source.getPixelRatio(Math.max(this.source.getClosestLevel(),0)),!1).x*this._scaleSpring.current.value,se=this.immediateRender?1:re,de=Math.min(1,(Q-.5)/.5),pe=se/Math.abs(se-le);if(B=n(this,Z,K,V,de,pe,A,Y,B),h(this.coverage,V))break}b(this,this.lastDrawn),B&&!B.context2D?(s(this,B,Y),this._needsDraw=!0,this._setFullyLoaded(!1)):this._setFullyLoaded(this._tilesLoading===0)},_getCornerTiles:function(f,E,A){var C,O;this.wrapHorizontal?(C=e.positiveModulo(E.x,1),O=e.positiveModulo(A.x,1)):(C=Math.max(0,E.x),O=Math.min(1,A.x));var D,I,B=1/this.source.aspectRatio;this.wrapVertical?(D=e.positiveModulo(E.y,B),I=e.positiveModulo(A.y,B)):(D=Math.max(0,E.y),I=Math.min(B,A.y));var Z=this.source.getTileAtPoint(f,new e.Point(C,D)),Y=this.source.getTileAtPoint(f,new e.Point(O,I)),V=this.source.getNumTiles(f);return this.wrapHorizontal&&(Z.x+=V.x*Math.floor(E.x),Y.x+=V.x*Math.floor(A.x)),this.wrapVertical&&(Z.y+=V.y*Math.floor(E.y/B),Y.y+=V.y*Math.floor(A.y/B)),{topLeft:Z,bottomRight:Y}}});function n(f,E,A,C,O,D,I,B,Z){var Y=I.getBoundingBox().getTopLeft(),V=I.getBoundingBox().getBottomRight();f.viewer&&f.viewer.raiseEvent("update-level",{tiledImage:f,havedrawn:E,level:C,opacity:O,visibility:D,drawArea:I,topleft:Y,bottomright:V,currenttime:B,best:Z}),y(f.coverage,C),y(f.loadingCoverage,C);var K=f._getCornerTiles(C,Y,V),Q=K.topLeft,le=K.bottomRight,re=f.source.getNumTiles(C),se=f.viewport.pixelFromPoint(f.viewport.getCenter());f.getFlip()&&(le.x+=1,f.wrapHorizontal||(le.x=Math.min(le.x,re.x-1)));for(var de=Q.x;de<=le.x;de++)for(var pe=Q.y;pe<=le.y;pe++){var G;if(f.getFlip()){var Me=(re.x+de%re.x)%re.x;G=de+re.x-Me-Me-1}else G=de;I.intersection(f.getTileBounds(C,G,pe))!==null&&(Z=r(f,A,E,G,pe,C,O,D,se,re,B,Z))}return Z}function r(f,E,A,C,O,D,I,B,Z,Y,V,K){var Q=o(C,O,D,f,f.source,f.tilesMatrix,V,Y,f._worldWidthCurrent,f._worldHeightCurrent),le=A;f.viewer&&f.viewer.raiseEvent("update-tile",{tiledImage:f,tile:Q}),g(f.coverage,D,C,O,!1);var re=Q.loaded||Q.loading||d(f.loadingCoverage,D,C,O);if(g(f.loadingCoverage,D,C,O,re),!Q.exists||(E&&!le&&(d(f.coverage,D,C,O)?g(f.coverage,D,C,O,!0):le=!0),!le))return K;if(u(Q,f.source.tileOverlap,f.viewport,Z,B,f),!Q.loaded)if(Q.context2D)l(f,Q);else{var se=f._tileCache.getImageRecord(Q.cacheKey);if(se){var de=se.getImage();l(f,Q,de)}}if(Q.loaded){var pe=c(f,Q,C,O,D,I,V);pe&&(f._needsDraw=!0)}else Q.loading?f._tilesLoading++:re||(K=x(K,Q));return K}function o(f,E,A,C,O,D,I,B,Z,Y){var V,K,Q,le,re,se,de,pe,G;return D[A]||(D[A]={}),D[A][f]||(D[A][f]={}),(!D[A][f][E]||!D[A][f][E].flipped!=!C.flipped)&&(V=(B.x+f%B.x)%B.x,K=(B.y+E%B.y)%B.y,Q=C.getTileBounds(A,f,E),le=O.getTileBounds(A,V,K,!0),re=O.tileExists(A,V,K),se=O.getTileUrl(A,V,K),C.loadTilesWithAjax?(de=O.getTileAjaxHeaders(A,V,K),e.isPlainObject(C.ajaxHeaders)&&(de=e.extend({},C.ajaxHeaders,de))):de=null,pe=O.getContext2D?O.getContext2D(A,V,K):void 0,G=new e.Tile(A,f,E,Q,re,se,pe,C.loadTilesWithAjax,de,le),C.getFlip()?V===0&&(G.isRightMost=!0):V===B.x-1&&(G.isRightMost=!0),K===B.y-1&&(G.isBottomMost=!0),G.flipped=C.flipped,D[A][f][E]=G),G=D[A][f][E],G.lastTouchTime=I,G}function s(f,E,A){E.loading=!0,f._imageLoader.addJob({src:E.url,loadWithAjax:E.loadWithAjax,ajaxHeaders:E.ajaxHeaders,crossOriginPolicy:f.crossOriginPolicy,ajaxWithCredentials:f.ajaxWithCredentials,callback:function(C,O,D){a(f,E,A,C,O,D)},abort:function(){E.loading=!1}})}function a(f,E,A,C,O,D){if(!C){e.console.log("Tile %s failed to load: %s - error: %s",E,E.url,O),f.viewer.raiseEvent("tile-load-failed",{tile:E,tiledImage:f,time:A,message:O,tileRequest:D}),E.loading=!1,E.exists=!1;return}if(A<f.lastResetTime){e.console.log("Ignoring tile %s loaded before reset: %s",E,E.url),E.loading=!1;return}var I=function(){var B=f.source.getClosestLevel();l(f,E,C,B,D)};f._midDraw?window.setTimeout(I,1):I()}function l(f,E,A,C,O){var D=0;function I(){return D++,B}function B(){D--,D===0&&(E.loading=!1,E.loaded=!0,E.context2D||f._tileCache.cacheTile({image:A,tile:E,cutoff:C,tiledImage:f}),f._needsDraw=!0)}f.viewer.raiseEvent("tile-loaded",{tile:E,tiledImage:f,tileRequest:O,image:A,getCompletionCallback:I}),I()()}function u(f,E,A,C,O,D){var I=f.bounds.getTopLeft();I.x*=D._scaleSpring.current.value,I.y*=D._scaleSpring.current.value,I.x+=D._xSpring.current.value,I.y+=D._ySpring.current.value;var B=f.bounds.getSize();B.x*=D._scaleSpring.current.value,B.y*=D._scaleSpring.current.value;var Z=A.pixelFromPointNoRotate(I,!0),Y=A.pixelFromPointNoRotate(I,!1),V=A.deltaPixelsFromPointsNoRotate(B,!0),K=A.deltaPixelsFromPointsNoRotate(B,!1),Q=Y.plus(K.divide(2)),le=C.squaredDistanceTo(Q);E||(V=V.plus(new e.Point(1,1))),f.isRightMost&&D.wrapHorizontal&&(V.x+=.75),f.isBottomMost&&D.wrapVertical&&(V.y+=.75),f.position=Z,f.size=V,f.squaredDistance=le,f.visibility=O}function c(f,E,A,C,O,D,I){var B=1e3*f.blendTime,Z,Y;if(E.blendStart||(E.blendStart=I),Z=I-E.blendStart,Y=B?Math.min(1,Z/B):1,f.alwaysBlend&&(Y*=D),E.opacity=Y,f.lastDrawn.push(E),Y===1)g(f.coverage,O,A,C,!0),f._hasOpaqueTile=!0;else if(Z<B)return!0;return!1}function h(f,E,A,C){var O,D,I,B;if(!f[E])return!1;if(A===void 0||C===void 0){O=f[E];for(I in O)if(Object.prototype.hasOwnProperty.call(O,I)){D=O[I];for(B in D)if(Object.prototype.hasOwnProperty.call(D,B)&&!D[B])return!1}return!0}return f[E][A]===void 0||f[E][A][C]===void 0||f[E][A][C]===!0}function d(f,E,A,C){return A===void 0||C===void 0?h(f,E+1):h(f,E+1,2*A,2*C)&&h(f,E+1,2*A,2*C+1)&&h(f,E+1,2*A+1,2*C)&&h(f,E+1,2*A+1,2*C+1)}function g(f,E,A,C,O){if(!f[E]){e.console.warn("Setting coverage for a tile before its level's coverage has been reset: %s",E);return}f[E][A]||(f[E][A]={}),f[E][A][C]=O}function y(f,E){f[E]={}}function x(f,E){return!f||E.visibility>f.visibility||E.visibility===f.visibility&&E.squaredDistance<f.squaredDistance?E:f}function b(f,E){if(!(f.opacity===0||E.length===0&&!f.placeholderFillStyle)){var A=E[0],C;A&&(C=f.opacity<1||f.compositeOperation&&f.compositeOperation!=="source-over"||!f._isBottomItem()&&A._hasTransparencyChannel());var O,D,I=f.viewport.getZoom(!0),B=f.viewportToImageZoom(I);E.length>1&&B>f.smoothTileEdgesMinZoom&&!f.iOSDevice&&f.getRotation(!0)%360===0&&e.supportsCanvas&&(C=!0,O=A.getScaleForEdgeSmoothing(),D=A.getTranslationForEdgeSmoothing(O,f._drawer.getCanvasSize(!1),f._drawer.getCanvasSize(!0)));var Z;C&&(O||(Z=f.viewport.viewportToViewerElementRectangle(f.getClippedBounds(!0)).getIntegerBoundingBox(),f._drawer.viewer.viewport.getFlip()&&(f.viewport.degrees!==0||f.getRotation(!0)%360!==0)&&(Z.x=f._drawer.viewer.container.clientWidth-(Z.x+Z.width)),Z=Z.times(e.pixelDensityRatio)),f._drawer._clear(!0,Z)),O||(f.viewport.degrees!==0&&f._drawer._offsetForRotation({degrees:f.viewport.degrees,useSketch:C}),f.getRotation(!0)%360!==0&&f._drawer._offsetForRotation({degrees:f.getRotation(!0),point:f.viewport.pixelFromPointNoRotate(f._getRotationPoint(!0),!0),useSketch:C}),f.viewport.degrees===0&&f.getRotation(!0)%360===0&&f._drawer.viewer.viewport.getFlip()&&f._drawer._flip());var Y=!1;if(f._clip){f._drawer.saveContext(C);var V=f.imageToViewportRectangle(f._clip,!0);V=V.rotate(-f.getRotation(!0),f._getRotationPoint(!0));var K=f._drawer.viewportToDrawerRectangle(V);O&&(K=K.times(O)),D&&(K=K.translate(D)),f._drawer.setClip(K,C),Y=!0}if(f._croppingPolygons){f._drawer.saveContext(C);try{var Q=f._croppingPolygons.map(function(de){return de.map(function(pe){var G=f.imageToViewportCoordinates(pe.x,pe.y,!0).rotate(-f.getRotation(!0),f._getRotationPoint(!0)),Me=f._drawer.viewportCoordToDrawerCoord(G);return O&&(Me=Me.times(O)),Me})});f._drawer.clipWithPolygons(Q,C)}catch(de){e.console.error(de)}Y=!0}if(f.placeholderFillStyle&&f._hasOpaqueTile===!1){var le=f._drawer.viewportToDrawerRectangle(f.getBounds(!0));O&&(le=le.times(O)),D&&(le=le.translate(D));var re=null;typeof f.placeholderFillStyle=="function"?re=f.placeholderFillStyle(f,f._drawer.context):re=f.placeholderFillStyle,f._drawer.drawRectangle(le,re,C)}for(var se=E.length-1;se>=0;se--)A=E[se],f._drawer.drawTile(A,f._drawingHandler,C,O,D),A.beingDrawn=!0,f.viewer&&f.viewer.raiseEvent("tile-drawn",{tiledImage:f,tile:A});Y&&f._drawer.restoreContext(C),O||(f.getRotation(!0)%360!==0&&f._drawer._restoreRotationChanges(C),f.viewport.degrees!==0&&f._drawer._restoreRotationChanges(C)),C&&(O&&(f.viewport.degrees!==0&&f._drawer._offsetForRotation({degrees:f.viewport.degrees,useSketch:!1}),f.getRotation(!0)%360!==0&&f._drawer._offsetForRotation({degrees:f.getRotation(!0),point:f.viewport.pixelFromPointNoRotate(f._getRotationPoint(!0),!0),useSketch:!1})),f._drawer.blendSketch({opacity:f.opacity,scale:O,translate:D,compositeOperation:f.compositeOperation,bounds:Z}),O&&(f.getRotation(!0)%360!==0&&f._drawer._restoreRotationChanges(!1),f.viewport.degrees!==0&&f._drawer._restoreRotationChanges(!1))),O||f.viewport.degrees===0&&f.getRotation(!0)%360===0&&f._drawer.viewer.viewport.getFlip()&&f._drawer._flip(),T(f,E)}}function T(f,E){if(f.debugMode)for(var A=E.length-1;A>=0;A--){var C=E[A];try{f._drawer.drawDebugInfo(C,E.length,A,f)}catch(O){e.console.error(O)}}}}(t),function(e){var n=function(o){e.console.assert(o,"[TileCache.cacheTile] options is required"),e.console.assert(o.tile,"[TileCache.cacheTile] options.tile is required"),e.console.assert(o.tiledImage,"[TileCache.cacheTile] options.tiledImage is required"),this.tile=o.tile,this.tiledImage=o.tiledImage},r=function(o){e.console.assert(o,"[ImageRecord] options is required"),e.console.assert(o.image,"[ImageRecord] options.image is required"),this._image=o.image,this._tiles=[]};r.prototype={destroy:function(){this._image=null,this._renderedContext=null,this._tiles=null},getImage:function(){return this._image},getRenderedContext:function(){if(!this._renderedContext){var o=document.createElement("canvas");o.width=this._image.width,o.height=this._image.height,this._renderedContext=o.getContext("2d"),this._renderedContext.drawImage(this._image,0,0),this._image=null}return this._renderedContext},setRenderedContext:function(o){e.console.error("ImageRecord.setRenderedContext is deprecated. The rendered context should be created by the ImageRecord itself when calling ImageRecord.getRenderedContext."),this._renderedContext=o},addTile:function(o){e.console.assert(o,"[ImageRecord.addTile] tile is required"),this._tiles.push(o)},removeTile:function(o){for(var s=0;s<this._tiles.length;s++)if(this._tiles[s]===o){this._tiles.splice(s,1);return}e.console.warn("[ImageRecord.removeTile] trying to remove unknown tile",o)},getTileCount:function(){return this._tiles.length}},e.TileCache=function(o){o=o||{},this._maxImageCacheCount=o.maxImageCacheCount||e.DEFAULT_SETTINGS.maxImageCacheCount,this._tilesLoaded=[],this._imagesLoaded=[],this._imagesLoadedCount=0},e.TileCache.prototype={numTilesLoaded:function(){return this._tilesLoaded.length},cacheTile:function(o){e.console.assert(o,"[TileCache.cacheTile] options is required"),e.console.assert(o.tile,"[TileCache.cacheTile] options.tile is required"),e.console.assert(o.tile.cacheKey,"[TileCache.cacheTile] options.tile.cacheKey is required"),e.console.assert(o.tiledImage,"[TileCache.cacheTile] options.tiledImage is required");var s=o.cutoff||0,a=this._tilesLoaded.length,l=this._imagesLoaded[o.tile.cacheKey];if(l||(e.console.assert(o.image,"[TileCache.cacheTile] options.image is required to create an ImageRecord"),l=this._imagesLoaded[o.tile.cacheKey]=new r({image:o.image}),this._imagesLoadedCount++),l.addTile(o.tile),o.tile.cacheImageRecord=l,this._imagesLoadedCount>this._maxImageCacheCount){for(var u=null,c=-1,h=null,d,g,y,x,b,T,f=this._tilesLoaded.length-1;f>=0;f--)if(T=this._tilesLoaded[f],d=T.tile,!(d.level<=s||d.beingDrawn)){if(!u){u=d,c=f,h=T;continue}x=d.lastTouchTime,g=u.lastTouchTime,b=d.level,y=u.level,(x<g||x===g&&b>y)&&(u=d,c=f,h=T)}u&&c>=0&&(this._unloadTile(h),a=c)}this._tilesLoaded[a]=new n({tile:o.tile,tiledImage:o.tiledImage})},clearTilesFor:function(o){e.console.assert(o,"[TileCache.clearTilesFor] tiledImage is required");for(var s,a=0;a<this._tilesLoaded.length;++a)s=this._tilesLoaded[a],s.tiledImage===o&&(this._unloadTile(s),this._tilesLoaded.splice(a,1),a--)},getImageRecord:function(o){return e.console.assert(o,"[TileCache.getImageRecord] cacheKey is required"),this._imagesLoaded[o]},_unloadTile:function(o){e.console.assert(o,"[TileCache._unloadTile] tileRecord is required");var s=o.tile,a=o.tiledImage;s.unload(),s.cacheImageRecord=null;var l=this._imagesLoaded[s.cacheKey];l.removeTile(s),l.getTileCount()||(l.destroy(),delete this._imagesLoaded[s.cacheKey],this._imagesLoadedCount--),a.viewer.raiseEvent("tile-unloaded",{tile:s,tiledImage:a})}}}(t),function(e){e.World=function(n){var r=this;e.console.assert(n.viewer,"[World] options.viewer is required"),e.EventSource.call(this),this.viewer=n.viewer,this._items=[],this._needsDraw=!1,this._autoRefigureSizes=!0,this._needsSizesFigured=!1,this._delegatedFigureSizes=function(o){r._autoRefigureSizes?r._figureSizes():r._needsSizesFigured=!0},this._figureSizes()},e.extend(e.World.prototype,e.EventSource.prototype,{addItem:function(n,r){if(e.console.assert(n,"[World.addItem] item is required"),e.console.assert(n instanceof e.TiledImage,"[World.addItem] only TiledImages supported at this time"),r=r||{},r.index!==void 0){var o=Math.max(0,Math.min(this._items.length,r.index));this._items.splice(o,0,n)}else this._items.push(n);this._autoRefigureSizes?this._figureSizes():this._needsSizesFigured=!0,this._needsDraw=!0,n.addHandler("bounds-change",this._delegatedFigureSizes),n.addHandler("clip-change",this._delegatedFigureSizes),this.raiseEvent("add-item",{item:n})},getItemAt:function(n){return e.console.assert(n!==void 0,"[World.getItemAt] index is required"),this._items[n]},getIndexOfItem:function(n){return e.console.assert(n,"[World.getIndexOfItem] item is required"),e.indexOf(this._items,n)},getItemCount:function(){return this._items.length},setItemIndex:function(n,r){e.console.assert(n,"[World.setItemIndex] item is required"),e.console.assert(r!==void 0,"[World.setItemIndex] index is required");var o=this.getIndexOfItem(n);if(r>=this._items.length)throw new Error("Index bigger than number of layers.");r===o||o===-1||(this._items.splice(o,1),this._items.splice(r,0,n),this._needsDraw=!0,this.raiseEvent("item-index-change",{item:n,previousIndex:o,newIndex:r}))},removeItem:function(n){e.console.assert(n,"[World.removeItem] item is required");var r=e.indexOf(this._items,n);r!==-1&&(n.removeHandler("bounds-change",this._delegatedFigureSizes),n.removeHandler("clip-change",this._delegatedFigureSizes),n.destroy(),this._items.splice(r,1),this._figureSizes(),this._needsDraw=!0,this._raiseRemoveItem(n))},removeAll:function(){this.viewer._cancelPendingImages();var n,r;for(r=0;r<this._items.length;r++)n=this._items[r],n.removeHandler("bounds-change",this._delegatedFigureSizes),n.removeHandler("clip-change",this._delegatedFigureSizes),n.destroy();var o=this._items;for(this._items=[],this._figureSizes(),this._needsDraw=!0,r=0;r<o.length;r++)n=o[r],this._raiseRemoveItem(n)},resetItems:function(){for(var n=0;n<this._items.length;n++)this._items[n].reset()},update:function(){for(var n=!1,r=0;r<this._items.length;r++)n=this._items[r].update()||n;return n},draw:function(){for(var n=0;n<this._items.length;n++)this._items[n].draw();this._needsDraw=!1},needsDraw:function(){for(var n=0;n<this._items.length;n++)if(this._items[n].needsDraw())return!0;return this._needsDraw},getHomeBounds:function(){return this._homeBounds.clone()},getContentFactor:function(){return this._contentFactor},setAutoRefigureSizes:function(n){this._autoRefigureSizes=n,n&this._needsSizesFigured&&(this._figureSizes(),this._needsSizesFigured=!1)},arrange:function(n){n=n||{};var r=n.immediately||!1,o=n.layout||e.DEFAULT_SETTINGS.collectionLayout,s=n.rows||e.DEFAULT_SETTINGS.collectionRows,a=n.columns||e.DEFAULT_SETTINGS.collectionColumns,l=n.tileSize||e.DEFAULT_SETTINGS.collectionTileSize,u=n.tileMargin||e.DEFAULT_SETTINGS.collectionTileMargin,c=l+u,h;!n.rows&&a?h=a:h=Math.ceil(this._items.length/s);var d=0,g=0,y,x,b,T,f;this.setAutoRefigureSizes(!1);for(var E=0;E<this._items.length;E++)E&&E%h===0&&(o==="horizontal"?(g+=c,d=0):(d+=c,g=0)),y=this._items[E],x=y.getBounds(),x.width>x.height?b=l:b=l*(x.width/x.height),T=b*(x.height/x.width),f=new e.Point(d+(l-b)/2,g+(l-T)/2),y.setPosition(f,r),y.setWidth(b,r),o==="horizontal"?d+=c:g+=c;this.setAutoRefigureSizes(!0)},_figureSizes:function(){var n=this._homeBounds?this._homeBounds.clone():null,r=this._contentSize?this._contentSize.clone():null,o=this._contentFactor||0;if(!this._items.length)this._homeBounds=new e.Rect(0,0,1,1),this._contentSize=new e.Point(1,1),this._contentFactor=1;else{var s=this._items[0],a=s.getBounds();this._contentFactor=s.getContentSize().x/a.width;for(var l=s.getClippedBounds().getBoundingBox(),u=l.x,c=l.y,h=l.x+l.width,d=l.y+l.height,g=1;g<this._items.length;g++)s=this._items[g],a=s.getBounds(),this._contentFactor=Math.max(this._contentFactor,s.getContentSize().x/a.width),l=s.getClippedBounds().getBoundingBox(),u=Math.min(u,l.x),c=Math.min(c,l.y),h=Math.max(h,l.x+l.width),d=Math.max(d,l.y+l.height);this._homeBounds=new e.Rect(u,c,h-u,d-c),this._contentSize=new e.Point(this._homeBounds.width*this._contentFactor,this._homeBounds.height*this._contentFactor)}(this._contentFactor!==o||!this._homeBounds.equals(n)||!this._contentSize.equals(r))&&this.raiseEvent("metrics-change",{})},_raiseRemoveItem:function(n){this.raiseEvent("remove-item",{item:n})}})}(t)})(Fh);var Dt=Fh.exports;const ce="http://www.w3.org/2000/svg",ns=i=>{const t=i.getAttribute("class");return t?new Set(t.split(" ")):new Set},Et=(i,t)=>{const e=ns(i);e.add(t),i.setAttribute("class",Array.from(e).join(" "))},Qi=(i,t)=>{const e=ns(i);e.delete(t),e.size===0?i.removeAttribute("class"):i.setAttribute("class",Array.from(e).join(" "))},is=(i,t)=>ns(i).has(t),Rt=(i,t)=>{const e=i.selector("FragmentSelector");if(e!=null&&e.conformsTo.startsWith("http://www.w3.org/TR/media-frags")){const{value:n}=e,r=n.includes(":")?n.substring(n.indexOf("=")+1,n.indexOf(":")):"pixel",o=n.includes(":")?n.substring(n.indexOf(":")+1):n.substring(n.indexOf("=")+1);let[s,a,l,u]=o.split(",").map(parseFloat);return r.toLowerCase()==="percent"&&(s=s*t.naturalWidth/100,a=a*t.naturalHeight/100,l=l*t.naturalWidth/100,u=u*t.naturalHeight/100),{x:s,y:a,w:l,h:u}}},_E=(i,t,e,n,r)=>({source:r==null?void 0:r.src,selector:{type:"FragmentSelector",conformsTo:"http://www.w3.org/TR/media-frags/",value:`xywh=pixel:${i},${t},${e},${n}`}}),TE=(i,t,e,n,r)=>{const o=i/r.naturalWidth*100,s=t/r.naturalHeight*100,a=e/r.naturalWidth*100,l=n/r.naturalHeight*100;return{source:r.src,selector:{type:"FragmentSelector",conformsTo:"http://www.w3.org/TR/media-frags/",value:`xywh=percent:${o},${s},${a},${l}`}}},pn=(i,t,e,n,r,o)=>(o==null?void 0:o.toLowerCase())==="percent"?TE(i,t,e,n,r):_E(i,t,e,n,r),$i=(i,t,e,n,r)=>{i.setAttribute("x",t),i.setAttribute("y",e),i.setAttribute("width",n),i.setAttribute("height",r)},er=(i,t,e)=>{i.setAttribute("cx",t),i.setAttribute("cy",e),i.setAttribute("r",7)},kh=(i,t,e,n,r)=>{const o=document.createElementNS(ce,"path");o.setAttribute("fill-rule","evenodd");const{naturalWidth:s,naturalHeight:a}=i;return o.setAttribute("d",`M0 0 h${s} v${a} h-${s} z M${t} ${e} h${n} v${r} h-${n} z`),o},Lh=(i,t,e,n,r,o)=>{const{naturalWidth:s,naturalHeight:a}=t;i.setAttribute("d",`M0 0 h${s} v${a} h-${s} z M${e} ${n} h${r} v${o} h-${r} z`)},rs=(i,t,e,n)=>{const{x:r,y:o,w:s,h:a}=i.type==="Annotation"||i.type==="Selection"?Rt(i,t):{x:i,y:t,w:e,h:n},l=document.createElementNS(ce,"g");if(s===0&&a===0){Et(l,"a9s-point"),Et(l,"a9s-non-scaling"),l.setAttribute("transform-origin",`${r} ${o}`);const u=document.createElementNS(ce,"circle"),c=document.createElementNS(ce,"circle");c.setAttribute("class","a9s-inner"),er(c,r,o),u.setAttribute("class","a9s-outer"),er(u,r,o),l.appendChild(u),l.appendChild(c)}else{const u=document.createElementNS(ce,"rect"),c=document.createElementNS(ce,"rect");c.setAttribute("class","a9s-inner"),$i(c,r,o,s,a),u.setAttribute("class","a9s-outer"),$i(u,r,o,s,a),l.appendChild(u),l.appendChild(c)}return l},os=i=>{const t=i.querySelector(".a9s-outer");if(t.nodeName==="rect"){const e=parseFloat(t.getAttribute("x")),n=parseFloat(t.getAttribute("y")),r=parseFloat(t.getAttribute("width")),o=parseFloat(t.getAttribute("height"));return{x:e,y:n,w:r,h:o}}else{const e=parseFloat(t.getAttribute("cx")),n=parseFloat(t.getAttribute("cy"));return{x:e,y:n,w:0,h:0}}},Bh=(i,t,e,n,r)=>{const o=i.querySelector(".a9s-inner"),s=i.querySelector(".a9s-outer");s.nodeName==="rect"?($i(o,t,e,n,r),$i(s,t,e,n,r)):(er(o,t,e),er(s,t,e))},CE=(i,t)=>{const{w:e,h:n}=Rt(i,t);return e*n};class PE{constructor(t,e,n,r,o){P(this,"dragTo",(t,e)=>{this.group.style.display=null,this.opposite=[t,e];const{x:n,y:r,w:o,h:s}=this.bbox;Lh(this.mask,this.env.image,n,r,o,s),Bh(this.rect,n,r,o,s)});P(this,"getBoundingClientRect",()=>this.rect.getBoundingClientRect());P(this,"toSelection",()=>{const{x:t,y:e,w:n,h:r}=this.bbox;return new Wn(pn(t,e,n,r,this.env.image,this.config.fragmentUnit))});P(this,"destroy",()=>{this.group.parentNode.removeChild(this.group),this.mask=null,this.rect=null,this.group=null});this.anchor=[t,e],this.opposite=[t,e],this.config=r,this.env=o,this.group=document.createElementNS(ce,"g"),this.mask=kh(o.image,t,e,2,2),this.mask.setAttribute("class","a9s-selection-mask"),this.rect=rs(t,e,2,2),this.rect.setAttribute("class","a9s-selection"),this.group.style.pointerEvents="none",this.group.style.display="none",this.group.appendChild(this.mask),this.group.appendChild(this.rect),n.appendChild(this.group)}get bbox(){const t=this.opposite[0]-this.anchor[0],e=this.opposite[1]-this.anchor[1];return{x:t>0?this.anchor[0]:this.opposite[0],y:e>0?this.anchor[1]:this.opposite[1],w:Math.max(1,Math.abs(t)),h:Math.max(1,Math.abs(e))}}get element(){return this.rect}}const AE={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup"},ss=()=>"ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0,OE=i=>{let t=null;const e=(r,o)=>new MouseEvent(r,{screenX:o.screenX,screenY:o.screenY,clientX:o.clientX,clientY:o.clientY,pageX:o.pageX,pageY:o.pageY,bubbles:!0}),n=r=>{const o=r.changedTouches[0],s=e(AE[r.type],o);o.target.dispatchEvent(s),r.preventDefault(),(r.type==="touchstart"||r.type==="touchmove")&&(t&&clearTimeout(t),t=setTimeout(()=>{const a=e("dblclick",o);o.target.dispatchEvent(a)},800)),r.type==="touchend"&&t&&clearTimeout(t)};i.addEventListener("touchstart",n,!0),i.addEventListener("touchmove",n,!0),i.addEventListener("touchend",n,!0),i.addEventListener("touchcancel",n,!0)},tr="An implementation is missing",DE=ss();class Ih extends Qn{constructor(e,n,r){super();P(this,"enableResponsive",()=>{window.ResizeObserver&&(this.resizeObserver=new ResizeObserver(()=>{const e=this.svg.getBoundingClientRect(),{width:n,height:r}=this.svg.viewBox.baseVal;this.scale=Math.max(n/e.width,r/e.height),this.onScaleChanged&&this.onScaleChanged(this.scale)}),this.resizeObserver.observe(this.svg.parentNode))});P(this,"getSVGPoint",e=>{const n=this.svg.createSVGPoint();if(DE){const r=this.svg.getBoundingClientRect(),o=e.clientX-r.x,s=e.clientY-r.y,{left:a,top:l}=this.svg.getBoundingClientRect();return n.x=o+a,n.y=s+l,n.matrixTransform(this.g.getScreenCTM().inverse())}else return n.x=e.offsetX,n.y=e.offsetY,n.matrixTransform(this.g.getCTM().inverse())});P(this,"drawHandle",(e,n)=>{const r=document.createElementNS(ce,"g");r.setAttribute("class","a9s-handle");const o=document.createElementNS(ce,"g"),s=c=>{const h=document.createElementNS(ce,"circle");return h.setAttribute("cx",e),h.setAttribute("cy",n),h.setAttribute("r",c),h.setAttribute("transform-origin",`${e} ${n}`),h},a=this.config.handleRadius||6,l=s(a);l.setAttribute("class","a9s-handle-inner");const u=s(a+1);return u.setAttribute("class","a9s-handle-outer"),o.appendChild(u),o.appendChild(l),r.appendChild(o),r});P(this,"setHandleXY",(e,n,r)=>{const o=e.querySelector(".a9s-handle-inner");o.setAttribute("cx",n),o.setAttribute("cy",r),o.setAttribute("transform-origin",`${n} ${r}`);const s=e.querySelector(".a9s-handle-outer");s.setAttribute("cx",n),s.setAttribute("cy",r),s.setAttribute("transform-origin",`${n} ${r}`)});P(this,"getHandleXY",e=>{const n=e.querySelector(".a9s-handle-outer");return{x:parseFloat(n.getAttribute("cx")),y:parseFloat(n.getAttribute("cy"))}});P(this,"scaleHandle",e=>{const n=e.querySelector(".a9s-handle-inner"),r=e.querySelector(".a9s-handle-outer"),o=this.scale*(this.config.handleRadius||6);n.setAttribute("r",o),r.setAttribute("r",o)});this.svg=e.closest("svg"),this.g=e,this.config=n,this.env=r,this.scale=1;const{image:o}=r;(o instanceof Element||o instanceof HTMLDocument)&&this.enableResponsive()}destroy(){this.resizeObserver&&this.resizeObserver.disconnect(),this.resizeObserver=null}}class as extends Ih{constructor(e,n,r){super(e,n,r);P(this,"attachListeners",({mouseMove:e,mouseUp:n,dblClick:r})=>{e&&(this.mouseMove=o=>{const{x:s,y:a}=this.getSVGPoint(o);this.started||(this.emit("startSelection",{x:s,y:a}),this.started=!0),e(s,a,o)},this.svg.addEventListener("mousemove",this.mouseMove)),n&&(this.mouseUp=o=>{if(o.button!==0)return;const{x:s,y:a}=this.getSVGPoint(o);n(s,a,o)},document.addEventListener("mouseup",this.mouseUp)),r&&(this.dblClick=o=>{const{x:s,y:a}=this.getSVGPoint(o);r(s,a,o)},document.addEventListener("dblclick",this.dblClick))});P(this,"detachListeners",()=>{this.mouseMove&&this.svg.removeEventListener("mousemove",this.mouseMove),this.mouseUp&&document.removeEventListener("mouseup",this.mouseUp),this.dblClick&&document.removeEventListener("dblclick",this.dblClick)});P(this,"start",(e,n)=>{const{x:r,y:o}=this.getSVGPoint(e),{naturalWidth:s,naturalHeight:a}=this.env.image,l=r<0?0:r>s?s:r,u=o<0?0:o>a?a:o;this.startDrawing(l,u,n,e)});P(this,"startDrawing",e=>{throw new Error(tr)});P(this,"createEditableShape",(e,n)=>{throw new Error(tr)});this.started=!1}get isDrawing(){throw new Error(tr)}}as.supports=i=>{throw new Error(tr)};const Nh="An implementation is missing";class Hh extends Ih{constructor(e,n,r,o){super(n,r,o);P(this,"updateState",e=>{throw new Error(Nh)});this.annotation=e}get element(){throw new Error(Nh)}}const RE=/firefox/i.test(navigator.userAgent),zh=(i,t,e,n,r)=>{i.setAttribute("width",n),i.setAttribute("height",r),RE?(i.setAttribute("x",0),i.setAttribute("y",0),i.setAttribute("transform",`translate(${t}, ${e})`)):(i.setAttribute("x",t),i.setAttribute("y",e))},ME=(i,t)=>{const{x:e,y:n,width:r,height:o}=t.getBBox(),s=document.createElementNS(ce,"svg");s.setAttribute("class","a9s-formatter-el"),zh(s,e,n,r,o);const a=document.createElementNS(ce,"g");a.appendChild(i),s.appendChild(a),t.append(s)},nr=(i,t,e)=>{if(!e)return i;const n=e.reduce((a,l)=>{const u=l(t);if(!u)return a;if(typeof u=="string"||u instanceof String)a.className=a.className?`${a.className} ${u}`:u;else if(u.nodeType===Node.ELEMENT_NODE)a.elements=a.elements?[...a.elements,u]:[u];else{const{className:c,style:h,element:d}=u;c&&(a.className=a.className?`${a.className} ${c}`:c),h&&(a.style=a.style?`${a.style} ${h}`:h),d&&(a.elements=a.elements?[...a.elements,d]:[d])}for(const c in u)u.hasOwnProperty(c)&&c.startsWith("data-")&&(a[c]=u[c]);return a},{}),{className:r,style:o,elements:s}=n;if(r&&Et(i,r),o){const a=i.querySelector(".a9s-outer"),l=i.querySelector(".a9s-inner");a&&l?(a.setAttribute("style","display:none"),l.setAttribute("style",o)):i.setAttribute("style",o)}s&&s.forEach(a=>ME(a,i));for(const a in n)n.hasOwnProperty(a)&&a.startsWith("data-")&&i.setAttribute(a,n[a])},Vh=(i,t,e,n,r)=>{const o=i.querySelector(".a9s-formatter-el");o&&zh(o,t,e,n,r)},jn="corner",ir="edge";class FE extends Hh{constructor(e,n,r,o){super(e,n,r,o);P(this,"onScaleChanged",()=>this.handles.map(this.scaleHandle));P(this,"setSize",(e,n,r,o)=>{Bh(this.rectangle,e,n,r,o),Lh(this.mask,this.env.image,e,n,r,o),Vh(this.elementGroup,e,n,r,o);const[s,a,l,u,c,h,d,g]=this.handles;this.setHandleXY(s,e,n),this.setHandleXY(a,e+r,n),this.setHandleXY(l,e+r,n+o),this.setHandleXY(u,e,n+o),this.enableEdgeControls&&(this.setHandleXY(c,e+r/2,n),this.setHandleXY(h,e+r,n+o/2),this.setHandleXY(d,e+r/2,n+o),this.setHandleXY(g,e,n+o/2))});P(this,"stretchCorners",(e,n,r)=>{const o=this.getHandleXY(n),s=r.x-o.x,a=r.y-o.y,l=s>0?o.x:r.x,u=a>0?o.y:r.y,c=Math.abs(s),h=Math.abs(a);return this.setSize(l,u,c,h),{x:l,y:u,w:c,h}});P(this,"stretchEdge",(e,n,r)=>{const o=this.getHandleXY(n),s=os(this.rectangle),a=e%2===0,l=a?s.w:r.x-o.x,u=a?r.y-o.y:s.h,c=a?s.x:l>0?o.x:r.x,h=a?u>0?o.y:r.y:s.y,d=Math.abs(l),g=Math.abs(u);return this.setSize(c,h,d,g),{x:c,y:h,w:d,h:g}});P(this,"onGrab",(e,n)=>r=>{if(r.button!==0)return;this.grabbedElem=e,this.grabbedType=n;const o=this.getSVGPoint(r),{x:s,y:a}=os(this.rectangle);this.mouseOffset={x:o.x-s,y:o.y-a}});P(this,"onMouseMove",e=>{if(e.button!==0)return;const n=(r,o)=>r<0?0:r>o?o:r;if(this.grabbedElem){const r=this.getSVGPoint(e);if(this.grabbedElem===this.rectangle){const{w:o,h:s}=os(this.rectangle),{naturalWidth:a,naturalHeight:l}=this.env.image,u=n(r.x-this.mouseOffset.x,a-o),c=n(r.y-this.mouseOffset.y,l-s);this.setSize(u,c,o,s),this.emit("update",pn(u,c,o,s,this.env.image,this.config.fragmentUnit))}else{const o=this.handles.indexOf(this.grabbedElem),s=this.handles[o^2],{x:a,y:l,w:u,h:c}=this.grabbedType===jn?this.stretchCorners(o,s,r):this.stretchEdge(o,s,r);this.emit("update",pn(a,l,u,c,this.env.image,this.config.fragmentUnit))}}});P(this,"onMouseUp",e=>{this.grabbedElem=null,this.grabbedType=null,this.mouseOffset=null});P(this,"updateState",e=>{const{x:n,y:r,w:o,h:s}=Rt(e,this.env.image);this.setSize(n,r,o,s)});this.svg.addEventListener("mousemove",this.onMouseMove),this.svg.addEventListener("mouseup",this.onMouseUp);const{x:s,y:a,w:l,h:u}=Rt(e,o.image);this.containerGroup=document.createElementNS(ce,"g"),this.mask=kh(o.image,s,a,l,u),this.mask.setAttribute("class","a9s-selection-mask"),this.containerGroup.appendChild(this.mask),this.elementGroup=document.createElementNS(ce,"g"),this.elementGroup.setAttribute("class","a9s-annotation editable selected"),this.elementGroup.setAttribute("data-id",e.id),this.rectangle=rs(s,a,l,u),this.rectangle.querySelector(".a9s-inner").addEventListener("mousedown",this.onGrab(this.rectangle)),this.elementGroup.appendChild(this.rectangle),this.enableEdgeControls=r.enableEdgeControls;const c=this.enableEdgeControls?[[s+l/2,a,ir],[s+l,a+u/2,ir],[s+l/2,a+u,ir],[s,a+u/2,ir]]:[];this.handles=[[s,a,jn],[s+l,a,jn],[s+l,a+u,jn],[s,a+u,jn],...c].map(h=>{const[d,g,y]=h,x=this.drawHandle(d,g);return x.addEventListener("mousedown",this.onGrab(x,y)),this.elementGroup.appendChild(x),x}),this.containerGroup.appendChild(this.elementGroup),n.appendChild(this.containerGroup),nr(this.rectangle,e,r.formatters),this.grabbedElem=null,this.grabbedType=null,this.mouseOffset=null}get element(){return this.elementGroup}destroy(){this.containerGroup.parentNode.removeChild(this.containerGroup),super.destroy()}}class rr extends as{constructor(e,n,r){super(e,n,r);P(this,"startDrawing",(e,n)=>{this.attachListeners({mouseMove:this.onMouseMove,mouseUp:this.onMouseUp}),this.rubberband=new PE(e,n,this.g,this.config,this.env)});P(this,"stop",()=>{this.rubberband&&(this.rubberband.destroy(),this.rubberband=null)});P(this,"onMouseMove",(e,n)=>{const{naturalWidth:r,naturalHeight:o}=this.env.image,s=Math.min(Math.max(e,0),r),a=Math.min(Math.max(n,0),o);this.rubberband.dragTo(s,a)});P(this,"onMouseUp",()=>{this.detachListeners(),this.started=!1;const{width:e,height:n}=this.rubberband.getBoundingClientRect(),r=this.config.minSelectionWidth||4,o=this.config.minSelectionHeight||4;if(e>=r&&n>=o){const{element:s}=this.rubberband;s.annotation=this.rubberband.toSelection(),this.emit("complete",s)}else this.emit("cancel");this.stop()});P(this,"createEditableShape",(e,n)=>new FE(e,this.g,{...this.config,formatters:n},this.env));this.rubberband=null}get isDrawing(){return this.rubberband!=null}}rr.identifier="rect",rr.supports=i=>{const t=i.selector("FragmentSelector");return t==null?void 0:t.conformsTo.startsWith("http://www.w3.org/TR/media-frags")};const or=i=>{let t=0,e=i.length-1;for(let n=0;n<i.length;n++)t+=(i[e][0]+i[n][0])*(i[e][1]-i[n][1]),e=n;return Math.abs(.5*t)},kE=(i,t,e,n)=>{const r=i[0]-t,o=i[1]-e;return Math.sqrt(r*r+o*o)<=n},LE=(i,t,e,n,r,o)=>{const s=o||0,a=Math.cos(s),l=Math.sin(s),u=i[0]-t,c=i[1]-e,h=a*u+l*c,d=l*u-a*c;return h*h/(n*n)+d*d/(r*r)<=1},ls=(i,t)=>{const e=i[0],n=i[1];let r=!1;for(let o=0,s=t.length-1;o<t.length;s=o++){const a=t[o][0],l=t[o][1],u=t[s][0],c=t[s][1];l>n!=c>n&&e<(u-a)*(n-l)/(c-l)+a&&(r=!r)}return r},BE=(i,t)=>{for(let e of i)if(!ls(e,t))return!1;return!0},IE=(i,t,e,n,r,o)=>{const s=i[0],a=i[1],l=n-t,u=r-e,c=Math.sqrt(l*l+u*u);return Math.abs((s-t)*u-(a-e)*l)/c<=o},Uh=i=>{const t=i.getAttribute("d").split(/(?=M|m|L|l|H|h|V|v|Z|z)/g).map(r=>r.trim()),e=[];let n=[];for(let r of t){const o=r.substring(0,1);if(o.toLowerCase()==="z")e.push([...n]),n=[];else{const s=r.substring(1).split(" ").map(c=>parseFloat(c.trim())),a=o===o.toUpperCase(),l=a?s[0]:s[0]+n[n.length-1][0],u=a?s[1]:s[1]+n[n.length-1][1];n.push([l,u])}}return n.length>0&&e.push([...n]),e},NE=i=>{const n=new XMLSerializer().serializeToString(i.documentElement).replace("<svg>",`<svg xmlns="${ce}">`);return new DOMParser().parseFromString(n,"image/svg+xml").documentElement},Wh=i=>{const t=n=>{Array.from(n.attributes).forEach(r=>{r.name.startsWith("on")&&n.removeAttribute(r.name)})},e=i.getElementsByTagName("script");return Array.from(e).reverse().forEach(n=>n.parentNode.removeChild(n)),t(i),Array.from(i.querySelectorAll("*")).forEach(t),i},Wt=i=>{const t=i.selector("SvgSelector");if(t){const e=new DOMParser,{value:n}=t,r=e.parseFromString(n,"image/svg+xml"),o=r.lookupPrefix(ce),s=r.lookupNamespaceURI(null);return o||s?Wh(r).firstChild:Wh(NE(r)).firstChild}},jh=i=>{const t=Wt(i),e=document.createElementNS(ce,"g"),n=t.cloneNode(!0);n.setAttribute("class","a9s-inner");const r=t.cloneNode(!0);return r.setAttribute("class","a9s-outer"),e.appendChild(r),e.appendChild(n),e},us=(i,t)=>{const e=i.querySelector(".a9s-inner").cloneNode(!0);e.removeAttribute("class"),e.removeAttribute("xmlns");let n=e.outerHTML||new XMLSerializer().serializeToString(e);return n=n.replace(` xmlns="${ce}"`,""),{source:t==null?void 0:t.src,selector:{type:"SvgSelector",value:`<svg>${n}</svg>`}}},HE=i=>{const t=Wt(i),e=t.nodeName.toLowerCase();if(e==="polygon")return zE(t);if(e==="circle")return VE(t);if(e==="ellipse")return UE(t);if(e=="path")return WE(t);if(e=="line")return 0;throw`Unsupported SVG shape type: ${e}`},zE=i=>{const t=i.getAttribute("points").trim().split(" ").map(e=>e.split(",").map(n=>parseFloat(n.trim())));return or(t)},VE=i=>{const t=i.getAttribute("r");return t*t*Math.PI},UE=i=>{const t=i.getAttribute("rx"),e=i.getAttribute("ry");return t*e*Math.PI},WE=i=>{const t=Uh(i);if(t.length==1)return or(t[0]);{const e=r=>t.find(o=>{if(r!==o)return BE(r,o)});let n=0;for(let r of t)e(r)?n-=or(r):n+=or(r);return n}};class Gh{constructor(t,e){P(this,"redraw",()=>{this.mask.setAttribute("d",`M0 0 h${this.w} v${this.h} h-${this.w} z M${this.polygon.getAttribute("points")} z`)});P(this,"destroy",()=>this.mask.parentNode.removeChild(this.mask));this.w=t.naturalWidth,this.h=t.naturalHeight,this.polygon=e,this.mask=document.createElementNS(ce,"path"),this.mask.setAttribute("fill-rule","evenodd"),this.mask.setAttribute("class","a9s-selection-mask"),this.mask.setAttribute("d",`M0 0 h${this.w} v${this.h} h-${this.w} z M${this.polygon.getAttribute("points")} z`)}get element(){return this.mask}}class jE{constructor(t,e,n){P(this,"setPoints",t=>{const e=t.map(n=>`${n[0]},${n[1]}`).join(" ");this.outer.setAttribute("points",e),this.inner.setAttribute("points",e)});P(this,"getBoundingClientRect",()=>this.outer.getBoundingClientRect());P(this,"dragTo",t=>{this.group.style.display=null,this.mousepos=t;const e=[...this.points,t];this.setPoints(e),this.mask.redraw()});P(this,"addPoint",()=>{const[t,e]=this.mousepos,n=this.points[this.points.length-1];Math.pow(t-n[0],2)+Math.pow(e-n[1],2)>4&&(this.points=[...this.points,this.mousepos],this.setPoints(this.points),this.mask.redraw())});P(this,"destroy",()=>{this.group.parentNode.removeChild(this.group),this.polygon=null,this.group=null});P(this,"toSelection",()=>new Wn(us(this.group,this.env.image)));this.points=[t],this.env=n,this.mousepos=t,this.group=document.createElementNS(ce,"g"),this.polygon=document.createElementNS(ce,"g"),this.polygon.setAttribute("class","a9s-selection"),this.outer=document.createElementNS(ce,"polygon"),this.outer.setAttribute("class","a9s-outer"),this.inner=document.createElementNS(ce,"polygon"),this.inner.setAttribute("class","a9s-inner"),this.setPoints(this.points),this.mask=new Gh(n.image,this.inner),this.polygon.appendChild(this.outer),this.polygon.appendChild(this.inner),this.group.style.display="none",this.group.appendChild(this.mask.element),this.group.appendChild(this.polygon),e.appendChild(this.group)}get element(){return this.polygon}}const cs=i=>{const t=i.querySelector(".a9s-inner").points,e=[];for(let n=0;n<t.numberOfItems;n++)e.push(t.getItem(n));return e},GE=i=>i.querySelector(".a9s-inner").getBBox();class qE extends Hh{constructor(e,n,r,o){super(e,n,r,o);P(this,"onScaleChanged",()=>this.handles.map(this.scaleHandle));P(this,"setPoints",e=>{const n=h=>Math.round(10*h)/10,r=e.map(h=>`${n(h.x)},${n(h.y)}`).join(" ");this.shape.querySelector(".a9s-inner").setAttribute("points",r);const s=this.shape.querySelector(".a9s-outer");s.setAttribute("points",r),this.mask.redraw();const{x:a,y:l,width:u,height:c}=s.getBBox();Vh(this.elementGroup,a,l,u,c)});P(this,"onGrab",e=>n=>{n.button===0&&(this.grabbedElem=e,this.grabbedAt=this.getSVGPoint(n))});P(this,"onMouseMove",e=>{const n=(r,o,s)=>r+o<0?-r:r+o>s?s-r:o;if(this.grabbedElem){const r=this.getSVGPoint(e);if(this.grabbedElem===this.shape){const{x:o,y:s,width:a,height:l}=GE(this.shape),{naturalWidth:u,naturalHeight:c}=this.env.image,h=n(o,r.x-this.grabbedAt.x,u-a),d=n(s,r.y-this.grabbedAt.y,c-l),g=cs(this.shape).map(y=>({x:y.x+h,y:y.y+d}));this.grabbedAt=r,this.setPoints(g),g.forEach((y,x)=>this.setHandleXY(this.handles[x],y.x,y.y)),this.emit("update",us(this.shape,this.env.image))}else{const o=this.handles.indexOf(this.grabbedElem),s=cs(this.shape).map((a,l)=>l===o?r:a);this.setPoints(s),this.setHandleXY(this.handles[o],r.x,r.y),this.emit("update",us(this.shape,this.env.image))}}});P(this,"onMouseUp",e=>{this.grabbedElem=null,this.grabbedAt=null});P(this,"updateState",e=>{const n=Wt(e).getAttribute("points").split(" ").map(r=>{const[o,s]=r.split(",").map(a=>parseFloat(a.trim()));return{x:o,y:s}});this.setPoints(n),n.forEach((r,o)=>this.setHandleXY(this.handles[o],r.x,r.y))});P(this,"destroy",()=>{this.containerGroup.parentNode.removeChild(this.containerGroup),super.destroy()});this.svg.addEventListener("mousemove",this.onMouseMove),this.svg.addEventListener("mouseup",this.onMouseUp),this.containerGroup=document.createElementNS(ce,"g"),this.shape=jh(e),this.shape.querySelector(".a9s-inner").addEventListener("mousedown",this.onGrab(this.shape)),this.mask=new Gh(o.image,this.shape.querySelector(".a9s-inner")),this.containerGroup.appendChild(this.mask.element),this.elementGroup=document.createElementNS(ce,"g"),this.elementGroup.setAttribute("class","a9s-annotation editable selected"),this.elementGroup.setAttribute("data-id",e.id),this.elementGroup.appendChild(this.shape),this.handles=cs(this.shape).map(s=>{const a=this.drawHandle(s.x,s.y);return a.addEventListener("mousedown",this.onGrab(a)),this.elementGroup.appendChild(a),a}),this.containerGroup.appendChild(this.elementGroup),n.appendChild(this.containerGroup),nr(this.shape,e,r.formatters),this.grabbedElem=null,this.grabbedAt=null}get element(){return this.elementGroup}}class hs extends as{constructor(e,n,r){super(e,n,r);P(this,"startDrawing",(e,n,r)=>{this._isDrawing=!0,this._startOnSingleClick=r,this.attachListeners({mouseMove:this.onMouseMove,mouseUp:this.onMouseUp,dblClick:this.onDblClick}),this.rubberband=new jE([e,n],this.g,this.env)});P(this,"stop",()=>{this.detachListeners(),this._isDrawing=!1,this.rubberband&&(this.rubberband.destroy(),this.rubberband=null)});P(this,"onMouseMove",(e,n)=>this.rubberband.dragTo([e,n]));P(this,"onMouseUp",()=>{const{width:e,height:n}=this.rubberband.getBoundingClientRect(),r=this.config.minSelectionWidth||4,o=this.config.minSelectionHeight||4;e>=r||n>=o?this.rubberband.addPoint():this._startOnSingleClick||(this.emit("cancel"),this.stop())});P(this,"onDblClick",()=>{this._isDrawing=!1;const e=this.rubberband.element;e.annotation=this.rubberband.toSelection(),this.emit("complete",e),this.stop()});P(this,"createEditableShape",(e,n)=>new qE(e,this.g,{...this.config,formatters:n},this.env));this._isDrawing=!1,this._startOnSingleClick=!1}get isDrawing(){return this._isDrawing}}hs.identifier="polygon",hs.supports=i=>{var e;const t=i.selector("SvgSelector");if(t)return(e=t.value)==null?void 0:e.match(/^<svg.*<polygon/g)};class XE extends Qn{constructor(e,n,r){super();P(this,"listTools",()=>this._registered.map(e=>e.identifier));P(this,"registerTool",e=>{const n=e.identifier;this.listTools().includes(n)&&this.unregisterTool(n),this._registered.unshift(e)});P(this,"unregisterTool",e=>this._registered=this._registered.filter(n=>n.identifier!==e));P(this,"setCurrent",e=>{this._current&&this._current.destroy();const n=typeof e=="string"||e instanceof String?this._registered.find(r=>r.identifier===e):e;this._current=new n(this._g,this._config,this._env),this._current.on("startSelection",r=>this.emit("startSelection",r)),this._current.on("complete",r=>this.emit("complete",r)),this._current.on("cancel",r=>this.emit("cancel",r))});P(this,"forAnnotation",e=>{var a;const[n,...r]=e.targets,o=(a=n.renderedVia)==null?void 0:a.name,s=o?this._registered.find(l=>l.identifier===o):this._registered.find(l=>l.supports(e));return s?new s(this._g,this._config,this._env):null});this._g=e,this._config=n,this._env=r,this._registered=[rr,hs],this.setCurrent(rr)}get current(){return this._current}}const YE={FragmentSelector:rs,SvgSelector:jh},ZE={FragmentSelector:CE,SvgSelector:HE},qh=i=>{const t=i.targets[0];if(t)return Array.isArray(t.selector)?t.selector[0]:t.selector},ds=(i,t)=>YE[qh(i).type](i,t),Xh=(i,t)=>ZE[qh(i).type](i,t);class KE{constructor(t){const e=document.createElementNS(ce,"svg");e.setAttribute("class","a9s-osd-crosshair-container");const n=document.createElementNS(ce,"g");n.setAttribute("class","a9s-crosshair"),e.appendChild(n);const r=document.createElementNS(ce,"line"),o=document.createElementNS(ce,"line");n.appendChild(r),n.appendChild(o),t.parentElement.appendChild(e);const s=a=>{const{offsetX:l,offsetY:u}=a,c=t.parentElement.offsetWidth,h=t.parentElement.offsetHeight;r.setAttribute("x1",0),r.setAttribute("y1",u),r.setAttribute("x2",c),r.setAttribute("y2",u),o.setAttribute("x1",l),o.setAttribute("y1",0),o.setAttribute("x2",l),o.setAttribute("y2",h)};t.addEventListener("pointermove",s),t.parentElement.addEventListener("pointermove",s)}}function JE(i,t,e,n,r){Yh(i,t,e||0,n||i.length-1,r||QE)}function Yh(i,t,e,n,r){for(;n>e;){if(n-e>600){var o=n-e+1,s=t-e+1,a=Math.log(o),l=.5*Math.exp(2*a/3),u=.5*Math.sqrt(a*l*(o-l)/o)*(s-o/2<0?-1:1),c=Math.max(e,Math.floor(t-s*l/o+u)),h=Math.min(n,Math.floor(t+(o-s)*l/o+u));Yh(i,t,c,h,r)}var d=i[t],g=e,y=n;for(Gn(i,e,t),r(i[n],d)>0&&Gn(i,e,n);g<y;){for(Gn(i,g,y),g++,y--;r(i[g],d)<0;)g++;for(;r(i[y],d)>0;)y--}r(i[e],d)===0?Gn(i,e,y):(y++,Gn(i,y,n)),y<=t&&(e=y+1),t<=y&&(n=y-1)}}function Gn(i,t,e){var n=i[t];i[t]=i[e],i[e]=n}function QE(i,t){return i<t?-1:i>t?1:0}class $E{constructor(t=9){this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(t){let e=this.data;const n=[];if(!ar(t,e))return n;const r=this.toBBox,o=[];for(;e;){for(let s=0;s<e.children.length;s++){const a=e.children[s],l=e.leaf?r(a):a;ar(t,l)&&(e.leaf?n.push(a):ps(t,l)?this._all(a,n):o.push(a))}e=o.pop()}return n}collides(t){let e=this.data;if(!ar(t,e))return!1;const n=[];for(;e;){for(let r=0;r<e.children.length;r++){const o=e.children[r],s=e.leaf?this.toBBox(o):o;if(ar(t,s)){if(e.leaf||ps(t,s))return!0;n.push(o)}}e=n.pop()}return!1}load(t){if(!(t&&t.length))return this;if(t.length<this._minEntries){for(let n=0;n<t.length;n++)this.insert(t[n]);return this}let e=this._build(t.slice(),0,t.length-1,0);if(!this.data.children.length)this.data=e;else if(this.data.height===e.height)this._splitRoot(this.data,e);else{if(this.data.height<e.height){const n=this.data;this.data=e,e=n}this._insert(e,this.data.height-e.height-1,!0)}return this}insert(t){return t&&this._insert(t,this.data.height-1),this}clear(){return this.data=gn([]),this}remove(t,e){if(!t)return this;let n=this.data;const r=this.toBBox(t),o=[],s=[];let a,l,u;for(;n||o.length;){if(n||(n=o.pop(),l=o[o.length-1],a=s.pop(),u=!0),n.leaf){const c=ex(t,n.children,e);if(c!==-1)return n.children.splice(c,1),o.push(n),this._condense(o),this}!u&&!n.leaf&&ps(n,r)?(o.push(n),s.push(a),a=0,l=n,n=n.children[0]):l?(a++,n=l.children[a],u=!1):n=null}return this}toBBox(t){return t}compareMinX(t,e){return t.minX-e.minX}compareMinY(t,e){return t.minY-e.minY}toJSON(){return this.data}fromJSON(t){return this.data=t,this}_all(t,e){const n=[];for(;t;)t.leaf?e.push(...t.children):n.push(...t.children),t=n.pop();return e}_build(t,e,n,r){const o=n-e+1;let s=this._maxEntries,a;if(o<=s)return a=gn(t.slice(e,n+1)),mn(a,this.toBBox),a;r||(r=Math.ceil(Math.log(o)/Math.log(s)),s=Math.ceil(o/Math.pow(s,r-1))),a=gn([]),a.leaf=!1,a.height=r;const l=Math.ceil(o/s),u=l*Math.ceil(Math.sqrt(s));Zh(t,e,n,u,this.compareMinX);for(let c=e;c<=n;c+=u){const h=Math.min(c+u-1,n);Zh(t,c,h,l,this.compareMinY);for(let d=c;d<=h;d+=l){const g=Math.min(d+l-1,h);a.children.push(this._build(t,d,g,r-1))}}return mn(a,this.toBBox),a}_chooseSubtree(t,e,n,r){for(;r.push(e),!(e.leaf||r.length-1===n);){let o=1/0,s=1/0,a;for(let l=0;l<e.children.length;l++){const u=e.children[l],c=fs(u),h=ix(t,u)-c;h<s?(s=h,o=c<o?c:o,a=u):h===s&&c<o&&(o=c,a=u)}e=a||e.children[0]}return e}_insert(t,e,n){const r=n?t:this.toBBox(t),o=[],s=this._chooseSubtree(r,this.data,e,o);for(s.children.push(t),Xn(s,r);e>=0&&o[e].children.length>this._maxEntries;)this._split(o,e),e--;this._adjustParentBBoxes(r,o,e)}_split(t,e){const n=t[e],r=n.children.length,o=this._minEntries;this._chooseSplitAxis(n,o,r);const s=this._chooseSplitIndex(n,o,r),a=gn(n.children.splice(s,n.children.length-s));a.height=n.height,a.leaf=n.leaf,mn(n,this.toBBox),mn(a,this.toBBox),e?t[e-1].children.push(a):this._splitRoot(n,a)}_splitRoot(t,e){this.data=gn([t,e]),this.data.height=t.height+1,this.data.leaf=!1,mn(this.data,this.toBBox)}_chooseSplitIndex(t,e,n){let r,o=1/0,s=1/0;for(let a=e;a<=n-e;a++){const l=qn(t,0,a,this.toBBox),u=qn(t,a,n,this.toBBox),c=rx(l,u),h=fs(l)+fs(u);c<o?(o=c,r=a,s=h<s?h:s):c===o&&h<s&&(s=h,r=a)}return r||n-e}_chooseSplitAxis(t,e,n){const r=t.leaf?this.compareMinX:tx,o=t.leaf?this.compareMinY:nx,s=this._allDistMargin(t,e,n,r),a=this._allDistMargin(t,e,n,o);s<a&&t.children.sort(r)}_allDistMargin(t,e,n,r){t.children.sort(r);const o=this.toBBox,s=qn(t,0,e,o),a=qn(t,n-e,n,o);let l=sr(s)+sr(a);for(let u=e;u<n-e;u++){const c=t.children[u];Xn(s,t.leaf?o(c):c),l+=sr(s)}for(let u=n-e-1;u>=e;u--){const c=t.children[u];Xn(a,t.leaf?o(c):c),l+=sr(a)}return l}_adjustParentBBoxes(t,e,n){for(let r=n;r>=0;r--)Xn(e[r],t)}_condense(t){for(let e=t.length-1,n;e>=0;e--)t[e].children.length===0?e>0?(n=t[e-1].children,n.splice(n.indexOf(t[e]),1)):this.clear():mn(t[e],this.toBBox)}}function ex(i,t,e){if(!e)return t.indexOf(i);for(let n=0;n<t.length;n++)if(e(i,t[n]))return n;return-1}function mn(i,t){qn(i,0,i.children.length,t,i)}function qn(i,t,e,n,r){r||(r=gn(null)),r.minX=1/0,r.minY=1/0,r.maxX=-1/0,r.maxY=-1/0;for(let o=t;o<e;o++){const s=i.children[o];Xn(r,i.leaf?n(s):s)}return r}function Xn(i,t){return i.minX=Math.min(i.minX,t.minX),i.minY=Math.min(i.minY,t.minY),i.maxX=Math.max(i.maxX,t.maxX),i.maxY=Math.max(i.maxY,t.maxY),i}function tx(i,t){return i.minX-t.minX}function nx(i,t){return i.minY-t.minY}function fs(i){return(i.maxX-i.minX)*(i.maxY-i.minY)}function sr(i){return i.maxX-i.minX+(i.maxY-i.minY)}function ix(i,t){return(Math.max(t.maxX,i.maxX)-Math.min(t.minX,i.minX))*(Math.max(t.maxY,i.maxY)-Math.min(t.minY,i.minY))}function rx(i,t){const e=Math.max(i.minX,t.minX),n=Math.max(i.minY,t.minY),r=Math.min(i.maxX,t.maxX),o=Math.min(i.maxY,t.maxY);return Math.max(0,r-e)*Math.max(0,o-n)}function ps(i,t){return i.minX<=t.minX&&i.minY<=t.minY&&t.maxX<=i.maxX&&t.maxY<=i.maxY}function ar(i,t){return t.minX<=i.maxX&&t.minY<=i.maxY&&t.maxX>=i.minX&&t.maxY>=i.minY}function gn(i){return{children:i,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function Zh(i,t,e,n,r){const o=[t,e];for(;o.length;){if(e=o.pop(),t=o.pop(),e-t<=n)continue;const s=t+Math.ceil((e-t)/n/2)*n;JE(i,s,t,e,r),o.push(t,s,s,e)}}const ms=(i,t)=>{if(i.targets[0].selector.type==="FragmentSelector"){const{x:n,y:r,w:o,h:s}=Rt(i,t);return{minX:n,minY:r,maxX:n+o,maxY:r+s}}else{const n=ds(i,t),r=document.createElementNS(ce,"svg");r.style.position="absolute",r.style.opacity=0,r.style.top=0,r.style.left=0,r.appendChild(n),document.body.appendChild(r);const{x:o,y:s,width:a,height:l}=n.getBBox();return document.body.removeChild(r),{minX:o,minY:s,maxX:o+a,maxY:s+l}}},ox=i=>{var e;const t=i.targets[0];return Array.isArray(t.selector)?t.selector[0].type:(e=t.selector)==null?void 0:e.type},sx=(i,t,e,n)=>{const r=Wt(e),o=r.nodeName.toLowerCase(),s=[i,t];if(o==="polygon"){const a=Array.from(r.points).map(l=>[l.x,l.y]);return ls(s,a)}else if(o==="circle"){const a=r.getAttribute("cx"),l=r.getAttribute("cy"),u=r.getAttribute("r");return kE(s,a,l,u)}else if(o==="ellipse"){const a=r.getAttribute("cx"),l=r.getAttribute("cy"),u=r.getAttribute("rx"),c=r.getAttribute("ry");return LE(s,a,l,u,c)}else{if(o==="path")return Uh(r).find(l=>ls(s,l));if(o==="line"){const a=parseInt(r.getAttribute("x1")),l=parseInt(r.getAttribute("y1")),u=parseInt(r.getAttribute("x2")),c=parseInt(r.getAttribute("y2"));return IE(s,a,l,u,c,n)}else throw`Unsupported SVG shape type: ${o}`}};class ax{constructor(t){P(this,"clear",()=>this.spatial_index.clear());P(this,"getAnnotationAt",(t,e,n)=>{const r=n?5/n:5,s=this.spatial_index.search({minX:t-r,minY:e-r,maxX:t+r,maxY:e+r}).map(a=>a.annotation).filter(a=>{const l=ox(a);if(l==="FragmentSelector")return!0;if(l==="SvgSelector")return sx(t,e,a,r);throw`Unsupported selector type: ${l}`});if(s.length>0)return s.sort((a,l)=>Xh(a,this.env.image)-Xh(l,this.env.image)),s[0]});P(this,"getAnnotationsIntersecting",t=>{const e=t.minX,n=e?t:ms(t,this.env.image),r=this.spatial_index.search(n).map(o=>o.annotation);return e?r:r.filter(o=>!o.isEqual(t))});P(this,"insert",t=>{(Array.isArray(t)?t:[t]).forEach(n=>{this.spatial_index.insert({...ms(n,this.env.image),annotation:n})})});P(this,"getBounds",t=>this.getBounds(t,this.env.image));P(this,"remove",t=>{const e={...ms(t,this.env.image),annotation:t};this.spatial_index.remove(e,(n,r)=>n.annotation.id===r.annotation.id)});this.env=t,t.store=this,this.spatial_index=new $E}}const Kh=(i,t)=>{const r=(is(t,".a9s-annotation")?t:t.closest(".a9s-annotation")).querySelector(".a9s-outer").getBoundingClientRect(),{canvas:o}=i.drawer,s=o.getBoundingClientRect(),a=o.width/s.width,l=o.height/s.height,u=r.x-s.x,c=r.y-s.y,{width:h,height:d}=r,g=document.createElement("CANVAS"),y=g.getContext("2d");g.width=h,g.height=d,y.drawImage(o,u*a,c*l,h*a,d*l,0,0,h,d);const x=i.viewport.viewerElementToImageCoordinates(new OpenSeadragon.Point(u,c)),b=i.viewport.viewportToImageZoom(i.viewport.getZoom());return{snippet:g,transform:T=>{const f=x.x+T[0]/a/b,E=x.y+T[1]/l/b;return[f,E]}}},lx=ss();class Jh extends Qn{constructor(e){super();P(this,"_getShapeAt",e=>{const n=a=>{const l=this.svg.createSVGPoint();if(window.TouchEvent&&a instanceof TouchEvent){const u=this.svg.getBoundingClientRect(),c=a.touches[0],h=c.clientX-u.x,d=c.clientY-u.y,{left:g,top:y}=this.svg.getBoundingClientRect();return l.x=h+g,l.y=d+y,l.matrixTransform(this.g.getScreenCTM().inverse())}else return l.x=a.offsetX,l.y=a.offsetY,l.matrixTransform(this.g.getCTM().inverse())},{x:r,y:o}=n(e),s=this.store.getAnnotationAt(r,o,this.currentScale());if(s)return this.findShape(s)});P(this,"_initDrawingTools",e=>{var l;let n=!1,r=!1,o=!1;this.tools=new XE(this.g,this.config,this.env),this.tools.on("complete",u=>{r=!1,this.onDrawingComplete(u)}),this.mouseTracker=new Dt.MouseTracker({element:this.svg,preProcessEventHandler:u=>{this.mouseTracker.enabled||(u.preventDefault=!1,u.preventGesture=!0),this.selectedShape&&u.eventType==="wheel"&&(u.preventDefault=!1,this.viewer.canvas.dispatchEvent(new u.originalEvent.constructor(u.eventType,u.originalEvent)))},pressHandler:u=>{this.tools.current.isDrawing||(this.tools.current.start(u.originalEvent,this.drawOnSingleClick&&!this.hoveredShape),e||this.scaleTool(this.tools.current))},moveHandler:u=>{if(this.tools.current.isDrawing){const{x:c,y:h}=this.tools.current.getSVGPoint(u.originalEvent);!u.buttons||!r?(u.originalEvent.stopPropagation(),this.tools.current.onMouseMove(c,h,u.originalEvent),n||(this.emit("startSelection",{x:c,y:h}),n=!0)):(!o&&this.tools.current.onDragStart&&this.tools.current.onDragStart(c,h,u.originalEvent),o=!0)}},releaseHandler:u=>{if(this.tools.current.isDrawing){r=!0;const{x:c,y:h}=this.tools.current.getSVGPoint(u.originalEvent);n&&this.emit("endSelection",{x:c,y:h}),this.tools.current.onMouseUp(c,h,u.originalEvent),o&&this.tools.current.onDragEnd&&this.tools.current.onDragEnd()}n=!1,o=!1}});const s=this.config.hotkey?this.config.hotkey.key?this.config.hotkey.key.toLowerCase():this.config.hotkey.toLowerCase():"shift",a=(l=this.config.hotkey)==null?void 0:l.inverted;this.mouseTracker.enabled=a,this.onKeyDown&&document.removeEventListener("keydown",this.onKeyDown),this.onKeyUp&&document.removeEventListener("keydown",this.onKeyDown),this.onKeyDown=u=>{if(u.key.toLowerCase()===s&&!this.selectedShape){const c=!this.readOnly&&!a;this.mouseTracker.enabled=c,this.tools.current.enabled=c}},this.onKeyUp=u=>{u.key.toLowerCase()===s&&!this.tools.current.isDrawing&&(this.mouseTracker.enabled=a,this.tools.current.enabled=a)},document.addEventListener("keydown",this.onKeyDown),document.addEventListener("keyup",this.onKeyUp)});P(this,"_initMouseEvents",()=>{this.svg.addEventListener("mousemove",n=>{var r,o;if(!((r=this.tools)!=null&&r.current.isDrawing)&&!n.target.closest(".a9s-annotation.editable.selected")){const a=this._getShapeAt(n);if((a==null?void 0:a.annotation)!==((o=this.hoveredShape)==null?void 0:o.annotation)){if(this.hoveredShape){const l=this.hoveredShape.element||this.hoveredShape;Qi(l,"hover"),this.emit("mouseLeaveAnnotation",this.hoveredShape.annotation,this.hoveredShape)}a&&(Et(a,"hover"),this.emit("mouseEnterAnnotation",a.annotation,a))}this.hoveredShape=a}}),this.svg.parentElement.addEventListener("mouseleave",()=>{this.hoveredShape&&(Qi(this.hoveredShape,"hover"),this.emit("mouseLeaveAnnotation",this.hoveredShape.annotation,this.hoveredShape),this.hoveredShape=null)});let e=null;this.viewer.addHandler("canvas-press",()=>e=new Date().getTime()),this.viewer.addHandler("canvas-click",n=>{var o;const{originalEvent:r}=n;if(!(((o=this.tools.current)==null?void 0:o.isDrawing)||this.disableSelect)&&new Date().getTime()-e<250){const l=r.target.closest(".a9s-annotation.editable.selected")?this.selectedShape:this._getShapeAt(r);l?(n.preventDefaultAction=!0,this.selectShape(l)):l||(this.deselect(),this.emit("select",{}))}this.disableSelect&&this.hoveredShape&&this.emit("clickAnnotation",this.hoveredShape.annotation,this.hoveredShape)})});P(this,"_lazy",e=>{if(this.viewer.world.getItemAt(0))e();else{const n=()=>{e(),this.viewer.removeHandler("open",n),this.viewer.world.removeHandler("add-item",n)};this.viewer.addHandler("open",n),this.viewer.world.addHandler("add-item",n)}});P(this,"_refreshNonScalingAnnotations",()=>{const e=this.currentScale();Array.from(this.svg.querySelectorAll(".a9s-non-scaling")).forEach(n=>n.setAttribute("transform",`scale(${1/e})`))});P(this,"addAnnotation",(e,n)=>{const r=n||this.g,o=ds(e,this.env.image);return Et(o,"a9s-annotation"),o.setAttribute("data-id",e.id),o.annotation=e,r.appendChild(o),nr(o,e,this.formatters),this.scaleFormatterElements(o),o});P(this,"addDrawingTool",e=>this.tools.registerTool(e));P(this,"addOrUpdateAnnotation",(e,n)=>{var s;const r=(s=this.selectedShape)==null?void 0:s.annotation;(r===e||(r==null?void 0:r.isSelection)||r==n)&&this.deselect(),n&&this.removeAnnotation(e),this.removeAnnotation(e);const o=this.addAnnotation(e);is(o,"a9s-non-scaling")&&o.setAttribute("transform",`scale(${1/this.currentScale()})`),this.store.insert(e)});P(this,"currentScale",()=>{const e=this.viewer.viewport.getContainerSize().x;return this.viewer.viewport.getZoom(!0)*e/this.viewer.world.getContentFactor()});P(this,"deselect",()=>{var e;if((e=this.tools)==null||e.current.stop(),this.selectedShape){const{annotation:n}=this.selectedShape;if(this.selectedShape.destroy){if(this.selectedShape.mouseTracker.destroy(),this.selectedShape.destroy(),!n.isSelection){const r=this.addAnnotation(n);is(r,"a9s-non-scaling")&&r.setAttribute("transform",`scale(${1/this.currentScale()})`)}}else Qi(this.selectedShape,"selected");this.selectedShape=null}});P(this,"destroy",()=>{this.deselect(),this.svg.parentNode.removeChild(this.svg)});P(this,"findShape",e=>{const n=e!=null&&e.id?e.id:e;return this.g.querySelector(`.a9s-annotation[data-id="${n}"]`)});P(this,"_fit",(e,n,r)=>{const o=this.findShape(e);if(o){const s=n?typeof n=="boolean"?n:n.immediately:!1,a=(n==null?void 0:n.padding)||0,l=this.viewer.container.getBoundingClientRect(),u=Math.min(2*a/l.width,2*a/l.height),{x:c,y:h,width:d,height:g}=o.getBBox(),y=c-u*d,x=h-u*g,b=d+2*u*d,T=g+2*u*g,f=this.viewer.viewport.imageToViewportRectangle(y,x,b,T);this.viewer.viewport[r](f,s)}});P(this,"fitBounds",(e,n)=>this._fit(e,n,"fitBounds"));P(this,"fitBoundsWithConstraints",(e,n)=>this._fit(e,n,"fitBoundsWithConstraints"));P(this,"getAnnotations",()=>Array.from(this.g.querySelectorAll(".a9s-annotation")).map(n=>n.annotation));P(this,"getAnnotationsIntersecting",e=>{const n=e.id?e:this.findShape(e).annotation;return this.store.getAnnotationsIntersecting(n)});P(this,"getImageSnippetById",e=>{const n=this.findShape(e);if(n)return Kh(this.viewer,n)});P(this,"getSelectedImageSnippet",()=>{var e;if(this.selectedShape){const n=(e=this.selectedShape.element)!=null?e:this.selectedShape;return Kh(this.viewer,n)}});P(this,"init",e=>{this.deselect(),Array.from(this.g.querySelectorAll(".a9s-annotation")).forEach(r=>this.g.removeChild(r)),this.store.clear(),this._lazy(()=>{console.time("Took"),console.log("Drawing..."),this.loaded||(this.g.style.display="none"),e.forEach(r=>this.addAnnotation(r)),console.log("Indexing..."),this.store.insert(e),console.timeEnd("Took"),this.resize()})});P(this,"listDrawingTools",()=>this.tools.listTools());P(this,"overrideId",(e,n)=>{const r=this.findShape(e);r.setAttribute("data-id",n);const{annotation:o}=r,s=o.clone({id:n});return r.annotation=s,this.store.remove(o),this.store.insert(s),s});P(this,"panTo",(e,n)=>{const r=this.findShape(e);if(r){const{top:o,left:s,width:a,height:l}=r.getBoundingClientRect(),u=s+a/2+window.scrollX,c=o+l/2+window.scrollY,h=this.viewer.viewport.windowToViewportCoordinates(new Dt.Point(u,c));this.viewer.viewport.panTo(h,n)}});P(this,"removeAnnotation",e=>{var o,s;const n=e.type?e.id:e;((o=this.selectedShape)==null?void 0:o.annotation.id)===n&&this.deselect();const r=this.findShape(e);if(r){const{annotation:a}=r;((s=this.selectedShape)==null?void 0:s.annotation)===a&&this.deselect(),r.parentNode.removeChild(r),this.store.remove(a)}});P(this,"removeDrawingTool",e=>{var n;return(n=this.tools)==null?void 0:n.unregisterTool(e)});P(this,"scaleFormatterElements",e=>{const n=1/this.currentScale();if(e){const r=e.querySelector(".a9s-formatter-el");r&&r.firstChild.setAttribute("transform",`scale(${n})`)}else Array.from(this.g.querySelectorAll(".a9s-formatter-el")).forEach(o=>o.firstChild.setAttribute("transform",`scale(${n})`))});P(this,"scaleTool",e=>{if(e){const n=1/this.currentScale();e.scale=n,e.onScaleChanged&&e.onScaleChanged(n)}});P(this,"selectAnnotation",(e,n)=>{this.selectedShape&&this.deselect();const r=this.findShape(e);if(r){this.selectShape(r,n);const o=this.selectedShape.element?this.selectedShape.element:this.selectedShape;return{annotation:r.annotation,element:o}}else this.deselect()});P(this,"selectShape",(e,n)=>{var s;if(!n&&!e.annotation.isSelection&&this.emit("clickAnnotation",e.annotation,e),((s=this.selectedShape)==null?void 0:s.annotation)===e.annotation)return;this.selectedShape&&this.selectedShape.annotation!==e.annotation&&this.deselect();const{annotation:r}=e;if(this.readOnly||r.readOnly||this.headless)this.selectedShape=e,Et(e,"selected"),n||this.emit("select",{annotation:r,element:e,skipEvent:n});else{const a=this.tools.forAnnotation(r);if(a){setTimeout(()=>{e.parentNode.removeChild(e),n||this.emit("select",{annotation:r,element:this.selectedShape.element})},1),this.selectedShape=a.createEditableShape(r,this.formatters),this.scaleTool(this.selectedShape),this.scaleFormatterElements(this.selectedShape.element),this.selectedShape.element.annotation=r;const l=new Dt.MouseTracker({element:this.svg,preProcessEventHandler:u=>{u.stopPropagation=!0,u.preventDefault=!1,u.preventGesture=!0}}).setTracking(!1);this.selectedShape.element.addEventListener("mouseenter",()=>{this.hoveredShape=this.selectedShape,l.setTracking(!0)}),this.selectedShape.element.addEventListener("mouseleave",()=>{this.hoveredShape=null,l.setTracking(!1)}),this.selectedShape.mouseTracker=l,this.selectedShape.on("update",u=>this.emit("updateTarget",this.selectedShape.element,u))}else this.selectedShape=e,n||this.emit("select",{annotation:r,element:this.selectedShape})}});P(this,"setDrawingEnabled",e=>{if(this.mouseTracker){const n=e&&!this.readOnly;this.mouseTracker.enabled=n,this.mouseTracker.setTracking(n),this.tools.current&&(this.tools.current.enabled=n)}});P(this,"setDrawingTool",e=>{var n;this.tools&&((n=this.tools.current)==null||n.stop(),this.tools.setCurrent(e))});P(this,"setVisible",e=>{e?this.svg.style.display=null:(this.deselect(),this.svg.style.display="none")});P(this,"stopDrawing",()=>{var e;(e=this.tools)!=null&&e.current&&(this.tools.current.isDrawing&&this.tools.current.stop(),this.mouseTracker.enabled=!1,this.tools.current.enabled=!1)});this.viewer=e.viewer,this.config=e.config,this.env=e.env,this.readOnly=e.config.readOnly,this.headless=e.config.headless,e.config.formatter?this.formatters=[e.config.formatter]:e.config.formatters&&(this.formatters=Array.isArray(e.config.formatters)?e.config.formatters:[e.config.formatters]),this.disableSelect=e.config.disableSelect,this.drawOnSingleClick=e.config.drawOnSingleClick,this.svg=document.createElementNS(ce,"svg"),lx?(this.svg.setAttribute("class","a9s-annotationlayer a9s-osd-annotationlayer touch"),OE(this.svg)):this.svg.setAttribute("class","a9s-annotationlayer a9s-osd-annotationlayer"),this.g=document.createElementNS(ce,"g"),this.svg.appendChild(this.g),this.viewer.canvas.appendChild(this.svg),this.viewer.addHandler("animation",()=>this.resize()),this.viewer.addHandler("rotate",()=>this.resize()),this.viewer.addHandler("resize",()=>this.resize()),this.viewer.addHandler("flip",()=>this.resize()),this.loaded=!1;const n=()=>{const{x:r,y:o}=this.viewer.world.getItemAt(0).source.dimensions,s=this.viewer.world.getItemAt(0).source["@id"]||new URL(this.viewer.world.getItemAt(0).source.url,document.baseURI).href;this.env.image={src:s,naturalWidth:r,naturalHeight:o},e.config.crosshair&&(this.crosshair||(this.crosshair=new KE(this.svg),Et(this.svg,"no-cursor"))),this.loaded||this.emit("load",s),this.loaded=!0,this.g.style.display="inline",this.resize()};this.viewer.addHandler("open",n),this.viewer.world.addHandler("add-item",n),this.viewer.world.getItemAt(0)&&n(),this.store=new ax(this.env),this.selectedShape=null,this.hoveredShape=null,this._initMouseEvents()}resize(){var a;const e=this.viewer.viewport.getFlip(),n=this.viewer.viewport.pixelFromPoint(new Dt.Point(0,0),!0);e&&(n.x=this.viewer.viewport._containerInnerSize.x-n.x);const r=this.currentScale(),o=e?-r:r,s=this.viewer.viewport.getRotation();this.g.setAttribute("transform",`translate(${n.x}, ${n.y}) scale(${o}, ${r}) rotate(${s})`),this._refreshNonScalingAnnotations(),this.scaleFormatterElements(),this.selectedShape&&(this.selectedShape.element?(this.scaleTool(this.selectedShape),this.emit("viewportChange",this.selectedShape.element)):this.emit("viewportChange",this.selectedShape)),(a=this.tools)!=null&&a.current&&this.scaleTool(this.tools.current)}}class ux extends Jh{constructor(e){super(e);P(this,"onDrawingComplete",e=>{var n;this.mouseTracker.enabled=(n=this.config.hotkey)==null?void 0:n.inverted,this.selectShape(e),this.emit("createSelection",e.annotation)});this._initDrawingTools()}}const gs=i=>{const t=i.viewport.viewportToImageRectangle(i.viewport.getBounds(!0)),e=i.viewport.getContainerSize().x,r=i.viewport.getZoom(!0)*e/i.world.getContentFactor();return{extent:t,scale:r}},cx=i=>{var e;const t=i.targets[0];return t?Array.isArray(t.selector)?t.selector[0].type:(e=t.selector)==null?void 0:e.type:null},Qh=(i,t)=>{const{extent:e,scale:n}=gs(i),{selector:r}=t,o=St.create({target:t});if(r.type==="SvgSelector"){const s=Wt(o),a=s.nodeName.toLowerCase();let l=null;if(a==="polygon")l=hx(s,e,n);else if(a==="circle")l=dx(s,e,n);else if(a==="ellipse")l=fx(s,e,n);else if(a==="path")l=px(s,e,n);else throw`Unsupported SVG shape type: ${a}`;let u=l.outerHTML||new XMLSerializer().serializeToString(l);return u=u.replace(` xmlns="${ce}"`,""),{...t,selector:{type:"SvgSelector",value:`<svg>${u}</svg>`}}}else if(r.type==="FragmentSelector"){const{x:s,y:a,w:l,h:u}=Rt(o),c=e.x+s/n,h=e.y+a/n,d=l/n,g=u/n;return l===0&&u===0?{...pn(c,h,d,g),renderedVia:{name:"point"}}:pn(c,h,d,g)}else throw`Unsupported selector type: ${r.type}`},hx=(i,t,e)=>{const r=Array.from(i.points).map(o=>{const s=t.x+o.x/e,a=t.y+o.y/e;return s+","+a}).join(" ");return i.setAttribute("points",r),i},dx=(i,t,e)=>{const n=parseFloat(i.getAttribute("cx")),r=parseFloat(i.getAttribute("cy")),o=parseFloat(i.getAttribute("r"));return i.setAttribute("cx",t.x+n/e),i.setAttribute("cy",t.y+r/e),i.setAttribute("r",o/e),i},fx=(i,t,e)=>{const n=parseFloat(i.getAttribute("cx")),r=parseFloat(i.getAttribute("cy")),o=parseFloat(i.getAttribute("rx")),s=parseFloat(i.getAttribute("ry"));return i.setAttribute("cx",t.x+n/e),i.setAttribute("cy",t.y+r/e),i.setAttribute("rx",o/e),i.setAttribute("ry",s/e),i},px=(i,t,e)=>{const r=i.getAttribute("d").split(/(?=M|m|L|l|H|h|V|v|Z|z)/g).map(o=>o.trim()).map(o=>{const s=o.substring(0,1);if(s.toLowerCase()==="z")return s;{const a=o.substring(1).split(" ").map(h=>parseFloat(h.trim())),l=s===s.toUpperCase(),u=l?t.x+a[0]/e:a[0]/e,c=l?t.y+a[1]/e:a[1]/e;return s+" "+u+" "+c}}).join(" ");return i.setAttribute("d",r),i},$h=(i,t)=>{const{extent:e,scale:n}=gs(i),r=t.selector("FragmentSelector");if(t.selector("SvgSelector")){const s=Wt(t),a=s.nodeName.toLowerCase();let l=null;if(a==="polygon")l=mx(s,e,n);else if(a==="circle")l=gx(s,e,n);else if(a==="ellipse")l=vx(s,e,n);else if(a==="path")l=yx(s,e,n);else throw`Unsupported SVG shape type: ${a}`;let u=l.outerHTML||new XMLSerializer().serializeToString(l);u=u.replace(` xmlns="${ce}"`,"");const c={selector:{type:"SvgSelector",value:`<svg>${u}</svg>`}};return t.clone({target:c})}else if(r){const{x:s,y:a,w:l,h:u}=Rt(t),c=(s-e.x)*n,h=(a-e.y)*n,d=pn(c,h,l*n,u*n);return t.clone({target:d})}},mx=(i,t,e)=>{const r=Array.from(i.points).map(o=>{const s=e*(o.x-t.x),a=e*(o.y-t.y);return s+","+a}).join(" ");return i.setAttribute("points",r),i},gx=(i,t,e)=>{const n=i.getAttribute("cx"),r=i.getAttribute("cy"),o=i.getAttribute("r");return i.setAttribute("cx",e*(n-t.x)),i.setAttribute("cy",e*(r-t.y)),i.setAttribute("r",o*e),i},vx=(i,t,e)=>{const n=i.getAttribute("cx"),r=i.getAttribute("cy"),o=i.getAttribute("rx"),s=i.getAttribute("ry");return i.setAttribute("cx",e*(n-t.x)),i.setAttribute("cy",e*(r-t.y)),i.setAttribute("rx",o*e),i.setAttribute("ry",s*e),i},yx=(i,t,e)=>{const r=i.getAttribute("d").split(/(?=M|m|L|l|H|h|V|v|Z|z)/g).map(o=>o.trim()).map(o=>{const s=o.substring(0,1);if(s.toLowerCase()==="z")return s;{const a=o.substring(1).split(" ").filter(h=>h).map(h=>parseFloat(h.trim())),l=s===s.toUpperCase(),u=l?e*(a[0]-t.x):e*a[0],c=l?e*(a[1]-t.y):e*a[1];return s+" "+u+" "+c}}).join(" ");return i.setAttribute("d",r),i},ed=(i,t)=>{const{extent:e,scale:n}=gs(i),r=cx(t.annotation);if(r==="FragmentSelector")wx(t,e,n);else if(r==="SvgSelector")bx(t,e,n);else throw`Unsupported selector type type: ${r}`;const o=t.querySelector(".a9s-formatter-el");if(o){const{x:s,y:a}=t.querySelector(".a9s-inner").getBBox();o.setAttribute("x",s),o.setAttribute("y",a)}},wx=(i,t,e)=>{const{x:n,y:r,w:o,h:s}=Rt(i.annotation),a=i.querySelector(".a9s-outer"),l=i.querySelector(".a9s-inner"),u=e*(n-t.x),c=e*(r-t.y);o===0&&s===0?[a,l].forEach(h=>{h.setAttribute("cx",u),h.setAttribute("cy",c)}):[a,l].forEach(h=>{h.setAttribute("x",u),h.setAttribute("y",c),h.setAttribute("width",o*e),h.setAttribute("height",s*e)})},bx=(i,t,e)=>{const n=Wt(i.annotation),r=n.nodeName.toLowerCase();if(r==="polygon")Sx(i,n,t,e);else if(r==="circle")Ex(i,n,t,e);else if(r==="ellipse")xx(i,n,t,e);else if(r==="path")_x(i,n,t,e);else throw`Unsupported SVG shape type: ${r}`},Sx=(i,t,e,n)=>{const o=Array.from(t.points).map(l=>{const u=n*(l.x-e.x),c=n*(l.y-e.y);return u+","+c}).join(" ");i.querySelector(".a9s-outer").setAttribute("points",o),i.querySelector(".a9s-inner").setAttribute("points",o)},Ex=(i,t,e,n)=>{const r=n*(t.getAttribute("cx")-e.x),o=n*(t.getAttribute("cy")-e.y),s=n*t.getAttribute("r"),a=i.querySelector(".a9s-outer");a.setAttribute("cx",r),a.setAttribute("cy",o),a.setAttribute("r",s);const l=i.querySelector(".a9s-inner");l.setAttribute("cx",r),l.setAttribute("cy",o),l.setAttribute("r",s)},xx=(i,t,e,n)=>{const r=n*(t.getAttribute("cx")-e.x),o=n*(t.getAttribute("cy")-e.y),s=n*t.getAttribute("rx"),a=n*t.getAttribute("ry"),l=i.querySelector(".a9s-outer");l.setAttribute("cx",r),l.setAttribute("cy",o),l.setAttribute("rx",s),l.setAttribute("ry",a);const u=i.querySelector(".a9s-inner");u.setAttribute("cx",r),u.setAttribute("cy",o),u.setAttribute("rx",s),u.setAttribute("ry",a)},_x=(i,t,e,n)=>{const o=t.getAttribute("d").split(/(?=M|m|L|l|H|h|V|v|Z|z)/g).map(s=>s.trim()).map(s=>{const a=s.substring(0,1);if(a.toLowerCase()==="z")return a;{const l=s.substring(1).split(" ").filter(d=>d).map(d=>parseFloat(d.trim())),u=a===a.toUpperCase(),c=u?n*(l[0]-e.x):n*l[0],h=u?n*(l[1]-e.y):n*l[1];return a+" "+c+" "+h}}).join(" ");i.querySelector(".a9s-inner").setAttribute("d",o),i.querySelector(".a9s-outer").setAttribute("d",o)},Tx=ss();class Cx extends Jh{constructor(e){super(e);P(this,"_fit",(e,n,r)=>{const o=n?typeof n=="boolean"?n:n.immediately:!1,s=(n==null?void 0:n.padding)||0,a=this.findShape(e);if(a){const l=this.viewer.container.getBoundingClientRect(),u=a.getBoundingClientRect(),c=u.x-l.x,h=u.y-l.y,{width:d,height:g}=u,y=c-s,x=h-s,b=d+2*s,T=g+2*s,f=this.viewer.viewport.viewerElementToViewportRectangle(new Dt.Rect(y,x,b,T));this.viewer.viewport[r](f,o)}});P(this,"_getShapeAt",e=>{const n=l=>{if(Tx){const u=this.svg.getBoundingClientRect(),c=l.clientX-u.x,h=l.clientY-u.y;return new Dt.Point(c,h)}else return new Dt.Point(l.offsetX,l.offsetY)},r=this.viewer.viewport.viewerElementToViewportCoordinates(n(e)),{x:o,y:s}=this.viewer.viewport.viewportToImageCoordinates(r.x,r.y),a=this.store.getAnnotationAt(o,s,this.currentScale());if(a)return this.findShape(a)});P(this,"_refreshNonScalingAnnotations",()=>{});P(this,"addAnnotation",(e,n)=>{const r=n||this.g,o=ds(e,this.env.image);return Et(o,"a9s-annotation"),o.setAttribute("data-id",e.id),o.annotation=e,ed(this.viewer,o),r.appendChild(o),nr(o,e,this.formatters),o});P(this,"addOrUpdateAnnotation",(e,n)=>{var o;const r=(o=this.selectedShape)==null?void 0:o.annotation;(r===e||(r==null?void 0:r.isSelection)||r==n)&&this.deselect(),n&&this.removeAnnotation(e),this.removeAnnotation(e),this.addAnnotation(e),this.store.insert(e)});P(this,"deselect",()=>{var e;if((e=this.tools)==null||e.current.stop(),this.selectedShape){const{annotation:n}=this.selectedShape;this.selectedShape.destroy?(this.selectedShape.mouseTracker.destroy(),this.selectedShape.destroy(),n.isSelection||this.addAnnotation(n)):Qi(this.selectedShape,"selected"),this.selectedShape=null}});P(this,"onDrawingComplete",e=>{const n=e.annotation.clone({target:Qh(this.viewer,e.annotation.target)});e.annotation=n,this.selectShape(e),this.emit("createSelection",e.annotation),this.mouseTracker.enabled=!1});P(this,"selectShape",(e,n)=>{var s;if(!n&&!e.annotation.isSelection&&this.emit("clickAnnotation",e.annotation,e),((s=this.selectedShape)==null?void 0:s.annotation)===e.annotation)return;this.selectedShape&&this.selectedShape.annotation!==e.annotation&&this.deselect(!0);const{annotation:r}=e;if(this.readOnly||r.readOnly||this.headless)this.selectedShape=e,Et(e,"selected"),n||this.emit("select",{annotation:r,element:e,skipEvent:n});else{setTimeout(()=>{e.parentNode.removeChild(e),n||this.emit("select",{annotation:r,element:this.selectedShape.element})},1);const a=this.tools.forAnnotation(r);this.selectedShape=a.createEditableShape(r),this.selectedShape.element.annotation=r;const l=$h(this.viewer,r);this.selectedShape.updateState(l);const u=new Dt.MouseTracker({element:this.svg,preProcessEventHandler:c=>{c.stopPropagation=!0,c.preventDefault=!1,c.preventGesture=!0}}).setTracking(!1);this.selectedShape.element.addEventListener("mouseenter",()=>{this.hoveredShape=this.selectedShape,u.setTracking(!0)}),this.selectedShape.element.addEventListener("mouseleave",()=>{this.hoveredShape=null,u.setTracking(!1)}),this.selectedShape.mouseTracker=u,this.selectedShape.on("update",c=>{const h=Qh(this.viewer,c);this.selectedShape.element.annotation=this.selectedShape.annotation.clone({target:h}),this.emit("updateTarget",this.selectedShape.element,h)})}});this._initDrawingTools(!0)}resize(){if(!this.store)return;if(Array.from(this.g.querySelectorAll(".a9s-annotation:not(.selected)")).forEach(n=>ed(this.viewer,n)),this.selectedShape)if(this.selectedShape.element){const n=$h(this.viewer,this.selectedShape.element.annotation);this.selectedShape.updateState&&this.selectedShape.updateState(n),this.emit("viewportChange",this.selectedShape.element)}else this.emit("viewportChange",this.selectedShape)}}var Px=0;function td(i,t,e,n,r){var o,s,a={};for(s in t)s=="ref"?o=t[s]:a[s]=t[s];var l={type:i,props:a,key:e,ref:o,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:--Px,__source:n,__self:r};if(typeof i=="function"&&(o=i.defaultProps))for(s in o)a[s]===void 0&&(a[s]=o[s]);return X.vnode&&X.vnode(l),l}class Ax extends Pe{constructor(e){super(e);P(this,"clearState",e=>this.setState({selectedAnnotation:null,selectedDOMElement:null,modifiedTarget:null,beforeHeadlessModify:null},e));P(this,"forwardEvent",(e,n)=>{this.annotationLayer.on(e,(r,o)=>{this.props[n](r.clone(),o)})});P(this,"onKeyUp",e=>{if(e.which===27){this.annotationLayer.stopDrawing();const{selectedAnnotation:n}=this.state;n&&(this.cancelSelected(),this.props.onCancelSelected(n))}else if(e.which===46){const{disableDeleteKey:n}=this.props.config;if(!n){const{selectedAnnotation:r}=this.state;r&&(r.isSelection?this.onCancelAnnotation(r):this.onDeleteAnnotation(r))}}});P(this,"handleStartSelect",e=>this.props.onSelectionStarted(e));P(this,"handleEndSelect",e=>this.props.onSelectionEnded(e));P(this,"handleSelect",(e,n)=>{this.state.editorDisabled?this.onHeadlessSelect(e,n):this.onNormalSelect(e,n)});P(this,"onNormalSelect",(e,n)=>{const{annotation:r,element:o}=e;if(r){const s=()=>{this.setState({selectedAnnotation:r,selectedDOMElement:o,modifiedTarget:null},()=>{n||(r.isSelection?this.props.onSelectionCreated(r.clone()):this.props.onAnnotationSelected(r.clone(),o))})},{selectedAnnotation:a}=this.state;a&&!a.isEqual(r)?this.clearState(()=>{this.props.onCancelSelected(a),s()}):s()}else{const{selectedAnnotation:s}=this.state;s?this.clearState(()=>this.props.onCancelSelected(s)):this.clearState()}});P(this,"onHeadlessSelect",(e,n)=>{this.saveSelected().then(()=>{this.onNormalSelect(e,n)})});P(this,"handleUpdateTarget",(e,n)=>{this.setState({selectedDOMElement:e,modifiedTarget:n});const r=JSON.parse(JSON.stringify(n));this.props.onSelectionTargetChanged(r)});P(this,"handleViewportChange",e=>this.setState({selectedDOMElement:e}));P(this,"overrideAnnotationId",e=>n=>{const{id:r}=e;this.state.selectedAnnotation?this.setState({selectedAnnotation:null,selectedDOMElement:null,modifiedTarget:null},()=>{this.annotationLayer.overrideId(r,n)}):this.annotationLayer.overrideId(r,n)});P(this,"onCreateOrUpdateAnnotation",(e,n)=>(r,o)=>{let s=r.isSelection?r.toAnnotation():r;s=this.state.modifiedTarget?s.clone({target:this.state.modifiedTarget}):s.clone(),this.clearState(()=>{this.annotationLayer.addOrUpdateAnnotation(s,o),o?this.props[e](s,o.clone()):this.props[e](s,this.overrideAnnotationId(s)),n&&n()})});P(this,"onDeleteAnnotation",e=>{this.clearState(),this.annotationLayer.removeAnnotation(e),this.props.onAnnotationDeleted(e)});P(this,"onCancelAnnotation",(e,n)=>{this.state.editorDisabled||this.annotationLayer.deselect(),this.props.onCancelSelected(e),this.clearState(n)});P(this,"addAnnotation",e=>{var n;e.id===((n=this.state.selectedAnnotation)==null?void 0:n.id)&&(this.annotationLayer.deselect(),this.clearState()),this.annotationLayer.addOrUpdateAnnotation(e.clone())});P(this,"addDrawingTool",e=>this.annotationLayer.addDrawingTool(e));P(this,"cancelSelected",()=>new Promise(e=>{this.annotationLayer.deselect(),this.state.selectedAnnotation?this.clearState(e):e()}));P(this,"fitBounds",(e,n)=>this.annotationLayer.fitBounds(e,n));P(this,"fitBoundsWithConstraints",(e,n)=>this.annotationLayer.fitBoundsWithConstraints(e,n));P(this,"getAnnotationById",e=>{var n;return(n=this.annotationLayer.findShape(e))==null?void 0:n.annotation});P(this,"getAnnotations",()=>this.annotationLayer.getAnnotations().map(e=>e.clone()));P(this,"getAnnotationsIntersecting",e=>this.annotationLayer.getAnnotationsIntersecting(e));P(this,"getImageSnippetById",e=>this.annotationLayer.getImageSnippetById(e));P(this,"getSelected",()=>{var e;if(this.state.selectedAnnotation)return this.state.editorDisabled?this.state.selectedAnnotation:(e=this._editor.current)==null?void 0:e.getCurrentAnnotation()});P(this,"getSelectedImageSnippet",()=>this.annotationLayer.getSelectedImageSnippet());P(this,"listDrawingTools",()=>this.annotationLayer.listDrawingTools());P(this,"panTo",(e,n)=>this.annotationLayer.panTo(e,n));P(this,"removeAnnotation",e=>this.annotationLayer.removeAnnotation(e));P(this,"removeDrawingTool",e=>this.annotationLayer.removeDrawingTool(e));P(this,"saveSelected",()=>new Promise(e=>{const n=this.state.selectedAnnotation;if(n)if(this._editor.current)this._editor.current.onOk(),e();else if(n.isSelection)n.bodies.length>0||this.props.config.allowEmpty?this.onCreateOrUpdateAnnotation("onAnnotationCreated",e)(n):(this.annotationLayer.deselect(),e());else{const{beforeHeadlessModify:r,modifiedTarget:o}=this.state;r?this.onCreateOrUpdateAnnotation("onAnnotationUpdated",e)(n,r):o?this.onCreateOrUpdateAnnotation("onAnnotationUpdated",e)(n,n):this.onCancelAnnotation(n,e)}else e()}));P(this,"selectAnnotation",e=>{const n=this.annotationLayer.selectAnnotation(e,!0);if(n)return this.handleSelect(n,!0),n.annotation.clone();this.clearState()});P(this,"setAnnotations",e=>this.annotationLayer.init(e.map(n=>n.clone())));P(this,"setDrawingEnabled",e=>this.annotationLayer.setDrawingEnabled(e));P(this,"setDrawingTool",e=>this.annotationLayer.setDrawingTool(e));P(this,"setVisible",e=>{this.annotationLayer.setVisible(e),e||this.clearState()});P(this,"updateSelected",(e,n)=>new Promise(r=>{this.state.selectedAnnotation&&(n?this.state.selectedAnnotation.isSelection?this.onCreateOrUpdateAnnotation("onAnnotationCreated",r)(e):this.onCreateOrUpdateAnnotation("onAnnotationUpdated",r)(e,this.state.selectedAnnotation):this.setState({selectedAnnotation:e,beforeHeadlessModify:this.state.beforeHeadlessModify||this.state.selectedAnnotation},r))}));this.state={selectedAnnotation:null,selectedDOMElement:null,modifiedTarget:null,readOnly:e.config.readOnly,editorDisabled:e.config.disableEditor,widgets:e.config.widgets,beforeHeadlessModify:null},this._editor=k.createRef()}componentDidMount(){this.annotationLayer=this.props.config.gigapixelMode?new Cx(this.props):new ux(this.props),this.annotationLayer.on("load",this.props.onLoad),this.annotationLayer.on("startSelection",this.handleStartSelect),this.annotationLayer.on("endSelection",this.handleEndSelect),this.annotationLayer.on("select",this.handleSelect),this.annotationLayer.on("updateTarget",this.handleUpdateTarget),this.annotationLayer.on("viewportChange",this.handleViewportChange),this.forwardEvent("clickAnnotation","onClickAnnotation"),this.forwardEvent("mouseEnterAnnotation","onMouseEnterAnnotation"),this.forwardEvent("mouseLeaveAnnotation","onMouseLeaveAnnotation"),document.addEventListener("keyup",this.onKeyUp)}componentWillUnmount(){this.annotationLayer.destroy(),document.removeEventListener("keyup",this.onKeyUp)}get disableEditor(){return this.state.editorDisabled}set disableEditor(e){this.setState({editorDisabled:e})}get disableSelect(){return this.annotationLayer.disableSelect}set disableSelect(e){this.annotationLayer.disableSelect=e}get formatters(){return this.annotationLayer.formatters}set formatters(e){this.annotationLayer.formatters=e}get readOnly(){return this.state.readOnly}set readOnly(e){this.annotationLayer.readOnly=e,this.setState({readOnly:e})}get widgets(){return this.state.widgets}set widgets(e){this.setState({widgets:e})}render(){var r;const e=this.state.selectedAnnotation&&!this.state.editorDisabled,n=this.state.readOnly||((r=this.state.selectedAnnotation)==null?void 0:r.readOnly);return e&&td(mE,{ref:this._editor,detachable:!0,wrapperEl:this.props.wrapperEl,annotation:this.state.selectedAnnotation,modifiedTarget:this.state.modifiedTarget,selectedElement:this.state.selectedDOMElement,readOnly:n,allowEmpty:this.props.config.allowEmpty,widgets:this.state.widgets,env:this.props.env,onAnnotationCreated:this.onCreateOrUpdateAnnotation("onAnnotationCreated"),onAnnotationUpdated:this.onCreateOrUpdateAnnotation("onAnnotationUpdated"),onAnnotationDeleted:this.onDeleteAnnotation,onCancel:this.onCancelAnnotation})}}var I1="",N1="",H1="";class Ox{constructor(t,e){P(this,"handleAnnotationCreated",(t,e)=>this._emitter.emit("createAnnotation",t.underlying,e));P(this,"handleAnnotationDeleted",t=>this._emitter.emit("deleteAnnotation",t.underlying));P(this,"handleAnnotationSelected",(t,e)=>this._emitter.emit("selectAnnotation",t.underlying,e));P(this,"handleAnnotationUpdated",(t,e)=>this._emitter.emit("updateAnnotation",t.underlying,e.underlying));P(this,"handleCancelSelected",t=>this._emitter.emit("cancelSelected",t.underlying));P(this,"handleClickAnnotation",(t,e)=>this._emitter.emit("clickAnnotation",t.underlying,e));P(this,"handleLoad",t=>this._emitter.emit("load",t));P(this,"handleSelectionCreated",t=>this._emitter.emit("createSelection",t.underlying));P(this,"handleSelectionStarted",t=>this._emitter.emit("startSelection",t));P(this,"handleSelectionEnded",t=>this._emitter.emit("endSelection",t));P(this,"handleSelectionTargetChanged",t=>this._emitter.emit("changeSelectionTarget",t));P(this,"handleMouseEnterAnnotation",(t,e)=>this._emitter.emit("mouseEnterAnnotation",t.underlying,e));P(this,"handleMouseLeaveAnnotation",(t,e)=>this._emitter.emit("mouseLeaveAnnotation",t.underlying,e));P(this,"_wrap",t=>(t==null?void 0:t.type)==="Annotation"?new St(t):t);P(this,"addAnnotation",t=>this._app.current.addAnnotation(new St(t)));P(this,"addDrawingTool",t=>this._app.current.addDrawingTool(t));P(this,"cancelSelected",()=>this._app.current.cancelSelected());P(this,"clearAnnotations",()=>this.setAnnotations([]));P(this,"clearAuthInfo",()=>this._env.user=null);P(this,"destroy",()=>k.unmountComponentAtNode(this.appContainerEl));P(this,"fitBounds",(t,e)=>this._app.current.fitBounds(this._wrap(t),e));P(this,"fitBoundsWithConstraints",(t,e)=>this._app.current.fitBoundsWithConstraints(this._wrap(t),e));P(this,"getAnnotationById",t=>{const e=this._app.current.getAnnotationById(t);return e==null?void 0:e.underlying});P(this,"getAnnotations",()=>this._app.current.getAnnotations().map(e=>e.underlying));P(this,"getAnnotationsIntersecting",t=>this._app.current.getAnnotationsIntersecting(this._wrap(t)));P(this,"getImageSnippetById",t=>this._app.current.getImageSnippetById(t));P(this,"getSelected",()=>{const t=this._app.current.getSelected();return t==null?void 0:t.underlying});P(this,"getSelectedImageSnippet",()=>this._app.current.getSelectedImageSnippet());P(this,"listDrawingTools",()=>this._app.current.listDrawingTools());P(this,"loadAnnotations",t=>fetch(t).then(e=>e.json()).then(e=>(this.setAnnotations(e),e)));P(this,"off",(t,e)=>this._emitter.off(t,e));P(this,"on",(t,e)=>this._emitter.on(t,e));P(this,"once",(t,e)=>this._emitter.once(t,e));P(this,"panTo",(t,e)=>this._app.current.panTo(this._wrap(t),e));P(this,"removeAnnotation",t=>this._app.current.removeAnnotation(this._wrap(t)));P(this,"removeDrawingTool",t=>this._app.current.removeDrawingTool(t));P(this,"saveSelected",()=>this._app.current.saveSelected());P(this,"selectAnnotation",t=>{const e=this._app.current.selectAnnotation(this._wrap(t));return e==null?void 0:e.underlying});P(this,"setAnnotations",t=>{const n=(t||[]).map(r=>new St(r));this._app.current.setAnnotations(n)});P(this,"setAuthInfo",t=>this._env.user=t);P(this,"setDrawingEnabled",t=>this._app.current.setDrawingEnabled(t));P(this,"setDrawingTool",t=>this._app.current.setDrawingTool(t));P(this,"setServerTime",t=>this._env.setServerTime(t));P(this,"setVisible",t=>this._app.current.setVisible(t));P(this,"updateSelected",(t,e)=>{let n=null;t.type==="Annotation"?n=new St(t):t.type==="Selection"&&(n=new Wn(t.target,t.body)),n&&this._app.current.updateSelected(n,e)});const n=e||{};this._app=k.createRef(),this._emitter=new Qn,this._env=EE(),this._element=t.element,window.getComputedStyle(this._element).getPropertyValue("position")==="static"&&(this._element.style.position="relative"),xE(n.locale,n.messages),this.appContainerEl=document.createElement("DIV"),this._element.appendChild(this.appContainerEl),k.render(td(Ax,{ref:this._app,viewer:t,wrapperEl:this._element,config:n,env:this._env,onSelectionStarted:this.handleSelectionStarted,onSelectionEnded:this.handleSelectionEnded,onSelectionCreated:this.handleSelectionCreated,onSelectionTargetChanged:this.handleSelectionTargetChanged,onAnnotationCreated:this.handleAnnotationCreated,onAnnotationSelected:this.handleAnnotationSelected,onAnnotationUpdated:this.handleAnnotationUpdated,onAnnotationDeleted:this.handleAnnotationDeleted,onCancelSelected:this.handleCancelSelected,onClickAnnotation:this.handleClickAnnotation,onLoad:this.handleLoad,onMouseEnterAnnotation:this.handleMouseEnterAnnotation,onMouseLeaveAnnotation:this.handleMouseLeaveAnnotation}),this.appContainerEl)}get disableEditor(){return this._app.current.disableEditor}set disableEditor(t){this._app.current.disableEditor=t}get disableSelect(){return this._app.current.disableSelect}set disableSelect(t){this._app.current.disableSelect=t}get formatters(){return this._app.current.formatters||[]}set formatters(t){if(t){const e=Array.isArray(t)?t:[t];this._app.current.formatters=e}else this._app.current.formatters=null}get readOnly(){return this._app.current.readOnly}set readOnly(t){this._app.current.readOnly=t}get widgets(){return this._app.current.widgets}set widgets(t){this._app.current.widgets=t}}var Dx=(i,t)=>new Ox(i,t);return Dx});
//# sourceMappingURL=annotorious-openseadragon.umd.js.map