diff --git a/README.md b/README.md index 2b2f1135..2b981088 100644 --- a/README.md +++ b/README.md @@ -23,17 +23,17 @@ Embed TIFY into your website in three easy steps: - Either download TIFY and copy the contents of the `dist` directory to your server: ``` html - - + + ``` - > To avoid issues with browser caching, add a query parameter with the current version, e.g. `?v0.29.0`. + > To avoid issues with browser caching, add a query parameter with the current version, e.g. `?v0.29.1`. - Or use [jsDelivr](https://www.jsdelivr.com/): ``` html - - + + ``` - Or `import` TIFY into your web application: diff --git a/dist/index.html b/dist/index.html index 715da43c..4c77fc18 100644 --- a/dist/index.html +++ b/dist/index.html @@ -29,7 +29,8 @@ color: #fff; cursor: pointer; font: .9em/1rem monospace; - padding: .25rem .5rem + padding: .25rem .5rem; + white-space: nowrap; } .button + .button { @@ -53,7 +54,7 @@ box-shadow: 0 -1px inset; flex: 1; font: .9em/1rem monospace; - padding: .25rem .5rem + padding: .25rem .5rem; } .header-input:focus { diff --git a/dist/tify.css b/dist/tify.css index 9a48837d..87783457 100644 --- a/dist/tify.css +++ b/dist/tify.css @@ -1,5 +1,5 @@ /*! -TIFY v0.29.0 +TIFY v0.29.1 (c) 2017-2023 Göttingen State and University Library (https://www.sub.uni-goettingen.de/) AGPL-3.0 https://tify.rocks/ diff --git a/dist/tify.js b/dist/tify.js index c2b48058..b3597175 100644 --- a/dist/tify.js +++ b/dist/tify.js @@ -1,14 +1,14 @@ /*! -TIFY v0.29.0 +TIFY v0.29.1 (c) 2017-2023 Göttingen State and University Library (https://www.sub.uni-goettingen.de/) AGPL-3.0 https://tify.rocks/ */ -(function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))i(n);new MutationObserver(n=>{for(const r of n)if(r.type==="childList")for(const l of r.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&i(l)}).observe(document,{childList:!0,subtree:!0});function e(n){const r={};return n.integrity&&(r.integrity=n.integrity),n.referrerPolicy&&(r.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?r.credentials="include":n.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function i(n){if(n.ep)return;n.ep=!0;const r=e(n);fetch(n.href,r)}})();function Zi(t,s){const e=Object.create(null),i=t.split(",");for(let n=0;n!!e[n.toLowerCase()]:n=>!!e[n]}const Te={},Ht=[],Ge=()=>{},or=()=>!1,ar=/^on[^a-z]/,di=t=>ar.test(t),Ki=t=>t.startsWith("onUpdate:"),Oe=Object.assign,Xi=(t,s)=>{const e=t.indexOf(s);e>-1&&t.splice(e,1)},lr=Object.prototype.hasOwnProperty,ve=(t,s)=>lr.call(t,s),le=Array.isArray,Ot=t=>fi(t)==="[object Map]",ns=t=>fi(t)==="[object Set]",ge=t=>typeof t=="function",Se=t=>typeof t=="string",Yi=t=>typeof t=="symbol",Ee=t=>t!==null&&typeof t=="object",ss=t=>Ee(t)&&ge(t.then)&&ge(t.catch),rs=Object.prototype.toString,fi=t=>rs.call(t),ur=t=>fi(t).slice(8,-1),os=t=>fi(t)==="[object Object]",Ji=t=>Se(t)&&t!=="NaN"&&t[0]!=="-"&&""+parseInt(t,10)===t,ti=Zi(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),pi=t=>{const s=Object.create(null);return e=>s[e]||(s[e]=t(e))},cr=/-(\w)/g,Qe=pi(t=>t.replace(cr,(s,e)=>e?e.toUpperCase():"")),hr=/\B([A-Z])/g,Et=pi(t=>t.replace(hr,"-$1").toLowerCase()),gi=pi(t=>t.charAt(0).toUpperCase()+t.slice(1)),Ei=pi(t=>t?`on${gi(t)}`:""),oi=(t,s)=>!Object.is(t,s),ii=(t,s)=>{for(let e=0;e{Object.defineProperty(t,s,{configurable:!0,enumerable:!1,value:e})},Li=t=>{const s=parseFloat(t);return isNaN(s)?t:s};let bn;const Mi=()=>bn||(bn=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function Qi(t){if(le(t)){const s={};for(let e=0;e{if(e){const i=e.split(fr);i.length>1&&(s[i[0].trim()]=i[1].trim())}}),s}function xe(t){let s="";if(Se(t))s=t;else if(le(t))for(let e=0;eSe(t)?t:t==null?"":le(t)||Ee(t)&&(t.toString===rs||!ge(t.toString))?JSON.stringify(t,ls,2):String(t),ls=(t,s)=>s&&s.__v_isRef?ls(t,s.value):Ot(s)?{[`Map(${s.size})`]:[...s.entries()].reduce((e,[i,n])=>(e[`${i} =>`]=n,e),{})}:ns(s)?{[`Set(${s.size})`]:[...s.values()]}:Ee(s)&&!le(s)&&!os(s)?String(s):s;let Ue;class yr{constructor(s=!1){this.detached=s,this._active=!0,this.effects=[],this.cleanups=[],this.parent=Ue,!s&&Ue&&(this.index=(Ue.scopes||(Ue.scopes=[])).push(this)-1)}get active(){return this._active}run(s){if(this._active){const e=Ue;try{return Ue=this,s()}finally{Ue=e}}}on(){Ue=this}off(){Ue=this.parent}stop(s){if(this._active){let e,i;for(e=0,i=this.effects.length;e{const s=new Set(t);return s.w=0,s.n=0,s},us=t=>(t.w&dt)>0,cs=t=>(t.n&dt)>0,Tr=({deps:t})=>{if(t.length)for(let s=0;s{const{deps:s}=t;if(s.length){let e=0;for(let i=0;i{(h==="length"||h>=o)&&a.push(u)})}else switch(e!==void 0&&a.push(l.get(e)),s){case"add":le(t)?Ji(e)&&a.push(l.get("length")):(a.push(l.get(Tt)),Ot(t)&&a.push(l.get(Fi)));break;case"delete":le(t)||(a.push(l.get(Tt)),Ot(t)&&a.push(l.get(Fi)));break;case"set":Ot(t)&&a.push(l.get(Tt));break}if(a.length===1)a[0]&&Ai(a[0]);else{const o=[];for(const u of a)u&&o.push(...u);Ai($i(o))}}function Ai(t,s){const e=le(t)?t:[...t];for(const i of e)i.computed&&Pn(i);for(const i of e)i.computed||Pn(i)}function Pn(t,s){(t!==We||t.allowRecurse)&&(t.scheduler?t.scheduler():t.run())}const br=Zi("__proto__,__v_isRef,__isVue"),fs=new Set(Object.getOwnPropertyNames(Symbol).filter(t=>t!=="arguments"&&t!=="caller").map(t=>Symbol[t]).filter(Yi)),Er=tn(),Pr=tn(!1,!0),Sr=tn(!0),Sn=Cr();function Cr(){const t={};return["includes","indexOf","lastIndexOf"].forEach(s=>{t[s]=function(...e){const i=_e(this);for(let r=0,l=this.length;r{t[s]=function(...e){Ft();const i=_e(this)[s].apply(this,e);return At(),i}}),t}function Rr(t){const s=_e(this);return ze(s,"has",t),s.hasOwnProperty(t)}function tn(t=!1,s=!1){return function(i,n,r){if(n==="__v_isReactive")return!t;if(n==="__v_isReadonly")return t;if(n==="__v_isShallow")return s;if(n==="__v_raw"&&r===(t?s?jr:ys:s?vs:ms).get(i))return i;const l=le(i);if(!t){if(l&&ve(Sn,n))return Reflect.get(Sn,n,r);if(n==="hasOwnProperty")return Rr}const a=Reflect.get(i,n,r);return(Yi(n)?fs.has(n):br(n))||(t||ze(i,"get",n),s)?a:Fe(a)?l&&Ji(n)?a:a.value:Ee(a)?t?ws(a):vi(a):a}}const Hr=ps(),Or=ps(!0);function ps(t=!1){return function(e,i,n,r){let l=e[i];if(jt(l)&&Fe(l)&&!Fe(n))return!1;if(!t&&(!Bi(n)&&!jt(n)&&(l=_e(l),n=_e(n)),!le(e)&&Fe(l)&&!Fe(n)))return l.value=n,!0;const a=le(e)&&Ji(i)?Number(i)t,mi=t=>Reflect.getPrototypeOf(t);function Xt(t,s,e=!1,i=!1){t=t.__v_raw;const n=_e(t),r=_e(s);e||(s!==r&&ze(n,"get",s),ze(n,"get",r));const{has:l}=mi(n),a=i?nn:e?an:on;if(l.call(n,s))return a(t.get(s));if(l.call(n,r))return a(t.get(r));t!==n&&t.get(s)}function Yt(t,s=!1){const e=this.__v_raw,i=_e(e),n=_e(t);return s||(t!==n&&ze(i,"has",t),ze(i,"has",n)),t===n?e.has(t):e.has(t)||e.has(n)}function Jt(t,s=!1){return t=t.__v_raw,!s&&ze(_e(t),"iterate",Tt),Reflect.get(t,"size",t)}function Cn(t){t=_e(t);const s=_e(this);return mi(s).has.call(s,t)||(s.add(t),tt(s,"add",t,t)),this}function Rn(t,s){s=_e(s);const e=_e(this),{has:i,get:n}=mi(e);let r=i.call(e,t);r||(t=_e(t),r=i.call(e,t));const l=n.call(e,t);return e.set(t,s),r?oi(s,l)&&tt(e,"set",t,s):tt(e,"add",t,s),this}function Hn(t){const s=_e(this),{has:e,get:i}=mi(s);let n=e.call(s,t);n||(t=_e(t),n=e.call(s,t)),i&&i.call(s,t);const r=s.delete(t);return n&&tt(s,"delete",t,void 0),r}function On(){const t=_e(this),s=t.size!==0,e=t.clear();return s&&tt(t,"clear",void 0,void 0),e}function Qt(t,s){return function(i,n){const r=this,l=r.__v_raw,a=_e(l),o=s?nn:t?an:on;return!t&&ze(a,"iterate",Tt),l.forEach((u,h)=>i.call(n,o(u),o(h),r))}}function $t(t,s,e){return function(...i){const n=this.__v_raw,r=_e(n),l=Ot(r),a=t==="entries"||t===Symbol.iterator&&l,o=t==="keys"&&l,u=n[t](...i),h=e?nn:s?an:on;return!s&&ze(r,"iterate",o?Fi:Tt),{next(){const{value:g,done:m}=u.next();return m?{value:g,done:m}:{value:a?[h(g[0]),h(g[1])]:h(g),done:m}},[Symbol.iterator](){return this}}}}function ot(t){return function(...s){return t==="delete"?!1:this}}function Ar(){const t={get(r){return Xt(this,r)},get size(){return Jt(this)},has:Yt,add:Cn,set:Rn,delete:Hn,clear:On,forEach:Qt(!1,!1)},s={get(r){return Xt(this,r,!1,!0)},get size(){return Jt(this)},has:Yt,add:Cn,set:Rn,delete:Hn,clear:On,forEach:Qt(!1,!0)},e={get(r){return Xt(this,r,!0)},get size(){return Jt(this,!0)},has(r){return Yt.call(this,r,!0)},add:ot("add"),set:ot("set"),delete:ot("delete"),clear:ot("clear"),forEach:Qt(!0,!1)},i={get(r){return Xt(this,r,!0,!0)},get size(){return Jt(this,!0)},has(r){return Yt.call(this,r,!0)},add:ot("add"),set:ot("set"),delete:ot("delete"),clear:ot("clear"),forEach:Qt(!0,!0)};return["keys","values","entries",Symbol.iterator].forEach(r=>{t[r]=$t(r,!1,!1),e[r]=$t(r,!0,!1),s[r]=$t(r,!1,!0),i[r]=$t(r,!0,!0)}),[t,e,s,i]}const[Br,Ir,zr,Nr]=Ar();function sn(t,s){const e=s?t?Nr:zr:t?Ir:Br;return(i,n,r)=>n==="__v_isReactive"?!t:n==="__v_isReadonly"?t:n==="__v_raw"?i:Reflect.get(ve(e,n)&&n in i?e:i,n,r)}const Vr={get:sn(!1,!1)},Ur={get:sn(!1,!0)},Wr={get:sn(!0,!1)},ms=new WeakMap,vs=new WeakMap,ys=new WeakMap,jr=new WeakMap;function Gr(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function qr(t){return t.__v_skip||!Object.isExtensible(t)?0:Gr(ur(t))}function vi(t){return jt(t)?t:rn(t,!1,gs,Vr,ms)}function Zr(t){return rn(t,!1,Fr,Ur,vs)}function ws(t){return rn(t,!0,kr,Wr,ys)}function rn(t,s,e,i,n){if(!Ee(t)||t.__v_raw&&!(s&&t.__v_isReactive))return t;const r=n.get(t);if(r)return r;const l=qr(t);if(l===0)return t;const a=new Proxy(t,l===2?i:e);return n.set(t,a),a}function Lt(t){return jt(t)?Lt(t.__v_raw):!!(t&&t.__v_isReactive)}function jt(t){return!!(t&&t.__v_isReadonly)}function Bi(t){return!!(t&&t.__v_isShallow)}function _s(t){return Lt(t)||jt(t)}function _e(t){const s=t&&t.__v_raw;return s?_e(s):t}function Ts(t){return ai(t,"__v_skip",!0),t}const on=t=>Ee(t)?vi(t):t,an=t=>Ee(t)?ws(t):t;function Kr(t){ct&&We&&(t=_e(t),ds(t.dep||(t.dep=$i())))}function Xr(t,s){t=_e(t);const e=t.dep;e&&Ai(e)}function Fe(t){return!!(t&&t.__v_isRef===!0)}function Yr(t){return Fe(t)?t.value:t}const Jr={get:(t,s,e)=>Yr(Reflect.get(t,s,e)),set:(t,s,e,i)=>{const n=t[s];return Fe(n)&&!Fe(e)?(n.value=e,!0):Reflect.set(t,s,e,i)}};function xs(t){return Lt(t)?t:new Proxy(t,Jr)}class Qr{constructor(s,e,i,n){this._setter=e,this.dep=void 0,this.__v_isRef=!0,this.__v_isReadonly=!1,this._dirty=!0,this.effect=new en(s,()=>{this._dirty||(this._dirty=!0,Xr(this))}),this.effect.computed=this,this.effect.active=this._cacheable=!n,this.__v_isReadonly=i}get value(){const s=_e(this);return Kr(s),(s._dirty||!s._cacheable)&&(s._dirty=!1,s._value=s.effect.run()),s._value}set value(s){this._setter(s)}}function $r(t,s,e=!1){let i,n;const r=ge(t);return r?(i=t,n=Ge):(i=t.get,n=t.set),new Qr(i,n,r||!n,e)}function ht(t,s,e,i){let n;try{n=i?t(...i):t()}catch(r){yi(r,s,e)}return n}function qe(t,s,e,i){if(ge(t)){const r=ht(t,s,e,i);return r&&ss(r)&&r.catch(l=>{yi(l,s,e)}),r}const n=[];for(let r=0;r>>1;qt(Le[i])Je&&Le.splice(s,1)}function no(t){le(t)?Mt.push(...t):(!et||!et.includes(t,t.allowRecurse?vt+1:vt))&&Mt.push(t),Ps()}function Ln(t,s=Gt?Je+1:0){for(;sqt(e)-qt(i)),vt=0;vtt.id==null?1/0:t.id,so=(t,s)=>{const e=qt(t)-qt(s);if(e===0){if(t.pre&&!s.pre)return-1;if(s.pre&&!t.pre)return 1}return e};function Cs(t){Ii=!1,Gt=!0,Le.sort(so);const s=Ge;try{for(Je=0;JeSe(T)?T.trim():T)),g&&(n=e.map(Li))}let a,o=i[a=Ei(s)]||i[a=Ei(Qe(s))];!o&&r&&(o=i[a=Ei(Et(s))]),o&&qe(o,t,6,n);const u=i[a+"Once"];if(u){if(!t.emitted)t.emitted={};else if(t.emitted[a])return;t.emitted[a]=!0,qe(u,t,6,n)}}function Rs(t,s,e=!1){const i=s.emitsCache,n=i.get(t);if(n!==void 0)return n;const r=t.emits;let l={},a=!1;if(!ge(t)){const o=u=>{const h=Rs(u,s,!0);h&&(a=!0,Oe(l,h))};!e&&s.mixins.length&&s.mixins.forEach(o),t.extends&&o(t.extends),t.mixins&&t.mixins.forEach(o)}return!r&&!a?(Ee(t)&&i.set(t,null),null):(le(r)?r.forEach(o=>l[o]=null):Oe(l,r),Ee(t)&&i.set(t,l),l)}function wi(t,s){return!t||!di(s)?!1:(s=s.slice(2).replace(/Once$/,""),ve(t,s[0].toLowerCase()+s.slice(1))||ve(t,Et(s))||ve(t,s))}let Ve=null,Hs=null;function li(t){const s=Ve;return Ve=t,Hs=t&&t.type.__scopeId||null,s}function oo(t,s=Ve,e){if(!s||t._n)return t;const i=(...n)=>{i._d&&Un(-1);const r=li(s);let l;try{l=t(...n)}finally{li(r),i._d&&Un(1)}return l};return i._n=!0,i._c=!0,i._d=!0,i}function Pi(t){const{type:s,vnode:e,proxy:i,withProxy:n,props:r,propsOptions:[l],slots:a,attrs:o,emit:u,render:h,renderCache:g,data:m,setupState:T,ctx:x,inheritAttrs:P}=t;let C,k;const d=li(t);try{if(e.shapeFlag&4){const S=n||i;C=Ye(h.call(S,S,g,r,T,m,x)),k=o}else{const S=s;C=Ye(S.length>1?S(r,{attrs:o,slots:a,emit:u}):S(r,null)),k=s.props?o:ao(o)}}catch(S){Wt.length=0,yi(S,t,1),C=te(bt)}let _=C;if(k&&P!==!1){const S=Object.keys(k),{shapeFlag:M}=_;S.length&&M&7&&(l&&S.some(Ki)&&(k=lo(k,l)),_=Dt(_,k))}return e.dirs&&(_=Dt(_),_.dirs=_.dirs?_.dirs.concat(e.dirs):e.dirs),e.transition&&(_.transition=e.transition),C=_,li(d),C}const ao=t=>{let s;for(const e in t)(e==="class"||e==="style"||di(e))&&((s||(s={}))[e]=t[e]);return s},lo=(t,s)=>{const e={};for(const i in t)(!Ki(i)||!(i.slice(9)in s))&&(e[i]=t[i]);return e};function uo(t,s,e){const{props:i,children:n,component:r}=t,{props:l,children:a,patchFlag:o}=s,u=r.emitsOptions;if(s.dirs||s.transition)return!0;if(e&&o>=0){if(o&1024)return!0;if(o&16)return i?Mn(i,l,u):!!l;if(o&8){const h=s.dynamicProps;for(let g=0;gt.__isSuspense;function fo(t,s){s&&s.pendingBranch?le(t)?s.effects.push(...t):s.effects.push(t):no(t)}const ei={};function Si(t,s,e){return Os(t,s,e)}function Os(t,s,{immediate:e,deep:i,flush:n,onTrack:r,onTrigger:l}=Te){var a;const o=_r()===((a=He)==null?void 0:a.scope)?He:null;let u,h=!1,g=!1;if(Fe(t)?(u=()=>t.value,h=Bi(t)):Lt(t)?(u=()=>t,i=!0):le(t)?(g=!0,h=t.some(S=>Lt(S)||Bi(S)),u=()=>t.map(S=>{if(Fe(S))return S.value;if(Lt(S))return wt(S);if(ge(S))return ht(S,o,2)})):ge(t)?s?u=()=>ht(t,o,2):u=()=>{if(!(o&&o.isUnmounted))return m&&m(),qe(t,o,3,[T])}:u=Ge,s&&i){const S=u;u=()=>wt(S())}let m,T=S=>{m=d.onStop=()=>{ht(S,o,4)}},x;if(Kt)if(T=Ge,s?e&&qe(s,o,3,[u(),g?[]:void 0,T]):u(),n==="sync"){const S=la();x=S.__watcherHandles||(S.__watcherHandles=[])}else return Ge;let P=g?new Array(t.length).fill(ei):ei;const C=()=>{if(d.active)if(s){const S=d.run();(i||h||(g?S.some((M,I)=>oi(M,P[I])):oi(S,P)))&&(m&&m(),qe(s,o,3,[S,P===ei?void 0:g&&P[0]===ei?[]:P,T]),P=S)}else d.run()};C.allowRecurse=!!s;let k;n==="sync"?k=C:n==="post"?k=()=>Ie(C,o&&o.suspense):(C.pre=!0,o&&(C.id=o.uid),k=()=>un(C));const d=new en(u,k);s?e?C():P=d.run():n==="post"?Ie(d.run.bind(d),o&&o.suspense):d.run();const _=()=>{d.stop(),o&&o.scope&&Xi(o.scope.effects,d)};return x&&x.push(_),_}function po(t,s,e){const i=this.proxy,n=Se(t)?t.includes(".")?Ls(i,t):()=>i[t]:t.bind(i,i);let r;ge(s)?r=s:(r=s.handler,e=s);const l=He;kt(this);const a=Os(n,r.bind(i),e);return l?kt(l):xt(),a}function Ls(t,s){const e=s.split(".");return()=>{let i=t;for(let n=0;n{wt(e,s)});else if(os(t))for(const e in t)wt(t[e],s);return t}function ke(t,s){const e=Ve;if(e===null)return t;const i=bi(e)||e.proxy,n=t.dirs||(t.dirs=[]);for(let r=0;r!!t.type.__asyncLoader,Ms=t=>t.type.__isKeepAlive;function go(t,s){Ds(t,"a",s)}function mo(t,s){Ds(t,"da",s)}function Ds(t,s,e=He){const i=t.__wdc||(t.__wdc=()=>{let n=e;for(;n;){if(n.isDeactivated)return;n=n.parent}return t()});if(_i(s,i,e),e){let n=e.parent;for(;n&&n.parent;)Ms(n.parent.vnode)&&vo(i,s,e,n),n=n.parent}}function vo(t,s,e,i){const n=_i(s,t,i,!0);ks(()=>{Xi(i[s],n)},e)}function _i(t,s,e=He,i=!1){if(e){const n=e[t]||(e[t]=[]),r=s.__weh||(s.__weh=(...l)=>{if(e.isUnmounted)return;Ft(),kt(e);const a=qe(s,e,t,l);return xt(),At(),a});return i?n.unshift(r):n.push(r),r}}const it=t=>(s,e=He)=>(!Kt||t==="sp")&&_i(t,(...i)=>s(...i),e),yo=it("bm"),wo=it("m"),_o=it("bu"),To=it("u"),xo=it("bum"),ks=it("um"),bo=it("sp"),Eo=it("rtg"),Po=it("rtc");function So(t,s=He){_i("ec",t,s)}const Fs="components",Co="directives";function As(t,s){return Bs(Fs,t,!0,s)||t}const Ro=Symbol.for("v-ndc");function cn(t){return Bs(Co,t)}function Bs(t,s,e=!0,i=!1){const n=Ve||He;if(n){const r=n.type;if(t===Fs){const a=sa(r,!1);if(a&&(a===s||a===Qe(s)||a===gi(Qe(s))))return r}const l=Dn(n[t]||r[t],s)||Dn(n.appContext[t],s);return!l&&i?r:l}}function Dn(t,s){return t&&(t[s]||t[Qe(s)]||t[gi(Qe(s))])}function Pe(t,s,e,i){let n;const r=e&&e[i];if(le(t)||Se(t)){n=new Array(t.length);for(let l=0,a=t.length;ls(l,a,void 0,r&&r[a]));else{const l=Object.keys(t);n=new Array(l.length);for(let a=0,o=l.length;at?Ks(t)?bi(t)||t.proxy:zi(t.parent):null,Ut=Oe(Object.create(null),{$:t=>t,$el:t=>t.vnode.el,$data:t=>t.data,$props:t=>t.props,$attrs:t=>t.attrs,$slots:t=>t.slots,$refs:t=>t.refs,$parent:t=>zi(t.parent),$root:t=>zi(t.root),$emit:t=>t.emit,$options:t=>hn(t),$forceUpdate:t=>t.f||(t.f=()=>un(t.update)),$nextTick:t=>t.n||(t.n=Es.bind(t.proxy)),$watch:t=>po.bind(t)}),Ci=(t,s)=>t!==Te&&!t.__isScriptSetup&&ve(t,s),Ho={get({_:t},s){const{ctx:e,setupState:i,data:n,props:r,accessCache:l,type:a,appContext:o}=t;let u;if(s[0]!=="$"){const T=l[s];if(T!==void 0)switch(T){case 1:return i[s];case 2:return n[s];case 4:return e[s];case 3:return r[s]}else{if(Ci(i,s))return l[s]=1,i[s];if(n!==Te&&ve(n,s))return l[s]=2,n[s];if((u=t.propsOptions[0])&&ve(u,s))return l[s]=3,r[s];if(e!==Te&&ve(e,s))return l[s]=4,e[s];Ni&&(l[s]=0)}}const h=Ut[s];let g,m;if(h)return s==="$attrs"&&ze(t,"get",s),h(t);if((g=a.__cssModules)&&(g=g[s]))return g;if(e!==Te&&ve(e,s))return l[s]=4,e[s];if(m=o.config.globalProperties,ve(m,s))return m[s]},set({_:t},s,e){const{data:i,setupState:n,ctx:r}=t;return Ci(n,s)?(n[s]=e,!0):i!==Te&&ve(i,s)?(i[s]=e,!0):ve(t.props,s)||s[0]==="$"&&s.slice(1)in t?!1:(r[s]=e,!0)},has({_:{data:t,setupState:s,accessCache:e,ctx:i,appContext:n,propsOptions:r}},l){let a;return!!e[l]||t!==Te&&ve(t,l)||Ci(s,l)||(a=r[0])&&ve(a,l)||ve(i,l)||ve(Ut,l)||ve(n.config.globalProperties,l)},defineProperty(t,s,e){return e.get!=null?t._.accessCache[s]=0:ve(e,"value")&&this.set(t,s,e.value,null),Reflect.defineProperty(t,s,e)}};function kn(t){return le(t)?t.reduce((s,e)=>(s[e]=null,s),{}):t}let Ni=!0;function Oo(t){const s=hn(t),e=t.proxy,i=t.ctx;Ni=!1,s.beforeCreate&&Fn(s.beforeCreate,t,"bc");const{data:n,computed:r,methods:l,watch:a,provide:o,inject:u,created:h,beforeMount:g,mounted:m,beforeUpdate:T,updated:x,activated:P,deactivated:C,beforeDestroy:k,beforeUnmount:d,destroyed:_,unmounted:S,render:M,renderTracked:I,renderTriggered:V,errorCaptured:j,serverPrefetch:q,expose:K,inheritAttrs:re,components:ee,directives:fe,filters:ce}=s;if(u&&Lo(u,i,null),l)for(const oe in l){const ie=l[oe];ge(ie)&&(i[oe]=ie.bind(e))}if(n){const oe=n.call(e,e);Ee(oe)&&(t.data=vi(oe))}if(Ni=!0,r)for(const oe in r){const ie=r[oe],we=ge(ie)?ie.bind(e,e):ge(ie.get)?ie.get.bind(e,e):Ge,Q=!ge(ie)&&ge(ie.set)?ie.set.bind(e):Ge,Ce=at({get:we,set:Q});Object.defineProperty(i,oe,{enumerable:!0,configurable:!0,get:()=>Ce.value,set:Ae=>Ce.value=Ae})}if(a)for(const oe in a)Is(a[oe],i,e,oe);if(o){const oe=ge(o)?o.call(e):o;Reflect.ownKeys(oe).forEach(ie=>{Bo(ie,oe[ie])})}h&&Fn(h,t,"c");function ae(oe,ie){le(ie)?ie.forEach(we=>oe(we.bind(e))):ie&&oe(ie.bind(e))}if(ae(yo,g),ae(wo,m),ae(_o,T),ae(To,x),ae(go,P),ae(mo,C),ae(So,j),ae(Po,I),ae(Eo,V),ae(xo,d),ae(ks,S),ae(bo,q),le(K))if(K.length){const oe=t.exposed||(t.exposed={});K.forEach(ie=>{Object.defineProperty(oe,ie,{get:()=>e[ie],set:we=>e[ie]=we})})}else t.exposed||(t.exposed={});M&&t.render===Ge&&(t.render=M),re!=null&&(t.inheritAttrs=re),ee&&(t.components=ee),fe&&(t.directives=fe)}function Lo(t,s,e=Ge){le(t)&&(t=Vi(t));for(const i in t){const n=t[i];let r;Ee(n)?"default"in n?r=si(n.from||i,n.default,!0):r=si(n.from||i):r=si(n),Fe(r)?Object.defineProperty(s,i,{enumerable:!0,configurable:!0,get:()=>r.value,set:l=>r.value=l}):s[i]=r}}function Fn(t,s,e){qe(le(t)?t.map(i=>i.bind(s.proxy)):t.bind(s.proxy),s,e)}function Is(t,s,e,i){const n=i.includes(".")?Ls(e,i):()=>e[i];if(Se(t)){const r=s[t];ge(r)&&Si(n,r)}else if(ge(t))Si(n,t.bind(e));else if(Ee(t))if(le(t))t.forEach(r=>Is(r,s,e,i));else{const r=ge(t.handler)?t.handler.bind(e):s[t.handler];ge(r)&&Si(n,r,t)}}function hn(t){const s=t.type,{mixins:e,extends:i}=s,{mixins:n,optionsCache:r,config:{optionMergeStrategies:l}}=t.appContext,a=r.get(s);let o;return a?o=a:!n.length&&!e&&!i?o=s:(o={},n.length&&n.forEach(u=>ui(o,u,l,!0)),ui(o,s,l)),Ee(s)&&r.set(s,o),o}function ui(t,s,e,i=!1){const{mixins:n,extends:r}=s;r&&ui(t,r,e,!0),n&&n.forEach(l=>ui(t,l,e,!0));for(const l in s)if(!(i&&l==="expose")){const a=Mo[l]||e&&e[l];t[l]=a?a(t[l],s[l]):s[l]}return t}const Mo={data:An,props:Bn,emits:Bn,methods:Nt,computed:Nt,beforeCreate:De,created:De,beforeMount:De,mounted:De,beforeUpdate:De,updated:De,beforeDestroy:De,beforeUnmount:De,destroyed:De,unmounted:De,activated:De,deactivated:De,errorCaptured:De,serverPrefetch:De,components:Nt,directives:Nt,watch:ko,provide:An,inject:Do};function An(t,s){return s?t?function(){return Oe(ge(t)?t.call(this,this):t,ge(s)?s.call(this,this):s)}:s:t}function Do(t,s){return Nt(Vi(t),Vi(s))}function Vi(t){if(le(t)){const s={};for(let e=0;e1)return e&&ge(s)?s.call(i&&i.proxy):s}}function Io(t,s,e,i=!1){const n={},r={};ai(r,xi,1),t.propsDefaults=Object.create(null),Ns(t,s,n,r);for(const l in t.propsOptions[0])l in n||(n[l]=void 0);e?t.props=i?n:Zr(n):t.type.props?t.props=n:t.props=r,t.attrs=r}function zo(t,s,e,i){const{props:n,attrs:r,vnode:{patchFlag:l}}=t,a=_e(n),[o]=t.propsOptions;let u=!1;if((i||l>0)&&!(l&16)){if(l&8){const h=t.vnode.dynamicProps;for(let g=0;g{o=!0;const[m,T]=Vs(g,s,!0);Oe(l,m),T&&a.push(...T)};!e&&s.mixins.length&&s.mixins.forEach(h),t.extends&&h(t.extends),t.mixins&&t.mixins.forEach(h)}if(!r&&!o)return Ee(t)&&i.set(t,Ht),Ht;if(le(r))for(let h=0;h-1,T[1]=P<0||x-1||ve(T,"default"))&&a.push(g)}}}const u=[l,a];return Ee(t)&&i.set(t,u),u}function In(t){return t[0]!=="$"}function zn(t){const s=t&&t.toString().match(/^\s*(function|class) (\w+)/);return s?s[2]:t===null?"null":""}function Nn(t,s){return zn(t)===zn(s)}function Vn(t,s){return le(s)?s.findIndex(e=>Nn(e,t)):ge(s)&&Nn(s,t)?0:-1}const Us=t=>t[0]==="_"||t==="$stable",dn=t=>le(t)?t.map(Ye):[Ye(t)],No=(t,s,e)=>{if(s._n)return s;const i=oo((...n)=>dn(s(...n)),e);return i._c=!1,i},Ws=(t,s,e)=>{const i=t._ctx;for(const n in t){if(Us(n))continue;const r=t[n];if(ge(r))s[n]=No(n,r,i);else if(r!=null){const l=dn(r);s[n]=()=>l}}},js=(t,s)=>{const e=dn(s);t.slots.default=()=>e},Vo=(t,s)=>{if(t.vnode.shapeFlag&32){const e=s._;e?(t.slots=_e(s),ai(s,"_",e)):Ws(s,t.slots={})}else t.slots={},s&&js(t,s);ai(t.slots,xi,1)},Uo=(t,s,e)=>{const{vnode:i,slots:n}=t;let r=!0,l=Te;if(i.shapeFlag&32){const a=s._;a?e&&a===1?r=!1:(Oe(n,s),!e&&a===1&&delete n._):(r=!s.$stable,Ws(s,n)),l=s}else s&&(js(t,s),l={default:1});if(r)for(const a in n)!Us(a)&&!(a in l)&&delete n[a]};function Wi(t,s,e,i,n=!1){if(le(t)){t.forEach((m,T)=>Wi(m,s&&(le(s)?s[T]:s),e,i,n));return}if(ni(i)&&!n)return;const r=i.shapeFlag&4?bi(i.component)||i.component.proxy:i.el,l=n?null:r,{i:a,r:o}=t,u=s&&s.r,h=a.refs===Te?a.refs={}:a.refs,g=a.setupState;if(u!=null&&u!==o&&(Se(u)?(h[u]=null,ve(g,u)&&(g[u]=null)):Fe(u)&&(u.value=null)),ge(o))ht(o,a,12,[l,h]);else{const m=Se(o),T=Fe(o);if(m||T){const x=()=>{if(t.f){const P=m?ve(g,o)?g[o]:h[o]:o.value;n?le(P)&&Xi(P,r):le(P)?P.includes(r)||P.push(r):m?(h[o]=[r],ve(g,o)&&(g[o]=h[o])):(o.value=[r],t.k&&(h[t.k]=o.value))}else m?(h[o]=l,ve(g,o)&&(g[o]=l)):T&&(o.value=l,t.k&&(h[t.k]=l))};l?(x.id=-1,Ie(x,e)):x()}}}const Ie=fo;function Wo(t){return jo(t)}function jo(t,s){const e=Mi();e.__VUE__=!0;const{insert:i,remove:n,patchProp:r,createElement:l,createText:a,createComment:o,setText:u,setElementText:h,parentNode:g,nextSibling:m,setScopeId:T=Ge,insertStaticContent:x}=t,P=(E,R,c,v=null,b=null,O=null,H=!1,B=null,A=!!R.dynamicChildren)=>{if(E===R)return;E&&!Bt(E,R)&&(v=$e(E),Ae(E,b,O,!0),E=null),R.patchFlag===-2&&(A=!1,R.dynamicChildren=null);const{type:N,ref:X,shapeFlag:G}=R;switch(N){case Ti:C(E,R,c,v);break;case bt:k(E,R,c,v);break;case Ri:E==null&&d(R,c,v,H);break;case de:ee(E,R,c,v,b,O,H,B,A);break;default:G&1?M(E,R,c,v,b,O,H,B,A):G&6?fe(E,R,c,v,b,O,H,B,A):(G&64||G&128)&&N.process(E,R,c,v,b,O,H,B,A,Ze)}X!=null&&b&&Wi(X,E&&E.ref,O,R||E,!R)},C=(E,R,c,v)=>{if(E==null)i(R.el=a(R.children),c,v);else{const b=R.el=E.el;R.children!==E.children&&u(b,R.children)}},k=(E,R,c,v)=>{E==null?i(R.el=o(R.children||""),c,v):R.el=E.el},d=(E,R,c,v)=>{[E.el,E.anchor]=x(E.children,R,c,v,E.el,E.anchor)},_=({el:E,anchor:R},c,v)=>{let b;for(;E&&E!==R;)b=m(E),i(E,c,v),E=b;i(R,c,v)},S=({el:E,anchor:R})=>{let c;for(;E&&E!==R;)c=m(E),n(E),E=c;n(R)},M=(E,R,c,v,b,O,H,B,A)=>{H=H||R.type==="svg",E==null?I(R,c,v,b,O,H,B,A):q(E,R,b,O,H,B,A)},I=(E,R,c,v,b,O,H,B)=>{let A,N;const{type:X,props:G,shapeFlag:U,transition:J,dirs:Y}=E;if(A=E.el=l(E.type,O,G&&G.is,G),U&8?h(A,E.children):U&16&&j(E.children,A,null,v,b,O&&X!=="foreignObject",H,B),Y&>(E,null,v,"created"),V(A,E,E.scopeId,H,v),G){for(const me in G)me!=="value"&&!ti(me)&&r(A,me,null,G[me],O,E.children,v,b,Be);"value"in G&&r(A,"value",null,G.value),(N=G.onVnodeBeforeMount)&&Ke(N,v,E)}Y&>(E,null,v,"beforeMount");const he=(!b||b&&!b.pendingBranch)&&J&&!J.persisted;he&&J.beforeEnter(A),i(A,R,c),((N=G&&G.onVnodeMounted)||he||Y)&&Ie(()=>{N&&Ke(N,v,E),he&&J.enter(A),Y&>(E,null,v,"mounted")},b)},V=(E,R,c,v,b)=>{if(c&&T(E,c),v)for(let O=0;O{for(let N=A;N{const B=R.el=E.el;let{patchFlag:A,dynamicChildren:N,dirs:X}=R;A|=E.patchFlag&16;const G=E.props||Te,U=R.props||Te;let J;c&&mt(c,!1),(J=U.onVnodeBeforeUpdate)&&Ke(J,c,R,E),X&>(R,E,c,"beforeUpdate"),c&&mt(c,!0);const Y=b&&R.type!=="foreignObject";if(N?K(E.dynamicChildren,N,B,c,v,Y,O):H||ie(E,R,B,null,c,v,Y,O,!1),A>0){if(A&16)re(B,R,G,U,c,v,b);else if(A&2&&G.class!==U.class&&r(B,"class",null,U.class,b),A&4&&r(B,"style",G.style,U.style,b),A&8){const he=R.dynamicProps;for(let me=0;me{J&&Ke(J,c,R,E),X&>(R,E,c,"updated")},v)},K=(E,R,c,v,b,O,H)=>{for(let B=0;B{if(c!==v){if(c!==Te)for(const B in c)!ti(B)&&!(B in v)&&r(E,B,c[B],null,H,R.children,b,O,Be);for(const B in v){if(ti(B))continue;const A=v[B],N=c[B];A!==N&&B!=="value"&&r(E,B,N,A,H,R.children,b,O,Be)}"value"in v&&r(E,"value",c.value,v.value)}},ee=(E,R,c,v,b,O,H,B,A)=>{const N=R.el=E?E.el:a(""),X=R.anchor=E?E.anchor:a("");let{patchFlag:G,dynamicChildren:U,slotScopeIds:J}=R;J&&(B=B?B.concat(J):J),E==null?(i(N,c,v),i(X,c,v),j(R.children,c,X,b,O,H,B,A)):G>0&&G&64&&U&&E.dynamicChildren?(K(E.dynamicChildren,U,c,b,O,H,B),(R.key!=null||b&&R===b.subTree)&&Gs(E,R,!0)):ie(E,R,c,X,b,O,H,B,A)},fe=(E,R,c,v,b,O,H,B,A)=>{R.slotScopeIds=B,E==null?R.shapeFlag&512?b.ctx.activate(R,c,v,H,A):ce(R,c,v,b,O,H,A):ye(E,R,A)},ce=(E,R,c,v,b,O,H)=>{const B=E.component=$o(E,v,b);if(Ms(E)&&(B.ctx.renderer=Ze),ea(B),B.asyncDep){if(b&&b.registerDep(B,ae),!E.el){const A=B.subTree=te(bt);k(null,A,R,c)}return}ae(B,E,R,c,b,O,H)},ye=(E,R,c)=>{const v=R.component=E.component;if(uo(E,R,c))if(v.asyncDep&&!v.asyncResolved){oe(v,R,c);return}else v.next=R,io(v.update),v.update();else R.el=E.el,v.vnode=R},ae=(E,R,c,v,b,O,H)=>{const B=()=>{if(E.isMounted){let{next:X,bu:G,u:U,parent:J,vnode:Y}=E,he=X,me;mt(E,!1),X?(X.el=Y.el,oe(E,X,H)):X=Y,G&&ii(G),(me=X.props&&X.props.onVnodeBeforeUpdate)&&Ke(me,J,X,Y),mt(E,!0);const p=Pi(E),f=E.subTree;E.subTree=p,P(f,p,g(f.el),$e(f),E,b,O),X.el=p.el,he===null&&co(E,p.el),U&&Ie(U,b),(me=X.props&&X.props.onVnodeUpdated)&&Ie(()=>Ke(me,J,X,Y),b)}else{let X;const{el:G,props:U}=R,{bm:J,m:Y,parent:he}=E,me=ni(R);if(mt(E,!1),J&&ii(J),!me&&(X=U&&U.onVnodeBeforeMount)&&Ke(X,he,R),mt(E,!0),G&&rt){const p=()=>{E.subTree=Pi(E),rt(G,E.subTree,E,b,null)};me?R.type.__asyncLoader().then(()=>!E.isUnmounted&&p()):p()}else{const p=E.subTree=Pi(E);P(null,p,c,v,E,b,O),R.el=p.el}if(Y&&Ie(Y,b),!me&&(X=U&&U.onVnodeMounted)){const p=R;Ie(()=>Ke(X,he,p),b)}(R.shapeFlag&256||he&&ni(he.vnode)&&he.vnode.shapeFlag&256)&&E.a&&Ie(E.a,b),E.isMounted=!0,R=c=v=null}},A=E.effect=new en(B,()=>un(N),E.scope),N=E.update=()=>A.run();N.id=E.uid,mt(E,!0),N()},oe=(E,R,c)=>{R.component=E;const v=E.vnode.props;E.vnode=R,E.next=null,zo(E,R.props,v,c),Uo(E,R.children,c),Ft(),Ln(),At()},ie=(E,R,c,v,b,O,H,B,A=!1)=>{const N=E&&E.children,X=E?E.shapeFlag:0,G=R.children,{patchFlag:U,shapeFlag:J}=R;if(U>0){if(U&128){Q(N,G,c,v,b,O,H,B,A);return}else if(U&256){we(N,G,c,v,b,O,H,B,A);return}}J&8?(X&16&&Be(N,b,O),G!==N&&h(c,G)):X&16?J&16?Q(N,G,c,v,b,O,H,B,A):Be(N,b,O,!0):(X&8&&h(c,""),J&16&&j(G,c,v,b,O,H,B,A))},we=(E,R,c,v,b,O,H,B,A)=>{E=E||Ht,R=R||Ht;const N=E.length,X=R.length,G=Math.min(N,X);let U;for(U=0;UX?Be(E,b,O,!0,!1,G):j(R,c,v,b,O,H,B,A,G)},Q=(E,R,c,v,b,O,H,B,A)=>{let N=0;const X=R.length;let G=E.length-1,U=X-1;for(;N<=G&&N<=U;){const J=E[N],Y=R[N]=A?lt(R[N]):Ye(R[N]);if(Bt(J,Y))P(J,Y,c,null,b,O,H,B,A);else break;N++}for(;N<=G&&N<=U;){const J=E[G],Y=R[U]=A?lt(R[U]):Ye(R[U]);if(Bt(J,Y))P(J,Y,c,null,b,O,H,B,A);else break;G--,U--}if(N>G){if(N<=U){const J=U+1,Y=JU)for(;N<=G;)Ae(E[N],b,O,!0),N++;else{const J=N,Y=N,he=new Map;for(N=Y;N<=U;N++){const $=R[N]=A?lt(R[N]):Ye(R[N]);$.key!=null&&he.set($.key,N)}let me,p=0;const f=U-Y+1;let y=!1,w=0;const z=new Array(f);for(N=0;N=f){Ae($,b,O,!0);continue}let pe;if($.key!=null)pe=he.get($.key);else for(me=Y;me<=U;me++)if(z[me-Y]===0&&Bt($,R[me])){pe=me;break}pe===void 0?Ae($,b,O,!0):(z[pe-Y]=N+1,pe>=w?w=pe:y=!0,P($,R[pe],c,null,b,O,H,B,A),p++)}const W=y?Go(z):Ht;for(me=W.length-1,N=f-1;N>=0;N--){const $=Y+N,pe=R[$],ne=$+1{const{el:O,type:H,transition:B,children:A,shapeFlag:N}=E;if(N&6){Ce(E.component.subTree,R,c,v);return}if(N&128){E.suspense.move(R,c,v);return}if(N&64){H.move(E,R,c,Ze);return}if(H===de){i(O,R,c);for(let G=0;GB.enter(O),b);else{const{leave:G,delayLeave:U,afterLeave:J}=B,Y=()=>i(O,R,c),he=()=>{G(O,()=>{Y(),J&&J()})};U?U(O,Y,he):he()}else i(O,R,c)},Ae=(E,R,c,v=!1,b=!1)=>{const{type:O,props:H,ref:B,children:A,dynamicChildren:N,shapeFlag:X,patchFlag:G,dirs:U}=E;if(B!=null&&Wi(B,null,c,E,!0),X&256){R.ctx.deactivate(E);return}const J=X&1&&U,Y=!ni(E);let he;if(Y&&(he=H&&H.onVnodeBeforeUnmount)&&Ke(he,R,E),X&6)Pt(E.component,c,v);else{if(X&128){E.suspense.unmount(c,v);return}J&>(E,null,R,"beforeUnmount"),X&64?E.type.remove(E,R,c,b,Ze,v):N&&(O!==de||G>0&&G&64)?Be(N,R,c,!1,!0):(O===de&&G&384||!b&&X&16)&&Be(A,R,c),v&&ft(E)}(Y&&(he=H&&H.onVnodeUnmounted)||J)&&Ie(()=>{he&&Ke(he,R,E),J&>(E,null,R,"unmounted")},c)},ft=E=>{const{type:R,el:c,anchor:v,transition:b}=E;if(R===de){nt(c,v);return}if(R===Ri){S(E);return}const O=()=>{n(c),b&&!b.persisted&&b.afterLeave&&b.afterLeave()};if(E.shapeFlag&1&&b&&!b.persisted){const{leave:H,delayLeave:B}=b,A=()=>H(c,O);B?B(E.el,O,A):A()}else O()},nt=(E,R)=>{let c;for(;E!==R;)c=m(E),n(E),E=c;n(R)},Pt=(E,R,c)=>{const{bum:v,scope:b,update:O,subTree:H,um:B}=E;v&&ii(v),b.stop(),O&&(O.active=!1,Ae(H,E,R,c)),B&&Ie(B,R),Ie(()=>{E.isUnmounted=!0},R),R&&R.pendingBranch&&!R.isUnmounted&&E.asyncDep&&!E.asyncResolved&&E.suspenseId===R.pendingId&&(R.deps--,R.deps===0&&R.resolve())},Be=(E,R,c,v=!1,b=!1,O=0)=>{for(let H=O;HE.shapeFlag&6?$e(E.component.subTree):E.shapeFlag&128?E.suspense.next():m(E.anchor||E.el),pt=(E,R,c)=>{E==null?R._vnode&&Ae(R._vnode,null,null,!0):P(R._vnode||null,E,R,null,null,null,c),Ln(),Ss(),R._vnode=E},Ze={p:P,um:Ae,m:Ce,r:ft,mt:ce,mc:j,pc:ie,pbc:K,n:$e,o:t};let st,rt;return s&&([st,rt]=s(Ze)),{render:pt,hydrate:st,createApp:Ao(pt,st)}}function mt({effect:t,update:s},e){t.allowRecurse=s.allowRecurse=e}function Gs(t,s,e=!1){const i=t.children,n=s.children;if(le(i)&&le(n))for(let r=0;r>1,t[e[a]]0&&(s[i]=e[r-1]),e[r]=i)}}for(r=e.length,l=e[r-1];r-- >0;)e[r]=l,l=s[l];return e}const qo=t=>t.__isTeleport,de=Symbol.for("v-fgt"),Ti=Symbol.for("v-txt"),bt=Symbol.for("v-cmt"),Ri=Symbol.for("v-stc"),Wt=[];let je=null;function L(t=!1){Wt.push(je=t?null:[])}function Zo(){Wt.pop(),je=Wt[Wt.length-1]||null}let Zt=1;function Un(t){Zt+=t}function qs(t){return t.dynamicChildren=Zt>0?je||Ht:null,Zo(),Zt>0&&je&&je.push(t),t}function D(t,s,e,i,n,r){return qs(F(t,s,e,i,n,r,!0))}function Me(t,s,e,i,n){return qs(te(t,s,e,i,n,!0))}function ji(t){return t?t.__v_isVNode===!0:!1}function Bt(t,s){return t.type===s.type&&t.key===s.key}const xi="__vInternal",Zs=({key:t})=>t??null,ri=({ref:t,ref_key:s,ref_for:e})=>(typeof t=="number"&&(t=""+t),t!=null?Se(t)||Fe(t)||ge(t)?{i:Ve,r:t,k:s,f:!!e}:t:null);function F(t,s=null,e=null,i=0,n=null,r=t===de?0:1,l=!1,a=!1){const o={__v_isVNode:!0,__v_skip:!0,type:t,props:s,key:s&&Zs(s),ref:s&&ri(s),scopeId:Hs,slotScopeIds:null,children:e,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetAnchor:null,staticCount:0,shapeFlag:r,patchFlag:i,dynamicProps:n,dynamicChildren:null,appContext:null,ctx:Ve};return a?(fn(o,e),r&128&&t.normalize(o)):e&&(o.shapeFlag|=Se(e)?8:16),Zt>0&&!l&&je&&(o.patchFlag>0||r&6)&&o.patchFlag!==32&&je.push(o),o}const te=Ko;function Ko(t,s=null,e=null,i=0,n=null,r=!1){if((!t||t===Ro)&&(t=bt),ji(t)){const a=Dt(t,s,!0);return e&&fn(a,e),Zt>0&&!r&&je&&(a.shapeFlag&6?je[je.indexOf(t)]=a:je.push(a)),a.patchFlag|=-2,a}if(ra(t)&&(t=t.__vccOpts),s){s=Xo(s);let{class:a,style:o}=s;a&&!Se(a)&&(s.class=xe(a)),Ee(o)&&(_s(o)&&!le(o)&&(o=Oe({},o)),s.style=Qi(o))}const l=Se(t)?1:ho(t)?128:qo(t)?64:Ee(t)?4:ge(t)?2:0;return F(t,s,e,i,n,l,r,!0)}function Xo(t){return t?_s(t)||xi in t?Oe({},t):t:null}function Dt(t,s,e=!1){const{props:i,ref:n,patchFlag:r,children:l}=t,a=s?Yo(i||{},s):i;return{__v_isVNode:!0,__v_skip:!0,type:t.type,props:a,key:a&&Zs(a),ref:s&&s.ref?e&&n?le(n)?n.concat(ri(s)):[n,ri(s)]:ri(s):n,scopeId:t.scopeId,slotScopeIds:t.slotScopeIds,children:l,target:t.target,targetAnchor:t.targetAnchor,staticCount:t.staticCount,shapeFlag:t.shapeFlag,patchFlag:s&&t.type!==de?r===-1?16:r|16:r,dynamicProps:t.dynamicProps,dynamicChildren:t.dynamicChildren,appContext:t.appContext,dirs:t.dirs,transition:t.transition,component:t.component,suspense:t.suspense,ssContent:t.ssContent&&Dt(t.ssContent),ssFallback:t.ssFallback&&Dt(t.ssFallback),el:t.el,anchor:t.anchor,ctx:t.ctx,ce:t.ce}}function be(t=" ",s=0){return te(Ti,null,t,s)}function se(t="",s=!1){return s?(L(),Me(bt,null,t)):te(bt,null,t)}function Ye(t){return t==null||typeof t=="boolean"?te(bt):le(t)?te(de,null,t.slice()):typeof t=="object"?lt(t):te(Ti,null,String(t))}function lt(t){return t.el===null&&t.patchFlag!==-1||t.memo?t:Dt(t)}function fn(t,s){let e=0;const{shapeFlag:i}=t;if(s==null)s=null;else if(le(s))e=16;else if(typeof s=="object")if(i&65){const n=s.default;n&&(n._c&&(n._d=!1),fn(t,n()),n._c&&(n._d=!0));return}else{e=32;const n=s._;!n&&!(xi in s)?s._ctx=Ve:n===3&&Ve&&(Ve.slots._===1?s._=1:(s._=2,t.patchFlag|=1024))}else ge(s)?(s={default:s,_ctx:Ve},e=32):(s=String(s),i&64?(e=16,s=[be(s)]):e=8);t.children=s,t.shapeFlag|=e}function Yo(...t){const s={};for(let e=0;eHe=t),pn=t=>{Ct.length>1?Ct.forEach(s=>s(t)):Ct[0](t)};const kt=t=>{pn(t),t.scope.on()},xt=()=>{He&&He.scope.off(),pn(null)};function Ks(t){return t.vnode.shapeFlag&4}let Kt=!1;function ea(t,s=!1){Kt=s;const{props:e,children:i}=t.vnode,n=Ks(t);Io(t,e,n,s),Vo(t,i);const r=n?ta(t,s):void 0;return Kt=!1,r}function ta(t,s){const e=t.type;t.accessCache=Object.create(null),t.proxy=Ts(new Proxy(t.ctx,Ho));const{setup:i}=e;if(i){const n=t.setupContext=i.length>1?na(t):null;kt(t),Ft();const r=ht(i,t,0,[t.props,n]);if(At(),xt(),ss(r)){if(r.then(xt,xt),s)return r.then(l=>{jn(t,l,s)}).catch(l=>{yi(l,t,0)});t.asyncDep=r}else jn(t,r,s)}else Xs(t,s)}function jn(t,s,e){ge(s)?t.type.__ssrInlineRender?t.ssrRender=s:t.render=s:Ee(s)&&(t.setupState=xs(s)),Xs(t,e)}let Gn;function Xs(t,s,e){const i=t.type;if(!t.render){if(!s&&Gn&&!i.render){const n=i.template||hn(t).template;if(n){const{isCustomElement:r,compilerOptions:l}=t.appContext.config,{delimiters:a,compilerOptions:o}=i,u=Oe(Oe({isCustomElement:r,delimiters:a},l),o);i.render=Gn(n,u)}}t.render=i.render||Ge}kt(t),Ft(),Oo(t),At(),xt()}function ia(t){return t.attrsProxy||(t.attrsProxy=new Proxy(t.attrs,{get(s,e){return ze(t,"get","$attrs"),s[e]}}))}function na(t){const s=e=>{t.exposed=e||{}};return{get attrs(){return ia(t)},slots:t.slots,emit:t.emit,expose:s}}function bi(t){if(t.exposed)return t.exposeProxy||(t.exposeProxy=new Proxy(xs(Ts(t.exposed)),{get(s,e){if(e in s)return s[e];if(e in Ut)return Ut[e](t)},has(s,e){return e in s||e in Ut}}))}function sa(t,s=!0){return ge(t)?t.displayName||t.name:t.name||s&&t.__name}function ra(t){return ge(t)&&"__vccOpts"in t}const at=(t,s)=>$r(t,s,Kt);function oa(t,s,e){const i=arguments.length;return i===2?Ee(s)&&!le(s)?ji(s)?te(t,null,[s]):te(t,s):te(t,null,s):(i>3?e=Array.prototype.slice.call(arguments,2):i===3&&ji(e)&&(e=[e]),te(t,s,e))}const aa=Symbol.for("v-scx"),la=()=>si(aa),ua="3.3.4",ca="http://www.w3.org/2000/svg",yt=typeof document<"u"?document:null,qn=yt&&yt.createElement("template"),ha={insert:(t,s,e)=>{s.insertBefore(t,e||null)},remove:t=>{const s=t.parentNode;s&&s.removeChild(t)},createElement:(t,s,e,i)=>{const n=s?yt.createElementNS(ca,t):yt.createElement(t,e?{is:e}:void 0);return t==="select"&&i&&i.multiple!=null&&n.setAttribute("multiple",i.multiple),n},createText:t=>yt.createTextNode(t),createComment:t=>yt.createComment(t),setText:(t,s)=>{t.nodeValue=s},setElementText:(t,s)=>{t.textContent=s},parentNode:t=>t.parentNode,nextSibling:t=>t.nextSibling,querySelector:t=>yt.querySelector(t),setScopeId(t,s){t.setAttribute(s,"")},insertStaticContent(t,s,e,i,n,r){const l=e?e.previousSibling:s.lastChild;if(n&&(n===r||n.nextSibling))for(;s.insertBefore(n.cloneNode(!0),e),!(n===r||!(n=n.nextSibling)););else{qn.innerHTML=i?`${t}`:t;const a=qn.content;if(i){const o=a.firstChild;for(;o.firstChild;)a.appendChild(o.firstChild);a.removeChild(o)}s.insertBefore(a,e)}return[l?l.nextSibling:s.firstChild,e?e.previousSibling:s.lastChild]}};function da(t,s,e){const i=t._vtc;i&&(s=(s?[s,...i]:[...i]).join(" ")),s==null?t.removeAttribute("class"):e?t.setAttribute("class",s):t.className=s}function fa(t,s,e){const i=t.style,n=Se(e);if(e&&!n){if(s&&!Se(s))for(const r in s)e[r]==null&&Gi(i,r,"");for(const r in e)Gi(i,r,e[r])}else{const r=i.display;n?s!==e&&(i.cssText=e):s&&t.removeAttribute("style"),"_vod"in t&&(i.display=r)}}const Zn=/\s*!important$/;function Gi(t,s,e){if(le(e))e.forEach(i=>Gi(t,s,i));else if(e==null&&(e=""),s.startsWith("--"))t.setProperty(s,e);else{const i=pa(t,s);Zn.test(e)?t.setProperty(Et(i),e.replace(Zn,""),"important"):t[i]=e}}const Kn=["Webkit","Moz","ms"],Hi={};function pa(t,s){const e=Hi[s];if(e)return e;let i=Qe(s);if(i!=="filter"&&i in t)return Hi[s]=i;i=gi(i);for(let n=0;nOi||(_a.then(()=>Oi=0),Oi=Date.now());function xa(t,s){const e=i=>{if(!i._vts)i._vts=Date.now();else if(i._vts<=e.attached)return;qe(ba(i,e.value),s,5,[i])};return e.value=t,e.attached=Ta(),e}function ba(t,s){if(le(s)){const e=t.stopImmediatePropagation;return t.stopImmediatePropagation=()=>{e.call(t),t._stopped=!0},s.map(i=>n=>!n._stopped&&i&&i(n))}else return s}const Jn=/^on[a-z]/,Ea=(t,s,e,i,n=!1,r,l,a,o)=>{s==="class"?da(t,i,n):s==="style"?fa(t,e,i):di(s)?Ki(s)||ya(t,s,e,i,l):(s[0]==="."?(s=s.slice(1),!0):s[0]==="^"?(s=s.slice(1),!1):Pa(t,s,i,n))?ma(t,s,i,r,l,a,o):(s==="true-value"?t._trueValue=i:s==="false-value"&&(t._falseValue=i),ga(t,s,i,n))};function Pa(t,s,e,i){return i?!!(s==="innerHTML"||s==="textContent"||s in t&&Jn.test(s)&&ge(e)):s==="spellcheck"||s==="draggable"||s==="translate"||s==="form"||s==="list"&&t.tagName==="INPUT"||s==="type"&&t.tagName==="TEXTAREA"||Jn.test(s)&&Se(e)?!1:s in t}const Qn=t=>{const s=t.props["onUpdate:modelValue"]||!1;return le(s)?e=>ii(s,e):s};function Sa(t){t.target.composing=!0}function $n(t){const s=t.target;s.composing&&(s.composing=!1,s.dispatchEvent(new Event("input")))}const Ys={created(t,{modifiers:{lazy:s,trim:e,number:i}},n){t._assign=Qn(n);const r=i||n.props&&n.props.type==="number";Rt(t,s?"change":"input",l=>{if(l.target.composing)return;let a=t.value;e&&(a=a.trim()),r&&(a=Li(a)),t._assign(a)}),e&&Rt(t,"change",()=>{t.value=t.value.trim()}),s||(Rt(t,"compositionstart",Sa),Rt(t,"compositionend",$n),Rt(t,"change",$n))},mounted(t,{value:s}){t.value=s??""},beforeUpdate(t,{value:s,modifiers:{lazy:e,trim:i,number:n}},r){if(t._assign=Qn(r),t.composing||document.activeElement===t&&t.type!=="range"&&(e||i&&t.value.trim()===s||(n||t.type==="number")&&Li(t.value)===s))return;const l=s??"";t.value!==l&&(t.value=l)}},Ca=["ctrl","shift","alt","meta"],Ra={stop:t=>t.stopPropagation(),prevent:t=>t.preventDefault(),self:t=>t.target!==t.currentTarget,ctrl:t=>!t.ctrlKey,shift:t=>!t.shiftKey,alt:t=>!t.altKey,meta:t=>!t.metaKey,left:t=>"button"in t&&t.button!==0,middle:t=>"button"in t&&t.button!==1,right:t=>"button"in t&&t.button!==2,exact:(t,s)=>Ca.some(e=>t[`${e}Key`]&&!s.includes(e))},_t=(t,s)=>(e,...i)=>{for(let n=0;ne=>{if(!("key"in e))return;const i=Et(e.key);if(s.some(n=>n===i||Ha[n]===i))return t(e)},Xe={beforeMount(t,{value:s},{transition:e}){t._vod=t.style.display==="none"?"":t.style.display,e&&s?e.beforeEnter(t):It(t,s)},mounted(t,{value:s},{transition:e}){e&&s&&e.enter(t)},updated(t,{value:s,oldValue:e},{transition:i}){!s!=!e&&(i?s?(i.beforeEnter(t),It(t,!0),i.enter(t)):i.leave(t,()=>{It(t,!1)}):It(t,s))},beforeUnmount(t,{value:s}){It(t,s)}};function It(t,s){t.style.display=s?t._vod:"none"}const Oa=Oe({patchProp:Ea},ha);let es;function La(){return es||(es=Wo(Oa))}const Ma=(...t)=>{const s=La().createApp(...t),{mount:e}=s;return s.mount=i=>{const n=Da(i);if(!n)return;const r=s._component;!ge(r)&&!r.render&&!r.template&&(r.template=n.innerHTML),n.innerHTML="";const l=e(n,!1,n instanceof SVGElement);return n instanceof Element&&(n.removeAttribute("v-cloak"),n.setAttribute("data-v-app","")),l},s};function Da(t){return Se(t)?document.querySelector(t):t}const ue=(t,s)=>{const e=t.__vccOpts||t;for(const[i,n]of s)e[i]=n;return e},ka={},Fa={class:"tify-icon",viewBox:"0 0 24 24"},Aa=F("path",{d:"M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z"},null,-1),Ba=[Aa];function Ia(t,s){return L(),D("svg",Fa,Ba)}const Js=ue(ka,[["render",Ia]]),za={computed:{copyrightHtml(){return'Copyright © 2017–2022 Göttingen University / Göttingen State and University Library'},env(){return{version:"0.29.0",license:"AGPL-3.0",bugsUrl:"https://github.com/tify-iiif-viewer/tify/issues",contributorsUrl:"https://github.com/tify-iiif-viewer/tify/blob/v0.29.0/CONTRIBUTORS.md",docsUrl:"https://github.com/tify-iiif-viewer/tify/blob/v0.29.0/doc",docsLanguages:["de","en"],repositoryUrl:"https://github.com/tify-iiif-viewer/tify"}},infoHtml(){return'TIFY is a slim and mobile-friendly IIIF document viewer, released under the GNU Affero General Public License 3.0.'},userGuideUrl(){const t=this.env.docsLanguages.includes(this.$store.options.language)?this.$store.options.language:"en";return`${this.env.docsUrl}/user-guide.${t}.md`}}},Na={class:"tify-help",tabindex:"0"},Va={class:"tify-sr-only"},Ua=["innerHTML"],Wa=["href"],ja=["href"],Ga=["href"],qa=["href"],Za={class:"tify-help-footer"},Ka=["innerHTML"];function Xa(t,s,e,i,n,r){return L(),D("section",Na,[F("h2",Va,Z(t.$translate("Help")),1),F("h3",null,Z(t.$translate("About TIFY")),1),F("p",{innerHTML:t.$translate("$info",r.infoHtml)},null,8,Ua),F("ul",null,[F("li",null,[F("a",{href:r.userGuideUrl},Z(t.$translate("User guide")),9,Wa)]),F("li",null,[F("a",{href:r.env.repositoryUrl},Z(t.$translate("Source code")),9,ja)]),F("li",null,[F("a",{href:r.env.contributorsUrl},Z(t.$translate("Contributors")),9,Ga)]),F("li",null,[F("a",{href:r.env.bugsUrl},Z(t.$translate("Report a bug")),9,qa)])]),F("footer",Za,[F("p",null,[be(Z(t.$translate("Version"))+" ",1),F("b",null,Z(r.env.version),1),be(" · "),F("span",{innerHTML:t.$translate("$copyright",r.copyrightHtml)},null,8,Ka)])])])}const Ya=ue(za,[["render",Xa]]),Ja={},Qa={class:"tify-icon",viewBox:"0 0 24 24"},$a=F("path",{d:"M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z"},null,-1),el=[$a];function tl(t,s){return L(),D("svg",Qa,el)}const Qs=ue(Ja,[["render",tl]]),il={},nl={class:"tify-icon",viewBox:"0 0 24 24"},sl=F("path",{d:"M19,13H5V11H19V13Z"},null,-1),rl=[sl];function ol(t,s){return L(),D("svg",nl,rl)}const $s=ue(il,[["render",ol]]),al={name:"CollectionNode",props:{item:{type:Object,default:()=>{}}},data(){return{children:null,expanded:!1,id:this.$store.getId(`collection-node-${Math.floor(Math.random()*1e12)}`)}},computed:{label(){const t=String.fromCharCode(160);return this.item.label?this.$store.convertValueToArray(this.item.label).join(`${t}· `):"—"}},methods:{toggleChildren(){if(this.expanded){this.expanded=!1;return}if(this.children){this.expanded=!0;return}if(this.item.children){this.children=this.item.children,this.expanded=!0;return}this.$store.fetchJson(this.item["@id"]).then(t=>{this.children=t.manifests||t.collections||[],this.expanded=!0},t=>{const s=t.response&&(t.response.statusText||t.response.data)||t.message;this.$store.addError(`Error loading IIIF manifest: ${s}`),this.children=!1})}}},ll=["aria-controls","aria-expanded"],ul={class:"tify-sr-only"},cl={class:"tify-sr-only"},hl=["id"],dl={key:1,class:"tify-collection-error"};function fl(t,s,e,i,n,r){const l=$s,a=Qs,o=As("collection-node",!0);return L(),D("li",{class:xe(["tify-collection-item",{"-current":t.$store.manifest&&t.$store.manifest["@id"]===e.item["@id"]}])},[e.item["@type"]==="sc:Collection"?(L(),D("button",{key:0,type:"button","aria-controls":n.id,"aria-expanded":n.expanded?"true":"false",class:"tify-collection-link -has-children",onClick:s[0]||(s[0]=u=>r.toggleChildren())},[n.expanded?(L(),D(de,{key:0},[te(l),F("span",ul,Z(t.$translate("Collapse")),1)],64)):(L(),D(de,{key:1},[te(a),F("span",cl,Z(t.$translate("Expand")),1)],64)),be(" "+Z(r.label),1)],8,ll)):(L(),D("a",{key:1,href:"javascript:;",class:"tify-collection-link",onClick:s[1]||(s[1]=u=>t.$store.loadManifest(e.item["@id"],{expectedType:e.item["@type"],reset:!0}))},Z(r.label),1)),n.expanded?(L(),D(de,{key:2},[n.expanded?(L(),D("ol",{key:0,id:n.id,class:"tify-collection-list"},[(L(!0),D(de,null,Pe(n.children,u=>(L(),Me(o,{key:u["@id"],item:u},null,8,["item"]))),128))],8,hl)):n.children===!1?(L(),D("p",dl,Z(t.$translate("Could not load child manifest")),1)):se("",!0)],64)):se("",!0)],2)}const pl=ue(al,[["render",fl]]),gl={data(){return{filter:""}},computed:{filteredItems(){const t=this.filter.trim().toLowerCase().split(/\s+/);return this.items.filter(s=>{const e=(s.label||"").toLowerCase();return t.every(i=>e.includes(i))})},items(){return this.$store.collection.manifests&&this.$store.collection.collections?[{"@id":"tify-collection-manifests","@type":"sc:Collection",label:this.$translate("Documents"),children:this.$store.collection.manifests},{"@id":"tify-collection-collections","@type":"sc:Collection",label:this.$translate("Collections"),children:this.$store.collection.collections}]:this.$store.collection.manifests||this.$store.collection.collections}}},ml={class:"tify-collection",tabindex:"0"},vl={class:"tify-sr-only"},yl={key:0,class:"tify-collection-controls"},wl=["aria-label","placeholder"],_l=["disabled"],Tl={key:1,class:"tify-collection-list"},xl={key:2,class:"tify-collection-no-results"};function bl(t,s,e,i,n,r){const l=pl;return L(),D("section",ml,[F("h2",vl,Z(t.$translate("Collection")),1),r.items.length>5?(L(),D("p",yl,[ke(F("input",{"onUpdate:modelValue":s[0]||(s[0]=a=>n.filter=a),"aria-label":t.$translate("Filter collection"),class:"tify-collection-filter",placeholder:t.$translate("Filter collection"),type:"text",onKeydown:[s[1]||(s[1]=Vt(_t(a=>n.filter?n.filter="":a.target.blur(),["prevent"]),["esc"])),s[2]||(s[2]=_t(()=>{},["stop"]))]},null,40,wl),[[Ys,n.filter]]),F("button",{type:"button",class:"tify-collection-reset",disabled:!n.filter,onClick:s[3]||(s[3]=a=>n.filter="")},Z(t.$translate("Reset")),9,_l)])):se("",!0),r.filteredItems.length?(L(),D("ol",Tl,[(L(!0),D(de,null,Pe(r.filteredItems,a=>(L(),Me(l,{key:a["@id"],item:a},null,8,["item"]))),128))])):(L(),D("p",xl,Z(t.$translate("No results")),1))])}const El=ue(gl,[["render",bl]]),Pl={},Sl={class:"tify-icon",viewBox:"0 0 24 24"},Cl=F("path",{d:"M7.41,15.41L12,10.83L16.59,15.41L18,14L12,8L6,14L7.41,15.41Z"},null,-1),Rl=[Cl];function Hl(t,s){return L(),D("svg",Sl,Rl)}const Ol=ue(Pl,[["render",Hl]]),Ll={},Ml={class:"tify-icon",viewBox:"0 0 24 24"},Dl=F("path",{d:"M7.41,8.58L12,13.17L16.59,8.58L18,10L12,16L6,10L7.41,8.58Z"},null,-1),kl=[Dl];function Fl(t,s){return L(),D("svg",Ml,kl)}const Al=ue(Ll,[["render",Fl]]);function ts(t,s){if(!Array.isArray(t)||new Set(t).size!==t.length)return!1;for(let e=0,i=t.length;e0&&t[e]>0&&t[e]<=t[e-1]||t[e]<0||t[e]>s)return!1;return!0}function gn(t,s=["https:","http:"]){let e;try{e=new URL(t)}catch{return!1}return s.includes(e.protocol)}const Bl={props:{metadata:{type:Array,default:()=>[]}},data(){return{infoItems:[]}},watch:{metadata(){this.updateInfoItems()}},mounted(){this.updateInfoItems()},methods:{cleanLabel(t){const s=t.replace("_"," ");return s.charAt(0).toUpperCase()+s.substr(1)},updateInfoItems(){this.$nextTick(()=>{this.$refs.contents&&this.$refs.contents.forEach((t,s)=>{const e=t.offsetHeight;this.infoItems[s]={collapsed:!0,exceedsHeight:!0},this.$nextTick(()=>{const i=t.offsetHeight,n=e>=i;this.infoItems[s]={collapsed:n,exceedsHeight:n}})})})},isValidUrl:gn}},Il={class:"tify-info-metadata"},zl={class:"tify-info-value"},Nl=["href"],Vl=["innerHTML"],Ul=["onClick"];function Wl(t,s,e,i,n,r){const l=Al,a=Ol;return L(),D("div",Il,[(L(!0),D(de,null,Pe(e.metadata,(o,u)=>(L(),D("div",{key:u},[F("h4",null,[(L(!0),D(de,null,Pe(t.$store.convertValueToArray(o.label),(h,g)=>(L(),D("div",{key:g},Z(r.cleanLabel(h)),1))),128))]),F("div",{ref_for:!0,ref:"contents",class:xe(["tify-info-content",{"-collapsed":n.infoItems[u]&&n.infoItems[u].collapsed}])},[F("div",zl,[(L(!0),D(de,null,Pe(t.$store.convertValueToArray(o.value),h=>(L(),D(de,null,[r.isValidUrl(h)?(L(),D("div",{key:"url-"+h},[F("a",{href:h},Z(h),9,Nl)])):(L(),D("div",{key:"html-"+h,innerHTML:h},null,8,Vl))],64))),256))]),n.infoItems[u]&&n.infoItems[u].exceedsHeight?(L(),D("button",{key:0,type:"button",class:"tify-info-toggle",onClick:h=>n.infoItems[u].collapsed=!n.infoItems[u].collapsed},[n.infoItems[u].collapsed?(L(),D(de,{key:0},[te(l),be(" "+Z(t.$translate("Expand")),1)],64)):(L(),D(de,{key:1},[te(a),be(" "+Z(t.$translate("Collapse")),1)],64))],8,Ul)):se("",!0)],2)]))),128))])}const jl=ue(Bl,[["render",Wl]]),Gl={data(){return{collectionDataShown:!1}},computed:{license(){return this.manifestOrCollection.license?this.$store.convertValueToArray(this.manifestOrCollection.license):[]},logoId(){return this.manifestOrCollection.logo["@id"]||this.manifestOrCollection.logo},manifestOrCollection(){return this.collectionDataShown?this.$store.collection:this.$store.manifest||this.$store.collection||{}},related(){return this.manifestOrCollection.related?this.$store.convertValueToArray(this.manifestOrCollection.related):[]}},methods:{isValidUrl:gn}},ql={class:"tify-info",tabindex:"0"},Zl={class:"tify-sr-only"},Kl={key:0,class:"tify-info-header"},Xl={key:1,class:"tify-info-section -title"},Yl={class:"tify-info-heading"},Jl={key:2,class:"tify-info-section -metadata"},Ql={key:3,class:"tify-info-section -metadata -structure"},$l={key:0,class:"tify-info-structure"},eu={key:4,class:"tify-info-section -description"},tu=["innerHTML"],iu={key:5,class:"tify-info-section -license"},nu=["href"],su=["href"],ru={key:6,class:"tify-info-section -related"},ou=["href"],au=["href"],lu={key:7,class:"tify-info-section -attribution"},uu=["innerHTML"],cu={key:8,class:"tify-info-section -logo"},hu=["href"],du=["src","alt"],fu=["src","alt"];function pu(t,s,e,i,n,r){const l=jl;return L(),D("section",ql,[F("h2",Zl,Z(t.$translate("Info")),1),t.$store.collection&&t.$store.manifest?(L(),D("div",Kl,[F("button",{type:"button",class:xe(["tify-info-button",{"-active":!n.collectionDataShown}]),onClick:s[0]||(s[0]=a=>n.collectionDataShown=!1)},Z(t.$translate("Document")),3),F("button",{type:"button",class:xe(["tify-info-button",{"-active":n.collectionDataShown}]),onClick:s[1]||(s[1]=a=>n.collectionDataShown=!0)},Z(t.$translate("Collection")),3)])):se("",!0),r.manifestOrCollection.label?(L(),D("div",Xl,[F("h3",Yl,Z(t.$translate("Title")),1),(L(!0),D(de,null,Pe(t.$store.convertValueToArray(r.manifestOrCollection.label),a=>(L(),D("div",{key:a},Z(a),1))),128))])):se("",!0),r.manifestOrCollection.metadata&&r.manifestOrCollection.metadata.length?(L(),D("div",Jl,[F("h3",null,Z(t.$translate("Metadata")),1),t.$store.options.view==="info"?(L(),Me(l,{key:0,metadata:r.manifestOrCollection.metadata},null,8,["metadata"])):se("",!0)])):se("",!0),r.manifestOrCollection.structures&&(t.$store.currentStructure.label||t.$store.currentStructure.metadata)?(L(),D("div",Ql,[F("h3",null,Z(t.$translate("Current Element")),1),t.$store.currentStructure.label?(L(),D("p",$l,Z(t.$store.currentStructure.label),1)):se("",!0),t.$store.options.view==="info"&&t.$store.currentStructure.metadata?(L(),Me(l,{key:1,class:"tify-info-section -metadata",metadata:t.$store.currentStructure.metadata},null,8,["metadata"])):se("",!0)])):se("",!0),r.manifestOrCollection.description?(L(),D("div",eu,[F("h3",null,Z(t.$translate("Description")),1),(L(!0),D(de,null,Pe(t.$store.convertValueToArray(r.manifestOrCollection.description),(a,o)=>(L(),D("div",{key:o,innerHTML:a},null,8,tu))),128))])):se("",!0),r.license.length?(L(),D("div",iu,[F("h3",null,Z(t.$translate("License")),1),(L(!0),D(de,null,Pe(r.license,(a,o)=>(L(),D("div",{key:o},[typeof a=="string"?(L(),D(de,{key:0},[r.isValidUrl(a)?(L(),D("a",{key:0,href:a},Z(a),9,nu)):(L(),D(de,{key:1},[be(Z(a),1)],64))],64)):(L(),D(de,{key:1},[r.isValidUrl(a["@id"])?(L(),D("a",{key:0,href:a["@id"]},Z(a.label||a["@id"]),9,su)):(L(),D(de,{key:1},[be(Z(a.label||a["@id"]),1)],64))],64))]))),128))])):se("",!0),r.related.length?(L(),D("div",ru,[F("h3",null,Z(t.$translate("Related Resources")),1),(L(!0),D(de,null,Pe(r.related,(a,o)=>(L(),D("div",{key:o},[typeof a=="string"?(L(),D("a",{key:0,href:a},Z(a),9,ou)):(L(),D("a",{key:1,href:a["@id"]},Z(a.label||a["@id"]),9,au))]))),128))])):se("",!0),r.manifestOrCollection.attribution?(L(),D("div",lu,[F("h3",null,Z(t.$translate("Provided by")),1),(L(!0),D(de,null,Pe(t.$store.convertValueToArray(r.manifestOrCollection.attribution),(a,o)=>(L(),D("div",{key:o,innerHTML:a},null,8,uu))),128))])):se("",!0),r.manifestOrCollection.logo?(L(),D("div",cu,[r.logoId&&r.manifestOrCollection.logo.service&&r.manifestOrCollection.logo.service["@id"]?(L(),D("a",{key:0,href:r.manifestOrCollection.logo.service["@id"]},[F("img",{class:"tify-info-logo",src:r.logoId,alt:t.$translate("Logo")},null,8,du)],8,hu)):(L(),D("img",{key:1,class:"tify-info-logo",src:r.logoId,alt:t.$translate("Logo")},null,8,fu))])):se("",!0)])}const gu=ue(Gl,[["render",pu]]),mu={name:"TocList",props:{level:{type:Number,default:0},structures:{type:Array,default:()=>[]},parentStructure:{type:Object,default:()=>{}},purpose:{type:String,default:""}},data(){return{expandedStructures:[],id:this.$store.getId(`toc-list-${Math.floor(Math.random()*1e12)}`)}},methods:{isCurrentPageInStructure(t){const{pages:s}=this.$store.options;return s.some(e=>e>=t.firstPage&&e<=t.lastPage)},setPage(t){this.$store.setPage(t),this.$store.isMobile()&&this.$store.updateOptions({view:"scan"})},toggleAllChildren(t=null){if(this.$refs.children){for(let s=this.structures.length-1;s>=0;s-=1)this.toggleChildren(s,t);this.$refs.children.forEach(s=>{s.toggleAllChildren(t)})}},toggleChildren(t,s=null){this.structures[t].childStructures&&(this.expandedStructures[t]=s!==null?s:!this.expandedStructures[t])}}},vu={class:"tify-toc-list"},yu=["data-level"],wu=["title","aria-controls","aria-expanded","onClick"],_u=["href"],Tu=["onClick"],xu={class:"tify-toc-label"},bu={class:"tify-toc-page"};function Eu(t,s,e,i,n,r){const l=$s,a=Qs,o=As("toc-list",!0);return L(),D("ul",vu,[(L(!0),D(de,null,Pe(e.structures,(u,h)=>(L(),D("li",{key:h,class:xe(["tify-toc-structure",{"-current":r.isCurrentPageInStructure(u),"-expanded":n.expandedStructures[h]}]),"data-level":e.level},[u.childStructures?(L(),D("button",{key:0,type:"button",class:"tify-toc-toggle",title:t.$translate(n.expandedStructures[h]?"Collapse":"Expand"),"aria-controls":`${n.id}-${h}`,"aria-expanded":n.expandedStructures[h]?"true":"false",onClick:g=>r.toggleChildren(h)},[n.expandedStructures[h]?(L(),Me(l,{key:0})):(L(),Me(a,{key:1}))],8,wu)):se("",!0),e.purpose==="pdf"?(L(),D("a",{key:1,class:"tify-toc-link",download:"",href:t.$store.convertValueToArray(u.rendering)[0]["@id"]},Z(u.label)+" ("+Z(u.pageCount)+" "+Z(t.$translate(u.pageCount===1?"page":"pages"))+") ",9,_u)):(L(),D("a",{key:2,class:"tify-toc-link -dots",href:"javascript:;",onClick:g=>t.$store.setPage(u.firstPage)},[F("span",xu,Z(u.label),1),F("span",bu,Z(u.pageLabel),1)],8,Tu)),u.childStructures?ke((L(),Me(o,{key:3,id:`${n.id}-${h}`,ref_for:!0,ref:"children",level:e.level+1,"parent-structure":u,purpose:e.purpose,structures:u.childStructures},null,8,["id","level","parent-structure","purpose","structures"])),[[Xe,n.expandedStructures[h]]]):se("",!0)],10,yu))),128))])}const er=ue(mu,[["render",Eu]]),Pu=[{label:"BibTex",profile:"http://www.bibtex.org/Format/",type:"literature"},{label:"EndNote",profile:"http://endnote.com/",type:"literature"},{label:"RIS",profile:"http://referencemanager.com/sites/rm/files/m/direct_export_ris.pdf",type:"literature"},{label:"METS",profile:"http://www.loc.gov/standards/mets/profile_docs/mets.profile.v2-0.xsd",type:"other"},{label:"MODS",format:"application/mods+xml",type:"other"}],Su={data(){return{literatureItems:[],otherItems:[],perElementPdfLinksVisible:!1}},computed:{hasElementPdfLinks(){return!Array.isArray(this.$store.manifest.structures)||!this.$store.manifest.structures[0]||!this.$store.manifest.structures[0].rendering?!1:this.$store.convertValueToArray(this.$store.manifest.structures[0].rendering).some(s=>s.format&&s.format==="application/pdf")},imageUrls(){const t={};return this.$store.options.pages.forEach(s=>{if(!s)return;const{resource:e}=this.$store.canvases[s-1].images[0];if(e.service){const i=e.service["@context"]==="http://iiif.io/api/image/2/context.json"?"default":"native",n=e.service["@id"];t[s]=`${n}${n.slice(-1)==="/"?"":"/"}full/full/0/${i}.jpg`}else t[s]=e["@id"]}),t},pages(){return this.$store.options.pages.filter(t=>t>0)},renderings(){return this.$store.convertValueToArray(this.$store.manifest.rendering)}},created(){const{seeAlso:t}=this.$store.manifest;if(!t)return;JSON.parse(JSON.stringify(Array.isArray(t)?t:[t])).forEach(e=>{const i=typeof e=="object"?e:{"@id":e};let n=!1;Pu.some(r=>{const l=e.format&&r.format===e.format,a=e.profile&&r.profile===e.profile;return l||a?(i.label=r.label,r.type==="literature"&&(n=!0),!0):!1}),n?this.literatureItems.push(i):this.otherItems.push(i)})}},Cu={class:"tify-export",tabindex:"0"},Ru={class:"tify-sr-only"},Hu={class:"tify-export-section -links"},Ou=["href","download"],Lu={key:0,class:"tify-export-section -renderings"},Mu=["href"],Du={key:0,class:"tify-export-container"},ku=["aria-controls","aria-expanded"],Fu={class:"tify-sr-only"},Au=["id"],Bu={key:1,class:"tify-export-section -literature"},Iu=["href"],zu={class:"tify-export-section -other"},Nu={key:0},Vu=["href"],Uu=["href"],Wu=["href"];function ju(t,s,e,i,n,r){const l=Js,a=er;return L(),D("section",Cu,[F("h2",Ru,Z(t.$translate("Export")),1),F("div",Hu,[F("h3",null,Z(t.$translate("Download Individual Images")),1),F("ul",null,[(L(!0),D(de,null,Pe(r.pages,o=>(L(),D("li",{key:o},[F("a",{href:r.imageUrls[o],download:`${o}.jpg`},Z(t.$translate("Page"))+" "+Z(t.$store.getPageLabel(o,t.$store.convertValueToArray(t.$store.canvases[o-1].label)[0])),9,Ou)]))),128))])]),t.$store.manifest.rendering?(L(),D("div",Lu,[F("h3",null,Z(t.$translate("Renderings")),1),F("ul",null,[(L(!0),D(de,null,Pe(r.renderings,o=>(L(),D("li",{key:o["@id"]},[F("a",{href:o["@id"]},Z(o.label),9,Mu)]))),128))]),r.hasElementPdfLinks?(L(),D("div",Du,[F("button",{type:"button",class:xe(["tify-export-toggle",{"-close":n.perElementPdfLinksVisible}]),"aria-controls":t.$store.getId("export-pdf-list"),"aria-expanded":n.perElementPdfLinksVisible?"true":"false",onClick:s[0]||(s[0]=o=>n.perElementPdfLinksVisible=!n.perElementPdfLinksVisible)},[n.perElementPdfLinksVisible?(L(),D(de,{key:1},[te(l),F("span",Fu,Z(t.$translate("Close PDF list")),1)],64)):(L(),D(de,{key:0},[be(Z(t.$translate("PDFs for each element")),1)],64))],10,ku),n.perElementPdfLinksVisible?(L(),D("div",{key:0,id:t.$store.getId("export-pdf-list"),class:"tify-export-toc"},[F("h4",null,Z(t.$translate("PDFs for each element")),1),te(a,{ref:"children",purpose:"pdf",level:0,structures:t.$store.structures},null,8,["structures"])],8,Au)):se("",!0)])):se("",!0)])):se("",!0),n.literatureItems.length?(L(),D("div",Bu,[F("h3",null,Z(t.$translate("Literature Management")),1),F("ul",null,[(L(!0),D(de,null,Pe(n.literatureItems,o=>(L(),D("li",{key:o["@id"]},[F("a",{href:o["@id"],download:""},Z(o.label),9,Iu)]))),128))])])):se("",!0),F("div",zu,[F("h3",null,Z(t.$translate("Other Formats")),1),F("ul",null,[t.$store.options.childManifestUrl?(L(),D("li",Nu,[F("a",{href:t.$store.options.childManifestUrl,download:"manifest.json"},Z(t.$translate("IIIF manifest (current document)")),9,Vu)])):se("",!0),F("li",null,[F("a",{href:t.$store.options.manifestUrl,download:"manifest.json"},Z(t.$translate(t.$store.collection?"IIIF manifest (collection)":"IIIF manifest")),9,Uu)]),(L(!0),D(de,null,Pe(n.otherItems,o=>(L(),D("li",{key:o["@id"]},[F("a",{href:o["@id"],download:""},Z(o.label||o["@id"]),9,Wu)]))),128))])])])}const Gu=ue(Su,[["render",ju]]);function hi(t,s,e=120){const i=t,n=e===!0?120:e;if(!n||n<0){i.scrollTop=s;return}const l=(s-t.scrollTop)/n/.1;setTimeout(()=>{i.scrollTop+=l,i.scrollTop!==s&&hi(i,s,n-10)},10)}function qi(t,s,e=!0){const i=s.querySelectorAll(t);if(!i.length)return;let n=i[0];const r=i[i.length-1];Array.prototype.forEach.call(i,u=>{u.dataset.level>n.dataset.level&&(n=u)});const l=s.getBoundingClientRect(),a=n.getBoundingClientRect(),o=r.getBoundingClientRect();if(a.topl.bottom){const u=o.bottom-l.bottom+s.scrollTop;hi(s,u+50,e)}}const is=".tify-toc-structure.-current",qu={data(){return{isInited:!1}},computed:{hasChildStructures(){return this.$store.structures&&this.$store.structures.some(t=>t.childStructures)}},watch:{"$store.options.pages":function(){this.$nextTick(()=>qi(is,this.$el))},"$store.options.view":{handler(t){t==="toc"&&this.$nextTick(this.init)},immediate:!0}},methods:{init(){this.isInited=!0,this.$nextTick(()=>qi(is,this.$el,!1))}}},Zu={class:"tify-toc",tabindex:"0"},Ku={class:"tify-sr-only"},Xu={key:0,class:"tify-toc-header"};function Yu(t,s,e,i,n,r){const l=er;return L(),D("section",Zu,[F("h2",Ku,Z(t.$translate("Table of Contents")),1),r.hasChildStructures?(L(),D("div",Xu,[F("button",{type:"button",class:"tify-toc-toggle-all",onClick:s[0]||(s[0]=a=>t.$refs.children.toggleAllChildren(!0))},Z(t.$translate("Expand all")),1),F("button",{type:"button",class:"tify-toc-toggle-all",onClick:s[1]||(s[1]=a=>t.$refs.children.toggleAllChildren(!1))},Z(t.$translate("Collapse all")),1)])):se("",!0),n.isInited?(L(),Me(l,{key:1,ref:"children",level:0,structures:t.$store.structures},null,8,["structures"])):se("",!0)])}const Ju=ue(qu,[["render",Yu]]),Qu=750,$u={data(){return{itemHeight:0,itemVMargin:0,items:[{label:""}],itemsPerRow:0,knownImages:[],lastScrollTop:0,resizeTimeout:null,style:{},thumbnailWidth:0,touchTimeout:null}},watch:{"$store.options.pages":function(t){this.$nextTick(()=>{const s=".tify-thumbnails-item.-current";t.length>2||t.length>1&&t[1]!==t[0]+1||(this.$refs.container.querySelector(s)?qi(s,this.$el):this.scrollToCurrentPage())})},"$store.options.view":{handler(t){t==="thumbnails"&&this.$nextTick(this.init)},immediate:!0}},mounted(){this.style.flex=this.$el.style.flex},methods:{init(){this.updateDimensions(),this.scrollToCurrentPage(!1),new ResizeObserver(this.onResize).observe(this.$el)},onResize(){clearTimeout(this.resizeTimeout),this.resizeTimeout=setTimeout(()=>{this.$store.options.view==="thumbnails"&&this.updateDimensions()},200)},updateDimensions(){const t=this.$refs.container.querySelector(".tify-thumbnails-item"),s=t.currentStyle||window.getComputedStyle(t),e=parseInt(s.marginTop,10)+parseFloat(s.marginBottom,10);this.itemHeight=t.offsetHeight+e,this.itemVerticalMargin=e;const i=parseInt(s.marginLeft,10)+parseFloat(s.marginRight,10),n=t.offsetWidth+i;this.thumbnailWidth=t.offsetWidth,this.itemsPerRow=Math.floor(this.$refs.container.clientWidth/n);const l=Math.ceil(this.$store.canvases.length/this.itemsPerRow)*this.itemHeight;this.$refs.container.style.height=`${l}px`,this.redrawThumbnails(),this.scrollToCurrentPage(!1)},redrawThumbnails(){const t=this.$el.scrollTop,s=Math.floor(t/this.itemHeight)*this.itemsPerRow+1,i=Math.ceil(this.$el.offsetHeight/this.itemHeight)*this.itemsPerRow,n=s+this.itemsPerRow+i,r=Math.min(this.$store.canvases.length,n),l=[];for(let a=s-1;a{const a=Math.floor(s/this.itemsPerRow);this.$refs.container.style.paddingTop=`${a*this.itemHeight}px`})},scrollToCurrentPage(t=!0){const e=Math.floor((this.$store.options.pages[0]-1)/this.itemsPerRow)*this.itemHeight+(this.itemVMargin-50);t?hi(this.$el,e):this.$el.scrollTop=e},setPageAndSwitchView(t,s=!1){if(s){const e=this.$store.options.pages.slice(0),i=e.indexOf(t);i<0?(e.push(t),e.sort((n,r)=>n-r),e[0]===0&&e.shift()):e.length>1&&e.splice(i,1),this.$store.updateOptions({pages:e});return}this.$store.setPage(t),this.$store.isMobile()&&this.$store.updateOptions({view:"scan"})},touchStartTogglePage(t){this.lastScrollTop=this.$el.scrollTop,this.touchTimeout=setTimeout(()=>{this.$el.scrollTop===this.lastScrollTop&&this.setPageAndSwitchView(t,!0)},Qu)},touchEnd(){clearTimeout(this.touchTimeout)}}},ec={class:"tify-sr-only"},tc={ref:"container",class:"tify-thumbnails-list"},ic=["onClick","onTouchstart"],nc=["src"],sc={class:"tify-thumbnails-page"};function rc(t,s,e,i,n,r){return L(),D("section",{class:"tify-thumbnails",tabindex:"0",onScroll:s[1]||(s[1]=(...l)=>r.redrawThumbnails&&r.redrawThumbnails(...l))},[F("h2",ec,Z(t.$translate("Pages")),1),F("div",tc,[(L(!0),D(de,null,Pe(n.items,l=>(L(),D("a",{key:l.page,class:xe(["tify-thumbnails-item",{"-current":t.$store.options.pages.includes(l.page)}]),href:"javascript:;",onClick:_t(a=>r.setPageAndSwitchView(l.page,a.ctrlKey),["prevent"]),onTouchstart:a=>r.touchStartTogglePage(l.page),onTouchend:s[0]||(s[0]=(...a)=>r.touchEnd&&r.touchEnd(...a))},[F("img",{alt:"",src:l.imgUrl},null,8,nc),F("span",sc,Z(t.$store.getPageLabel(l.page,l.label)),1)],42,ic))),128))],512)],32)}const oc=ue($u,[["render",rc]]);var mn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function vn(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var tr={exports:{}};(function(t){(function(s){if(typeof e!="function"){var e=function(x){return x};e.nonNative=!0}const i=e("plaintext"),n=e("html"),r=e("comment"),l=/<(\w*)>/g,a=/<\/?([^\s\/>]+)/;function o(x,P,C){x=x||"",P=P||[],C=C||"";let k=h(P,C);return g(x,k)}function u(x,P){x=x||[],P=P||"";let C=h(x,P);return function(d){return g(d||"",C)}}o.init_streaming_mode=u;function h(x,P){return x=m(x),{allowable_tags:x,tag_replacement:P,state:i,tag_buffer:"",depth:0,in_quote_char:""}}function g(x,P){if(typeof x!="string")throw new TypeError("'html' parameter must be a string");let C=P.allowable_tags,k=P.tag_replacement,d=P.state,_=P.tag_buffer,S=P.depth,M=P.in_quote_char,I="";for(let V=0,j=x.length;V":if(M)break;if(S){S--;break}M="",d=i,_+=">",C.has(T(_))?I+=_:I+=k,_="";break;case'"':case"'":q===M?M="":M=M||q,_+=q;break;case"-":_==="{for(const r of n)if(r.type==="childList")for(const l of r.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&i(l)}).observe(document,{childList:!0,subtree:!0});function e(n){const r={};return n.integrity&&(r.integrity=n.integrity),n.referrerPolicy&&(r.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?r.credentials="include":n.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function i(n){if(n.ep)return;n.ep=!0;const r=e(n);fetch(n.href,r)}})();function Zi(t,s){const e=Object.create(null),i=t.split(",");for(let n=0;n!!e[n.toLowerCase()]:n=>!!e[n]}const Te={},Ht=[],Ge=()=>{},or=()=>!1,ar=/^on[^a-z]/,di=t=>ar.test(t),Ki=t=>t.startsWith("onUpdate:"),Oe=Object.assign,Xi=(t,s)=>{const e=t.indexOf(s);e>-1&&t.splice(e,1)},lr=Object.prototype.hasOwnProperty,ve=(t,s)=>lr.call(t,s),le=Array.isArray,Ot=t=>fi(t)==="[object Map]",ns=t=>fi(t)==="[object Set]",ge=t=>typeof t=="function",Se=t=>typeof t=="string",Yi=t=>typeof t=="symbol",be=t=>t!==null&&typeof t=="object",ss=t=>be(t)&&ge(t.then)&&ge(t.catch),rs=Object.prototype.toString,fi=t=>rs.call(t),ur=t=>fi(t).slice(8,-1),os=t=>fi(t)==="[object Object]",Ji=t=>Se(t)&&t!=="NaN"&&t[0]!=="-"&&""+parseInt(t,10)===t,ti=Zi(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),pi=t=>{const s=Object.create(null);return e=>s[e]||(s[e]=t(e))},cr=/-(\w)/g,$e=pi(t=>t.replace(cr,(s,e)=>e?e.toUpperCase():"")),hr=/\B([A-Z])/g,Et=pi(t=>t.replace(hr,"-$1").toLowerCase()),gi=pi(t=>t.charAt(0).toUpperCase()+t.slice(1)),Ei=pi(t=>t?`on${gi(t)}`:""),oi=(t,s)=>!Object.is(t,s),ii=(t,s)=>{for(let e=0;e{Object.defineProperty(t,s,{configurable:!0,enumerable:!1,value:e})},Li=t=>{const s=parseFloat(t);return isNaN(s)?t:s};let bn;const Mi=()=>bn||(bn=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function Qi(t){if(le(t)){const s={};for(let e=0;e{if(e){const i=e.split(fr);i.length>1&&(s[i[0].trim()]=i[1].trim())}}),s}function xe(t){let s="";if(Se(t))s=t;else if(le(t))for(let e=0;eSe(t)?t:t==null?"":le(t)||be(t)&&(t.toString===rs||!ge(t.toString))?JSON.stringify(t,ls,2):String(t),ls=(t,s)=>s&&s.__v_isRef?ls(t,s.value):Ot(s)?{[`Map(${s.size})`]:[...s.entries()].reduce((e,[i,n])=>(e[`${i} =>`]=n,e),{})}:ns(s)?{[`Set(${s.size})`]:[...s.values()]}:be(s)&&!le(s)&&!os(s)?String(s):s;let Ue;class yr{constructor(s=!1){this.detached=s,this._active=!0,this.effects=[],this.cleanups=[],this.parent=Ue,!s&&Ue&&(this.index=(Ue.scopes||(Ue.scopes=[])).push(this)-1)}get active(){return this._active}run(s){if(this._active){const e=Ue;try{return Ue=this,s()}finally{Ue=e}}}on(){Ue=this}off(){Ue=this.parent}stop(s){if(this._active){let e,i;for(e=0,i=this.effects.length;e{const s=new Set(t);return s.w=0,s.n=0,s},us=t=>(t.w&ft)>0,cs=t=>(t.n&ft)>0,Tr=({deps:t})=>{if(t.length)for(let s=0;s{const{deps:s}=t;if(s.length){let e=0;for(let i=0;i{(h==="length"||h>=o)&&a.push(u)})}else switch(e!==void 0&&a.push(l.get(e)),s){case"add":le(t)?Ji(e)&&a.push(l.get("length")):(a.push(l.get(Tt)),Ot(t)&&a.push(l.get(Fi)));break;case"delete":le(t)||(a.push(l.get(Tt)),Ot(t)&&a.push(l.get(Fi)));break;case"set":Ot(t)&&a.push(l.get(Tt));break}if(a.length===1)a[0]&&Ai(a[0]);else{const o=[];for(const u of a)u&&o.push(...u);Ai($i(o))}}function Ai(t,s){const e=le(t)?t:[...t];for(const i of e)i.computed&&Pn(i);for(const i of e)i.computed||Pn(i)}function Pn(t,s){(t!==We||t.allowRecurse)&&(t.scheduler?t.scheduler():t.run())}const br=Zi("__proto__,__v_isRef,__isVue"),fs=new Set(Object.getOwnPropertyNames(Symbol).filter(t=>t!=="arguments"&&t!=="caller").map(t=>Symbol[t]).filter(Yi)),Er=tn(),Pr=tn(!1,!0),Sr=tn(!0),Sn=Cr();function Cr(){const t={};return["includes","indexOf","lastIndexOf"].forEach(s=>{t[s]=function(...e){const i=_e(this);for(let r=0,l=this.length;r{t[s]=function(...e){Ft();const i=_e(this)[s].apply(this,e);return At(),i}}),t}function Rr(t){const s=_e(this);return ze(s,"has",t),s.hasOwnProperty(t)}function tn(t=!1,s=!1){return function(i,n,r){if(n==="__v_isReactive")return!t;if(n==="__v_isReadonly")return t;if(n==="__v_isShallow")return s;if(n==="__v_raw"&&r===(t?s?jr:ys:s?vs:ms).get(i))return i;const l=le(i);if(!t){if(l&&ve(Sn,n))return Reflect.get(Sn,n,r);if(n==="hasOwnProperty")return Rr}const a=Reflect.get(i,n,r);return(Yi(n)?fs.has(n):br(n))||(t||ze(i,"get",n),s)?a:Fe(a)?l&&Ji(n)?a:a.value:be(a)?t?ws(a):vi(a):a}}const Hr=ps(),Or=ps(!0);function ps(t=!1){return function(e,i,n,r){let l=e[i];if(jt(l)&&Fe(l)&&!Fe(n))return!1;if(!t&&(!Bi(n)&&!jt(n)&&(l=_e(l),n=_e(n)),!le(e)&&Fe(l)&&!Fe(n)))return l.value=n,!0;const a=le(e)&&Ji(i)?Number(i)t,mi=t=>Reflect.getPrototypeOf(t);function Xt(t,s,e=!1,i=!1){t=t.__v_raw;const n=_e(t),r=_e(s);e||(s!==r&&ze(n,"get",s),ze(n,"get",r));const{has:l}=mi(n),a=i?nn:e?an:on;if(l.call(n,s))return a(t.get(s));if(l.call(n,r))return a(t.get(r));t!==n&&t.get(s)}function Yt(t,s=!1){const e=this.__v_raw,i=_e(e),n=_e(t);return s||(t!==n&&ze(i,"has",t),ze(i,"has",n)),t===n?e.has(t):e.has(t)||e.has(n)}function Jt(t,s=!1){return t=t.__v_raw,!s&&ze(_e(t),"iterate",Tt),Reflect.get(t,"size",t)}function Cn(t){t=_e(t);const s=_e(this);return mi(s).has.call(s,t)||(s.add(t),it(s,"add",t,t)),this}function Rn(t,s){s=_e(s);const e=_e(this),{has:i,get:n}=mi(e);let r=i.call(e,t);r||(t=_e(t),r=i.call(e,t));const l=n.call(e,t);return e.set(t,s),r?oi(s,l)&&it(e,"set",t,s):it(e,"add",t,s),this}function Hn(t){const s=_e(this),{has:e,get:i}=mi(s);let n=e.call(s,t);n||(t=_e(t),n=e.call(s,t)),i&&i.call(s,t);const r=s.delete(t);return n&&it(s,"delete",t,void 0),r}function On(){const t=_e(this),s=t.size!==0,e=t.clear();return s&&it(t,"clear",void 0,void 0),e}function Qt(t,s){return function(i,n){const r=this,l=r.__v_raw,a=_e(l),o=s?nn:t?an:on;return!t&&ze(a,"iterate",Tt),l.forEach((u,h)=>i.call(n,o(u),o(h),r))}}function $t(t,s,e){return function(...i){const n=this.__v_raw,r=_e(n),l=Ot(r),a=t==="entries"||t===Symbol.iterator&&l,o=t==="keys"&&l,u=n[t](...i),h=e?nn:s?an:on;return!s&&ze(r,"iterate",o?Fi:Tt),{next(){const{value:g,done:m}=u.next();return m?{value:g,done:m}:{value:a?[h(g[0]),h(g[1])]:h(g),done:m}},[Symbol.iterator](){return this}}}}function at(t){return function(...s){return t==="delete"?!1:this}}function Ar(){const t={get(r){return Xt(this,r)},get size(){return Jt(this)},has:Yt,add:Cn,set:Rn,delete:Hn,clear:On,forEach:Qt(!1,!1)},s={get(r){return Xt(this,r,!1,!0)},get size(){return Jt(this)},has:Yt,add:Cn,set:Rn,delete:Hn,clear:On,forEach:Qt(!1,!0)},e={get(r){return Xt(this,r,!0)},get size(){return Jt(this,!0)},has(r){return Yt.call(this,r,!0)},add:at("add"),set:at("set"),delete:at("delete"),clear:at("clear"),forEach:Qt(!0,!1)},i={get(r){return Xt(this,r,!0,!0)},get size(){return Jt(this,!0)},has(r){return Yt.call(this,r,!0)},add:at("add"),set:at("set"),delete:at("delete"),clear:at("clear"),forEach:Qt(!0,!0)};return["keys","values","entries",Symbol.iterator].forEach(r=>{t[r]=$t(r,!1,!1),e[r]=$t(r,!0,!1),s[r]=$t(r,!1,!0),i[r]=$t(r,!0,!0)}),[t,e,s,i]}const[Br,Ir,zr,Nr]=Ar();function sn(t,s){const e=s?t?Nr:zr:t?Ir:Br;return(i,n,r)=>n==="__v_isReactive"?!t:n==="__v_isReadonly"?t:n==="__v_raw"?i:Reflect.get(ve(e,n)&&n in i?e:i,n,r)}const Vr={get:sn(!1,!1)},Ur={get:sn(!1,!0)},Wr={get:sn(!0,!1)},ms=new WeakMap,vs=new WeakMap,ys=new WeakMap,jr=new WeakMap;function Gr(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function qr(t){return t.__v_skip||!Object.isExtensible(t)?0:Gr(ur(t))}function vi(t){return jt(t)?t:rn(t,!1,gs,Vr,ms)}function Zr(t){return rn(t,!1,Fr,Ur,vs)}function ws(t){return rn(t,!0,kr,Wr,ys)}function rn(t,s,e,i,n){if(!be(t)||t.__v_raw&&!(s&&t.__v_isReactive))return t;const r=n.get(t);if(r)return r;const l=qr(t);if(l===0)return t;const a=new Proxy(t,l===2?i:e);return n.set(t,a),a}function Lt(t){return jt(t)?Lt(t.__v_raw):!!(t&&t.__v_isReactive)}function jt(t){return!!(t&&t.__v_isReadonly)}function Bi(t){return!!(t&&t.__v_isShallow)}function _s(t){return Lt(t)||jt(t)}function _e(t){const s=t&&t.__v_raw;return s?_e(s):t}function Ts(t){return ai(t,"__v_skip",!0),t}const on=t=>be(t)?vi(t):t,an=t=>be(t)?ws(t):t;function Kr(t){ht&&We&&(t=_e(t),ds(t.dep||(t.dep=$i())))}function Xr(t,s){t=_e(t);const e=t.dep;e&&Ai(e)}function Fe(t){return!!(t&&t.__v_isRef===!0)}function Yr(t){return Fe(t)?t.value:t}const Jr={get:(t,s,e)=>Yr(Reflect.get(t,s,e)),set:(t,s,e,i)=>{const n=t[s];return Fe(n)&&!Fe(e)?(n.value=e,!0):Reflect.set(t,s,e,i)}};function xs(t){return Lt(t)?t:new Proxy(t,Jr)}class Qr{constructor(s,e,i,n){this._setter=e,this.dep=void 0,this.__v_isRef=!0,this.__v_isReadonly=!1,this._dirty=!0,this.effect=new en(s,()=>{this._dirty||(this._dirty=!0,Xr(this))}),this.effect.computed=this,this.effect.active=this._cacheable=!n,this.__v_isReadonly=i}get value(){const s=_e(this);return Kr(s),(s._dirty||!s._cacheable)&&(s._dirty=!1,s._value=s.effect.run()),s._value}set value(s){this._setter(s)}}function $r(t,s,e=!1){let i,n;const r=ge(t);return r?(i=t,n=Ge):(i=t.get,n=t.set),new Qr(i,n,r||!n,e)}function dt(t,s,e,i){let n;try{n=i?t(...i):t()}catch(r){yi(r,s,e)}return n}function qe(t,s,e,i){if(ge(t)){const r=dt(t,s,e,i);return r&&ss(r)&&r.catch(l=>{yi(l,s,e)}),r}const n=[];for(let r=0;r>>1;qt(Le[i])Qe&&Le.splice(s,1)}function no(t){le(t)?Mt.push(...t):(!tt||!tt.includes(t,t.allowRecurse?yt+1:yt))&&Mt.push(t),Ps()}function Ln(t,s=Gt?Qe+1:0){for(;sqt(e)-qt(i)),yt=0;ytt.id==null?1/0:t.id,so=(t,s)=>{const e=qt(t)-qt(s);if(e===0){if(t.pre&&!s.pre)return-1;if(s.pre&&!t.pre)return 1}return e};function Cs(t){Ii=!1,Gt=!0,Le.sort(so);const s=Ge;try{for(Qe=0;QeSe(T)?T.trim():T)),g&&(n=e.map(Li))}let a,o=i[a=Ei(s)]||i[a=Ei($e(s))];!o&&r&&(o=i[a=Ei(Et(s))]),o&&qe(o,t,6,n);const u=i[a+"Once"];if(u){if(!t.emitted)t.emitted={};else if(t.emitted[a])return;t.emitted[a]=!0,qe(u,t,6,n)}}function Rs(t,s,e=!1){const i=s.emitsCache,n=i.get(t);if(n!==void 0)return n;const r=t.emits;let l={},a=!1;if(!ge(t)){const o=u=>{const h=Rs(u,s,!0);h&&(a=!0,Oe(l,h))};!e&&s.mixins.length&&s.mixins.forEach(o),t.extends&&o(t.extends),t.mixins&&t.mixins.forEach(o)}return!r&&!a?(be(t)&&i.set(t,null),null):(le(r)?r.forEach(o=>l[o]=null):Oe(l,r),be(t)&&i.set(t,l),l)}function wi(t,s){return!t||!di(s)?!1:(s=s.slice(2).replace(/Once$/,""),ve(t,s[0].toLowerCase()+s.slice(1))||ve(t,Et(s))||ve(t,s))}let Ve=null,Hs=null;function li(t){const s=Ve;return Ve=t,Hs=t&&t.type.__scopeId||null,s}function oo(t,s=Ve,e){if(!s||t._n)return t;const i=(...n)=>{i._d&&Un(-1);const r=li(s);let l;try{l=t(...n)}finally{li(r),i._d&&Un(1)}return l};return i._n=!0,i._c=!0,i._d=!0,i}function Pi(t){const{type:s,vnode:e,proxy:i,withProxy:n,props:r,propsOptions:[l],slots:a,attrs:o,emit:u,render:h,renderCache:g,data:m,setupState:T,ctx:x,inheritAttrs:P}=t;let C,k;const d=li(t);try{if(e.shapeFlag&4){const S=n||i;C=Je(h.call(S,S,g,r,T,m,x)),k=o}else{const S=s;C=Je(S.length>1?S(r,{attrs:o,slots:a,emit:u}):S(r,null)),k=s.props?o:ao(o)}}catch(S){Wt.length=0,yi(S,t,1),C=te(bt)}let _=C;if(k&&P!==!1){const S=Object.keys(k),{shapeFlag:M}=_;S.length&&M&7&&(l&&S.some(Ki)&&(k=lo(k,l)),_=Dt(_,k))}return e.dirs&&(_=Dt(_),_.dirs=_.dirs?_.dirs.concat(e.dirs):e.dirs),e.transition&&(_.transition=e.transition),C=_,li(d),C}const ao=t=>{let s;for(const e in t)(e==="class"||e==="style"||di(e))&&((s||(s={}))[e]=t[e]);return s},lo=(t,s)=>{const e={};for(const i in t)(!Ki(i)||!(i.slice(9)in s))&&(e[i]=t[i]);return e};function uo(t,s,e){const{props:i,children:n,component:r}=t,{props:l,children:a,patchFlag:o}=s,u=r.emitsOptions;if(s.dirs||s.transition)return!0;if(e&&o>=0){if(o&1024)return!0;if(o&16)return i?Mn(i,l,u):!!l;if(o&8){const h=s.dynamicProps;for(let g=0;gt.__isSuspense;function fo(t,s){s&&s.pendingBranch?le(t)?s.effects.push(...t):s.effects.push(t):no(t)}const ei={};function Si(t,s,e){return Os(t,s,e)}function Os(t,s,{immediate:e,deep:i,flush:n,onTrack:r,onTrigger:l}=Te){var a;const o=_r()===((a=He)==null?void 0:a.scope)?He:null;let u,h=!1,g=!1;if(Fe(t)?(u=()=>t.value,h=Bi(t)):Lt(t)?(u=()=>t,i=!0):le(t)?(g=!0,h=t.some(S=>Lt(S)||Bi(S)),u=()=>t.map(S=>{if(Fe(S))return S.value;if(Lt(S))return _t(S);if(ge(S))return dt(S,o,2)})):ge(t)?s?u=()=>dt(t,o,2):u=()=>{if(!(o&&o.isUnmounted))return m&&m(),qe(t,o,3,[T])}:u=Ge,s&&i){const S=u;u=()=>_t(S())}let m,T=S=>{m=d.onStop=()=>{dt(S,o,4)}},x;if(Kt)if(T=Ge,s?e&&qe(s,o,3,[u(),g?[]:void 0,T]):u(),n==="sync"){const S=la();x=S.__watcherHandles||(S.__watcherHandles=[])}else return Ge;let P=g?new Array(t.length).fill(ei):ei;const C=()=>{if(d.active)if(s){const S=d.run();(i||h||(g?S.some((M,I)=>oi(M,P[I])):oi(S,P)))&&(m&&m(),qe(s,o,3,[S,P===ei?void 0:g&&P[0]===ei?[]:P,T]),P=S)}else d.run()};C.allowRecurse=!!s;let k;n==="sync"?k=C:n==="post"?k=()=>Ie(C,o&&o.suspense):(C.pre=!0,o&&(C.id=o.uid),k=()=>un(C));const d=new en(u,k);s?e?C():P=d.run():n==="post"?Ie(d.run.bind(d),o&&o.suspense):d.run();const _=()=>{d.stop(),o&&o.scope&&Xi(o.scope.effects,d)};return x&&x.push(_),_}function po(t,s,e){const i=this.proxy,n=Se(t)?t.includes(".")?Ls(i,t):()=>i[t]:t.bind(i,i);let r;ge(s)?r=s:(r=s.handler,e=s);const l=He;kt(this);const a=Os(n,r.bind(i),e);return l?kt(l):xt(),a}function Ls(t,s){const e=s.split(".");return()=>{let i=t;for(let n=0;n{_t(e,s)});else if(os(t))for(const e in t)_t(t[e],s);return t}function ke(t,s){const e=Ve;if(e===null)return t;const i=bi(e)||e.proxy,n=t.dirs||(t.dirs=[]);for(let r=0;r!!t.type.__asyncLoader,Ms=t=>t.type.__isKeepAlive;function go(t,s){Ds(t,"a",s)}function mo(t,s){Ds(t,"da",s)}function Ds(t,s,e=He){const i=t.__wdc||(t.__wdc=()=>{let n=e;for(;n;){if(n.isDeactivated)return;n=n.parent}return t()});if(_i(s,i,e),e){let n=e.parent;for(;n&&n.parent;)Ms(n.parent.vnode)&&vo(i,s,e,n),n=n.parent}}function vo(t,s,e,i){const n=_i(s,t,i,!0);ks(()=>{Xi(i[s],n)},e)}function _i(t,s,e=He,i=!1){if(e){const n=e[t]||(e[t]=[]),r=s.__weh||(s.__weh=(...l)=>{if(e.isUnmounted)return;Ft(),kt(e);const a=qe(s,e,t,l);return xt(),At(),a});return i?n.unshift(r):n.push(r),r}}const nt=t=>(s,e=He)=>(!Kt||t==="sp")&&_i(t,(...i)=>s(...i),e),yo=nt("bm"),wo=nt("m"),_o=nt("bu"),To=nt("u"),xo=nt("bum"),ks=nt("um"),bo=nt("sp"),Eo=nt("rtg"),Po=nt("rtc");function So(t,s=He){_i("ec",t,s)}const Fs="components",Co="directives";function As(t,s){return Bs(Fs,t,!0,s)||t}const Ro=Symbol.for("v-ndc");function cn(t){return Bs(Co,t)}function Bs(t,s,e=!0,i=!1){const n=Ve||He;if(n){const r=n.type;if(t===Fs){const a=sa(r,!1);if(a&&(a===s||a===$e(s)||a===gi($e(s))))return r}const l=Dn(n[t]||r[t],s)||Dn(n.appContext[t],s);return!l&&i?r:l}}function Dn(t,s){return t&&(t[s]||t[$e(s)]||t[gi($e(s))])}function Pe(t,s,e,i){let n;const r=e&&e[i];if(le(t)||Se(t)){n=new Array(t.length);for(let l=0,a=t.length;ls(l,a,void 0,r&&r[a]));else{const l=Object.keys(t);n=new Array(l.length);for(let a=0,o=l.length;at?Ks(t)?bi(t)||t.proxy:zi(t.parent):null,Ut=Oe(Object.create(null),{$:t=>t,$el:t=>t.vnode.el,$data:t=>t.data,$props:t=>t.props,$attrs:t=>t.attrs,$slots:t=>t.slots,$refs:t=>t.refs,$parent:t=>zi(t.parent),$root:t=>zi(t.root),$emit:t=>t.emit,$options:t=>hn(t),$forceUpdate:t=>t.f||(t.f=()=>un(t.update)),$nextTick:t=>t.n||(t.n=Es.bind(t.proxy)),$watch:t=>po.bind(t)}),Ci=(t,s)=>t!==Te&&!t.__isScriptSetup&&ve(t,s),Ho={get({_:t},s){const{ctx:e,setupState:i,data:n,props:r,accessCache:l,type:a,appContext:o}=t;let u;if(s[0]!=="$"){const T=l[s];if(T!==void 0)switch(T){case 1:return i[s];case 2:return n[s];case 4:return e[s];case 3:return r[s]}else{if(Ci(i,s))return l[s]=1,i[s];if(n!==Te&&ve(n,s))return l[s]=2,n[s];if((u=t.propsOptions[0])&&ve(u,s))return l[s]=3,r[s];if(e!==Te&&ve(e,s))return l[s]=4,e[s];Ni&&(l[s]=0)}}const h=Ut[s];let g,m;if(h)return s==="$attrs"&&ze(t,"get",s),h(t);if((g=a.__cssModules)&&(g=g[s]))return g;if(e!==Te&&ve(e,s))return l[s]=4,e[s];if(m=o.config.globalProperties,ve(m,s))return m[s]},set({_:t},s,e){const{data:i,setupState:n,ctx:r}=t;return Ci(n,s)?(n[s]=e,!0):i!==Te&&ve(i,s)?(i[s]=e,!0):ve(t.props,s)||s[0]==="$"&&s.slice(1)in t?!1:(r[s]=e,!0)},has({_:{data:t,setupState:s,accessCache:e,ctx:i,appContext:n,propsOptions:r}},l){let a;return!!e[l]||t!==Te&&ve(t,l)||Ci(s,l)||(a=r[0])&&ve(a,l)||ve(i,l)||ve(Ut,l)||ve(n.config.globalProperties,l)},defineProperty(t,s,e){return e.get!=null?t._.accessCache[s]=0:ve(e,"value")&&this.set(t,s,e.value,null),Reflect.defineProperty(t,s,e)}};function kn(t){return le(t)?t.reduce((s,e)=>(s[e]=null,s),{}):t}let Ni=!0;function Oo(t){const s=hn(t),e=t.proxy,i=t.ctx;Ni=!1,s.beforeCreate&&Fn(s.beforeCreate,t,"bc");const{data:n,computed:r,methods:l,watch:a,provide:o,inject:u,created:h,beforeMount:g,mounted:m,beforeUpdate:T,updated:x,activated:P,deactivated:C,beforeDestroy:k,beforeUnmount:d,destroyed:_,unmounted:S,render:M,renderTracked:I,renderTriggered:V,errorCaptured:j,serverPrefetch:q,expose:K,inheritAttrs:re,components:ee,directives:fe,filters:ce}=s;if(u&&Lo(u,i,null),l)for(const oe in l){const ie=l[oe];ge(ie)&&(i[oe]=ie.bind(e))}if(n){const oe=n.call(e,e);be(oe)&&(t.data=vi(oe))}if(Ni=!0,r)for(const oe in r){const ie=r[oe],we=ge(ie)?ie.bind(e,e):ge(ie.get)?ie.get.bind(e,e):Ge,Q=!ge(ie)&&ge(ie.set)?ie.set.bind(e):Ge,Ce=Xe({get:we,set:Q});Object.defineProperty(i,oe,{enumerable:!0,configurable:!0,get:()=>Ce.value,set:Ae=>Ce.value=Ae})}if(a)for(const oe in a)Is(a[oe],i,e,oe);if(o){const oe=ge(o)?o.call(e):o;Reflect.ownKeys(oe).forEach(ie=>{Bo(ie,oe[ie])})}h&&Fn(h,t,"c");function ae(oe,ie){le(ie)?ie.forEach(we=>oe(we.bind(e))):ie&&oe(ie.bind(e))}if(ae(yo,g),ae(wo,m),ae(_o,T),ae(To,x),ae(go,P),ae(mo,C),ae(So,j),ae(Po,I),ae(Eo,V),ae(xo,d),ae(ks,S),ae(bo,q),le(K))if(K.length){const oe=t.exposed||(t.exposed={});K.forEach(ie=>{Object.defineProperty(oe,ie,{get:()=>e[ie],set:we=>e[ie]=we})})}else t.exposed||(t.exposed={});M&&t.render===Ge&&(t.render=M),re!=null&&(t.inheritAttrs=re),ee&&(t.components=ee),fe&&(t.directives=fe)}function Lo(t,s,e=Ge){le(t)&&(t=Vi(t));for(const i in t){const n=t[i];let r;be(n)?"default"in n?r=si(n.from||i,n.default,!0):r=si(n.from||i):r=si(n),Fe(r)?Object.defineProperty(s,i,{enumerable:!0,configurable:!0,get:()=>r.value,set:l=>r.value=l}):s[i]=r}}function Fn(t,s,e){qe(le(t)?t.map(i=>i.bind(s.proxy)):t.bind(s.proxy),s,e)}function Is(t,s,e,i){const n=i.includes(".")?Ls(e,i):()=>e[i];if(Se(t)){const r=s[t];ge(r)&&Si(n,r)}else if(ge(t))Si(n,t.bind(e));else if(be(t))if(le(t))t.forEach(r=>Is(r,s,e,i));else{const r=ge(t.handler)?t.handler.bind(e):s[t.handler];ge(r)&&Si(n,r,t)}}function hn(t){const s=t.type,{mixins:e,extends:i}=s,{mixins:n,optionsCache:r,config:{optionMergeStrategies:l}}=t.appContext,a=r.get(s);let o;return a?o=a:!n.length&&!e&&!i?o=s:(o={},n.length&&n.forEach(u=>ui(o,u,l,!0)),ui(o,s,l)),be(s)&&r.set(s,o),o}function ui(t,s,e,i=!1){const{mixins:n,extends:r}=s;r&&ui(t,r,e,!0),n&&n.forEach(l=>ui(t,l,e,!0));for(const l in s)if(!(i&&l==="expose")){const a=Mo[l]||e&&e[l];t[l]=a?a(t[l],s[l]):s[l]}return t}const Mo={data:An,props:Bn,emits:Bn,methods:Nt,computed:Nt,beforeCreate:De,created:De,beforeMount:De,mounted:De,beforeUpdate:De,updated:De,beforeDestroy:De,beforeUnmount:De,destroyed:De,unmounted:De,activated:De,deactivated:De,errorCaptured:De,serverPrefetch:De,components:Nt,directives:Nt,watch:ko,provide:An,inject:Do};function An(t,s){return s?t?function(){return Oe(ge(t)?t.call(this,this):t,ge(s)?s.call(this,this):s)}:s:t}function Do(t,s){return Nt(Vi(t),Vi(s))}function Vi(t){if(le(t)){const s={};for(let e=0;e1)return e&&ge(s)?s.call(i&&i.proxy):s}}function Io(t,s,e,i=!1){const n={},r={};ai(r,xi,1),t.propsDefaults=Object.create(null),Ns(t,s,n,r);for(const l in t.propsOptions[0])l in n||(n[l]=void 0);e?t.props=i?n:Zr(n):t.type.props?t.props=n:t.props=r,t.attrs=r}function zo(t,s,e,i){const{props:n,attrs:r,vnode:{patchFlag:l}}=t,a=_e(n),[o]=t.propsOptions;let u=!1;if((i||l>0)&&!(l&16)){if(l&8){const h=t.vnode.dynamicProps;for(let g=0;g{o=!0;const[m,T]=Vs(g,s,!0);Oe(l,m),T&&a.push(...T)};!e&&s.mixins.length&&s.mixins.forEach(h),t.extends&&h(t.extends),t.mixins&&t.mixins.forEach(h)}if(!r&&!o)return be(t)&&i.set(t,Ht),Ht;if(le(r))for(let h=0;h-1,T[1]=P<0||x-1||ve(T,"default"))&&a.push(g)}}}const u=[l,a];return be(t)&&i.set(t,u),u}function In(t){return t[0]!=="$"}function zn(t){const s=t&&t.toString().match(/^\s*(function|class) (\w+)/);return s?s[2]:t===null?"null":""}function Nn(t,s){return zn(t)===zn(s)}function Vn(t,s){return le(s)?s.findIndex(e=>Nn(e,t)):ge(s)&&Nn(s,t)?0:-1}const Us=t=>t[0]==="_"||t==="$stable",dn=t=>le(t)?t.map(Je):[Je(t)],No=(t,s,e)=>{if(s._n)return s;const i=oo((...n)=>dn(s(...n)),e);return i._c=!1,i},Ws=(t,s,e)=>{const i=t._ctx;for(const n in t){if(Us(n))continue;const r=t[n];if(ge(r))s[n]=No(n,r,i);else if(r!=null){const l=dn(r);s[n]=()=>l}}},js=(t,s)=>{const e=dn(s);t.slots.default=()=>e},Vo=(t,s)=>{if(t.vnode.shapeFlag&32){const e=s._;e?(t.slots=_e(s),ai(s,"_",e)):Ws(s,t.slots={})}else t.slots={},s&&js(t,s);ai(t.slots,xi,1)},Uo=(t,s,e)=>{const{vnode:i,slots:n}=t;let r=!0,l=Te;if(i.shapeFlag&32){const a=s._;a?e&&a===1?r=!1:(Oe(n,s),!e&&a===1&&delete n._):(r=!s.$stable,Ws(s,n)),l=s}else s&&(js(t,s),l={default:1});if(r)for(const a in n)!Us(a)&&!(a in l)&&delete n[a]};function Wi(t,s,e,i,n=!1){if(le(t)){t.forEach((m,T)=>Wi(m,s&&(le(s)?s[T]:s),e,i,n));return}if(ni(i)&&!n)return;const r=i.shapeFlag&4?bi(i.component)||i.component.proxy:i.el,l=n?null:r,{i:a,r:o}=t,u=s&&s.r,h=a.refs===Te?a.refs={}:a.refs,g=a.setupState;if(u!=null&&u!==o&&(Se(u)?(h[u]=null,ve(g,u)&&(g[u]=null)):Fe(u)&&(u.value=null)),ge(o))dt(o,a,12,[l,h]);else{const m=Se(o),T=Fe(o);if(m||T){const x=()=>{if(t.f){const P=m?ve(g,o)?g[o]:h[o]:o.value;n?le(P)&&Xi(P,r):le(P)?P.includes(r)||P.push(r):m?(h[o]=[r],ve(g,o)&&(g[o]=h[o])):(o.value=[r],t.k&&(h[t.k]=o.value))}else m?(h[o]=l,ve(g,o)&&(g[o]=l)):T&&(o.value=l,t.k&&(h[t.k]=l))};l?(x.id=-1,Ie(x,e)):x()}}}const Ie=fo;function Wo(t){return jo(t)}function jo(t,s){const e=Mi();e.__VUE__=!0;const{insert:i,remove:n,patchProp:r,createElement:l,createText:a,createComment:o,setText:u,setElementText:h,parentNode:g,nextSibling:m,setScopeId:T=Ge,insertStaticContent:x}=t,P=(E,R,c,v=null,b=null,O=null,H=!1,B=null,A=!!R.dynamicChildren)=>{if(E===R)return;E&&!Bt(E,R)&&(v=et(E),Ae(E,b,O,!0),E=null),R.patchFlag===-2&&(A=!1,R.dynamicChildren=null);const{type:N,ref:X,shapeFlag:G}=R;switch(N){case Ti:C(E,R,c,v);break;case bt:k(E,R,c,v);break;case Ri:E==null&&d(R,c,v,H);break;case de:ee(E,R,c,v,b,O,H,B,A);break;default:G&1?M(E,R,c,v,b,O,H,B,A):G&6?fe(E,R,c,v,b,O,H,B,A):(G&64||G&128)&&N.process(E,R,c,v,b,O,H,B,A,Ze)}X!=null&&b&&Wi(X,E&&E.ref,O,R||E,!R)},C=(E,R,c,v)=>{if(E==null)i(R.el=a(R.children),c,v);else{const b=R.el=E.el;R.children!==E.children&&u(b,R.children)}},k=(E,R,c,v)=>{E==null?i(R.el=o(R.children||""),c,v):R.el=E.el},d=(E,R,c,v)=>{[E.el,E.anchor]=x(E.children,R,c,v,E.el,E.anchor)},_=({el:E,anchor:R},c,v)=>{let b;for(;E&&E!==R;)b=m(E),i(E,c,v),E=b;i(R,c,v)},S=({el:E,anchor:R})=>{let c;for(;E&&E!==R;)c=m(E),n(E),E=c;n(R)},M=(E,R,c,v,b,O,H,B,A)=>{H=H||R.type==="svg",E==null?I(R,c,v,b,O,H,B,A):q(E,R,b,O,H,B,A)},I=(E,R,c,v,b,O,H,B)=>{let A,N;const{type:X,props:G,shapeFlag:U,transition:J,dirs:Y}=E;if(A=E.el=l(E.type,O,G&&G.is,G),U&8?h(A,E.children):U&16&&j(E.children,A,null,v,b,O&&X!=="foreignObject",H,B),Y&&mt(E,null,v,"created"),V(A,E,E.scopeId,H,v),G){for(const me in G)me!=="value"&&!ti(me)&&r(A,me,null,G[me],O,E.children,v,b,Be);"value"in G&&r(A,"value",null,G.value),(N=G.onVnodeBeforeMount)&&Ke(N,v,E)}Y&&mt(E,null,v,"beforeMount");const he=(!b||b&&!b.pendingBranch)&&J&&!J.persisted;he&&J.beforeEnter(A),i(A,R,c),((N=G&&G.onVnodeMounted)||he||Y)&&Ie(()=>{N&&Ke(N,v,E),he&&J.enter(A),Y&&mt(E,null,v,"mounted")},b)},V=(E,R,c,v,b)=>{if(c&&T(E,c),v)for(let O=0;O{for(let N=A;N{const B=R.el=E.el;let{patchFlag:A,dynamicChildren:N,dirs:X}=R;A|=E.patchFlag&16;const G=E.props||Te,U=R.props||Te;let J;c&&vt(c,!1),(J=U.onVnodeBeforeUpdate)&&Ke(J,c,R,E),X&&mt(R,E,c,"beforeUpdate"),c&&vt(c,!0);const Y=b&&R.type!=="foreignObject";if(N?K(E.dynamicChildren,N,B,c,v,Y,O):H||ie(E,R,B,null,c,v,Y,O,!1),A>0){if(A&16)re(B,R,G,U,c,v,b);else if(A&2&&G.class!==U.class&&r(B,"class",null,U.class,b),A&4&&r(B,"style",G.style,U.style,b),A&8){const he=R.dynamicProps;for(let me=0;me{J&&Ke(J,c,R,E),X&&mt(R,E,c,"updated")},v)},K=(E,R,c,v,b,O,H)=>{for(let B=0;B{if(c!==v){if(c!==Te)for(const B in c)!ti(B)&&!(B in v)&&r(E,B,c[B],null,H,R.children,b,O,Be);for(const B in v){if(ti(B))continue;const A=v[B],N=c[B];A!==N&&B!=="value"&&r(E,B,N,A,H,R.children,b,O,Be)}"value"in v&&r(E,"value",c.value,v.value)}},ee=(E,R,c,v,b,O,H,B,A)=>{const N=R.el=E?E.el:a(""),X=R.anchor=E?E.anchor:a("");let{patchFlag:G,dynamicChildren:U,slotScopeIds:J}=R;J&&(B=B?B.concat(J):J),E==null?(i(N,c,v),i(X,c,v),j(R.children,c,X,b,O,H,B,A)):G>0&&G&64&&U&&E.dynamicChildren?(K(E.dynamicChildren,U,c,b,O,H,B),(R.key!=null||b&&R===b.subTree)&&Gs(E,R,!0)):ie(E,R,c,X,b,O,H,B,A)},fe=(E,R,c,v,b,O,H,B,A)=>{R.slotScopeIds=B,E==null?R.shapeFlag&512?b.ctx.activate(R,c,v,H,A):ce(R,c,v,b,O,H,A):ye(E,R,A)},ce=(E,R,c,v,b,O,H)=>{const B=E.component=$o(E,v,b);if(Ms(E)&&(B.ctx.renderer=Ze),ea(B),B.asyncDep){if(b&&b.registerDep(B,ae),!E.el){const A=B.subTree=te(bt);k(null,A,R,c)}return}ae(B,E,R,c,b,O,H)},ye=(E,R,c)=>{const v=R.component=E.component;if(uo(E,R,c))if(v.asyncDep&&!v.asyncResolved){oe(v,R,c);return}else v.next=R,io(v.update),v.update();else R.el=E.el,v.vnode=R},ae=(E,R,c,v,b,O,H)=>{const B=()=>{if(E.isMounted){let{next:X,bu:G,u:U,parent:J,vnode:Y}=E,he=X,me;vt(E,!1),X?(X.el=Y.el,oe(E,X,H)):X=Y,G&&ii(G),(me=X.props&&X.props.onVnodeBeforeUpdate)&&Ke(me,J,X,Y),vt(E,!0);const p=Pi(E),f=E.subTree;E.subTree=p,P(f,p,g(f.el),et(f),E,b,O),X.el=p.el,he===null&&co(E,p.el),U&&Ie(U,b),(me=X.props&&X.props.onVnodeUpdated)&&Ie(()=>Ke(me,J,X,Y),b)}else{let X;const{el:G,props:U}=R,{bm:J,m:Y,parent:he}=E,me=ni(R);if(vt(E,!1),J&&ii(J),!me&&(X=U&&U.onVnodeBeforeMount)&&Ke(X,he,R),vt(E,!0),G&&ot){const p=()=>{E.subTree=Pi(E),ot(G,E.subTree,E,b,null)};me?R.type.__asyncLoader().then(()=>!E.isUnmounted&&p()):p()}else{const p=E.subTree=Pi(E);P(null,p,c,v,E,b,O),R.el=p.el}if(Y&&Ie(Y,b),!me&&(X=U&&U.onVnodeMounted)){const p=R;Ie(()=>Ke(X,he,p),b)}(R.shapeFlag&256||he&&ni(he.vnode)&&he.vnode.shapeFlag&256)&&E.a&&Ie(E.a,b),E.isMounted=!0,R=c=v=null}},A=E.effect=new en(B,()=>un(N),E.scope),N=E.update=()=>A.run();N.id=E.uid,vt(E,!0),N()},oe=(E,R,c)=>{R.component=E;const v=E.vnode.props;E.vnode=R,E.next=null,zo(E,R.props,v,c),Uo(E,R.children,c),Ft(),Ln(),At()},ie=(E,R,c,v,b,O,H,B,A=!1)=>{const N=E&&E.children,X=E?E.shapeFlag:0,G=R.children,{patchFlag:U,shapeFlag:J}=R;if(U>0){if(U&128){Q(N,G,c,v,b,O,H,B,A);return}else if(U&256){we(N,G,c,v,b,O,H,B,A);return}}J&8?(X&16&&Be(N,b,O),G!==N&&h(c,G)):X&16?J&16?Q(N,G,c,v,b,O,H,B,A):Be(N,b,O,!0):(X&8&&h(c,""),J&16&&j(G,c,v,b,O,H,B,A))},we=(E,R,c,v,b,O,H,B,A)=>{E=E||Ht,R=R||Ht;const N=E.length,X=R.length,G=Math.min(N,X);let U;for(U=0;UX?Be(E,b,O,!0,!1,G):j(R,c,v,b,O,H,B,A,G)},Q=(E,R,c,v,b,O,H,B,A)=>{let N=0;const X=R.length;let G=E.length-1,U=X-1;for(;N<=G&&N<=U;){const J=E[N],Y=R[N]=A?lt(R[N]):Je(R[N]);if(Bt(J,Y))P(J,Y,c,null,b,O,H,B,A);else break;N++}for(;N<=G&&N<=U;){const J=E[G],Y=R[U]=A?lt(R[U]):Je(R[U]);if(Bt(J,Y))P(J,Y,c,null,b,O,H,B,A);else break;G--,U--}if(N>G){if(N<=U){const J=U+1,Y=JU)for(;N<=G;)Ae(E[N],b,O,!0),N++;else{const J=N,Y=N,he=new Map;for(N=Y;N<=U;N++){const $=R[N]=A?lt(R[N]):Je(R[N]);$.key!=null&&he.set($.key,N)}let me,p=0;const f=U-Y+1;let y=!1,w=0;const z=new Array(f);for(N=0;N=f){Ae($,b,O,!0);continue}let pe;if($.key!=null)pe=he.get($.key);else for(me=Y;me<=U;me++)if(z[me-Y]===0&&Bt($,R[me])){pe=me;break}pe===void 0?Ae($,b,O,!0):(z[pe-Y]=N+1,pe>=w?w=pe:y=!0,P($,R[pe],c,null,b,O,H,B,A),p++)}const W=y?Go(z):Ht;for(me=W.length-1,N=f-1;N>=0;N--){const $=Y+N,pe=R[$],ne=$+1{const{el:O,type:H,transition:B,children:A,shapeFlag:N}=E;if(N&6){Ce(E.component.subTree,R,c,v);return}if(N&128){E.suspense.move(R,c,v);return}if(N&64){H.move(E,R,c,Ze);return}if(H===de){i(O,R,c);for(let G=0;GB.enter(O),b);else{const{leave:G,delayLeave:U,afterLeave:J}=B,Y=()=>i(O,R,c),he=()=>{G(O,()=>{Y(),J&&J()})};U?U(O,Y,he):he()}else i(O,R,c)},Ae=(E,R,c,v=!1,b=!1)=>{const{type:O,props:H,ref:B,children:A,dynamicChildren:N,shapeFlag:X,patchFlag:G,dirs:U}=E;if(B!=null&&Wi(B,null,c,E,!0),X&256){R.ctx.deactivate(E);return}const J=X&1&&U,Y=!ni(E);let he;if(Y&&(he=H&&H.onVnodeBeforeUnmount)&&Ke(he,R,E),X&6)Pt(E.component,c,v);else{if(X&128){E.suspense.unmount(c,v);return}J&&mt(E,null,R,"beforeUnmount"),X&64?E.type.remove(E,R,c,b,Ze,v):N&&(O!==de||G>0&&G&64)?Be(N,R,c,!1,!0):(O===de&&G&384||!b&&X&16)&&Be(A,R,c),v&&pt(E)}(Y&&(he=H&&H.onVnodeUnmounted)||J)&&Ie(()=>{he&&Ke(he,R,E),J&&mt(E,null,R,"unmounted")},c)},pt=E=>{const{type:R,el:c,anchor:v,transition:b}=E;if(R===de){st(c,v);return}if(R===Ri){S(E);return}const O=()=>{n(c),b&&!b.persisted&&b.afterLeave&&b.afterLeave()};if(E.shapeFlag&1&&b&&!b.persisted){const{leave:H,delayLeave:B}=b,A=()=>H(c,O);B?B(E.el,O,A):A()}else O()},st=(E,R)=>{let c;for(;E!==R;)c=m(E),n(E),E=c;n(R)},Pt=(E,R,c)=>{const{bum:v,scope:b,update:O,subTree:H,um:B}=E;v&&ii(v),b.stop(),O&&(O.active=!1,Ae(H,E,R,c)),B&&Ie(B,R),Ie(()=>{E.isUnmounted=!0},R),R&&R.pendingBranch&&!R.isUnmounted&&E.asyncDep&&!E.asyncResolved&&E.suspenseId===R.pendingId&&(R.deps--,R.deps===0&&R.resolve())},Be=(E,R,c,v=!1,b=!1,O=0)=>{for(let H=O;HE.shapeFlag&6?et(E.component.subTree):E.shapeFlag&128?E.suspense.next():m(E.anchor||E.el),gt=(E,R,c)=>{E==null?R._vnode&&Ae(R._vnode,null,null,!0):P(R._vnode||null,E,R,null,null,null,c),Ln(),Ss(),R._vnode=E},Ze={p:P,um:Ae,m:Ce,r:pt,mt:ce,mc:j,pc:ie,pbc:K,n:et,o:t};let rt,ot;return s&&([rt,ot]=s(Ze)),{render:gt,hydrate:rt,createApp:Ao(gt,rt)}}function vt({effect:t,update:s},e){t.allowRecurse=s.allowRecurse=e}function Gs(t,s,e=!1){const i=t.children,n=s.children;if(le(i)&&le(n))for(let r=0;r>1,t[e[a]]0&&(s[i]=e[r-1]),e[r]=i)}}for(r=e.length,l=e[r-1];r-- >0;)e[r]=l,l=s[l];return e}const qo=t=>t.__isTeleport,de=Symbol.for("v-fgt"),Ti=Symbol.for("v-txt"),bt=Symbol.for("v-cmt"),Ri=Symbol.for("v-stc"),Wt=[];let je=null;function L(t=!1){Wt.push(je=t?null:[])}function Zo(){Wt.pop(),je=Wt[Wt.length-1]||null}let Zt=1;function Un(t){Zt+=t}function qs(t){return t.dynamicChildren=Zt>0?je||Ht:null,Zo(),Zt>0&&je&&je.push(t),t}function D(t,s,e,i,n,r){return qs(F(t,s,e,i,n,r,!0))}function Me(t,s,e,i,n){return qs(te(t,s,e,i,n,!0))}function ji(t){return t?t.__v_isVNode===!0:!1}function Bt(t,s){return t.type===s.type&&t.key===s.key}const xi="__vInternal",Zs=({key:t})=>t??null,ri=({ref:t,ref_key:s,ref_for:e})=>(typeof t=="number"&&(t=""+t),t!=null?Se(t)||Fe(t)||ge(t)?{i:Ve,r:t,k:s,f:!!e}:t:null);function F(t,s=null,e=null,i=0,n=null,r=t===de?0:1,l=!1,a=!1){const o={__v_isVNode:!0,__v_skip:!0,type:t,props:s,key:s&&Zs(s),ref:s&&ri(s),scopeId:Hs,slotScopeIds:null,children:e,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetAnchor:null,staticCount:0,shapeFlag:r,patchFlag:i,dynamicProps:n,dynamicChildren:null,appContext:null,ctx:Ve};return a?(fn(o,e),r&128&&t.normalize(o)):e&&(o.shapeFlag|=Se(e)?8:16),Zt>0&&!l&&je&&(o.patchFlag>0||r&6)&&o.patchFlag!==32&&je.push(o),o}const te=Ko;function Ko(t,s=null,e=null,i=0,n=null,r=!1){if((!t||t===Ro)&&(t=bt),ji(t)){const a=Dt(t,s,!0);return e&&fn(a,e),Zt>0&&!r&&je&&(a.shapeFlag&6?je[je.indexOf(t)]=a:je.push(a)),a.patchFlag|=-2,a}if(ra(t)&&(t=t.__vccOpts),s){s=Xo(s);let{class:a,style:o}=s;a&&!Se(a)&&(s.class=xe(a)),be(o)&&(_s(o)&&!le(o)&&(o=Oe({},o)),s.style=Qi(o))}const l=Se(t)?1:ho(t)?128:qo(t)?64:be(t)?4:ge(t)?2:0;return F(t,s,e,i,n,l,r,!0)}function Xo(t){return t?_s(t)||xi in t?Oe({},t):t:null}function Dt(t,s,e=!1){const{props:i,ref:n,patchFlag:r,children:l}=t,a=s?Yo(i||{},s):i;return{__v_isVNode:!0,__v_skip:!0,type:t.type,props:a,key:a&&Zs(a),ref:s&&s.ref?e&&n?le(n)?n.concat(ri(s)):[n,ri(s)]:ri(s):n,scopeId:t.scopeId,slotScopeIds:t.slotScopeIds,children:l,target:t.target,targetAnchor:t.targetAnchor,staticCount:t.staticCount,shapeFlag:t.shapeFlag,patchFlag:s&&t.type!==de?r===-1?16:r|16:r,dynamicProps:t.dynamicProps,dynamicChildren:t.dynamicChildren,appContext:t.appContext,dirs:t.dirs,transition:t.transition,component:t.component,suspense:t.suspense,ssContent:t.ssContent&&Dt(t.ssContent),ssFallback:t.ssFallback&&Dt(t.ssFallback),el:t.el,anchor:t.anchor,ctx:t.ctx,ce:t.ce}}function Ee(t=" ",s=0){return te(Ti,null,t,s)}function se(t="",s=!1){return s?(L(),Me(bt,null,t)):te(bt,null,t)}function Je(t){return t==null||typeof t=="boolean"?te(bt):le(t)?te(de,null,t.slice()):typeof t=="object"?lt(t):te(Ti,null,String(t))}function lt(t){return t.el===null&&t.patchFlag!==-1||t.memo?t:Dt(t)}function fn(t,s){let e=0;const{shapeFlag:i}=t;if(s==null)s=null;else if(le(s))e=16;else if(typeof s=="object")if(i&65){const n=s.default;n&&(n._c&&(n._d=!1),fn(t,n()),n._c&&(n._d=!0));return}else{e=32;const n=s._;!n&&!(xi in s)?s._ctx=Ve:n===3&&Ve&&(Ve.slots._===1?s._=1:(s._=2,t.patchFlag|=1024))}else ge(s)?(s={default:s,_ctx:Ve},e=32):(s=String(s),i&64?(e=16,s=[Ee(s)]):e=8);t.children=s,t.shapeFlag|=e}function Yo(...t){const s={};for(let e=0;eHe=t),pn=t=>{Ct.length>1?Ct.forEach(s=>s(t)):Ct[0](t)};const kt=t=>{pn(t),t.scope.on()},xt=()=>{He&&He.scope.off(),pn(null)};function Ks(t){return t.vnode.shapeFlag&4}let Kt=!1;function ea(t,s=!1){Kt=s;const{props:e,children:i}=t.vnode,n=Ks(t);Io(t,e,n,s),Vo(t,i);const r=n?ta(t,s):void 0;return Kt=!1,r}function ta(t,s){const e=t.type;t.accessCache=Object.create(null),t.proxy=Ts(new Proxy(t.ctx,Ho));const{setup:i}=e;if(i){const n=t.setupContext=i.length>1?na(t):null;kt(t),Ft();const r=dt(i,t,0,[t.props,n]);if(At(),xt(),ss(r)){if(r.then(xt,xt),s)return r.then(l=>{jn(t,l,s)}).catch(l=>{yi(l,t,0)});t.asyncDep=r}else jn(t,r,s)}else Xs(t,s)}function jn(t,s,e){ge(s)?t.type.__ssrInlineRender?t.ssrRender=s:t.render=s:be(s)&&(t.setupState=xs(s)),Xs(t,e)}let Gn;function Xs(t,s,e){const i=t.type;if(!t.render){if(!s&&Gn&&!i.render){const n=i.template||hn(t).template;if(n){const{isCustomElement:r,compilerOptions:l}=t.appContext.config,{delimiters:a,compilerOptions:o}=i,u=Oe(Oe({isCustomElement:r,delimiters:a},l),o);i.render=Gn(n,u)}}t.render=i.render||Ge}kt(t),Ft(),Oo(t),At(),xt()}function ia(t){return t.attrsProxy||(t.attrsProxy=new Proxy(t.attrs,{get(s,e){return ze(t,"get","$attrs"),s[e]}}))}function na(t){const s=e=>{t.exposed=e||{}};return{get attrs(){return ia(t)},slots:t.slots,emit:t.emit,expose:s}}function bi(t){if(t.exposed)return t.exposeProxy||(t.exposeProxy=new Proxy(xs(Ts(t.exposed)),{get(s,e){if(e in s)return s[e];if(e in Ut)return Ut[e](t)},has(s,e){return e in s||e in Ut}}))}function sa(t,s=!0){return ge(t)?t.displayName||t.name:t.name||s&&t.__name}function ra(t){return ge(t)&&"__vccOpts"in t}const Xe=(t,s)=>$r(t,s,Kt);function oa(t,s,e){const i=arguments.length;return i===2?be(s)&&!le(s)?ji(s)?te(t,null,[s]):te(t,s):te(t,null,s):(i>3?e=Array.prototype.slice.call(arguments,2):i===3&&ji(e)&&(e=[e]),te(t,s,e))}const aa=Symbol.for("v-scx"),la=()=>si(aa),ua="3.3.4",ca="http://www.w3.org/2000/svg",wt=typeof document<"u"?document:null,qn=wt&&wt.createElement("template"),ha={insert:(t,s,e)=>{s.insertBefore(t,e||null)},remove:t=>{const s=t.parentNode;s&&s.removeChild(t)},createElement:(t,s,e,i)=>{const n=s?wt.createElementNS(ca,t):wt.createElement(t,e?{is:e}:void 0);return t==="select"&&i&&i.multiple!=null&&n.setAttribute("multiple",i.multiple),n},createText:t=>wt.createTextNode(t),createComment:t=>wt.createComment(t),setText:(t,s)=>{t.nodeValue=s},setElementText:(t,s)=>{t.textContent=s},parentNode:t=>t.parentNode,nextSibling:t=>t.nextSibling,querySelector:t=>wt.querySelector(t),setScopeId(t,s){t.setAttribute(s,"")},insertStaticContent(t,s,e,i,n,r){const l=e?e.previousSibling:s.lastChild;if(n&&(n===r||n.nextSibling))for(;s.insertBefore(n.cloneNode(!0),e),!(n===r||!(n=n.nextSibling)););else{qn.innerHTML=i?`${t}`:t;const a=qn.content;if(i){const o=a.firstChild;for(;o.firstChild;)a.appendChild(o.firstChild);a.removeChild(o)}s.insertBefore(a,e)}return[l?l.nextSibling:s.firstChild,e?e.previousSibling:s.lastChild]}};function da(t,s,e){const i=t._vtc;i&&(s=(s?[s,...i]:[...i]).join(" ")),s==null?t.removeAttribute("class"):e?t.setAttribute("class",s):t.className=s}function fa(t,s,e){const i=t.style,n=Se(e);if(e&&!n){if(s&&!Se(s))for(const r in s)e[r]==null&&Gi(i,r,"");for(const r in e)Gi(i,r,e[r])}else{const r=i.display;n?s!==e&&(i.cssText=e):s&&t.removeAttribute("style"),"_vod"in t&&(i.display=r)}}const Zn=/\s*!important$/;function Gi(t,s,e){if(le(e))e.forEach(i=>Gi(t,s,i));else if(e==null&&(e=""),s.startsWith("--"))t.setProperty(s,e);else{const i=pa(t,s);Zn.test(e)?t.setProperty(Et(i),e.replace(Zn,""),"important"):t[i]=e}}const Kn=["Webkit","Moz","ms"],Hi={};function pa(t,s){const e=Hi[s];if(e)return e;let i=$e(s);if(i!=="filter"&&i in t)return Hi[s]=i;i=gi(i);for(let n=0;nOi||(_a.then(()=>Oi=0),Oi=Date.now());function xa(t,s){const e=i=>{if(!i._vts)i._vts=Date.now();else if(i._vts<=e.attached)return;qe(ba(i,e.value),s,5,[i])};return e.value=t,e.attached=Ta(),e}function ba(t,s){if(le(s)){const e=t.stopImmediatePropagation;return t.stopImmediatePropagation=()=>{e.call(t),t._stopped=!0},s.map(i=>n=>!n._stopped&&i&&i(n))}else return s}const Jn=/^on[a-z]/,Ea=(t,s,e,i,n=!1,r,l,a,o)=>{s==="class"?da(t,i,n):s==="style"?fa(t,e,i):di(s)?Ki(s)||ya(t,s,e,i,l):(s[0]==="."?(s=s.slice(1),!0):s[0]==="^"?(s=s.slice(1),!1):Pa(t,s,i,n))?ma(t,s,i,r,l,a,o):(s==="true-value"?t._trueValue=i:s==="false-value"&&(t._falseValue=i),ga(t,s,i,n))};function Pa(t,s,e,i){return i?!!(s==="innerHTML"||s==="textContent"||s in t&&Jn.test(s)&&ge(e)):s==="spellcheck"||s==="draggable"||s==="translate"||s==="form"||s==="list"&&t.tagName==="INPUT"||s==="type"&&t.tagName==="TEXTAREA"||Jn.test(s)&&Se(e)?!1:s in t}const Qn=t=>{const s=t.props["onUpdate:modelValue"]||!1;return le(s)?e=>ii(s,e):s};function Sa(t){t.target.composing=!0}function $n(t){const s=t.target;s.composing&&(s.composing=!1,s.dispatchEvent(new Event("input")))}const Ys={created(t,{modifiers:{lazy:s,trim:e,number:i}},n){t._assign=Qn(n);const r=i||n.props&&n.props.type==="number";Rt(t,s?"change":"input",l=>{if(l.target.composing)return;let a=t.value;e&&(a=a.trim()),r&&(a=Li(a)),t._assign(a)}),e&&Rt(t,"change",()=>{t.value=t.value.trim()}),s||(Rt(t,"compositionstart",Sa),Rt(t,"compositionend",$n),Rt(t,"change",$n))},mounted(t,{value:s}){t.value=s??""},beforeUpdate(t,{value:s,modifiers:{lazy:e,trim:i,number:n}},r){if(t._assign=Qn(r),t.composing||document.activeElement===t&&t.type!=="range"&&(e||i&&t.value.trim()===s||(n||t.type==="number")&&Li(t.value)===s))return;const l=s??"";t.value!==l&&(t.value=l)}},Ca=["ctrl","shift","alt","meta"],Ra={stop:t=>t.stopPropagation(),prevent:t=>t.preventDefault(),self:t=>t.target!==t.currentTarget,ctrl:t=>!t.ctrlKey,shift:t=>!t.shiftKey,alt:t=>!t.altKey,meta:t=>!t.metaKey,left:t=>"button"in t&&t.button!==0,middle:t=>"button"in t&&t.button!==1,right:t=>"button"in t&&t.button!==2,exact:(t,s)=>Ca.some(e=>t[`${e}Key`]&&!s.includes(e))},ct=(t,s)=>(e,...i)=>{for(let n=0;ne=>{if(!("key"in e))return;const i=Et(e.key);if(s.some(n=>n===i||Ha[n]===i))return t(e)},Ye={beforeMount(t,{value:s},{transition:e}){t._vod=t.style.display==="none"?"":t.style.display,e&&s?e.beforeEnter(t):It(t,s)},mounted(t,{value:s},{transition:e}){e&&s&&e.enter(t)},updated(t,{value:s,oldValue:e},{transition:i}){!s!=!e&&(i?s?(i.beforeEnter(t),It(t,!0),i.enter(t)):i.leave(t,()=>{It(t,!1)}):It(t,s))},beforeUnmount(t,{value:s}){It(t,s)}};function It(t,s){t.style.display=s?t._vod:"none"}const Oa=Oe({patchProp:Ea},ha);let es;function La(){return es||(es=Wo(Oa))}const Ma=(...t)=>{const s=La().createApp(...t),{mount:e}=s;return s.mount=i=>{const n=Da(i);if(!n)return;const r=s._component;!ge(r)&&!r.render&&!r.template&&(r.template=n.innerHTML),n.innerHTML="";const l=e(n,!1,n instanceof SVGElement);return n instanceof Element&&(n.removeAttribute("v-cloak"),n.setAttribute("data-v-app","")),l},s};function Da(t){return Se(t)?document.querySelector(t):t}const ue=(t,s)=>{const e=t.__vccOpts||t;for(const[i,n]of s)e[i]=n;return e},ka={},Fa={class:"tify-icon",viewBox:"0 0 24 24"},Aa=F("path",{d:"M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z"},null,-1),Ba=[Aa];function Ia(t,s){return L(),D("svg",Fa,Ba)}const Js=ue(ka,[["render",Ia]]),za={computed:{copyrightHtml(){return'Copyright © 2017–2022 Göttingen University / Göttingen State and University Library'},env(){return{version:"0.29.1",license:"AGPL-3.0",bugsUrl:"https://github.com/tify-iiif-viewer/tify/issues",contributorsUrl:"https://github.com/tify-iiif-viewer/tify/blob/v0.29.1/CONTRIBUTORS.md",docsUrl:"https://github.com/tify-iiif-viewer/tify/blob/v0.29.1/doc",docsLanguages:["de","en"],repositoryUrl:"https://github.com/tify-iiif-viewer/tify"}},infoHtml(){return'TIFY is a slim and mobile-friendly IIIF document viewer, released under the GNU Affero General Public License 3.0.'},userGuideUrl(){const t=this.env.docsLanguages.includes(this.$store.options.language)?this.$store.options.language:"en";return`${this.env.docsUrl}/user-guide.${t}.md`}}},Na={class:"tify-help",tabindex:"0"},Va={class:"tify-sr-only"},Ua=["innerHTML"],Wa=["href"],ja=["href"],Ga=["href"],qa=["href"],Za={class:"tify-help-footer"},Ka=["innerHTML"];function Xa(t,s,e,i,n,r){return L(),D("section",Na,[F("h2",Va,Z(t.$translate("Help")),1),F("h3",null,Z(t.$translate("About TIFY")),1),F("p",{innerHTML:t.$translate("$info",r.infoHtml)},null,8,Ua),F("ul",null,[F("li",null,[F("a",{href:r.userGuideUrl},Z(t.$translate("User guide")),9,Wa)]),F("li",null,[F("a",{href:r.env.repositoryUrl},Z(t.$translate("Source code")),9,ja)]),F("li",null,[F("a",{href:r.env.contributorsUrl},Z(t.$translate("Contributors")),9,Ga)]),F("li",null,[F("a",{href:r.env.bugsUrl},Z(t.$translate("Report a bug")),9,qa)])]),F("footer",Za,[F("p",null,[Ee(Z(t.$translate("Version"))+" ",1),F("b",null,Z(r.env.version),1),Ee(" · "),F("span",{innerHTML:t.$translate("$copyright",r.copyrightHtml)},null,8,Ka)])])])}const Ya=ue(za,[["render",Xa]]),Ja={},Qa={class:"tify-icon",viewBox:"0 0 24 24"},$a=F("path",{d:"M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z"},null,-1),el=[$a];function tl(t,s){return L(),D("svg",Qa,el)}const Qs=ue(Ja,[["render",tl]]),il={},nl={class:"tify-icon",viewBox:"0 0 24 24"},sl=F("path",{d:"M19,13H5V11H19V13Z"},null,-1),rl=[sl];function ol(t,s){return L(),D("svg",nl,rl)}const $s=ue(il,[["render",ol]]),al={name:"CollectionNode",props:{item:{type:Object,default:()=>{}}},data(){return{children:null,expanded:!1,id:this.$store.getId(`collection-node-${Math.floor(Math.random()*1e12)}`)}},computed:{label(){const t=String.fromCharCode(160);return this.item.label?this.$store.convertValueToArray(this.item.label).join(`${t}· `):"—"}},methods:{toggleChildren(){if(this.expanded){this.expanded=!1;return}if(this.children){this.expanded=!0;return}if(this.item.children){this.children=this.item.children,this.expanded=!0;return}this.$store.fetchJson(this.item["@id"]).then(t=>{this.children=t.manifests||t.collections||[],this.expanded=!0},t=>{const s=t.response&&(t.response.statusText||t.response.data)||t.message;this.$store.addError(`Error loading IIIF manifest: ${s}`),this.children=!1})}}},ll=["aria-controls","aria-expanded"],ul={class:"tify-sr-only"},cl={class:"tify-sr-only"},hl=["id"],dl={key:1,class:"tify-collection-error"};function fl(t,s,e,i,n,r){const l=$s,a=Qs,o=As("collection-node",!0);return L(),D("li",{class:xe(["tify-collection-item",{"-current":t.$store.manifest&&t.$store.manifest["@id"]===e.item["@id"]}])},[e.item["@type"]==="sc:Collection"?(L(),D("button",{key:0,type:"button","aria-controls":n.id,"aria-expanded":n.expanded?"true":"false",class:"tify-collection-link -has-children",onClick:s[0]||(s[0]=u=>r.toggleChildren())},[n.expanded?(L(),D(de,{key:0},[te(l),F("span",ul,Z(t.$translate("Collapse")),1)],64)):(L(),D(de,{key:1},[te(a),F("span",cl,Z(t.$translate("Expand")),1)],64)),Ee(" "+Z(r.label),1)],8,ll)):(L(),D("a",{key:1,href:"javascript:;",class:"tify-collection-link",onClick:s[1]||(s[1]=u=>t.$store.loadManifest(e.item["@id"],{expectedType:e.item["@type"],reset:!0}))},Z(r.label),1)),n.expanded?(L(),D(de,{key:2},[n.expanded?(L(),D("ol",{key:0,id:n.id,class:"tify-collection-list"},[(L(!0),D(de,null,Pe(n.children,u=>(L(),Me(o,{key:u["@id"],item:u},null,8,["item"]))),128))],8,hl)):n.children===!1?(L(),D("p",dl,Z(t.$translate("Could not load child manifest")),1)):se("",!0)],64)):se("",!0)],2)}const pl=ue(al,[["render",fl]]),gl={data(){return{filter:""}},computed:{filteredItems(){const t=this.filter.trim().toLowerCase().split(/\s+/);return this.items.filter(s=>{const e=(s.label||"").toLowerCase();return t.every(i=>e.includes(i))})},items(){return this.$store.collection.manifests&&this.$store.collection.collections?[{"@id":"tify-collection-manifests","@type":"sc:Collection",label:this.$translate("Documents"),children:this.$store.collection.manifests},{"@id":"tify-collection-collections","@type":"sc:Collection",label:this.$translate("Collections"),children:this.$store.collection.collections}]:this.$store.collection.manifests||this.$store.collection.collections}}},ml={class:"tify-collection",tabindex:"0"},vl={class:"tify-sr-only"},yl={key:0,class:"tify-collection-controls"},wl=["aria-label","placeholder"],_l=["disabled"],Tl={key:1,class:"tify-collection-list"},xl={key:2,class:"tify-collection-no-results"};function bl(t,s,e,i,n,r){const l=pl;return L(),D("section",ml,[F("h2",vl,Z(t.$translate("Collection")),1),r.items.length>5?(L(),D("p",yl,[ke(F("input",{"onUpdate:modelValue":s[0]||(s[0]=a=>n.filter=a),"aria-label":t.$translate("Filter collection"),class:"tify-collection-filter",placeholder:t.$translate("Filter collection"),type:"text",onKeydown:[s[1]||(s[1]=Vt(ct(a=>n.filter?n.filter="":a.target.blur(),["prevent"]),["esc"])),s[2]||(s[2]=ct(()=>{},["stop"]))]},null,40,wl),[[Ys,n.filter]]),F("button",{type:"button",class:"tify-collection-reset",disabled:!n.filter,onClick:s[3]||(s[3]=a=>n.filter="")},Z(t.$translate("Reset")),9,_l)])):se("",!0),r.filteredItems.length?(L(),D("ol",Tl,[(L(!0),D(de,null,Pe(r.filteredItems,a=>(L(),Me(l,{key:a["@id"],item:a},null,8,["item"]))),128))])):(L(),D("p",xl,Z(t.$translate("No results")),1))])}const El=ue(gl,[["render",bl]]),Pl={},Sl={class:"tify-icon",viewBox:"0 0 24 24"},Cl=F("path",{d:"M7.41,15.41L12,10.83L16.59,15.41L18,14L12,8L6,14L7.41,15.41Z"},null,-1),Rl=[Cl];function Hl(t,s){return L(),D("svg",Sl,Rl)}const Ol=ue(Pl,[["render",Hl]]),Ll={},Ml={class:"tify-icon",viewBox:"0 0 24 24"},Dl=F("path",{d:"M7.41,8.58L12,13.17L16.59,8.58L18,10L12,16L6,10L7.41,8.58Z"},null,-1),kl=[Dl];function Fl(t,s){return L(),D("svg",Ml,kl)}const Al=ue(Ll,[["render",Fl]]);function ts(t,s){if(!Array.isArray(t)||new Set(t).size!==t.length)return!1;for(let e=0,i=t.length;e0&&t[e]>0&&t[e]<=t[e-1]||t[e]<0||t[e]>s)return!1;return!0}function gn(t,s=["https:","http:"]){let e;try{e=new URL(t)}catch{return!1}return s.includes(e.protocol)}const Bl={props:{metadata:{type:Array,default:()=>[]}},data(){return{infoItems:[]}},watch:{metadata(){this.updateInfoItems()}},mounted(){this.updateInfoItems()},methods:{cleanLabel(t){const s=t.replace("_"," ");return s.charAt(0).toUpperCase()+s.substr(1)},updateInfoItems(){this.$nextTick(()=>{this.$refs.contents&&this.$refs.contents.forEach((t,s)=>{const e=t.offsetHeight;this.infoItems[s]={collapsed:!0,exceedsHeight:!0},this.$nextTick(()=>{const i=t.offsetHeight,n=e>=i;this.infoItems[s]={collapsed:n,exceedsHeight:n}})})})},isValidUrl:gn}},Il={class:"tify-info-metadata"},zl={class:"tify-info-value"},Nl=["href"],Vl=["innerHTML"],Ul=["onClick"];function Wl(t,s,e,i,n,r){const l=Al,a=Ol;return L(),D("div",Il,[(L(!0),D(de,null,Pe(e.metadata,(o,u)=>(L(),D("div",{key:u},[F("h4",null,[(L(!0),D(de,null,Pe(t.$store.convertValueToArray(o.label),(h,g)=>(L(),D("div",{key:g},Z(r.cleanLabel(h)),1))),128))]),F("div",{ref_for:!0,ref:"contents",class:xe(["tify-info-content",{"-collapsed":n.infoItems[u]&&n.infoItems[u].collapsed}])},[F("div",zl,[(L(!0),D(de,null,Pe(t.$store.convertValueToArray(o.value),h=>(L(),D(de,null,[r.isValidUrl(h)?(L(),D("div",{key:"url-"+h},[F("a",{href:h},Z(h),9,Nl)])):(L(),D("div",{key:"html-"+h,innerHTML:h},null,8,Vl))],64))),256))]),n.infoItems[u]&&n.infoItems[u].exceedsHeight?(L(),D("button",{key:0,type:"button",class:"tify-info-toggle",onClick:h=>n.infoItems[u].collapsed=!n.infoItems[u].collapsed},[n.infoItems[u].collapsed?(L(),D(de,{key:0},[te(l),Ee(" "+Z(t.$translate("Expand")),1)],64)):(L(),D(de,{key:1},[te(a),Ee(" "+Z(t.$translate("Collapse")),1)],64))],8,Ul)):se("",!0)],2)]))),128))])}const jl=ue(Bl,[["render",Wl]]),Gl={data(){return{collectionDataShown:!1}},computed:{license(){return this.manifestOrCollection.license?this.$store.convertValueToArray(this.manifestOrCollection.license):[]},logoId(){return this.manifestOrCollection.logo["@id"]||this.manifestOrCollection.logo},manifestOrCollection(){return this.collectionDataShown?this.$store.collection:this.$store.manifest||this.$store.collection||{}},related(){return this.manifestOrCollection.related?this.$store.convertValueToArray(this.manifestOrCollection.related):[]}},methods:{isValidUrl:gn}},ql={class:"tify-info",tabindex:"0"},Zl={class:"tify-sr-only"},Kl={key:0,class:"tify-info-header"},Xl={key:1,class:"tify-info-section -title"},Yl={class:"tify-info-heading"},Jl={key:2,class:"tify-info-section -metadata"},Ql={key:3,class:"tify-info-section -metadata -structure"},$l={key:0,class:"tify-info-structure"},eu={key:4,class:"tify-info-section -description"},tu=["innerHTML"],iu={key:5,class:"tify-info-section -license"},nu=["href"],su=["href"],ru={key:6,class:"tify-info-section -related"},ou=["href"],au=["href"],lu={key:7,class:"tify-info-section -attribution"},uu=["innerHTML"],cu={key:8,class:"tify-info-section -logo"},hu=["href"],du=["src","alt"],fu=["src","alt"];function pu(t,s,e,i,n,r){const l=jl;return L(),D("section",ql,[F("h2",Zl,Z(t.$translate("Info")),1),t.$store.collection&&t.$store.manifest?(L(),D("div",Kl,[F("button",{type:"button",class:xe(["tify-info-button",{"-active":!n.collectionDataShown}]),onClick:s[0]||(s[0]=a=>n.collectionDataShown=!1)},Z(t.$translate("Document")),3),F("button",{type:"button",class:xe(["tify-info-button",{"-active":n.collectionDataShown}]),onClick:s[1]||(s[1]=a=>n.collectionDataShown=!0)},Z(t.$translate("Collection")),3)])):se("",!0),r.manifestOrCollection.label?(L(),D("div",Xl,[F("h3",Yl,Z(t.$translate("Title")),1),(L(!0),D(de,null,Pe(t.$store.convertValueToArray(r.manifestOrCollection.label),a=>(L(),D("div",{key:a},Z(a),1))),128))])):se("",!0),r.manifestOrCollection.metadata&&r.manifestOrCollection.metadata.length?(L(),D("div",Jl,[F("h3",null,Z(t.$translate("Metadata")),1),t.$store.options.view==="info"?(L(),Me(l,{key:0,metadata:r.manifestOrCollection.metadata},null,8,["metadata"])):se("",!0)])):se("",!0),r.manifestOrCollection.structures&&(t.$store.currentStructure.label||t.$store.currentStructure.metadata)?(L(),D("div",Ql,[F("h3",null,Z(t.$translate("Current Element")),1),t.$store.currentStructure.label?(L(),D("p",$l,Z(t.$store.currentStructure.label),1)):se("",!0),t.$store.options.view==="info"&&t.$store.currentStructure.metadata?(L(),Me(l,{key:1,class:"tify-info-section -metadata",metadata:t.$store.currentStructure.metadata},null,8,["metadata"])):se("",!0)])):se("",!0),r.manifestOrCollection.description?(L(),D("div",eu,[F("h3",null,Z(t.$translate("Description")),1),(L(!0),D(de,null,Pe(t.$store.convertValueToArray(r.manifestOrCollection.description),(a,o)=>(L(),D("div",{key:o,innerHTML:a},null,8,tu))),128))])):se("",!0),r.license.length?(L(),D("div",iu,[F("h3",null,Z(t.$translate("License")),1),(L(!0),D(de,null,Pe(r.license,(a,o)=>(L(),D("div",{key:o},[typeof a=="string"?(L(),D(de,{key:0},[r.isValidUrl(a)?(L(),D("a",{key:0,href:a},Z(a),9,nu)):(L(),D(de,{key:1},[Ee(Z(a),1)],64))],64)):(L(),D(de,{key:1},[r.isValidUrl(a["@id"])?(L(),D("a",{key:0,href:a["@id"]},Z(a.label||a["@id"]),9,su)):(L(),D(de,{key:1},[Ee(Z(a.label||a["@id"]),1)],64))],64))]))),128))])):se("",!0),r.related.length?(L(),D("div",ru,[F("h3",null,Z(t.$translate("Related Resources")),1),(L(!0),D(de,null,Pe(r.related,(a,o)=>(L(),D("div",{key:o},[typeof a=="string"?(L(),D("a",{key:0,href:a},Z(a),9,ou)):(L(),D("a",{key:1,href:a["@id"]},Z(a.label||a["@id"]),9,au))]))),128))])):se("",!0),r.manifestOrCollection.attribution?(L(),D("div",lu,[F("h3",null,Z(t.$translate("Provided by")),1),(L(!0),D(de,null,Pe(t.$store.convertValueToArray(r.manifestOrCollection.attribution),(a,o)=>(L(),D("div",{key:o,innerHTML:a},null,8,uu))),128))])):se("",!0),r.manifestOrCollection.logo?(L(),D("div",cu,[r.logoId&&r.manifestOrCollection.logo.service&&r.manifestOrCollection.logo.service["@id"]?(L(),D("a",{key:0,href:r.manifestOrCollection.logo.service["@id"]},[F("img",{class:"tify-info-logo",src:r.logoId,alt:t.$translate("Logo")},null,8,du)],8,hu)):(L(),D("img",{key:1,class:"tify-info-logo",src:r.logoId,alt:t.$translate("Logo")},null,8,fu))])):se("",!0)])}const gu=ue(Gl,[["render",pu]]),mu={name:"TocList",props:{level:{type:Number,default:0},structures:{type:Array,default:()=>[]},parentStructure:{type:Object,default:()=>{}},purpose:{type:String,default:""}},data(){return{expandedStructures:[],id:this.$store.getId(`toc-list-${Math.floor(Math.random()*1e12)}`)}},methods:{isCurrentPageInStructure(t){const{pages:s}=this.$store.options;return s.some(e=>e>=t.firstPage&&e<=t.lastPage)},setPage(t){this.$store.setPage(t),this.$store.isMobile()&&this.$store.updateOptions({view:"scan"})},toggleAllChildren(t=null){if(this.$refs.children){for(let s=this.structures.length-1;s>=0;s-=1)this.toggleChildren(s,t);this.$refs.children.forEach(s=>{s.toggleAllChildren(t)})}},toggleChildren(t,s=null){this.structures[t].childStructures&&(this.expandedStructures[t]=s!==null?s:!this.expandedStructures[t])}}},vu={class:"tify-toc-list"},yu=["data-level"],wu=["title","aria-controls","aria-expanded","onClick"],_u=["href"],Tu=["onClick"],xu={class:"tify-toc-label"},bu={class:"tify-toc-page"};function Eu(t,s,e,i,n,r){const l=$s,a=Qs,o=As("toc-list",!0);return L(),D("ul",vu,[(L(!0),D(de,null,Pe(e.structures,(u,h)=>(L(),D("li",{key:h,class:xe(["tify-toc-structure",{"-current":r.isCurrentPageInStructure(u),"-expanded":n.expandedStructures[h]}]),"data-level":e.level},[u.childStructures?(L(),D("button",{key:0,type:"button",class:"tify-toc-toggle",title:t.$translate(n.expandedStructures[h]?"Collapse":"Expand"),"aria-controls":`${n.id}-${h}`,"aria-expanded":n.expandedStructures[h]?"true":"false",onClick:g=>r.toggleChildren(h)},[n.expandedStructures[h]?(L(),Me(l,{key:0})):(L(),Me(a,{key:1}))],8,wu)):se("",!0),e.purpose==="pdf"?(L(),D("a",{key:1,class:"tify-toc-link",download:"",href:t.$store.convertValueToArray(u.rendering)[0]["@id"]},Z(u.label)+" ("+Z(u.pageCount)+" "+Z(t.$translate(u.pageCount===1?"page":"pages"))+") ",9,_u)):(L(),D("a",{key:2,class:"tify-toc-link -dots",href:"javascript:;",onClick:g=>t.$store.setPage(u.firstPage)},[F("span",xu,Z(u.label),1),F("span",bu,Z(u.pageLabel),1)],8,Tu)),u.childStructures?ke((L(),Me(o,{key:3,id:`${n.id}-${h}`,ref_for:!0,ref:"children",level:e.level+1,"parent-structure":u,purpose:e.purpose,structures:u.childStructures},null,8,["id","level","parent-structure","purpose","structures"])),[[Ye,n.expandedStructures[h]]]):se("",!0)],10,yu))),128))])}const er=ue(mu,[["render",Eu]]),Pu=[{label:"BibTex",profile:"http://www.bibtex.org/Format/",type:"literature"},{label:"EndNote",profile:"http://endnote.com/",type:"literature"},{label:"RIS",profile:"http://referencemanager.com/sites/rm/files/m/direct_export_ris.pdf",type:"literature"},{label:"METS",profile:"http://www.loc.gov/standards/mets/profile_docs/mets.profile.v2-0.xsd",type:"other"},{label:"MODS",format:"application/mods+xml",type:"other"}],Su={data(){return{literatureItems:[],otherItems:[],perElementPdfLinksVisible:!1}},computed:{hasElementPdfLinks(){return!Array.isArray(this.$store.manifest.structures)||!this.$store.manifest.structures[0]||!this.$store.manifest.structures[0].rendering?!1:this.$store.convertValueToArray(this.$store.manifest.structures[0].rendering).some(s=>s.format&&s.format==="application/pdf")},imageUrls(){const t={};return this.$store.options.pages.forEach(s=>{if(!s)return;const{resource:e}=this.$store.canvases[s-1].images[0];if(e.service){const i=e.service["@context"]==="http://iiif.io/api/image/2/context.json"?"default":"native",n=e.service["@id"];t[s]=`${n}${n.slice(-1)==="/"?"":"/"}full/full/0/${i}.jpg`}else t[s]=e["@id"]}),t},pages(){return this.$store.options.pages.filter(t=>t>0)},renderings(){return this.$store.convertValueToArray(this.$store.manifest.rendering)}},created(){const{seeAlso:t}=this.$store.manifest;if(!t)return;JSON.parse(JSON.stringify(Array.isArray(t)?t:[t])).forEach(e=>{const i=typeof e=="object"?e:{"@id":e};let n=!1;Pu.some(r=>{const l=e.format&&r.format===e.format,a=e.profile&&r.profile===e.profile;return l||a?(i.label=r.label,r.type==="literature"&&(n=!0),!0):!1}),n?this.literatureItems.push(i):this.otherItems.push(i)})}},Cu={class:"tify-export",tabindex:"0"},Ru={class:"tify-sr-only"},Hu={class:"tify-export-section -links"},Ou=["href","download"],Lu={key:0,class:"tify-export-section -renderings"},Mu=["href"],Du={key:0,class:"tify-export-container"},ku=["aria-controls","aria-expanded"],Fu={class:"tify-sr-only"},Au=["id"],Bu={key:1,class:"tify-export-section -literature"},Iu=["href"],zu={class:"tify-export-section -other"},Nu={key:0},Vu=["href"],Uu=["href"],Wu=["href"];function ju(t,s,e,i,n,r){const l=Js,a=er;return L(),D("section",Cu,[F("h2",Ru,Z(t.$translate("Export")),1),F("div",Hu,[F("h3",null,Z(t.$translate("Download Individual Images")),1),F("ul",null,[(L(!0),D(de,null,Pe(r.pages,o=>(L(),D("li",{key:o},[F("a",{href:r.imageUrls[o],download:`${o}.jpg`},Z(t.$translate("Page"))+" "+Z(t.$store.getPageLabel(o,t.$store.convertValueToArray(t.$store.canvases[o-1].label)[0])),9,Ou)]))),128))])]),t.$store.manifest.rendering?(L(),D("div",Lu,[F("h3",null,Z(t.$translate("Renderings")),1),F("ul",null,[(L(!0),D(de,null,Pe(r.renderings,o=>(L(),D("li",{key:o["@id"]},[F("a",{href:o["@id"]},Z(o.label),9,Mu)]))),128))]),r.hasElementPdfLinks?(L(),D("div",Du,[F("button",{type:"button",class:xe(["tify-export-toggle",{"-close":n.perElementPdfLinksVisible}]),"aria-controls":t.$store.getId("export-pdf-list"),"aria-expanded":n.perElementPdfLinksVisible?"true":"false",onClick:s[0]||(s[0]=o=>n.perElementPdfLinksVisible=!n.perElementPdfLinksVisible)},[n.perElementPdfLinksVisible?(L(),D(de,{key:1},[te(l),F("span",Fu,Z(t.$translate("Close PDF list")),1)],64)):(L(),D(de,{key:0},[Ee(Z(t.$translate("PDFs for each element")),1)],64))],10,ku),n.perElementPdfLinksVisible?(L(),D("div",{key:0,id:t.$store.getId("export-pdf-list"),class:"tify-export-toc"},[F("h4",null,Z(t.$translate("PDFs for each element")),1),te(a,{ref:"children",purpose:"pdf",level:0,structures:t.$store.structures},null,8,["structures"])],8,Au)):se("",!0)])):se("",!0)])):se("",!0),n.literatureItems.length?(L(),D("div",Bu,[F("h3",null,Z(t.$translate("Literature Management")),1),F("ul",null,[(L(!0),D(de,null,Pe(n.literatureItems,o=>(L(),D("li",{key:o["@id"]},[F("a",{href:o["@id"],download:""},Z(o.label),9,Iu)]))),128))])])):se("",!0),F("div",zu,[F("h3",null,Z(t.$translate("Other Formats")),1),F("ul",null,[t.$store.options.childManifestUrl?(L(),D("li",Nu,[F("a",{href:t.$store.options.childManifestUrl,download:"manifest.json"},Z(t.$translate("IIIF manifest (current document)")),9,Vu)])):se("",!0),F("li",null,[F("a",{href:t.$store.options.manifestUrl,download:"manifest.json"},Z(t.$translate(t.$store.collection?"IIIF manifest (collection)":"IIIF manifest")),9,Uu)]),(L(!0),D(de,null,Pe(n.otherItems,o=>(L(),D("li",{key:o["@id"]},[F("a",{href:o["@id"],download:""},Z(o.label||o["@id"]),9,Wu)]))),128))])])])}const Gu=ue(Su,[["render",ju]]);function hi(t,s,e=120){const i=t,n=e===!0?120:e;if(!n||n<0){i.scrollTop=s;return}const l=(s-t.scrollTop)/n/.1;setTimeout(()=>{i.scrollTop+=l,i.scrollTop!==s&&hi(i,s,n-10)},10)}function qi(t,s,e=!0){const i=s.querySelectorAll(t);if(!i.length)return;let n=i[0];const r=i[i.length-1];Array.prototype.forEach.call(i,u=>{u.dataset.level>n.dataset.level&&(n=u)});const l=s.getBoundingClientRect(),a=n.getBoundingClientRect(),o=r.getBoundingClientRect();if(a.topl.bottom){const u=o.bottom-l.bottom+s.scrollTop;hi(s,u+50,e)}}const is=".tify-toc-structure.-current",qu={data(){return{isInited:!1}},computed:{hasChildStructures(){return this.$store.structures&&this.$store.structures.some(t=>t.childStructures)}},watch:{"$store.options.pages":function(){this.$nextTick(()=>qi(is,this.$el))},"$store.options.view":{handler(t){t==="toc"&&this.$nextTick(this.init)},immediate:!0}},methods:{init(){this.isInited=!0,this.$nextTick(()=>qi(is,this.$el,!1))}}},Zu={class:"tify-toc",tabindex:"0"},Ku={class:"tify-sr-only"},Xu={key:0,class:"tify-toc-header"};function Yu(t,s,e,i,n,r){const l=er;return L(),D("section",Zu,[F("h2",Ku,Z(t.$translate("Table of Contents")),1),r.hasChildStructures?(L(),D("div",Xu,[F("button",{type:"button",class:"tify-toc-toggle-all",onClick:s[0]||(s[0]=a=>t.$refs.children.toggleAllChildren(!0))},Z(t.$translate("Expand all")),1),F("button",{type:"button",class:"tify-toc-toggle-all",onClick:s[1]||(s[1]=a=>t.$refs.children.toggleAllChildren(!1))},Z(t.$translate("Collapse all")),1)])):se("",!0),n.isInited?(L(),Me(l,{key:1,ref:"children",level:0,structures:t.$store.structures},null,8,["structures"])):se("",!0)])}const Ju=ue(qu,[["render",Yu]]),Qu=750,$u={data(){return{itemHeight:0,itemVMargin:0,items:[{label:""}],itemsPerRow:0,knownImages:[],lastScrollTop:0,resizeTimeout:null,style:{},thumbnailWidth:0,touchTimeout:null}},watch:{"$store.options.pages":function(t){this.$nextTick(()=>{const s=".tify-thumbnails-item.-current";t.length>2||t.length>1&&t[1]!==t[0]+1||(this.$refs.container.querySelector(s)?qi(s,this.$el):this.scrollToCurrentPage())})},"$store.options.view":{handler(t){t==="thumbnails"&&this.$nextTick(this.init)},immediate:!0}},mounted(){this.style.flex=this.$el.style.flex},methods:{init(){this.updateDimensions(),this.scrollToCurrentPage(!1),new ResizeObserver(this.onResize).observe(this.$el)},onResize(){clearTimeout(this.resizeTimeout),this.resizeTimeout=setTimeout(()=>{this.$store.options.view==="thumbnails"&&this.updateDimensions()},200)},updateDimensions(){const t=this.$refs.container.querySelector(".tify-thumbnails-item"),s=t.currentStyle||window.getComputedStyle(t),e=parseInt(s.marginTop,10)+parseFloat(s.marginBottom,10);this.itemHeight=t.offsetHeight+e,this.itemVerticalMargin=e;const i=parseInt(s.marginLeft,10)+parseFloat(s.marginRight,10),n=t.offsetWidth+i;this.thumbnailWidth=t.offsetWidth,this.itemsPerRow=Math.floor(this.$refs.container.clientWidth/n);const l=Math.ceil(this.$store.canvases.length/this.itemsPerRow)*this.itemHeight;this.$refs.container.style.height=`${l}px`,this.redrawThumbnails(),this.scrollToCurrentPage(!1)},redrawThumbnails(){const t=this.$el.scrollTop,s=Math.floor(t/this.itemHeight)*this.itemsPerRow+1,i=Math.ceil(this.$el.offsetHeight/this.itemHeight)*this.itemsPerRow,n=s+this.itemsPerRow+i,r=Math.min(this.$store.canvases.length,n),l=[];for(let a=s-1;a{const a=Math.floor(s/this.itemsPerRow);this.$refs.container.style.paddingTop=`${a*this.itemHeight}px`})},scrollToCurrentPage(t=!0){const e=Math.floor((this.$store.options.pages[0]-1)/this.itemsPerRow)*this.itemHeight+(this.itemVMargin-50);t?hi(this.$el,e):this.$el.scrollTop=e},setPageAndSwitchView(t,s=!1){if(s){const e=this.$store.options.pages.slice(0),i=e.indexOf(t);i<0?(e.push(t),e.sort((n,r)=>n-r),e[0]===0&&e.shift()):e.length>1&&e.splice(i,1),this.$store.updateOptions({pages:e});return}this.$store.setPage(t),this.$store.isMobile()&&this.$store.updateOptions({view:"scan"})},touchStartTogglePage(t){this.lastScrollTop=this.$el.scrollTop,this.touchTimeout=setTimeout(()=>{this.$el.scrollTop===this.lastScrollTop&&this.setPageAndSwitchView(t,!0)},Qu)},touchEnd(){clearTimeout(this.touchTimeout)}}},ec={class:"tify-sr-only"},tc={ref:"container",class:"tify-thumbnails-list"},ic=["onClick","onTouchstart"],nc=["src"],sc={class:"tify-thumbnails-page"};function rc(t,s,e,i,n,r){return L(),D("section",{class:"tify-thumbnails",tabindex:"0",onScroll:s[1]||(s[1]=(...l)=>r.redrawThumbnails&&r.redrawThumbnails(...l))},[F("h2",ec,Z(t.$translate("Pages")),1),F("div",tc,[(L(!0),D(de,null,Pe(n.items,l=>(L(),D("a",{key:l.page,class:xe(["tify-thumbnails-item",{"-current":t.$store.options.pages.includes(l.page)}]),href:"javascript:;",onClick:ct(a=>r.setPageAndSwitchView(l.page,a.ctrlKey),["prevent"]),onTouchstart:a=>r.touchStartTogglePage(l.page),onTouchend:s[0]||(s[0]=(...a)=>r.touchEnd&&r.touchEnd(...a))},[F("img",{alt:"",src:l.imgUrl},null,8,nc),F("span",sc,Z(t.$store.getPageLabel(l.page,l.label)),1)],42,ic))),128))],512)],32)}const oc=ue($u,[["render",rc]]);var mn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function vn(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var tr={exports:{}};(function(t){(function(s){if(typeof e!="function"){var e=function(x){return x};e.nonNative=!0}const i=e("plaintext"),n=e("html"),r=e("comment"),l=/<(\w*)>/g,a=/<\/?([^\s\/>]+)/;function o(x,P,C){x=x||"",P=P||[],C=C||"";let k=h(P,C);return g(x,k)}function u(x,P){x=x||[],P=P||"";let C=h(x,P);return function(d){return g(d||"",C)}}o.init_streaming_mode=u;function h(x,P){return x=m(x),{allowable_tags:x,tag_replacement:P,state:i,tag_buffer:"",depth:0,in_quote_char:""}}function g(x,P){if(typeof x!="string")throw new TypeError("'html' parameter must be a string");let C=P.allowable_tags,k=P.tag_replacement,d=P.state,_=P.tag_buffer,S=P.depth,M=P.in_quote_char,I="";for(let V=0,j=x.length;V":if(M)break;if(S){S--;break}M="",d=i,_+=">",C.has(T(_))?I+=_:I+=k,_="";break;case'"':case"'":q===M?M="":M=M||q,_+=q;break;case"-":_==="":_.slice(-2)=="--"&&(d=i),_="";break;default:_+=q;break}}return P.state=d,P.tag_buffer=_,P.depth=S,P.in_quote_char=M,I}function m(x){let P=new Set;if(typeof x=="string"){let C;for(;C=l.exec(x);)P.add(C[1])}else!e.nonNative&&typeof x[e.iterator]=="function"?P=new Set(x):typeof x.forEach=="function"&&x.forEach(P.add,P);return P}function T(x){let P=a.exec(x);return P?P[1].toLowerCase():null}t.exports?t.exports=o:s.striptags=o})(mn)})(tr);var ac=tr.exports;const lc=vn(ac);function ut(t){const s=["a","b","br","i","img","p","span"],e={a:["href"],img:["alt","src"]};let i=lc(t,s);const n=/<(\w+)((\s+.+?(\s*=\s*(?:".*?"|'.*?'|.*?|[\^'">\s]+))?)+\s*|\s*)>/g;return i=i.replace(n,(r,l,a)=>{if(!a)return`<${l}>`;const o=/(?:([^\s]+)=(?:"(.*?)"|'(.*?)'))|([^\s]+)/g,u=[];return a.replace(o,(h,g)=>{h!==g&&e[l]&&e[l].includes(g)&&u.push(h)}),u.length>0?`<${l} ${u.join(" ")}>`:`<${l}>`}),i}const uc={data(){return{fulltextAvailable:null,fulltexts:[]}},computed:{pages(){return this.$store.options.pages.filter(t=>!!t)}},watch:{"$store.options.pages":function(){this.loadFulltexts()}},mounted(){this.loadFulltexts()},methods:{loadFulltexts(){this.fulltextAvailable=null,this.fulltexts=[],this.$store.options.pages.forEach(t=>{if(t<1||this.fulltexts[t])return;const s=this.$store.canvases[t-1];if(!("otherContent"in s)){this.fulltextAvailable=!1;return}const e=s.otherContent[0]["@id"];this.$store.fetchJson(e).then(i=>{const{resources:n}=i;Array.isArray(n)&&n.forEach((r,l)=>{const a=r.resource;if(a)if(this.fulltexts[t]||(this.fulltexts[t]=[]),a&&a.chars){const o=ut(a.chars);o&&(this.fulltextAvailable=!0),this.fulltexts[t][l]=o}else a["@id"]&&this.loadRemoteFulltext(t,l,a["@id"])})},i=>{const n=i.response?i.response.statusText:i.message;console.warn(`Could not load annotations: ${n}`),this.fulltextAvailable=!1})})},loadRemoteFulltext(t,s,e){gn(e)&&this.$store.fetchText(e).then(i=>{const n=ut(i);n&&(this.fulltextAvailable=!0),this.fulltexts[t]||(this.fulltexts[t]=[]),this.fulltexts[t][s]=n},i=>{const n=i.response?i.response.statusText:i.message;console.warn(`Could not load fulltext: ${n}`)})}}},cc={class:"tify-fulltext",tabindex:"0"},hc={class:"tify-sr-only"},dc={key:0,class:"tify-fulltext-texts"},fc=["innerHTML"],pc={key:1,class:"tify-fulltext-none"};function gc(t,s,e,i,n,r){return L(),D("section",cc,[F("h2",hc,Z(t.$translate("Fulltext")),1),n.fulltextAvailable!==!1?(L(),D("div",dc,[(L(!0),D(de,null,Pe(r.pages,l=>(L(),D("div",{key:l,class:"tify-fulltext-page"},[F("h3",null,Z(t.$translate("Page"))+" "+Z(t.$store.getPageLabel(l,t.$store.canvases[l-1].label)),1),(L(!0),D(de,null,Pe(n.fulltexts[l],(a,o)=>(L(),D("div",{key:`${l}-${o}`,class:"tify-fulltext-text",innerHTML:a},null,8,fc))),128))]))),128))])):(L(),D("div",pc,Z(t.$translate("Fulltext not available for this page")),1))])}const mc=ue(uc,[["render",gc]]),vc={},yc={class:"tify-icon",viewBox:"0 0 24 24"},wc=F("path",{d:"M12,3A9,9 0 0,0 3,12H0L4,16L8,12H5A7,7 0 0,1 12,5A7,7 0 0,1 19,12A7,7 0 0,1 12,19C10.5,19 9.09,18.5 7.94,17.7L6.5,19.14C8.04,20.3 9.94,21 12,21A9,9 0 0,0 21,12A9,9 0 0,0 12,3M14,12A2,2 0 0,0 12,10A2,2 0 0,0 10,12A2,2 0 0,0 12,14A2,2 0 0,0 14,12Z"},null,-1),_c=[wc];function Tc(t,s){return L(),D("svg",yc,_c)}const xc=ue(vc,[["render",Tc]]),bc={},Ec={class:"tify-icon",viewBox:"0 0 24 24"},Pc=F("path",{d:"M17.5,12A1.5,1.5 0 0,1 16,10.5A1.5,1.5 0 0,1 17.5,9A1.5,1.5 0 0,1 19,10.5A1.5,1.5 0 0,1 17.5,12M14.5,8A1.5,1.5 0 0,1 13,6.5A1.5,1.5 0 0,1 14.5,5A1.5,1.5 0 0,1 16,6.5A1.5,1.5 0 0,1 14.5,8M9.5,8A1.5,1.5 0 0,1 8,6.5A1.5,1.5 0 0,1 9.5,5A1.5,1.5 0 0,1 11,6.5A1.5,1.5 0 0,1 9.5,8M6.5,12A1.5,1.5 0 0,1 5,10.5A1.5,1.5 0 0,1 6.5,9A1.5,1.5 0 0,1 8,10.5A1.5,1.5 0 0,1 6.5,12M12,3A9,9 0 0,0 3,12A9,9 0 0,0 12,21A1.5,1.5 0 0,0 13.5,19.5C13.5,19.11 13.35,18.76 13.11,18.5C12.88,18.23 12.73,17.88 12.73,17.5A1.5,1.5 0 0,1 14.23,16H16A5,5 0 0,0 21,11C21,6.58 16.97,3 12,3Z"},null,-1),Sc=[Pc];function Cc(t,s){return L(),D("svg",Ec,Sc)}const Rc=ue(bc,[["render",Cc]]),Hc={},Oc={class:"tify-icon",viewBox:"0 0 24 24"},Lc=F("path",{d:"M12,18V6A6,6 0 0,1 18,12A6,6 0 0,1 12,18M20,15.31L23.31,12L20,8.69V4H15.31L12,0.69L8.69,4H4V8.69L0.69,12L4,15.31V20H8.69L12,23.31L15.31,20H20V15.31Z"},null,-1),Mc=[Lc];function Dc(t,s){return L(),D("svg",Oc,Mc)}const kc=ue(Hc,[["render",Dc]]),Fc={},Ac={class:"tify-icon",viewBox:"0 0 24 24"},Bc=F("path",{d:"M3.55 19.09L4.96 20.5L6.76 18.71L5.34 17.29M12 6C8.69 6 6 8.69 6 12S8.69 18 12 18 18 15.31 18 12C18 8.68 15.31 6 12 6M20 13H23V11H20M17.24 18.71L19.04 20.5L20.45 19.09L18.66 17.29M20.45 5L19.04 3.6L17.24 5.39L18.66 6.81M13 1H11V4H13M6.76 5.39L4.96 3.6L3.55 5L5.34 6.81L6.76 5.39M1 13H4V11H1M13 20H11V23H13"},null,-1),Ic=[Bc];function zc(t,s){return L(),D("svg",Ac,Ic)}const Nc=ue(Fc,[["render",zc]]),Vc={},Uc={class:"tify-icon",viewBox:"0 0 24 24"},Wc=F("path",{d:"M3,17V19H9V17H3M3,5V7H13V5H3M13,21V19H21V17H13V15H11V21H13M7,9V11H3V13H7V15H9V9H7M21,13V11H11V13H21M15,9H17V7H21V5H17V3H15V9Z"},null,-1),jc=[Wc];function Gc(t,s){return L(),D("svg",Uc,jc)}const qc=ue(Vc,[["render",Gc]]),Zc={},Kc={class:"tify-icon",viewBox:"0 0 24 24"},Xc=F("path",{d:"M16.89,15.5L18.31,16.89C19.21,15.73 19.76,14.39 19.93,13H17.91C17.77,13.87 17.43,14.72 16.89,15.5M13,17.9V19.92C14.39,19.75 15.74,19.21 16.9,18.31L15.46,16.87C14.71,17.41 13.87,17.76 13,17.9M19.93,11C19.76,9.61 19.21,8.27 18.31,7.11L16.89,8.53C17.43,9.28 17.77,10.13 17.91,11M15.55,5.55L11,1V4.07C7.06,4.56 4,7.92 4,12C4,16.08 7.05,19.44 11,19.93V17.91C8.16,17.43 6,14.97 6,12C6,9.03 8.16,6.57 11,6.09V10L15.55,5.55Z"},null,-1),Yc=[Xc];function Jc(t,s){return L(),D("svg",Kc,Yc)}const Qc=ue(Zc,[["render",Jc]]),$c={},eh={class:"tify-icon",viewBox:"0 0 24 24"},th=F("path",{d:"M9,2A7,7 0 0,1 16,9C16,10.57 15.5,12 14.61,13.19L15.41,14H16L22,20L20,22L14,16V15.41L13.19,14.61C12,15.5 10.57,16 9,16A7,7 0 0,1 2,9A7,7 0 0,1 9,2M5,8V10H13V8H5Z"},null,-1),ih=[th];function nh(t,s){return L(),D("svg",eh,ih)}const sh=ue($c,[["render",nh]]),rh={},oh={class:"tify-icon",viewBox:"0 0 24 24"},ah=F("path",{d:"M19,12H17V15H14V17H19V12M7,9H10V7H5V12H7V9M21,3H3A2,2 0 0,0 1,5V19A2,2 0 0,0 3,21H21A2,2 0 0,0 23,19V5A2,2 0 0,0 21,3M21,19H3V5H21V19Z"},null,-1),lh=[ah];function uh(t,s){return L(),D("svg",oh,lh)}const ch=ue(rh,[["render",uh]]),hh={},dh={class:"tify-icon",viewBox:"0 0 24 24"},fh=F("path",{d:"M9,2A7,7 0 0,1 16,9C16,10.57 15.5,12 14.61,13.19L15.41,14H16L22,20L20,22L14,16V15.41L13.19,14.61C12,15.5 10.57,16 9,16A7,7 0 0,1 2,9A7,7 0 0,1 9,2M8,5V8H5V10H8V13H10V10H13V8H10V5H8Z"},null,-1),ph=[fh];function gh(t,s){return L(),D("svg",dh,ph)}const mh=ue(hh,[["render",gh]]),vh={},yh={class:"tify-icon",viewBox:"0 0 24 24"},wh=F("path",{d:"M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z"},null,-1),_h=[wh];function Th(t,s){return L(),D("svg",yh,_h)}const ir=ue(vh,[["render",Th]]),xh={},bh={class:"tify-icon",viewBox:"0 0 24 24"},Eh=F("path",{d:"M15.41,16.58L10.83,12L15.41,7.41L14,6L8,12L14,18L15.41,16.58Z"},null,-1),Ph=[Eh];function Sh(t,s){return L(),D("svg",bh,Ph)}const nr=ue(xh,[["render",Sh]]);var sr={exports:{}};(function(t,s){(function(e,i){t.exports=i()})(mn,function(){var e="__v-click-outside",i=typeof window<"u",n=typeof navigator<"u",r=i&&("ontouchstart"in window||n&&navigator.msMaxTouchPoints>0)?["touchstart"]:["click"],l=function(h){var g=h.event,m=h.handler;(0,h.middleware)(g)&&m(g)},a=function(h,g){var m=function(d){var _=typeof d=="function";if(!_&&typeof d!="object")throw new Error("v-click-outside: Binding value must be a function or an object");return{handler:_?d:d.handler,middleware:d.middleware||function(S){return S},events:d.events||r,isActive:d.isActive!==!1,detectIframe:d.detectIframe!==!1,capture:!!d.capture}}(g.value),T=m.handler,x=m.middleware,P=m.detectIframe,C=m.capture;if(m.isActive){if(h[e]=m.events.map(function(d){return{event:d,srcTarget:document.documentElement,handler:function(_){return function(S){var M=S.el,I=S.event,V=S.handler,j=S.middleware,q=I.path||I.composedPath&&I.composedPath();(q?q.indexOf(M)<0:!M.contains(I.target))&&l({event:I,handler:V,middleware:j})}({el:h,event:_,handler:T,middleware:x})},capture:C}}),P){var k={event:"blur",srcTarget:window,handler:function(d){return function(_){var S=_.el,M=_.event,I=_.handler,V=_.middleware;setTimeout(function(){var j=document.activeElement;j&&j.tagName==="IFRAME"&&!S.contains(j)&&l({event:M,handler:I,middleware:V})},0)}({el:h,event:d,handler:T,middleware:x})},capture:C};h[e]=[].concat(h[e],[k])}h[e].forEach(function(d){var _=d.event,S=d.srcTarget,M=d.handler;return setTimeout(function(){h[e]&&S.addEventListener(_,M,C)},0)})}},o=function(h){(h[e]||[]).forEach(function(g){return g.srcTarget.removeEventListener(g.event,g.handler,g.capture)}),delete h[e]},u=i?{beforeMount:a,updated:function(h,g){var m=g.value,T=g.oldValue;JSON.stringify(m)!==JSON.stringify(T)&&(o(h),a(h,{value:m}))},unmounted:o}:{};return{install:function(h){h.directive("click-outside",u)},directive:u}})})(sr);var Ch=sr.exports;const yn=vn(Ch);var rr={exports:{}};(function(t){//! 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 s(e){return new s.Viewer(e)}(function(e){e.version={versionStr:"3.0.0",major:parseInt("3",10),minor:parseInt("0",10),revision:parseInt("0",10)};var i={"[object Boolean]":"boolean","[object Number]":"number","[object String]":"string","[object Function]":"function","[object Array]":"array","[object Date]":"date","[object RegExp]":"regexp","[object Object]":"object"},n=Object.prototype.toString,r=Object.prototype.hasOwnProperty;e.isFunction=function(l){return e.type(l)==="function"},e.isArray=Array.isArray||function(l){return e.type(l)==="array"},e.isWindow=function(l){return l&&typeof l=="object"&&"setInterval"in l},e.type=function(l){return l==null?String(l):i[n.call(l)]||"object"},e.isPlainObject=function(l){if(!l||s.type(l)!=="object"||l.nodeType||e.isWindow(l)||l.constructor&&!r.call(l,"constructor")&&!r.call(l.constructor.prototype,"isPrototypeOf"))return!1;var a;for(var o in l)a=o;return a===void 0||r.call(l,a)},e.isEmptyObject=function(l){for(var a in l)return!1;return!0},e.freezeObject=function(l){return Object.freeze?e.freezeObject=Object.freeze:e.freezeObject=function(a){return a},e.freezeObject(l)},e.supportsCanvas=function(){var l=document.createElement("canvas");return!!(e.isFunction(l.getContext)&&l.getContext("2d"))}(),e.isCanvasTainted=function(l){var a=!1;try{l.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 l=0;if(e.supportsAddEventListener)try{var a={get capture(){return l++,!1},get once(){return l++,!1},get passive(){return l++,!1}};window.addEventListener("test",null,a),window.removeEventListener("test",null,a)}catch{l=0}return l>=3}(),e.getCurrentPixelDensityRatio=function(){if(e.supportsCanvas){var l=document.createElement("canvas").getContext("2d"),a=window.devicePixelRatio||1,o=l.webkitBackingStorePixelRatio||l.mozBackingStorePixelRatio||l.msBackingStorePixelRatio||l.oBackingStorePixelRatio||l.backingStorePixelRatio||1;return Math.max(a,1)/o}else return 1},e.pixelDensityRatio=e.getCurrentPixelDensityRatio()})(s),function(e){e.extend=function(){var o,u,h,g,m,T,x=arguments[0]||{},P=arguments.length,C=!1,k=1;for(typeof x=="boolean"&&(C=x,x=arguments[1]||{},k=2),typeof x!="object"&&!s.isFunction(x)&&(x={}),P===k&&(x=this,--k);k=h.x&&u.x=h.y},getMousePosition:function(o){if(typeof o.pageX=="number")e.getMousePosition=function(u){var h=new e.Point;return h.x=u.pageX,h.y=u.pageY,h};else if(typeof o.clientX=="number")e.getMousePosition=function(u){var h=new e.Point;return h.x=u.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,h.y=u.clientY+document.body.scrollTop+document.documentElement.scrollTop,h};else throw new Error("Unknown event mouse position, no known technique.");return e.getMousePosition(o)},getPageScroll:function(){var o=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(o.scrollLeft||o.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(o){if(typeof window.scrollTo<"u")e.setPageScroll=function(g){window.scrollTo(g.x,g.y)};else{var u=e.getPageScroll();if(u.x===o.x&&u.y===o.y)return;document.body.scrollLeft=o.x,document.body.scrollTop=o.y;var h=e.getPageScroll();if(h.x!==u.x&&h.y!==u.y){e.setPageScroll=function(g){document.body.scrollLeft=g.x,document.body.scrollTop=g.y};return}if(document.documentElement.scrollLeft=o.x,document.documentElement.scrollTop=o.y,h=e.getPageScroll(),h.x!==u.x&&h.y!==u.y){e.setPageScroll=function(g){document.documentElement.scrollLeft=g.x,document.documentElement.scrollTop=g.y};return}e.setPageScroll=function(g){}}e.setPageScroll(o)},getWindowSize:function(){var o=document.documentElement||{},u=document.body||{};if(typeof window.innerWidth=="number")e.getWindowSize=function(){return new e.Point(window.innerWidth,window.innerHeight)};else if(o.clientWidth||o.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(o){o=e.getElement(o);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(o),u[0]},makeNeutralElement:function(o){var u=document.createElement(o),h=u.style;return h.background="transparent none",h.border="none",h.margin="0px",h.padding="0px",h.position="static",u},now:function(){return Date.now?e.now=Date.now:e.now=function(){return new Date().getTime()},e.now()},makeTransparentImage:function(o){var u=e.makeNeutralElement("img");return u.src=o,u},setElementOpacity:function(o,u,h){var g,m;o=e.getElement(o),h&&!e.Browser.alpha&&(u=Math.round(u)),e.Browser.opacity?o.style.opacity=u<1?u:"":u<1?(g=Math.round(100*u),m="alpha(opacity="+g+")",o.style.filter=m):o.style.filter=""},setElementTouchActionNone:function(o){o=e.getElement(o),typeof o.style.touchAction<"u"?o.style.touchAction="none":typeof o.style.msTouchAction<"u"&&(o.style.msTouchAction="none")},setElementPointerEvents:function(o,u){o=e.getElement(o),typeof o.style.pointerEvents<"u"&&(o.style.pointerEvents=u)},setElementPointerEventsNone:function(o){e.setElementPointerEvents(o,"none")},addClass:function(o,u){o=e.getElement(o),o.className?(" "+o.className+" ").indexOf(" "+u+" ")===-1&&(o.className+=" "+u):o.className=u},indexOf:function(o,u,h){return Array.prototype.indexOf?this.indexOf=function(g,m,T){return g.indexOf(m,T)}:this.indexOf=function(g,m,T){var x,P=T||0,C;if(!g)throw new TypeError;if(C=g.length,C===0||P>=C)return-1;for(P<0&&(P=C-Math.abs(P)),x=P;x=200&&P.status<300||P.status===0&&x!=="http:"&&x!=="https:"?u(P):(e.console.log("AJAX request returned %d: %s",P.status,o),e.isFunction(h)&&h(P)))};try{if(P.open("GET",o,!0),T&&(P.responseType=T),m)for(var C in m)Object.prototype.hasOwnProperty.call(m,C)&&m[C]&&P.setRequestHeader(C,m[C]);g&&(P.withCredentials=!0),P.send(null)}catch(k){e.console.log("%s while making AJAX request: %s",k.name,k.message),P.onreadystatechange=function(){},e.isFunction(h)&&h(P,k)}return P},jsonp:function(o){var u,h=o.url,g=document.head||document.getElementsByTagName("head")[0]||document.documentElement,m=o.callbackName||"openseadragon"+e.now(),T=window[m],x="$1"+m+"$2",P=o.param||"callback",C=o.callback;h=h.replace(/(=)\?(&|$)|\?\?/i,x),h+=(/\?/.test(h)?"&":"?")+P+"="+m,window[m]=function(k){if(T)window[m]=T;else try{delete window[m]}catch{}C&&e.isFunction(C)&&C(k)},u=document.createElement("script"),(o.async!==void 0||o.async!==!1)&&(u.async="async"),o.scriptCharset&&(u.charset=o.scriptCharset),u.src=h,u.onload=u.onreadystatechange=function(k,d){(d||!u.readyState||/loaded|complete/.test(u.readyState))&&(u.onload=u.onreadystatechange=null,g&&u.parentNode&&g.removeChild(u),u=void 0)},g.insertBefore(u,g.firstChild)},createFromDZI:function(){throw"OpenSeadragon.createFromDZI is deprecated, use Viewer.open."},parseXml:function(o){if(window.DOMParser)e.parseXml=function(u){var h=null,g;return g=new DOMParser,h=g.parseFromString(u,"text/xml"),h};else if(window.ActiveXObject)e.parseXml=function(u){var h=null;return h=new ActiveXObject("Microsoft.XMLDOM"),h.async=!1,h.loadXML(u),h};else throw new Error("Browser doesn't support XML DOM.");return e.parseXml(o)},parseJSON:function(o){return e.parseJSON=window.JSON.parse,e.parseJSON(o)},imageFormatSupported:function(o){return o=o||"",!!r[o.toLowerCase()]},setImageFormatsSupported:function(o){e.extend(r,o)}});var n=function(o){};e.console=window.console||{log:n,debug:n,info:n,warn:n,error:n,assert:n},e.Browser={vendor:e.BROWSERS.UNKNOWN,version:0,alpha:!0};var r={bmp:!1,jpeg:!0,jpg:!0,png:!0,tif:!1,wdp:!1},l={};(function(){var o=navigator.appVersion,u=navigator.userAgent,h;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")))):(h=new RegExp("Trident/.*rv:([0-9]{1,}[.0-9]{0,})"),h.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(o);break}var g=window.location.search.substring(1),m=g.split("&"),T,x,P;for(P=0;P0){var C=T.substring(0,x),k=T.substring(x+1);try{l[C]=decodeURIComponent(k)}catch{e.console.error("Ignoring malformed URL parameter: %s=%s",C,k)}}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(o){var u=o.requestAnimationFrame||o.mozRequestAnimationFrame||o.webkitRequestAnimationFrame||o.msRequestAnimationFrame,h=o.cancelAnimationFrame||o.mozCancelAnimationFrame||o.webkitCancelAnimationFrame||o.msCancelAnimationFrame;if(u&&h)e.requestAnimationFrame=function(){return u.apply(o,arguments)},e.cancelAnimationFrame=function(){return h.apply(o,arguments)};else{var g=[],m=[],T=0,x;e.requestAnimationFrame=function(P){return g.push([++T,P]),x||(x=setInterval(function(){if(g.length){var C=e.now(),k=m;for(m=g,g=k;m.length;)m.shift()[1](C)}else clearInterval(x),x=void 0},1e3/50)),T},e.cancelAnimationFrame=function(P){var C,k;for(C=0,k=g.length;C8||"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 p=document.createElement("div");return e.isFunction(p.setPointerCapture)&&e.isFunction(p.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 p=document.createElement("div");return e.isFunction(p.setCapture)&&e.isFunction(p.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(p){this._gPoints=[],this.type=p,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(p){return this._gPoints.push(p)},removeById:function(p){var f,y=this._gPoints.length;for(f=0;f1&&(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 l(p){var f=i[p.hash],y,w,z,W,$,pe=f.activePointersLists.length;for(y=0;y0){for($=[],W=z.asArray(),w=0;wf.touches.length-z&&e.console.warn("Tracked touch contact count doesn't match event.touches.length");var pe={originalEvent:f,eventType:"pointerdown",pointerType:"touch",isEmulated:!1};for(H(p,pe),w=0;w0&&f.removeContact(),w=f.removeById(y.id)):w=f.getLength(),w}function O(p,f){switch(f.eventType){case"pointermove":f.isStoppable=!0,f.isCancelable=!0,f.preventDefault=!1,f.preventGesture=!p.hasGestureHandlers,f.stopPropagation=!1;break;case"pointerover":case"pointerout":case"contextmenu":case"keydown":case"keyup":case"keypress":f.isStoppable=!0,f.isCancelable=!0,f.preventDefault=!1,f.preventGesture=!1,f.stopPropagation=!1;break;case"pointerdown":f.isStoppable=!0,f.isCancelable=!0,f.preventDefault=!1,f.preventGesture=!p.hasGestureHandlers,f.stopPropagation=!1;break;case"pointerup":f.isStoppable=!0,f.isCancelable=!0,f.preventDefault=!1,f.preventGesture=!p.hasGestureHandlers,f.stopPropagation=!1;break;case"wheel":f.isStoppable=!0,f.isCancelable=!0,f.preventDefault=!1,f.preventGesture=!p.hasScrollHandler,f.stopPropagation=!1;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":f.isStoppable=!0,f.isCancelable=!1,f.preventDefault=!1,f.preventGesture=!1,f.stopPropagation=!1;break;case"click":f.isStoppable=!0,f.isCancelable=!0,f.preventDefault=!!p.clickHandler,f.preventGesture=!1,f.stopPropagation=!1;break;case"dblclick":f.isStoppable=!0,f.isCancelable=!0,f.preventDefault=!!p.dblClickHandler,f.preventGesture=!1,f.stopPropagation=!1;break;case"focus":case"blur":case"pointerenter":case"pointerleave":default:f.isStoppable=!1,f.isCancelable=!1,f.preventDefault=!1,f.preventGesture=!1,f.stopPropagation=!1;break}}function H(p,f){f.eventSource=p,f.eventPhase=f.originalEvent&&typeof f.originalEvent.eventPhase<"u"?f.originalEvent.eventPhase:0,f.defaultPrevented=e.eventIsCanceled(f.originalEvent),f.shouldCapture=!1,f.shouldReleaseCapture=!1,f.userData=p.userData,O(p,f),p.preProcessEventHandler&&p.preProcessEventHandler(f)}function B(p,f,y){var w=p.getActivePointersListByType(f.type),z=w.getById(f.id);z?y&&!z.captured?(z.captured=!0,w.captureCount++):!y&&z.captured&&(z.captured=!1,w.captureCount--,w.captureCount<0&&(w.captureCount=0,e.console.warn("updatePointerCaptured() - pointsList.captureCount went negative"))):e.console.warn("updatePointerCaptured() called on untracked pointer")}function A(p,f,y){var w=p.getActivePointersListByType(y.type),z;z=w.getById(y.id),z?(z.insideElement=!0,z.lastPos=z.currentPos,z.lastTime=z.currentTime,z.currentPos=y.currentPos,z.currentTime=y.currentTime,y=z):(y.captured=!1,y.insideElementPressed=!1,y.insideElement=!0,v(w,y)),p.enterHandler&&p.enterHandler({eventSource:p,pointerType:y.type,position:k(y.currentPos,p.element),buttons:w.buttons,pointers:p.getActivePointerCount(),insideElementPressed:y.insideElementPressed,buttonDownAny:w.buttons!==0,isTouchEvent:y.type==="touch",originalEvent:f.originalEvent,userData:p.userData})}function N(p,f,y){var w=p.getActivePointersListByType(y.type),z,W;z=w.getById(y.id),z?(z.captured?(z.insideElement=!1,z.lastPos=z.currentPos,z.lastTime=z.currentTime,z.currentPos=y.currentPos,z.currentTime=y.currentTime):b(p,w,z),y=z):(y.captured=!1,y.insideElementPressed=!1),(p.leaveHandler||p.exitHandler)&&(W={eventSource:p,pointerType:y.type,position:y.currentPos&&k(y.currentPos,p.element),buttons:w.buttons,pointers:p.getActivePointerCount(),insideElementPressed:y.insideElementPressed,buttonDownAny:w.buttons!==0,isTouchEvent:y.type==="touch",originalEvent:f.originalEvent,userData:p.userData},p.leaveHandler&&p.leaveHandler(W),p.exitHandler&&p.exitHandler(W))}function X(p,f,y){var w,z;w=p.getActivePointersListByType(y.type),z=w.getById(y.id),z?y=z:(y.captured=!1,y.insideElementPressed=!1),p.overHandler&&p.overHandler({eventSource:p,pointerType:y.type,position:k(y.currentPos,p.element),buttons:w.buttons,pointers:p.getActivePointerCount(),insideElementPressed:y.insideElementPressed,buttonDownAny:w.buttons!==0,isTouchEvent:y.type==="touch",originalEvent:f.originalEvent,userData:p.userData})}function G(p,f,y){var w,z;w=p.getActivePointersListByType(y.type),z=w.getById(y.id),z?y=z:(y.captured=!1,y.insideElementPressed=!1),p.outHandler&&p.outHandler({eventSource:p,pointerType:y.type,position:y.currentPos&&k(y.currentPos,p.element),buttons:w.buttons,pointers:p.getActivePointerCount(),insideElementPressed:y.insideElementPressed,buttonDownAny:w.buttons!==0,isTouchEvent:y.type==="touch",originalEvent:f.originalEvent,userData:p.userData})}function U(p,f,y,w){var z=i[p.hash],W=p.getActivePointersListByType(y.type),$;if(typeof f.originalEvent.buttons<"u"?W.buttons=f.originalEvent.buttons:w===0?W.buttons|=1:w===1?W.buttons|=4:w===2?W.buttons|=2:w===3?W.buttons|=8:w===4?W.buttons|=16:w===5&&(W.buttons|=32),w!==0){f.shouldCapture=!1,f.shouldReleaseCapture=!1,p.nonPrimaryPressHandler&&!f.preventGesture&&!f.defaultPrevented&&(f.preventDefault=!0,p.nonPrimaryPressHandler({eventSource:p,pointerType:y.type,position:k(y.currentPos,p.element),button:w,buttons:W.buttons,isTouchEvent:y.type==="touch",originalEvent:f.originalEvent,userData:p.userData}));return}if($=W.getById(y.id),$)$.insideElementPressed=!0,$.insideElement=!0,$.originalTarget=f.originalEvent.target,$.contactPos=y.currentPos,$.contactTime=y.currentTime,$.lastPos=$.currentPos,$.lastTime=$.currentTime,$.currentPos=y.currentPos,$.currentTime=y.currentTime,y=$;else{e.console.warn("pointerdown event on untracked pointer"),y.captured=!1,y.insideElementPressed=!0,y.insideElement=!0,y.originalTarget=f.originalEvent.target,v(W,y);return}W.addContact(),!f.preventGesture&&!f.defaultPrevented?(f.shouldCapture=!0,f.shouldReleaseCapture=!1,f.preventDefault=!0,(p.dragHandler||p.dragEndHandler||p.pinchHandler)&&e.MouseTracker.gesturePointVelocityTracker.addPoint(p,y),W.contacts===1?p.pressHandler&&!f.preventGesture&&p.pressHandler({eventSource:p,pointerType:y.type,position:k(y.contactPos,p.element),buttons:W.buttons,isTouchEvent:y.type==="touch",originalEvent:f.originalEvent,userData:p.userData}):W.contacts===2&&p.pinchHandler&&y.type==="touch"&&(z.pinchGPoints=W.asArray(),z.lastPinchDist=z.currentPinchDist=z.pinchGPoints[0].currentPos.distanceTo(z.pinchGPoints[1].currentPos),z.lastPinchCenter=z.currentPinchCenter=d(z.pinchGPoints[0].currentPos,z.pinchGPoints[1].currentPos))):(f.shouldCapture=!1,f.shouldReleaseCapture=!1)}function J(p,f,y,w){var z=i[p.hash],W=p.getActivePointersListByType(y.type),$,pe,ne,Ne=!1,Re;if(typeof f.originalEvent.buttons<"u"?W.buttons=f.originalEvent.buttons:w===0?W.buttons^=-2:w===1?W.buttons^=-5:w===2?W.buttons^=-3:w===3?W.buttons^=-9:w===4?W.buttons^=-17:w===5&&(W.buttons^=-33),f.shouldCapture=!1,w!==0){f.shouldReleaseCapture=!1,p.nonPrimaryReleaseHandler&&!f.preventGesture&&!f.defaultPrevented&&(f.preventDefault=!0,p.nonPrimaryReleaseHandler({eventSource:p,pointerType:y.type,position:k(y.currentPos,p.element),button:w,buttons:W.buttons,isTouchEvent:y.type==="touch",originalEvent:f.originalEvent,userData:p.userData}));return}ne=W.getById(y.id),ne?(W.removeContact(),ne.captured&&(Ne=!0),ne.lastPos=ne.currentPos,ne.lastTime=ne.currentTime,ne.currentPos=y.currentPos,ne.currentTime=y.currentTime,ne.insideElement||b(p,W,ne),$=ne.currentPos,pe=ne.currentTime):(e.console.warn("updatePointerUp(): pointerup on untracked gPoint"),y.captured=!1,y.insideElementPressed=!1,y.insideElement=!0,v(W,y),ne=y),!f.preventGesture&&!f.defaultPrevented&&(Ne?(f.shouldReleaseCapture=!0,f.preventDefault=!0,(p.dragHandler||p.dragEndHandler||p.pinchHandler)&&e.MouseTracker.gesturePointVelocityTracker.removePoint(p,ne),W.contacts===0?(p.releaseHandler&&p.releaseHandler({eventSource:p,pointerType:ne.type,position:k($,p.element),buttons:W.buttons,insideElementPressed:ne.insideElementPressed,insideElementReleased:ne.insideElement,isTouchEvent:ne.type==="touch",originalEvent:f.originalEvent,userData:p.userData}),p.dragEndHandler&&z.sentDragEvent&&p.dragEndHandler({eventSource:p,pointerType:ne.type,position:k(ne.currentPos,p.element),speed:ne.speed,direction:ne.direction,shift:f.originalEvent.shiftKey,isTouchEvent:ne.type==="touch",originalEvent:f.originalEvent,userData:p.userData}),z.sentDragEvent=!1,(p.clickHandler||p.dblClickHandler)&&ne.insideElement&&(Re=pe-ne.contactTime<=p.clickTimeThreshold&&ne.contactPos.distanceTo($)<=p.clickDistThreshold,p.clickHandler&&p.clickHandler({eventSource:p,pointerType:ne.type,position:k(ne.currentPos,p.element),quick:Re,shift:f.originalEvent.shiftKey,isTouchEvent:ne.type==="touch",originalEvent:f.originalEvent,originalTarget:ne.originalTarget,userData:p.userData}),p.dblClickHandler&&Re&&(W.clicks++,W.clicks===1?(z.lastClickPos=$,z.dblClickTimeOut=setTimeout(function(){W.clicks=0},p.dblClickTimeThreshold)):W.clicks===2&&(clearTimeout(z.dblClickTimeOut),W.clicks=0,z.lastClickPos.distanceTo($)<=p.dblClickDistThreshold&&p.dblClickHandler({eventSource:p,pointerType:ne.type,position:k(ne.currentPos,p.element),shift:f.originalEvent.shiftKey,isTouchEvent:ne.type==="touch",originalEvent:f.originalEvent,userData:p.userData}),z.lastClickPos=null)))):W.contacts===2&&p.pinchHandler&&ne.type==="touch"&&(z.pinchGPoints=W.asArray(),z.lastPinchDist=z.currentPinchDist=z.pinchGPoints[0].currentPos.distanceTo(z.pinchGPoints[1].currentPos),z.lastPinchCenter=z.currentPinchCenter=d(z.pinchGPoints[0].currentPos,z.pinchGPoints[1].currentPos))):(f.shouldReleaseCapture=!1,p.releaseHandler&&(p.releaseHandler({eventSource:p,pointerType:ne.type,position:k($,p.element),buttons:W.buttons,insideElementPressed:ne.insideElementPressed,insideElementReleased:ne.insideElement,isTouchEvent:ne.type==="touch",originalEvent:f.originalEvent,userData:p.userData}),f.preventDefault=!0)))}function Y(p,f,y){var w=i[p.hash],z=p.getActivePointersListByType(y.type),W,$,pe;if(typeof f.originalEvent.buttons<"u"&&(z.buttons=f.originalEvent.buttons),W=z.getById(y.id),W)W.lastPos=W.currentPos,W.lastTime=W.currentTime,W.currentPos=y.currentPos,W.currentTime=y.currentTime;else return;f.shouldCapture=!1,f.shouldReleaseCapture=!1,p.stopHandler&&y.type==="mouse"&&(clearTimeout(p.stopTimeOut),p.stopTimeOut=setTimeout(function(){me(p,f.originalEvent,y.type)},p.stopDelay)),z.contacts===0?p.moveHandler&&p.moveHandler({eventSource:p,pointerType:y.type,position:k(y.currentPos,p.element),buttons:z.buttons,isTouchEvent:y.type==="touch",originalEvent:f.originalEvent,userData:p.userData}):z.contacts===1?(p.moveHandler&&(W=z.asArray()[0],p.moveHandler({eventSource:p,pointerType:W.type,position:k(W.currentPos,p.element),buttons:z.buttons,isTouchEvent:W.type==="touch",originalEvent:f.originalEvent,userData:p.userData})),p.dragHandler&&!f.preventGesture&&!f.defaultPrevented&&(W=z.asArray()[0],pe=W.currentPos.minus(W.lastPos),p.dragHandler({eventSource:p,pointerType:W.type,position:k(W.currentPos,p.element),buttons:z.buttons,delta:pe,speed:W.speed,direction:W.direction,shift:f.originalEvent.shiftKey,isTouchEvent:W.type==="touch",originalEvent:f.originalEvent,userData:p.userData}),f.preventDefault=!0,w.sentDragEvent=!0)):z.contacts===2&&(p.moveHandler&&($=z.asArray(),p.moveHandler({eventSource:p,pointerType:$[0].type,position:k(d($[0].currentPos,$[1].currentPos),p.element),buttons:z.buttons,isTouchEvent:$[0].type==="touch",originalEvent:f.originalEvent,userData:p.userData})),p.pinchHandler&&y.type==="touch"&&!f.preventGesture&&!f.defaultPrevented&&(pe=w.pinchGPoints[0].currentPos.distanceTo(w.pinchGPoints[1].currentPos),pe!==w.currentPinchDist&&(w.lastPinchDist=w.currentPinchDist,w.currentPinchDist=pe,w.lastPinchCenter=w.currentPinchCenter,w.currentPinchCenter=d(w.pinchGPoints[0].currentPos,w.pinchGPoints[1].currentPos),p.pinchHandler({eventSource:p,pointerType:"touch",gesturePoints:w.pinchGPoints,lastCenter:k(w.lastPinchCenter,p.element),center:k(w.currentPinchCenter,p.element),lastDistance:w.lastPinchDist,distance:w.currentPinchDist,shift:f.originalEvent.shiftKey,originalEvent:f.originalEvent,userData:p.userData}),f.preventDefault=!0)))}function he(p,f,y){var w=p.getActivePointersListByType(y.type),z;z=w.getById(y.id),z&&b(p,w,z)}function me(p,f,y){p.stopHandler&&p.stopHandler({eventSource:p,pointerType:y,position:C(f,p.element),buttons:p.getActivePointersListByType(y).buttons,isTouchEvent:y==="touch",originalEvent:f,userData:p.userData})}}(s),function(e){e.ControlAnchor={NONE:0,TOP_LEFT:1,TOP_RIGHT:2,BOTTOM_RIGHT:3,BOTTOM_LEFT:4,ABSOLUTE:5},e.Control=function(i,n,r){var l=i.parentNode;typeof n=="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"),n={anchor:n}),n.attachToViewer=typeof n.attachToViewer>"u"?!0:n.attachToViewer,this.autoFade=typeof n.autoFade>"u"?!0:n.autoFade,this.element=i,this.anchor=n.anchor,this.container=r,this.anchor===e.ControlAnchor.ABSOLUTE?(this.wrapper=e.makeNeutralElement("div"),this.wrapper.style.position="absolute",this.wrapper.style.top=typeof n.top=="number"?n.top+"px":n.top,this.wrapper.style.left=typeof n.left=="number"?n.left+"px":n.left,this.wrapper.style.height=typeof n.height=="number"?n.height+"px":n.height,this.wrapper.style.width=typeof n.width=="number"?n.width+"px":n.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),n.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):l.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(i){this.wrapper.style.display=i?this.anchor===e.ControlAnchor.ABSOLUTE?"block":"inline-block":"none"},setOpacity:function(i){this.element[e.SIGNAL]&&e.Browser.vendor===e.BROWSERS.IE?e.setElementOpacity(this.element,i,!0):e.setElementOpacity(this.wrapper,i,!0)}}}(s),function(e){e.ControlDock=function(n){var r=["topleft","topright","bottomright","bottomleft"],l,a;for(e.extend(!0,this,{id:"controldock-"+e.now()+"-"+Math.floor(Math.random()*1e6),container:e.makeNeutralElement("div"),controls:[]},n),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=0)){switch(r.anchor){case e.ControlAnchor.TOP_RIGHT:l=this.controls.topright,n.style.position="relative",n.style.paddingRight="0px",n.style.paddingTop="0px";break;case e.ControlAnchor.BOTTOM_RIGHT:l=this.controls.bottomright,n.style.position="relative",n.style.paddingRight="0px",n.style.paddingBottom="0px";break;case e.ControlAnchor.BOTTOM_LEFT:l=this.controls.bottomleft,n.style.position="relative",n.style.paddingLeft="0px",n.style.paddingBottom="0px";break;case e.ControlAnchor.TOP_LEFT:l=this.controls.topleft,n.style.position="relative",n.style.paddingLeft="0px",n.style.paddingTop="0px";break;case e.ControlAnchor.ABSOLUTE:l=this.container,n.style.margin="0px",n.style.padding="0px";break;default:case e.ControlAnchor.NONE:l=this.container,n.style.margin="0px",n.style.padding="0px";break}this.controls.push(new e.Control(n,r,l)),n.style.display="inline-block"}},removeControl:function(n){n=e.getElement(n);var r=i(this,n);return r>=0&&(this.controls[r].destroy(),this.controls.splice(r,1)),this},clearControls:function(){for(;this.controls.length>0;)this.controls.pop().destroy();return this},areControlsEnabled:function(){var n;for(n=this.controls.length-1;n>=0;n--)if(this.controls[n].isVisible())return!0;return!1},setControlsEnabled:function(n){var r;for(r=this.controls.length-1;r>=0;r--)this.controls[r].setVisible(n);return this}};function i(n,r){var l=n.controls,a;for(a=l.length-1;a>=0;a--)if(l[a].element===r)return a;return-1}}(s),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}}})}(s),function(e){var i={},n=1;e.Viewer=function(c){var v=arguments,b=this,O;if(e.isPlainObject(c)||(c={id:v[0],xmlPath:v.length>1?v[1]:void 0,prefixUrl:v.length>2?v[2]:void 0,controls:v.length>3?v[3]:void 0,overlays:v.length>4?v[4]:void 0}),c.config&&(e.extend(!0,c,c.config),delete c.config),e.extend(!0,this,{id:c.id,hash:c.hash||n++,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,c),typeof this.hash>"u")throw new Error("A hash must be defined, either by specifying options.id or options.hash.");for(typeof i[this.hash]<"u"&&e.console.warn("Hash "+this.hash+" has already been used."),i[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(H){var B=e.getString("Errors.OpenFailed",H.eventSource,H.message);b._showMessage(B)}),e.ControlDock.call(this,c),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(H){H.width="100%",H.height="100%",H.overflow="hidden",H.position="absolute",H.top="0px",H.left="0px"}(this.canvas.style),e.setElementTouchActionNone(this.canvas),c.tabIndex!==""&&(this.canvas.tabIndex=c.tabIndex===void 0?0:c.tabIndex),this.container.className="openseadragon-container",function(H){H.width="100%",H.height="100%",H.position="relative",H.overflow="hidden",H.left="0px",H.top="0px",H.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,C),keyDownHandler:e.delegate(this,k),keyHandler:e.delegate(this,d),clickHandler:e.delegate(this,_),dblClickHandler:e.delegate(this,S),dragHandler:e.delegate(this,M),dragEndHandler:e.delegate(this,I),enterHandler:e.delegate(this,V),leaveHandler:e.delegate(this,j),pressHandler:e.delegate(this,q),releaseHandler:e.delegate(this,K),nonPrimaryPressHandler:e.delegate(this,re),nonPrimaryReleaseHandler:e.delegate(this,ee),scrollHandler:e.delegate(this,ce),pinchHandler:e.delegate(this,fe)}),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,ye),leaveHandler:e.delegate(this,ae)}),this.toolbar&&(this.toolbar=new e.ControlDock({element:this.toolbar})),this.bindStandardControls(),i[this.hash].prevContainerSize=r(this.container),this.world=new e.World({viewer:this}),this.world.addHandler("add-item",function(H){b.source=b.world.getItemAt(0).source,i[b.hash].forceRedraw=!0,b._updateRequestId||(b._updateRequestId=u(b,oe))}),this.world.addHandler("remove-item",function(H){b.world.getItemCount()?b.source=b.world.getItemAt(0).source:b.source=null,i[b.hash].forceRedraw=!0}),this.world.addHandler("metrics-change",function(H){b.viewport&&b.viewport._setContentBounds(b.world.getHomeBounds(),b.world.getContentFactor())}),this.world.addHandler("item-index-change",function(H){b.source=b.world.getItemAt(0).source}),this.viewport=new e.Viewport({containerSize:i[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:c.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&&(O=this.buttonGroup.buttons.indexOf(this.rotateLeft),this.buttonGroup.buttons.splice(O,1),this.buttonGroup.element.removeChild(this.rotateLeft.element)),this.rotateRight&&(O=this.buttonGroup.buttons.indexOf(this.rotateRight),this.buttonGroup.buttons.splice(O,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),O=0;O-1&&c.index=0&&c=0)return this;var B=a(this,H);return this.currentOverlays.push(B),B.drawHTML(this.overlaysContainer,this.viewport),this.raiseEvent("add-overlay",{element:c,location:H.location,placement:H.placement}),this},updateOverlay:function(c,v,b){var O;return c=e.getElement(c),O=o(this.currentOverlays,c),O>=0&&(this.currentOverlays[O].update(v,b),i[this.hash].forceRedraw=!0,this.raiseEvent("update-overlay",{element:c,location:v,placement:b})),this},removeOverlay:function(c){var v;return c=e.getElement(c),v=o(this.currentOverlays,c),v>=0&&(this.currentOverlays[v].destroy(),this.currentOverlays.splice(v,1),i[this.hash].forceRedraw=!0,this.raiseEvent("remove-overlay",{element:c})),this},clearOverlays:function(){for(;this.currentOverlays.length>0;)this.currentOverlays.pop().destroy();return i[this.hash].forceRedraw=!0,this.raiseEvent("clear-overlay",{}),this},getOverlayById:function(c){var v;return c=e.getElement(c),v=o(this.currentOverlays,c),v>=0?this.currentOverlays[v]:null},_updateSequenceButtons:function(c){this.nextButton&&(!this.tileSources||this.tileSources.length-1===c?this.navPrevNextWrap||this.nextButton.disable():this.nextButton.enable()),this.previousButton&&(c>0?this.previousButton.enable():this.navPrevNextWrap||this.previousButton.disable())},_showMessage:function(c){this._hideMessage();var v=e.makeNeutralElement("div");v.appendChild(document.createTextNode(c)),this.messageDiv=e.makeCenteredNode(v),e.addClass(this.messageDiv,"openseadragon-message"),this.container.appendChild(this.messageDiv)},_hideMessage:function(){var c=this.messageDiv;c&&(c.parentNode.removeChild(c),delete this.messageDiv)},gestureSettingsByDeviceType:function(c){switch(c){case"mouse":return this.gestureSettingsMouse;case"touch":return this.gestureSettingsTouch;case"pen":return this.gestureSettingsPen;default:return this.gestureSettingsUnknown}},_drawOverlays:function(){var c,v=this.currentOverlays.length;for(c=0;c1&&(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 c=e.pixelDensityRatio,v=e.getCurrentPixelDensityRatio();c!==v&&(e.pixelDensityRatio=v,this.world.resetItems(),this.forceRedraw())},goToPreviousPage:function(){var c=this._sequenceIndex-1;this.navPrevNextWrap&&c<0&&(c+=this.tileSources.length),this.goToPage(c)},goToNextPage:function(){var c=this._sequenceIndex+1;this.navPrevNextWrap&&c>=this.tileSources.length&&(c=0),this.goToPage(c)}});function r(c){return c=e.getElement(c),new e.Point(c.clientWidth===0?1:c.clientWidth,c.clientHeight===0?1:c.clientHeight)}function l(c,v,b,O,H){var B=c;if(e.type(v)==="string"){if(v.match(/^\s*<.*>\s*$/))v=e.parseXml(v);else if(v.match(/^\s*[{[].*[}\]]\s*$/))try{var A=e.parseJSON(v);v=A}catch{}}function N(X,G){X.ready?O(X):(X.addHandler("ready",function(){O(X)}),X.addHandler("open-failed",function(U){H({message:U.message,source:G})}))}setTimeout(function(){if(e.type(v)==="string")v=new e.TileSource({url:v,crossOriginPolicy:b.crossOriginPolicy!==void 0?b.crossOriginPolicy:c.crossOriginPolicy,ajaxWithCredentials:c.ajaxWithCredentials,ajaxHeaders:b.ajaxHeaders?b.ajaxHeaders:c.ajaxHeaders,useCanvas:c.useCanvas,success:function(J){O(J.tileSource)}}),v.addHandler("open-failed",function(J){H(J)});else if(e.isPlainObject(v)||v.nodeType)if(v.crossOriginPolicy===void 0&&(b.crossOriginPolicy!==void 0||c.crossOriginPolicy!==void 0)&&(v.crossOriginPolicy=b.crossOriginPolicy!==void 0?b.crossOriginPolicy:c.crossOriginPolicy),v.ajaxWithCredentials===void 0&&(v.ajaxWithCredentials=c.ajaxWithCredentials),v.useCanvas===void 0&&(v.useCanvas=c.useCanvas),e.isFunction(v.getTileUrl)){var X=new e.TileSource(v);X.getTileUrl=v.getTileUrl,O(X)}else{var G=e.TileSource.determineType(B,v);if(!G){H({message:"Unable to load TileSource",source:v});return}var U=G.prototype.configure.apply(B,[v]);N(new G(U),v)}else N(v,v)})}function a(c,v){if(v instanceof e.Overlay)return v;var b=null;if(v.element)b=e.getElement(v.element);else{var O=v.id?v.id:"openseadragon-overlay-"+Math.floor(Math.random()*1e7);b=e.getElement(v.id),b||(b=document.createElement("a"),b.href="#/overlay/"+O),b.id=O,e.addClass(b,v.className?v.className:"openseadragon-overlay")}var H=v.location,B=v.width,A=v.height;if(!H){var N=v.x,X=v.y;if(v.px!==void 0){var G=c.viewport.imageToViewportRectangle(new e.Rect(v.px,v.py,B||0,A||0));N=G.x,X=G.y,B=B!==void 0?G.width:void 0,A=A!==void 0?G.height:void 0}H=new e.Point(N,X)}var U=v.placement;return U&&e.type(U)==="string"&&(U=e.Placement[v.placement.toUpperCase()]),new e.Overlay({element:b,location:H,placement:U,onDraw:v.onDraw,checkResize:v.checkResize,width:B,height:A,rotationMode:v.rotationMode})}function o(c,v){var b;for(b=c.length-1;b>=0;b--)if(c[b].element===v)return b;return-1}function u(c,v){return e.requestAnimationFrame(function(){v(c)})}function h(c){e.requestAnimationFrame(function(){m(c)})}function g(c){c.autoHideControls&&(c.controlsShouldFade=!0,c.controlsFadeBeginTime=e.now()+c.controlsFadeDelay,window.setTimeout(function(){h(c)},c.controlsFadeDelay))}function m(c){var v,b,O,H;if(c.controlsShouldFade){for(v=e.now(),b=v-c.controlsFadeBeginTime,O=1-b/c.controlsFadeLength,O=Math.min(1,O),O=Math.max(0,O),H=c.controls.length-1;H>=0;H--)c.controls[H].autoFade&&c.controls[H].setOpacity(O);O>0&&h(c)}}function T(c){var v;for(c.controlsShouldFade=!1,v=c.controls.length-1;v>=0;v--)c.controls[v].setOpacity(1)}function x(){T(this)}function P(){g(this)}function C(c){var v={tracker:c.eventSource,position:c.position,originalEvent:c.originalEvent,preventDefault:c.preventDefault};this.raiseEvent("canvas-contextmenu",v),c.preventDefault=v.preventDefault}function k(c){var v={originalEvent:c.originalEvent,preventDefaultAction:!1,preventVerticalPan:c.preventVerticalPan,preventHorizontalPan:c.preventHorizontalPan};if(this.raiseEvent("canvas-key",v),!v.preventDefaultAction&&!c.ctrl&&!c.alt&&!c.meta)switch(c.keyCode){case 38:v.preventVerticalPan||(c.shift?this.viewport.zoomBy(1.1):this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(0,-this.pixelsPerArrowPress))),this.viewport.applyConstraints()),c.preventDefault=!0;break;case 40:v.preventVerticalPan||(c.shift?this.viewport.zoomBy(.9):this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(0,this.pixelsPerArrowPress))),this.viewport.applyConstraints()),c.preventDefault=!0;break;case 37:v.preventHorizontalPan||(this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(-this.pixelsPerArrowPress,0))),this.viewport.applyConstraints()),c.preventDefault=!0;break;case 39:v.preventHorizontalPan||(this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(this.pixelsPerArrowPress,0))),this.viewport.applyConstraints()),c.preventDefault=!0;break;default:c.preventDefault=!1;break}else c.preventDefault=!1}function d(c){var v={originalEvent:c.originalEvent,preventDefaultAction:!1,preventVerticalPan:c.preventVerticalPan,preventHorizontalPan:c.preventHorizontalPan};if(this.raiseEvent("canvas-key",v),!v.preventDefaultAction&&!c.ctrl&&!c.alt&&!c.meta)switch(c.keyCode){case 43:case 61:this.viewport.zoomBy(1.1),this.viewport.applyConstraints(),c.preventDefault=!0;break;case 45:this.viewport.zoomBy(.9),this.viewport.applyConstraints(),c.preventDefault=!0;break;case 48:this.viewport.goHome(),this.viewport.applyConstraints(),c.preventDefault=!0;break;case 119:case 87:v.preventVerticalPan||(c.shift?this.viewport.zoomBy(1.1):this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(0,-40))),this.viewport.applyConstraints()),c.preventDefault=!0;break;case 115:case 83:v.preventVerticalPan||(c.shift?this.viewport.zoomBy(.9):this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(0,40))),this.viewport.applyConstraints()),c.preventDefault=!0;break;case 97:v.preventHorizontalPan||(this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(-40,0))),this.viewport.applyConstraints()),c.preventDefault=!0;break;case 100:v.preventHorizontalPan||(this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(40,0))),this.viewport.applyConstraints()),c.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(),c.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(),c.preventDefault=!0;break;case 102:this.viewport.toggleFlip(),c.preventDefault=!0;break;case 106:this.goToPreviousPage();break;case 107:this.goToNextPage();break;default:c.preventDefault=!1;break}else c.preventDefault=!1}function _(c){var v,b=document.activeElement===this.canvas;b||this.canvas.focus(),this.viewport.flipped&&(c.position.x=this.viewport.getContainerSize().x-c.position.x);var O={tracker:c.eventSource,position:c.position,quick:c.quick,shift:c.shift,originalEvent:c.originalEvent,originalTarget:c.originalTarget,preventDefaultAction:!1};this.raiseEvent("canvas-click",O),!O.preventDefaultAction&&this.viewport&&c.quick&&(v=this.gestureSettingsByDeviceType(c.pointerType),v.clickToZoom&&(this.viewport.zoomBy(c.shift?1/this.zoomPerClick:this.zoomPerClick,v.zoomToRefPoint?this.viewport.pointFromPixel(c.position,!0):null),this.viewport.applyConstraints()))}function S(c){var v,b={tracker:c.eventSource,position:c.position,shift:c.shift,originalEvent:c.originalEvent,preventDefaultAction:!1};this.raiseEvent("canvas-double-click",b),!b.preventDefaultAction&&this.viewport&&(v=this.gestureSettingsByDeviceType(c.pointerType),v.dblClickToZoom&&(this.viewport.zoomBy(c.shift?1/this.zoomPerClick:this.zoomPerClick,v.zoomToRefPoint?this.viewport.pointFromPixel(c.position,!0):null),this.viewport.applyConstraints()))}function M(c){var v,b={tracker:c.eventSource,pointerType:c.pointerType,position:c.position,delta:c.delta,speed:c.speed,direction:c.direction,shift:c.shift,originalEvent:c.originalEvent,preventDefaultAction:!1};if(this.raiseEvent("canvas-drag",b),v=this.gestureSettingsByDeviceType(c.pointerType),v.dragToPan&&!b.preventDefaultAction&&this.viewport){if(this.panHorizontal||(c.delta.x=0),this.panVertical||(c.delta.y=0),this.viewport.flipped&&(c.delta.x=-c.delta.x),this.constrainDuringPan){var O=this.viewport.deltaPointsFromPixels(c.delta.negate());this.viewport.centerSpringX.target.value+=O.x,this.viewport.centerSpringY.target.value+=O.y;var H=this.viewport.getBounds(),B=this.viewport.getConstrainedBounds();this.viewport.centerSpringX.target.value-=O.x,this.viewport.centerSpringY.target.value-=O.y,H.x!==B.x&&(c.delta.x=0),H.y!==B.y&&(c.delta.y=0)}this.viewport.panBy(this.viewport.deltaPointsFromPixels(c.delta.negate()),v.flickEnabled&&!this.constrainDuringPan)}}function I(c){var v={tracker:c.eventSource,pointerType:c.pointerType,position:c.position,speed:c.speed,direction:c.direction,shift:c.shift,originalEvent:c.originalEvent,preventDefaultAction:!1};if(this.raiseEvent("canvas-drag-end",v),!v.preventDefaultAction&&this.viewport){var b=this.gestureSettingsByDeviceType(c.pointerType);if(b.flickEnabled&&c.speed>=b.flickMinSpeed){var O=0;this.panHorizontal&&(O=b.flickMomentum*c.speed*Math.cos(c.direction));var H=0;this.panVertical&&(H=b.flickMomentum*c.speed*Math.sin(c.direction));var B=this.viewport.pixelFromPoint(this.viewport.getCenter(!0)),A=this.viewport.pointFromPixel(new e.Point(B.x-O,B.y-H));this.viewport.panTo(A,!1)}this.viewport.applyConstraints()}}function V(c){this.raiseEvent("canvas-enter",{tracker:c.eventSource,pointerType:c.pointerType,position:c.position,buttons:c.buttons,pointers:c.pointers,insideElementPressed:c.insideElementPressed,buttonDownAny:c.buttonDownAny,originalEvent:c.originalEvent})}function j(c){this.raiseEvent("canvas-exit",{tracker:c.eventSource,pointerType:c.pointerType,position:c.position,buttons:c.buttons,pointers:c.pointers,insideElementPressed:c.insideElementPressed,buttonDownAny:c.buttonDownAny,originalEvent:c.originalEvent})}function q(c){this.raiseEvent("canvas-press",{tracker:c.eventSource,pointerType:c.pointerType,position:c.position,insideElementPressed:c.insideElementPressed,insideElementReleased:c.insideElementReleased,originalEvent:c.originalEvent})}function K(c){this.raiseEvent("canvas-release",{tracker:c.eventSource,pointerType:c.pointerType,position:c.position,insideElementPressed:c.insideElementPressed,insideElementReleased:c.insideElementReleased,originalEvent:c.originalEvent})}function re(c){this.raiseEvent("canvas-nonprimary-press",{tracker:c.eventSource,position:c.position,pointerType:c.pointerType,button:c.button,buttons:c.buttons,originalEvent:c.originalEvent})}function ee(c){this.raiseEvent("canvas-nonprimary-release",{tracker:c.eventSource,position:c.position,pointerType:c.pointerType,button:c.button,buttons:c.buttons,originalEvent:c.originalEvent})}function fe(c){var v,b,O,H,B={tracker:c.eventSource,pointerType:c.pointerType,gesturePoints:c.gesturePoints,lastCenter:c.lastCenter,center:c.center,lastDistance:c.lastDistance,distance:c.distance,shift:c.shift,originalEvent:c.originalEvent,preventDefaultPanAction:!1,preventDefaultZoomAction:!1,preventDefaultRotateAction:!1};if(this.raiseEvent("canvas-pinch",B),this.viewport&&(v=this.gestureSettingsByDeviceType(c.pointerType),v.pinchToZoom&&(!B.preventDefaultPanAction||!B.preventDefaultZoomAction)&&(b=this.viewport.pointFromPixel(c.center,!0),B.preventDefaultZoomAction||this.viewport.zoomBy(c.distance/c.lastDistance,b,!0),v.zoomToRefPoint&&!B.preventDefaultPanAction&&(O=this.viewport.pointFromPixel(c.lastCenter,!0),H=O.minus(b),this.panHorizontal||(H.x=0),this.panVertical||(H.y=0),this.viewport.panBy(H,!0)),this.viewport.applyConstraints()),v.pinchRotate&&!B.preventDefaultRotateAction)){var A=Math.atan2(c.gesturePoints[0].currentPos.y-c.gesturePoints[1].currentPos.y,c.gesturePoints[0].currentPos.x-c.gesturePoints[1].currentPos.x),N=Math.atan2(c.gesturePoints[0].lastPos.y-c.gesturePoints[1].lastPos.y,c.gesturePoints[0].lastPos.x-c.gesturePoints[1].lastPos.x);this.viewport.setRotation(this.viewport.getRotation()+(A-N)*(180/Math.PI))}}function ce(c){var v,b,O,H,B;H=e.now(),B=H-this._lastScrollTime,B>this.minScrollDeltaTime?(this._lastScrollTime=H,v={tracker:c.eventSource,position:c.position,scroll:c.scroll,shift:c.shift,originalEvent:c.originalEvent,preventDefaultAction:!1,preventDefault:!0},this.raiseEvent("canvas-scroll",v),!v.preventDefaultAction&&this.viewport&&(this.viewport.flipped&&(c.position.x=this.viewport.getContainerSize().x-c.position.x),b=this.gestureSettingsByDeviceType(c.pointerType),b.scrollToZoom&&(O=Math.pow(this.zoomPerScroll,c.scroll),this.viewport.zoomBy(O,b.zoomToRefPoint?this.viewport.pointFromPixel(c.position,!0):null),this.viewport.applyConstraints())),c.preventDefault=v.preventDefault):c.preventDefault=!0}function ye(c){i[this.hash].mouseInside=!0,T(this),this.raiseEvent("container-enter",{tracker:c.eventSource,pointerType:c.pointerType,position:c.position,buttons:c.buttons,pointers:c.pointers,insideElementPressed:c.insideElementPressed,buttonDownAny:c.buttonDownAny,originalEvent:c.originalEvent})}function ae(c){c.pointers<1&&(i[this.hash].mouseInside=!1,i[this.hash].animating||g(this)),this.raiseEvent("container-exit",{tracker:c.eventSource,pointerType:c.pointerType,position:c.position,buttons:c.buttons,pointers:c.pointers,insideElementPressed:c.insideElementPressed,buttonDownAny:c.buttonDownAny,originalEvent:c.originalEvent})}function oe(c){ie(c),c.isOpen()?c._updateRequestId=u(c,oe):c._updateRequestId=!1}function ie(c){if(!(c._opening||!i[c.hash])){if(c.autoResize){var v=r(c.container),b=i[c.hash].prevContainerSize;if(!v.equals(b)){var O=c.viewport;if(c.preserveImageSizeOnResize){var H=b.x/v.x,B=O.getZoom()*H,A=O.getCenter();O.resize(v,!1),O.zoomTo(B,null,!0),O.panTo(A,!0)}else{var N=O.getBounds();O.resize(v,!0),O.fitBoundsWithConstraints(N,!0)}i[c.hash].prevContainerSize=v,i[c.hash].forceRedraw=!0}}var X=c.viewport.update(),G=c.world.update()||X;X&&c.raiseEvent("viewport-change"),c.referenceStrip&&(G=c.referenceStrip.update(c.viewport)||G),!i[c.hash].animating&&G&&(c.raiseEvent("animation-start"),T(c)),(G||i[c.hash].forceRedraw||c.world.needsDraw())&&(we(c),c._drawOverlays(),c.navigator&&c.navigator.update(c.viewport),i[c.hash].forceRedraw=!1,G&&c.raiseEvent("animation")),i[c.hash].animating&&!G&&(c.raiseEvent("animation-finish"),i[c.hash].mouseInside||g(c)),i[c.hash].animating=G}}function we(c){c.imageLoader.clear(),c.drawer.clear(),c.world.draw(),c.raiseEvent("update-viewport",{})}function Q(c,v){return c?c+v:v}function Ce(){i[this.hash].lastZoomTime=e.now(),i[this.hash].zoomFactor=this.zoomPerSecond,i[this.hash].zooming=!0,nt(this)}function Ae(){i[this.hash].lastZoomTime=e.now(),i[this.hash].zoomFactor=1/this.zoomPerSecond,i[this.hash].zooming=!0,nt(this)}function ft(){i[this.hash].zooming=!1}function nt(c){e.requestAnimationFrame(e.delegate(c,Pt))}function Pt(){var c,v,b;i[this.hash].zooming&&this.viewport&&(c=e.now(),v=c-i[this.hash].lastZoomTime,b=Math.pow(i[this.hash].zoomFactor,v/1e3),this.viewport.zoomBy(b),this.viewport.applyConstraints(),i[this.hash].lastZoomTime=c,nt(this))}function Be(){this.viewport&&(i[this.hash].zooming=!1,this.viewport.zoomBy(this.zoomPerClick/1),this.viewport.applyConstraints())}function $e(){this.viewport&&(i[this.hash].zooming=!1,this.viewport.zoomBy(1/this.zoomPerClick),this.viewport.applyConstraints())}function pt(){this.buttonGroup&&(this.buttonGroup.emulateEnter(),this.buttonGroup.emulateLeave())}function Ze(){this.viewport&&this.viewport.goHome()}function st(){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 rt(){if(this.viewport){var c=this.viewport.getRotation();this.viewport.flipped?c=e.positiveModulo(c+this.rotationIncrement,360):c=e.positiveModulo(c-this.rotationIncrement,360),this.viewport.setRotation(c)}}function E(){if(this.viewport){var c=this.viewport.getRotation();this.viewport.flipped?c=e.positiveModulo(c-this.rotationIncrement,360):c=e.positiveModulo(c+this.rotationIncrement,360),this.viewport.setRotation(c)}}function R(){this.viewport.toggleFlip()}}(s),function(e){e.Navigator=function(u){var h=u.viewer,g=this,m,T;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=h.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(C,k){C.margin="0px",C.border=k+"px solid "+u.borderColor,C.padding="0px",C.background=u.background,C.opacity=u.opacity,C.overflow="hidden"}(this.element.style,this.borderWidth),this.displayRegion=e.makeNeutralElement("div"),this.displayRegion.id=this.element.id+"-displayregion",this.displayRegion.className="displayregion",function(C,k){C.position="relative",C.top="0px",C.left="0px",C.fontSize="0px",C.overflow="hidden",C.border=k+"px solid "+u.displayRegionColor,C.margin="0px",C.padding="0px",C.background="transparent",C.float="left",C.cssFloat="left",C.styleFloat="left",C.zIndex=999999999,C.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),h.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&&(m=e.getElementSize(h.element),this.element.style.height=Math.round(m.y*u.sizeRatio)+"px",this.element.style.width=Math.round(m.x*u.sizeRatio)+"px",this.oldViewerSize=m,T=e.getElementSize(this.element),this.elementArea=T.x*T.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 x(C){a(g.displayRegionContainer,C),a(g.displayRegion,-C),g.viewport.setRotation(C)}if(u.navigatorRotate){var P=u.viewer.viewport?u.viewer.viewport.getRotation():u.viewer.degrees||0;x(P),u.viewer.addHandler("rotate",function(C){x(C.degrees)})}this.innerTracker.destroy(),this.innerTracker=new e.MouseTracker({userData:"Navigator.innerTracker",element:this.element,dragHandler:e.delegate(this,n),clickHandler:e.delegate(this,i),releaseHandler:e.delegate(this,r),scrollHandler:e.delegate(this,l),preProcessEventHandler:function(C){C.eventType==="wheel"&&(C.preventDefault=!0)}}),this.outerTracker.userData="Navigator.outerTracker",e.setElementPointerEventsNone(this.canvas),e.setElementPointerEventsNone(this.container),this.addHandler("reset-size",function(){g.viewport&&g.viewport.goHome(!0)}),h.world.addHandler("item-index-change",function(C){window.setTimeout(function(){var k=g.world.getItemAt(C.previousIndex);g.world.setItemIndex(k,C.newIndex)},1)}),h.world.addHandler("remove-item",function(C){var k=C.item,d=g._getMatchingItem(k);d&&g.world.removeItem(d)}),this.update(h.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){o(this.displayRegion,u),o(this.canvas,u),o(this.element,u)},update:function(u){var h,g,m,T,x,P;if(h=e.getElementSize(this.viewer.element),this._resizeWithViewer&&h.x&&h.y&&!h.equals(this.oldViewerSize)&&(this.oldViewerSize=h,this.maintainSizeRatio||!this.elementArea?(g=h.x*this.sizeRatio,m=h.y*this.sizeRatio):(g=Math.sqrt(this.elementArea*(h.x/h.y)),m=this.elementArea/g),this.element.style.width=Math.round(g)+"px",this.element.style.height=Math.round(m)+"px",this.elementArea||(this.elementArea=g*m),this.updateSize()),u&&this.viewport){T=u.getBoundsNoRotate(!0),x=this.viewport.pixelFromPointNoRotate(T.getTopLeft(),!1),P=this.viewport.pixelFromPointNoRotate(T.getBottomRight(),!1).minus(this.totalBorderWidths);var C=this.displayRegion.style;C.display=this.world.getItemCount()?"block":"none",C.top=Math.round(x.y)+"px",C.left=Math.round(x.x)+"px";var k=Math.abs(x.x-P.x),d=Math.abs(x.y-P.y);C.width=Math.round(Math.max(k,0))+"px",C.height=Math.round(Math.max(d,0))+"px"}},addTiledImage:function(u){var h=this,g=u.originalTiledImage;delete u.original;var m=e.extend({},u,{success:function(T){var x=T.item;x._originalForNavigator=g,h._matchBounds(x,g,!0),h._matchOpacity(x,g),h._matchCompositeOperation(x,g);function P(){h._matchBounds(x,g)}function C(){h._matchOpacity(x,g)}function k(){h._matchCompositeOperation(x,g)}g.addHandler("bounds-change",P),g.addHandler("clip-change",P),g.addHandler("opacity-change",C),g.addHandler("composite-operation-change",k)}});return e.Viewer.prototype.addTiledImage.apply(this,[m])},destroy:function(){return e.Viewer.prototype.destroy.apply(this)},_getMatchingItem:function(u){for(var h=this.world.getItemCount(),g,m=0;m1||r.y>1));n++);return n-1},getTileAtPoint:function(n,r){var l=r.x>=0&&r.x<=1&&r.y>=0&&r.y<=1/this.aspectRatio;e.console.assert(l,"[TileSource.getTileAtPoint] must be called with a valid point.");var a=this.dimensions.x*this.getLevelScale(n),o=r.x*a,u=r.y*a,h=Math.floor(o/this.getTileWidth(n)),g=Math.floor(u/this.getTileHeight(n));r.x>=1&&(h=this.getNumTiles(n).x-1);var m=1e-15;return r.y>=1/this.aspectRatio-m&&(g=this.getNumTiles(n).y-1),new e.Point(h,g)},getTileBounds:function(n,r,l,a){var o=this.dimensions.times(this.getLevelScale(n)),u=this.getTileWidth(n),h=this.getTileHeight(n),g=r===0?0:u*r-this.tileOverlap,m=l===0?0:h*l-this.tileOverlap,T=u+(r===0?1:2)*this.tileOverlap,x=h+(l===0?1:2)*this.tileOverlap,P=1/o.x;return T=Math.min(T,o.x-g),x=Math.min(x,o.y-m),a?new e.Rect(0,0,T,x):new e.Rect(g*P,m*P,T*P,x*P)},getImageInfo:function(n){var r=this,l,a,o,u,h,g,m;n&&(h=n.split("/"),g=h[h.length-1],m=g.lastIndexOf("."),m>-1&&(h[h.length-1]=g.slice(0,m))),a=function(T){typeof T=="string"&&(T=e.parseXml(T));var x=e.TileSource.determineType(r,T,n);if(!x){r.raiseEvent("open-failed",{message:"Unable to load TileSource",source:n});return}u=x.prototype.configure.apply(r,[T,n]),u.ajaxWithCredentials===void 0&&(u.ajaxWithCredentials=r.ajaxWithCredentials),o=new x(u),r.ready=!0,r.raiseEvent("ready",{tileSource:o})},n.match(/\.js$/)?(l=n.split("/").pop().replace(".js",""),e.jsonp({url:n,async:!1,callbackName:l,callback:a})):e.makeAjaxRequest({url:n,withCredentials:this.ajaxWithCredentials,headers:this.ajaxHeaders,success:function(T){var x=i(T);a(x)},error:function(T,x){var P;try{P="HTTP "+T.status+" attempting to load TileSource"}catch{var C;typeof x>"u"||!x.toString?C="Unknown error":C=x.toString(),P=C+" attempting to load TileSource"}r.raiseEvent("open-failed",{message:P,source:n})}})},supports:function(n,r){return!1},configure:function(n,r){throw new Error("Method not implemented.")},getTileUrl:function(n,r,l){throw new Error("Method not implemented.")},getTileAjaxHeaders:function(n,r,l){return{}},tileExists:function(n,r,l){var a=this.getNumTiles(n);return n>=this.minLevel&&n<=this.maxLevel&&r>=0&&l>=0&&r=0;x--)for(P=this.displayRects[x],C=P.minLevel;C<=P.maxLevel;C++)this._levelRects[C]||(this._levelRects[C]=[]),this._levelRects[C].push(P);e.TileSource.apply(this,[k])},e.extend(e.DziTileSource.prototype,e.TileSource.prototype,{supports:function(r,l){var a;return r.Image?a=r.Image.xmlns:r.documentElement&&(r.documentElement.localName==="Image"||r.documentElement.tagName==="Image")&&(a=r.documentElement.namespaceURI),a=(a||"").toLowerCase(),a.indexOf("schemas.microsoft.com/deepzoom/2008")!==-1||a.indexOf("schemas.microsoft.com/deepzoom/2009")!==-1},configure:function(r,l){var a;return e.isPlainObject(r)?a=n(this,r):a=i(this,r),l&&!a.tilesUrl&&(a.tilesUrl=l.replace(/([^/]+?)(\.(dzi|xml|js)?(\?[^/]*)?)?\/?$/,"$1_files/"),l.search(/\.(dzi|xml|js)\?/)!==-1?a.queryParams=l.match(/\?.*/):a.queryParams=""),a},getTileUrl:function(r,l,a){return[this.tilesUrl,r,"/",l,"_",a,".",this.fileFormat,this.queryParams].join("")},tileExists:function(r,l,a){var o=this._levelRects[r],u,h,g,m,T,x,P;if(this.minLevel&&rthis.maxLevel)return!1;if(!o||!o.length)return!0;for(P=o.length-1;P>=0;P--)if(u=o[P],!(ru.maxLevel)&&(h=this.getLevelScale(r),g=u.x*h,m=u.y*h,T=g+u.width*h,x=m+u.height*h,g=Math.floor(g/this._tileWidth),m=Math.floor(m/this._tileWidth),T=Math.ceil(T/this._tileWidth),x=Math.ceil(x/this._tileWidth),g<=l&&l0?a.tileSize=Math.max.apply(null,T):a.tileSize=g}else this.sizes&&this.sizes.length>0?(this.emulateLegacyImagePyramid=!0,a.levels=n(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 P=Math.max.apply(null,this.scale_factors);a.maxLevel=Math.round(Math.log(P)*Math.LOG2E)}e.TileSource.apply(this,[a])},e.extend(e.IIIFTileSource.prototype,e.TileSource.prototype,{supports:function(a,o){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,o){if(e.isPlainObject(a)){if(!a["@context"])a["@context"]="http://iiif.io/api/image/1.0/context.json",a["@id"]=o.replace("/info.json",""),a.version=1;else{var h=a["@context"];if(Array.isArray(h)){for(var g=0;g0&&a>=this.minLevel&&a<=this.maxLevel&&(o=this.levels[a].width/this.levels[this.maxLevel].width),o}return e.TileSource.prototype.getLevelScale.call(this,a)},getNumTiles:function(a){if(this.emulateLegacyImagePyramid){var o=this.getLevelScale(a);return o?new e.Point(1,1):new e.Point(0,0)}return e.TileSource.prototype.getNumTiles.call(this,a)},getTileAtPoint:function(a,o){return this.emulateLegacyImagePyramid?new e.Point(0,0):e.TileSource.prototype.getTileAtPoint.call(this,a,o)},getTileUrl:function(a,o,u){if(this.emulateLegacyImagePyramid){var h=null;return this.levels.length>0&&a>=this.minLevel&&a<=this.maxLevel&&(h=this.levels[a].url),h}var g="0",m=Math.pow(.5,this.maxLevel-a),T=Math.ceil(this.width*m),x=Math.ceil(this.height*m),P,C,k,d,_,S,M,I,V,j,q,K,re,ee;return P=this.getTileWidth(a),C=this.getTileHeight(a),k=Math.ceil(P/m),d=Math.ceil(C/m),this.version===1?re="native."+this.tileFormat:re="default."+this.tileFormat,T1&&a.profile[1].supports&&(g=a.profile[1].supports.indexOf("sizeByW")!==-1),a.version===3&&a.extraFeatures&&(g=a.extraFeatures.indexOf("sizeByWh")!==-1),!h||g}function n(a){for(var o=[],u=0;uh?g=u/256:g=h/256,o.maxLevel=Math.ceil(Math.log(g)/Math.log(2))-1,o.tileSize=256,o.width=u,o.height=h,e.TileSource.apply(this,[o])},e.extend(e.TmsTileSource.prototype,e.TileSource.prototype,{supports:function(i,n){return i.type&&i.type==="tiledmapservice"},configure:function(i,n){return i},getTileUrl:function(i,n,r){var l=this.getNumTiles(i).y-1;return this.tilesUrl+i+"/"+n+"/"+(l-r)+".png"}})}(s),function(e){e.ZoomifyTileSource=function(i){typeof i.tileSize>"u"&&(i.tileSize=256),typeof i.fileFormat>"u"&&(i.fileFormat="jpg",this.fileFormat=i.fileFormat);var n={x:i.width,y:i.height};for(i.imageSizes=[{x:i.width,y:i.height}],i.gridSize=[this._getGridSize(i.width,i.height,i.tileSize)];parseInt(n.x,10)>i.tileSize||parseInt(n.y,10)>i.tileSize;)n.x=Math.floor(n.x/2),n.y=Math.floor(n.y/2),i.imageSizes.push({x:n.x,y:n.y}),i.gridSize.push(this._getGridSize(n.x,n.y,i.tileSize));i.imageSizes.reverse(),i.gridSize.reverse(),i.minLevel=0,i.maxLevel=i.gridSize.length-1,s.TileSource.apply(this,[i])},e.extend(e.ZoomifyTileSource.prototype,e.TileSource.prototype,{_getGridSize:function(i,n,r){return{x:Math.ceil(i/r),y:Math.ceil(n/r)}},_calculateAbsoluteTileNumber:function(i,n,r){for(var l=0,a={},o=0;o0?(o=a.levels[a.levels.length-1].width,u=a.levels[a.levels.length-1].height):(o=0,u=0,e.console.error("No supported image formats found")),e.extend(!0,a,{width:o,height:u,tileSize:Math.max(u,o),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(l,a){return l.type&&l.type==="legacy-image-pyramid"||l.documentElement&&l.documentElement.getAttribute("type")==="legacy-image-pyramid"},configure:function(l,a){var o;return e.isPlainObject(l)?o=r(this,l):o=n(this,l),o},getLevelScale:function(l){var a=NaN;return this.levels.length>0&&l>=this.minLevel&&l<=this.maxLevel&&(a=this.levels[l].width/this.levels[this.maxLevel].width),a},getNumTiles:function(l){var a=this.getLevelScale(l);return a?new e.Point(1,1):new e.Point(0,0)},getTileUrl:function(l,a,o){var u=null;return this.levels.length>0&&l>=this.minLevel&&l<=this.maxLevel&&(u=this.levels[l].url),u}});function i(l){var a=[],o,u;for(u=0;u");return a.sort(function(h,g){return h.height-g.height})}function n(l,a){if(!a||!a.documentElement)throw new Error(e.getString("Errors.Xml"));var o=a.documentElement,u=o.tagName,h=null,g=[],m,T;if(u==="image")try{for(h={type:o.getAttribute("type"),levels:[]},g=o.getElementsByTagName("level"),T=0;T=this.minLevel&&i<=this.maxLevel&&(n=this.levels[i].width/this.levels[this.maxLevel].width),n},getNumTiles:function(i){var n=this.getLevelScale(i);return n?new e.Point(1,1):new e.Point(0,0)},getTileUrl:function(i,n,r){var l=null;return i>=this.minLevel&&i<=this.maxLevel&&(l=this.levels[i].url),l},getContext2D:function(i,n,r){var l=null;return i>=this.minLevel&&i<=this.maxLevel&&(l=this.levels[i].context2D),l},destroy:function(){this._freeupCanvasMemory()},_buildLevels:function(){var i=[{url:this._image.src,width:this._image.naturalWidth,height:this._image.naturalHeight}];if(!this.buildPyramid||!e.supportsCanvas||!this.useCanvas)return delete this._image,i;var n=this._image.naturalWidth,r=this._image.naturalHeight,l=document.createElement("canvas"),a=l.getContext("2d");if(l.width=n,l.height=r,a.drawImage(this._image,0,0,n,r),i[0].context2D=a,delete this._image,e.isCanvasTainted(l))return i;for(;n>=2&&r>=2;){n=Math.floor(n/2),r=Math.floor(r/2);var o=document.createElement("canvas"),u=o.getContext("2d");o.width=n,o.height=r,u.drawImage(l,0,0,n,r),i.splice(0,0,{context2D:u,width:n,height:r}),l=o,a=u}return i},_freeupCanvasMemory:function(){for(var i=0;i0&&i(u))}function r(u){u.shouldFade=!0,u.fadeBeginTime=e.now()+u.fadeDelay,window.setTimeout(function(){i(u)},u.fadeDelay)}function l(u){u.shouldFade=!1,u.imgGroup&&e.setElementOpacity(u.imgGroup,1,!0)}function a(u,h){u.element.disabled||(h>=e.ButtonState.GROUP&&u.currentState===e.ButtonState.REST&&(l(u),u.currentState=e.ButtonState.GROUP),h>=e.ButtonState.HOVER&&u.currentState===e.ButtonState.GROUP&&(u.imgHover&&(u.imgHover.style.visibility=""),u.currentState=e.ButtonState.HOVER),h>=e.ButtonState.DOWN&&u.currentState===e.ButtonState.HOVER&&(u.imgDown&&(u.imgDown.style.visibility=""),u.currentState=e.ButtonState.DOWN))}function o(u,h){u.element.disabled||(h<=e.ButtonState.HOVER&&u.currentState===e.ButtonState.DOWN&&(u.imgDown&&(u.imgDown.style.visibility="hidden"),u.currentState=e.ButtonState.HOVER),h<=e.ButtonState.GROUP&&u.currentState===e.ButtonState.HOVER&&(u.imgHover&&(u.imgHover.style.visibility="hidden"),u.currentState=e.ButtonState.GROUP),h<=e.ButtonState.REST&&u.currentState===e.ButtonState.GROUP&&(r(u),u.currentState=e.ButtonState.REST))}}(s),function(e){e.ButtonGroup=function(i){e.extend(!0,this,{buttons:[],clickTimeThreshold:e.DEFAULT_SETTINGS.clickTimeThreshold,clickDistThreshold:e.DEFAULT_SETTINGS.clickDistThreshold,labelText:""},i);var n=this.buttons.concat([]),r=this,l;if(this.element=i.element||e.makeNeutralElement("div"),!i.group)for(this.element.style.display="inline-block",l=0;l=270?(o=this.getTopRight(),this.x=o.x,this.y=o.y,u=this.height,this.height=this.width,this.width=u,this.degrees-=270):this.degrees>=180?(o=this.getBottomRight(),this.x=o.x,this.y=o.y,this.degrees-=180):this.degrees>=90&&(o=this.getBottomLeft(),this.x=o.x,this.y=o.y,u=this.height,this.height=this.width,this.width=u,this.degrees-=90)},e.Rect.fromSummits=function(i,n,r){var l=i.distanceTo(n),a=i.distanceTo(r),o=n.minus(i),u=Math.atan(o.y/o.x);return o.x<0?u+=Math.PI:o.y<0&&(u+=2*Math.PI),new e.Rect(i.x,i.y,l,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(i){return i instanceof e.Rect&&this.x===i.x&&this.y===i.y&&this.width===i.width&&this.height===i.height&&this.degrees===i.degrees},times:function(i){return new e.Rect(this.x*i,this.y*i,this.width*i,this.height*i,this.degrees)},translate:function(i){return new e.Rect(this.x+i.x,this.y+i.y,this.width,this.height,this.degrees)},union:function(i){var n=this.getBoundingBox(),r=i.getBoundingBox(),l=Math.min(n.x,r.x),a=Math.min(n.y,r.y),o=Math.max(n.x+n.width,r.x+r.width),u=Math.max(n.y+n.height,r.y+r.height);return new e.Rect(l,a,o-l,u-a)},intersection:function(i){var n=1e-10,r=[],l=this.getTopLeft();i.containsPoint(l,n)&&r.push(l);var a=this.getTopRight();i.containsPoint(a,n)&&r.push(a);var o=this.getBottomLeft();i.containsPoint(o,n)&&r.push(o);var u=this.getBottomRight();i.containsPoint(u,n)&&r.push(u);var h=i.getTopLeft();this.containsPoint(h,n)&&r.push(h);var g=i.getTopRight();this.containsPoint(g,n)&&r.push(g);var m=i.getBottomLeft();this.containsPoint(m,n)&&r.push(m);var T=i.getBottomRight();this.containsPoint(T,n)&&r.push(T);for(var x=this._getSegments(),P=i._getSegments(),C=0;CV&&(V=re.x),re.yq&&(q=re.y)}return new e.Rect(I,j,V-I,q-j)},_getSegments:function(){var i=this.getTopLeft(),n=this.getTopRight(),r=this.getBottomLeft(),l=this.getBottomRight();return[[i,n],[n,l],[l,r],[r,i]]},rotate:function(i,n){if(i=e.positiveModulo(i,360),i===0)return this.clone();n=n||this.getCenter();var r=this.getTopLeft().rotate(i,n),l=this.getTopRight().rotate(i,n),a=l.minus(r);a=a.apply(function(u){var h=1e-15;return Math.abs(u)=-n&&(i.x-l.x)*o.x+(i.y-l.y)*o.y<=n&&(i.x-r.x)*u.x+(i.y-r.y)*u.y>=-n&&(i.x-a.x)*u.x+(i.y-a.y)*u.y<=n},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]"}}}(s),function(e){var i={};e.ReferenceStrip=function(m){var T=this,x=m.viewer,P=e.getElementSize(x.element),C,k,d;for(m.id||(m.id="referencestrip-"+e.now(),this.element=e.makeNeutralElement("div"),this.element.id=m.id,this.element.className="referencestrip"),m=e.extend(!0,{sizeRatio:e.DEFAULT_SETTINGS.referenceStripSizeRatio,position:e.DEFAULT_SETTINGS.referenceStripPosition,scroll:e.DEFAULT_SETTINGS.referenceStripScroll,clickTimeThreshold:e.DEFAULT_SETTINGS.clickTimeThreshold},m,{element:this.element}),e.extend(this,m),i[this.id]={animating:!1},this.minPixelRatio=this.viewer.minPixelRatio,this.element.tabIndex=0,k=this.element.style,k.marginTop="0px",k.marginRight="0px",k.marginBottom="0px",k.marginLeft="0px",k.left="0px",k.bottom="0px",k.border="0px",k.background="#000",k.position="relative",e.setElementTouchActionNone(this.element),e.setElementOpacity(this.element,.8),this.viewer=x,this.tracker=new e.MouseTracker({userData:"ReferenceStrip.tracker",element:this.element,clickHandler:e.delegate(this,n),dragHandler:e.delegate(this,r),scrollHandler:e.delegate(this,l),enterHandler:e.delegate(this,o),leaveHandler:e.delegate(this,u),keyDownHandler:e.delegate(this,h),keyHandler:e.delegate(this,g),preProcessEventHandler:function(_){_.eventType==="wheel"&&(_.preventDefault=!0)}}),m.width&&m.height?(this.element.style.width=m.width+"px",this.element.style.height=m.height+"px",x.addControl(this.element,{anchor:e.ControlAnchor.BOTTOM_LEFT})):m.scroll==="horizontal"?(this.element.style.width=P.x*m.sizeRatio*x.tileSources.length+12*x.tileSources.length+"px",this.element.style.height=P.y*m.sizeRatio+"px",x.addControl(this.element,{anchor:e.ControlAnchor.BOTTOM_LEFT})):(this.element.style.height=P.y*m.sizeRatio*x.tileSources.length+12*x.tileSources.length+"px",this.element.style.width=P.x*m.sizeRatio+"px",x.addControl(this.element,{anchor:e.ControlAnchor.TOP_LEFT})),this.panelWidth=P.x*this.sizeRatio+8,this.panelHeight=P.y*this.sizeRatio+8,this.panels=[],this.miniViewers={},d=0;dk+x.x-this.panelWidth?(_=Math.min(_,P-x.x),this.element.style.marginLeft=-_+"px",a(this,x.x,-_)):_d+x.y-this.panelHeight?(_=Math.min(_,C-x.y),this.element.style.marginTop=-_+"px",a(this,x.y,-_)):_0?T>-(P-k.x)&&(this.element.style.marginLeft=T+m.delta.x*2+"px",a(this,k.x,T+m.delta.x*2)):-m.delta.x<0&&T<0&&(this.element.style.marginLeft=T+m.delta.x*2+"px",a(this,k.x,T+m.delta.x*2)):-m.delta.y>0?x>-(C-k.y)&&(this.element.style.marginTop=x+m.delta.y*2+"px",a(this,k.y,x+m.delta.y*2)):-m.delta.y<0&&x<0&&(this.element.style.marginTop=x+m.delta.y*2+"px",a(this,k.y,x+m.delta.y*2))}}function l(m){if(this.element){var T=Number(this.element.style.marginLeft.replace("px","")),x=Number(this.element.style.marginTop.replace("px","")),P=Number(this.element.style.width.replace("px","")),C=Number(this.element.style.height.replace("px","")),k=e.getElementSize(this.viewer.canvas);this.scroll==="horizontal"?m.scroll>0?T>-(P-k.x)&&(this.element.style.marginLeft=T-m.scroll*60+"px",a(this,k.x,T-m.scroll*60)):m.scroll<0&&T<0&&(this.element.style.marginLeft=T-m.scroll*60+"px",a(this,k.x,T-m.scroll*60)):m.scroll<0?x>k.y-C&&(this.element.style.marginTop=x+m.scroll*60+"px",a(this,k.y,x+m.scroll*60)):m.scroll>0&&x<0&&(this.element.style.marginTop=x+m.scroll*60+"px",a(this,k.y,x+m.scroll*60)),m.preventDefault=!0}}function a(m,T,x){var P,C,k,d,_,S;for(m.scroll==="horizontal"?P=m.panelWidth:P=m.panelHeight,C=Math.ceil(T/P)+5,k=Math.ceil((Math.abs(x)+T)/P)+1,C=k-C,C=C<0?0:C,_=C;_1?r[1].springStiffness:5,animationTime:r.length>1?r[1].animationTime:1.5}),e.console.assert(typeof n.springStiffness=="number"&&n.springStiffness!==0,"[OpenSeadragon.Spring] options.springStiffness must be a non-zero number"),e.console.assert(typeof n.animationTime=="number"&&n.animationTime>=0,"[OpenSeadragon.Spring] options.animationTime must be a number greater than or equal to 0"),n.exponential&&(this._exponential=!0,delete n.exponential),e.extend(!0,this,n),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(n){e.console.assert(!this._exponential||n!==0,"[OpenSeadragon.Spring.resetTo] target must be non-zero for exponential springs"),this.start.value=this.target.value=this.current.value=n,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(n){e.console.assert(!this._exponential||n!==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=n,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(n){this.start.value+=n,this.target.value+=n,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(n){this._exponential=n,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 n,r;this._exponential?(n=this.start._logValue,r=this.target._logValue):(n=this.start.value,r=this.target.value);var l=this.current.time>=this.target.time?r:n+(r-n)*i(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(l):this.current.value=l,a!==this.current.value},isAtTargetValue:function(){return this.current.value===this.target.value}};function i(n,r){return(1-Math.exp(n*-r))/(1-Math.exp(-n))}}(s),function(e){function i(r){e.extend(!0,this,{timeout:e.DEFAULT_SETTINGS.timeout,jobId:null},r),this.image=null}i.prototype={errorMsg:null,start:function(){var r=this,l=this.abort;this.image=new Image,this.image.onload=function(){r.finish(!0)},this.image.onabort=this.image.onerror=function(){r.errorMsg="Image load aborted",r.finish(!1)},this.jobId=window.setTimeout(function(){r.errorMsg="Image load exceeded timeout ("+r.timeout+" ms)",r.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 o;try{o=new window.Blob([a.response])}catch(m){var u=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder;if(m.name==="TypeError"&&u){var h=new u;h.append(a.response),o=h.getBlob()}}o.size===0&&(r.errorMsg="Empty image response.",r.finish(!1));var g=(window.URL||window.webkitURL).createObjectURL(o);r.image.src=g},error:function(a){r.errorMsg="Image load aborted - XHR error",r.finish(!1)}}),this.abort=function(){r.request.abort(),typeof l=="function"&&l()}):(this.crossOriginPolicy!==!1&&(this.image.crossOrigin=this.crossOriginPolicy),this.image.src=this.src)},finish:function(r){this.image.onload=this.image.onerror=this.image.onabort=null,r||(this.image=null),this.jobId&&window.clearTimeout(this.jobId),this.callback(this)}},e.ImageLoader=function(r){e.extend(!0,this,{jobLimit:e.DEFAULT_SETTINGS.imageLoaderLimit,timeout:e.DEFAULT_SETTINGS.timeout,jobQueue:[],jobsInProgress:0},r)},e.ImageLoader.prototype={addJob:function(r){var l=this,a=function(h){n(l,h,r.callback)},o={src:r.src,loadWithAjax:r.loadWithAjax,ajaxHeaders:r.loadWithAjax?r.ajaxHeaders:null,crossOriginPolicy:r.crossOriginPolicy,ajaxWithCredentials:r.ajaxWithCredentials,callback:a,abort:r.abort,timeout:this.timeout},u=new i(o);!this.jobLimit||this.jobsInProgress0&&(o=r.jobQueue.shift(),o.start(),r.jobsInProgress++),a(l.image,l.errorMsg,l.request)}}(s),function(e){e.Tile=function(i,n,r,l,a,o,u,h,g,m){this.level=i,this.x=n,this.y=r,this.bounds=l,this.sourceBounds=m,this.exists=a,this.url=o,this.context2D=u,this.loadWithAjax=h,this.ajaxHeaders=g,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(i){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!==i&&i.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(i,n,r,l){var a=this.position.times(e.pixelDensityRatio),o=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}i.save(),i.globalAlpha=this.opacity,typeof r=="number"&&r!==1&&(a=a.times(r),o=o.times(r)),l instanceof e.Point&&(a=a.plus(l)),i.globalAlpha===1&&this._hasTransparencyChannel()&&i.clearRect(a.x,a.y,o.x,o.y),n({context:i,tile:this,rendered:u});var h,g;this.sourceBounds?(h=Math.min(this.sourceBounds.width,u.canvas.width),g=Math.min(this.sourceBounds.height,u.canvas.height)):(h=u.canvas.width,g=u.canvas.height),i.translate(a.x+o.x/2,0),this.flipped&&i.scale(-1,1),i.drawImage(u.canvas,0,0,h,g,-o.x/2,a.y,o.x,o.y),i.restore()},getScaleForEdgeSmoothing:function(){var i;if(this.cacheImageRecord)i=this.cacheImageRecord.getRenderedContext();else if(this.context2D)i=this.context2D;else return e.console.warn("[Tile.drawCanvas] attempting to get tile scale %s when tile's not cached",this.toString()),1;return i.canvas.width/(this.size.x*e.pixelDensityRatio)},getTranslationForEdgeSmoothing:function(i,n,r){var l=Math.max(1,Math.ceil((r.x-n.x)/2)),a=Math.max(1,Math.ceil((r.y-n.y)/2));return new e.Point(l,a).minus(this.position.times(e.pixelDensityRatio).times(i||1).apply(function(o){return o%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}}}(s),function(e){e.OverlayPlacement=e.Placement,e.OverlayRotationMode=e.freezeObject({NO_ROTATION:1,EXACT:2,BOUNDING_BOX:3}),e.Overlay=function(i,n,r){var l;e.isPlainObject(i)?l=i:l={element:i,location:n,placement:r},this.element=l.element,this.style=l.element.style,this._init(l)},e.Overlay.prototype={_init:function(i){this.location=i.location,this.placement=i.placement===void 0?e.Placement.TOP_LEFT:i.placement,this.onDraw=i.onDraw,this.checkResize=i.checkResize===void 0?!0:i.checkResize,this.width=i.width===void 0?null:i.width,this.height=i.height===void 0?null:i.height,this.rotationMode=i.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(i,n){var r=e.Placement.properties[this.placement];r&&(r.isHorizontallyCentered?i.x-=n.x/2:r.isRight&&(i.x-=n.x),r.isVerticallyCentered?i.y-=n.y/2:r.isBottom&&(i.y-=n.y))},destroy:function(){var i=this.element,n=this.style;i.parentNode&&(i.parentNode.removeChild(i),i.prevElementParent&&(n.display="none",document.body.appendChild(i))),this.onDraw=null,n.top="",n.left="",n.position="",this.width!==null&&(n.width=""),this.height!==null&&(n.height="");var r=e.getCssPropertyWithVendorPrefix("transformOrigin"),l=e.getCssPropertyWithVendorPrefix("transform");r&&l&&(n[r]="",n[l]="")},drawHTML:function(i,n){var r=this.element;r.parentNode!==i&&(r.prevElementParent=r.parentNode,r.prevNextSibling=r.nextSibling,i.appendChild(r),this.style.position="absolute",this.size=e.getElementSize(r));var l=this._getOverlayPositionAndSize(n),a=l.position,o=this.size=l.size,u=l.rotate;if(this.onDraw)this.onDraw(a,o,this.element);else{var h=this.style;h.left=a.x+"px",h.top=a.y+"px",this.width!==null&&(h.width=o.x+"px"),this.height!==null&&(h.height=o.y+"px");var g=e.getCssPropertyWithVendorPrefix("transformOrigin"),m=e.getCssPropertyWithVendorPrefix("transform");g&&m&&(u?(h[g]=this._getTransformOrigin(),h[m]="rotate("+u+"deg)"):(h[g]="",h[m]="")),h.display="block"}},_getOverlayPositionAndSize:function(i){var n=i.pixelFromPoint(this.location,!0),r=this._getSizeInPixels(i);this.adjust(n,r);var l=0;if(i.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(n.x,n.y,r.x,r.y),o=this._getBoundingBox(a,i.degrees);n=o.getTopLeft(),r=o.getSize()}else l=i.degrees;return{position:n,size:r,rotate:l}},_getSizeInPixels:function(i){var n=this.size.x,r=this.size.y;if(this.width!==null||this.height!==null){var l=i.deltaPixelsFromPointsNoRotate(new e.Point(this.width||0,this.height||0),!0);this.width!==null&&(n=l.x),this.height!==null&&(r=l.y)}if(this.checkResize&&(this.width===null||this.height===null)){var a=this.size=e.getElementSize(this.element);this.width===null&&(n=a.x),this.height===null&&(r=a.y)}return new e.Point(n,r)},_getBoundingBox:function(i,n){var r=this._getPlacementPoint(i);return i.rotate(n,r).getBoundingBox()},_getPlacementPoint:function(i){var n=new e.Point(i.x,i.y),r=e.Placement.properties[this.placement];return r&&(r.isHorizontallyCentered?n.x+=i.width/2:r.isRight&&(n.x+=i.width),r.isVerticallyCentered?n.y+=i.height/2:r.isBottom&&(n.y+=i.height)),n},_getTransformOrigin:function(){var i="",n=e.Placement.properties[this.placement];return n&&(n.isLeft?i="left":n.isRight&&(i="right"),n.isTop?i+=" top":n.isBottom&&(i+=" bottom")),i},update:function(i,n){var r=e.isPlainObject(i)?i:{location:i,placement:n};this._init({location:r.location||this.location,placement:r.placement!==void 0?r.placement:this.placement,onDraw:r.onDraw||this.onDraw,checkResize:r.checkResize||this.checkResize,width:r.width!==void 0?r.width:this.width,height:r.height!==void 0?r.height:this.height,rotationMode:r.rotationMode||this.rotationMode})},getBounds:function(i){e.console.assert(i,"A viewport must now be passed to Overlay.getBounds.");var n=this.width,r=this.height;if(n===null||r===null){var l=i.deltaPointsFromPixelsNoRotate(this.size,!0);n===null&&(n=l.x),r===null&&(r=l.y)}var a=this.location.clone();return this.adjust(a,new e.Point(n,r)),this._adjustBoundsForRotation(i,new e.Rect(a.x,a.y,n,r))},_adjustBoundsForRotation:function(i,n){if(!i||i.degrees===0||this.rotationMode===e.OverlayRotationMode.EXACT)return n;if(this.rotationMode===e.OverlayRotationMode.BOUNDING_BOX){if(this.width===null||this.height===null)return n;var r=this._getOverlayPositionAndSize(i);return i.viewerElementToViewportRectangle(new e.Rect(r.position.x,r.position.y,r.size.x,r.size.y))}return n.rotate(-i.degrees,this._getPlacementPoint(n))}}}(s),function(e){e.Drawer=function(i){e.console.assert(i.viewer,"[Drawer] options.viewer is required");var n=arguments;if(e.isPlainObject(i)||(i={source:n[0],viewport:n[1],element:n[2]}),e.console.assert(i.viewport,"[Drawer] options.viewport is required"),e.console.assert(i.element,"[Drawer] options.element is required"),i.source&&e.console.error("[Drawer] options.source is no longer accepted; use TiledImage instead"),this.viewer=i.viewer,this.viewport=i.viewport,this.debugGridColor=typeof i.debugGridColor=="string"?[i.debugGridColor]:i.debugGridColor||e.DEFAULT_SETTINGS.debugGridColor,i.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(i.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 r=this._calculateCanvasSize();this.canvas.width=r.x,this.canvas.height=r.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(i,n,r,l){return e.console.error("drawer.addOverlay is deprecated. Use viewer.addOverlay instead."),this.viewer.addOverlay(i,n,r,l),this},updateOverlay:function(i,n,r){return e.console.error("drawer.updateOverlay is deprecated. Use viewer.updateOverlay instead."),this.viewer.updateOverlay(i,n,r),this},removeOverlay:function(i){return e.console.error("drawer.removeOverlay is deprecated. Use viewer.removeOverlay instead."),this.viewer.removeOverlay(i),this},clearOverlays:function(){return e.console.error("drawer.clearOverlays is deprecated. Use viewer.clearOverlays instead."),this.viewer.clearOverlays(),this},viewportCoordToDrawerCoord:function(i){var n=this.viewport.pixelFromPointNoRotate(i,!0);return new e.Point(n.x*e.pixelDensityRatio,n.y*e.pixelDensityRatio)},clipWithPolygons:function(i,n){if(this.useCanvas){var r=this._getContext(n);r.beginPath(),i.forEach(function(l){l.forEach(function(a,o){r[o===0?"moveTo":"lineTo"](a.x,a.y)})}),r.clip()}},setOpacity:function(i){e.console.error("drawer.setOpacity is deprecated. Use tiledImage.setOpacity instead.");for(var n=this.viewer.world,r=0;rn&&(n=l)}return n},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 i=this._calculateCanvasSize();if((this.canvas.width!==i.x||this.canvas.height!==i.y)&&(this.canvas.width=i.x,this.canvas.height=i.y,this._updateImageSmoothingEnabled(this.context),this.sketchCanvas!==null)){var n=this._calculateSketchCanvasSize();this.sketchCanvas.width=n.x,this.sketchCanvas.height=n.y,this._updateImageSmoothingEnabled(this.sketchContext)}this._clear()}},_clear:function(i,n){if(this.useCanvas){var r=this._getContext(i);if(n)r.clearRect(n.x,n.y,n.width,n.height);else{var l=r.canvas;r.clearRect(0,0,l.width,l.height)}}},viewportToDrawerRectangle:function(i){var n=this.viewport.pixelFromPointNoRotate(i.getTopLeft(),!0),r=this.viewport.deltaPixelsFromPointsNoRotate(i.getSize(),!0);return new e.Rect(n.x*e.pixelDensityRatio,n.y*e.pixelDensityRatio,r.x*e.pixelDensityRatio,r.y*e.pixelDensityRatio)},drawTile:function(i,n,r,l,a){if(e.console.assert(i,"[Drawer.drawTile] tile is required"),e.console.assert(n,"[Drawer.drawTile] drawingHandler is required"),this.useCanvas){var o=this._getContext(r);l=l||1,i.drawCanvas(o,n,l,a)}else i.drawHTML(this.canvas)},_getContext:function(i){var n=this.context;if(i){if(this.sketchCanvas===null){this.sketchCanvas=document.createElement("canvas");var r=this._calculateSketchCanvasSize();if(this.sketchCanvas.width=r.x,this.sketchCanvas.height=r.y,this.sketchContext=this.sketchCanvas.getContext("2d"),this.viewport.getRotation()===0){var l=this;this.viewer.addHandler("rotate",function a(){if(l.viewport.getRotation()!==0){l.viewer.removeHandler("rotate",a);var o=l._calculateSketchCanvasSize();l.sketchCanvas.width=o.x,l.sketchCanvas.height=o.y}})}this._updateImageSmoothingEnabled(this.sketchContext)}n=this.sketchContext}return n},saveContext:function(i){this.useCanvas&&this._getContext(i).save()},restoreContext:function(i){this.useCanvas&&this._getContext(i).restore()},setClip:function(i,n){if(this.useCanvas){var r=this._getContext(n);r.beginPath(),r.rect(i.x,i.y,i.width,i.height),r.clip()}},drawRectangle:function(i,n,r){if(this.useCanvas){var l=this._getContext(r);l.save(),l.fillStyle=n,l.fillRect(i.x,i.y,i.width,i.height),l.restore()}},blendSketch:function(i,n,r,l){var a=i;if(e.isPlainObject(a)||(a={opacity:i,scale:n,translate:r,compositeOperation:l}),!(!this.useCanvas||!this.sketchCanvas)){i=a.opacity,l=a.compositeOperation;var o=a.bounds;if(this.context.save(),this.context.globalAlpha=i,l&&(this.context.globalCompositeOperation=l),o)o.x<0&&(o.width+=o.x,o.x=0),o.x+o.width>this.canvas.width&&(o.width=this.canvas.width-o.x),o.y<0&&(o.height+=o.y,o.y=0),o.y+o.height>this.canvas.height&&(o.height=this.canvas.height-o.y),this.context.drawImage(this.sketchCanvas,o.x,o.y,o.width,o.height,o.x,o.y,o.width,o.height);else{n=a.scale||1,r=a.translate;var u=r instanceof e.Point?r:new e.Point(0,0),h=0,g=0;if(r){var m=this.sketchCanvas.width-this.canvas.width,T=this.sketchCanvas.height-this.canvas.height;h=Math.round(m/2),g=Math.round(T/2)}this.context.drawImage(this.sketchCanvas,u.x-h*n,u.y-g*n,(this.canvas.width+2*h)*n,(this.canvas.height+2*g)*n,-h,-g,this.canvas.width+2*h,this.canvas.height+2*g)}this.context.restore()}},drawDebugInfo:function(i,n,r,l){if(this.useCanvas){var a=this.viewer.world.getIndexOfItem(l)%this.debugGridColor.length,o=this.context;o.save(),o.lineWidth=2*e.pixelDensityRatio,o.font="small-caps bold "+13*e.pixelDensityRatio+"px arial",o.strokeStyle=this.debugGridColor[a],o.fillStyle=this.debugGridColor[a],this.viewport.degrees!==0&&this._offsetForRotation({degrees:this.viewport.degrees}),l.getRotation(!0)%360!==0&&this._offsetForRotation({degrees:l.getRotation(!0),point:l.viewport.pixelFromPointNoRotate(l._getRotationPoint(!0),!0)}),l.viewport.degrees===0&&l.getRotation(!0)%360===0&&l._drawer.viewer.viewport.getFlip()&&l._drawer._flip(),o.strokeRect(i.position.x*e.pixelDensityRatio,i.position.y*e.pixelDensityRatio,i.size.x*e.pixelDensityRatio,i.size.y*e.pixelDensityRatio);var u=(i.position.x+i.size.x/2)*e.pixelDensityRatio,h=(i.position.y+i.size.y/2)*e.pixelDensityRatio;o.translate(u,h),o.rotate(Math.PI/180*-this.viewport.degrees),o.translate(-u,-h),i.x===0&&i.y===0&&(o.fillText("Zoom: "+this.viewport.getZoom(),i.position.x*e.pixelDensityRatio,(i.position.y-30)*e.pixelDensityRatio),o.fillText("Pan: "+this.viewport.getBounds().toString(),i.position.x*e.pixelDensityRatio,(i.position.y-20)*e.pixelDensityRatio)),o.fillText("Level: "+i.level,(i.position.x+10)*e.pixelDensityRatio,(i.position.y+20)*e.pixelDensityRatio),o.fillText("Column: "+i.x,(i.position.x+10)*e.pixelDensityRatio,(i.position.y+30)*e.pixelDensityRatio),o.fillText("Row: "+i.y,(i.position.x+10)*e.pixelDensityRatio,(i.position.y+40)*e.pixelDensityRatio),o.fillText("Order: "+r+" of "+n,(i.position.x+10)*e.pixelDensityRatio,(i.position.y+50)*e.pixelDensityRatio),o.fillText("Size: "+i.size.toString(),(i.position.x+10)*e.pixelDensityRatio,(i.position.y+60)*e.pixelDensityRatio),o.fillText("Position: "+i.position.toString(),(i.position.x+10)*e.pixelDensityRatio,(i.position.y+70)*e.pixelDensityRatio),this.viewport.degrees!==0&&this._restoreRotationChanges(),l.getRotation(!0)%360!==0&&this._restoreRotationChanges(),l.viewport.degrees===0&&l.getRotation(!0)%360===0&&l._drawer.viewer.viewport.getFlip()&&l._drawer._flip(),o.restore()}},debugRect:function(i){if(this.useCanvas){var n=this.context;n.save(),n.lineWidth=2*e.pixelDensityRatio,n.strokeStyle=this.debugGridColor[0],n.fillStyle=this.debugGridColor[0],n.strokeRect(i.x*e.pixelDensityRatio,i.y*e.pixelDensityRatio,i.width*e.pixelDensityRatio,i.height*e.pixelDensityRatio),n.restore()}},setImageSmoothingEnabled:function(i){this.useCanvas&&(this._imageSmoothingEnabled=i,this._updateImageSmoothingEnabled(this.context),this.viewer.forceRedraw())},_updateImageSmoothingEnabled:function(i){i.msImageSmoothingEnabled=this._imageSmoothingEnabled,i.imageSmoothingEnabled=this._imageSmoothingEnabled},getCanvasSize:function(i){var n=this._getContext(i).canvas;return new e.Point(n.width,n.height)},getCanvasCenter:function(){return new e.Point(this.canvas.width/2,this.canvas.height/2)},_offsetForRotation:function(i){var n=i.point?i.point.times(e.pixelDensityRatio):this.getCanvasCenter(),r=this._getContext(i.useSketch);r.save(),r.translate(n.x,n.y),this.viewer.viewport.flipped?(r.rotate(Math.PI/180*-i.degrees),r.scale(-1,1)):r.rotate(Math.PI/180*i.degrees),r.translate(-n.x,-n.y)},_flip:function(i){i=i||{};var n=i.point?i.point.times(e.pixelDensityRatio):this.getCanvasCenter(),r=this._getContext(i.useSketch);r.translate(n.x,0),r.scale(-1,1),r.translate(-n.x,0)},_restoreRotationChanges:function(i){var n=this._getContext(i);n.restore()},_calculateCanvasSize:function(){var i=e.pixelDensityRatio,n=this.viewport.getContainerSize();return{x:Math.round(n.x*i),y:Math.round(n.y*i)}},_calculateSketchCanvasSize:function(){var i=this._calculateCanvasSize();if(this.viewport.getRotation()===0)return i;var n=Math.ceil(Math.sqrt(i.x*i.x+i.y*i.y));return{x:n,y:n}}}}(s),function(e){e.Viewport=function(i){var n=arguments;n.length&&n[0]instanceof e.Point&&(i={containerSize:n[0],contentSize:n[1],config:n[2]}),i.config&&(e.extend(!0,i,i.config),delete i.config),this._margins=e.extend({left:0,top:0,right:0,bottom:0},i.margins||{}),delete i.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},i),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(i){return e.console.assert(i,"[Viewport.resetContentSize] contentSize is required"),e.console.assert(i instanceof e.Point,"[Viewport.resetContentSize] contentSize must be an OpenSeadragon.Point"),e.console.assert(i.x>0,"[Viewport.resetContentSize] contentSize.x must be greater than 0"),e.console.assert(i.y>0,"[Viewport.resetContentSize] contentSize.y must be greater than 0"),this._setContentBounds(new e.Rect(0,0,1,i.y/i.x),i.x),this},setHomeBounds:function(i,n){e.console.error("[Viewport.setHomeBounds] this function is deprecated; The content bounds should not be set manually."),this._setContentBounds(i,n)},_setContentBounds:function(i,n){e.console.assert(i,"[Viewport._setContentBounds] bounds is required"),e.console.assert(i instanceof e.Rect,"[Viewport._setContentBounds] bounds must be an OpenSeadragon.Rect"),e.console.assert(i.width>0,"[Viewport._setContentBounds] bounds.width must be greater than 0"),e.console.assert(i.height>0,"[Viewport._setContentBounds] bounds.height must be greater than 0"),this._contentBoundsNoRotate=i.clone(),this._contentSizeNoRotate=this._contentBoundsNoRotate.getSize().times(n),this._contentBounds=i.rotate(this.degrees).getBoundingBox(),this._contentSize=this._contentBounds.getSize().times(n),this._contentAspectRatio=this._contentSize.x/this._contentSize.y,this.viewer&&this.viewer.raiseEvent("reset-size",{contentSize:this._contentSizeNoRotate.clone(),contentFactor:n,homeBounds:this._contentBoundsNoRotate.clone(),contentBounds:this._contentBounds.clone()})},getHomeZoom:function(){if(this.defaultZoomLevel)return this.defaultZoomLevel;var i=this._contentAspectRatio/this.getAspectRatio(),n;return this.homeFillsViewer?n=i>=1?i:1:n=i>=1?1:i,n/this._contentBounds.width},getHomeBounds:function(){return this.getHomeBoundsNoRotate().rotate(-this.getRotation())},getHomeBoundsNoRotate:function(){var i=this._contentBounds.getCenter(),n=1/this.getHomeZoom(),r=n/this.getAspectRatio();return new e.Rect(i.x-n/2,i.y-r/2,n,r)},goHome:function(i){return this.viewer&&this.viewer.raiseEvent("home",{immediately:i}),this.fitBounds(this.getHomeBounds(),i)},getMinZoom:function(){var i=this.getHomeZoom(),n=this.minZoomLevel?this.minZoomLevel:this.minZoomImageRatio*i;return n},getMaxZoom:function(){var i=this.maxZoomLevel;return i||(i=this._contentSize.x*this.maxZoomPixelRatio/this._containerInnerSize.x,i/=this._contentBounds.width),Math.max(i,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(i){e.console.assert(e.type(i)==="object","[Viewport.setMargins] margins must be an object"),this._margins=e.extend({left:0,top:0,right:0,bottom:0},i),this._updateContainerInnerSize(),this.viewer&&this.viewer.forceRedraw()},getBounds:function(i){return this.getBoundsNoRotate(i).rotate(-this.getRotation())},getBoundsNoRotate:function(i){var n=this.getCenter(i),r=1/this.getZoom(i),l=r/this.getAspectRatio();return new e.Rect(n.x-r/2,n.y-l/2,r,l)},getBoundsWithMargins:function(i){return this.getBoundsNoRotateWithMargins(i).rotate(-this.getRotation(),this.getCenter(i))},getBoundsNoRotateWithMargins:function(i){var n=this.getBoundsNoRotate(i),r=this._containerInnerSize.x*this.getZoom(i);return n.x-=this._margins.left/r,n.y-=this._margins.top/r,n.width+=(this._margins.left+this._margins.right)/r,n.height+=(this._margins.top+this._margins.bottom)/r,n},getCenter:function(i){var n=new e.Point(this.centerSpringX.current.value,this.centerSpringY.current.value),r=new e.Point(this.centerSpringX.target.value,this.centerSpringY.target.value),l,a,o,u,h,g,m,T;return i?n:this.zoomPoint?(l=this.pixelFromPoint(this.zoomPoint,!0),a=this.getZoom(),o=1/a,u=o/this.getAspectRatio(),h=new e.Rect(n.x-o/2,n.y-u/2,o,u),g=this._pixelFromPoint(this.zoomPoint,h),m=g.minus(l),T=m.divide(this._containerInnerSize.x*a),r.plus(T)):r},getZoom:function(i){return i?this.zoomSpring.current.value:this.zoomSpring.target.value},_applyZoomConstraints:function(i){return Math.max(Math.min(i,this.getMaxZoom()),this.getMinZoom())},_applyBoundaryConstraints:function(i){var n=new e.Rect(i.x,i.y,i.width,i.height);if(!this.wrapHorizontal){var r=this.visibilityRatio*n.width,l=n.x+n.width,a=this._contentBoundsNoRotate.x+this._contentBoundsNoRotate.width,o=this._contentBoundsNoRotate.x-l+r,u=a-n.x-r;r>this._contentBoundsNoRotate.width?n.x+=(o+u)/2:u<0?n.x+=u:o>0&&(n.x+=o)}if(!this.wrapVertical){var h=this.visibilityRatio*n.height,g=n.y+n.height,m=this._contentBoundsNoRotate.y+this._contentBoundsNoRotate.height,T=this._contentBoundsNoRotate.y-g+h,x=m-n.y-h;h>this._contentBoundsNoRotate.height?n.y+=(T+x)/2:x<0?n.y+=x:T>0&&(n.y+=T)}return n},_raiseConstraintsEvent:function(i){this.viewer&&this.viewer.raiseEvent("constrain",{immediately:i})},applyConstraints:function(i){var n=this.getZoom(),r=this._applyZoomConstraints(n);n!==r&&this.zoomTo(r,this.zoomPoint,i);var l=this.getBoundsNoRotate(),a=this._applyBoundaryConstraints(l);return this._raiseConstraintsEvent(i),(l.x!==a.x||l.y!==a.y||i)&&this.fitBounds(a.rotate(-this.getRotation()),i),this},ensureVisible:function(i){return this.applyConstraints(i)},_fitBounds:function(i,n){n=n||{};var r=n.immediately||!1,l=n.constraints||!1,a=this.getAspectRatio(),o=i.getCenter(),u=new e.Rect(i.x,i.y,i.width,i.height,i.degrees+this.getRotation()).getBoundingBox();u.getAspectRatio()>=a?u.height=u.width/a:u.width=u.height*a,u.x=o.x-u.width/2,u.y=o.y-u.height/2;var h=1/u.width;if(l){var g=u.getAspectRatio(),m=this._applyZoomConstraints(h);h!==m&&(h=m,u.width=1/h,u.x=o.x-u.width/2,u.height=u.width/g,u.y=o.y-u.height/2),u=this._applyBoundaryConstraints(u),o=u.getCenter(),this._raiseConstraintsEvent(r)}if(r)return this.panTo(o,!0),this.zoomTo(h,null,!0);this.panTo(this.getCenter(!0),!0),this.zoomTo(this.getZoom(!0),null,!0);var T=this.getBounds(),x=this.getZoom();if(x===0||Math.abs(h/x-1)<1e-8)return this.zoomTo(h,!0),this.panTo(o,r);u=u.rotate(-this.getRotation());var P=u.getTopLeft().times(h).minus(T.getTopLeft().times(x)).divide(h-x);return this.zoomTo(h,P,r)},fitBounds:function(i,n){return this._fitBounds(i,{immediately:n,constraints:!1})},fitBoundsWithConstraints:function(i,n){return this._fitBounds(i,{immediately:n,constraints:!0})},fitVertically:function(i){var n=new e.Rect(this._contentBounds.x+this._contentBounds.width/2,this._contentBounds.y,0,this._contentBounds.height);return this.fitBounds(n,i)},fitHorizontally:function(i){var n=new e.Rect(this._contentBounds.x,this._contentBounds.y+this._contentBounds.height/2,this._contentBounds.width,0);return this.fitBounds(n,i)},getConstrainedBounds:function(i){var n,r;return n=this.getBounds(i),r=this._applyBoundaryConstraints(n),r},panBy:function(i,n){var r=new e.Point(this.centerSpringX.target.value,this.centerSpringY.target.value);return this.panTo(r.plus(i),n)},panTo:function(i,n){return n?(this.centerSpringX.resetTo(i.x),this.centerSpringY.resetTo(i.y)):(this.centerSpringX.springTo(i.x),this.centerSpringY.springTo(i.y)),this.viewer&&this.viewer.raiseEvent("pan",{center:i,immediately:n}),this},zoomBy:function(i,n,r){return this.zoomTo(this.zoomSpring.target.value*i,n,r)},zoomTo:function(i,n,r){var l=this;return this.zoomPoint=n instanceof e.Point&&!isNaN(n.x)&&!isNaN(n.y)?n:null,r?this._adjustCenterSpringsForZoomPoint(function(){l.zoomSpring.resetTo(i)}):this.zoomSpring.springTo(i),this.viewer&&this.viewer.raiseEvent("zoom",{zoom:i,refPoint:n,immediately:r}),this},setRotation:function(i){return!this.viewer||!this.viewer.drawer.canRotate()?this:(this.degrees=e.positiveModulo(i,360),this._setContentBounds(this.viewer.world.getHomeBounds(),this.viewer.world.getContentFactor()),this.viewer.forceRedraw(),this.viewer.raiseEvent("rotate",{degrees:i}),this)},getRotation:function(){return this.degrees},resize:function(i,n){var r=this.getBoundsNoRotate(),l=r,a;return this.containerSize.x=i.x,this.containerSize.y=i.y,this._updateContainerInnerSize(),n&&(a=i.x/this.containerSize.x,l.width=r.width*a,l.height=l.width/this.getAspectRatio()),this.viewer&&this.viewer.raiseEvent("resize",{newContainerSize:i,maintain:n}),this.fitBounds(l,!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 i=this;this._adjustCenterSpringsForZoomPoint(function(){i.zoomSpring.update()}),this.centerSpringX.update(),this.centerSpringY.update();var n=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,n},_adjustCenterSpringsForZoomPoint:function(i){if(this.zoomPoint){var n=this.pixelFromPoint(this.zoomPoint,!0);i();var r=this.pixelFromPoint(this.zoomPoint,!0),l=r.minus(n),a=this.deltaPointsFromPixels(l,!0);this.centerSpringX.shiftBy(a.x),this.centerSpringY.shiftBy(a.y),this.zoomSpring.isAtTargetValue()&&(this.zoomPoint=null)}else i()},deltaPixelsFromPointsNoRotate:function(i,n){return i.times(this._containerInnerSize.x*this.getZoom(n))},deltaPixelsFromPoints:function(i,n){return this.deltaPixelsFromPointsNoRotate(i.rotate(this.getRotation()),n)},deltaPointsFromPixelsNoRotate:function(i,n){return i.divide(this._containerInnerSize.x*this.getZoom(n))},deltaPointsFromPixels:function(i,n){return this.deltaPointsFromPixelsNoRotate(i,n).rotate(-this.getRotation())},pixelFromPointNoRotate:function(i,n){return this._pixelFromPointNoRotate(i,this.getBoundsNoRotate(n))},pixelFromPoint:function(i,n){return this._pixelFromPoint(i,this.getBoundsNoRotate(n))},_pixelFromPointNoRotate:function(i,n){return i.minus(n.getTopLeft()).times(this._containerInnerSize.x/n.width).plus(new e.Point(this._margins.left,this._margins.top))},_pixelFromPoint:function(i,n){return this._pixelFromPointNoRotate(i.rotate(this.getRotation(),this.getCenter(!0)),n)},pointFromPixelNoRotate:function(i,n){var r=this.getBoundsNoRotate(n);return i.minus(new e.Point(this._margins.left,this._margins.top)).divide(this._containerInnerSize.x/r.width).plus(r.getTopLeft())},pointFromPixel:function(i,n){return this.pointFromPixelNoRotate(i,n).rotate(-this.getRotation(),this.getCenter(!0))},_viewportToImageDelta:function(i,n){var r=this._contentBoundsNoRotate.width;return new e.Point(i*this._contentSizeNoRotate.x/r,n*this._contentSizeNoRotate.x/r)},viewportToImageCoordinates:function(i,n){if(i instanceof e.Point)return this.viewportToImageCoordinates(i.x,i.y);if(this.viewer){var r=this.viewer.world.getItemCount();if(r>1)e.console.error("[Viewport.viewportToImageCoordinates] is not accurate with multi-image; use TiledImage.viewportToImageCoordinates instead.");else if(r===1){var l=this.viewer.world.getItemAt(0);return l.viewportToImageCoordinates(i,n,!0)}}return this._viewportToImageDelta(i-this._contentBoundsNoRotate.x,n-this._contentBoundsNoRotate.y)},_imageToViewportDelta:function(i,n){var r=this._contentBoundsNoRotate.width;return new e.Point(i/this._contentSizeNoRotate.x*r,n/this._contentSizeNoRotate.x*r)},imageToViewportCoordinates:function(i,n){if(i instanceof e.Point)return this.imageToViewportCoordinates(i.x,i.y);if(this.viewer){var r=this.viewer.world.getItemCount();if(r>1)e.console.error("[Viewport.imageToViewportCoordinates] is not accurate with multi-image; use TiledImage.imageToViewportCoordinates instead.");else if(r===1){var l=this.viewer.world.getItemAt(0);return l.imageToViewportCoordinates(i,n,!0)}}var a=this._imageToViewportDelta(i,n);return a.x+=this._contentBoundsNoRotate.x,a.y+=this._contentBoundsNoRotate.y,a},imageToViewportRectangle:function(i,n,r,l){var a=i;if(a instanceof e.Rect||(a=new e.Rect(i,n,r,l)),this.viewer){var o=this.viewer.world.getItemCount();if(o>1)e.console.error("[Viewport.imageToViewportRectangle] is not accurate with multi-image; use TiledImage.imageToViewportRectangle instead.");else if(o===1){var u=this.viewer.world.getItemAt(0);return u.imageToViewportRectangle(i,n,r,l,!0)}}var h=this.imageToViewportCoordinates(a.x,a.y),g=this._imageToViewportDelta(a.width,a.height);return new e.Rect(h.x,h.y,g.x,g.y,a.degrees)},viewportToImageRectangle:function(i,n,r,l){var a=i;if(a instanceof e.Rect||(a=new e.Rect(i,n,r,l)),this.viewer){var o=this.viewer.world.getItemCount();if(o>1)e.console.error("[Viewport.viewportToImageRectangle] is not accurate with multi-image; use TiledImage.viewportToImageRectangle instead.");else if(o===1){var u=this.viewer.world.getItemAt(0);return u.viewportToImageRectangle(i,n,r,l,!0)}}var h=this.viewportToImageCoordinates(a.x,a.y),g=this._viewportToImageDelta(a.width,a.height);return new e.Rect(h.x,h.y,g.x,g.y,a.degrees)},viewerElementToImageCoordinates:function(i){var n=this.pointFromPixel(i,!0);return this.viewportToImageCoordinates(n)},imageToViewerElementCoordinates:function(i){var n=this.imageToViewportCoordinates(i);return this.pixelFromPoint(n,!0)},windowToImageCoordinates:function(i){e.console.assert(this.viewer,"[Viewport.windowToImageCoordinates] the viewport must have a viewer.");var n=i.minus(e.getElementPosition(this.viewer.element));return this.viewerElementToImageCoordinates(n)},imageToWindowCoordinates:function(i){e.console.assert(this.viewer,"[Viewport.imageToWindowCoordinates] the viewport must have a viewer.");var n=this.imageToViewerElementCoordinates(i);return n.plus(e.getElementPosition(this.viewer.element))},viewerElementToViewportCoordinates:function(i){return this.pointFromPixel(i,!0)},viewportToViewerElementCoordinates:function(i){return this.pixelFromPoint(i,!0)},viewerElementToViewportRectangle:function(i){return e.Rect.fromSummits(this.pointFromPixel(i.getTopLeft(),!0),this.pointFromPixel(i.getTopRight(),!0),this.pointFromPixel(i.getBottomLeft(),!0))},viewportToViewerElementRectangle:function(i){return e.Rect.fromSummits(this.pixelFromPoint(i.getTopLeft(),!0),this.pixelFromPoint(i.getTopRight(),!0),this.pixelFromPoint(i.getBottomLeft(),!0))},windowToViewportCoordinates:function(i){e.console.assert(this.viewer,"[Viewport.windowToViewportCoordinates] the viewport must have a viewer.");var n=i.minus(e.getElementPosition(this.viewer.element));return this.viewerElementToViewportCoordinates(n)},viewportToWindowCoordinates:function(i){e.console.assert(this.viewer,"[Viewport.viewportToWindowCoordinates] the viewport must have a viewer.");var n=this.viewportToViewerElementCoordinates(i);return n.plus(e.getElementPosition(this.viewer.element))},viewportToImageZoom:function(i){if(this.viewer){var n=this.viewer.world.getItemCount();if(n>1)e.console.error("[Viewport.viewportToImageZoom] is not accurate with multi-image.");else if(n===1){var r=this.viewer.world.getItemAt(0);return r.viewportToImageZoom(i)}}var l=this._contentSizeNoRotate.x,a=this._containerInnerSize.x,o=this._contentBoundsNoRotate.width,u=a/l*o;return i*u},imageToViewportZoom:function(i){if(this.viewer){var n=this.viewer.world.getItemCount();if(n>1)e.console.error("[Viewport.imageToViewportZoom] is not accurate with multi-image.");else if(n===1){var r=this.viewer.world.getItemAt(0);return r.imageToViewportZoom(i)}}var l=this._contentSizeNoRotate.x,a=this._containerInnerSize.x,o=this._contentBoundsNoRotate.width,u=l/a/o;return i*u},toggleFlip:function(){return this.setFlip(!this.getFlip()),this},getFlip:function(){return this.flipped},setFlip:function(i){return this.flipped===i?this:(this.flipped=i,this.viewer.navigator&&this.viewer.navigator.setFlip(this.getFlip()),this.viewer.forceRedraw(),this.viewer.raiseEvent("flip",{flipped:i}),this)}}}(s),function(e){e.TiledImage=function(d){var _=this;e.console.assert(d.tileCache,"[TiledImage] options.tileCache is required"),e.console.assert(d.drawer,"[TiledImage] options.drawer is required"),e.console.assert(d.viewer,"[TiledImage] options.viewer is required"),e.console.assert(d.imageLoader,"[TiledImage] options.imageLoader is required"),e.console.assert(d.source,"[TiledImage] options.source is required"),e.console.assert(!d.clip||d.clip instanceof e.Rect,"[TiledImage] options.clip must be an OpenSeadragon.Rect if present"),e.EventSource.call(this),this._tileCache=d.tileCache,delete d.tileCache,this._drawer=d.drawer,delete d.drawer,this._imageLoader=d.imageLoader,delete d.imageLoader,d.clip instanceof e.Rect&&(this._clip=d.clip.clone()),delete d.clip;var S=d.x||0;delete d.x;var M=d.y||0;delete d.y,this.normHeight=d.source.dimensions.y/d.source.dimensions.x,this.contentAspectX=d.source.dimensions.x/d.source.dimensions.y;var I=1;d.width?(I=d.width,delete d.width,d.height&&(e.console.error("specifying both width and height to a tiledImage is not supported"),delete d.height)):d.height&&(I=d.height/this.normHeight,delete d.height);var V=d.fitBounds;delete d.fitBounds;var j=d.fitBoundsPlacement||s.Placement.CENTER;delete d.fitBoundsPlacement;var q=d.degrees||0;delete d.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},d),this._preload=this.preload,delete this.preload,this._fullyLoaded=!1,this._xSpring=new e.Spring({initial:S,springStiffness:this.springStiffness,animationTime:this.animationTime}),this._ySpring=new e.Spring({initial:M,springStiffness:this.springStiffness,animationTime:this.animationTime}),this._scaleSpring=new e.Spring({initial:I,springStiffness:this.springStiffness,animationTime:this.animationTime}),this._degreesSpring=new e.Spring({initial:q,springStiffness:this.springStiffness,animationTime:this.animationTime}),this._updateForScale(),V&&this.fitBounds(V,j,!0),this._drawingHandler=function(K){_.viewer.raiseEvent("tile-drawing",e.extend({tiledImage:_},K))}},e.extend(e.TiledImage.prototype,e.EventSource.prototype,{needsDraw:function(){return this._needsDraw},getFullyLoaded:function(){return this._fullyLoaded},_setFullyLoaded:function(d){d!==this._fullyLoaded&&(this._fullyLoaded=d,this.raiseEvent("fully-loaded-change",{fullyLoaded:this._fullyLoaded}))},reset:function(){this._tileCache.clearTilesFor(this),this.lastResetTime=e.now(),this._needsDraw=!0},update:function(){var d=this._xSpring.update(),_=this._ySpring.update(),S=this._scaleSpring.update(),M=this._degreesSpring.update();return d||_||S||M?(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(d){return this.getBoundsNoRotate(d).rotate(this.getRotation(d),this._getRotationPoint(d))},getBoundsNoRotate:function(d){return d?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(d){var _=this.getBoundsNoRotate(d);if(this._clip){var S=d?this._worldWidthCurrent:this._worldWidthTarget,M=S/this.source.dimensions.x,I=this._clip.times(M);_=new e.Rect(_.x+I.x,_.y+I.y,I.width,I.height)}return _.rotate(this.getRotation(d),this._getRotationPoint(d))},getTileBounds:function(d,_,S){var M=this.source.getNumTiles(d),I=(M.x+_%M.x)%M.x,V=(M.y+S%M.y)%M.y,j=this.source.getTileBounds(d,I,V);return this.getFlip()&&(j.x=1-j.x-j.width),j.x+=(_-I)/M.x,j.y+=this._worldHeightCurrent/this._worldWidthCurrent*((S-V)/M.y),j},getContentSize:function(){return new e.Point(this.source.dimensions.x,this.source.dimensions.y)},getSizeInWindowCoordinates:function(){var d=this.imageToWindowCoordinates(new e.Point(0,0)),_=this.imageToWindowCoordinates(this.getContentSize());return new e.Point(_.x-d.x,_.y-d.y)},_viewportToImageDelta:function(d,_,S){var M=S?this._scaleSpring.current.value:this._scaleSpring.target.value;return new e.Point(d*(this.source.dimensions.x/M),_*(this.source.dimensions.y*this.contentAspectX/M))},viewportToImageCoordinates:function(d,_,S){var M;return d instanceof e.Point?(S=_,M=d):M=new e.Point(d,_),M=M.rotate(-this.getRotation(S),this._getRotationPoint(S)),S?this._viewportToImageDelta(M.x-this._xSpring.current.value,M.y-this._ySpring.current.value):this._viewportToImageDelta(M.x-this._xSpring.target.value,M.y-this._ySpring.target.value)},_imageToViewportDelta:function(d,_,S){var M=S?this._scaleSpring.current.value:this._scaleSpring.target.value;return new e.Point(d/this.source.dimensions.x*M,_/this.source.dimensions.y/this.contentAspectX*M)},imageToViewportCoordinates:function(d,_,S){d instanceof e.Point&&(S=_,_=d.y,d=d.x);var M=this._imageToViewportDelta(d,_);return S?(M.x+=this._xSpring.current.value,M.y+=this._ySpring.current.value):(M.x+=this._xSpring.target.value,M.y+=this._ySpring.target.value),M.rotate(this.getRotation(S),this._getRotationPoint(S))},imageToViewportRectangle:function(d,_,S,M,I){var V=d;V instanceof e.Rect?I=_:V=new e.Rect(d,_,S,M);var j=this.imageToViewportCoordinates(V.getTopLeft(),I),q=this._imageToViewportDelta(V.width,V.height,I);return new e.Rect(j.x,j.y,q.x,q.y,V.degrees+this.getRotation(I))},viewportToImageRectangle:function(d,_,S,M,I){var V=d;d instanceof e.Rect?I=_:V=new e.Rect(d,_,S,M);var j=this.viewportToImageCoordinates(V.getTopLeft(),I),q=this._viewportToImageDelta(V.width,V.height,I);return new e.Rect(j.x,j.y,q.x,q.y,V.degrees-this.getRotation(I))},viewerElementToImageCoordinates:function(d){var _=this.viewport.pointFromPixel(d,!0);return this.viewportToImageCoordinates(_)},imageToViewerElementCoordinates:function(d){var _=this.imageToViewportCoordinates(d);return this.viewport.pixelFromPoint(_,!0)},windowToImageCoordinates:function(d){var _=d.minus(s.getElementPosition(this.viewer.element));return this.viewerElementToImageCoordinates(_)},imageToWindowCoordinates:function(d){var _=this.imageToViewerElementCoordinates(d);return _.plus(s.getElementPosition(this.viewer.element))},_viewportToTiledImageRectangle:function(d){var _=this._scaleSpring.current.value;return d=d.rotate(-this.getRotation(!0),this._getRotationPoint(!0)),new e.Rect((d.x-this._xSpring.current.value)/_,(d.y-this._ySpring.current.value)/_,d.width/_,d.height/_,d.degrees)},viewportToImageZoom:function(d){var _=this._scaleSpring.current.value*this.viewport._containerInnerSize.x/this.source.dimensions.x;return _*d},imageToViewportZoom:function(d){var _=this._scaleSpring.current.value*this.viewport._containerInnerSize.x/this.source.dimensions.x;return d/_},setPosition:function(d,_){var S=this._xSpring.target.value===d.x&&this._ySpring.target.value===d.y;if(_){if(S&&this._xSpring.current.value===d.x&&this._ySpring.current.value===d.y)return;this._xSpring.resetTo(d.x),this._ySpring.resetTo(d.y),this._needsDraw=!0}else{if(S)return;this._xSpring.springTo(d.x),this._ySpring.springTo(d.y),this._needsDraw=!0}S||this._raiseBoundsChange()},setWidth:function(d,_){this._setScale(d,_)},setHeight:function(d,_){this._setScale(d/this.normHeight,_)},setCroppingPolygons:function(d){var _=function(M){return M instanceof e.Point||typeof M.x=="number"&&typeof M.y=="number"},S=function(M){return M.map(function(I){try{if(_(I))return{x:I.x,y:I.y};throw new Error}catch{throw new Error("A Provided cropping polygon point is not supported")}})};try{if(!e.isArray(d))throw new Error("Provided cropping polygon is not an array");this._croppingPolygons=d.map(function(M){return S(M)})}catch(M){e.console.error("[TiledImage.setCroppingPolygons] Cropping polygon format not supported"),e.console.error(M),this._croppingPolygons=null}},resetCroppingPolygons:function(){this._croppingPolygons=null},fitBounds:function(d,_,S){_=_||e.Placement.CENTER;var M=e.Placement.properties[_],I=this.contentAspectX,V=0,j=0,q=1,K=1;if(this._clip&&(I=this._clip.getAspectRatio(),q=this._clip.width/this.source.dimensions.x,K=this._clip.height/this.source.dimensions.y,d.getAspectRatio()>I?(V=this._clip.x/this._clip.height*d.height,j=this._clip.y/this._clip.height*d.height):(V=this._clip.x/this._clip.width*d.width,j=this._clip.y/this._clip.width*d.width)),d.getAspectRatio()>I){var re=d.height/K,ee=0;M.isHorizontallyCentered?ee=(d.width-d.height*I)/2:M.isRight&&(ee=d.width-d.height*I),this.setPosition(new e.Point(d.x-V+ee,d.y-j),S),this.setHeight(re,S)}else{var fe=d.width/q,ce=0;M.isVerticallyCentered?ce=(d.height-d.width/I)/2:M.isBottom&&(ce=d.height-d.width/I),this.setPosition(new e.Point(d.x-V,d.y-j+ce),S),this.setWidth(fe,S)}},getClip:function(){return this._clip?this._clip.clone():null},setClip:function(d){e.console.assert(!d||d instanceof e.Rect,"[TiledImage.setClip] newClip must be an OpenSeadragon.Rect or null"),d instanceof e.Rect?this._clip=d.clone():this._clip=null,this._needsDraw=!0,this.raiseEvent("clip-change")},getFlip:function(){return!!this.flipped},setFlip:function(d){this.flipped=!!d,this._needsDraw=!0,this._raiseBoundsChange()},getOpacity:function(){return this.opacity},setOpacity:function(d){d!==this.opacity&&(this.opacity=d,this._needsDraw=!0,this.raiseEvent("opacity-change",{opacity:this.opacity}))},getPreload:function(){return this._preload},setPreload:function(d){this._preload=!!d,this._needsDraw=!0},getRotation:function(d){return d?this._degreesSpring.current.value:this._degreesSpring.target.value},setRotation:function(d,_){this._degreesSpring.target.value===d&&this._degreesSpring.isAtTargetValue()||(_?this._degreesSpring.resetTo(d):this._degreesSpring.springTo(d),this._needsDraw=!0,this._raiseBoundsChange())},_getRotationPoint:function(d){return this.getBoundsNoRotate(d).getCenter()},getCompositeOperation:function(){return this.compositeOperation},setCompositeOperation:function(d){d!==this.compositeOperation&&(this.compositeOperation=d,this._needsDraw=!0,this.raiseEvent("composite-operation-change",{compositeOperation:this.compositeOperation}))},_setScale:function(d,_){var S=this._scaleSpring.target.value===d;if(_){if(S&&this._scaleSpring.current.value===d)return;this._scaleSpring.resetTo(d),this._updateForScale(),this._needsDraw=!0}else{if(S)return;this._scaleSpring.springTo(d),this._updateForScale(),this._needsDraw=!0}S||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 d=Math.max(this.source.minLevel,Math.floor(Math.log(this.minZoomImageRatio)/Math.log(2))),_=this.viewport.deltaPixelsFromPointsNoRotate(this.source.getPixelRatio(0),!0).x*this._scaleSpring.current.value,S=Math.min(Math.abs(this.source.maxLevel),Math.abs(Math.floor(Math.log(_/this.minPixelRatio)/Math.log(2))));return S=Math.max(S,this.source.minLevel||0),d=Math.min(d,S),{lowestLevel:d,highestLevel:S}},_updateViewport:function(){for(this._needsDraw=!1,this._tilesLoading=0,this.loadingCoverage={};this.lastDrawn.length>0;){var d=this.lastDrawn.pop();d.beingDrawn=!1}var _=this.viewport,S=this._viewportToTiledImageRectangle(_.getBoundsWithMargins(!0));if(!this.wrapHorizontal&&!this.wrapVertical){var M=this._viewportToTiledImageRectangle(this.getClippedBounds(!0));if(S=S.intersection(M),S===null)return}for(var I=this._getLevelsInterval(),V=I.lowestLevel,j=I.highestLevel,q=null,K=!1,re=e.now(),ee=j;ee>=V;ee--){var fe=!1,ce=_.deltaPixelsFromPointsNoRotate(this.source.getPixelRatio(ee),!0).x*this._scaleSpring.current.value;if(ee===V||!K&&ce>=this.minPixelRatio)fe=!0,K=!0;else if(!K)continue;var ye=_.deltaPixelsFromPointsNoRotate(this.source.getPixelRatio(ee),!1).x*this._scaleSpring.current.value,ae=_.deltaPixelsFromPointsNoRotate(this.source.getPixelRatio(Math.max(this.source.getClosestLevel(),0)),!1).x*this._scaleSpring.current.value,oe=this.immediateRender?1:ae,ie=Math.min(1,(ce-.5)/.5),we=oe/Math.abs(oe-ye);if(q=i(this,K,fe,ee,ie,we,S,re,q),g(this.coverage,ee))break}C(this,this.lastDrawn),q&&!q.context2D?(l(this,q,re),this._needsDraw=!0,this._setFullyLoaded(!1)):this._setFullyLoaded(this._tilesLoading===0)},_getCornerTiles:function(d,_,S){var M,I;this.wrapHorizontal?(M=e.positiveModulo(_.x,1),I=e.positiveModulo(S.x,1)):(M=Math.max(0,_.x),I=Math.min(1,S.x));var V,j,q=1/this.source.aspectRatio;this.wrapVertical?(V=e.positiveModulo(_.y,q),j=e.positiveModulo(S.y,q)):(V=Math.max(0,_.y),j=Math.min(q,S.y));var K=this.source.getTileAtPoint(d,new e.Point(M,V)),re=this.source.getTileAtPoint(d,new e.Point(I,j)),ee=this.source.getNumTiles(d);return this.wrapHorizontal&&(K.x+=ee.x*Math.floor(_.x),re.x+=ee.x*Math.floor(S.x)),this.wrapVertical&&(K.y+=ee.y*Math.floor(_.y/q),re.y+=ee.y*Math.floor(S.y/q)),{topLeft:K,bottomRight:re}}});function i(d,_,S,M,I,V,j,q,K){var re=j.getBoundingBox().getTopLeft(),ee=j.getBoundingBox().getBottomRight();d.viewer&&d.viewer.raiseEvent("update-level",{tiledImage:d,havedrawn:_,level:M,opacity:I,visibility:V,drawArea:j,topleft:re,bottomright:ee,currenttime:q,best:K}),x(d.coverage,M),x(d.loadingCoverage,M);var fe=d._getCornerTiles(M,re,ee),ce=fe.topLeft,ye=fe.bottomRight,ae=d.source.getNumTiles(M),oe=d.viewport.pixelFromPoint(d.viewport.getCenter());d.getFlip()&&(ye.x+=1,d.wrapHorizontal||(ye.x=Math.min(ye.x,ae.x-1)));for(var ie=ce.x;ie<=ye.x;ie++)for(var we=ce.y;we<=ye.y;we++){var Q;if(d.getFlip()){var Ce=(ae.x+ie%ae.x)%ae.x;Q=ie+ae.x-Ce-Ce-1}else Q=ie;j.intersection(d.getTileBounds(M,Q,we))!==null&&(K=n(d,S,_,Q,we,M,I,V,oe,ae,q,K))}return K}function n(d,_,S,M,I,V,j,q,K,re,ee,fe){var ce=r(M,I,V,d,d.source,d.tilesMatrix,ee,re,d._worldWidthCurrent,d._worldHeightCurrent),ye=S;d.viewer&&d.viewer.raiseEvent("update-tile",{tiledImage:d,tile:ce}),T(d.coverage,V,M,I,!1);var ae=ce.loaded||ce.loading||m(d.loadingCoverage,V,M,I);if(T(d.loadingCoverage,V,M,I,ae),!ce.exists||(_&&!ye&&(m(d.coverage,V,M,I)?T(d.coverage,V,M,I,!0):ye=!0),!ye))return fe;if(u(ce,d.source.tileOverlap,d.viewport,K,q,d),!ce.loaded)if(ce.context2D)o(d,ce);else{var oe=d._tileCache.getImageRecord(ce.cacheKey);if(oe){var ie=oe.getImage();o(d,ce,ie)}}if(ce.loaded){var we=h(d,ce,M,I,V,j,ee);we&&(d._needsDraw=!0)}else ce.loading?d._tilesLoading++:ae||(fe=P(fe,ce));return fe}function r(d,_,S,M,I,V,j,q,K,re){var ee,fe,ce,ye,ae,oe,ie,we,Q;return V[S]||(V[S]={}),V[S][d]||(V[S][d]={}),(!V[S][d][_]||!V[S][d][_].flipped!=!M.flipped)&&(ee=(q.x+d%q.x)%q.x,fe=(q.y+_%q.y)%q.y,ce=M.getTileBounds(S,d,_),ye=I.getTileBounds(S,ee,fe,!0),ae=I.tileExists(S,ee,fe),oe=I.getTileUrl(S,ee,fe),M.loadTilesWithAjax?(ie=I.getTileAjaxHeaders(S,ee,fe),e.isPlainObject(M.ajaxHeaders)&&(ie=e.extend({},M.ajaxHeaders,ie))):ie=null,we=I.getContext2D?I.getContext2D(S,ee,fe):void 0,Q=new e.Tile(S,d,_,ce,ae,oe,we,M.loadTilesWithAjax,ie,ye),M.getFlip()?ee===0&&(Q.isRightMost=!0):ee===q.x-1&&(Q.isRightMost=!0),fe===q.y-1&&(Q.isBottomMost=!0),Q.flipped=M.flipped,V[S][d][_]=Q),Q=V[S][d][_],Q.lastTouchTime=j,Q}function l(d,_,S){_.loading=!0,d._imageLoader.addJob({src:_.url,loadWithAjax:_.loadWithAjax,ajaxHeaders:_.ajaxHeaders,crossOriginPolicy:d.crossOriginPolicy,ajaxWithCredentials:d.ajaxWithCredentials,callback:function(M,I,V){a(d,_,S,M,I,V)},abort:function(){_.loading=!1}})}function a(d,_,S,M,I,V){if(!M){e.console.log("Tile %s failed to load: %s - error: %s",_,_.url,I),d.viewer.raiseEvent("tile-load-failed",{tile:_,tiledImage:d,time:S,message:I,tileRequest:V}),_.loading=!1,_.exists=!1;return}if(Sd.visibility||_.visibility===d.visibility&&_.squaredDistance1&&q>d.smoothTileEdgesMinZoom&&!d.iOSDevice&&d.getRotation(!0)%360===0&&e.supportsCanvas&&(M=!0,I=S.getScaleForEdgeSmoothing(),V=S.getTranslationForEdgeSmoothing(I,d._drawer.getCanvasSize(!1),d._drawer.getCanvasSize(!0)));var K;M&&(I||(K=d.viewport.viewportToViewerElementRectangle(d.getClippedBounds(!0)).getIntegerBoundingBox(),d._drawer.viewer.viewport.getFlip()&&(d.viewport.degrees!==0||d.getRotation(!0)%360!==0)&&(K.x=d._drawer.viewer.container.clientWidth-(K.x+K.width)),K=K.times(e.pixelDensityRatio)),d._drawer._clear(!0,K)),I||(d.viewport.degrees!==0&&d._drawer._offsetForRotation({degrees:d.viewport.degrees,useSketch:M}),d.getRotation(!0)%360!==0&&d._drawer._offsetForRotation({degrees:d.getRotation(!0),point:d.viewport.pixelFromPointNoRotate(d._getRotationPoint(!0),!0),useSketch:M}),d.viewport.degrees===0&&d.getRotation(!0)%360===0&&d._drawer.viewer.viewport.getFlip()&&d._drawer._flip());var re=!1;if(d._clip){d._drawer.saveContext(M);var ee=d.imageToViewportRectangle(d._clip,!0);ee=ee.rotate(-d.getRotation(!0),d._getRotationPoint(!0));var fe=d._drawer.viewportToDrawerRectangle(ee);I&&(fe=fe.times(I)),V&&(fe=fe.translate(V)),d._drawer.setClip(fe,M),re=!0}if(d._croppingPolygons){d._drawer.saveContext(M);try{var ce=d._croppingPolygons.map(function(ie){return ie.map(function(we){var Q=d.imageToViewportCoordinates(we.x,we.y,!0).rotate(-d.getRotation(!0),d._getRotationPoint(!0)),Ce=d._drawer.viewportCoordToDrawerCoord(Q);return I&&(Ce=Ce.times(I)),Ce})});d._drawer.clipWithPolygons(ce,M)}catch(ie){e.console.error(ie)}re=!0}if(d.placeholderFillStyle&&d._hasOpaqueTile===!1){var ye=d._drawer.viewportToDrawerRectangle(d.getBounds(!0));I&&(ye=ye.times(I)),V&&(ye=ye.translate(V));var ae=null;typeof d.placeholderFillStyle=="function"?ae=d.placeholderFillStyle(d,d._drawer.context):ae=d.placeholderFillStyle,d._drawer.drawRectangle(ye,ae,M)}for(var oe=_.length-1;oe>=0;oe--)S=_[oe],d._drawer.drawTile(S,d._drawingHandler,M,I,V),S.beingDrawn=!0,d.viewer&&d.viewer.raiseEvent("tile-drawn",{tiledImage:d,tile:S});re&&d._drawer.restoreContext(M),I||(d.getRotation(!0)%360!==0&&d._drawer._restoreRotationChanges(M),d.viewport.degrees!==0&&d._drawer._restoreRotationChanges(M)),M&&(I&&(d.viewport.degrees!==0&&d._drawer._offsetForRotation({degrees:d.viewport.degrees,useSketch:!1}),d.getRotation(!0)%360!==0&&d._drawer._offsetForRotation({degrees:d.getRotation(!0),point:d.viewport.pixelFromPointNoRotate(d._getRotationPoint(!0),!0),useSketch:!1})),d._drawer.blendSketch({opacity:d.opacity,scale:I,translate:V,compositeOperation:d.compositeOperation,bounds:K}),I&&(d.getRotation(!0)%360!==0&&d._drawer._restoreRotationChanges(!1),d.viewport.degrees!==0&&d._drawer._restoreRotationChanges(!1))),I||d.viewport.degrees===0&&d.getRotation(!0)%360===0&&d._drawer.viewer.viewport.getFlip()&&d._drawer._flip(),k(d,_)}}function k(d,_){if(d.debugMode)for(var S=_.length-1;S>=0;S--){var M=_[S];try{d._drawer.drawDebugInfo(M,_.length,S,d)}catch(I){e.console.error(I)}}}}(s),function(e){var i=function(r){e.console.assert(r,"[TileCache.cacheTile] options is required"),e.console.assert(r.tile,"[TileCache.cacheTile] options.tile is required"),e.console.assert(r.tiledImage,"[TileCache.cacheTile] options.tiledImage is required"),this.tile=r.tile,this.tiledImage=r.tiledImage},n=function(r){e.console.assert(r,"[ImageRecord] options is required"),e.console.assert(r.image,"[ImageRecord] options.image is required"),this._image=r.image,this._tiles=[]};n.prototype={destroy:function(){this._image=null,this._renderedContext=null,this._tiles=null},getImage:function(){return this._image},getRenderedContext:function(){if(!this._renderedContext){var r=document.createElement("canvas");r.width=this._image.width,r.height=this._image.height,this._renderedContext=r.getContext("2d"),this._renderedContext.drawImage(this._image,0,0),this._image=null}return this._renderedContext},setRenderedContext:function(r){e.console.error("ImageRecord.setRenderedContext is deprecated. The rendered context should be created by the ImageRecord itself when calling ImageRecord.getRenderedContext."),this._renderedContext=r},addTile:function(r){e.console.assert(r,"[ImageRecord.addTile] tile is required"),this._tiles.push(r)},removeTile:function(r){for(var l=0;lthis._maxImageCacheCount){for(var u=null,h=-1,g=null,m,T,x,P,C,k,d=this._tilesLoaded.length-1;d>=0;d--)if(k=this._tilesLoaded[d],m=k.tile,!(m.level<=l||m.beingDrawn)){if(!u){u=m,h=d,g=k;continue}P=m.lastTouchTime,T=u.lastTouchTime,C=m.level,x=u.level,(Px)&&(u=m,h=d,g=k)}u&&h>=0&&(this._unloadTile(g),a=h)}this._tilesLoaded[a]=new i({tile:r.tile,tiledImage:r.tiledImage})},clearTilesFor:function(r){e.console.assert(r,"[TileCache.clearTilesFor] tiledImage is required");for(var l,a=0;a=this._items.length)throw new Error("Index bigger than number of layers.");n===r||r===-1||(this._items.splice(r,1),this._items.splice(n,0,i),this._needsDraw=!0,this.raiseEvent("item-index-change",{item:i,previousIndex:r,newIndex:n}))},removeItem:function(i){e.console.assert(i,"[World.removeItem] item is required");var n=e.indexOf(this._items,i);n!==-1&&(i.removeHandler("bounds-change",this._delegatedFigureSizes),i.removeHandler("clip-change",this._delegatedFigureSizes),i.destroy(),this._items.splice(n,1),this._figureSizes(),this._needsDraw=!0,this._raiseRemoveItem(i))},removeAll:function(){this.viewer._cancelPendingImages();var i,n;for(n=0;nP.height?C=o:C=o*(P.width/P.height),k=C*(P.height/P.width),d=new e.Point(m+(o-C)/2,T+(o-k)/2),x.setPosition(d,n),x.setWidth(C,n),r==="horizontal"?m+=h:T+=h;this.setAutoRefigureSizes(!0)},_figureSizes:function(){var i=this._homeBounds?this._homeBounds.clone():null,n=this._contentSize?this._contentSize.clone():null,r=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 l=this._items[0],a=l.getBounds();this._contentFactor=l.getContentSize().x/a.width;for(var o=l.getClippedBounds().getBoundingBox(),u=o.x,h=o.y,g=o.x+o.width,m=o.y+o.height,T=1;T0},saturation(){const t=this.$store.options.filters.saturate;return typeof t=="number"?t:1}},watch:{"$store.options.pages":function(t,s){const e=t.length!==s.length;this.loadImageInfo(e)}},mounted(){this.loadImageInfo(),this.updateFilterStyle(),this.$store.rootElement.addEventListener("keydown",this.onKeydown),this.$store.rootElement.addEventListener("keypress",this.onKeypress)},beforeUnmount(){this.viewer&&this.viewer.destroy(),this.$store.rootElement.removeEventListener("keydown",this.onKeydown),this.$store.rootElement.removeEventListener("keypress",this.onKeypress)},methods:{closeFilters(){this.filtersVisible=!1},initViewer(t){const s=[];let e=0,i,n=0;if(this.$store.options.pages.forEach((r,l)=>{let a=1;r<1?(a=0,i=l>0?this.$store.pageCount:1):i=r;const o=this.tileSources[i];if(!o)return;e||(e=o.width);const u=o.width/e;s.push({opacity:a,tileSource:o,width:u,x:n}),n+=u+Oh}),this.viewer){this.viewer.addOnceHandler("open",()=>{if(this.viewerState.isReset||t)this.resetScan();else{if(this.viewer.viewport.applyConstraints(!0),!this.$store.options.optionsResetOnPageChange)return;this.$store.options.optionsResetOnPageChange.forEach(r=>{if(r==="filters")this.resetFilters();else if(r==="pan"){const l=this.viewer.viewport.getBounds();if(l.x<=0&&l.y<=0)return;const a=this.$store.options.pages[0]?0:1;this.viewer.viewport.panTo({x:l.x>0?l.width/2+a:this.$store.options.pan.x,y:l.y>0?l.height/2:this.$store.options.pan.y}),this.$store.updateOptions({pan:{}})}else r==="rotation"?(this.viewer.viewport.setRotation(0),this.$store.updateOptions({rotation:null})):r==="zoom"&&(this.viewer.viewport.goHome(),this.$store.updateOptions({zoom:null}))})}}),this.viewer.open(s);return}this.viewer=Hh({animationTime:.4,element:this.$refs.image,immediateRender:!0,preload:!this.$store.isMobile(),preserveImageSizeOnResize:!0,preserveViewport:!0,showNavigationControl:!1,showZoomControl:!1,tileSources:s,visibilityRatio:.2,...this.$store.options.viewer}),this.viewer.innerTracker.keyHandler=null,this.viewer.gestureSettingsMouse.clickToZoom=!1,this.viewer.addHandler("animation-finish",()=>{if(this.viewerState.isReset){this.removeScanOptions();return}const r=this.viewer.viewport.getCenter();this.$store.updateOptions({pan:{x:Math.round(r.x*1e3)/1e3,y:Math.round(r.y*1e3)/1e3},zoom:Math.round(this.viewer.viewport.getZoom()*1e3)/1e3})}),this.viewer.addHandler("canvas-click",()=>{document.body.click()}),this.viewer.addHandler("open",()=>{this.startLoadingWatch(),this.$store.options.pan.x!==void 0||this.$store.options.pan.y!==void 0||this.$store.options.zoom?((this.$store.options.pan.x!==void 0||this.$store.options.pan.y!==void 0)&&this.viewer.viewport.panTo({x:this.$store.options.pan.x,y:this.$store.options.pan.y},!0),this.$store.options.zoom&&this.viewer.viewport.zoomTo(this.$store.options.zoom,null,!0)):this.viewer.viewport.goHome(),this.$store.options.rotation!==null&&this.viewer.viewport.setRotation(this.$store.options.rotation)}),this.viewer.addHandler("pan",this.updateViewerState),this.viewer.addHandler("resize",this.updateViewerState),this.viewer.addHandler("zoom",this.updateViewerState),this.viewer.addHandler("tile-load-failed",r=>{this.$store.addError(`Error loading image: ${r.message}`)}),this.$api.expose(this.resetScan),this.$api.expose(this.viewer,"viewer")},loadImageInfo(t=!1){this.stopLoadingWatch();const s=[];this.$store.options.pages.forEach(e=>{if(e<1||this.tileSources[e])return;const{resource:i}=this.$store.canvases[e-1].images[0];if(i.service){const n=i.service["@id"],r=`${n}${n.slice(-1)==="/"?"":"/"}info.json`;s.push(this.$store.fetchJson(r).then(l=>({...l,page:e}),l=>{let a;l.response&&l.response.statusText?a=l.response.statusText:l.message&&(a=l.message),this.$store.addError(`Error loading info file for page ${e}${a?`: ${a}`:""}`)}))}else this.tileSources[e]={type:"image",url:i["@id"],width:i.width,height:i.height}}),s.length?Promise.all(s).then(e=>{e.forEach(i=>{i&&(this.tileSources[i.page]=i)}),this.initViewer(t)}):this.initViewer(t)},onKeydown(t){t.key==="Escape"&&(this.filtersVisible=!1),[45,48,96].includes(t.keyCode)&&(t.shiftKey?this.resetScan(t):this.viewer.viewport.goHome())},onKeypress(t){if(!wn(t))switch(t.key){case"r":case"R":this.rotateRight(t);break;case"i":this.filtersVisible=!this.filtersVisible,this.filtersVisible&&this.$nextTick(()=>{this.$refs.firstSlider.focus()});break;case"I":this.resetFilters();break;case"+":case"=":case"W":this.viewer.viewport.zoomBy(1.1),this.viewer.viewport.applyConstraints();break;case"-":case"_":case"S":this.viewer.viewport.zoomBy(.9),this.viewer.viewport.applyConstraints();break;case"w":this.viewer.innerTracker.keyDownHandler({keyCode:38});break;case"s":this.viewer.innerTracker.keyDownHandler({keyCode:40});break;case"a":this.viewer.innerTracker.keyDownHandler({keyCode:37});break;case"d":this.viewer.innerTracker.keyDownHandler({keyCode:39});break}},removeScanOptions(){this.$store.updateOptions({pan:{},zoom:null})},resetFilters(){this.$refs.image.style.cssText="",this.$store.updateOptions({filters:{}})},resetScan(t){t&&(this.viewer.viewport.setRotation(0),this.$store.updateOptions({rotation:null}),this.filtersActive&&this.resetFilters()),this.viewer.viewport.goHome(),this.removeScanOptions()},rotateRight(t){const{viewport:s}=this.viewer,e=t&&t.shiftKey?0:(s.getRotation()+90)%360;s.setRotation(e),this.$store.updateOptions({rotation:e||null})},setFilter(t,s){const e=s.target.valueAsNumber;e===1?delete this.$store.options.filters[t]:this.$store.options.filters[t]=e,this.$store.updateOptions({filters:this.$store.options.filters}),this.updateFilterStyle()},startLoadingWatch(){this.$store.loading=0;for(let t=this.viewer.world.getItemCount()-1;t>=0;t-=1){const s=this.viewer.world.getItemAt(t);if(s&&s._tilesLoading){this.$store.loading=1;break}}this.loadingTimeout=setTimeout(this.startLoadingWatch,200)},stopLoadingWatch(){clearTimeout(this.loadingTimeout)},updateFilterStyle(){if(!this.filtersActive)return;const t=[];Object.keys(this.$store.options.filters).forEach(i=>{t.push(`${i}(${this.$store.options.filters[i]})`)});const{image:s}=this.$refs,e=t.join(" ");s.style.cssText=`filter: ${e}`},updateViewerState(){const t=this.viewer.viewport.getZoom();this.viewerState.isMaxZoom=t>=this.viewer.viewport.getMaxZoom(),this.viewerState.isMinZoom=t<=this.viewer.viewport.getMinZoom();const s=this.viewer.viewport.getHomeBounds(),e=this.viewer.viewport.getBounds();this.viewerState.isReset=Math.abs(s.height-e.height)<1e-9&&Math.abs(s.width-e.width)<1e-9&&Math.abs(s.x-e.x)<1e-9&&Math.abs(s.y-e.y)<1e-9},zoomIn(){this.viewer.viewport.zoomBy(this.zoomFactor)},zoomOut(){this.viewer.viewport.zoomBy(1/this.zoomFactor)}}},Mh={class:"tify-scan"},Dh={class:"tify-sr-only"},kh=["title"],Fh=["title"],Ah={key:2,class:"tify-scan-buttons"},Bh=["disabled","title"],Ih=["disabled","title"],zh=["disabled","title"],Nh=["title"],Vh=["title","aria-controls","aria-expanded"],Uh=["id"],Wh={class:"tify-sr-only"},jh=["value"],Gh=["value"],qh=["value"],Zh=["disabled"],Kh={ref:"image",class:"tify-scan-image"};function Xh(t,s,e,i,n,r){const l=nr,a=ir,o=mh,u=ch,h=sh,g=Qc,m=qc,T=Nc,x=kc,P=Rc,C=xc,k=cn("click-outside");return L(),D("section",Mh,[F("h2",Dh,Z(t.$translate("Scan")),1),!t.$store.isCustomPageView&&!t.$store.isFirstPage?(L(),D("button",{key:0,type:"button",class:"tify-scan-page-button -previous",title:t.$translate("Previous page"),onClick:s[0]||(s[0]=d=>t.$store.goToPreviousPage())},[te(l)],8,kh)):se("",!0),!t.$store.isCustomPageView&&!t.$store.isLastPage?(L(),D("button",{key:1,type:"button",class:"tify-scan-page-button -next",title:t.$translate("Next page"),onClick:s[1]||(s[1]=d=>t.$store.goToNextPage())},[te(a)],8,Fh)):se("",!0),n.viewer?(L(),D("div",Ah,[F("button",{type:"button",class:"tify-scan-button",disabled:n.viewerState.isMaxZoom,title:t.$translate("Zoom in"),onClick:s[2]||(s[2]=d=>r.zoomIn())},[te(o)],8,Bh),F("button",{type:"button",class:"tify-scan-button",disabled:n.viewerState.isReset,title:t.$translate("Reset"),onClick:s[3]||(s[3]=d=>r.resetScan(!!d.shiftKey))},[te(u)],8,Ih),F("button",{type:"button",class:"tify-scan-button",disabled:n.viewerState.isMinZoom,title:t.$translate("Zoom out"),onClick:s[4]||(s[4]=d=>r.zoomOut())},[te(h)],8,zh),F("button",{type:"button",class:xe(["tify-scan-button",{"-active":t.$store.options.rotation}]),title:t.$translate("Rotate"),onClick:s[5]||(s[5]=d=>r.rotateRight(d))},[te(g)],10,Nh),ke((L(),D("div",{class:xe(["tify-scan-filters",{"-open":n.filtersVisible}])},[F("button",{type:"button",class:xe(["tify-scan-button",{"-active":r.filtersActive}]),title:t.$translate("Toggle image filters"),"aria-controls":t.$store.getId("filters"),"aria-expanded":n.filtersVisible?"true":"false",onClick:s[6]||(s[6]=d=>n.filtersVisible=!n.filtersVisible)},[te(m)],10,Vh),ke(F("div",{id:t.$store.getId("filters"),class:"tify-scan-filters-popup"},[F("h3",Wh,Z(t.$translate("Image filters")),1),F("p",null,[F("label",null,[te(T),be(" "+Z(t.$translate("Brightness"))+" ",1),F("b",null,Z(Math.round((t.$store.options.filters.brightness||1)*100))+" %",1),F("input",{ref:"firstSlider",class:"tify-scan-range",max:"2",min:".5",step:".01",type:"range",value:t.$store.options.filters.brightness||1,onInput:s[7]||(s[7]=d=>r.setFilter("brightness",d))},null,40,jh)])]),F("p",null,[F("label",null,[te(x),be(" "+Z(t.$translate("Contrast"))+" ",1),F("b",null,Z(Math.round((t.$store.options.filters.contrast||1)*100))+" %",1),F("input",{class:"tify-scan-range",max:"2",min:".5",step:".01",type:"range",value:t.$store.options.filters.contrast||1,onInput:s[8]||(s[8]=d=>r.setFilter("contrast",d))},null,40,Gh)])]),F("p",null,[F("label",null,[te(P),be(" "+Z(t.$translate("Saturation"))+" ",1),F("b",null,Z(Math.round(r.saturation*100))+" %",1),F("input",{class:"tify-scan-range",max:"3",min:"0",step:".01",type:"range",value:r.saturation,onInput:s[9]||(s[9]=d=>r.setFilter("saturate",d))},null,40,qh)])]),F("p",null,[F("button",{type:"button",class:"tify-scan-reset",disabled:!r.filtersActive,onClick:s[10]||(s[10]=d=>r.resetFilters())},[te(C),be(" "+Z(t.$translate("Reset")),1)],8,Zh)])],8,Uh),[[Xe,n.filtersVisible]])],2)),[[k,r.closeFilters]])])):se("",!0),F("div",Kh,null,512)])}const Yh=ue(Lh,[["render",Xh]]),Jh={},Qh={class:"tify-icon",viewBox:"0 0 24 24"},$h=F("path",{d:"M14,14H19V16H16V19H14V14M5,14H10V19H8V16H5V14M8,5H10V10H5V8H8V5M19,8V10H14V5H16V8H19Z"},null,-1),ed=[$h];function td(t,s){return L(),D("svg",Qh,ed)}const id=ue(Jh,[["render",td]]),nd={},sd={class:"tify-icon",viewBox:"0 0 24 24"},rd=F("path",{d:"M5,5H10V7H7V10H5V5M14,5H19V10H17V7H14V5M17,14H19V19H14V17H17V14M10,17V19H5V14H7V17H10Z"},null,-1),od=[rd];function ad(t,s){return L(),D("svg",sd,od)}const ld=ue(nd,[["render",ad]]),ud={},cd={class:"tify-icon",viewBox:"0 0 24 24"},hd=F("path",{d:"M11,18H13V16H11V18M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20,12C20,16.41 16.41,20 12,20M12,6A4,4 0 0,0 8,10H10A2,2 0 0,1 12,8A2,2 0 0,1 14,10C14,12 11,11.75 11,15H13C13,12.75 16,12.5 16,10A4,4 0 0,0 12,6Z"},null,-1),dd=[hd];function fd(t,s){return L(),D("svg",cd,dd)}const pd=ue(ud,[["render",fd]]),gd={},md={class:"tify-icon",viewBox:"0 0 24 24"},vd=F("path",{d:"M11 15H17V17H11V15M9 7H7V9H9V7M11 13H17V11H11V13M11 9H17V7H11V9M9 11H7V13H9V11M21 5V19C21 20.1 20.1 21 19 21H5C3.9 21 3 20.1 3 19V5C3 3.9 3.9 3 5 3H19C20.1 3 21 3.9 21 5M19 5H5V19H19V5M9 15H7V17H9V15Z"},null,-1),yd=[vd];function wd(t,s){return L(),D("svg",md,yd)}const _d=ue(gd,[["render",wd]]),Td={},xd={class:"tify-icon",viewBox:"0 0 24 24"},bd=F("path",{d:"M13,5V11H14.17L12,13.17L9.83,11H11V5H13M15,3H9V9H5L12,16L19,9H15V3M19,18H5V20H19V18Z"},null,-1),Ed=[bd];function Pd(t,s){return L(),D("svg",xd,Ed)}const Sd=ue(Td,[["render",Pd]]),Cd={},Rd={class:"tify-icon",viewBox:"0 0 24 24"},Hd=F("path",{d:"M13.5,4A1.5,1.5 0 0,0 12,5.5A1.5,1.5 0 0,0 13.5,7A1.5,1.5 0 0,0 15,5.5A1.5,1.5 0 0,0 13.5,4M13.14,8.77C11.95,8.87 8.7,11.46 8.7,11.46C8.5,11.61 8.56,11.6 8.72,11.88C8.88,12.15 8.86,12.17 9.05,12.04C9.25,11.91 9.58,11.7 10.13,11.36C12.25,10 10.47,13.14 9.56,18.43C9.2,21.05 11.56,19.7 12.17,19.3C12.77,18.91 14.38,17.8 14.54,17.69C14.76,17.54 14.6,17.42 14.43,17.17C14.31,17 14.19,17.12 14.19,17.12C13.54,17.55 12.35,18.45 12.19,17.88C12,17.31 13.22,13.4 13.89,10.71C14,10.07 14.3,8.67 13.14,8.77Z"},null,-1),Od=[Hd];function Ld(t,s){return L(),D("svg",Rd,Od)}const Md=ue(Cd,[["render",Ld]]),Dd={},kd={class:"tify-icon",viewBox:"0 0 24 24"},Fd=F("path",{d:"M3,9H17V7H3V9M3,13H17V11H3V13M3,17H17V15H3V17M19,17H21V15H19V17M19,7V9H21V7H19M19,13H21V11H19V13Z"},null,-1),Ad=[Fd];function Bd(t,s){return L(),D("svg",kd,Ad)}const Id=ue(Dd,[["render",Bd]]),zd={},Nd={class:"tify-icon",viewBox:"0 0 24 24"},Vd=F("path",{d:"M4,5H20V7H4V5M4,9H20V11H4V9M4,13H20V15H4V13M4,17H14V19H4V17Z"},null,-1),Ud=[Vd];function Wd(t,s){return L(),D("svg",Nd,Ud)}const jd=ue(zd,[["render",Wd]]),Gd={},qd={class:"tify-icon",viewBox:"0 0 24 24"},Zd=F("path",{d:"M8.5,13.5L11,16.5L14.5,12L19,18H5M21,19V5C21,3.89 20.1,3 19,3H5A2,2 0 0,0 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19Z"},null,-1),Kd=[Zd];function Xd(t,s){return L(),D("svg",qd,Kd)}const Yd=ue(Gd,[["render",Xd]]),Jd={},Qd={class:"tify-icon",viewBox:"0 0 24 24"},$d=F("path",{d:"M12 16C13.1 16 14 16.9 14 18S13.1 20 12 20 10 19.1 10 18 10.9 16 12 16M12 10C13.1 10 14 10.9 14 12S13.1 14 12 14 10 13.1 10 12 10.9 10 12 10M12 4C13.1 4 14 4.9 14 6S13.1 8 12 8 10 7.1 10 6 10.9 4 12 4M6 16C7.1 16 8 16.9 8 18S7.1 20 6 20 4 19.1 4 18 4.9 16 6 16M6 10C7.1 10 8 10.9 8 12S7.1 14 6 14 4 13.1 4 12 4.9 10 6 10M6 4C7.1 4 8 4.9 8 6S7.1 8 6 8 4 7.1 4 6 4.9 4 6 4M18 16C19.1 16 20 16.9 20 18S19.1 20 18 20 16 19.1 16 18 16.9 16 18 16M18 10C19.1 10 20 10.9 20 12S19.1 14 18 14 16 13.1 16 12 16.9 10 18 10M18 4C19.1 4 20 4.9 20 6S19.1 8 18 8 16 7.1 16 6 16.9 4 18 4Z"},null,-1),ef=[$d];function tf(t,s){return L(),D("svg",Qd,ef)}const nf=ue(Jd,[["render",tf]]),sf={},rf={class:"tify-icon",viewBox:"0 0 24 24"},of=F("path",{d:"M5.59,7.41L10.18,12L5.59,16.59L7,18L13,12L7,6L5.59,7.41M16,6H18V18H16V6Z"},null,-1),af=[of];function lf(t,s){return L(),D("svg",rf,af)}const uf=ue(sf,[["render",lf]]),cf={},hf={class:"tify-icon",viewBox:"0 0 24 24"},df=F("path",{d:"M16,18H18V6H16M6,18L14.5,12L6,6V18Z"},null,-1),ff=[df];function pf(t,s){return L(),D("svg",hf,ff)}const gf=ue(cf,[["render",pf]]),mf={},vf={class:"tify-icon",viewBox:"0 0 24 24"},yf=F("path",{d:"M6,18V6H8V18H6M9.5,12L18,6V18L9.5,12Z"},null,-1),wf=[yf];function _f(t,s){return L(),D("svg",vf,wf)}const Tf=ue(mf,[["render",_f]]),xf={},bf={class:"tify-icon",viewBox:"0 0 24 24"},Ef=F("path",{d:"M18.41,16.59L13.82,12L18.41,7.41L17,6L11,12L17,18L18.41,16.59M6,6H8V18H6V6Z"},null,-1),Pf=[Ef];function Sf(t,s){return L(),D("svg",bf,Pf)}const Cf=ue(xf,[["render",Sf]]),Rf={},Hf={class:"tify-icon",viewBox:"0 0 24 24"},Of=F("path",{d:"M21,5C19.89,4.65 18.67,4.5 17.5,4.5C15.55,4.5 13.45,4.9 12,6C10.55,4.9 8.45,4.5 6.5,4.5C4.55,4.5 2.45,4.9 1,6V20.65C1,20.9 1.25,21.15 1.5,21.15C1.6,21.15 1.65,21.1 1.75,21.1C3.1,20.45 5.05,20 6.5,20C8.45,20 10.55,20.4 12,21.5C13.35,20.65 15.8,20 17.5,20C19.15,20 20.85,20.3 22.25,21.05C22.35,21.1 22.4,21.1 22.5,21.1C22.75,21.1 23,20.85 23,20.6V6C22.4,5.55 21.75,5.25 21,5M21,18.5C19.9,18.15 18.7,18 17.5,18C15.8,18 13.35,18.65 12,19.5V8C13.35,7.15 15.8,6.5 17.5,6.5C18.7,6.5 19.9,6.65 21,7V18.5Z"},null,-1),Lf=[Of];function Mf(t,s){return L(),D("svg",Hf,Lf)}const Df=ue(Rf,[["render",Mf]]),kf={},Ff={class:"tify-icon",viewBox:"0 0 24 24"},Af=F("path",{d:"M16,5V11H21V5M10,11H15V5H10M16,18H21V12H16M10,18H15V12H10M4,18H9V12H4M4,11H9V5H4V11Z"},null,-1),Bf=[Af];function If(t,s){return L(),D("svg",Ff,Bf)}const zf=ue(kf,[["render",If]]),Nf={directives:{clickOutside:yn.directive},data(){return{filter:"",filteredCanvases:[],highlightIndex:0,isOpen:!1}},computed:{currentPageLabel(){const t=this.$store.options.pages[0]||1,s=this.$store.options.pages[0]?this.$store.options.pages[0]-1:0,e=this.$store.convertValueToArray(this.$store.canvases[s].label)[0];return this.$store.getPageLabel(t,e)},currentPageTitleAttr(){const{pages:t}=this.$store.options,s=t[0]===0&&t.length>1?1:t[0],e=this.$translate("Physical page"),i=this.$translate("Logical page");return`${e}: ${s} -${i}: ${this.$store.convertValueToArray(this.$store.canvases[s-1].label)[0]}`}},watch:{filter(){this.updateFilteredCanvases(),this.$nextTick(()=>this.updateScroll())},isOpen(){this.isOpen&&(this.filter="",this.highlightIndex=this.$store.options.pages[0]-1)}},mounted(){this.updateFilteredCanvases(),this.$store.rootElement.addEventListener("keydown",this.onKeydown)},beforeUnmount(){this.$store.rootElement.removeEventListener("keydown",this.onKeydown)},methods:{closeDropdown(){this.isOpen=!1},onKeydown(t){if(!wn(t)){if(t.key==="Escape"){this.closeDropdown();return}t.key==="x"&&(this.toggleDropdown(),t.preventDefault())}},onKeyDownArrow(){this.highlightIndex0&&(this.highlightIndex-=1,this.updateScroll())},setPage(t){this.closeDropdown(),this.$store.setPage(t),this.$store.isMobile()&&this.$store.updateOptions({view:"scan"})},toggleDropdown(){this.isOpen=!this.isOpen,this.isOpen&&this.$nextTick(()=>{this.$refs.search.focus(),this.updateScroll()})},updateFilteredCanvases(){const t=[],s=this.filter.toLowerCase();let e=-1;this.$store.canvases.forEach((i,n)=>{const l=this.$store.convertValueToArray(i.label)[0].toLowerCase().includes(s),a=(n+1).toFixed().includes(s);if(l||a){const o=i;o.page=n+1,o.page===this.$store.options.pages[0]&&(e=t.length),t.push(o)}}),this.highlightIndex=e<0?0:e,this.filteredCanvases=t},updateScroll(){const{list:t}=this.$refs;if(t&&t.children[this.highlightIndex]){const{offsetTop:s}=t.children[this.highlightIndex];t.scrollTop=s-(t.offsetHeight/2-t.children[0].offsetHeight)}}}},Vf={class:"tify-page-select"},Uf=["title","aria-label","aria-controls","aria-expanded"],Wf=["id"],jf={class:"tify-page-select-filter"},Gf=["aria-label"],qf={ref:"list",class:"tify-page-select-list"},Zf=["onClick"];function Kf(t,s,e,i,n,r){const l=cn("click-outside");return L(),D("div",Vf,[ke((L(),D("button",{type:"button",class:"tify-page-select-button",title:r.currentPageTitleAttr,"aria-label":t.$translate("Current page"),"aria-controls":t.$store.getId("dropdown"),"aria-expanded":n.isOpen?"true":"false",onClick:s[0]||(s[0]=a=>r.toggleDropdown())},[be(Z(r.currentPageLabel),1)],8,Uf)),[[l,r.closeDropdown]]),ke(F("div",{id:t.$store.getId("dropdown"),key:"dropdown",class:"tify-page-select-dropdown",onClick:s[6]||(s[6]=_t(()=>{},["stop"]))},[F("div",jf,[ke(F("input",{ref:"search","onUpdate:modelValue":s[1]||(s[1]=a=>n.filter=a),"aria-label":t.$translate("Filter pages"),type:"text",class:"tify-page-select-input",onKeyup:s[2]||(s[2]=Vt(a=>n.filteredCanvases[n.highlightIndex]&&t.$store.setPage(n.filteredCanvases[n.highlightIndex].page),["enter"])),onKeydown:[s[3]||(s[3]=Vt(_t(a=>n.filter?n.filter="":r.closeDropdown(),["prevent"]),["esc"])),s[4]||(s[4]=Vt(_t(a=>r.onKeyUpArrow(),["prevent"]),["up"])),s[5]||(s[5]=Vt(_t(a=>r.onKeyDownArrow(),["prevent"]),["down"]))]},null,40,Gf),[[Ys,n.filter]])]),F("ol",qf,[(L(!0),D(de,null,Pe(n.filteredCanvases,(a,o)=>(L(),D("li",{key:o,class:xe({"-current":t.$store.options.pages.includes(a.page),"-highlighted":n.highlightIndex===o})},[F("a",{href:"javascript:;",onClick:u=>r.setPage(a.page)},Z(t.$store.getPageLabel(a.page,t.$store.convertValueToArray(a.label)[0])),9,Zf)],2))),128))],512)],8,Wf),[[Xe,n.isOpen]])])}const Xf=ue(Nf,[["render",Kf]]),Yf={directives:{clickOutside:yn.directive},props:{fulltextEnabled:Boolean,tocEnabled:Boolean},data(){return{controlsVisible:!1,fullscreenActive:!1,screen:this.$store.rootElement.parentNode}},computed:{fullscreenSupported(){return document.fullscreenElement===null||document.webkitFullscreenElement===null},isLastSection(){const{pages:t}=this.$store.options,s=t.length-1;return(t[s]?t[s]:t[s-1])>=this.sections[this.sections.length-1].firstPage},sections(){const t=[];return this.$store.manifest.structures&&this.$store.manifest.structures.forEach(s=>{if(!s.canvases){t.push({firstPage:1,lastPage:this.$store.pageCount});return}const e=s.canvases[0],i=this.$store.canvases.findIndex(l=>l["@id"]===e)+1,n=s.canvases[s.canvases.length-1],r=this.$store.canvases.findIndex(l=>l["@id"]===n)+1;t.push({firstPage:i,lastPage:r})}),t},title(){const t=String.fromCharCode(160);return this.$store.convertValueToArray((this.$store.manifest||this.$store.collection||{}).label).join(`${t}· `).trim().replace(/(\S{1,10})\s+(\S{1,10})$/,`$1${t}$2`)}},created(){this.$api.expose(this.setView),this.$api.expose(this.toggleDoublePage),this.$api.expose(this.toggleFullscreen)},mounted(){this.$store.rootElement.addEventListener("keydown",this.onKeyDown),["","moz","webkit"].forEach(s=>{document.addEventListener(`${s}fullscreenchange`,this.toggleFullscreenActive)})},beforeUnmount(){this.$store.rootElement.removeEventListener("keydown",this.onKeyDown)},methods:{closeControlsPopup(){this.controlsVisible=!1},detectFullscreen(){let t;switch(null){case document.fullscreenElement:t=document.fullscreenElement;break;case document.webkitFullscreenElement:t=document.webkitFullscreenElement;break;default:t=!1}return t},goToNextSection(){const{pages:t}=this.$store.options,s=t.length-1,e=t[s]?t[s]:t[s-1];let i=0;for(;e>=this.sections[i].firstPage||e&&e>=this.sections[i].firstPage;)i+=1;this.$store.setPage(this.sections[i].firstPage)},goToPreviousSection(){const{pages:t}=this.$store.options,s=t[0]?t[0]:t[1];let e=this.sections.length-1;for(;s<=this.sections[e].firstPage||s&&s<=this.sections[e].firstPage;)e-=1;this.$store.setPage(this.sections[e].firstPage)},onKeyDown(t){if(wn(t))return;if(t.key==="Escape"){this.controlsVisible=!1;return}switch(t.key){case"Backspace":this.$refs.switchViewSmall.offsetParent&&this.toggleView("scan");break;case"1":this.$store.manifest&&this.fulltextEnabled&&this.toggleView("fulltext");break;case"2":this.$store.manifest&&this.toggleView("thumbnails");break;case"3":this.$store.manifest&&this.tocEnabled&&this.toggleView("toc");break;case"4":this.toggleView("info");break;case"5":this.$store.manifest&&this.toggleView("export");break;case"6":this.$store.collection&&this.toggleView("collection");break;case"7":this.toggleView("help");break;case"b":this.$store.manifest&&this.toggleDoublePage();break;case"f":this.toggleFullscreen();break}if(!this.$store.manifest||this.$store.isCustomPageView)return;const{pages:s}=this.$store.options;switch(t.key){case"q":case",":s[0]>1&&this.$store.goToPreviousPage();break;case"e":case".":this.isLastPage||this.$store.goToNextPage();break;case"Q":s[0]>1&&this.$store.goToFirstPage();break;case"E":this.isLastPage||this.$store.goToLastPage();break}},setView(t){this.$store.updateOptions({view:t})},toggleControlsPopup(){this.controlsVisible=!this.controlsVisible},toggleDoublePage(t){const{pages:s}=this.$store.options;let e;if(s.length>1&&t!==!0||t===!1)e=[s[0]<1?1:s[0]];else if(s[0]<2)e=[0,1];else if(s[0]%2>0)e=[s[0]-1,s[0]];else{const i=s[0]1}]),title:t.$translate("Toggle double-page"),onClick:s[0]||(s[0]=(...K)=>r.toggleDoublePage&&r.toggleDoublePage(...K))},[t.$store.isCustomPageView?(L(),Me(a,{key:0})):(L(),Me(o,{key:1}))],10,ip)]),F("div",np,[F("button",{type:"button",class:"tify-header-button",disabled:t.$store.isCustomPageView||t.$store.isFirstPage,title:t.$translate("First page"),onClick:s[1]||(s[1]=K=>t.$store.goToFirstPage())},[te(u)],8,sp),t.$store.manifest.structures?(L(),D("button",{key:0,type:"button",class:"tify-header-button",disabled:t.$store.isCustomPageView||t.$store.isFirstPage,title:t.$translate("Previous section"),onClick:s[2]||(s[2]=K=>r.goToPreviousSection())},[te(h)],8,rp)):se("",!0),F("button",{type:"button",class:"tify-header-button",disabled:t.$store.isCustomPageView||t.$store.isFirstPage,title:t.$translate("Previous page"),onClick:s[3]||(s[3]=K=>t.$store.goToPreviousPage())},[te(g)],8,op),F("button",{type:"button",class:"tify-header-button",disabled:t.$store.isCustomPageView||t.$store.isLastPage,title:t.$translate("Next page"),onClick:s[4]||(s[4]=K=>t.$store.goToNextPage())},[te(m)],8,ap),t.$store.manifest.structures?(L(),D("button",{key:1,type:"button",class:"tify-header-button",disabled:t.$store.isCustomPageView||r.isLastSection,title:t.$translate("Next section"),onClick:s[5]||(s[5]=K=>r.goToNextSection())},[te(T)],8,lp)):se("",!0),F("button",{type:"button",class:"tify-header-button",disabled:t.$store.isCustomPageView||t.$store.isLastPage,title:t.$translate("Last page"),onClick:s[6]||(s[6]=K=>t.$store.goToLastPage())},[te(x)],8,up)])])):se("",!0),F("div",cp,[F("div",hp,[ke((L(),D("button",{type:"button","aria-controls":t.$store.getId("controls"),"aria-expanded":n.controlsVisible?"true":"false","aria-label":t.$translate("View"),class:"tify-header-button",title:t.$translate("View"),onClick:s[7]||(s[7]=(...K)=>r.toggleControlsPopup&&r.toggleControlsPopup(...K))},[te(P)],8,dp)),[[q,r.closeControlsPopup]])],512)]),F("div",{id:t.$store.getId("controls"),class:xe(["tify-header-column -controls",{"-visible":n.controlsVisible}])},[F("div",pp,[t.$store.manifest?(L(),D("button",{key:0,type:"button",class:xe(["tify-header-button -scan",{"-active":t.$store.options.view==="scan"}]),"aria-controls":t.$store.getId("scan"),"aria-expanded":t.$store.options.view==="scan"?"true":"false",onClick:s[8]||(s[8]=K=>r.toggleView("scan"))},[te(C),be(" "+Z(t.$translate("Scan")),1)],10,gp)):se("",!0),e.fulltextEnabled?(L(),D("button",{key:1,type:"button",class:xe(["tify-header-button",{"-active":t.$store.options.view==="fulltext"}]),"aria-controls":t.$store.getId("fulltext"),"aria-expanded":t.$store.options.view==="fulltext"?"true":"false",onClick:s[9]||(s[9]=K=>r.toggleView("fulltext"))},[te(k),be(" "+Z(t.$translate("Fulltext")),1)],10,mp)):se("",!0),t.$store.manifest?(L(),D("button",{key:2,type:"button",class:xe(["tify-header-button",{"-active":t.$store.options.view==="thumbnails"}]),"aria-controls":t.$store.getId("thumbnails"),"aria-expanded":t.$store.options.view==="thumbnails"?"true":"false",onClick:s[10]||(s[10]=K=>r.toggleView("thumbnails"))},[te(a),be(" "+Z(t.$translate("Pages")),1)],10,vp)):se("",!0),e.tocEnabled?(L(),D("button",{key:3,type:"button",class:xe(["tify-header-button",{"-active":t.$store.options.view==="toc"}]),"aria-controls":t.$store.getId("toc"),"aria-expanded":t.$store.options.view==="toc"?"true":"false",onClick:s[11]||(s[11]=K=>r.toggleView("toc"))},[te(d),be(" "+Z(t.$translate("Contents")),1)],10,yp)):se("",!0),F("button",{type:"button",class:xe(["tify-header-button",{"-active":t.$store.options.view==="info"}]),"aria-controls":t.$store.getId("info"),"aria-expanded":t.$store.options.view==="info"?"true":"false",onClick:s[12]||(s[12]=K=>r.toggleView("info"))},[te(_),be(" "+Z(t.$translate("Info")),1)],10,wp),t.$store.manifest?(L(),D("button",{key:4,type:"button",class:xe(["tify-header-button",{"-active":t.$store.options.view==="export"}]),"aria-controls":t.$store.getId("export"),"aria-expanded":t.$store.options.view==="export"?"true":"false",onClick:s[13]||(s[13]=K=>r.toggleView("export"))},[te(S),be(" "+Z(t.$translate("Export")),1)],10,_p)):se("",!0),t.$store.collection?(L(),D("button",{key:5,type:"button",class:xe(["tify-header-button",{"-active":t.$store.options.view==="collection"}]),"aria-controls":t.$store.getId("collection"),"aria-expanded":t.$store.options==="collection"?"true":"false",onClick:s[14]||(s[14]=K=>r.toggleView("collection"))},[te(M),be(" "+Z(t.$translate("Collection")),1)],10,Tp)):se("",!0)]),r.fullscreenSupported?(L(),D("div",xp,[F("button",{type:"button",class:xe(["tify-header-button -icon-only",{"-active":t.$store.options.view==="help"}]),"aria-controls":t.$store.getId("help"),"aria-expanded":t.$store.options.view==="help"?"true":"false",title:t.$translate("Help"),onClick:s[15]||(s[15]=K=>r.toggleView("help"))},[te(I),be(" "+Z(t.$translate("Help")),1)],10,bp),n.fullscreenActive?(L(),D("button",{key:1,type:"button",class:"tify-header-button -icon-only",title:t.$translate("Exit fullscreen"),onClick:s[17]||(s[17]=(...K)=>r.toggleFullscreen&&r.toggleFullscreen(...K))},[te(j),be(" "+Z(t.$translate("Exit fullscreen")),1)],8,Pp)):(L(),D("button",{key:0,type:"button",class:"tify-header-button -icon-only",title:t.$translate("Fullscreen"),onClick:s[16]||(s[16]=(...K)=>r.toggleFullscreen&&r.toggleFullscreen(...K))},[te(V),be(" "+Z(t.$translate("Fullscreen")),1)],8,Ep))])):se("",!0),t.$store.manifest?(L(),D("div",Sp,[F("button",{type:"button",class:"tify-header-button",disabled:t.$store.isCustomPageView||t.$store.isFirstPage,title:t.$translate("First page"),onClick:s[18]||(s[18]=K=>t.goToFirstPage())},[te(u)],8,Cp),t.$store.manifest.structures?(L(),D("button",{key:0,type:"button",class:"tify-header-button",disabled:t.$store.isCustomPageView||t.$store.isFirstPage,title:t.$translate("Previous section"),onClick:s[19]||(s[19]=K=>r.goToPreviousSection())},[te(h)],8,Rp)):se("",!0),F("button",{type:"button",class:"tify-header-button",disabled:t.$store.isCustomPageView||t.$store.isFirstPage,title:t.$translate("Previous page"),onClick:s[20]||(s[20]=K=>t.goToPreviousPage())},[te(g)],8,Hp),F("button",{type:"button",class:"tify-header-button",disabled:t.$store.isCustomPageView||t.$store.isLastPage,title:t.$translate("Next page"),onClick:s[21]||(s[21]=K=>t.goToNextPage())},[te(m)],8,Op),t.$store.manifest.structures?(L(),D("button",{key:1,type:"button",class:"tify-header-button",disabled:t.$store.isCustomPageView||t.$store.isLastSection,title:t.$translate("Next section"),onClick:s[22]||(s[22]=K=>r.goToNextSection())},[te(T)],8,Lp)):se("",!0),F("button",{type:"button",class:"tify-header-button",disabled:t.$store.isCustomPageView||t.$store.isLastPage,title:t.$translate("Last page"),onClick:s[23]||(s[23]=K=>t.$store.goToLastPage())},[te(x)],8,Mp)])):se("",!0)],10,fp)])}const kp=ue(Yf,[["render",Dp]]);const Fp={props:{readyPromise:{type:Object,default:null}},data(){return{ready:!1}},computed:{hasOtherContent(){return this.$store.canvases.some(t=>"otherContent"in t)},hasToc(){return this.$store.manifest&&this.$store.manifest.structures&&this.$store.manifest.structures.length>0}},created(){this.$api.expose(this.setLanguage),this.$api.expose(this.$store.setPage)},mounted(){if(this.$store.rootElement=this.$el,!this.$store.options.manifestUrl){this.$store.addError('Missing option "manifestUrl"');return}this.updateBreakpoint(),new ResizeObserver(this.updateBreakpoint).observe(this.$el),Promise.all([this.$store.loadManifest(this.$store.options.manifestUrl),this.setLanguage(this.$store.options.language)]).then(()=>{this.$nextTick(()=>{this.ready=!0,this.readyPromise.resolve()})},t=>{this.readyPromise.reject(t)})},beforeUnmount(){clearTimeout(this.$store.urlUpdateTimeout),window.removeEventListener("popstate",this.$store.initOptions)},methods:{setLanguage(t){let s,e;const i=new Promise((r,l)=>{s=r,e=l});if(t==="en")return this.$store.options.language="en",this.$translate.setTranslation(null),s(t),i;if(this.$store.options.translationsDirUrl===null)return e(new Error("Could not determine translationsDirUrl")),i;const n=`${this.$store.options.translationsDirUrl}/${t}.json`;return this.$store.fetchJson(n).then(r=>{this.$store.options.language=t,this.$translate.setTranslation(r),s(t)},r=>{const l=r.response?r.response.statusText:r.message;this.$store.addError(`Error loading translation for "${t}": ${l}`),e(new Error(r))}),i},updateBreakpoint(){Object.keys(this.$store.options.breakpoints).forEach(t=>{this.$el.clientWidth<=this.$store.options.breakpoints[t]?this.$el.classList.add(`-${t}`):this.$el.classList.remove(`-${t}`)}),this.$el.clientHeight<520?this.$el.classList.add("-short"):this.$el.classList.remove("-short")}}},Ap={class:"tify",tabindex:"-1"},Bp={key:1,class:"tify-main"},Ip=["aria-label"],zp={key:3,class:"tify-error"},Np=["aria-label"],Vp={class:"tify-error-messages"};function Up(t,s,e,i,n,r){const l=kp,a=Yh,o=mc,u=oc,h=Ju,g=Gu,m=gu,T=El,x=Ya,P=Js;return L(),D("article",Ap,[n.ready&&(t.$store.collection||t.$store.manifest)?(L(),Me(l,{key:0,"fulltext-enabled":r.hasOtherContent,"toc-enabled":r.hasToc},null,8,["fulltext-enabled","toc-enabled"])):se("",!0),n.ready?(L(),D("div",Bp,[t.$store.manifest?(L(),D(de,{key:0},[te(a,{id:t.$store.getId("scan")},null,8,["id"]),r.hasOtherContent?ke((L(),Me(o,{key:0,id:t.$store.getId("fulltext")},null,8,["id"])),[[Xe,t.$store.options.view==="fulltext"]]):se("",!0),ke(te(u,{id:t.$store.getId("thumbnails")},null,8,["id"]),[[Xe,t.$store.options.view==="thumbnails"]]),r.hasToc?ke((L(),Me(h,{key:1,id:t.$store.getId("toc")},null,8,["id"])),[[Xe,t.$store.options.view==="toc"]]):se("",!0),ke(te(g,{id:t.$store.getId("export")},null,8,["id"]),[[Xe,t.$store.options.view==="export"]])],64)):se("",!0),t.$store.collection||t.$store.manifest?ke((L(),Me(m,{key:1,id:t.$store.getId("info")},null,8,["id"])),[[Xe,t.$store.options.view==="info"]]):se("",!0),t.$store.collection?ke((L(),Me(T,{key:2,id:t.$store.getId("collection")},null,8,["id"])),[[Xe,t.$store.options.view==="collection"]]):se("",!0),ke(te(x,{id:t.$store.getId("help")},null,8,["id"]),[[Xe,t.$store.options.view==="help"]])])):se("",!0),t.$store.loading?(L(),D("div",{key:2,class:"tify-loading","aria-label":t.$translate("Loading")},null,8,Ip)):se("",!0),t.$store.errors.length?(L(),D("section",zp,[F("button",{type:"button",class:"tify-error-close","aria-label":t.$translate("Dismiss"),onClick:s[0]||(s[0]=C=>t.$store.clearErrors())},[te(P)],8,Np),F("div",Vp,[(L(!0),D(de,null,Pe(t.$store.errors,C=>(L(),D("p",{key:C},Z(C),1))),128))])])):se("",!0)])}const Wp=ue(Fp,[["render",Up]]);function jp(t){return{expose(s,e){t[e||s.name.replace("bound ","")]=s}}}const Gp={install:(t,s)=>{t.config.globalProperties.$api=new jp(s.instance)}},qp={install:t=>{let s=null;t.config.globalProperties.$translate=(e,i)=>s&&s[e]?s[e]:i||e,t.config.globalProperties.$translate.setTranslation=e=>{s=e}}};function Zp(t){const s=`tify-${Math.floor(Math.random()*Date.now())}`,e=vi({collection:null,errors:[],loading:0,manifest:t.manifest||null,options:t.options||{},rootElement:t.rootElement||null,urlUpdateTimeout:null,canvases:at(()=>e.manifest&&e.manifest.sequences?e.manifest.sequences[0].canvases:[]),currentStructure:at(()=>{if(!Array.isArray(e.manifest.structures))return!1;const i=[];e.options.pages.forEach(a=>{a&&i.push(e.manifest.sequences[0].canvases[a-1]["@id"])});const{length:n}=e.manifest.structures;let r,l;for(let a=0;ai.includes(h))&&o.firstPage&&o.lastPage){const h=o.lastPage-o.firstPage;if((h=0?e.manifest.structures[r]:!1}),isCustomPageView:at(()=>{const{pages:i}=e.options;return i?i.length>2||i.length===2&&(i[0]%2>0||i[1]!==i[0]+1)&&i[1]>0:!1}),isFirstPage:at(()=>e.options.pages[0]<2),isLastPage:at(()=>{const{pages:i}=e.options;return i[0]>=e.pageCount||i[i.length-1]>=e.pageCount}),pageCount:at(()=>e.canvases.length),structures:at(()=>{if(!e.manifest.structures)return[];const i=[],n=[],{canvases:r}=e.manifest.sequences[0],{length:l}=e.manifest.structures;for(let u=0;ux["@id"]===g)+1;const m=h.canvases[h.canvases.length-1];h.lastPage=r.findIndex(x=>x["@id"]===m)+1;const T=r[h.firstPage-1];if(!T)continue;h.pageLabel=T.label}else r[0]&&(h.firstPage=1,h.lastPage=e.pageCount,h.pageLabel=r[0].label);h.pageCount=h.lastPage-h.firstPage+1,h.within&&n.push(h),i.push(h)}}const a=n.length;for(let u=0;ug.firstPage-m.firstPage))}return i.filter(u=>!u.within).sort((u,h)=>u.firstPage-h.firstPage)}),addError(i){e.errors.push(i)},clearErrors(){e.errors=[]},convertValueToArray(i){if(!e.options.language)throw new Error("language not set");if(!(i instanceof Array)){if(typeof i=="object"){if(i["@value"])return[ut(i["@value"])];if(i["@id"]){const a=ut(i["@id"]);return[{"@id":a,label:i.label?ut(i.label):a}]}return["(Invalid value)"]}return[ut(i)]}const n=[],r={};i.forEach(a=>{typeof a=="string"||a["@id"]&&a.label?n.push(a):a&&typeof a!="object"?n.push(ut(a)):a["@language"]&&a["@value"]&&(r.fallback||(r.fallback=a["@value"]),a["@language"].indexOf("en")===0?r.en=a["@value"]:e.options.language&&a["@language"]===e.options.language&&(r.preferred=a["@value"]))});const l=r.preferred||r.en||r.fallback||null;return l&&n.push(ut(l)),n},async fetchJson(i){e.loading+=1;const r=await(await fetch(i).catch(l=>(e.loading=0,Promise.reject(l)))).json().catch(l=>(e.loading=0,Promise.reject(l)));return e.loading>0&&(e.loading-=1),r},async fetchText(i){e.loading+=1;const r=await(await fetch(i).catch(l=>(e.loading=0,Promise.reject(l)))).text().catch(l=>(e.loading=0,Promise.reject(l)));return e.loading>0&&(e.loading-=1),r},getId(i){return s+(i?`-${i}`:"")},getPageLabel(i,n){return e.options.pageLabelFormat.replace("P",i).replace("L",n)},getStartPage(){const{startCanvas:i}=e.manifest.sequences[0],n=e.canvases.findIndex(r=>r["@id"]===i);return n>=0?n+1:1},goToFirstPage(){e.setPage(1)},goToNextPage(){let i=e.options.pages[0]+1;e.options.pages.length>1&&i%2>0&&i1&&i%2>0&&i>0&&(i-=1),e.setPage(i)},initOptions(i){let n={};if(e.options.urlQueryKey)try{const r=new URLSearchParams(window.location.search);n=JSON.parse(r.get(e.options.urlQueryKey))||{}}catch{}n.view===""&&e.isMobile()&&(n.view="scan"),n.pages&&!ts(n.pages,e.pageCount)&&(e.addError("Invalid pages, reset to start page"),n.pages=null),e.options.childManifestUrl=n.childManifestUrl||e.options.childManifestUrl,e.options.filters=n.filters||e.options.filters,e.options.pages=i&&i.type==="popstate"?n.pages||[e.getStartPage()]:n.pages||e.options.pages||[e.getStartPage()],e.options.pan=n.panX||n.panY?{x:n.panX,y:n.panY}:n.pan||e.options.pan,e.options.rotation=parseInt(n.rotation,10)||e.options.rotation,e.options.view=n.view||n.view===""?n.view:e.options.view,e.options.zoom=parseFloat(n.zoom)||e.options.zoom},isMobile(){return e.rootElement.offsetWidth{r=o,l=u});return e.fetchJson(i).then(async o=>{if(n.expectedType&&o["@type"]!==n.expectedType){const h=`Expected manifest of type ${n.expectedType}, but got ${o["@type"]}`;return e.addError(h),l(h),a}if(e.manifest=null,await Es(),o["@type"]==="sc:Manifest")return e.manifest=o,e.initOptions(),window.addEventListener("popstate",e.initOptions),n.reset&&e.updateOptions({childManifestUrl:i,pages:[e.getStartPage()],pan:{},rotation:null,view:e.isMobile()?"scan":"collection",zoom:null}),r(),a;if(o["@type"]==="sc:Collection"){e.collection=o;const h=new URLSearchParams(window.location.search);let g={};try{g=JSON.parse(h.get(e.options.urlQueryKey))||{}}catch{}let m="";if(e.options.urlQueryParams.includes("childManifestUrl")&&g.childManifestUrl?m=g.childManifestUrl:e.collection.manifests&&e.options.childManifestAutoloaded&&(m=e.collection.manifests[0]["@id"]),m)await e.loadManifest(m,{expectedType:"sc:Manifest"}),e.updateOptions({childManifestUrl:m});else{const T=g.view||e.options.view;e.updateOptions({view:["collection","help","info"].includes(T)?T:"collection"})}return r(),a}const u="Please provide a valid IIIF Presentation API 2.x manifest";return e.addError(u),l(u),a},o=>{const h=`Error loading IIIF manifest: ${o.response&&(o.response.statusText||o.response.data)||o.message}`;return e.addError(h),l(h),a})},setPage(i){let n=i;if(Array.isArray(i)||(n=[i]),!ts(n,e.pageCount))throw new RangeError("Invalid pages");if(n.length===1&&e.options.pages&&e.options.pages[0]%2<1&&(e.options.pages[1]===e.options.pages[0]+1||e.options.pages[1]===0)){const r=n[0]%2>0?n[0]-1:n[0];n=[r,r===e.pageCount?0:r+1]}return e.updateOptions({pages:n}),n},updateOptions(i){Object.assign(e.options,i),clearTimeout(e.urlUpdateTimeout),e.options.urlQueryKey&&(e.urlUpdateTimeout=setTimeout(()=>{const n={};e.options.urlQueryParams.forEach(l=>{const a=e.options[l];a===null||l==="pages"&&a.length<2&&a[0]<2||typeof a=="object"&&!Object.keys(a).length?delete n[l]:n[l]=e.options[l]});const r=new URL(window.location);Object.keys(n).length?r.searchParams.set(e.options.urlQueryKey,JSON.stringify(n)):r.searchParams.delete(e.options.urlQueryKey),window.history&&(i.pages?(e.clearErrors(),window.history.pushState({},"",r)):window.history.replaceState({},"",r))},100))}});return e}const Kp={install:(t,s={})=>{t.config.globalProperties.$store=new Zp(s)}};window.Tify=function(s={}){const e={breakpoints:{tiny:359,small:719,medium:959,large:1199},childManifestAutoloaded:!0,childManifestUrl:null,container:null,filters:{},language:"en",manifestUrl:null,optionsResetOnPageChange:["pan"],pageLabelFormat:"P : L",pages:null,pan:{},rotation:null,translationsDirUrl:null,urlQueryKey:null,urlQueryParams:["childManifestUrl","filters","pages","pan","rotation","view","zoom"],view:"",viewer:{},zoom:null};if(this.options={...e,...s},!this.options.translationsDirUrl){const a=[...document.getElementsByTagName("script")].find(o=>o.src.includes("/tify"));if(a){const{src:o}=a;this.options.translationsDirUrl=`${o.substring(0,o.lastIndexOf("/"))}/translations`}}let i=null;this.ready=new Promise((l,a)=>{i={resolve:l,reject:a}});const n=this;this.app=Ma({render:()=>oa(Wp,{readyPromise:i})}).use(Gp,{instance:n}).use(qp).use(Kp,{options:this.options});let r=!1;this.mount=l=>{if(r)throw new Error("TIFY is already mounted");const a=typeof l=="string"?document.querySelector(l):l;if(!a)throw new Error("Container element not found");window.getComputedStyle(a).position==="static"&&(a.style.position="relative"),this.app.mount(a),r=!0},this.destroy=()=>{this.app.unmount()},this.options.container&&this.mount(this.options.container)}; +function s(e){return new s.Viewer(e)}(function(e){e.version={versionStr:"3.0.0",major:parseInt("3",10),minor:parseInt("0",10),revision:parseInt("0",10)};var i={"[object Boolean]":"boolean","[object Number]":"number","[object String]":"string","[object Function]":"function","[object Array]":"array","[object Date]":"date","[object RegExp]":"regexp","[object Object]":"object"},n=Object.prototype.toString,r=Object.prototype.hasOwnProperty;e.isFunction=function(l){return e.type(l)==="function"},e.isArray=Array.isArray||function(l){return e.type(l)==="array"},e.isWindow=function(l){return l&&typeof l=="object"&&"setInterval"in l},e.type=function(l){return l==null?String(l):i[n.call(l)]||"object"},e.isPlainObject=function(l){if(!l||s.type(l)!=="object"||l.nodeType||e.isWindow(l)||l.constructor&&!r.call(l,"constructor")&&!r.call(l.constructor.prototype,"isPrototypeOf"))return!1;var a;for(var o in l)a=o;return a===void 0||r.call(l,a)},e.isEmptyObject=function(l){for(var a in l)return!1;return!0},e.freezeObject=function(l){return Object.freeze?e.freezeObject=Object.freeze:e.freezeObject=function(a){return a},e.freezeObject(l)},e.supportsCanvas=function(){var l=document.createElement("canvas");return!!(e.isFunction(l.getContext)&&l.getContext("2d"))}(),e.isCanvasTainted=function(l){var a=!1;try{l.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 l=0;if(e.supportsAddEventListener)try{var a={get capture(){return l++,!1},get once(){return l++,!1},get passive(){return l++,!1}};window.addEventListener("test",null,a),window.removeEventListener("test",null,a)}catch{l=0}return l>=3}(),e.getCurrentPixelDensityRatio=function(){if(e.supportsCanvas){var l=document.createElement("canvas").getContext("2d"),a=window.devicePixelRatio||1,o=l.webkitBackingStorePixelRatio||l.mozBackingStorePixelRatio||l.msBackingStorePixelRatio||l.oBackingStorePixelRatio||l.backingStorePixelRatio||1;return Math.max(a,1)/o}else return 1},e.pixelDensityRatio=e.getCurrentPixelDensityRatio()})(s),function(e){e.extend=function(){var o,u,h,g,m,T,x=arguments[0]||{},P=arguments.length,C=!1,k=1;for(typeof x=="boolean"&&(C=x,x=arguments[1]||{},k=2),typeof x!="object"&&!s.isFunction(x)&&(x={}),P===k&&(x=this,--k);k=h.x&&u.x=h.y},getMousePosition:function(o){if(typeof o.pageX=="number")e.getMousePosition=function(u){var h=new e.Point;return h.x=u.pageX,h.y=u.pageY,h};else if(typeof o.clientX=="number")e.getMousePosition=function(u){var h=new e.Point;return h.x=u.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,h.y=u.clientY+document.body.scrollTop+document.documentElement.scrollTop,h};else throw new Error("Unknown event mouse position, no known technique.");return e.getMousePosition(o)},getPageScroll:function(){var o=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(o.scrollLeft||o.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(o){if(typeof window.scrollTo<"u")e.setPageScroll=function(g){window.scrollTo(g.x,g.y)};else{var u=e.getPageScroll();if(u.x===o.x&&u.y===o.y)return;document.body.scrollLeft=o.x,document.body.scrollTop=o.y;var h=e.getPageScroll();if(h.x!==u.x&&h.y!==u.y){e.setPageScroll=function(g){document.body.scrollLeft=g.x,document.body.scrollTop=g.y};return}if(document.documentElement.scrollLeft=o.x,document.documentElement.scrollTop=o.y,h=e.getPageScroll(),h.x!==u.x&&h.y!==u.y){e.setPageScroll=function(g){document.documentElement.scrollLeft=g.x,document.documentElement.scrollTop=g.y};return}e.setPageScroll=function(g){}}e.setPageScroll(o)},getWindowSize:function(){var o=document.documentElement||{},u=document.body||{};if(typeof window.innerWidth=="number")e.getWindowSize=function(){return new e.Point(window.innerWidth,window.innerHeight)};else if(o.clientWidth||o.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(o){o=e.getElement(o);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(o),u[0]},makeNeutralElement:function(o){var u=document.createElement(o),h=u.style;return h.background="transparent none",h.border="none",h.margin="0px",h.padding="0px",h.position="static",u},now:function(){return Date.now?e.now=Date.now:e.now=function(){return new Date().getTime()},e.now()},makeTransparentImage:function(o){var u=e.makeNeutralElement("img");return u.src=o,u},setElementOpacity:function(o,u,h){var g,m;o=e.getElement(o),h&&!e.Browser.alpha&&(u=Math.round(u)),e.Browser.opacity?o.style.opacity=u<1?u:"":u<1?(g=Math.round(100*u),m="alpha(opacity="+g+")",o.style.filter=m):o.style.filter=""},setElementTouchActionNone:function(o){o=e.getElement(o),typeof o.style.touchAction<"u"?o.style.touchAction="none":typeof o.style.msTouchAction<"u"&&(o.style.msTouchAction="none")},setElementPointerEvents:function(o,u){o=e.getElement(o),typeof o.style.pointerEvents<"u"&&(o.style.pointerEvents=u)},setElementPointerEventsNone:function(o){e.setElementPointerEvents(o,"none")},addClass:function(o,u){o=e.getElement(o),o.className?(" "+o.className+" ").indexOf(" "+u+" ")===-1&&(o.className+=" "+u):o.className=u},indexOf:function(o,u,h){return Array.prototype.indexOf?this.indexOf=function(g,m,T){return g.indexOf(m,T)}:this.indexOf=function(g,m,T){var x,P=T||0,C;if(!g)throw new TypeError;if(C=g.length,C===0||P>=C)return-1;for(P<0&&(P=C-Math.abs(P)),x=P;x=200&&P.status<300||P.status===0&&x!=="http:"&&x!=="https:"?u(P):(e.console.log("AJAX request returned %d: %s",P.status,o),e.isFunction(h)&&h(P)))};try{if(P.open("GET",o,!0),T&&(P.responseType=T),m)for(var C in m)Object.prototype.hasOwnProperty.call(m,C)&&m[C]&&P.setRequestHeader(C,m[C]);g&&(P.withCredentials=!0),P.send(null)}catch(k){e.console.log("%s while making AJAX request: %s",k.name,k.message),P.onreadystatechange=function(){},e.isFunction(h)&&h(P,k)}return P},jsonp:function(o){var u,h=o.url,g=document.head||document.getElementsByTagName("head")[0]||document.documentElement,m=o.callbackName||"openseadragon"+e.now(),T=window[m],x="$1"+m+"$2",P=o.param||"callback",C=o.callback;h=h.replace(/(=)\?(&|$)|\?\?/i,x),h+=(/\?/.test(h)?"&":"?")+P+"="+m,window[m]=function(k){if(T)window[m]=T;else try{delete window[m]}catch{}C&&e.isFunction(C)&&C(k)},u=document.createElement("script"),(o.async!==void 0||o.async!==!1)&&(u.async="async"),o.scriptCharset&&(u.charset=o.scriptCharset),u.src=h,u.onload=u.onreadystatechange=function(k,d){(d||!u.readyState||/loaded|complete/.test(u.readyState))&&(u.onload=u.onreadystatechange=null,g&&u.parentNode&&g.removeChild(u),u=void 0)},g.insertBefore(u,g.firstChild)},createFromDZI:function(){throw"OpenSeadragon.createFromDZI is deprecated, use Viewer.open."},parseXml:function(o){if(window.DOMParser)e.parseXml=function(u){var h=null,g;return g=new DOMParser,h=g.parseFromString(u,"text/xml"),h};else if(window.ActiveXObject)e.parseXml=function(u){var h=null;return h=new ActiveXObject("Microsoft.XMLDOM"),h.async=!1,h.loadXML(u),h};else throw new Error("Browser doesn't support XML DOM.");return e.parseXml(o)},parseJSON:function(o){return e.parseJSON=window.JSON.parse,e.parseJSON(o)},imageFormatSupported:function(o){return o=o||"",!!r[o.toLowerCase()]},setImageFormatsSupported:function(o){e.extend(r,o)}});var n=function(o){};e.console=window.console||{log:n,debug:n,info:n,warn:n,error:n,assert:n},e.Browser={vendor:e.BROWSERS.UNKNOWN,version:0,alpha:!0};var r={bmp:!1,jpeg:!0,jpg:!0,png:!0,tif:!1,wdp:!1},l={};(function(){var o=navigator.appVersion,u=navigator.userAgent,h;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")))):(h=new RegExp("Trident/.*rv:([0-9]{1,}[.0-9]{0,})"),h.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(o);break}var g=window.location.search.substring(1),m=g.split("&"),T,x,P;for(P=0;P0){var C=T.substring(0,x),k=T.substring(x+1);try{l[C]=decodeURIComponent(k)}catch{e.console.error("Ignoring malformed URL parameter: %s=%s",C,k)}}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(o){var u=o.requestAnimationFrame||o.mozRequestAnimationFrame||o.webkitRequestAnimationFrame||o.msRequestAnimationFrame,h=o.cancelAnimationFrame||o.mozCancelAnimationFrame||o.webkitCancelAnimationFrame||o.msCancelAnimationFrame;if(u&&h)e.requestAnimationFrame=function(){return u.apply(o,arguments)},e.cancelAnimationFrame=function(){return h.apply(o,arguments)};else{var g=[],m=[],T=0,x;e.requestAnimationFrame=function(P){return g.push([++T,P]),x||(x=setInterval(function(){if(g.length){var C=e.now(),k=m;for(m=g,g=k;m.length;)m.shift()[1](C)}else clearInterval(x),x=void 0},1e3/50)),T},e.cancelAnimationFrame=function(P){var C,k;for(C=0,k=g.length;C8||"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 p=document.createElement("div");return e.isFunction(p.setPointerCapture)&&e.isFunction(p.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 p=document.createElement("div");return e.isFunction(p.setCapture)&&e.isFunction(p.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(p){this._gPoints=[],this.type=p,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(p){return this._gPoints.push(p)},removeById:function(p){var f,y=this._gPoints.length;for(f=0;f1&&(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 l(p){var f=i[p.hash],y,w,z,W,$,pe=f.activePointersLists.length;for(y=0;y0){for($=[],W=z.asArray(),w=0;wf.touches.length-z&&e.console.warn("Tracked touch contact count doesn't match event.touches.length");var pe={originalEvent:f,eventType:"pointerdown",pointerType:"touch",isEmulated:!1};for(H(p,pe),w=0;w0&&f.removeContact(),w=f.removeById(y.id)):w=f.getLength(),w}function O(p,f){switch(f.eventType){case"pointermove":f.isStoppable=!0,f.isCancelable=!0,f.preventDefault=!1,f.preventGesture=!p.hasGestureHandlers,f.stopPropagation=!1;break;case"pointerover":case"pointerout":case"contextmenu":case"keydown":case"keyup":case"keypress":f.isStoppable=!0,f.isCancelable=!0,f.preventDefault=!1,f.preventGesture=!1,f.stopPropagation=!1;break;case"pointerdown":f.isStoppable=!0,f.isCancelable=!0,f.preventDefault=!1,f.preventGesture=!p.hasGestureHandlers,f.stopPropagation=!1;break;case"pointerup":f.isStoppable=!0,f.isCancelable=!0,f.preventDefault=!1,f.preventGesture=!p.hasGestureHandlers,f.stopPropagation=!1;break;case"wheel":f.isStoppable=!0,f.isCancelable=!0,f.preventDefault=!1,f.preventGesture=!p.hasScrollHandler,f.stopPropagation=!1;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":f.isStoppable=!0,f.isCancelable=!1,f.preventDefault=!1,f.preventGesture=!1,f.stopPropagation=!1;break;case"click":f.isStoppable=!0,f.isCancelable=!0,f.preventDefault=!!p.clickHandler,f.preventGesture=!1,f.stopPropagation=!1;break;case"dblclick":f.isStoppable=!0,f.isCancelable=!0,f.preventDefault=!!p.dblClickHandler,f.preventGesture=!1,f.stopPropagation=!1;break;case"focus":case"blur":case"pointerenter":case"pointerleave":default:f.isStoppable=!1,f.isCancelable=!1,f.preventDefault=!1,f.preventGesture=!1,f.stopPropagation=!1;break}}function H(p,f){f.eventSource=p,f.eventPhase=f.originalEvent&&typeof f.originalEvent.eventPhase<"u"?f.originalEvent.eventPhase:0,f.defaultPrevented=e.eventIsCanceled(f.originalEvent),f.shouldCapture=!1,f.shouldReleaseCapture=!1,f.userData=p.userData,O(p,f),p.preProcessEventHandler&&p.preProcessEventHandler(f)}function B(p,f,y){var w=p.getActivePointersListByType(f.type),z=w.getById(f.id);z?y&&!z.captured?(z.captured=!0,w.captureCount++):!y&&z.captured&&(z.captured=!1,w.captureCount--,w.captureCount<0&&(w.captureCount=0,e.console.warn("updatePointerCaptured() - pointsList.captureCount went negative"))):e.console.warn("updatePointerCaptured() called on untracked pointer")}function A(p,f,y){var w=p.getActivePointersListByType(y.type),z;z=w.getById(y.id),z?(z.insideElement=!0,z.lastPos=z.currentPos,z.lastTime=z.currentTime,z.currentPos=y.currentPos,z.currentTime=y.currentTime,y=z):(y.captured=!1,y.insideElementPressed=!1,y.insideElement=!0,v(w,y)),p.enterHandler&&p.enterHandler({eventSource:p,pointerType:y.type,position:k(y.currentPos,p.element),buttons:w.buttons,pointers:p.getActivePointerCount(),insideElementPressed:y.insideElementPressed,buttonDownAny:w.buttons!==0,isTouchEvent:y.type==="touch",originalEvent:f.originalEvent,userData:p.userData})}function N(p,f,y){var w=p.getActivePointersListByType(y.type),z,W;z=w.getById(y.id),z?(z.captured?(z.insideElement=!1,z.lastPos=z.currentPos,z.lastTime=z.currentTime,z.currentPos=y.currentPos,z.currentTime=y.currentTime):b(p,w,z),y=z):(y.captured=!1,y.insideElementPressed=!1),(p.leaveHandler||p.exitHandler)&&(W={eventSource:p,pointerType:y.type,position:y.currentPos&&k(y.currentPos,p.element),buttons:w.buttons,pointers:p.getActivePointerCount(),insideElementPressed:y.insideElementPressed,buttonDownAny:w.buttons!==0,isTouchEvent:y.type==="touch",originalEvent:f.originalEvent,userData:p.userData},p.leaveHandler&&p.leaveHandler(W),p.exitHandler&&p.exitHandler(W))}function X(p,f,y){var w,z;w=p.getActivePointersListByType(y.type),z=w.getById(y.id),z?y=z:(y.captured=!1,y.insideElementPressed=!1),p.overHandler&&p.overHandler({eventSource:p,pointerType:y.type,position:k(y.currentPos,p.element),buttons:w.buttons,pointers:p.getActivePointerCount(),insideElementPressed:y.insideElementPressed,buttonDownAny:w.buttons!==0,isTouchEvent:y.type==="touch",originalEvent:f.originalEvent,userData:p.userData})}function G(p,f,y){var w,z;w=p.getActivePointersListByType(y.type),z=w.getById(y.id),z?y=z:(y.captured=!1,y.insideElementPressed=!1),p.outHandler&&p.outHandler({eventSource:p,pointerType:y.type,position:y.currentPos&&k(y.currentPos,p.element),buttons:w.buttons,pointers:p.getActivePointerCount(),insideElementPressed:y.insideElementPressed,buttonDownAny:w.buttons!==0,isTouchEvent:y.type==="touch",originalEvent:f.originalEvent,userData:p.userData})}function U(p,f,y,w){var z=i[p.hash],W=p.getActivePointersListByType(y.type),$;if(typeof f.originalEvent.buttons<"u"?W.buttons=f.originalEvent.buttons:w===0?W.buttons|=1:w===1?W.buttons|=4:w===2?W.buttons|=2:w===3?W.buttons|=8:w===4?W.buttons|=16:w===5&&(W.buttons|=32),w!==0){f.shouldCapture=!1,f.shouldReleaseCapture=!1,p.nonPrimaryPressHandler&&!f.preventGesture&&!f.defaultPrevented&&(f.preventDefault=!0,p.nonPrimaryPressHandler({eventSource:p,pointerType:y.type,position:k(y.currentPos,p.element),button:w,buttons:W.buttons,isTouchEvent:y.type==="touch",originalEvent:f.originalEvent,userData:p.userData}));return}if($=W.getById(y.id),$)$.insideElementPressed=!0,$.insideElement=!0,$.originalTarget=f.originalEvent.target,$.contactPos=y.currentPos,$.contactTime=y.currentTime,$.lastPos=$.currentPos,$.lastTime=$.currentTime,$.currentPos=y.currentPos,$.currentTime=y.currentTime,y=$;else{e.console.warn("pointerdown event on untracked pointer"),y.captured=!1,y.insideElementPressed=!0,y.insideElement=!0,y.originalTarget=f.originalEvent.target,v(W,y);return}W.addContact(),!f.preventGesture&&!f.defaultPrevented?(f.shouldCapture=!0,f.shouldReleaseCapture=!1,f.preventDefault=!0,(p.dragHandler||p.dragEndHandler||p.pinchHandler)&&e.MouseTracker.gesturePointVelocityTracker.addPoint(p,y),W.contacts===1?p.pressHandler&&!f.preventGesture&&p.pressHandler({eventSource:p,pointerType:y.type,position:k(y.contactPos,p.element),buttons:W.buttons,isTouchEvent:y.type==="touch",originalEvent:f.originalEvent,userData:p.userData}):W.contacts===2&&p.pinchHandler&&y.type==="touch"&&(z.pinchGPoints=W.asArray(),z.lastPinchDist=z.currentPinchDist=z.pinchGPoints[0].currentPos.distanceTo(z.pinchGPoints[1].currentPos),z.lastPinchCenter=z.currentPinchCenter=d(z.pinchGPoints[0].currentPos,z.pinchGPoints[1].currentPos))):(f.shouldCapture=!1,f.shouldReleaseCapture=!1)}function J(p,f,y,w){var z=i[p.hash],W=p.getActivePointersListByType(y.type),$,pe,ne,Ne=!1,Re;if(typeof f.originalEvent.buttons<"u"?W.buttons=f.originalEvent.buttons:w===0?W.buttons^=-2:w===1?W.buttons^=-5:w===2?W.buttons^=-3:w===3?W.buttons^=-9:w===4?W.buttons^=-17:w===5&&(W.buttons^=-33),f.shouldCapture=!1,w!==0){f.shouldReleaseCapture=!1,p.nonPrimaryReleaseHandler&&!f.preventGesture&&!f.defaultPrevented&&(f.preventDefault=!0,p.nonPrimaryReleaseHandler({eventSource:p,pointerType:y.type,position:k(y.currentPos,p.element),button:w,buttons:W.buttons,isTouchEvent:y.type==="touch",originalEvent:f.originalEvent,userData:p.userData}));return}ne=W.getById(y.id),ne?(W.removeContact(),ne.captured&&(Ne=!0),ne.lastPos=ne.currentPos,ne.lastTime=ne.currentTime,ne.currentPos=y.currentPos,ne.currentTime=y.currentTime,ne.insideElement||b(p,W,ne),$=ne.currentPos,pe=ne.currentTime):(e.console.warn("updatePointerUp(): pointerup on untracked gPoint"),y.captured=!1,y.insideElementPressed=!1,y.insideElement=!0,v(W,y),ne=y),!f.preventGesture&&!f.defaultPrevented&&(Ne?(f.shouldReleaseCapture=!0,f.preventDefault=!0,(p.dragHandler||p.dragEndHandler||p.pinchHandler)&&e.MouseTracker.gesturePointVelocityTracker.removePoint(p,ne),W.contacts===0?(p.releaseHandler&&p.releaseHandler({eventSource:p,pointerType:ne.type,position:k($,p.element),buttons:W.buttons,insideElementPressed:ne.insideElementPressed,insideElementReleased:ne.insideElement,isTouchEvent:ne.type==="touch",originalEvent:f.originalEvent,userData:p.userData}),p.dragEndHandler&&z.sentDragEvent&&p.dragEndHandler({eventSource:p,pointerType:ne.type,position:k(ne.currentPos,p.element),speed:ne.speed,direction:ne.direction,shift:f.originalEvent.shiftKey,isTouchEvent:ne.type==="touch",originalEvent:f.originalEvent,userData:p.userData}),z.sentDragEvent=!1,(p.clickHandler||p.dblClickHandler)&&ne.insideElement&&(Re=pe-ne.contactTime<=p.clickTimeThreshold&&ne.contactPos.distanceTo($)<=p.clickDistThreshold,p.clickHandler&&p.clickHandler({eventSource:p,pointerType:ne.type,position:k(ne.currentPos,p.element),quick:Re,shift:f.originalEvent.shiftKey,isTouchEvent:ne.type==="touch",originalEvent:f.originalEvent,originalTarget:ne.originalTarget,userData:p.userData}),p.dblClickHandler&&Re&&(W.clicks++,W.clicks===1?(z.lastClickPos=$,z.dblClickTimeOut=setTimeout(function(){W.clicks=0},p.dblClickTimeThreshold)):W.clicks===2&&(clearTimeout(z.dblClickTimeOut),W.clicks=0,z.lastClickPos.distanceTo($)<=p.dblClickDistThreshold&&p.dblClickHandler({eventSource:p,pointerType:ne.type,position:k(ne.currentPos,p.element),shift:f.originalEvent.shiftKey,isTouchEvent:ne.type==="touch",originalEvent:f.originalEvent,userData:p.userData}),z.lastClickPos=null)))):W.contacts===2&&p.pinchHandler&&ne.type==="touch"&&(z.pinchGPoints=W.asArray(),z.lastPinchDist=z.currentPinchDist=z.pinchGPoints[0].currentPos.distanceTo(z.pinchGPoints[1].currentPos),z.lastPinchCenter=z.currentPinchCenter=d(z.pinchGPoints[0].currentPos,z.pinchGPoints[1].currentPos))):(f.shouldReleaseCapture=!1,p.releaseHandler&&(p.releaseHandler({eventSource:p,pointerType:ne.type,position:k($,p.element),buttons:W.buttons,insideElementPressed:ne.insideElementPressed,insideElementReleased:ne.insideElement,isTouchEvent:ne.type==="touch",originalEvent:f.originalEvent,userData:p.userData}),f.preventDefault=!0)))}function Y(p,f,y){var w=i[p.hash],z=p.getActivePointersListByType(y.type),W,$,pe;if(typeof f.originalEvent.buttons<"u"&&(z.buttons=f.originalEvent.buttons),W=z.getById(y.id),W)W.lastPos=W.currentPos,W.lastTime=W.currentTime,W.currentPos=y.currentPos,W.currentTime=y.currentTime;else return;f.shouldCapture=!1,f.shouldReleaseCapture=!1,p.stopHandler&&y.type==="mouse"&&(clearTimeout(p.stopTimeOut),p.stopTimeOut=setTimeout(function(){me(p,f.originalEvent,y.type)},p.stopDelay)),z.contacts===0?p.moveHandler&&p.moveHandler({eventSource:p,pointerType:y.type,position:k(y.currentPos,p.element),buttons:z.buttons,isTouchEvent:y.type==="touch",originalEvent:f.originalEvent,userData:p.userData}):z.contacts===1?(p.moveHandler&&(W=z.asArray()[0],p.moveHandler({eventSource:p,pointerType:W.type,position:k(W.currentPos,p.element),buttons:z.buttons,isTouchEvent:W.type==="touch",originalEvent:f.originalEvent,userData:p.userData})),p.dragHandler&&!f.preventGesture&&!f.defaultPrevented&&(W=z.asArray()[0],pe=W.currentPos.minus(W.lastPos),p.dragHandler({eventSource:p,pointerType:W.type,position:k(W.currentPos,p.element),buttons:z.buttons,delta:pe,speed:W.speed,direction:W.direction,shift:f.originalEvent.shiftKey,isTouchEvent:W.type==="touch",originalEvent:f.originalEvent,userData:p.userData}),f.preventDefault=!0,w.sentDragEvent=!0)):z.contacts===2&&(p.moveHandler&&($=z.asArray(),p.moveHandler({eventSource:p,pointerType:$[0].type,position:k(d($[0].currentPos,$[1].currentPos),p.element),buttons:z.buttons,isTouchEvent:$[0].type==="touch",originalEvent:f.originalEvent,userData:p.userData})),p.pinchHandler&&y.type==="touch"&&!f.preventGesture&&!f.defaultPrevented&&(pe=w.pinchGPoints[0].currentPos.distanceTo(w.pinchGPoints[1].currentPos),pe!==w.currentPinchDist&&(w.lastPinchDist=w.currentPinchDist,w.currentPinchDist=pe,w.lastPinchCenter=w.currentPinchCenter,w.currentPinchCenter=d(w.pinchGPoints[0].currentPos,w.pinchGPoints[1].currentPos),p.pinchHandler({eventSource:p,pointerType:"touch",gesturePoints:w.pinchGPoints,lastCenter:k(w.lastPinchCenter,p.element),center:k(w.currentPinchCenter,p.element),lastDistance:w.lastPinchDist,distance:w.currentPinchDist,shift:f.originalEvent.shiftKey,originalEvent:f.originalEvent,userData:p.userData}),f.preventDefault=!0)))}function he(p,f,y){var w=p.getActivePointersListByType(y.type),z;z=w.getById(y.id),z&&b(p,w,z)}function me(p,f,y){p.stopHandler&&p.stopHandler({eventSource:p,pointerType:y,position:C(f,p.element),buttons:p.getActivePointersListByType(y).buttons,isTouchEvent:y==="touch",originalEvent:f,userData:p.userData})}}(s),function(e){e.ControlAnchor={NONE:0,TOP_LEFT:1,TOP_RIGHT:2,BOTTOM_RIGHT:3,BOTTOM_LEFT:4,ABSOLUTE:5},e.Control=function(i,n,r){var l=i.parentNode;typeof n=="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"),n={anchor:n}),n.attachToViewer=typeof n.attachToViewer>"u"?!0:n.attachToViewer,this.autoFade=typeof n.autoFade>"u"?!0:n.autoFade,this.element=i,this.anchor=n.anchor,this.container=r,this.anchor===e.ControlAnchor.ABSOLUTE?(this.wrapper=e.makeNeutralElement("div"),this.wrapper.style.position="absolute",this.wrapper.style.top=typeof n.top=="number"?n.top+"px":n.top,this.wrapper.style.left=typeof n.left=="number"?n.left+"px":n.left,this.wrapper.style.height=typeof n.height=="number"?n.height+"px":n.height,this.wrapper.style.width=typeof n.width=="number"?n.width+"px":n.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),n.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):l.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(i){this.wrapper.style.display=i?this.anchor===e.ControlAnchor.ABSOLUTE?"block":"inline-block":"none"},setOpacity:function(i){this.element[e.SIGNAL]&&e.Browser.vendor===e.BROWSERS.IE?e.setElementOpacity(this.element,i,!0):e.setElementOpacity(this.wrapper,i,!0)}}}(s),function(e){e.ControlDock=function(n){var r=["topleft","topright","bottomright","bottomleft"],l,a;for(e.extend(!0,this,{id:"controldock-"+e.now()+"-"+Math.floor(Math.random()*1e6),container:e.makeNeutralElement("div"),controls:[]},n),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=0)){switch(r.anchor){case e.ControlAnchor.TOP_RIGHT:l=this.controls.topright,n.style.position="relative",n.style.paddingRight="0px",n.style.paddingTop="0px";break;case e.ControlAnchor.BOTTOM_RIGHT:l=this.controls.bottomright,n.style.position="relative",n.style.paddingRight="0px",n.style.paddingBottom="0px";break;case e.ControlAnchor.BOTTOM_LEFT:l=this.controls.bottomleft,n.style.position="relative",n.style.paddingLeft="0px",n.style.paddingBottom="0px";break;case e.ControlAnchor.TOP_LEFT:l=this.controls.topleft,n.style.position="relative",n.style.paddingLeft="0px",n.style.paddingTop="0px";break;case e.ControlAnchor.ABSOLUTE:l=this.container,n.style.margin="0px",n.style.padding="0px";break;default:case e.ControlAnchor.NONE:l=this.container,n.style.margin="0px",n.style.padding="0px";break}this.controls.push(new e.Control(n,r,l)),n.style.display="inline-block"}},removeControl:function(n){n=e.getElement(n);var r=i(this,n);return r>=0&&(this.controls[r].destroy(),this.controls.splice(r,1)),this},clearControls:function(){for(;this.controls.length>0;)this.controls.pop().destroy();return this},areControlsEnabled:function(){var n;for(n=this.controls.length-1;n>=0;n--)if(this.controls[n].isVisible())return!0;return!1},setControlsEnabled:function(n){var r;for(r=this.controls.length-1;r>=0;r--)this.controls[r].setVisible(n);return this}};function i(n,r){var l=n.controls,a;for(a=l.length-1;a>=0;a--)if(l[a].element===r)return a;return-1}}(s),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}}})}(s),function(e){var i={},n=1;e.Viewer=function(c){var v=arguments,b=this,O;if(e.isPlainObject(c)||(c={id:v[0],xmlPath:v.length>1?v[1]:void 0,prefixUrl:v.length>2?v[2]:void 0,controls:v.length>3?v[3]:void 0,overlays:v.length>4?v[4]:void 0}),c.config&&(e.extend(!0,c,c.config),delete c.config),e.extend(!0,this,{id:c.id,hash:c.hash||n++,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,c),typeof this.hash>"u")throw new Error("A hash must be defined, either by specifying options.id or options.hash.");for(typeof i[this.hash]<"u"&&e.console.warn("Hash "+this.hash+" has already been used."),i[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(H){var B=e.getString("Errors.OpenFailed",H.eventSource,H.message);b._showMessage(B)}),e.ControlDock.call(this,c),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(H){H.width="100%",H.height="100%",H.overflow="hidden",H.position="absolute",H.top="0px",H.left="0px"}(this.canvas.style),e.setElementTouchActionNone(this.canvas),c.tabIndex!==""&&(this.canvas.tabIndex=c.tabIndex===void 0?0:c.tabIndex),this.container.className="openseadragon-container",function(H){H.width="100%",H.height="100%",H.position="relative",H.overflow="hidden",H.left="0px",H.top="0px",H.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,C),keyDownHandler:e.delegate(this,k),keyHandler:e.delegate(this,d),clickHandler:e.delegate(this,_),dblClickHandler:e.delegate(this,S),dragHandler:e.delegate(this,M),dragEndHandler:e.delegate(this,I),enterHandler:e.delegate(this,V),leaveHandler:e.delegate(this,j),pressHandler:e.delegate(this,q),releaseHandler:e.delegate(this,K),nonPrimaryPressHandler:e.delegate(this,re),nonPrimaryReleaseHandler:e.delegate(this,ee),scrollHandler:e.delegate(this,ce),pinchHandler:e.delegate(this,fe)}),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,ye),leaveHandler:e.delegate(this,ae)}),this.toolbar&&(this.toolbar=new e.ControlDock({element:this.toolbar})),this.bindStandardControls(),i[this.hash].prevContainerSize=r(this.container),this.world=new e.World({viewer:this}),this.world.addHandler("add-item",function(H){b.source=b.world.getItemAt(0).source,i[b.hash].forceRedraw=!0,b._updateRequestId||(b._updateRequestId=u(b,oe))}),this.world.addHandler("remove-item",function(H){b.world.getItemCount()?b.source=b.world.getItemAt(0).source:b.source=null,i[b.hash].forceRedraw=!0}),this.world.addHandler("metrics-change",function(H){b.viewport&&b.viewport._setContentBounds(b.world.getHomeBounds(),b.world.getContentFactor())}),this.world.addHandler("item-index-change",function(H){b.source=b.world.getItemAt(0).source}),this.viewport=new e.Viewport({containerSize:i[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:c.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&&(O=this.buttonGroup.buttons.indexOf(this.rotateLeft),this.buttonGroup.buttons.splice(O,1),this.buttonGroup.element.removeChild(this.rotateLeft.element)),this.rotateRight&&(O=this.buttonGroup.buttons.indexOf(this.rotateRight),this.buttonGroup.buttons.splice(O,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),O=0;O-1&&c.index=0&&c=0)return this;var B=a(this,H);return this.currentOverlays.push(B),B.drawHTML(this.overlaysContainer,this.viewport),this.raiseEvent("add-overlay",{element:c,location:H.location,placement:H.placement}),this},updateOverlay:function(c,v,b){var O;return c=e.getElement(c),O=o(this.currentOverlays,c),O>=0&&(this.currentOverlays[O].update(v,b),i[this.hash].forceRedraw=!0,this.raiseEvent("update-overlay",{element:c,location:v,placement:b})),this},removeOverlay:function(c){var v;return c=e.getElement(c),v=o(this.currentOverlays,c),v>=0&&(this.currentOverlays[v].destroy(),this.currentOverlays.splice(v,1),i[this.hash].forceRedraw=!0,this.raiseEvent("remove-overlay",{element:c})),this},clearOverlays:function(){for(;this.currentOverlays.length>0;)this.currentOverlays.pop().destroy();return i[this.hash].forceRedraw=!0,this.raiseEvent("clear-overlay",{}),this},getOverlayById:function(c){var v;return c=e.getElement(c),v=o(this.currentOverlays,c),v>=0?this.currentOverlays[v]:null},_updateSequenceButtons:function(c){this.nextButton&&(!this.tileSources||this.tileSources.length-1===c?this.navPrevNextWrap||this.nextButton.disable():this.nextButton.enable()),this.previousButton&&(c>0?this.previousButton.enable():this.navPrevNextWrap||this.previousButton.disable())},_showMessage:function(c){this._hideMessage();var v=e.makeNeutralElement("div");v.appendChild(document.createTextNode(c)),this.messageDiv=e.makeCenteredNode(v),e.addClass(this.messageDiv,"openseadragon-message"),this.container.appendChild(this.messageDiv)},_hideMessage:function(){var c=this.messageDiv;c&&(c.parentNode.removeChild(c),delete this.messageDiv)},gestureSettingsByDeviceType:function(c){switch(c){case"mouse":return this.gestureSettingsMouse;case"touch":return this.gestureSettingsTouch;case"pen":return this.gestureSettingsPen;default:return this.gestureSettingsUnknown}},_drawOverlays:function(){var c,v=this.currentOverlays.length;for(c=0;c1&&(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 c=e.pixelDensityRatio,v=e.getCurrentPixelDensityRatio();c!==v&&(e.pixelDensityRatio=v,this.world.resetItems(),this.forceRedraw())},goToPreviousPage:function(){var c=this._sequenceIndex-1;this.navPrevNextWrap&&c<0&&(c+=this.tileSources.length),this.goToPage(c)},goToNextPage:function(){var c=this._sequenceIndex+1;this.navPrevNextWrap&&c>=this.tileSources.length&&(c=0),this.goToPage(c)}});function r(c){return c=e.getElement(c),new e.Point(c.clientWidth===0?1:c.clientWidth,c.clientHeight===0?1:c.clientHeight)}function l(c,v,b,O,H){var B=c;if(e.type(v)==="string"){if(v.match(/^\s*<.*>\s*$/))v=e.parseXml(v);else if(v.match(/^\s*[{[].*[}\]]\s*$/))try{var A=e.parseJSON(v);v=A}catch{}}function N(X,G){X.ready?O(X):(X.addHandler("ready",function(){O(X)}),X.addHandler("open-failed",function(U){H({message:U.message,source:G})}))}setTimeout(function(){if(e.type(v)==="string")v=new e.TileSource({url:v,crossOriginPolicy:b.crossOriginPolicy!==void 0?b.crossOriginPolicy:c.crossOriginPolicy,ajaxWithCredentials:c.ajaxWithCredentials,ajaxHeaders:b.ajaxHeaders?b.ajaxHeaders:c.ajaxHeaders,useCanvas:c.useCanvas,success:function(J){O(J.tileSource)}}),v.addHandler("open-failed",function(J){H(J)});else if(e.isPlainObject(v)||v.nodeType)if(v.crossOriginPolicy===void 0&&(b.crossOriginPolicy!==void 0||c.crossOriginPolicy!==void 0)&&(v.crossOriginPolicy=b.crossOriginPolicy!==void 0?b.crossOriginPolicy:c.crossOriginPolicy),v.ajaxWithCredentials===void 0&&(v.ajaxWithCredentials=c.ajaxWithCredentials),v.useCanvas===void 0&&(v.useCanvas=c.useCanvas),e.isFunction(v.getTileUrl)){var X=new e.TileSource(v);X.getTileUrl=v.getTileUrl,O(X)}else{var G=e.TileSource.determineType(B,v);if(!G){H({message:"Unable to load TileSource",source:v});return}var U=G.prototype.configure.apply(B,[v]);N(new G(U),v)}else N(v,v)})}function a(c,v){if(v instanceof e.Overlay)return v;var b=null;if(v.element)b=e.getElement(v.element);else{var O=v.id?v.id:"openseadragon-overlay-"+Math.floor(Math.random()*1e7);b=e.getElement(v.id),b||(b=document.createElement("a"),b.href="#/overlay/"+O),b.id=O,e.addClass(b,v.className?v.className:"openseadragon-overlay")}var H=v.location,B=v.width,A=v.height;if(!H){var N=v.x,X=v.y;if(v.px!==void 0){var G=c.viewport.imageToViewportRectangle(new e.Rect(v.px,v.py,B||0,A||0));N=G.x,X=G.y,B=B!==void 0?G.width:void 0,A=A!==void 0?G.height:void 0}H=new e.Point(N,X)}var U=v.placement;return U&&e.type(U)==="string"&&(U=e.Placement[v.placement.toUpperCase()]),new e.Overlay({element:b,location:H,placement:U,onDraw:v.onDraw,checkResize:v.checkResize,width:B,height:A,rotationMode:v.rotationMode})}function o(c,v){var b;for(b=c.length-1;b>=0;b--)if(c[b].element===v)return b;return-1}function u(c,v){return e.requestAnimationFrame(function(){v(c)})}function h(c){e.requestAnimationFrame(function(){m(c)})}function g(c){c.autoHideControls&&(c.controlsShouldFade=!0,c.controlsFadeBeginTime=e.now()+c.controlsFadeDelay,window.setTimeout(function(){h(c)},c.controlsFadeDelay))}function m(c){var v,b,O,H;if(c.controlsShouldFade){for(v=e.now(),b=v-c.controlsFadeBeginTime,O=1-b/c.controlsFadeLength,O=Math.min(1,O),O=Math.max(0,O),H=c.controls.length-1;H>=0;H--)c.controls[H].autoFade&&c.controls[H].setOpacity(O);O>0&&h(c)}}function T(c){var v;for(c.controlsShouldFade=!1,v=c.controls.length-1;v>=0;v--)c.controls[v].setOpacity(1)}function x(){T(this)}function P(){g(this)}function C(c){var v={tracker:c.eventSource,position:c.position,originalEvent:c.originalEvent,preventDefault:c.preventDefault};this.raiseEvent("canvas-contextmenu",v),c.preventDefault=v.preventDefault}function k(c){var v={originalEvent:c.originalEvent,preventDefaultAction:!1,preventVerticalPan:c.preventVerticalPan,preventHorizontalPan:c.preventHorizontalPan};if(this.raiseEvent("canvas-key",v),!v.preventDefaultAction&&!c.ctrl&&!c.alt&&!c.meta)switch(c.keyCode){case 38:v.preventVerticalPan||(c.shift?this.viewport.zoomBy(1.1):this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(0,-this.pixelsPerArrowPress))),this.viewport.applyConstraints()),c.preventDefault=!0;break;case 40:v.preventVerticalPan||(c.shift?this.viewport.zoomBy(.9):this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(0,this.pixelsPerArrowPress))),this.viewport.applyConstraints()),c.preventDefault=!0;break;case 37:v.preventHorizontalPan||(this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(-this.pixelsPerArrowPress,0))),this.viewport.applyConstraints()),c.preventDefault=!0;break;case 39:v.preventHorizontalPan||(this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(this.pixelsPerArrowPress,0))),this.viewport.applyConstraints()),c.preventDefault=!0;break;default:c.preventDefault=!1;break}else c.preventDefault=!1}function d(c){var v={originalEvent:c.originalEvent,preventDefaultAction:!1,preventVerticalPan:c.preventVerticalPan,preventHorizontalPan:c.preventHorizontalPan};if(this.raiseEvent("canvas-key",v),!v.preventDefaultAction&&!c.ctrl&&!c.alt&&!c.meta)switch(c.keyCode){case 43:case 61:this.viewport.zoomBy(1.1),this.viewport.applyConstraints(),c.preventDefault=!0;break;case 45:this.viewport.zoomBy(.9),this.viewport.applyConstraints(),c.preventDefault=!0;break;case 48:this.viewport.goHome(),this.viewport.applyConstraints(),c.preventDefault=!0;break;case 119:case 87:v.preventVerticalPan||(c.shift?this.viewport.zoomBy(1.1):this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(0,-40))),this.viewport.applyConstraints()),c.preventDefault=!0;break;case 115:case 83:v.preventVerticalPan||(c.shift?this.viewport.zoomBy(.9):this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(0,40))),this.viewport.applyConstraints()),c.preventDefault=!0;break;case 97:v.preventHorizontalPan||(this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(-40,0))),this.viewport.applyConstraints()),c.preventDefault=!0;break;case 100:v.preventHorizontalPan||(this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(40,0))),this.viewport.applyConstraints()),c.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(),c.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(),c.preventDefault=!0;break;case 102:this.viewport.toggleFlip(),c.preventDefault=!0;break;case 106:this.goToPreviousPage();break;case 107:this.goToNextPage();break;default:c.preventDefault=!1;break}else c.preventDefault=!1}function _(c){var v,b=document.activeElement===this.canvas;b||this.canvas.focus(),this.viewport.flipped&&(c.position.x=this.viewport.getContainerSize().x-c.position.x);var O={tracker:c.eventSource,position:c.position,quick:c.quick,shift:c.shift,originalEvent:c.originalEvent,originalTarget:c.originalTarget,preventDefaultAction:!1};this.raiseEvent("canvas-click",O),!O.preventDefaultAction&&this.viewport&&c.quick&&(v=this.gestureSettingsByDeviceType(c.pointerType),v.clickToZoom&&(this.viewport.zoomBy(c.shift?1/this.zoomPerClick:this.zoomPerClick,v.zoomToRefPoint?this.viewport.pointFromPixel(c.position,!0):null),this.viewport.applyConstraints()))}function S(c){var v,b={tracker:c.eventSource,position:c.position,shift:c.shift,originalEvent:c.originalEvent,preventDefaultAction:!1};this.raiseEvent("canvas-double-click",b),!b.preventDefaultAction&&this.viewport&&(v=this.gestureSettingsByDeviceType(c.pointerType),v.dblClickToZoom&&(this.viewport.zoomBy(c.shift?1/this.zoomPerClick:this.zoomPerClick,v.zoomToRefPoint?this.viewport.pointFromPixel(c.position,!0):null),this.viewport.applyConstraints()))}function M(c){var v,b={tracker:c.eventSource,pointerType:c.pointerType,position:c.position,delta:c.delta,speed:c.speed,direction:c.direction,shift:c.shift,originalEvent:c.originalEvent,preventDefaultAction:!1};if(this.raiseEvent("canvas-drag",b),v=this.gestureSettingsByDeviceType(c.pointerType),v.dragToPan&&!b.preventDefaultAction&&this.viewport){if(this.panHorizontal||(c.delta.x=0),this.panVertical||(c.delta.y=0),this.viewport.flipped&&(c.delta.x=-c.delta.x),this.constrainDuringPan){var O=this.viewport.deltaPointsFromPixels(c.delta.negate());this.viewport.centerSpringX.target.value+=O.x,this.viewport.centerSpringY.target.value+=O.y;var H=this.viewport.getBounds(),B=this.viewport.getConstrainedBounds();this.viewport.centerSpringX.target.value-=O.x,this.viewport.centerSpringY.target.value-=O.y,H.x!==B.x&&(c.delta.x=0),H.y!==B.y&&(c.delta.y=0)}this.viewport.panBy(this.viewport.deltaPointsFromPixels(c.delta.negate()),v.flickEnabled&&!this.constrainDuringPan)}}function I(c){var v={tracker:c.eventSource,pointerType:c.pointerType,position:c.position,speed:c.speed,direction:c.direction,shift:c.shift,originalEvent:c.originalEvent,preventDefaultAction:!1};if(this.raiseEvent("canvas-drag-end",v),!v.preventDefaultAction&&this.viewport){var b=this.gestureSettingsByDeviceType(c.pointerType);if(b.flickEnabled&&c.speed>=b.flickMinSpeed){var O=0;this.panHorizontal&&(O=b.flickMomentum*c.speed*Math.cos(c.direction));var H=0;this.panVertical&&(H=b.flickMomentum*c.speed*Math.sin(c.direction));var B=this.viewport.pixelFromPoint(this.viewport.getCenter(!0)),A=this.viewport.pointFromPixel(new e.Point(B.x-O,B.y-H));this.viewport.panTo(A,!1)}this.viewport.applyConstraints()}}function V(c){this.raiseEvent("canvas-enter",{tracker:c.eventSource,pointerType:c.pointerType,position:c.position,buttons:c.buttons,pointers:c.pointers,insideElementPressed:c.insideElementPressed,buttonDownAny:c.buttonDownAny,originalEvent:c.originalEvent})}function j(c){this.raiseEvent("canvas-exit",{tracker:c.eventSource,pointerType:c.pointerType,position:c.position,buttons:c.buttons,pointers:c.pointers,insideElementPressed:c.insideElementPressed,buttonDownAny:c.buttonDownAny,originalEvent:c.originalEvent})}function q(c){this.raiseEvent("canvas-press",{tracker:c.eventSource,pointerType:c.pointerType,position:c.position,insideElementPressed:c.insideElementPressed,insideElementReleased:c.insideElementReleased,originalEvent:c.originalEvent})}function K(c){this.raiseEvent("canvas-release",{tracker:c.eventSource,pointerType:c.pointerType,position:c.position,insideElementPressed:c.insideElementPressed,insideElementReleased:c.insideElementReleased,originalEvent:c.originalEvent})}function re(c){this.raiseEvent("canvas-nonprimary-press",{tracker:c.eventSource,position:c.position,pointerType:c.pointerType,button:c.button,buttons:c.buttons,originalEvent:c.originalEvent})}function ee(c){this.raiseEvent("canvas-nonprimary-release",{tracker:c.eventSource,position:c.position,pointerType:c.pointerType,button:c.button,buttons:c.buttons,originalEvent:c.originalEvent})}function fe(c){var v,b,O,H,B={tracker:c.eventSource,pointerType:c.pointerType,gesturePoints:c.gesturePoints,lastCenter:c.lastCenter,center:c.center,lastDistance:c.lastDistance,distance:c.distance,shift:c.shift,originalEvent:c.originalEvent,preventDefaultPanAction:!1,preventDefaultZoomAction:!1,preventDefaultRotateAction:!1};if(this.raiseEvent("canvas-pinch",B),this.viewport&&(v=this.gestureSettingsByDeviceType(c.pointerType),v.pinchToZoom&&(!B.preventDefaultPanAction||!B.preventDefaultZoomAction)&&(b=this.viewport.pointFromPixel(c.center,!0),B.preventDefaultZoomAction||this.viewport.zoomBy(c.distance/c.lastDistance,b,!0),v.zoomToRefPoint&&!B.preventDefaultPanAction&&(O=this.viewport.pointFromPixel(c.lastCenter,!0),H=O.minus(b),this.panHorizontal||(H.x=0),this.panVertical||(H.y=0),this.viewport.panBy(H,!0)),this.viewport.applyConstraints()),v.pinchRotate&&!B.preventDefaultRotateAction)){var A=Math.atan2(c.gesturePoints[0].currentPos.y-c.gesturePoints[1].currentPos.y,c.gesturePoints[0].currentPos.x-c.gesturePoints[1].currentPos.x),N=Math.atan2(c.gesturePoints[0].lastPos.y-c.gesturePoints[1].lastPos.y,c.gesturePoints[0].lastPos.x-c.gesturePoints[1].lastPos.x);this.viewport.setRotation(this.viewport.getRotation()+(A-N)*(180/Math.PI))}}function ce(c){var v,b,O,H,B;H=e.now(),B=H-this._lastScrollTime,B>this.minScrollDeltaTime?(this._lastScrollTime=H,v={tracker:c.eventSource,position:c.position,scroll:c.scroll,shift:c.shift,originalEvent:c.originalEvent,preventDefaultAction:!1,preventDefault:!0},this.raiseEvent("canvas-scroll",v),!v.preventDefaultAction&&this.viewport&&(this.viewport.flipped&&(c.position.x=this.viewport.getContainerSize().x-c.position.x),b=this.gestureSettingsByDeviceType(c.pointerType),b.scrollToZoom&&(O=Math.pow(this.zoomPerScroll,c.scroll),this.viewport.zoomBy(O,b.zoomToRefPoint?this.viewport.pointFromPixel(c.position,!0):null),this.viewport.applyConstraints())),c.preventDefault=v.preventDefault):c.preventDefault=!0}function ye(c){i[this.hash].mouseInside=!0,T(this),this.raiseEvent("container-enter",{tracker:c.eventSource,pointerType:c.pointerType,position:c.position,buttons:c.buttons,pointers:c.pointers,insideElementPressed:c.insideElementPressed,buttonDownAny:c.buttonDownAny,originalEvent:c.originalEvent})}function ae(c){c.pointers<1&&(i[this.hash].mouseInside=!1,i[this.hash].animating||g(this)),this.raiseEvent("container-exit",{tracker:c.eventSource,pointerType:c.pointerType,position:c.position,buttons:c.buttons,pointers:c.pointers,insideElementPressed:c.insideElementPressed,buttonDownAny:c.buttonDownAny,originalEvent:c.originalEvent})}function oe(c){ie(c),c.isOpen()?c._updateRequestId=u(c,oe):c._updateRequestId=!1}function ie(c){if(!(c._opening||!i[c.hash])){if(c.autoResize){var v=r(c.container),b=i[c.hash].prevContainerSize;if(!v.equals(b)){var O=c.viewport;if(c.preserveImageSizeOnResize){var H=b.x/v.x,B=O.getZoom()*H,A=O.getCenter();O.resize(v,!1),O.zoomTo(B,null,!0),O.panTo(A,!0)}else{var N=O.getBounds();O.resize(v,!0),O.fitBoundsWithConstraints(N,!0)}i[c.hash].prevContainerSize=v,i[c.hash].forceRedraw=!0}}var X=c.viewport.update(),G=c.world.update()||X;X&&c.raiseEvent("viewport-change"),c.referenceStrip&&(G=c.referenceStrip.update(c.viewport)||G),!i[c.hash].animating&&G&&(c.raiseEvent("animation-start"),T(c)),(G||i[c.hash].forceRedraw||c.world.needsDraw())&&(we(c),c._drawOverlays(),c.navigator&&c.navigator.update(c.viewport),i[c.hash].forceRedraw=!1,G&&c.raiseEvent("animation")),i[c.hash].animating&&!G&&(c.raiseEvent("animation-finish"),i[c.hash].mouseInside||g(c)),i[c.hash].animating=G}}function we(c){c.imageLoader.clear(),c.drawer.clear(),c.world.draw(),c.raiseEvent("update-viewport",{})}function Q(c,v){return c?c+v:v}function Ce(){i[this.hash].lastZoomTime=e.now(),i[this.hash].zoomFactor=this.zoomPerSecond,i[this.hash].zooming=!0,st(this)}function Ae(){i[this.hash].lastZoomTime=e.now(),i[this.hash].zoomFactor=1/this.zoomPerSecond,i[this.hash].zooming=!0,st(this)}function pt(){i[this.hash].zooming=!1}function st(c){e.requestAnimationFrame(e.delegate(c,Pt))}function Pt(){var c,v,b;i[this.hash].zooming&&this.viewport&&(c=e.now(),v=c-i[this.hash].lastZoomTime,b=Math.pow(i[this.hash].zoomFactor,v/1e3),this.viewport.zoomBy(b),this.viewport.applyConstraints(),i[this.hash].lastZoomTime=c,st(this))}function Be(){this.viewport&&(i[this.hash].zooming=!1,this.viewport.zoomBy(this.zoomPerClick/1),this.viewport.applyConstraints())}function et(){this.viewport&&(i[this.hash].zooming=!1,this.viewport.zoomBy(1/this.zoomPerClick),this.viewport.applyConstraints())}function gt(){this.buttonGroup&&(this.buttonGroup.emulateEnter(),this.buttonGroup.emulateLeave())}function Ze(){this.viewport&&this.viewport.goHome()}function rt(){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 ot(){if(this.viewport){var c=this.viewport.getRotation();this.viewport.flipped?c=e.positiveModulo(c+this.rotationIncrement,360):c=e.positiveModulo(c-this.rotationIncrement,360),this.viewport.setRotation(c)}}function E(){if(this.viewport){var c=this.viewport.getRotation();this.viewport.flipped?c=e.positiveModulo(c-this.rotationIncrement,360):c=e.positiveModulo(c+this.rotationIncrement,360),this.viewport.setRotation(c)}}function R(){this.viewport.toggleFlip()}}(s),function(e){e.Navigator=function(u){var h=u.viewer,g=this,m,T;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=h.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(C,k){C.margin="0px",C.border=k+"px solid "+u.borderColor,C.padding="0px",C.background=u.background,C.opacity=u.opacity,C.overflow="hidden"}(this.element.style,this.borderWidth),this.displayRegion=e.makeNeutralElement("div"),this.displayRegion.id=this.element.id+"-displayregion",this.displayRegion.className="displayregion",function(C,k){C.position="relative",C.top="0px",C.left="0px",C.fontSize="0px",C.overflow="hidden",C.border=k+"px solid "+u.displayRegionColor,C.margin="0px",C.padding="0px",C.background="transparent",C.float="left",C.cssFloat="left",C.styleFloat="left",C.zIndex=999999999,C.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),h.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&&(m=e.getElementSize(h.element),this.element.style.height=Math.round(m.y*u.sizeRatio)+"px",this.element.style.width=Math.round(m.x*u.sizeRatio)+"px",this.oldViewerSize=m,T=e.getElementSize(this.element),this.elementArea=T.x*T.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 x(C){a(g.displayRegionContainer,C),a(g.displayRegion,-C),g.viewport.setRotation(C)}if(u.navigatorRotate){var P=u.viewer.viewport?u.viewer.viewport.getRotation():u.viewer.degrees||0;x(P),u.viewer.addHandler("rotate",function(C){x(C.degrees)})}this.innerTracker.destroy(),this.innerTracker=new e.MouseTracker({userData:"Navigator.innerTracker",element:this.element,dragHandler:e.delegate(this,n),clickHandler:e.delegate(this,i),releaseHandler:e.delegate(this,r),scrollHandler:e.delegate(this,l),preProcessEventHandler:function(C){C.eventType==="wheel"&&(C.preventDefault=!0)}}),this.outerTracker.userData="Navigator.outerTracker",e.setElementPointerEventsNone(this.canvas),e.setElementPointerEventsNone(this.container),this.addHandler("reset-size",function(){g.viewport&&g.viewport.goHome(!0)}),h.world.addHandler("item-index-change",function(C){window.setTimeout(function(){var k=g.world.getItemAt(C.previousIndex);g.world.setItemIndex(k,C.newIndex)},1)}),h.world.addHandler("remove-item",function(C){var k=C.item,d=g._getMatchingItem(k);d&&g.world.removeItem(d)}),this.update(h.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){o(this.displayRegion,u),o(this.canvas,u),o(this.element,u)},update:function(u){var h,g,m,T,x,P;if(h=e.getElementSize(this.viewer.element),this._resizeWithViewer&&h.x&&h.y&&!h.equals(this.oldViewerSize)&&(this.oldViewerSize=h,this.maintainSizeRatio||!this.elementArea?(g=h.x*this.sizeRatio,m=h.y*this.sizeRatio):(g=Math.sqrt(this.elementArea*(h.x/h.y)),m=this.elementArea/g),this.element.style.width=Math.round(g)+"px",this.element.style.height=Math.round(m)+"px",this.elementArea||(this.elementArea=g*m),this.updateSize()),u&&this.viewport){T=u.getBoundsNoRotate(!0),x=this.viewport.pixelFromPointNoRotate(T.getTopLeft(),!1),P=this.viewport.pixelFromPointNoRotate(T.getBottomRight(),!1).minus(this.totalBorderWidths);var C=this.displayRegion.style;C.display=this.world.getItemCount()?"block":"none",C.top=Math.round(x.y)+"px",C.left=Math.round(x.x)+"px";var k=Math.abs(x.x-P.x),d=Math.abs(x.y-P.y);C.width=Math.round(Math.max(k,0))+"px",C.height=Math.round(Math.max(d,0))+"px"}},addTiledImage:function(u){var h=this,g=u.originalTiledImage;delete u.original;var m=e.extend({},u,{success:function(T){var x=T.item;x._originalForNavigator=g,h._matchBounds(x,g,!0),h._matchOpacity(x,g),h._matchCompositeOperation(x,g);function P(){h._matchBounds(x,g)}function C(){h._matchOpacity(x,g)}function k(){h._matchCompositeOperation(x,g)}g.addHandler("bounds-change",P),g.addHandler("clip-change",P),g.addHandler("opacity-change",C),g.addHandler("composite-operation-change",k)}});return e.Viewer.prototype.addTiledImage.apply(this,[m])},destroy:function(){return e.Viewer.prototype.destroy.apply(this)},_getMatchingItem:function(u){for(var h=this.world.getItemCount(),g,m=0;m1||r.y>1));n++);return n-1},getTileAtPoint:function(n,r){var l=r.x>=0&&r.x<=1&&r.y>=0&&r.y<=1/this.aspectRatio;e.console.assert(l,"[TileSource.getTileAtPoint] must be called with a valid point.");var a=this.dimensions.x*this.getLevelScale(n),o=r.x*a,u=r.y*a,h=Math.floor(o/this.getTileWidth(n)),g=Math.floor(u/this.getTileHeight(n));r.x>=1&&(h=this.getNumTiles(n).x-1);var m=1e-15;return r.y>=1/this.aspectRatio-m&&(g=this.getNumTiles(n).y-1),new e.Point(h,g)},getTileBounds:function(n,r,l,a){var o=this.dimensions.times(this.getLevelScale(n)),u=this.getTileWidth(n),h=this.getTileHeight(n),g=r===0?0:u*r-this.tileOverlap,m=l===0?0:h*l-this.tileOverlap,T=u+(r===0?1:2)*this.tileOverlap,x=h+(l===0?1:2)*this.tileOverlap,P=1/o.x;return T=Math.min(T,o.x-g),x=Math.min(x,o.y-m),a?new e.Rect(0,0,T,x):new e.Rect(g*P,m*P,T*P,x*P)},getImageInfo:function(n){var r=this,l,a,o,u,h,g,m;n&&(h=n.split("/"),g=h[h.length-1],m=g.lastIndexOf("."),m>-1&&(h[h.length-1]=g.slice(0,m))),a=function(T){typeof T=="string"&&(T=e.parseXml(T));var x=e.TileSource.determineType(r,T,n);if(!x){r.raiseEvent("open-failed",{message:"Unable to load TileSource",source:n});return}u=x.prototype.configure.apply(r,[T,n]),u.ajaxWithCredentials===void 0&&(u.ajaxWithCredentials=r.ajaxWithCredentials),o=new x(u),r.ready=!0,r.raiseEvent("ready",{tileSource:o})},n.match(/\.js$/)?(l=n.split("/").pop().replace(".js",""),e.jsonp({url:n,async:!1,callbackName:l,callback:a})):e.makeAjaxRequest({url:n,withCredentials:this.ajaxWithCredentials,headers:this.ajaxHeaders,success:function(T){var x=i(T);a(x)},error:function(T,x){var P;try{P="HTTP "+T.status+" attempting to load TileSource"}catch{var C;typeof x>"u"||!x.toString?C="Unknown error":C=x.toString(),P=C+" attempting to load TileSource"}r.raiseEvent("open-failed",{message:P,source:n})}})},supports:function(n,r){return!1},configure:function(n,r){throw new Error("Method not implemented.")},getTileUrl:function(n,r,l){throw new Error("Method not implemented.")},getTileAjaxHeaders:function(n,r,l){return{}},tileExists:function(n,r,l){var a=this.getNumTiles(n);return n>=this.minLevel&&n<=this.maxLevel&&r>=0&&l>=0&&r=0;x--)for(P=this.displayRects[x],C=P.minLevel;C<=P.maxLevel;C++)this._levelRects[C]||(this._levelRects[C]=[]),this._levelRects[C].push(P);e.TileSource.apply(this,[k])},e.extend(e.DziTileSource.prototype,e.TileSource.prototype,{supports:function(r,l){var a;return r.Image?a=r.Image.xmlns:r.documentElement&&(r.documentElement.localName==="Image"||r.documentElement.tagName==="Image")&&(a=r.documentElement.namespaceURI),a=(a||"").toLowerCase(),a.indexOf("schemas.microsoft.com/deepzoom/2008")!==-1||a.indexOf("schemas.microsoft.com/deepzoom/2009")!==-1},configure:function(r,l){var a;return e.isPlainObject(r)?a=n(this,r):a=i(this,r),l&&!a.tilesUrl&&(a.tilesUrl=l.replace(/([^/]+?)(\.(dzi|xml|js)?(\?[^/]*)?)?\/?$/,"$1_files/"),l.search(/\.(dzi|xml|js)\?/)!==-1?a.queryParams=l.match(/\?.*/):a.queryParams=""),a},getTileUrl:function(r,l,a){return[this.tilesUrl,r,"/",l,"_",a,".",this.fileFormat,this.queryParams].join("")},tileExists:function(r,l,a){var o=this._levelRects[r],u,h,g,m,T,x,P;if(this.minLevel&&rthis.maxLevel)return!1;if(!o||!o.length)return!0;for(P=o.length-1;P>=0;P--)if(u=o[P],!(ru.maxLevel)&&(h=this.getLevelScale(r),g=u.x*h,m=u.y*h,T=g+u.width*h,x=m+u.height*h,g=Math.floor(g/this._tileWidth),m=Math.floor(m/this._tileWidth),T=Math.ceil(T/this._tileWidth),x=Math.ceil(x/this._tileWidth),g<=l&&l0?a.tileSize=Math.max.apply(null,T):a.tileSize=g}else this.sizes&&this.sizes.length>0?(this.emulateLegacyImagePyramid=!0,a.levels=n(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 P=Math.max.apply(null,this.scale_factors);a.maxLevel=Math.round(Math.log(P)*Math.LOG2E)}e.TileSource.apply(this,[a])},e.extend(e.IIIFTileSource.prototype,e.TileSource.prototype,{supports:function(a,o){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,o){if(e.isPlainObject(a)){if(!a["@context"])a["@context"]="http://iiif.io/api/image/1.0/context.json",a["@id"]=o.replace("/info.json",""),a.version=1;else{var h=a["@context"];if(Array.isArray(h)){for(var g=0;g0&&a>=this.minLevel&&a<=this.maxLevel&&(o=this.levels[a].width/this.levels[this.maxLevel].width),o}return e.TileSource.prototype.getLevelScale.call(this,a)},getNumTiles:function(a){if(this.emulateLegacyImagePyramid){var o=this.getLevelScale(a);return o?new e.Point(1,1):new e.Point(0,0)}return e.TileSource.prototype.getNumTiles.call(this,a)},getTileAtPoint:function(a,o){return this.emulateLegacyImagePyramid?new e.Point(0,0):e.TileSource.prototype.getTileAtPoint.call(this,a,o)},getTileUrl:function(a,o,u){if(this.emulateLegacyImagePyramid){var h=null;return this.levels.length>0&&a>=this.minLevel&&a<=this.maxLevel&&(h=this.levels[a].url),h}var g="0",m=Math.pow(.5,this.maxLevel-a),T=Math.ceil(this.width*m),x=Math.ceil(this.height*m),P,C,k,d,_,S,M,I,V,j,q,K,re,ee;return P=this.getTileWidth(a),C=this.getTileHeight(a),k=Math.ceil(P/m),d=Math.ceil(C/m),this.version===1?re="native."+this.tileFormat:re="default."+this.tileFormat,T1&&a.profile[1].supports&&(g=a.profile[1].supports.indexOf("sizeByW")!==-1),a.version===3&&a.extraFeatures&&(g=a.extraFeatures.indexOf("sizeByWh")!==-1),!h||g}function n(a){for(var o=[],u=0;uh?g=u/256:g=h/256,o.maxLevel=Math.ceil(Math.log(g)/Math.log(2))-1,o.tileSize=256,o.width=u,o.height=h,e.TileSource.apply(this,[o])},e.extend(e.TmsTileSource.prototype,e.TileSource.prototype,{supports:function(i,n){return i.type&&i.type==="tiledmapservice"},configure:function(i,n){return i},getTileUrl:function(i,n,r){var l=this.getNumTiles(i).y-1;return this.tilesUrl+i+"/"+n+"/"+(l-r)+".png"}})}(s),function(e){e.ZoomifyTileSource=function(i){typeof i.tileSize>"u"&&(i.tileSize=256),typeof i.fileFormat>"u"&&(i.fileFormat="jpg",this.fileFormat=i.fileFormat);var n={x:i.width,y:i.height};for(i.imageSizes=[{x:i.width,y:i.height}],i.gridSize=[this._getGridSize(i.width,i.height,i.tileSize)];parseInt(n.x,10)>i.tileSize||parseInt(n.y,10)>i.tileSize;)n.x=Math.floor(n.x/2),n.y=Math.floor(n.y/2),i.imageSizes.push({x:n.x,y:n.y}),i.gridSize.push(this._getGridSize(n.x,n.y,i.tileSize));i.imageSizes.reverse(),i.gridSize.reverse(),i.minLevel=0,i.maxLevel=i.gridSize.length-1,s.TileSource.apply(this,[i])},e.extend(e.ZoomifyTileSource.prototype,e.TileSource.prototype,{_getGridSize:function(i,n,r){return{x:Math.ceil(i/r),y:Math.ceil(n/r)}},_calculateAbsoluteTileNumber:function(i,n,r){for(var l=0,a={},o=0;o0?(o=a.levels[a.levels.length-1].width,u=a.levels[a.levels.length-1].height):(o=0,u=0,e.console.error("No supported image formats found")),e.extend(!0,a,{width:o,height:u,tileSize:Math.max(u,o),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(l,a){return l.type&&l.type==="legacy-image-pyramid"||l.documentElement&&l.documentElement.getAttribute("type")==="legacy-image-pyramid"},configure:function(l,a){var o;return e.isPlainObject(l)?o=r(this,l):o=n(this,l),o},getLevelScale:function(l){var a=NaN;return this.levels.length>0&&l>=this.minLevel&&l<=this.maxLevel&&(a=this.levels[l].width/this.levels[this.maxLevel].width),a},getNumTiles:function(l){var a=this.getLevelScale(l);return a?new e.Point(1,1):new e.Point(0,0)},getTileUrl:function(l,a,o){var u=null;return this.levels.length>0&&l>=this.minLevel&&l<=this.maxLevel&&(u=this.levels[l].url),u}});function i(l){var a=[],o,u;for(u=0;u");return a.sort(function(h,g){return h.height-g.height})}function n(l,a){if(!a||!a.documentElement)throw new Error(e.getString("Errors.Xml"));var o=a.documentElement,u=o.tagName,h=null,g=[],m,T;if(u==="image")try{for(h={type:o.getAttribute("type"),levels:[]},g=o.getElementsByTagName("level"),T=0;T=this.minLevel&&i<=this.maxLevel&&(n=this.levels[i].width/this.levels[this.maxLevel].width),n},getNumTiles:function(i){var n=this.getLevelScale(i);return n?new e.Point(1,1):new e.Point(0,0)},getTileUrl:function(i,n,r){var l=null;return i>=this.minLevel&&i<=this.maxLevel&&(l=this.levels[i].url),l},getContext2D:function(i,n,r){var l=null;return i>=this.minLevel&&i<=this.maxLevel&&(l=this.levels[i].context2D),l},destroy:function(){this._freeupCanvasMemory()},_buildLevels:function(){var i=[{url:this._image.src,width:this._image.naturalWidth,height:this._image.naturalHeight}];if(!this.buildPyramid||!e.supportsCanvas||!this.useCanvas)return delete this._image,i;var n=this._image.naturalWidth,r=this._image.naturalHeight,l=document.createElement("canvas"),a=l.getContext("2d");if(l.width=n,l.height=r,a.drawImage(this._image,0,0,n,r),i[0].context2D=a,delete this._image,e.isCanvasTainted(l))return i;for(;n>=2&&r>=2;){n=Math.floor(n/2),r=Math.floor(r/2);var o=document.createElement("canvas"),u=o.getContext("2d");o.width=n,o.height=r,u.drawImage(l,0,0,n,r),i.splice(0,0,{context2D:u,width:n,height:r}),l=o,a=u}return i},_freeupCanvasMemory:function(){for(var i=0;i0&&i(u))}function r(u){u.shouldFade=!0,u.fadeBeginTime=e.now()+u.fadeDelay,window.setTimeout(function(){i(u)},u.fadeDelay)}function l(u){u.shouldFade=!1,u.imgGroup&&e.setElementOpacity(u.imgGroup,1,!0)}function a(u,h){u.element.disabled||(h>=e.ButtonState.GROUP&&u.currentState===e.ButtonState.REST&&(l(u),u.currentState=e.ButtonState.GROUP),h>=e.ButtonState.HOVER&&u.currentState===e.ButtonState.GROUP&&(u.imgHover&&(u.imgHover.style.visibility=""),u.currentState=e.ButtonState.HOVER),h>=e.ButtonState.DOWN&&u.currentState===e.ButtonState.HOVER&&(u.imgDown&&(u.imgDown.style.visibility=""),u.currentState=e.ButtonState.DOWN))}function o(u,h){u.element.disabled||(h<=e.ButtonState.HOVER&&u.currentState===e.ButtonState.DOWN&&(u.imgDown&&(u.imgDown.style.visibility="hidden"),u.currentState=e.ButtonState.HOVER),h<=e.ButtonState.GROUP&&u.currentState===e.ButtonState.HOVER&&(u.imgHover&&(u.imgHover.style.visibility="hidden"),u.currentState=e.ButtonState.GROUP),h<=e.ButtonState.REST&&u.currentState===e.ButtonState.GROUP&&(r(u),u.currentState=e.ButtonState.REST))}}(s),function(e){e.ButtonGroup=function(i){e.extend(!0,this,{buttons:[],clickTimeThreshold:e.DEFAULT_SETTINGS.clickTimeThreshold,clickDistThreshold:e.DEFAULT_SETTINGS.clickDistThreshold,labelText:""},i);var n=this.buttons.concat([]),r=this,l;if(this.element=i.element||e.makeNeutralElement("div"),!i.group)for(this.element.style.display="inline-block",l=0;l=270?(o=this.getTopRight(),this.x=o.x,this.y=o.y,u=this.height,this.height=this.width,this.width=u,this.degrees-=270):this.degrees>=180?(o=this.getBottomRight(),this.x=o.x,this.y=o.y,this.degrees-=180):this.degrees>=90&&(o=this.getBottomLeft(),this.x=o.x,this.y=o.y,u=this.height,this.height=this.width,this.width=u,this.degrees-=90)},e.Rect.fromSummits=function(i,n,r){var l=i.distanceTo(n),a=i.distanceTo(r),o=n.minus(i),u=Math.atan(o.y/o.x);return o.x<0?u+=Math.PI:o.y<0&&(u+=2*Math.PI),new e.Rect(i.x,i.y,l,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(i){return i instanceof e.Rect&&this.x===i.x&&this.y===i.y&&this.width===i.width&&this.height===i.height&&this.degrees===i.degrees},times:function(i){return new e.Rect(this.x*i,this.y*i,this.width*i,this.height*i,this.degrees)},translate:function(i){return new e.Rect(this.x+i.x,this.y+i.y,this.width,this.height,this.degrees)},union:function(i){var n=this.getBoundingBox(),r=i.getBoundingBox(),l=Math.min(n.x,r.x),a=Math.min(n.y,r.y),o=Math.max(n.x+n.width,r.x+r.width),u=Math.max(n.y+n.height,r.y+r.height);return new e.Rect(l,a,o-l,u-a)},intersection:function(i){var n=1e-10,r=[],l=this.getTopLeft();i.containsPoint(l,n)&&r.push(l);var a=this.getTopRight();i.containsPoint(a,n)&&r.push(a);var o=this.getBottomLeft();i.containsPoint(o,n)&&r.push(o);var u=this.getBottomRight();i.containsPoint(u,n)&&r.push(u);var h=i.getTopLeft();this.containsPoint(h,n)&&r.push(h);var g=i.getTopRight();this.containsPoint(g,n)&&r.push(g);var m=i.getBottomLeft();this.containsPoint(m,n)&&r.push(m);var T=i.getBottomRight();this.containsPoint(T,n)&&r.push(T);for(var x=this._getSegments(),P=i._getSegments(),C=0;CV&&(V=re.x),re.yq&&(q=re.y)}return new e.Rect(I,j,V-I,q-j)},_getSegments:function(){var i=this.getTopLeft(),n=this.getTopRight(),r=this.getBottomLeft(),l=this.getBottomRight();return[[i,n],[n,l],[l,r],[r,i]]},rotate:function(i,n){if(i=e.positiveModulo(i,360),i===0)return this.clone();n=n||this.getCenter();var r=this.getTopLeft().rotate(i,n),l=this.getTopRight().rotate(i,n),a=l.minus(r);a=a.apply(function(u){var h=1e-15;return Math.abs(u)=-n&&(i.x-l.x)*o.x+(i.y-l.y)*o.y<=n&&(i.x-r.x)*u.x+(i.y-r.y)*u.y>=-n&&(i.x-a.x)*u.x+(i.y-a.y)*u.y<=n},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]"}}}(s),function(e){var i={};e.ReferenceStrip=function(m){var T=this,x=m.viewer,P=e.getElementSize(x.element),C,k,d;for(m.id||(m.id="referencestrip-"+e.now(),this.element=e.makeNeutralElement("div"),this.element.id=m.id,this.element.className="referencestrip"),m=e.extend(!0,{sizeRatio:e.DEFAULT_SETTINGS.referenceStripSizeRatio,position:e.DEFAULT_SETTINGS.referenceStripPosition,scroll:e.DEFAULT_SETTINGS.referenceStripScroll,clickTimeThreshold:e.DEFAULT_SETTINGS.clickTimeThreshold},m,{element:this.element}),e.extend(this,m),i[this.id]={animating:!1},this.minPixelRatio=this.viewer.minPixelRatio,this.element.tabIndex=0,k=this.element.style,k.marginTop="0px",k.marginRight="0px",k.marginBottom="0px",k.marginLeft="0px",k.left="0px",k.bottom="0px",k.border="0px",k.background="#000",k.position="relative",e.setElementTouchActionNone(this.element),e.setElementOpacity(this.element,.8),this.viewer=x,this.tracker=new e.MouseTracker({userData:"ReferenceStrip.tracker",element:this.element,clickHandler:e.delegate(this,n),dragHandler:e.delegate(this,r),scrollHandler:e.delegate(this,l),enterHandler:e.delegate(this,o),leaveHandler:e.delegate(this,u),keyDownHandler:e.delegate(this,h),keyHandler:e.delegate(this,g),preProcessEventHandler:function(_){_.eventType==="wheel"&&(_.preventDefault=!0)}}),m.width&&m.height?(this.element.style.width=m.width+"px",this.element.style.height=m.height+"px",x.addControl(this.element,{anchor:e.ControlAnchor.BOTTOM_LEFT})):m.scroll==="horizontal"?(this.element.style.width=P.x*m.sizeRatio*x.tileSources.length+12*x.tileSources.length+"px",this.element.style.height=P.y*m.sizeRatio+"px",x.addControl(this.element,{anchor:e.ControlAnchor.BOTTOM_LEFT})):(this.element.style.height=P.y*m.sizeRatio*x.tileSources.length+12*x.tileSources.length+"px",this.element.style.width=P.x*m.sizeRatio+"px",x.addControl(this.element,{anchor:e.ControlAnchor.TOP_LEFT})),this.panelWidth=P.x*this.sizeRatio+8,this.panelHeight=P.y*this.sizeRatio+8,this.panels=[],this.miniViewers={},d=0;dk+x.x-this.panelWidth?(_=Math.min(_,P-x.x),this.element.style.marginLeft=-_+"px",a(this,x.x,-_)):_d+x.y-this.panelHeight?(_=Math.min(_,C-x.y),this.element.style.marginTop=-_+"px",a(this,x.y,-_)):_0?T>-(P-k.x)&&(this.element.style.marginLeft=T+m.delta.x*2+"px",a(this,k.x,T+m.delta.x*2)):-m.delta.x<0&&T<0&&(this.element.style.marginLeft=T+m.delta.x*2+"px",a(this,k.x,T+m.delta.x*2)):-m.delta.y>0?x>-(C-k.y)&&(this.element.style.marginTop=x+m.delta.y*2+"px",a(this,k.y,x+m.delta.y*2)):-m.delta.y<0&&x<0&&(this.element.style.marginTop=x+m.delta.y*2+"px",a(this,k.y,x+m.delta.y*2))}}function l(m){if(this.element){var T=Number(this.element.style.marginLeft.replace("px","")),x=Number(this.element.style.marginTop.replace("px","")),P=Number(this.element.style.width.replace("px","")),C=Number(this.element.style.height.replace("px","")),k=e.getElementSize(this.viewer.canvas);this.scroll==="horizontal"?m.scroll>0?T>-(P-k.x)&&(this.element.style.marginLeft=T-m.scroll*60+"px",a(this,k.x,T-m.scroll*60)):m.scroll<0&&T<0&&(this.element.style.marginLeft=T-m.scroll*60+"px",a(this,k.x,T-m.scroll*60)):m.scroll<0?x>k.y-C&&(this.element.style.marginTop=x+m.scroll*60+"px",a(this,k.y,x+m.scroll*60)):m.scroll>0&&x<0&&(this.element.style.marginTop=x+m.scroll*60+"px",a(this,k.y,x+m.scroll*60)),m.preventDefault=!0}}function a(m,T,x){var P,C,k,d,_,S;for(m.scroll==="horizontal"?P=m.panelWidth:P=m.panelHeight,C=Math.ceil(T/P)+5,k=Math.ceil((Math.abs(x)+T)/P)+1,C=k-C,C=C<0?0:C,_=C;_1?r[1].springStiffness:5,animationTime:r.length>1?r[1].animationTime:1.5}),e.console.assert(typeof n.springStiffness=="number"&&n.springStiffness!==0,"[OpenSeadragon.Spring] options.springStiffness must be a non-zero number"),e.console.assert(typeof n.animationTime=="number"&&n.animationTime>=0,"[OpenSeadragon.Spring] options.animationTime must be a number greater than or equal to 0"),n.exponential&&(this._exponential=!0,delete n.exponential),e.extend(!0,this,n),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(n){e.console.assert(!this._exponential||n!==0,"[OpenSeadragon.Spring.resetTo] target must be non-zero for exponential springs"),this.start.value=this.target.value=this.current.value=n,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(n){e.console.assert(!this._exponential||n!==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=n,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(n){this.start.value+=n,this.target.value+=n,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(n){this._exponential=n,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 n,r;this._exponential?(n=this.start._logValue,r=this.target._logValue):(n=this.start.value,r=this.target.value);var l=this.current.time>=this.target.time?r:n+(r-n)*i(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(l):this.current.value=l,a!==this.current.value},isAtTargetValue:function(){return this.current.value===this.target.value}};function i(n,r){return(1-Math.exp(n*-r))/(1-Math.exp(-n))}}(s),function(e){function i(r){e.extend(!0,this,{timeout:e.DEFAULT_SETTINGS.timeout,jobId:null},r),this.image=null}i.prototype={errorMsg:null,start:function(){var r=this,l=this.abort;this.image=new Image,this.image.onload=function(){r.finish(!0)},this.image.onabort=this.image.onerror=function(){r.errorMsg="Image load aborted",r.finish(!1)},this.jobId=window.setTimeout(function(){r.errorMsg="Image load exceeded timeout ("+r.timeout+" ms)",r.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 o;try{o=new window.Blob([a.response])}catch(m){var u=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder;if(m.name==="TypeError"&&u){var h=new u;h.append(a.response),o=h.getBlob()}}o.size===0&&(r.errorMsg="Empty image response.",r.finish(!1));var g=(window.URL||window.webkitURL).createObjectURL(o);r.image.src=g},error:function(a){r.errorMsg="Image load aborted - XHR error",r.finish(!1)}}),this.abort=function(){r.request.abort(),typeof l=="function"&&l()}):(this.crossOriginPolicy!==!1&&(this.image.crossOrigin=this.crossOriginPolicy),this.image.src=this.src)},finish:function(r){this.image.onload=this.image.onerror=this.image.onabort=null,r||(this.image=null),this.jobId&&window.clearTimeout(this.jobId),this.callback(this)}},e.ImageLoader=function(r){e.extend(!0,this,{jobLimit:e.DEFAULT_SETTINGS.imageLoaderLimit,timeout:e.DEFAULT_SETTINGS.timeout,jobQueue:[],jobsInProgress:0},r)},e.ImageLoader.prototype={addJob:function(r){var l=this,a=function(h){n(l,h,r.callback)},o={src:r.src,loadWithAjax:r.loadWithAjax,ajaxHeaders:r.loadWithAjax?r.ajaxHeaders:null,crossOriginPolicy:r.crossOriginPolicy,ajaxWithCredentials:r.ajaxWithCredentials,callback:a,abort:r.abort,timeout:this.timeout},u=new i(o);!this.jobLimit||this.jobsInProgress0&&(o=r.jobQueue.shift(),o.start(),r.jobsInProgress++),a(l.image,l.errorMsg,l.request)}}(s),function(e){e.Tile=function(i,n,r,l,a,o,u,h,g,m){this.level=i,this.x=n,this.y=r,this.bounds=l,this.sourceBounds=m,this.exists=a,this.url=o,this.context2D=u,this.loadWithAjax=h,this.ajaxHeaders=g,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(i){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!==i&&i.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(i,n,r,l){var a=this.position.times(e.pixelDensityRatio),o=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}i.save(),i.globalAlpha=this.opacity,typeof r=="number"&&r!==1&&(a=a.times(r),o=o.times(r)),l instanceof e.Point&&(a=a.plus(l)),i.globalAlpha===1&&this._hasTransparencyChannel()&&i.clearRect(a.x,a.y,o.x,o.y),n({context:i,tile:this,rendered:u});var h,g;this.sourceBounds?(h=Math.min(this.sourceBounds.width,u.canvas.width),g=Math.min(this.sourceBounds.height,u.canvas.height)):(h=u.canvas.width,g=u.canvas.height),i.translate(a.x+o.x/2,0),this.flipped&&i.scale(-1,1),i.drawImage(u.canvas,0,0,h,g,-o.x/2,a.y,o.x,o.y),i.restore()},getScaleForEdgeSmoothing:function(){var i;if(this.cacheImageRecord)i=this.cacheImageRecord.getRenderedContext();else if(this.context2D)i=this.context2D;else return e.console.warn("[Tile.drawCanvas] attempting to get tile scale %s when tile's not cached",this.toString()),1;return i.canvas.width/(this.size.x*e.pixelDensityRatio)},getTranslationForEdgeSmoothing:function(i,n,r){var l=Math.max(1,Math.ceil((r.x-n.x)/2)),a=Math.max(1,Math.ceil((r.y-n.y)/2));return new e.Point(l,a).minus(this.position.times(e.pixelDensityRatio).times(i||1).apply(function(o){return o%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}}}(s),function(e){e.OverlayPlacement=e.Placement,e.OverlayRotationMode=e.freezeObject({NO_ROTATION:1,EXACT:2,BOUNDING_BOX:3}),e.Overlay=function(i,n,r){var l;e.isPlainObject(i)?l=i:l={element:i,location:n,placement:r},this.element=l.element,this.style=l.element.style,this._init(l)},e.Overlay.prototype={_init:function(i){this.location=i.location,this.placement=i.placement===void 0?e.Placement.TOP_LEFT:i.placement,this.onDraw=i.onDraw,this.checkResize=i.checkResize===void 0?!0:i.checkResize,this.width=i.width===void 0?null:i.width,this.height=i.height===void 0?null:i.height,this.rotationMode=i.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(i,n){var r=e.Placement.properties[this.placement];r&&(r.isHorizontallyCentered?i.x-=n.x/2:r.isRight&&(i.x-=n.x),r.isVerticallyCentered?i.y-=n.y/2:r.isBottom&&(i.y-=n.y))},destroy:function(){var i=this.element,n=this.style;i.parentNode&&(i.parentNode.removeChild(i),i.prevElementParent&&(n.display="none",document.body.appendChild(i))),this.onDraw=null,n.top="",n.left="",n.position="",this.width!==null&&(n.width=""),this.height!==null&&(n.height="");var r=e.getCssPropertyWithVendorPrefix("transformOrigin"),l=e.getCssPropertyWithVendorPrefix("transform");r&&l&&(n[r]="",n[l]="")},drawHTML:function(i,n){var r=this.element;r.parentNode!==i&&(r.prevElementParent=r.parentNode,r.prevNextSibling=r.nextSibling,i.appendChild(r),this.style.position="absolute",this.size=e.getElementSize(r));var l=this._getOverlayPositionAndSize(n),a=l.position,o=this.size=l.size,u=l.rotate;if(this.onDraw)this.onDraw(a,o,this.element);else{var h=this.style;h.left=a.x+"px",h.top=a.y+"px",this.width!==null&&(h.width=o.x+"px"),this.height!==null&&(h.height=o.y+"px");var g=e.getCssPropertyWithVendorPrefix("transformOrigin"),m=e.getCssPropertyWithVendorPrefix("transform");g&&m&&(u?(h[g]=this._getTransformOrigin(),h[m]="rotate("+u+"deg)"):(h[g]="",h[m]="")),h.display="block"}},_getOverlayPositionAndSize:function(i){var n=i.pixelFromPoint(this.location,!0),r=this._getSizeInPixels(i);this.adjust(n,r);var l=0;if(i.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(n.x,n.y,r.x,r.y),o=this._getBoundingBox(a,i.degrees);n=o.getTopLeft(),r=o.getSize()}else l=i.degrees;return{position:n,size:r,rotate:l}},_getSizeInPixels:function(i){var n=this.size.x,r=this.size.y;if(this.width!==null||this.height!==null){var l=i.deltaPixelsFromPointsNoRotate(new e.Point(this.width||0,this.height||0),!0);this.width!==null&&(n=l.x),this.height!==null&&(r=l.y)}if(this.checkResize&&(this.width===null||this.height===null)){var a=this.size=e.getElementSize(this.element);this.width===null&&(n=a.x),this.height===null&&(r=a.y)}return new e.Point(n,r)},_getBoundingBox:function(i,n){var r=this._getPlacementPoint(i);return i.rotate(n,r).getBoundingBox()},_getPlacementPoint:function(i){var n=new e.Point(i.x,i.y),r=e.Placement.properties[this.placement];return r&&(r.isHorizontallyCentered?n.x+=i.width/2:r.isRight&&(n.x+=i.width),r.isVerticallyCentered?n.y+=i.height/2:r.isBottom&&(n.y+=i.height)),n},_getTransformOrigin:function(){var i="",n=e.Placement.properties[this.placement];return n&&(n.isLeft?i="left":n.isRight&&(i="right"),n.isTop?i+=" top":n.isBottom&&(i+=" bottom")),i},update:function(i,n){var r=e.isPlainObject(i)?i:{location:i,placement:n};this._init({location:r.location||this.location,placement:r.placement!==void 0?r.placement:this.placement,onDraw:r.onDraw||this.onDraw,checkResize:r.checkResize||this.checkResize,width:r.width!==void 0?r.width:this.width,height:r.height!==void 0?r.height:this.height,rotationMode:r.rotationMode||this.rotationMode})},getBounds:function(i){e.console.assert(i,"A viewport must now be passed to Overlay.getBounds.");var n=this.width,r=this.height;if(n===null||r===null){var l=i.deltaPointsFromPixelsNoRotate(this.size,!0);n===null&&(n=l.x),r===null&&(r=l.y)}var a=this.location.clone();return this.adjust(a,new e.Point(n,r)),this._adjustBoundsForRotation(i,new e.Rect(a.x,a.y,n,r))},_adjustBoundsForRotation:function(i,n){if(!i||i.degrees===0||this.rotationMode===e.OverlayRotationMode.EXACT)return n;if(this.rotationMode===e.OverlayRotationMode.BOUNDING_BOX){if(this.width===null||this.height===null)return n;var r=this._getOverlayPositionAndSize(i);return i.viewerElementToViewportRectangle(new e.Rect(r.position.x,r.position.y,r.size.x,r.size.y))}return n.rotate(-i.degrees,this._getPlacementPoint(n))}}}(s),function(e){e.Drawer=function(i){e.console.assert(i.viewer,"[Drawer] options.viewer is required");var n=arguments;if(e.isPlainObject(i)||(i={source:n[0],viewport:n[1],element:n[2]}),e.console.assert(i.viewport,"[Drawer] options.viewport is required"),e.console.assert(i.element,"[Drawer] options.element is required"),i.source&&e.console.error("[Drawer] options.source is no longer accepted; use TiledImage instead"),this.viewer=i.viewer,this.viewport=i.viewport,this.debugGridColor=typeof i.debugGridColor=="string"?[i.debugGridColor]:i.debugGridColor||e.DEFAULT_SETTINGS.debugGridColor,i.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(i.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 r=this._calculateCanvasSize();this.canvas.width=r.x,this.canvas.height=r.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(i,n,r,l){return e.console.error("drawer.addOverlay is deprecated. Use viewer.addOverlay instead."),this.viewer.addOverlay(i,n,r,l),this},updateOverlay:function(i,n,r){return e.console.error("drawer.updateOverlay is deprecated. Use viewer.updateOverlay instead."),this.viewer.updateOverlay(i,n,r),this},removeOverlay:function(i){return e.console.error("drawer.removeOverlay is deprecated. Use viewer.removeOverlay instead."),this.viewer.removeOverlay(i),this},clearOverlays:function(){return e.console.error("drawer.clearOverlays is deprecated. Use viewer.clearOverlays instead."),this.viewer.clearOverlays(),this},viewportCoordToDrawerCoord:function(i){var n=this.viewport.pixelFromPointNoRotate(i,!0);return new e.Point(n.x*e.pixelDensityRatio,n.y*e.pixelDensityRatio)},clipWithPolygons:function(i,n){if(this.useCanvas){var r=this._getContext(n);r.beginPath(),i.forEach(function(l){l.forEach(function(a,o){r[o===0?"moveTo":"lineTo"](a.x,a.y)})}),r.clip()}},setOpacity:function(i){e.console.error("drawer.setOpacity is deprecated. Use tiledImage.setOpacity instead.");for(var n=this.viewer.world,r=0;rn&&(n=l)}return n},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 i=this._calculateCanvasSize();if((this.canvas.width!==i.x||this.canvas.height!==i.y)&&(this.canvas.width=i.x,this.canvas.height=i.y,this._updateImageSmoothingEnabled(this.context),this.sketchCanvas!==null)){var n=this._calculateSketchCanvasSize();this.sketchCanvas.width=n.x,this.sketchCanvas.height=n.y,this._updateImageSmoothingEnabled(this.sketchContext)}this._clear()}},_clear:function(i,n){if(this.useCanvas){var r=this._getContext(i);if(n)r.clearRect(n.x,n.y,n.width,n.height);else{var l=r.canvas;r.clearRect(0,0,l.width,l.height)}}},viewportToDrawerRectangle:function(i){var n=this.viewport.pixelFromPointNoRotate(i.getTopLeft(),!0),r=this.viewport.deltaPixelsFromPointsNoRotate(i.getSize(),!0);return new e.Rect(n.x*e.pixelDensityRatio,n.y*e.pixelDensityRatio,r.x*e.pixelDensityRatio,r.y*e.pixelDensityRatio)},drawTile:function(i,n,r,l,a){if(e.console.assert(i,"[Drawer.drawTile] tile is required"),e.console.assert(n,"[Drawer.drawTile] drawingHandler is required"),this.useCanvas){var o=this._getContext(r);l=l||1,i.drawCanvas(o,n,l,a)}else i.drawHTML(this.canvas)},_getContext:function(i){var n=this.context;if(i){if(this.sketchCanvas===null){this.sketchCanvas=document.createElement("canvas");var r=this._calculateSketchCanvasSize();if(this.sketchCanvas.width=r.x,this.sketchCanvas.height=r.y,this.sketchContext=this.sketchCanvas.getContext("2d"),this.viewport.getRotation()===0){var l=this;this.viewer.addHandler("rotate",function a(){if(l.viewport.getRotation()!==0){l.viewer.removeHandler("rotate",a);var o=l._calculateSketchCanvasSize();l.sketchCanvas.width=o.x,l.sketchCanvas.height=o.y}})}this._updateImageSmoothingEnabled(this.sketchContext)}n=this.sketchContext}return n},saveContext:function(i){this.useCanvas&&this._getContext(i).save()},restoreContext:function(i){this.useCanvas&&this._getContext(i).restore()},setClip:function(i,n){if(this.useCanvas){var r=this._getContext(n);r.beginPath(),r.rect(i.x,i.y,i.width,i.height),r.clip()}},drawRectangle:function(i,n,r){if(this.useCanvas){var l=this._getContext(r);l.save(),l.fillStyle=n,l.fillRect(i.x,i.y,i.width,i.height),l.restore()}},blendSketch:function(i,n,r,l){var a=i;if(e.isPlainObject(a)||(a={opacity:i,scale:n,translate:r,compositeOperation:l}),!(!this.useCanvas||!this.sketchCanvas)){i=a.opacity,l=a.compositeOperation;var o=a.bounds;if(this.context.save(),this.context.globalAlpha=i,l&&(this.context.globalCompositeOperation=l),o)o.x<0&&(o.width+=o.x,o.x=0),o.x+o.width>this.canvas.width&&(o.width=this.canvas.width-o.x),o.y<0&&(o.height+=o.y,o.y=0),o.y+o.height>this.canvas.height&&(o.height=this.canvas.height-o.y),this.context.drawImage(this.sketchCanvas,o.x,o.y,o.width,o.height,o.x,o.y,o.width,o.height);else{n=a.scale||1,r=a.translate;var u=r instanceof e.Point?r:new e.Point(0,0),h=0,g=0;if(r){var m=this.sketchCanvas.width-this.canvas.width,T=this.sketchCanvas.height-this.canvas.height;h=Math.round(m/2),g=Math.round(T/2)}this.context.drawImage(this.sketchCanvas,u.x-h*n,u.y-g*n,(this.canvas.width+2*h)*n,(this.canvas.height+2*g)*n,-h,-g,this.canvas.width+2*h,this.canvas.height+2*g)}this.context.restore()}},drawDebugInfo:function(i,n,r,l){if(this.useCanvas){var a=this.viewer.world.getIndexOfItem(l)%this.debugGridColor.length,o=this.context;o.save(),o.lineWidth=2*e.pixelDensityRatio,o.font="small-caps bold "+13*e.pixelDensityRatio+"px arial",o.strokeStyle=this.debugGridColor[a],o.fillStyle=this.debugGridColor[a],this.viewport.degrees!==0&&this._offsetForRotation({degrees:this.viewport.degrees}),l.getRotation(!0)%360!==0&&this._offsetForRotation({degrees:l.getRotation(!0),point:l.viewport.pixelFromPointNoRotate(l._getRotationPoint(!0),!0)}),l.viewport.degrees===0&&l.getRotation(!0)%360===0&&l._drawer.viewer.viewport.getFlip()&&l._drawer._flip(),o.strokeRect(i.position.x*e.pixelDensityRatio,i.position.y*e.pixelDensityRatio,i.size.x*e.pixelDensityRatio,i.size.y*e.pixelDensityRatio);var u=(i.position.x+i.size.x/2)*e.pixelDensityRatio,h=(i.position.y+i.size.y/2)*e.pixelDensityRatio;o.translate(u,h),o.rotate(Math.PI/180*-this.viewport.degrees),o.translate(-u,-h),i.x===0&&i.y===0&&(o.fillText("Zoom: "+this.viewport.getZoom(),i.position.x*e.pixelDensityRatio,(i.position.y-30)*e.pixelDensityRatio),o.fillText("Pan: "+this.viewport.getBounds().toString(),i.position.x*e.pixelDensityRatio,(i.position.y-20)*e.pixelDensityRatio)),o.fillText("Level: "+i.level,(i.position.x+10)*e.pixelDensityRatio,(i.position.y+20)*e.pixelDensityRatio),o.fillText("Column: "+i.x,(i.position.x+10)*e.pixelDensityRatio,(i.position.y+30)*e.pixelDensityRatio),o.fillText("Row: "+i.y,(i.position.x+10)*e.pixelDensityRatio,(i.position.y+40)*e.pixelDensityRatio),o.fillText("Order: "+r+" of "+n,(i.position.x+10)*e.pixelDensityRatio,(i.position.y+50)*e.pixelDensityRatio),o.fillText("Size: "+i.size.toString(),(i.position.x+10)*e.pixelDensityRatio,(i.position.y+60)*e.pixelDensityRatio),o.fillText("Position: "+i.position.toString(),(i.position.x+10)*e.pixelDensityRatio,(i.position.y+70)*e.pixelDensityRatio),this.viewport.degrees!==0&&this._restoreRotationChanges(),l.getRotation(!0)%360!==0&&this._restoreRotationChanges(),l.viewport.degrees===0&&l.getRotation(!0)%360===0&&l._drawer.viewer.viewport.getFlip()&&l._drawer._flip(),o.restore()}},debugRect:function(i){if(this.useCanvas){var n=this.context;n.save(),n.lineWidth=2*e.pixelDensityRatio,n.strokeStyle=this.debugGridColor[0],n.fillStyle=this.debugGridColor[0],n.strokeRect(i.x*e.pixelDensityRatio,i.y*e.pixelDensityRatio,i.width*e.pixelDensityRatio,i.height*e.pixelDensityRatio),n.restore()}},setImageSmoothingEnabled:function(i){this.useCanvas&&(this._imageSmoothingEnabled=i,this._updateImageSmoothingEnabled(this.context),this.viewer.forceRedraw())},_updateImageSmoothingEnabled:function(i){i.msImageSmoothingEnabled=this._imageSmoothingEnabled,i.imageSmoothingEnabled=this._imageSmoothingEnabled},getCanvasSize:function(i){var n=this._getContext(i).canvas;return new e.Point(n.width,n.height)},getCanvasCenter:function(){return new e.Point(this.canvas.width/2,this.canvas.height/2)},_offsetForRotation:function(i){var n=i.point?i.point.times(e.pixelDensityRatio):this.getCanvasCenter(),r=this._getContext(i.useSketch);r.save(),r.translate(n.x,n.y),this.viewer.viewport.flipped?(r.rotate(Math.PI/180*-i.degrees),r.scale(-1,1)):r.rotate(Math.PI/180*i.degrees),r.translate(-n.x,-n.y)},_flip:function(i){i=i||{};var n=i.point?i.point.times(e.pixelDensityRatio):this.getCanvasCenter(),r=this._getContext(i.useSketch);r.translate(n.x,0),r.scale(-1,1),r.translate(-n.x,0)},_restoreRotationChanges:function(i){var n=this._getContext(i);n.restore()},_calculateCanvasSize:function(){var i=e.pixelDensityRatio,n=this.viewport.getContainerSize();return{x:Math.round(n.x*i),y:Math.round(n.y*i)}},_calculateSketchCanvasSize:function(){var i=this._calculateCanvasSize();if(this.viewport.getRotation()===0)return i;var n=Math.ceil(Math.sqrt(i.x*i.x+i.y*i.y));return{x:n,y:n}}}}(s),function(e){e.Viewport=function(i){var n=arguments;n.length&&n[0]instanceof e.Point&&(i={containerSize:n[0],contentSize:n[1],config:n[2]}),i.config&&(e.extend(!0,i,i.config),delete i.config),this._margins=e.extend({left:0,top:0,right:0,bottom:0},i.margins||{}),delete i.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},i),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(i){return e.console.assert(i,"[Viewport.resetContentSize] contentSize is required"),e.console.assert(i instanceof e.Point,"[Viewport.resetContentSize] contentSize must be an OpenSeadragon.Point"),e.console.assert(i.x>0,"[Viewport.resetContentSize] contentSize.x must be greater than 0"),e.console.assert(i.y>0,"[Viewport.resetContentSize] contentSize.y must be greater than 0"),this._setContentBounds(new e.Rect(0,0,1,i.y/i.x),i.x),this},setHomeBounds:function(i,n){e.console.error("[Viewport.setHomeBounds] this function is deprecated; The content bounds should not be set manually."),this._setContentBounds(i,n)},_setContentBounds:function(i,n){e.console.assert(i,"[Viewport._setContentBounds] bounds is required"),e.console.assert(i instanceof e.Rect,"[Viewport._setContentBounds] bounds must be an OpenSeadragon.Rect"),e.console.assert(i.width>0,"[Viewport._setContentBounds] bounds.width must be greater than 0"),e.console.assert(i.height>0,"[Viewport._setContentBounds] bounds.height must be greater than 0"),this._contentBoundsNoRotate=i.clone(),this._contentSizeNoRotate=this._contentBoundsNoRotate.getSize().times(n),this._contentBounds=i.rotate(this.degrees).getBoundingBox(),this._contentSize=this._contentBounds.getSize().times(n),this._contentAspectRatio=this._contentSize.x/this._contentSize.y,this.viewer&&this.viewer.raiseEvent("reset-size",{contentSize:this._contentSizeNoRotate.clone(),contentFactor:n,homeBounds:this._contentBoundsNoRotate.clone(),contentBounds:this._contentBounds.clone()})},getHomeZoom:function(){if(this.defaultZoomLevel)return this.defaultZoomLevel;var i=this._contentAspectRatio/this.getAspectRatio(),n;return this.homeFillsViewer?n=i>=1?i:1:n=i>=1?1:i,n/this._contentBounds.width},getHomeBounds:function(){return this.getHomeBoundsNoRotate().rotate(-this.getRotation())},getHomeBoundsNoRotate:function(){var i=this._contentBounds.getCenter(),n=1/this.getHomeZoom(),r=n/this.getAspectRatio();return new e.Rect(i.x-n/2,i.y-r/2,n,r)},goHome:function(i){return this.viewer&&this.viewer.raiseEvent("home",{immediately:i}),this.fitBounds(this.getHomeBounds(),i)},getMinZoom:function(){var i=this.getHomeZoom(),n=this.minZoomLevel?this.minZoomLevel:this.minZoomImageRatio*i;return n},getMaxZoom:function(){var i=this.maxZoomLevel;return i||(i=this._contentSize.x*this.maxZoomPixelRatio/this._containerInnerSize.x,i/=this._contentBounds.width),Math.max(i,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(i){e.console.assert(e.type(i)==="object","[Viewport.setMargins] margins must be an object"),this._margins=e.extend({left:0,top:0,right:0,bottom:0},i),this._updateContainerInnerSize(),this.viewer&&this.viewer.forceRedraw()},getBounds:function(i){return this.getBoundsNoRotate(i).rotate(-this.getRotation())},getBoundsNoRotate:function(i){var n=this.getCenter(i),r=1/this.getZoom(i),l=r/this.getAspectRatio();return new e.Rect(n.x-r/2,n.y-l/2,r,l)},getBoundsWithMargins:function(i){return this.getBoundsNoRotateWithMargins(i).rotate(-this.getRotation(),this.getCenter(i))},getBoundsNoRotateWithMargins:function(i){var n=this.getBoundsNoRotate(i),r=this._containerInnerSize.x*this.getZoom(i);return n.x-=this._margins.left/r,n.y-=this._margins.top/r,n.width+=(this._margins.left+this._margins.right)/r,n.height+=(this._margins.top+this._margins.bottom)/r,n},getCenter:function(i){var n=new e.Point(this.centerSpringX.current.value,this.centerSpringY.current.value),r=new e.Point(this.centerSpringX.target.value,this.centerSpringY.target.value),l,a,o,u,h,g,m,T;return i?n:this.zoomPoint?(l=this.pixelFromPoint(this.zoomPoint,!0),a=this.getZoom(),o=1/a,u=o/this.getAspectRatio(),h=new e.Rect(n.x-o/2,n.y-u/2,o,u),g=this._pixelFromPoint(this.zoomPoint,h),m=g.minus(l),T=m.divide(this._containerInnerSize.x*a),r.plus(T)):r},getZoom:function(i){return i?this.zoomSpring.current.value:this.zoomSpring.target.value},_applyZoomConstraints:function(i){return Math.max(Math.min(i,this.getMaxZoom()),this.getMinZoom())},_applyBoundaryConstraints:function(i){var n=new e.Rect(i.x,i.y,i.width,i.height);if(!this.wrapHorizontal){var r=this.visibilityRatio*n.width,l=n.x+n.width,a=this._contentBoundsNoRotate.x+this._contentBoundsNoRotate.width,o=this._contentBoundsNoRotate.x-l+r,u=a-n.x-r;r>this._contentBoundsNoRotate.width?n.x+=(o+u)/2:u<0?n.x+=u:o>0&&(n.x+=o)}if(!this.wrapVertical){var h=this.visibilityRatio*n.height,g=n.y+n.height,m=this._contentBoundsNoRotate.y+this._contentBoundsNoRotate.height,T=this._contentBoundsNoRotate.y-g+h,x=m-n.y-h;h>this._contentBoundsNoRotate.height?n.y+=(T+x)/2:x<0?n.y+=x:T>0&&(n.y+=T)}return n},_raiseConstraintsEvent:function(i){this.viewer&&this.viewer.raiseEvent("constrain",{immediately:i})},applyConstraints:function(i){var n=this.getZoom(),r=this._applyZoomConstraints(n);n!==r&&this.zoomTo(r,this.zoomPoint,i);var l=this.getBoundsNoRotate(),a=this._applyBoundaryConstraints(l);return this._raiseConstraintsEvent(i),(l.x!==a.x||l.y!==a.y||i)&&this.fitBounds(a.rotate(-this.getRotation()),i),this},ensureVisible:function(i){return this.applyConstraints(i)},_fitBounds:function(i,n){n=n||{};var r=n.immediately||!1,l=n.constraints||!1,a=this.getAspectRatio(),o=i.getCenter(),u=new e.Rect(i.x,i.y,i.width,i.height,i.degrees+this.getRotation()).getBoundingBox();u.getAspectRatio()>=a?u.height=u.width/a:u.width=u.height*a,u.x=o.x-u.width/2,u.y=o.y-u.height/2;var h=1/u.width;if(l){var g=u.getAspectRatio(),m=this._applyZoomConstraints(h);h!==m&&(h=m,u.width=1/h,u.x=o.x-u.width/2,u.height=u.width/g,u.y=o.y-u.height/2),u=this._applyBoundaryConstraints(u),o=u.getCenter(),this._raiseConstraintsEvent(r)}if(r)return this.panTo(o,!0),this.zoomTo(h,null,!0);this.panTo(this.getCenter(!0),!0),this.zoomTo(this.getZoom(!0),null,!0);var T=this.getBounds(),x=this.getZoom();if(x===0||Math.abs(h/x-1)<1e-8)return this.zoomTo(h,!0),this.panTo(o,r);u=u.rotate(-this.getRotation());var P=u.getTopLeft().times(h).minus(T.getTopLeft().times(x)).divide(h-x);return this.zoomTo(h,P,r)},fitBounds:function(i,n){return this._fitBounds(i,{immediately:n,constraints:!1})},fitBoundsWithConstraints:function(i,n){return this._fitBounds(i,{immediately:n,constraints:!0})},fitVertically:function(i){var n=new e.Rect(this._contentBounds.x+this._contentBounds.width/2,this._contentBounds.y,0,this._contentBounds.height);return this.fitBounds(n,i)},fitHorizontally:function(i){var n=new e.Rect(this._contentBounds.x,this._contentBounds.y+this._contentBounds.height/2,this._contentBounds.width,0);return this.fitBounds(n,i)},getConstrainedBounds:function(i){var n,r;return n=this.getBounds(i),r=this._applyBoundaryConstraints(n),r},panBy:function(i,n){var r=new e.Point(this.centerSpringX.target.value,this.centerSpringY.target.value);return this.panTo(r.plus(i),n)},panTo:function(i,n){return n?(this.centerSpringX.resetTo(i.x),this.centerSpringY.resetTo(i.y)):(this.centerSpringX.springTo(i.x),this.centerSpringY.springTo(i.y)),this.viewer&&this.viewer.raiseEvent("pan",{center:i,immediately:n}),this},zoomBy:function(i,n,r){return this.zoomTo(this.zoomSpring.target.value*i,n,r)},zoomTo:function(i,n,r){var l=this;return this.zoomPoint=n instanceof e.Point&&!isNaN(n.x)&&!isNaN(n.y)?n:null,r?this._adjustCenterSpringsForZoomPoint(function(){l.zoomSpring.resetTo(i)}):this.zoomSpring.springTo(i),this.viewer&&this.viewer.raiseEvent("zoom",{zoom:i,refPoint:n,immediately:r}),this},setRotation:function(i){return!this.viewer||!this.viewer.drawer.canRotate()?this:(this.degrees=e.positiveModulo(i,360),this._setContentBounds(this.viewer.world.getHomeBounds(),this.viewer.world.getContentFactor()),this.viewer.forceRedraw(),this.viewer.raiseEvent("rotate",{degrees:i}),this)},getRotation:function(){return this.degrees},resize:function(i,n){var r=this.getBoundsNoRotate(),l=r,a;return this.containerSize.x=i.x,this.containerSize.y=i.y,this._updateContainerInnerSize(),n&&(a=i.x/this.containerSize.x,l.width=r.width*a,l.height=l.width/this.getAspectRatio()),this.viewer&&this.viewer.raiseEvent("resize",{newContainerSize:i,maintain:n}),this.fitBounds(l,!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 i=this;this._adjustCenterSpringsForZoomPoint(function(){i.zoomSpring.update()}),this.centerSpringX.update(),this.centerSpringY.update();var n=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,n},_adjustCenterSpringsForZoomPoint:function(i){if(this.zoomPoint){var n=this.pixelFromPoint(this.zoomPoint,!0);i();var r=this.pixelFromPoint(this.zoomPoint,!0),l=r.minus(n),a=this.deltaPointsFromPixels(l,!0);this.centerSpringX.shiftBy(a.x),this.centerSpringY.shiftBy(a.y),this.zoomSpring.isAtTargetValue()&&(this.zoomPoint=null)}else i()},deltaPixelsFromPointsNoRotate:function(i,n){return i.times(this._containerInnerSize.x*this.getZoom(n))},deltaPixelsFromPoints:function(i,n){return this.deltaPixelsFromPointsNoRotate(i.rotate(this.getRotation()),n)},deltaPointsFromPixelsNoRotate:function(i,n){return i.divide(this._containerInnerSize.x*this.getZoom(n))},deltaPointsFromPixels:function(i,n){return this.deltaPointsFromPixelsNoRotate(i,n).rotate(-this.getRotation())},pixelFromPointNoRotate:function(i,n){return this._pixelFromPointNoRotate(i,this.getBoundsNoRotate(n))},pixelFromPoint:function(i,n){return this._pixelFromPoint(i,this.getBoundsNoRotate(n))},_pixelFromPointNoRotate:function(i,n){return i.minus(n.getTopLeft()).times(this._containerInnerSize.x/n.width).plus(new e.Point(this._margins.left,this._margins.top))},_pixelFromPoint:function(i,n){return this._pixelFromPointNoRotate(i.rotate(this.getRotation(),this.getCenter(!0)),n)},pointFromPixelNoRotate:function(i,n){var r=this.getBoundsNoRotate(n);return i.minus(new e.Point(this._margins.left,this._margins.top)).divide(this._containerInnerSize.x/r.width).plus(r.getTopLeft())},pointFromPixel:function(i,n){return this.pointFromPixelNoRotate(i,n).rotate(-this.getRotation(),this.getCenter(!0))},_viewportToImageDelta:function(i,n){var r=this._contentBoundsNoRotate.width;return new e.Point(i*this._contentSizeNoRotate.x/r,n*this._contentSizeNoRotate.x/r)},viewportToImageCoordinates:function(i,n){if(i instanceof e.Point)return this.viewportToImageCoordinates(i.x,i.y);if(this.viewer){var r=this.viewer.world.getItemCount();if(r>1)e.console.error("[Viewport.viewportToImageCoordinates] is not accurate with multi-image; use TiledImage.viewportToImageCoordinates instead.");else if(r===1){var l=this.viewer.world.getItemAt(0);return l.viewportToImageCoordinates(i,n,!0)}}return this._viewportToImageDelta(i-this._contentBoundsNoRotate.x,n-this._contentBoundsNoRotate.y)},_imageToViewportDelta:function(i,n){var r=this._contentBoundsNoRotate.width;return new e.Point(i/this._contentSizeNoRotate.x*r,n/this._contentSizeNoRotate.x*r)},imageToViewportCoordinates:function(i,n){if(i instanceof e.Point)return this.imageToViewportCoordinates(i.x,i.y);if(this.viewer){var r=this.viewer.world.getItemCount();if(r>1)e.console.error("[Viewport.imageToViewportCoordinates] is not accurate with multi-image; use TiledImage.imageToViewportCoordinates instead.");else if(r===1){var l=this.viewer.world.getItemAt(0);return l.imageToViewportCoordinates(i,n,!0)}}var a=this._imageToViewportDelta(i,n);return a.x+=this._contentBoundsNoRotate.x,a.y+=this._contentBoundsNoRotate.y,a},imageToViewportRectangle:function(i,n,r,l){var a=i;if(a instanceof e.Rect||(a=new e.Rect(i,n,r,l)),this.viewer){var o=this.viewer.world.getItemCount();if(o>1)e.console.error("[Viewport.imageToViewportRectangle] is not accurate with multi-image; use TiledImage.imageToViewportRectangle instead.");else if(o===1){var u=this.viewer.world.getItemAt(0);return u.imageToViewportRectangle(i,n,r,l,!0)}}var h=this.imageToViewportCoordinates(a.x,a.y),g=this._imageToViewportDelta(a.width,a.height);return new e.Rect(h.x,h.y,g.x,g.y,a.degrees)},viewportToImageRectangle:function(i,n,r,l){var a=i;if(a instanceof e.Rect||(a=new e.Rect(i,n,r,l)),this.viewer){var o=this.viewer.world.getItemCount();if(o>1)e.console.error("[Viewport.viewportToImageRectangle] is not accurate with multi-image; use TiledImage.viewportToImageRectangle instead.");else if(o===1){var u=this.viewer.world.getItemAt(0);return u.viewportToImageRectangle(i,n,r,l,!0)}}var h=this.viewportToImageCoordinates(a.x,a.y),g=this._viewportToImageDelta(a.width,a.height);return new e.Rect(h.x,h.y,g.x,g.y,a.degrees)},viewerElementToImageCoordinates:function(i){var n=this.pointFromPixel(i,!0);return this.viewportToImageCoordinates(n)},imageToViewerElementCoordinates:function(i){var n=this.imageToViewportCoordinates(i);return this.pixelFromPoint(n,!0)},windowToImageCoordinates:function(i){e.console.assert(this.viewer,"[Viewport.windowToImageCoordinates] the viewport must have a viewer.");var n=i.minus(e.getElementPosition(this.viewer.element));return this.viewerElementToImageCoordinates(n)},imageToWindowCoordinates:function(i){e.console.assert(this.viewer,"[Viewport.imageToWindowCoordinates] the viewport must have a viewer.");var n=this.imageToViewerElementCoordinates(i);return n.plus(e.getElementPosition(this.viewer.element))},viewerElementToViewportCoordinates:function(i){return this.pointFromPixel(i,!0)},viewportToViewerElementCoordinates:function(i){return this.pixelFromPoint(i,!0)},viewerElementToViewportRectangle:function(i){return e.Rect.fromSummits(this.pointFromPixel(i.getTopLeft(),!0),this.pointFromPixel(i.getTopRight(),!0),this.pointFromPixel(i.getBottomLeft(),!0))},viewportToViewerElementRectangle:function(i){return e.Rect.fromSummits(this.pixelFromPoint(i.getTopLeft(),!0),this.pixelFromPoint(i.getTopRight(),!0),this.pixelFromPoint(i.getBottomLeft(),!0))},windowToViewportCoordinates:function(i){e.console.assert(this.viewer,"[Viewport.windowToViewportCoordinates] the viewport must have a viewer.");var n=i.minus(e.getElementPosition(this.viewer.element));return this.viewerElementToViewportCoordinates(n)},viewportToWindowCoordinates:function(i){e.console.assert(this.viewer,"[Viewport.viewportToWindowCoordinates] the viewport must have a viewer.");var n=this.viewportToViewerElementCoordinates(i);return n.plus(e.getElementPosition(this.viewer.element))},viewportToImageZoom:function(i){if(this.viewer){var n=this.viewer.world.getItemCount();if(n>1)e.console.error("[Viewport.viewportToImageZoom] is not accurate with multi-image.");else if(n===1){var r=this.viewer.world.getItemAt(0);return r.viewportToImageZoom(i)}}var l=this._contentSizeNoRotate.x,a=this._containerInnerSize.x,o=this._contentBoundsNoRotate.width,u=a/l*o;return i*u},imageToViewportZoom:function(i){if(this.viewer){var n=this.viewer.world.getItemCount();if(n>1)e.console.error("[Viewport.imageToViewportZoom] is not accurate with multi-image.");else if(n===1){var r=this.viewer.world.getItemAt(0);return r.imageToViewportZoom(i)}}var l=this._contentSizeNoRotate.x,a=this._containerInnerSize.x,o=this._contentBoundsNoRotate.width,u=l/a/o;return i*u},toggleFlip:function(){return this.setFlip(!this.getFlip()),this},getFlip:function(){return this.flipped},setFlip:function(i){return this.flipped===i?this:(this.flipped=i,this.viewer.navigator&&this.viewer.navigator.setFlip(this.getFlip()),this.viewer.forceRedraw(),this.viewer.raiseEvent("flip",{flipped:i}),this)}}}(s),function(e){e.TiledImage=function(d){var _=this;e.console.assert(d.tileCache,"[TiledImage] options.tileCache is required"),e.console.assert(d.drawer,"[TiledImage] options.drawer is required"),e.console.assert(d.viewer,"[TiledImage] options.viewer is required"),e.console.assert(d.imageLoader,"[TiledImage] options.imageLoader is required"),e.console.assert(d.source,"[TiledImage] options.source is required"),e.console.assert(!d.clip||d.clip instanceof e.Rect,"[TiledImage] options.clip must be an OpenSeadragon.Rect if present"),e.EventSource.call(this),this._tileCache=d.tileCache,delete d.tileCache,this._drawer=d.drawer,delete d.drawer,this._imageLoader=d.imageLoader,delete d.imageLoader,d.clip instanceof e.Rect&&(this._clip=d.clip.clone()),delete d.clip;var S=d.x||0;delete d.x;var M=d.y||0;delete d.y,this.normHeight=d.source.dimensions.y/d.source.dimensions.x,this.contentAspectX=d.source.dimensions.x/d.source.dimensions.y;var I=1;d.width?(I=d.width,delete d.width,d.height&&(e.console.error("specifying both width and height to a tiledImage is not supported"),delete d.height)):d.height&&(I=d.height/this.normHeight,delete d.height);var V=d.fitBounds;delete d.fitBounds;var j=d.fitBoundsPlacement||s.Placement.CENTER;delete d.fitBoundsPlacement;var q=d.degrees||0;delete d.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},d),this._preload=this.preload,delete this.preload,this._fullyLoaded=!1,this._xSpring=new e.Spring({initial:S,springStiffness:this.springStiffness,animationTime:this.animationTime}),this._ySpring=new e.Spring({initial:M,springStiffness:this.springStiffness,animationTime:this.animationTime}),this._scaleSpring=new e.Spring({initial:I,springStiffness:this.springStiffness,animationTime:this.animationTime}),this._degreesSpring=new e.Spring({initial:q,springStiffness:this.springStiffness,animationTime:this.animationTime}),this._updateForScale(),V&&this.fitBounds(V,j,!0),this._drawingHandler=function(K){_.viewer.raiseEvent("tile-drawing",e.extend({tiledImage:_},K))}},e.extend(e.TiledImage.prototype,e.EventSource.prototype,{needsDraw:function(){return this._needsDraw},getFullyLoaded:function(){return this._fullyLoaded},_setFullyLoaded:function(d){d!==this._fullyLoaded&&(this._fullyLoaded=d,this.raiseEvent("fully-loaded-change",{fullyLoaded:this._fullyLoaded}))},reset:function(){this._tileCache.clearTilesFor(this),this.lastResetTime=e.now(),this._needsDraw=!0},update:function(){var d=this._xSpring.update(),_=this._ySpring.update(),S=this._scaleSpring.update(),M=this._degreesSpring.update();return d||_||S||M?(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(d){return this.getBoundsNoRotate(d).rotate(this.getRotation(d),this._getRotationPoint(d))},getBoundsNoRotate:function(d){return d?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(d){var _=this.getBoundsNoRotate(d);if(this._clip){var S=d?this._worldWidthCurrent:this._worldWidthTarget,M=S/this.source.dimensions.x,I=this._clip.times(M);_=new e.Rect(_.x+I.x,_.y+I.y,I.width,I.height)}return _.rotate(this.getRotation(d),this._getRotationPoint(d))},getTileBounds:function(d,_,S){var M=this.source.getNumTiles(d),I=(M.x+_%M.x)%M.x,V=(M.y+S%M.y)%M.y,j=this.source.getTileBounds(d,I,V);return this.getFlip()&&(j.x=1-j.x-j.width),j.x+=(_-I)/M.x,j.y+=this._worldHeightCurrent/this._worldWidthCurrent*((S-V)/M.y),j},getContentSize:function(){return new e.Point(this.source.dimensions.x,this.source.dimensions.y)},getSizeInWindowCoordinates:function(){var d=this.imageToWindowCoordinates(new e.Point(0,0)),_=this.imageToWindowCoordinates(this.getContentSize());return new e.Point(_.x-d.x,_.y-d.y)},_viewportToImageDelta:function(d,_,S){var M=S?this._scaleSpring.current.value:this._scaleSpring.target.value;return new e.Point(d*(this.source.dimensions.x/M),_*(this.source.dimensions.y*this.contentAspectX/M))},viewportToImageCoordinates:function(d,_,S){var M;return d instanceof e.Point?(S=_,M=d):M=new e.Point(d,_),M=M.rotate(-this.getRotation(S),this._getRotationPoint(S)),S?this._viewportToImageDelta(M.x-this._xSpring.current.value,M.y-this._ySpring.current.value):this._viewportToImageDelta(M.x-this._xSpring.target.value,M.y-this._ySpring.target.value)},_imageToViewportDelta:function(d,_,S){var M=S?this._scaleSpring.current.value:this._scaleSpring.target.value;return new e.Point(d/this.source.dimensions.x*M,_/this.source.dimensions.y/this.contentAspectX*M)},imageToViewportCoordinates:function(d,_,S){d instanceof e.Point&&(S=_,_=d.y,d=d.x);var M=this._imageToViewportDelta(d,_);return S?(M.x+=this._xSpring.current.value,M.y+=this._ySpring.current.value):(M.x+=this._xSpring.target.value,M.y+=this._ySpring.target.value),M.rotate(this.getRotation(S),this._getRotationPoint(S))},imageToViewportRectangle:function(d,_,S,M,I){var V=d;V instanceof e.Rect?I=_:V=new e.Rect(d,_,S,M);var j=this.imageToViewportCoordinates(V.getTopLeft(),I),q=this._imageToViewportDelta(V.width,V.height,I);return new e.Rect(j.x,j.y,q.x,q.y,V.degrees+this.getRotation(I))},viewportToImageRectangle:function(d,_,S,M,I){var V=d;d instanceof e.Rect?I=_:V=new e.Rect(d,_,S,M);var j=this.viewportToImageCoordinates(V.getTopLeft(),I),q=this._viewportToImageDelta(V.width,V.height,I);return new e.Rect(j.x,j.y,q.x,q.y,V.degrees-this.getRotation(I))},viewerElementToImageCoordinates:function(d){var _=this.viewport.pointFromPixel(d,!0);return this.viewportToImageCoordinates(_)},imageToViewerElementCoordinates:function(d){var _=this.imageToViewportCoordinates(d);return this.viewport.pixelFromPoint(_,!0)},windowToImageCoordinates:function(d){var _=d.minus(s.getElementPosition(this.viewer.element));return this.viewerElementToImageCoordinates(_)},imageToWindowCoordinates:function(d){var _=this.imageToViewerElementCoordinates(d);return _.plus(s.getElementPosition(this.viewer.element))},_viewportToTiledImageRectangle:function(d){var _=this._scaleSpring.current.value;return d=d.rotate(-this.getRotation(!0),this._getRotationPoint(!0)),new e.Rect((d.x-this._xSpring.current.value)/_,(d.y-this._ySpring.current.value)/_,d.width/_,d.height/_,d.degrees)},viewportToImageZoom:function(d){var _=this._scaleSpring.current.value*this.viewport._containerInnerSize.x/this.source.dimensions.x;return _*d},imageToViewportZoom:function(d){var _=this._scaleSpring.current.value*this.viewport._containerInnerSize.x/this.source.dimensions.x;return d/_},setPosition:function(d,_){var S=this._xSpring.target.value===d.x&&this._ySpring.target.value===d.y;if(_){if(S&&this._xSpring.current.value===d.x&&this._ySpring.current.value===d.y)return;this._xSpring.resetTo(d.x),this._ySpring.resetTo(d.y),this._needsDraw=!0}else{if(S)return;this._xSpring.springTo(d.x),this._ySpring.springTo(d.y),this._needsDraw=!0}S||this._raiseBoundsChange()},setWidth:function(d,_){this._setScale(d,_)},setHeight:function(d,_){this._setScale(d/this.normHeight,_)},setCroppingPolygons:function(d){var _=function(M){return M instanceof e.Point||typeof M.x=="number"&&typeof M.y=="number"},S=function(M){return M.map(function(I){try{if(_(I))return{x:I.x,y:I.y};throw new Error}catch{throw new Error("A Provided cropping polygon point is not supported")}})};try{if(!e.isArray(d))throw new Error("Provided cropping polygon is not an array");this._croppingPolygons=d.map(function(M){return S(M)})}catch(M){e.console.error("[TiledImage.setCroppingPolygons] Cropping polygon format not supported"),e.console.error(M),this._croppingPolygons=null}},resetCroppingPolygons:function(){this._croppingPolygons=null},fitBounds:function(d,_,S){_=_||e.Placement.CENTER;var M=e.Placement.properties[_],I=this.contentAspectX,V=0,j=0,q=1,K=1;if(this._clip&&(I=this._clip.getAspectRatio(),q=this._clip.width/this.source.dimensions.x,K=this._clip.height/this.source.dimensions.y,d.getAspectRatio()>I?(V=this._clip.x/this._clip.height*d.height,j=this._clip.y/this._clip.height*d.height):(V=this._clip.x/this._clip.width*d.width,j=this._clip.y/this._clip.width*d.width)),d.getAspectRatio()>I){var re=d.height/K,ee=0;M.isHorizontallyCentered?ee=(d.width-d.height*I)/2:M.isRight&&(ee=d.width-d.height*I),this.setPosition(new e.Point(d.x-V+ee,d.y-j),S),this.setHeight(re,S)}else{var fe=d.width/q,ce=0;M.isVerticallyCentered?ce=(d.height-d.width/I)/2:M.isBottom&&(ce=d.height-d.width/I),this.setPosition(new e.Point(d.x-V,d.y-j+ce),S),this.setWidth(fe,S)}},getClip:function(){return this._clip?this._clip.clone():null},setClip:function(d){e.console.assert(!d||d instanceof e.Rect,"[TiledImage.setClip] newClip must be an OpenSeadragon.Rect or null"),d instanceof e.Rect?this._clip=d.clone():this._clip=null,this._needsDraw=!0,this.raiseEvent("clip-change")},getFlip:function(){return!!this.flipped},setFlip:function(d){this.flipped=!!d,this._needsDraw=!0,this._raiseBoundsChange()},getOpacity:function(){return this.opacity},setOpacity:function(d){d!==this.opacity&&(this.opacity=d,this._needsDraw=!0,this.raiseEvent("opacity-change",{opacity:this.opacity}))},getPreload:function(){return this._preload},setPreload:function(d){this._preload=!!d,this._needsDraw=!0},getRotation:function(d){return d?this._degreesSpring.current.value:this._degreesSpring.target.value},setRotation:function(d,_){this._degreesSpring.target.value===d&&this._degreesSpring.isAtTargetValue()||(_?this._degreesSpring.resetTo(d):this._degreesSpring.springTo(d),this._needsDraw=!0,this._raiseBoundsChange())},_getRotationPoint:function(d){return this.getBoundsNoRotate(d).getCenter()},getCompositeOperation:function(){return this.compositeOperation},setCompositeOperation:function(d){d!==this.compositeOperation&&(this.compositeOperation=d,this._needsDraw=!0,this.raiseEvent("composite-operation-change",{compositeOperation:this.compositeOperation}))},_setScale:function(d,_){var S=this._scaleSpring.target.value===d;if(_){if(S&&this._scaleSpring.current.value===d)return;this._scaleSpring.resetTo(d),this._updateForScale(),this._needsDraw=!0}else{if(S)return;this._scaleSpring.springTo(d),this._updateForScale(),this._needsDraw=!0}S||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 d=Math.max(this.source.minLevel,Math.floor(Math.log(this.minZoomImageRatio)/Math.log(2))),_=this.viewport.deltaPixelsFromPointsNoRotate(this.source.getPixelRatio(0),!0).x*this._scaleSpring.current.value,S=Math.min(Math.abs(this.source.maxLevel),Math.abs(Math.floor(Math.log(_/this.minPixelRatio)/Math.log(2))));return S=Math.max(S,this.source.minLevel||0),d=Math.min(d,S),{lowestLevel:d,highestLevel:S}},_updateViewport:function(){for(this._needsDraw=!1,this._tilesLoading=0,this.loadingCoverage={};this.lastDrawn.length>0;){var d=this.lastDrawn.pop();d.beingDrawn=!1}var _=this.viewport,S=this._viewportToTiledImageRectangle(_.getBoundsWithMargins(!0));if(!this.wrapHorizontal&&!this.wrapVertical){var M=this._viewportToTiledImageRectangle(this.getClippedBounds(!0));if(S=S.intersection(M),S===null)return}for(var I=this._getLevelsInterval(),V=I.lowestLevel,j=I.highestLevel,q=null,K=!1,re=e.now(),ee=j;ee>=V;ee--){var fe=!1,ce=_.deltaPixelsFromPointsNoRotate(this.source.getPixelRatio(ee),!0).x*this._scaleSpring.current.value;if(ee===V||!K&&ce>=this.minPixelRatio)fe=!0,K=!0;else if(!K)continue;var ye=_.deltaPixelsFromPointsNoRotate(this.source.getPixelRatio(ee),!1).x*this._scaleSpring.current.value,ae=_.deltaPixelsFromPointsNoRotate(this.source.getPixelRatio(Math.max(this.source.getClosestLevel(),0)),!1).x*this._scaleSpring.current.value,oe=this.immediateRender?1:ae,ie=Math.min(1,(ce-.5)/.5),we=oe/Math.abs(oe-ye);if(q=i(this,K,fe,ee,ie,we,S,re,q),g(this.coverage,ee))break}C(this,this.lastDrawn),q&&!q.context2D?(l(this,q,re),this._needsDraw=!0,this._setFullyLoaded(!1)):this._setFullyLoaded(this._tilesLoading===0)},_getCornerTiles:function(d,_,S){var M,I;this.wrapHorizontal?(M=e.positiveModulo(_.x,1),I=e.positiveModulo(S.x,1)):(M=Math.max(0,_.x),I=Math.min(1,S.x));var V,j,q=1/this.source.aspectRatio;this.wrapVertical?(V=e.positiveModulo(_.y,q),j=e.positiveModulo(S.y,q)):(V=Math.max(0,_.y),j=Math.min(q,S.y));var K=this.source.getTileAtPoint(d,new e.Point(M,V)),re=this.source.getTileAtPoint(d,new e.Point(I,j)),ee=this.source.getNumTiles(d);return this.wrapHorizontal&&(K.x+=ee.x*Math.floor(_.x),re.x+=ee.x*Math.floor(S.x)),this.wrapVertical&&(K.y+=ee.y*Math.floor(_.y/q),re.y+=ee.y*Math.floor(S.y/q)),{topLeft:K,bottomRight:re}}});function i(d,_,S,M,I,V,j,q,K){var re=j.getBoundingBox().getTopLeft(),ee=j.getBoundingBox().getBottomRight();d.viewer&&d.viewer.raiseEvent("update-level",{tiledImage:d,havedrawn:_,level:M,opacity:I,visibility:V,drawArea:j,topleft:re,bottomright:ee,currenttime:q,best:K}),x(d.coverage,M),x(d.loadingCoverage,M);var fe=d._getCornerTiles(M,re,ee),ce=fe.topLeft,ye=fe.bottomRight,ae=d.source.getNumTiles(M),oe=d.viewport.pixelFromPoint(d.viewport.getCenter());d.getFlip()&&(ye.x+=1,d.wrapHorizontal||(ye.x=Math.min(ye.x,ae.x-1)));for(var ie=ce.x;ie<=ye.x;ie++)for(var we=ce.y;we<=ye.y;we++){var Q;if(d.getFlip()){var Ce=(ae.x+ie%ae.x)%ae.x;Q=ie+ae.x-Ce-Ce-1}else Q=ie;j.intersection(d.getTileBounds(M,Q,we))!==null&&(K=n(d,S,_,Q,we,M,I,V,oe,ae,q,K))}return K}function n(d,_,S,M,I,V,j,q,K,re,ee,fe){var ce=r(M,I,V,d,d.source,d.tilesMatrix,ee,re,d._worldWidthCurrent,d._worldHeightCurrent),ye=S;d.viewer&&d.viewer.raiseEvent("update-tile",{tiledImage:d,tile:ce}),T(d.coverage,V,M,I,!1);var ae=ce.loaded||ce.loading||m(d.loadingCoverage,V,M,I);if(T(d.loadingCoverage,V,M,I,ae),!ce.exists||(_&&!ye&&(m(d.coverage,V,M,I)?T(d.coverage,V,M,I,!0):ye=!0),!ye))return fe;if(u(ce,d.source.tileOverlap,d.viewport,K,q,d),!ce.loaded)if(ce.context2D)o(d,ce);else{var oe=d._tileCache.getImageRecord(ce.cacheKey);if(oe){var ie=oe.getImage();o(d,ce,ie)}}if(ce.loaded){var we=h(d,ce,M,I,V,j,ee);we&&(d._needsDraw=!0)}else ce.loading?d._tilesLoading++:ae||(fe=P(fe,ce));return fe}function r(d,_,S,M,I,V,j,q,K,re){var ee,fe,ce,ye,ae,oe,ie,we,Q;return V[S]||(V[S]={}),V[S][d]||(V[S][d]={}),(!V[S][d][_]||!V[S][d][_].flipped!=!M.flipped)&&(ee=(q.x+d%q.x)%q.x,fe=(q.y+_%q.y)%q.y,ce=M.getTileBounds(S,d,_),ye=I.getTileBounds(S,ee,fe,!0),ae=I.tileExists(S,ee,fe),oe=I.getTileUrl(S,ee,fe),M.loadTilesWithAjax?(ie=I.getTileAjaxHeaders(S,ee,fe),e.isPlainObject(M.ajaxHeaders)&&(ie=e.extend({},M.ajaxHeaders,ie))):ie=null,we=I.getContext2D?I.getContext2D(S,ee,fe):void 0,Q=new e.Tile(S,d,_,ce,ae,oe,we,M.loadTilesWithAjax,ie,ye),M.getFlip()?ee===0&&(Q.isRightMost=!0):ee===q.x-1&&(Q.isRightMost=!0),fe===q.y-1&&(Q.isBottomMost=!0),Q.flipped=M.flipped,V[S][d][_]=Q),Q=V[S][d][_],Q.lastTouchTime=j,Q}function l(d,_,S){_.loading=!0,d._imageLoader.addJob({src:_.url,loadWithAjax:_.loadWithAjax,ajaxHeaders:_.ajaxHeaders,crossOriginPolicy:d.crossOriginPolicy,ajaxWithCredentials:d.ajaxWithCredentials,callback:function(M,I,V){a(d,_,S,M,I,V)},abort:function(){_.loading=!1}})}function a(d,_,S,M,I,V){if(!M){e.console.log("Tile %s failed to load: %s - error: %s",_,_.url,I),d.viewer.raiseEvent("tile-load-failed",{tile:_,tiledImage:d,time:S,message:I,tileRequest:V}),_.loading=!1,_.exists=!1;return}if(Sd.visibility||_.visibility===d.visibility&&_.squaredDistance1&&q>d.smoothTileEdgesMinZoom&&!d.iOSDevice&&d.getRotation(!0)%360===0&&e.supportsCanvas&&(M=!0,I=S.getScaleForEdgeSmoothing(),V=S.getTranslationForEdgeSmoothing(I,d._drawer.getCanvasSize(!1),d._drawer.getCanvasSize(!0)));var K;M&&(I||(K=d.viewport.viewportToViewerElementRectangle(d.getClippedBounds(!0)).getIntegerBoundingBox(),d._drawer.viewer.viewport.getFlip()&&(d.viewport.degrees!==0||d.getRotation(!0)%360!==0)&&(K.x=d._drawer.viewer.container.clientWidth-(K.x+K.width)),K=K.times(e.pixelDensityRatio)),d._drawer._clear(!0,K)),I||(d.viewport.degrees!==0&&d._drawer._offsetForRotation({degrees:d.viewport.degrees,useSketch:M}),d.getRotation(!0)%360!==0&&d._drawer._offsetForRotation({degrees:d.getRotation(!0),point:d.viewport.pixelFromPointNoRotate(d._getRotationPoint(!0),!0),useSketch:M}),d.viewport.degrees===0&&d.getRotation(!0)%360===0&&d._drawer.viewer.viewport.getFlip()&&d._drawer._flip());var re=!1;if(d._clip){d._drawer.saveContext(M);var ee=d.imageToViewportRectangle(d._clip,!0);ee=ee.rotate(-d.getRotation(!0),d._getRotationPoint(!0));var fe=d._drawer.viewportToDrawerRectangle(ee);I&&(fe=fe.times(I)),V&&(fe=fe.translate(V)),d._drawer.setClip(fe,M),re=!0}if(d._croppingPolygons){d._drawer.saveContext(M);try{var ce=d._croppingPolygons.map(function(ie){return ie.map(function(we){var Q=d.imageToViewportCoordinates(we.x,we.y,!0).rotate(-d.getRotation(!0),d._getRotationPoint(!0)),Ce=d._drawer.viewportCoordToDrawerCoord(Q);return I&&(Ce=Ce.times(I)),Ce})});d._drawer.clipWithPolygons(ce,M)}catch(ie){e.console.error(ie)}re=!0}if(d.placeholderFillStyle&&d._hasOpaqueTile===!1){var ye=d._drawer.viewportToDrawerRectangle(d.getBounds(!0));I&&(ye=ye.times(I)),V&&(ye=ye.translate(V));var ae=null;typeof d.placeholderFillStyle=="function"?ae=d.placeholderFillStyle(d,d._drawer.context):ae=d.placeholderFillStyle,d._drawer.drawRectangle(ye,ae,M)}for(var oe=_.length-1;oe>=0;oe--)S=_[oe],d._drawer.drawTile(S,d._drawingHandler,M,I,V),S.beingDrawn=!0,d.viewer&&d.viewer.raiseEvent("tile-drawn",{tiledImage:d,tile:S});re&&d._drawer.restoreContext(M),I||(d.getRotation(!0)%360!==0&&d._drawer._restoreRotationChanges(M),d.viewport.degrees!==0&&d._drawer._restoreRotationChanges(M)),M&&(I&&(d.viewport.degrees!==0&&d._drawer._offsetForRotation({degrees:d.viewport.degrees,useSketch:!1}),d.getRotation(!0)%360!==0&&d._drawer._offsetForRotation({degrees:d.getRotation(!0),point:d.viewport.pixelFromPointNoRotate(d._getRotationPoint(!0),!0),useSketch:!1})),d._drawer.blendSketch({opacity:d.opacity,scale:I,translate:V,compositeOperation:d.compositeOperation,bounds:K}),I&&(d.getRotation(!0)%360!==0&&d._drawer._restoreRotationChanges(!1),d.viewport.degrees!==0&&d._drawer._restoreRotationChanges(!1))),I||d.viewport.degrees===0&&d.getRotation(!0)%360===0&&d._drawer.viewer.viewport.getFlip()&&d._drawer._flip(),k(d,_)}}function k(d,_){if(d.debugMode)for(var S=_.length-1;S>=0;S--){var M=_[S];try{d._drawer.drawDebugInfo(M,_.length,S,d)}catch(I){e.console.error(I)}}}}(s),function(e){var i=function(r){e.console.assert(r,"[TileCache.cacheTile] options is required"),e.console.assert(r.tile,"[TileCache.cacheTile] options.tile is required"),e.console.assert(r.tiledImage,"[TileCache.cacheTile] options.tiledImage is required"),this.tile=r.tile,this.tiledImage=r.tiledImage},n=function(r){e.console.assert(r,"[ImageRecord] options is required"),e.console.assert(r.image,"[ImageRecord] options.image is required"),this._image=r.image,this._tiles=[]};n.prototype={destroy:function(){this._image=null,this._renderedContext=null,this._tiles=null},getImage:function(){return this._image},getRenderedContext:function(){if(!this._renderedContext){var r=document.createElement("canvas");r.width=this._image.width,r.height=this._image.height,this._renderedContext=r.getContext("2d"),this._renderedContext.drawImage(this._image,0,0),this._image=null}return this._renderedContext},setRenderedContext:function(r){e.console.error("ImageRecord.setRenderedContext is deprecated. The rendered context should be created by the ImageRecord itself when calling ImageRecord.getRenderedContext."),this._renderedContext=r},addTile:function(r){e.console.assert(r,"[ImageRecord.addTile] tile is required"),this._tiles.push(r)},removeTile:function(r){for(var l=0;lthis._maxImageCacheCount){for(var u=null,h=-1,g=null,m,T,x,P,C,k,d=this._tilesLoaded.length-1;d>=0;d--)if(k=this._tilesLoaded[d],m=k.tile,!(m.level<=l||m.beingDrawn)){if(!u){u=m,h=d,g=k;continue}P=m.lastTouchTime,T=u.lastTouchTime,C=m.level,x=u.level,(Px)&&(u=m,h=d,g=k)}u&&h>=0&&(this._unloadTile(g),a=h)}this._tilesLoaded[a]=new i({tile:r.tile,tiledImage:r.tiledImage})},clearTilesFor:function(r){e.console.assert(r,"[TileCache.clearTilesFor] tiledImage is required");for(var l,a=0;a=this._items.length)throw new Error("Index bigger than number of layers.");n===r||r===-1||(this._items.splice(r,1),this._items.splice(n,0,i),this._needsDraw=!0,this.raiseEvent("item-index-change",{item:i,previousIndex:r,newIndex:n}))},removeItem:function(i){e.console.assert(i,"[World.removeItem] item is required");var n=e.indexOf(this._items,i);n!==-1&&(i.removeHandler("bounds-change",this._delegatedFigureSizes),i.removeHandler("clip-change",this._delegatedFigureSizes),i.destroy(),this._items.splice(n,1),this._figureSizes(),this._needsDraw=!0,this._raiseRemoveItem(i))},removeAll:function(){this.viewer._cancelPendingImages();var i,n;for(n=0;nP.height?C=o:C=o*(P.width/P.height),k=C*(P.height/P.width),d=new e.Point(m+(o-C)/2,T+(o-k)/2),x.setPosition(d,n),x.setWidth(C,n),r==="horizontal"?m+=h:T+=h;this.setAutoRefigureSizes(!0)},_figureSizes:function(){var i=this._homeBounds?this._homeBounds.clone():null,n=this._contentSize?this._contentSize.clone():null,r=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 l=this._items[0],a=l.getBounds();this._contentFactor=l.getContentSize().x/a.width;for(var o=l.getClippedBounds().getBoundingBox(),u=o.x,h=o.y,g=o.x+o.width,m=o.y+o.height,T=1;T0},saturation(){const t=this.$store.options.filters.saturate;return typeof t=="number"?t:1}},watch:{"$store.options.pages":function(t,s){const e=t.length!==s.length;this.loadImageInfo(e)}},mounted(){this.loadImageInfo(),this.updateFilterStyle(),this.$store.rootElement.addEventListener("keydown",this.onKeydown),this.$store.rootElement.addEventListener("keypress",this.onKeypress)},beforeUnmount(){this.viewer&&this.viewer.destroy(),this.$store.rootElement.removeEventListener("keydown",this.onKeydown),this.$store.rootElement.removeEventListener("keypress",this.onKeypress)},methods:{closeFilters(){this.filtersVisible=!1},initViewer(t){const s=[];let e=0,i,n=0;if(this.$store.options.pages.forEach((r,l)=>{let a=1;r<1?(a=0,i=l>0?this.$store.pageCount:1):i=r;const o=this.tileSources[i];if(!o)return;e||(e=o.width);const u=o.width/e;s.push({opacity:a,tileSource:o,width:u,x:n}),n+=u+Oh}),this.viewer){this.viewer.addOnceHandler("open",()=>{if(this.viewerState.isReset||t)this.resetScan();else{if(this.viewer.viewport.applyConstraints(!0),!this.$store.options.optionsResetOnPageChange)return;this.$store.options.optionsResetOnPageChange.forEach(r=>{if(r==="filters")this.resetFilters();else if(r==="pan"){const l=this.viewer.viewport.getBounds();if(l.x<=0&&l.y<=0)return;const a=this.$store.options.pages[0]?0:1;this.viewer.viewport.panTo({x:l.x>0?l.width/2+a:this.$store.options.pan.x,y:l.y>0?l.height/2:this.$store.options.pan.y}),this.$store.updateOptions({pan:{}})}else r==="rotation"?(this.viewer.viewport.setRotation(0),this.$store.updateOptions({rotation:null})):r==="zoom"&&(this.viewer.viewport.goHome(),this.$store.updateOptions({zoom:null}))})}}),this.viewer.open(s);return}this.viewer=Hh({animationTime:.4,element:this.$refs.image,immediateRender:!0,preload:!this.$store.isMobile(),preserveImageSizeOnResize:!0,preserveViewport:!0,showNavigationControl:!1,showZoomControl:!1,tileSources:s,visibilityRatio:.2,...this.$store.options.viewer}),this.viewer.innerTracker.keyHandler=null,this.viewer.gestureSettingsMouse.clickToZoom=!1,this.viewer.addHandler("animation-finish",()=>{if(this.viewerState.isReset){this.removeScanOptions();return}const r=this.viewer.viewport.getCenter();this.$store.updateOptions({pan:{x:Math.round(r.x*1e3)/1e3,y:Math.round(r.y*1e3)/1e3},zoom:Math.round(this.viewer.viewport.getZoom()*1e3)/1e3})}),this.viewer.addHandler("canvas-click",()=>{document.body.click()}),this.viewer.addHandler("open",()=>{this.startLoadingWatch(),this.$store.options.pan.x!==void 0||this.$store.options.pan.y!==void 0||this.$store.options.zoom?((this.$store.options.pan.x!==void 0||this.$store.options.pan.y!==void 0)&&this.viewer.viewport.panTo({x:this.$store.options.pan.x,y:this.$store.options.pan.y},!0),this.$store.options.zoom&&this.viewer.viewport.zoomTo(this.$store.options.zoom,null,!0)):this.viewer.viewport.goHome(),this.$store.options.rotation!==null&&this.viewer.viewport.setRotation(this.$store.options.rotation)}),this.viewer.addHandler("pan",this.updateViewerState),this.viewer.addHandler("resize",this.updateViewerState),this.viewer.addHandler("zoom",this.updateViewerState),this.viewer.addHandler("tile-load-failed",r=>{this.$store.addError(`Error loading image: ${r.message}`)}),this.$api.expose(this.resetScan),this.$api.expose(this.viewer,"viewer")},loadImageInfo(t=!1){this.stopLoadingWatch();const s=[];this.$store.options.pages.forEach(e=>{if(e<1||this.tileSources[e])return;const{resource:i}=this.$store.canvases[e-1].images[0];if(i.service){const n=i.service["@id"],r=`${n}${n.slice(-1)==="/"?"":"/"}info.json`;s.push(this.$store.fetchJson(r).then(l=>({...l,page:e}),l=>{let a;l.response&&l.response.statusText?a=l.response.statusText:l.message&&(a=l.message),this.$store.addError(`Error loading info file for page ${e}${a?`: ${a}`:""}`)}))}else this.tileSources[e]={type:"image",url:i["@id"],width:i.width,height:i.height}}),s.length?Promise.all(s).then(e=>{e.forEach(i=>{i&&(this.tileSources[i.page]=i)}),this.initViewer(t)}):this.initViewer(t)},onKeydown(t){t.key==="Escape"&&(this.filtersVisible=!1),[45,48,96].includes(t.keyCode)&&(t.shiftKey?this.resetScan(t):this.viewer.viewport.goHome())},onKeypress(t){if(!wn(t))switch(t.key){case"r":case"R":this.rotateRight(t);break;case"i":this.filtersVisible=!this.filtersVisible,this.filtersVisible&&this.$nextTick(()=>{this.$refs.firstSlider.focus()});break;case"I":this.resetFilters();break;case"+":case"=":case"W":this.viewer.viewport.zoomBy(1.1),this.viewer.viewport.applyConstraints();break;case"-":case"_":case"S":this.viewer.viewport.zoomBy(.9),this.viewer.viewport.applyConstraints();break;case"w":this.viewer.innerTracker.keyDownHandler({keyCode:38});break;case"s":this.viewer.innerTracker.keyDownHandler({keyCode:40});break;case"a":this.viewer.innerTracker.keyDownHandler({keyCode:37});break;case"d":this.viewer.innerTracker.keyDownHandler({keyCode:39});break}},removeScanOptions(){this.$store.updateOptions({pan:{},zoom:null})},resetFilters(){this.$refs.image.style.cssText="",this.$store.updateOptions({filters:{}})},resetScan(t){t&&(this.viewer.viewport.setRotation(0),this.$store.updateOptions({rotation:null}),this.filtersActive&&this.resetFilters()),this.viewer.viewport.goHome(),this.removeScanOptions()},rotateRight(t){const{viewport:s}=this.viewer,e=t&&t.shiftKey?0:(s.getRotation()+90)%360;s.setRotation(e),this.$store.updateOptions({rotation:e||null})},setFilter(t,s){const e=s.target.valueAsNumber;e===1?delete this.$store.options.filters[t]:this.$store.options.filters[t]=e,this.$store.updateOptions({filters:this.$store.options.filters}),this.updateFilterStyle()},startLoadingWatch(){this.$store.loading=0;for(let t=this.viewer.world.getItemCount()-1;t>=0;t-=1){const s=this.viewer.world.getItemAt(t);if(s&&s._tilesLoading){this.$store.loading=1;break}}this.loadingTimeout=setTimeout(this.startLoadingWatch,200)},stopLoadingWatch(){clearTimeout(this.loadingTimeout)},updateFilterStyle(){if(!this.filtersActive)return;const t=[];Object.keys(this.$store.options.filters).forEach(i=>{t.push(`${i}(${this.$store.options.filters[i]})`)});const{image:s}=this.$refs,e=t.join(" ");s.style.cssText=`filter: ${e}`},updateViewerState(){const t=this.viewer.viewport.getZoom();this.viewerState.isMaxZoom=t>=this.viewer.viewport.getMaxZoom(),this.viewerState.isMinZoom=t<=this.viewer.viewport.getMinZoom();const s=this.viewer.viewport.getHomeBounds(),e=this.viewer.viewport.getBounds();this.viewerState.isReset=Math.abs(s.height-e.height)<1e-9&&Math.abs(s.width-e.width)<1e-9&&Math.abs(s.x-e.x)<1e-9&&Math.abs(s.y-e.y)<1e-9},zoomIn(){this.viewer.viewport.zoomBy(this.zoomFactor)},zoomOut(){this.viewer.viewport.zoomBy(1/this.zoomFactor)}}},Mh={class:"tify-scan"},Dh={class:"tify-sr-only"},kh=["title"],Fh=["title"],Ah={key:2,class:"tify-scan-buttons"},Bh=["disabled","title"],Ih=["disabled","title"],zh=["disabled","title"],Nh=["title"],Vh=["title","aria-controls","aria-expanded"],Uh=["id"],Wh={class:"tify-sr-only"},jh=["value"],Gh=["value"],qh=["value"],Zh=["disabled"],Kh={ref:"image",class:"tify-scan-image"};function Xh(t,s,e,i,n,r){const l=nr,a=ir,o=mh,u=ch,h=sh,g=Qc,m=qc,T=Nc,x=kc,P=Rc,C=xc,k=cn("click-outside");return L(),D("section",Mh,[F("h2",Dh,Z(t.$translate("Scan")),1),!t.$store.isCustomPageView&&!t.$store.isFirstPage?(L(),D("button",{key:0,type:"button",class:"tify-scan-page-button -previous",title:t.$translate("Previous page"),onClick:s[0]||(s[0]=d=>t.$store.goToPreviousPage())},[te(l)],8,kh)):se("",!0),!t.$store.isCustomPageView&&!t.$store.isLastPage?(L(),D("button",{key:1,type:"button",class:"tify-scan-page-button -next",title:t.$translate("Next page"),onClick:s[1]||(s[1]=d=>t.$store.goToNextPage())},[te(a)],8,Fh)):se("",!0),n.viewer?(L(),D("div",Ah,[F("button",{type:"button",class:"tify-scan-button",disabled:n.viewerState.isMaxZoom,title:t.$translate("Zoom in"),onClick:s[2]||(s[2]=d=>r.zoomIn())},[te(o)],8,Bh),F("button",{type:"button",class:"tify-scan-button",disabled:n.viewerState.isReset,title:t.$translate("Reset"),onClick:s[3]||(s[3]=d=>r.resetScan(!!d.shiftKey))},[te(u)],8,Ih),F("button",{type:"button",class:"tify-scan-button",disabled:n.viewerState.isMinZoom,title:t.$translate("Zoom out"),onClick:s[4]||(s[4]=d=>r.zoomOut())},[te(h)],8,zh),F("button",{type:"button",class:xe(["tify-scan-button",{"-active":t.$store.options.rotation}]),title:t.$translate("Rotate"),onClick:s[5]||(s[5]=d=>r.rotateRight(d))},[te(g)],10,Nh),ke((L(),D("div",{class:xe(["tify-scan-filters",{"-open":n.filtersVisible}])},[F("button",{type:"button",class:xe(["tify-scan-button",{"-active":r.filtersActive}]),title:t.$translate("Toggle image filters"),"aria-controls":t.$store.getId("filters"),"aria-expanded":n.filtersVisible?"true":"false",onClick:s[6]||(s[6]=d=>n.filtersVisible=!n.filtersVisible)},[te(m)],10,Vh),ke(F("div",{id:t.$store.getId("filters"),class:"tify-scan-filters-popup"},[F("h3",Wh,Z(t.$translate("Image filters")),1),F("p",null,[F("label",null,[te(T),Ee(" "+Z(t.$translate("Brightness"))+" ",1),F("b",null,Z(Math.round((t.$store.options.filters.brightness||1)*100))+" %",1),F("input",{ref:"firstSlider",class:"tify-scan-range",max:"2",min:".5",step:".01",type:"range",value:t.$store.options.filters.brightness||1,onInput:s[7]||(s[7]=d=>r.setFilter("brightness",d))},null,40,jh)])]),F("p",null,[F("label",null,[te(x),Ee(" "+Z(t.$translate("Contrast"))+" ",1),F("b",null,Z(Math.round((t.$store.options.filters.contrast||1)*100))+" %",1),F("input",{class:"tify-scan-range",max:"2",min:".5",step:".01",type:"range",value:t.$store.options.filters.contrast||1,onInput:s[8]||(s[8]=d=>r.setFilter("contrast",d))},null,40,Gh)])]),F("p",null,[F("label",null,[te(P),Ee(" "+Z(t.$translate("Saturation"))+" ",1),F("b",null,Z(Math.round(r.saturation*100))+" %",1),F("input",{class:"tify-scan-range",max:"3",min:"0",step:".01",type:"range",value:r.saturation,onInput:s[9]||(s[9]=d=>r.setFilter("saturate",d))},null,40,qh)])]),F("p",null,[F("button",{type:"button",class:"tify-scan-reset",disabled:!r.filtersActive,onClick:s[10]||(s[10]=d=>r.resetFilters())},[te(C),Ee(" "+Z(t.$translate("Reset")),1)],8,Zh)])],8,Uh),[[Ye,n.filtersVisible]])],2)),[[k,r.closeFilters]])])):se("",!0),F("div",Kh,null,512)])}const Yh=ue(Lh,[["render",Xh]]),Jh={},Qh={class:"tify-icon",viewBox:"0 0 24 24"},$h=F("path",{d:"M14,14H19V16H16V19H14V14M5,14H10V19H8V16H5V14M8,5H10V10H5V8H8V5M19,8V10H14V5H16V8H19Z"},null,-1),ed=[$h];function td(t,s){return L(),D("svg",Qh,ed)}const id=ue(Jh,[["render",td]]),nd={},sd={class:"tify-icon",viewBox:"0 0 24 24"},rd=F("path",{d:"M5,5H10V7H7V10H5V5M14,5H19V10H17V7H14V5M17,14H19V19H14V17H17V14M10,17V19H5V14H7V17H10Z"},null,-1),od=[rd];function ad(t,s){return L(),D("svg",sd,od)}const ld=ue(nd,[["render",ad]]),ud={},cd={class:"tify-icon",viewBox:"0 0 24 24"},hd=F("path",{d:"M11,18H13V16H11V18M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20,12C20,16.41 16.41,20 12,20M12,6A4,4 0 0,0 8,10H10A2,2 0 0,1 12,8A2,2 0 0,1 14,10C14,12 11,11.75 11,15H13C13,12.75 16,12.5 16,10A4,4 0 0,0 12,6Z"},null,-1),dd=[hd];function fd(t,s){return L(),D("svg",cd,dd)}const pd=ue(ud,[["render",fd]]),gd={},md={class:"tify-icon",viewBox:"0 0 24 24"},vd=F("path",{d:"M11 15H17V17H11V15M9 7H7V9H9V7M11 13H17V11H11V13M11 9H17V7H11V9M9 11H7V13H9V11M21 5V19C21 20.1 20.1 21 19 21H5C3.9 21 3 20.1 3 19V5C3 3.9 3.9 3 5 3H19C20.1 3 21 3.9 21 5M19 5H5V19H19V5M9 15H7V17H9V15Z"},null,-1),yd=[vd];function wd(t,s){return L(),D("svg",md,yd)}const _d=ue(gd,[["render",wd]]),Td={},xd={class:"tify-icon",viewBox:"0 0 24 24"},bd=F("path",{d:"M13,5V11H14.17L12,13.17L9.83,11H11V5H13M15,3H9V9H5L12,16L19,9H15V3M19,18H5V20H19V18Z"},null,-1),Ed=[bd];function Pd(t,s){return L(),D("svg",xd,Ed)}const Sd=ue(Td,[["render",Pd]]),Cd={},Rd={class:"tify-icon",viewBox:"0 0 24 24"},Hd=F("path",{d:"M13.5,4A1.5,1.5 0 0,0 12,5.5A1.5,1.5 0 0,0 13.5,7A1.5,1.5 0 0,0 15,5.5A1.5,1.5 0 0,0 13.5,4M13.14,8.77C11.95,8.87 8.7,11.46 8.7,11.46C8.5,11.61 8.56,11.6 8.72,11.88C8.88,12.15 8.86,12.17 9.05,12.04C9.25,11.91 9.58,11.7 10.13,11.36C12.25,10 10.47,13.14 9.56,18.43C9.2,21.05 11.56,19.7 12.17,19.3C12.77,18.91 14.38,17.8 14.54,17.69C14.76,17.54 14.6,17.42 14.43,17.17C14.31,17 14.19,17.12 14.19,17.12C13.54,17.55 12.35,18.45 12.19,17.88C12,17.31 13.22,13.4 13.89,10.71C14,10.07 14.3,8.67 13.14,8.77Z"},null,-1),Od=[Hd];function Ld(t,s){return L(),D("svg",Rd,Od)}const Md=ue(Cd,[["render",Ld]]),Dd={},kd={class:"tify-icon",viewBox:"0 0 24 24"},Fd=F("path",{d:"M3,9H17V7H3V9M3,13H17V11H3V13M3,17H17V15H3V17M19,17H21V15H19V17M19,7V9H21V7H19M19,13H21V11H19V13Z"},null,-1),Ad=[Fd];function Bd(t,s){return L(),D("svg",kd,Ad)}const Id=ue(Dd,[["render",Bd]]),zd={},Nd={class:"tify-icon",viewBox:"0 0 24 24"},Vd=F("path",{d:"M4,5H20V7H4V5M4,9H20V11H4V9M4,13H20V15H4V13M4,17H14V19H4V17Z"},null,-1),Ud=[Vd];function Wd(t,s){return L(),D("svg",Nd,Ud)}const jd=ue(zd,[["render",Wd]]),Gd={},qd={class:"tify-icon",viewBox:"0 0 24 24"},Zd=F("path",{d:"M8.5,13.5L11,16.5L14.5,12L19,18H5M21,19V5C21,3.89 20.1,3 19,3H5A2,2 0 0,0 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19Z"},null,-1),Kd=[Zd];function Xd(t,s){return L(),D("svg",qd,Kd)}const Yd=ue(Gd,[["render",Xd]]),Jd={},Qd={class:"tify-icon",viewBox:"0 0 24 24"},$d=F("path",{d:"M12 16C13.1 16 14 16.9 14 18S13.1 20 12 20 10 19.1 10 18 10.9 16 12 16M12 10C13.1 10 14 10.9 14 12S13.1 14 12 14 10 13.1 10 12 10.9 10 12 10M12 4C13.1 4 14 4.9 14 6S13.1 8 12 8 10 7.1 10 6 10.9 4 12 4M6 16C7.1 16 8 16.9 8 18S7.1 20 6 20 4 19.1 4 18 4.9 16 6 16M6 10C7.1 10 8 10.9 8 12S7.1 14 6 14 4 13.1 4 12 4.9 10 6 10M6 4C7.1 4 8 4.9 8 6S7.1 8 6 8 4 7.1 4 6 4.9 4 6 4M18 16C19.1 16 20 16.9 20 18S19.1 20 18 20 16 19.1 16 18 16.9 16 18 16M18 10C19.1 10 20 10.9 20 12S19.1 14 18 14 16 13.1 16 12 16.9 10 18 10M18 4C19.1 4 20 4.9 20 6S19.1 8 18 8 16 7.1 16 6 16.9 4 18 4Z"},null,-1),ef=[$d];function tf(t,s){return L(),D("svg",Qd,ef)}const nf=ue(Jd,[["render",tf]]),sf={},rf={class:"tify-icon",viewBox:"0 0 24 24"},of=F("path",{d:"M5.59,7.41L10.18,12L5.59,16.59L7,18L13,12L7,6L5.59,7.41M16,6H18V18H16V6Z"},null,-1),af=[of];function lf(t,s){return L(),D("svg",rf,af)}const uf=ue(sf,[["render",lf]]),cf={},hf={class:"tify-icon",viewBox:"0 0 24 24"},df=F("path",{d:"M16,18H18V6H16M6,18L14.5,12L6,6V18Z"},null,-1),ff=[df];function pf(t,s){return L(),D("svg",hf,ff)}const gf=ue(cf,[["render",pf]]),mf={},vf={class:"tify-icon",viewBox:"0 0 24 24"},yf=F("path",{d:"M6,18V6H8V18H6M9.5,12L18,6V18L9.5,12Z"},null,-1),wf=[yf];function _f(t,s){return L(),D("svg",vf,wf)}const Tf=ue(mf,[["render",_f]]),xf={},bf={class:"tify-icon",viewBox:"0 0 24 24"},Ef=F("path",{d:"M18.41,16.59L13.82,12L18.41,7.41L17,6L11,12L17,18L18.41,16.59M6,6H8V18H6V6Z"},null,-1),Pf=[Ef];function Sf(t,s){return L(),D("svg",bf,Pf)}const Cf=ue(xf,[["render",Sf]]),Rf={},Hf={class:"tify-icon",viewBox:"0 0 24 24"},Of=F("path",{d:"M21,5C19.89,4.65 18.67,4.5 17.5,4.5C15.55,4.5 13.45,4.9 12,6C10.55,4.9 8.45,4.5 6.5,4.5C4.55,4.5 2.45,4.9 1,6V20.65C1,20.9 1.25,21.15 1.5,21.15C1.6,21.15 1.65,21.1 1.75,21.1C3.1,20.45 5.05,20 6.5,20C8.45,20 10.55,20.4 12,21.5C13.35,20.65 15.8,20 17.5,20C19.15,20 20.85,20.3 22.25,21.05C22.35,21.1 22.4,21.1 22.5,21.1C22.75,21.1 23,20.85 23,20.6V6C22.4,5.55 21.75,5.25 21,5M21,18.5C19.9,18.15 18.7,18 17.5,18C15.8,18 13.35,18.65 12,19.5V8C13.35,7.15 15.8,6.5 17.5,6.5C18.7,6.5 19.9,6.65 21,7V18.5Z"},null,-1),Lf=[Of];function Mf(t,s){return L(),D("svg",Hf,Lf)}const Df=ue(Rf,[["render",Mf]]),kf={},Ff={class:"tify-icon",viewBox:"0 0 24 24"},Af=F("path",{d:"M16,5V11H21V5M10,11H15V5H10M16,18H21V12H16M10,18H15V12H10M4,18H9V12H4M4,11H9V5H4V11Z"},null,-1),Bf=[Af];function If(t,s){return L(),D("svg",Ff,Bf)}const zf=ue(kf,[["render",If]]),Nf={directives:{clickOutside:yn.directive},data(){return{filter:"",filteredCanvases:[],highlightIndex:0,isOpen:!1}},computed:{currentPageLabel(){const t=this.$store.options.pages[0]||1,s=this.$store.options.pages[0]?this.$store.options.pages[0]-1:0,e=this.$store.convertValueToArray(this.$store.canvases[s].label)[0];return this.$store.getPageLabel(t,e)},currentPageTitleAttr(){const{pages:t}=this.$store.options,s=t[0]===0&&t.length>1?1:t[0],e=this.$translate("Physical page"),i=this.$translate("Logical page");return`${e}: ${s} +${i}: ${this.$store.convertValueToArray(this.$store.canvases[s-1].label)[0]}`}},watch:{filter(){this.updateFilteredCanvases(),this.$nextTick(()=>this.updateScroll())},isOpen(){this.isOpen&&(this.filter="",this.highlightIndex=this.$store.options.pages[0]-1)}},mounted(){this.updateFilteredCanvases(),this.$store.rootElement.addEventListener("keydown",this.onKeydown)},beforeUnmount(){this.$store.rootElement.removeEventListener("keydown",this.onKeydown)},methods:{closeDropdown(){this.isOpen=!1},onKeydown(t){if(!wn(t)){if(t.key==="Escape"){this.closeDropdown();return}t.key==="x"&&(this.toggleDropdown(),t.preventDefault())}},onKeyDownArrow(){this.highlightIndex0&&(this.highlightIndex-=1,this.updateScroll())},setPage(t){this.closeDropdown(),this.$store.setPage(t),this.$store.isMobile()&&this.$store.updateOptions({view:"scan"})},toggleDropdown(){this.isOpen=!this.isOpen,this.isOpen&&this.$nextTick(()=>{this.$refs.search.focus(),this.updateScroll()})},updateFilteredCanvases(){const t=[],s=this.filter.toLowerCase();let e=-1;this.$store.canvases.forEach((i,n)=>{const l=this.$store.convertValueToArray(i.label)[0].toLowerCase().includes(s),a=(n+1).toFixed().includes(s);if(l||a){const o=i;o.page=n+1,o.page===this.$store.options.pages[0]&&(e=t.length),t.push(o)}}),this.highlightIndex=e<0?0:e,this.filteredCanvases=t},updateScroll(){const{list:t}=this.$refs;if(t&&t.children[this.highlightIndex]){const{offsetTop:s}=t.children[this.highlightIndex];t.scrollTop=s-(t.offsetHeight/2-t.children[0].offsetHeight)}}}},Vf={class:"tify-page-select"},Uf=["title","aria-label","aria-controls","aria-expanded"],Wf=["id"],jf={class:"tify-page-select-filter"},Gf=["aria-label"],qf={ref:"list",class:"tify-page-select-list"},Zf=["onClick"];function Kf(t,s,e,i,n,r){const l=cn("click-outside");return ke((L(),D("div",Vf,[F("button",{type:"button",class:"tify-page-select-button",title:r.currentPageTitleAttr,"aria-label":t.$translate("Current page"),"aria-controls":t.$store.getId("dropdown"),"aria-expanded":n.isOpen?"true":"false",onClick:s[0]||(s[0]=a=>r.toggleDropdown())},Z(r.currentPageLabel),9,Uf),ke(F("div",{id:t.$store.getId("dropdown"),key:"dropdown",class:"tify-page-select-dropdown",onClick:s[6]||(s[6]=ct(()=>{},["stop"]))},[F("div",jf,[ke(F("input",{ref:"search","onUpdate:modelValue":s[1]||(s[1]=a=>n.filter=a),"aria-label":t.$translate("Filter pages"),type:"text",class:"tify-page-select-input",onKeyup:s[2]||(s[2]=Vt(a=>n.filteredCanvases[n.highlightIndex]&&t.$store.setPage(n.filteredCanvases[n.highlightIndex].page),["enter"])),onKeydown:[s[3]||(s[3]=Vt(ct(a=>n.filter?n.filter="":r.closeDropdown(),["prevent"]),["esc"])),s[4]||(s[4]=Vt(ct(a=>r.onKeyUpArrow(),["prevent"]),["up"])),s[5]||(s[5]=Vt(ct(a=>r.onKeyDownArrow(),["prevent"]),["down"]))]},null,40,Gf),[[Ys,n.filter]])]),F("ol",qf,[(L(!0),D(de,null,Pe(n.filteredCanvases,(a,o)=>(L(),D("li",{key:o,class:xe({"-current":t.$store.options.pages.includes(a.page),"-highlighted":n.highlightIndex===o})},[F("a",{href:"javascript:;",onClick:u=>r.setPage(a.page)},Z(t.$store.getPageLabel(a.page,t.$store.convertValueToArray(a.label)[0])),9,Zf)],2))),128))],512)],8,Wf),[[Ye,n.isOpen]])])),[[l,r.closeDropdown]])}const Xf=ue(Nf,[["render",Kf]]),Yf={directives:{clickOutside:yn.directive},props:{fulltextEnabled:Boolean,tocEnabled:Boolean},data(){return{controlsVisible:!1,fullscreenActive:!1,screen:this.$store.rootElement.parentNode}},computed:{fullscreenSupported(){return document.fullscreenElement===null||document.webkitFullscreenElement===null},title(){const t=String.fromCharCode(160);return this.$store.convertValueToArray((this.$store.manifest||this.$store.collection||{}).label).join(`${t}· `).trim().replace(/(\S{1,10})\s+(\S{1,10})$/,`$1${t}$2`)}},created(){this.$api.expose(this.setView),this.$api.expose(this.toggleDoublePage),this.$api.expose(this.toggleFullscreen)},mounted(){this.$store.rootElement.addEventListener("keydown",this.onKeyDown),["","moz","webkit"].forEach(s=>{document.addEventListener(`${s}fullscreenchange`,this.toggleFullscreenActive)})},beforeUnmount(){this.$store.rootElement.removeEventListener("keydown",this.onKeyDown)},methods:{closeControlsPopup(){this.controlsVisible=!1},detectFullscreen(){let t;switch(null){case document.fullscreenElement:t=document.fullscreenElement;break;case document.webkitFullscreenElement:t=document.webkitFullscreenElement;break;default:t=!1}return t},onKeyDown(t){if(wn(t))return;if(t.key==="Escape"){this.controlsVisible=!1;return}switch(t.key){case"Backspace":this.$refs.switchViewSmall.offsetParent&&this.toggleView("scan");break;case"1":this.$store.manifest&&this.fulltextEnabled&&this.toggleView("fulltext");break;case"2":this.$store.manifest&&this.toggleView("thumbnails");break;case"3":this.$store.manifest&&this.tocEnabled&&this.toggleView("toc");break;case"4":this.toggleView("info");break;case"5":this.$store.manifest&&this.toggleView("export");break;case"6":this.$store.collection&&this.toggleView("collection");break;case"7":this.toggleView("help");break;case"b":this.$store.manifest&&this.toggleDoublePage();break;case"f":this.toggleFullscreen();break}if(!this.$store.manifest||this.$store.isCustomPageView)return;const{pages:s}=this.$store.options;switch(t.key){case"q":case",":s[0]>1&&this.$store.goToPreviousPage();break;case"e":case".":this.isLastPage||this.$store.goToNextPage();break;case"Q":s[0]>1&&this.$store.goToFirstPage();break;case"E":this.isLastPage||this.$store.goToLastPage();break}},setView(t){this.$store.updateOptions({view:t})},toggleControlsPopup(){this.controlsVisible=!this.controlsVisible},toggleDoublePage(t){const{pages:s}=this.$store.options;let e;if(s.length>1&&t!==!0||t===!1)e=[s[0]<1?1:s[0]];else if(s[0]<2)e=[0,1];else if(s[0]%2>0)e=[s[0]-1,s[0]];else{const i=s[0]1}]),title:t.$translate("Toggle double-page"),onClick:s[0]||(s[0]=(...K)=>r.toggleDoublePage&&r.toggleDoublePage(...K))},[t.$store.isCustomPageView?(L(),Me(a,{key:0})):(L(),Me(o,{key:1}))],10,ip)]),F("div",np,[F("button",{type:"button",class:"tify-header-button",disabled:t.$store.isCustomPageView||t.$store.isFirstPage,title:t.$translate("First page"),onClick:s[1]||(s[1]=K=>t.$store.goToFirstPage())},[te(u)],8,sp),t.$store.manifest.structures?(L(),D("button",{key:0,type:"button",class:"tify-header-button",disabled:t.$store.isCustomPageView||t.$store.isFirstPage,title:t.$translate("Previous section"),onClick:s[2]||(s[2]=K=>t.$store.goToPreviousSection())},[te(h)],8,rp)):se("",!0),F("button",{type:"button",class:"tify-header-button",disabled:t.$store.isCustomPageView||t.$store.isFirstPage,title:t.$translate("Previous page"),onClick:s[3]||(s[3]=K=>t.$store.goToPreviousPage())},[te(g)],8,op),F("button",{type:"button",class:"tify-header-button",disabled:t.$store.isCustomPageView||t.$store.isLastPage,title:t.$translate("Next page"),onClick:s[4]||(s[4]=K=>t.$store.goToNextPage())},[te(m)],8,ap),t.$store.manifest.structures?(L(),D("button",{key:1,type:"button",class:"tify-header-button",disabled:t.$store.isCustomPageView||t.$store.isLastSection,title:t.$translate("Next section"),onClick:s[5]||(s[5]=K=>t.$store.goToNextSection())},[te(T)],8,lp)):se("",!0),F("button",{type:"button",class:"tify-header-button",disabled:t.$store.isCustomPageView||t.$store.isLastPage,title:t.$translate("Last page"),onClick:s[6]||(s[6]=K=>t.$store.goToLastPage())},[te(x)],8,up)])])):se("",!0),F("div",cp,[F("div",hp,[F("button",{type:"button","aria-controls":t.$store.getId("controls"),"aria-expanded":n.controlsVisible?"true":"false","aria-label":t.$translate("View"),class:"tify-header-button",title:t.$translate("View"),onClick:s[7]||(s[7]=ct((...K)=>r.toggleControlsPopup&&r.toggleControlsPopup(...K),["stop"]))},[te(P)],8,dp)],512)]),ke((L(),D("div",{id:t.$store.getId("controls"),class:xe(["tify-header-column -controls",{"-visible":n.controlsVisible}])},[F("div",pp,[t.$store.manifest?(L(),D("button",{key:0,type:"button",class:xe(["tify-header-button -scan",{"-active":t.$store.options.view==="scan"}]),"aria-controls":t.$store.getId("scan"),"aria-expanded":t.$store.options.view==="scan"?"true":"false",onClick:s[8]||(s[8]=K=>r.toggleView("scan"))},[te(C),Ee(" "+Z(t.$translate("Scan")),1)],10,gp)):se("",!0),e.fulltextEnabled?(L(),D("button",{key:1,type:"button",class:xe(["tify-header-button",{"-active":t.$store.options.view==="fulltext"}]),"aria-controls":t.$store.getId("fulltext"),"aria-expanded":t.$store.options.view==="fulltext"?"true":"false",onClick:s[9]||(s[9]=K=>r.toggleView("fulltext"))},[te(k),Ee(" "+Z(t.$translate("Fulltext")),1)],10,mp)):se("",!0),t.$store.manifest?(L(),D("button",{key:2,type:"button",class:xe(["tify-header-button",{"-active":t.$store.options.view==="thumbnails"}]),"aria-controls":t.$store.getId("thumbnails"),"aria-expanded":t.$store.options.view==="thumbnails"?"true":"false",onClick:s[10]||(s[10]=K=>r.toggleView("thumbnails"))},[te(a),Ee(" "+Z(t.$translate("Pages")),1)],10,vp)):se("",!0),e.tocEnabled?(L(),D("button",{key:3,type:"button",class:xe(["tify-header-button",{"-active":t.$store.options.view==="toc"}]),"aria-controls":t.$store.getId("toc"),"aria-expanded":t.$store.options.view==="toc"?"true":"false",onClick:s[11]||(s[11]=K=>r.toggleView("toc"))},[te(d),Ee(" "+Z(t.$translate("Contents")),1)],10,yp)):se("",!0),F("button",{type:"button",class:xe(["tify-header-button",{"-active":t.$store.options.view==="info"}]),"aria-controls":t.$store.getId("info"),"aria-expanded":t.$store.options.view==="info"?"true":"false",onClick:s[12]||(s[12]=K=>r.toggleView("info"))},[te(_),Ee(" "+Z(t.$translate("Info")),1)],10,wp),t.$store.manifest?(L(),D("button",{key:4,type:"button",class:xe(["tify-header-button",{"-active":t.$store.options.view==="export"}]),"aria-controls":t.$store.getId("export"),"aria-expanded":t.$store.options.view==="export"?"true":"false",onClick:s[13]||(s[13]=K=>r.toggleView("export"))},[te(S),Ee(" "+Z(t.$translate("Export")),1)],10,_p)):se("",!0),t.$store.collection?(L(),D("button",{key:5,type:"button",class:xe(["tify-header-button",{"-active":t.$store.options.view==="collection"}]),"aria-controls":t.$store.getId("collection"),"aria-expanded":t.$store.options==="collection"?"true":"false",onClick:s[14]||(s[14]=K=>r.toggleView("collection"))},[te(M),Ee(" "+Z(t.$translate("Collection")),1)],10,Tp)):se("",!0)]),r.fullscreenSupported?(L(),D("div",xp,[F("button",{type:"button",class:xe(["tify-header-button -icon-only",{"-active":t.$store.options.view==="help"}]),"aria-controls":t.$store.getId("help"),"aria-expanded":t.$store.options.view==="help"?"true":"false",title:t.$translate("Help"),onClick:s[15]||(s[15]=K=>r.toggleView("help"))},[te(I),Ee(" "+Z(t.$translate("Help")),1)],10,bp),n.fullscreenActive?(L(),D("button",{key:1,type:"button",class:"tify-header-button -icon-only",title:t.$translate("Exit fullscreen"),onClick:s[17]||(s[17]=(...K)=>r.toggleFullscreen&&r.toggleFullscreen(...K))},[te(j),Ee(" "+Z(t.$translate("Exit fullscreen")),1)],8,Pp)):(L(),D("button",{key:0,type:"button",class:"tify-header-button -icon-only",title:t.$translate("Fullscreen"),onClick:s[16]||(s[16]=(...K)=>r.toggleFullscreen&&r.toggleFullscreen(...K))},[te(V),Ee(" "+Z(t.$translate("Fullscreen")),1)],8,Ep))])):se("",!0),t.$store.manifest?(L(),D("div",Sp,[F("button",{type:"button",class:"tify-header-button",disabled:t.$store.isCustomPageView||t.$store.isFirstPage,title:t.$translate("First page"),onClick:s[18]||(s[18]=K=>t.$store.goToFirstPage())},[te(u)],8,Cp),t.$store.manifest.structures?(L(),D("button",{key:0,type:"button",class:"tify-header-button",disabled:t.$store.isCustomPageView||t.$store.isFirstPage,title:t.$translate("Previous section"),onClick:s[19]||(s[19]=K=>t.$store.goToPreviousSection())},[te(h)],8,Rp)):se("",!0),F("button",{type:"button",class:"tify-header-button",disabled:t.$store.isCustomPageView||t.$store.isFirstPage,title:t.$translate("Previous page"),onClick:s[20]||(s[20]=K=>t.$store.goToPreviousPage())},[te(g)],8,Hp),F("button",{type:"button",class:"tify-header-button",disabled:t.$store.isCustomPageView||t.$store.isLastPage,title:t.$translate("Next page"),onClick:s[21]||(s[21]=K=>t.$store.goToNextPage())},[te(m)],8,Op),t.$store.manifest.structures?(L(),D("button",{key:1,type:"button",class:"tify-header-button",disabled:t.$store.isCustomPageView||t.$store.isLastSection,title:t.$translate("Next section"),onClick:s[22]||(s[22]=K=>t.$store.goToNextSection())},[te(T)],8,Lp)):se("",!0),F("button",{type:"button",class:"tify-header-button",disabled:t.$store.isCustomPageView||t.$store.isLastPage,title:t.$translate("Last page"),onClick:s[23]||(s[23]=K=>t.$store.goToLastPage())},[te(x)],8,Mp)])):se("",!0)],10,fp)),[[q,r.closeControlsPopup]])])}const kp=ue(Yf,[["render",Dp]]);const Fp={props:{readyPromise:{type:Object,default:null}},data(){return{ready:!1}},computed:{hasOtherContent(){return this.$store.canvases.some(t=>"otherContent"in t)},hasToc(){return this.$store.manifest&&this.$store.manifest.structures&&this.$store.manifest.structures.length>0}},created(){this.$api.expose(this.setLanguage),this.$api.expose(this.$store.setPage)},mounted(){if(this.$store.rootElement=this.$el,!this.$store.options.manifestUrl){this.$store.addError('Missing option "manifestUrl"');return}this.updateBreakpoint(),new ResizeObserver(this.updateBreakpoint).observe(this.$el),Promise.all([this.$store.loadManifest(this.$store.options.manifestUrl),this.setLanguage(this.$store.options.language)]).then(()=>{this.$nextTick(()=>{this.ready=!0,this.readyPromise.resolve()})},t=>{this.readyPromise.reject(t)})},beforeUnmount(){clearTimeout(this.$store.urlUpdateTimeout),window.removeEventListener("popstate",this.$store.initOptions)},methods:{setLanguage(t){let s,e;const i=new Promise((r,l)=>{s=r,e=l});if(t==="en")return this.$store.options.language="en",this.$translate.setTranslation(null),s(t),i;if(this.$store.options.translationsDirUrl===null)return e(new Error("Could not determine translationsDirUrl")),i;const n=`${this.$store.options.translationsDirUrl}/${t}.json`;return this.$store.fetchJson(n).then(r=>{this.$store.options.language=t,this.$translate.setTranslation(r),s(t)},r=>{const l=r.response?r.response.statusText:r.message;this.$store.addError(`Error loading translation for "${t}": ${l}`),e(new Error(r))}),i},updateBreakpoint(){Object.keys(this.$store.options.breakpoints).forEach(t=>{this.$el.clientWidth<=this.$store.options.breakpoints[t]?this.$el.classList.add(`-${t}`):this.$el.classList.remove(`-${t}`)}),this.$el.clientHeight<520?this.$el.classList.add("-short"):this.$el.classList.remove("-short")}}},Ap={class:"tify",tabindex:"-1"},Bp={key:1,class:"tify-main"},Ip=["aria-label"],zp={key:3,class:"tify-error"},Np=["aria-label"],Vp={class:"tify-error-messages"};function Up(t,s,e,i,n,r){const l=kp,a=Yh,o=mc,u=oc,h=Ju,g=Gu,m=gu,T=El,x=Ya,P=Js;return L(),D("article",Ap,[n.ready&&(t.$store.collection||t.$store.manifest)?(L(),Me(l,{key:0,"fulltext-enabled":r.hasOtherContent,"toc-enabled":r.hasToc},null,8,["fulltext-enabled","toc-enabled"])):se("",!0),n.ready?(L(),D("div",Bp,[t.$store.manifest?(L(),D(de,{key:0},[te(a,{id:t.$store.getId("scan")},null,8,["id"]),r.hasOtherContent?ke((L(),Me(o,{key:0,id:t.$store.getId("fulltext")},null,8,["id"])),[[Ye,t.$store.options.view==="fulltext"]]):se("",!0),ke(te(u,{id:t.$store.getId("thumbnails")},null,8,["id"]),[[Ye,t.$store.options.view==="thumbnails"]]),r.hasToc?ke((L(),Me(h,{key:1,id:t.$store.getId("toc")},null,8,["id"])),[[Ye,t.$store.options.view==="toc"]]):se("",!0),ke(te(g,{id:t.$store.getId("export")},null,8,["id"]),[[Ye,t.$store.options.view==="export"]])],64)):se("",!0),t.$store.collection||t.$store.manifest?ke((L(),Me(m,{key:1,id:t.$store.getId("info")},null,8,["id"])),[[Ye,t.$store.options.view==="info"]]):se("",!0),t.$store.collection?ke((L(),Me(T,{key:2,id:t.$store.getId("collection")},null,8,["id"])),[[Ye,t.$store.options.view==="collection"]]):se("",!0),ke(te(x,{id:t.$store.getId("help")},null,8,["id"]),[[Ye,t.$store.options.view==="help"]])])):se("",!0),t.$store.loading?(L(),D("div",{key:2,class:"tify-loading","aria-label":t.$translate("Loading")},null,8,Ip)):se("",!0),t.$store.errors.length?(L(),D("section",zp,[F("button",{type:"button",class:"tify-error-close","aria-label":t.$translate("Dismiss"),onClick:s[0]||(s[0]=C=>t.$store.clearErrors())},[te(P)],8,Np),F("div",Vp,[(L(!0),D(de,null,Pe(t.$store.errors,C=>(L(),D("p",{key:C},Z(C),1))),128))])])):se("",!0)])}const Wp=ue(Fp,[["render",Up]]);function jp(t){return{expose(s,e){t[e||s.name.replace("bound ","")]=s}}}const Gp={install:(t,s)=>{t.config.globalProperties.$api=new jp(s.instance)}},qp={install:t=>{let s=null;t.config.globalProperties.$translate=(e,i)=>s&&s[e]?s[e]:i||e,t.config.globalProperties.$translate.setTranslation=e=>{s=e}}};function Zp(t){const s=`tify-${Math.floor(Math.random()*Date.now())}`,e=vi({collection:null,errors:[],loading:0,manifest:t.manifest||null,options:t.options||{},rootElement:t.rootElement||null,urlUpdateTimeout:null,canvases:Xe(()=>e.manifest&&e.manifest.sequences?e.manifest.sequences[0].canvases:[]),currentStructure:Xe(()=>{if(!Array.isArray(e.manifest.structures))return!1;const i=[];e.options.pages.forEach(a=>{a&&i.push(e.manifest.sequences[0].canvases[a-1]["@id"])});const{length:n}=e.manifest.structures;let r,l;for(let a=0;ai.includes(h))&&o.firstPage&&o.lastPage){const h=o.lastPage-o.firstPage;if((h=0?e.manifest.structures[r]:!1}),isCustomPageView:Xe(()=>{const{pages:i}=e.options;return i?i.length>2||i.length===2&&(i[0]%2>0||i[1]!==i[0]+1)&&i[1]>0:!1}),isFirstPage:Xe(()=>e.options.pages[0]<2),isLastPage:Xe(()=>{const{pages:i}=e.options;return i[0]>=e.pageCount||i[i.length-1]>=e.pageCount}),isLastSection:Xe(()=>{const{pages:i}=e.options,n=i.length-1;return(i[n]?i[n]:i[n-1])>=e.sections[e.sections.length-1].firstPage}),pageCount:Xe(()=>e.canvases.length),sections:Xe(()=>{const i=[];return e.manifest.structures&&e.manifest.structures.forEach(n=>{if(!n.canvases){i.push({firstPage:1,lastPage:e.pageCount});return}const r=n.canvases[0],l=e.canvases.findIndex(u=>u["@id"]===r)+1,a=n.canvases[n.canvases.length-1],o=e.canvases.findIndex(u=>u["@id"]===a)+1;i.push({firstPage:l,lastPage:o})}),i}),structures:Xe(()=>{if(!e.manifest.structures)return[];const i=[],n=[],{canvases:r}=e.manifest.sequences[0],{length:l}=e.manifest.structures;for(let u=0;ux["@id"]===g)+1;const m=h.canvases[h.canvases.length-1];h.lastPage=r.findIndex(x=>x["@id"]===m)+1;const T=r[h.firstPage-1];if(!T)continue;h.pageLabel=T.label}else r[0]&&(h.firstPage=1,h.lastPage=e.pageCount,h.pageLabel=r[0].label);h.pageCount=h.lastPage-h.firstPage+1,h.within&&n.push(h),i.push(h)}}const a=n.length;for(let u=0;ug.firstPage-m.firstPage))}return i.filter(u=>!u.within).sort((u,h)=>u.firstPage-h.firstPage)}),addError(i){e.errors.push(i)},clearErrors(){e.errors=[]},convertValueToArray(i){if(!e.options.language)throw new Error("language not set");if(!(i instanceof Array)){if(typeof i=="object"){if(i["@value"])return[ut(i["@value"])];if(i["@id"]){const a=ut(i["@id"]);return[{"@id":a,label:i.label?ut(i.label):a}]}return["(Invalid value)"]}return[ut(i)]}const n=[],r={};i.forEach(a=>{typeof a=="string"||a["@id"]&&a.label?n.push(a):a&&typeof a!="object"?n.push(ut(a)):a["@language"]&&a["@value"]&&(r.fallback||(r.fallback=a["@value"]),a["@language"].indexOf("en")===0?r.en=a["@value"]:e.options.language&&a["@language"]===e.options.language&&(r.preferred=a["@value"]))});const l=r.preferred||r.en||r.fallback||null;return l&&n.push(ut(l)),n},async fetchJson(i){e.loading+=1;const r=await(await fetch(i).catch(l=>(e.loading=0,Promise.reject(l)))).json().catch(l=>(e.loading=0,Promise.reject(l)));return e.loading>0&&(e.loading-=1),r},async fetchText(i){e.loading+=1;const r=await(await fetch(i).catch(l=>(e.loading=0,Promise.reject(l)))).text().catch(l=>(e.loading=0,Promise.reject(l)));return e.loading>0&&(e.loading-=1),r},getId(i){return s+(i?`-${i}`:"")},getPageLabel(i,n){return e.options.pageLabelFormat.replace("P",i).replace("L",n)},getStartPage(){const{startCanvas:i}=e.manifest.sequences[0],n=e.canvases.findIndex(r=>r["@id"]===i);return n>=0?n+1:1},goToFirstPage(){e.setPage(1)},goToNextPage(){let i=e.options.pages[0]+1;e.options.pages.length>1&&i%2>0&&i=this.sections[l].firstPage||r&&r>=this.sections[l].firstPage;)l+=1;e.setPage(this.sections[l].firstPage)},goToLastPage(){e.setPage(e.pageCount)},goToPreviousPage(){let i=e.options.pages[0]-1;e.options.pages.length>1&&i%2>0&&i>0&&(i-=1),e.setPage(i)},goToPreviousSection(){const{pages:i}=e.options,n=i[0]?i[0]:i[1];let r=this.sections.length-1;for(;n<=this.sections[r].firstPage||n&&n<=this.sections[r].firstPage;)r-=1;e.setPage(this.sections[r].firstPage)},initOptions(i){let n={};if(e.options.urlQueryKey)try{const r=new URLSearchParams(window.location.search);n=JSON.parse(r.get(e.options.urlQueryKey))||{}}catch{}n.view===""&&e.isMobile()&&(n.view="scan"),n.pages&&!ts(n.pages,e.pageCount)&&(e.addError("Invalid pages, reset to start page"),n.pages=null),e.options.childManifestUrl=n.childManifestUrl||e.options.childManifestUrl,e.options.filters=n.filters||e.options.filters,e.options.pages=i&&i.type==="popstate"?n.pages||[e.getStartPage()]:n.pages||e.options.pages||[e.getStartPage()],e.options.pan=n.panX||n.panY?{x:n.panX,y:n.panY}:n.pan||e.options.pan,e.options.rotation=parseInt(n.rotation,10)||e.options.rotation,e.options.view=n.view||n.view===""?n.view:e.options.view,e.options.zoom=parseFloat(n.zoom)||e.options.zoom},isMobile(){return e.rootElement.offsetWidth{r=o,l=u});return e.fetchJson(i).then(async o=>{if(n.expectedType&&o["@type"]!==n.expectedType){const h=`Expected manifest of type ${n.expectedType}, but got ${o["@type"]}`;return e.addError(h),l(h),a}if(e.manifest=null,await Es(),o["@type"]==="sc:Manifest")return e.manifest=o,e.initOptions(),window.addEventListener("popstate",e.initOptions),n.reset&&e.updateOptions({childManifestUrl:i,pages:[e.getStartPage()],pan:{},rotation:null,view:e.isMobile()?"scan":"collection",zoom:null}),r(),a;if(o["@type"]==="sc:Collection"){e.collection=o;const h=new URLSearchParams(window.location.search);let g={};try{g=JSON.parse(h.get(e.options.urlQueryKey))||{}}catch{}let m="";if(e.options.urlQueryParams.includes("childManifestUrl")&&g.childManifestUrl?m=g.childManifestUrl:e.collection.manifests&&e.options.childManifestAutoloaded&&(m=e.collection.manifests[0]["@id"]),m)await e.loadManifest(m,{expectedType:"sc:Manifest"}),e.updateOptions({childManifestUrl:m});else{const T=g.view||e.options.view;e.updateOptions({view:["collection","help","info"].includes(T)?T:"collection"})}return r(),a}const u="Please provide a valid IIIF Presentation API 2.x manifest";return e.addError(u),l(u),a},o=>{const h=`Error loading IIIF manifest: ${o.response&&(o.response.statusText||o.response.data)||o.message}`;return e.addError(h),l(h),a})},setPage(i){let n=i;if(Array.isArray(i)||(n=[i]),!ts(n,e.pageCount))throw new RangeError("Invalid pages");if(n.length===1&&e.options.pages&&e.options.pages[0]%2<1&&(e.options.pages[1]===e.options.pages[0]+1||e.options.pages[1]===0)){const r=n[0]%2>0?n[0]-1:n[0];n=[r,r===e.pageCount?0:r+1]}return e.updateOptions({pages:n}),n},updateOptions(i){Object.assign(e.options,i),clearTimeout(e.urlUpdateTimeout),e.options.urlQueryKey&&(e.urlUpdateTimeout=setTimeout(()=>{const n={};e.options.urlQueryParams.forEach(l=>{const a=e.options[l];a===null||l==="pages"&&a.length<2&&a[0]<2||typeof a=="object"&&!Object.keys(a).length?delete n[l]:n[l]=e.options[l]});const r=new URL(window.location);Object.keys(n).length?r.searchParams.set(e.options.urlQueryKey,JSON.stringify(n)):r.searchParams.delete(e.options.urlQueryKey),window.history&&(i.pages?(e.clearErrors(),window.history.pushState({},"",r)):window.history.replaceState({},"",r))},100))}});return e}const Kp={install:(t,s={})=>{t.config.globalProperties.$store=new Zp(s)}};window.Tify=function(s={}){const e={breakpoints:{tiny:359,small:719,medium:959,large:1199},childManifestAutoloaded:!0,childManifestUrl:null,container:null,filters:{},language:"en",manifestUrl:null,optionsResetOnPageChange:["pan"],pageLabelFormat:"P : L",pages:null,pan:{},rotation:null,translationsDirUrl:null,urlQueryKey:null,urlQueryParams:["childManifestUrl","filters","pages","pan","rotation","view","zoom"],view:"",viewer:{},zoom:null};if(this.options={...e,...s},!this.options.translationsDirUrl){const a=[...document.getElementsByTagName("script")].find(o=>o.src.includes("/tify"));if(a){const{src:o}=a;this.options.translationsDirUrl=`${o.substring(0,o.lastIndexOf("/"))}/translations`}}let i=null;this.ready=new Promise((l,a)=>{i={resolve:l,reject:a}});const n=this;this.app=Ma({render:()=>oa(Wp,{readyPromise:i})}).use(Gp,{instance:n}).use(qp).use(Kp,{options:this.options});let r=!1;this.mount=l=>{if(r)throw new Error("TIFY is already mounted");const a=typeof l=="string"?document.querySelector(l):l;if(!a)throw new Error("Container element not found");window.getComputedStyle(a).position==="static"&&(a.style.position="relative"),this.app.mount(a),r=!0},this.destroy=()=>{this.app.unmount()},this.options.container&&this.mount(this.options.container)}; diff --git a/package-lock.json b/package-lock.json index 94707dc4..31307e8e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "tify", - "version": "0.29.0", + "version": "0.29.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "tify", - "version": "0.29.0", + "version": "0.29.1", "hasInstallScript": true, "license": "AGPL-3.0", "devDependencies": { diff --git a/package.json b/package.json index a9a4b96e..b298c36f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "tify", - "version": "0.29.0", + "version": "0.29.1", "description": "A slim and mobile-friendly IIIF document viewer", "homepage": "https://tify.rocks/", "repository": {